@superdurable/connector-copper 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/dist/index.js CHANGED
@@ -1,7 +1,123 @@
1
1
  import {
2
+ CompaniesPageSchema,
3
+ CompanyMetadataSchema,
2
4
  ConfigSchema,
3
5
  Connection,
4
6
  ConnectorID,
7
+ CreateCompanyBranch,
8
+ CreateCompanyBranchCreated,
9
+ CreateCompanyBranchDefect,
10
+ CreateCompanyBranchProviderRejected,
11
+ CreateCompanyBranchUncertain,
12
+ CreateCompanyDefinition,
13
+ CreateCompanyInputSchema,
14
+ CreateCompanyMetadata,
15
+ CreateLeadBranch,
16
+ CreateLeadBranchCreated,
17
+ CreateLeadBranchDefect,
18
+ CreateLeadBranchProviderRejected,
19
+ CreateLeadBranchUncertain,
20
+ CreateLeadDefinition,
21
+ CreateLeadInputSchema,
22
+ CreateLeadMetadata,
23
+ CreateOpportunityBranch,
24
+ CreateOpportunityBranchCreated,
25
+ CreateOpportunityBranchDefect,
26
+ CreateOpportunityBranchProviderRejected,
27
+ CreateOpportunityBranchUncertain,
28
+ CreateOpportunityDefinition,
29
+ CreateOpportunityInputSchema,
30
+ CreateOpportunityMetadata,
31
+ CreatePersonBranch,
32
+ CreatePersonBranchCreated,
33
+ CreatePersonBranchDefect,
34
+ CreatePersonBranchProviderRejected,
35
+ CreatePersonBranchUncertain,
36
+ CreatePersonDefinition,
37
+ CreatePersonInputSchema,
38
+ CreatePersonMetadata,
39
+ CreateProjectBranch,
40
+ CreateProjectBranchCreated,
41
+ CreateProjectBranchDefect,
42
+ CreateProjectBranchProviderRejected,
43
+ CreateProjectBranchUncertain,
44
+ CreateProjectDefinition,
45
+ CreateProjectInputSchema,
46
+ CreateProjectMetadata,
47
+ CreateTaskBranch,
48
+ CreateTaskBranchCreated,
49
+ CreateTaskBranchDefect,
50
+ CreateTaskBranchProviderRejected,
51
+ CreateTaskBranchUncertain,
52
+ CreateTaskDefinition,
53
+ CreateTaskInputSchema,
54
+ CreateTaskMetadata,
55
+ CredentialMaterialError,
56
+ CustomerSourceMetadataSchema,
57
+ CustomerSourcesListSchema,
58
+ DeleteCompanyBranch,
59
+ DeleteCompanyBranchDefect,
60
+ DeleteCompanyBranchDeleted,
61
+ DeleteCompanyBranchNotFound,
62
+ DeleteCompanyBranchProviderRejected,
63
+ DeleteCompanyDefinition,
64
+ DeleteCompanyInputSchema,
65
+ DeleteCompanyMetadata,
66
+ DeleteCompanyOutputSchema,
67
+ DeleteLeadBranch,
68
+ DeleteLeadBranchDefect,
69
+ DeleteLeadBranchDeleted,
70
+ DeleteLeadBranchNotFound,
71
+ DeleteLeadBranchProviderRejected,
72
+ DeleteLeadDefinition,
73
+ DeleteLeadInputSchema,
74
+ DeleteLeadMetadata,
75
+ DeleteLeadOutputSchema,
76
+ DeleteOpportunityBranch,
77
+ DeleteOpportunityBranchDefect,
78
+ DeleteOpportunityBranchDeleted,
79
+ DeleteOpportunityBranchNotFound,
80
+ DeleteOpportunityBranchProviderRejected,
81
+ DeleteOpportunityDefinition,
82
+ DeleteOpportunityInputSchema,
83
+ DeleteOpportunityMetadata,
84
+ DeleteOpportunityOutputSchema,
85
+ DeletePersonBranch,
86
+ DeletePersonBranchDefect,
87
+ DeletePersonBranchDeleted,
88
+ DeletePersonBranchNotFound,
89
+ DeletePersonBranchProviderRejected,
90
+ DeletePersonDefinition,
91
+ DeletePersonInputSchema,
92
+ DeletePersonMetadata,
93
+ DeletePersonOutputSchema,
94
+ DeleteProjectBranch,
95
+ DeleteProjectBranchDefect,
96
+ DeleteProjectBranchDeleted,
97
+ DeleteProjectBranchNotFound,
98
+ DeleteProjectBranchProviderRejected,
99
+ DeleteProjectDefinition,
100
+ DeleteProjectInputSchema,
101
+ DeleteProjectMetadata,
102
+ DeleteProjectOutputSchema,
103
+ DeleteTaskBranch,
104
+ DeleteTaskBranchDefect,
105
+ DeleteTaskBranchDeleted,
106
+ DeleteTaskBranchNotFound,
107
+ DeleteTaskBranchProviderRejected,
108
+ DeleteTaskDefinition,
109
+ DeleteTaskInputSchema,
110
+ DeleteTaskMetadata,
111
+ DeleteTaskOutputSchema,
112
+ GetCompanyBranch,
113
+ GetCompanyBranchDefect,
114
+ GetCompanyBranchFound,
115
+ GetCompanyBranchInvalidResponse,
116
+ GetCompanyBranchNotFound,
117
+ GetCompanyBranchProviderRejected,
118
+ GetCompanyDefinition,
119
+ GetCompanyInputSchema,
120
+ GetCompanyMetadata,
5
121
  GetLeadBranch,
6
122
  GetLeadBranchDefect,
7
123
  GetLeadBranchFound,
@@ -11,9 +127,62 @@ import {
11
127
  GetLeadDefinition,
12
128
  GetLeadInputSchema,
13
129
  GetLeadMetadata,
130
+ GetOpportunityBranch,
131
+ GetOpportunityBranchDefect,
132
+ GetOpportunityBranchFound,
133
+ GetOpportunityBranchInvalidResponse,
134
+ GetOpportunityBranchNotFound,
135
+ GetOpportunityBranchProviderRejected,
136
+ GetOpportunityDefinition,
137
+ GetOpportunityInputSchema,
138
+ GetOpportunityMetadata,
139
+ GetPersonBranch,
140
+ GetPersonBranchDefect,
141
+ GetPersonBranchFound,
142
+ GetPersonBranchInvalidResponse,
143
+ GetPersonBranchNotFound,
144
+ GetPersonBranchProviderRejected,
145
+ GetPersonDefinition,
146
+ GetPersonInputSchema,
147
+ GetPersonMetadata,
148
+ GetProjectBranch,
149
+ GetProjectBranchDefect,
150
+ GetProjectBranchFound,
151
+ GetProjectBranchInvalidResponse,
152
+ GetProjectBranchNotFound,
153
+ GetProjectBranchProviderRejected,
154
+ GetProjectDefinition,
155
+ GetProjectInputSchema,
156
+ GetProjectMetadata,
157
+ GetTaskBranch,
158
+ GetTaskBranchDefect,
159
+ GetTaskBranchFound,
160
+ GetTaskBranchInvalidResponse,
161
+ GetTaskBranchNotFound,
162
+ GetTaskBranchProviderRejected,
163
+ GetTaskDefinition,
164
+ GetTaskInputSchema,
165
+ GetTaskMetadata,
14
166
  LeadMetadataSchema,
15
167
  LeadStatusMetadataSchema,
16
168
  LeadStatusesListSchema,
169
+ LeadsPageSchema,
170
+ ListCompaniesBranch,
171
+ ListCompaniesBranchDefect,
172
+ ListCompaniesBranchInvalidResponse,
173
+ ListCompaniesBranchListed,
174
+ ListCompaniesBranchProviderRejected,
175
+ ListCompaniesDefinition,
176
+ ListCompaniesInputSchema,
177
+ ListCompaniesMetadata,
178
+ ListCustomerSourcesBranch,
179
+ ListCustomerSourcesBranchDefect,
180
+ ListCustomerSourcesBranchInvalidResponse,
181
+ ListCustomerSourcesBranchListed,
182
+ ListCustomerSourcesBranchProviderRejected,
183
+ ListCustomerSourcesDefinition,
184
+ ListCustomerSourcesInputSchema,
185
+ ListCustomerSourcesMetadata,
17
186
  ListLeadStatusesBranch,
18
187
  ListLeadStatusesBranchDefect,
19
188
  ListLeadStatusesBranchInvalidResponse,
@@ -22,15 +191,234 @@ import {
22
191
  ListLeadStatusesDefinition,
23
192
  ListLeadStatusesInputSchema,
24
193
  ListLeadStatusesMetadata,
194
+ ListLeadsBranch,
195
+ ListLeadsBranchDefect,
196
+ ListLeadsBranchInvalidResponse,
197
+ ListLeadsBranchListed,
198
+ ListLeadsBranchProviderRejected,
199
+ ListLeadsDefinition,
200
+ ListLeadsInputSchema,
201
+ ListLeadsMetadata,
202
+ ListOpportunitiesBranch,
203
+ ListOpportunitiesBranchDefect,
204
+ ListOpportunitiesBranchInvalidResponse,
205
+ ListOpportunitiesBranchListed,
206
+ ListOpportunitiesBranchProviderRejected,
207
+ ListOpportunitiesDefinition,
208
+ ListOpportunitiesInputSchema,
209
+ ListOpportunitiesMetadata,
210
+ ListPeopleBranch,
211
+ ListPeopleBranchDefect,
212
+ ListPeopleBranchInvalidResponse,
213
+ ListPeopleBranchListed,
214
+ ListPeopleBranchProviderRejected,
215
+ ListPeopleDefinition,
216
+ ListPeopleInputSchema,
217
+ ListPeopleMetadata,
218
+ ListProjectsBranch,
219
+ ListProjectsBranchDefect,
220
+ ListProjectsBranchInvalidResponse,
221
+ ListProjectsBranchListed,
222
+ ListProjectsBranchProviderRejected,
223
+ ListProjectsDefinition,
224
+ ListProjectsInputSchema,
225
+ ListProjectsMetadata,
226
+ ListTasksBranch,
227
+ ListTasksBranchDefect,
228
+ ListTasksBranchInvalidResponse,
229
+ ListTasksBranchListed,
230
+ ListTasksBranchProviderRejected,
231
+ ListTasksDefinition,
232
+ ListTasksInputSchema,
233
+ ListTasksMetadata,
234
+ ListUsersBranch,
235
+ ListUsersBranchDefect,
236
+ ListUsersBranchInvalidResponse,
237
+ ListUsersBranchListed,
238
+ ListUsersBranchProviderRejected,
239
+ ListUsersDefinition,
240
+ ListUsersInputSchema,
241
+ ListUsersMetadata,
242
+ OpportunitiesPageSchema,
243
+ OpportunityMetadataSchema,
244
+ PeoplePageSchema,
245
+ PersonMetadataSchema,
246
+ ProjectMetadataSchema,
247
+ ProjectsPageSchema,
25
248
  ProviderID,
249
+ TaskMetadataSchema,
250
+ TasksPageSchema,
251
+ UpdateCompanyBranch,
252
+ UpdateCompanyBranchDefect,
253
+ UpdateCompanyBranchNotFound,
254
+ UpdateCompanyBranchProviderRejected,
255
+ UpdateCompanyBranchUpdated,
256
+ UpdateCompanyDefinition,
257
+ UpdateCompanyInputSchema,
258
+ UpdateCompanyMetadata,
259
+ UpdateLeadBranch,
260
+ UpdateLeadBranchDefect,
261
+ UpdateLeadBranchNotFound,
262
+ UpdateLeadBranchProviderRejected,
263
+ UpdateLeadBranchUpdated,
264
+ UpdateLeadDefinition,
265
+ UpdateLeadInputSchema,
266
+ UpdateLeadMetadata,
267
+ UpdateOpportunityBranch,
268
+ UpdateOpportunityBranchDefect,
269
+ UpdateOpportunityBranchNotFound,
270
+ UpdateOpportunityBranchProviderRejected,
271
+ UpdateOpportunityBranchUpdated,
272
+ UpdateOpportunityDefinition,
273
+ UpdateOpportunityInputSchema,
274
+ UpdateOpportunityMetadata,
275
+ UpdatePersonBranch,
276
+ UpdatePersonBranchDefect,
277
+ UpdatePersonBranchNotFound,
278
+ UpdatePersonBranchProviderRejected,
279
+ UpdatePersonBranchUpdated,
280
+ UpdatePersonDefinition,
281
+ UpdatePersonInputSchema,
282
+ UpdatePersonMetadata,
283
+ UpdateProjectBranch,
284
+ UpdateProjectBranchDefect,
285
+ UpdateProjectBranchNotFound,
286
+ UpdateProjectBranchProviderRejected,
287
+ UpdateProjectBranchUpdated,
288
+ UpdateProjectDefinition,
289
+ UpdateProjectInputSchema,
290
+ UpdateProjectMetadata,
291
+ UpdateTaskBranch,
292
+ UpdateTaskBranchDefect,
293
+ UpdateTaskBranchNotFound,
294
+ UpdateTaskBranchProviderRejected,
295
+ UpdateTaskBranchUpdated,
296
+ UpdateTaskDefinition,
297
+ UpdateTaskInputSchema,
298
+ UpdateTaskMetadata,
299
+ UserMetadataSchema,
300
+ UsersPageSchema,
26
301
  decodeCredentials,
302
+ isCredentialMaterialError,
27
303
  newConnection,
28
304
  newConnectionWithOperations,
29
305
  newProjectConnection
30
- } from "./chunk-ND3EMY5U.js";
306
+ } from "./chunk-HEWAN7RM.js";
31
307
 
32
308
  // src/generated/steps.ts
33
- import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
309
+ import { goToBranch, newMutationStep, newQueryStep } from "@superdurable/connectors-sdk";
310
+ function newCreateCompanyStep(configuration) {
311
+ const { connection, connectionName, created, providerRejected, uncertain, defect, ...stepConfiguration } = configuration;
312
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
313
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createCompany(), connection: connection.reference, branches: [
314
+ goToBranch("created", created),
315
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
316
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
317
+ ...defect ? [goToBranch("defect", defect)] : []
318
+ ] });
319
+ }
320
+ function newGetCompanyStep(configuration) {
321
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
322
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
323
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getCompany(), connection: connection.reference, branches: [
324
+ goToBranch("found", found),
325
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
326
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
327
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
328
+ ...defect ? [goToBranch("defect", defect)] : []
329
+ ] });
330
+ }
331
+ function newListCompaniesStep(configuration) {
332
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
333
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
334
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listCompanies(), connection: connection.reference, branches: [
335
+ goToBranch("listed", listed),
336
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
337
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
338
+ ...defect ? [goToBranch("defect", defect)] : []
339
+ ] });
340
+ }
341
+ function newUpdateCompanyStep(configuration) {
342
+ const { connection, connectionName, updated, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
343
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
344
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateCompany(), connection: connection.reference, branches: [
345
+ goToBranch("updated", updated),
346
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
347
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
348
+ ...defect ? [goToBranch("defect", defect)] : []
349
+ ] });
350
+ }
351
+ function newDeleteCompanyStep(configuration) {
352
+ const { connection, connectionName, deleted, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
353
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
354
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteCompany(), connection: connection.reference, branches: [
355
+ goToBranch("deleted", deleted),
356
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
357
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
358
+ ...defect ? [goToBranch("defect", defect)] : []
359
+ ] });
360
+ }
361
+ function newCreatePersonStep(configuration) {
362
+ const { connection, connectionName, created, providerRejected, uncertain, defect, ...stepConfiguration } = configuration;
363
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
364
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createPerson(), connection: connection.reference, branches: [
365
+ goToBranch("created", created),
366
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
367
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
368
+ ...defect ? [goToBranch("defect", defect)] : []
369
+ ] });
370
+ }
371
+ function newGetPersonStep(configuration) {
372
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
373
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
374
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getPerson(), connection: connection.reference, branches: [
375
+ goToBranch("found", found),
376
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
377
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
378
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
379
+ ...defect ? [goToBranch("defect", defect)] : []
380
+ ] });
381
+ }
382
+ function newListPeopleStep(configuration) {
383
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
384
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
385
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listPeople(), connection: connection.reference, branches: [
386
+ goToBranch("listed", listed),
387
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
388
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
389
+ ...defect ? [goToBranch("defect", defect)] : []
390
+ ] });
391
+ }
392
+ function newUpdatePersonStep(configuration) {
393
+ const { connection, connectionName, updated, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
394
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
395
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updatePerson(), connection: connection.reference, branches: [
396
+ goToBranch("updated", updated),
397
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
398
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
399
+ ...defect ? [goToBranch("defect", defect)] : []
400
+ ] });
401
+ }
402
+ function newDeletePersonStep(configuration) {
403
+ const { connection, connectionName, deleted, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
404
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
405
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deletePerson(), connection: connection.reference, branches: [
406
+ goToBranch("deleted", deleted),
407
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
408
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
409
+ ...defect ? [goToBranch("defect", defect)] : []
410
+ ] });
411
+ }
412
+ function newListCustomerSourcesStep(configuration) {
413
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
414
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
415
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listCustomerSources(), connection: connection.reference, branches: [
416
+ goToBranch("listed", listed),
417
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
418
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
419
+ ...defect ? [goToBranch("defect", defect)] : []
420
+ ] });
421
+ }
34
422
  function newListLeadStatusesStep(configuration) {
35
423
  const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
36
424
  if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
@@ -41,25 +429,1010 @@ function newListLeadStatusesStep(configuration) {
41
429
  ...defect ? [goToBranch("defect", defect)] : []
42
430
  ] });
43
431
  }
44
- function newGetLeadStep(configuration) {
45
- const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
46
- if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
47
- return newQueryStep({ ...stepConfiguration, operation: connection.operations.getLead(), connection: connection.reference, branches: [
48
- goToBranch("found", found),
49
- ...notFound ? [goToBranch("notFound", notFound)] : [],
50
- ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
51
- ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
52
- ...defect ? [goToBranch("defect", defect)] : []
53
- ] });
432
+ function newListUsersStep(configuration) {
433
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
434
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
435
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listUsers(), connection: connection.reference, branches: [
436
+ goToBranch("listed", listed),
437
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
438
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
439
+ ...defect ? [goToBranch("defect", defect)] : []
440
+ ] });
441
+ }
442
+ function newCreateTaskStep(configuration) {
443
+ const { connection, connectionName, created, providerRejected, uncertain, defect, ...stepConfiguration } = configuration;
444
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
445
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createTask(), connection: connection.reference, branches: [
446
+ goToBranch("created", created),
447
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
448
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
449
+ ...defect ? [goToBranch("defect", defect)] : []
450
+ ] });
451
+ }
452
+ function newListTasksStep(configuration) {
453
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
454
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
455
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listTasks(), connection: connection.reference, branches: [
456
+ goToBranch("listed", listed),
457
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
458
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
459
+ ...defect ? [goToBranch("defect", defect)] : []
460
+ ] });
461
+ }
462
+ function newUpdateTaskStep(configuration) {
463
+ const { connection, connectionName, updated, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
464
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
465
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateTask(), connection: connection.reference, branches: [
466
+ goToBranch("updated", updated),
467
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
468
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
469
+ ...defect ? [goToBranch("defect", defect)] : []
470
+ ] });
471
+ }
472
+ function newDeleteTaskStep(configuration) {
473
+ const { connection, connectionName, deleted, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
474
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
475
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteTask(), connection: connection.reference, branches: [
476
+ goToBranch("deleted", deleted),
477
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
478
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
479
+ ...defect ? [goToBranch("defect", defect)] : []
480
+ ] });
481
+ }
482
+ function newGetTaskStep(configuration) {
483
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
484
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
485
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getTask(), connection: connection.reference, branches: [
486
+ goToBranch("found", found),
487
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
488
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
489
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
490
+ ...defect ? [goToBranch("defect", defect)] : []
491
+ ] });
492
+ }
493
+ function newCreateProjectStep(configuration) {
494
+ const { connection, connectionName, created, providerRejected, uncertain, defect, ...stepConfiguration } = configuration;
495
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
496
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createProject(), connection: connection.reference, branches: [
497
+ goToBranch("created", created),
498
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
499
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
500
+ ...defect ? [goToBranch("defect", defect)] : []
501
+ ] });
502
+ }
503
+ function newListProjectsStep(configuration) {
504
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
505
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
506
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listProjects(), connection: connection.reference, branches: [
507
+ goToBranch("listed", listed),
508
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
509
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
510
+ ...defect ? [goToBranch("defect", defect)] : []
511
+ ] });
512
+ }
513
+ function newUpdateProjectStep(configuration) {
514
+ const { connection, connectionName, updated, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
515
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
516
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateProject(), connection: connection.reference, branches: [
517
+ goToBranch("updated", updated),
518
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
519
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
520
+ ...defect ? [goToBranch("defect", defect)] : []
521
+ ] });
522
+ }
523
+ function newDeleteProjectStep(configuration) {
524
+ const { connection, connectionName, deleted, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
525
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
526
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteProject(), connection: connection.reference, branches: [
527
+ goToBranch("deleted", deleted),
528
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
529
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
530
+ ...defect ? [goToBranch("defect", defect)] : []
531
+ ] });
532
+ }
533
+ function newGetProjectStep(configuration) {
534
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
535
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
536
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getProject(), connection: connection.reference, branches: [
537
+ goToBranch("found", found),
538
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
539
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
540
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
541
+ ...defect ? [goToBranch("defect", defect)] : []
542
+ ] });
543
+ }
544
+ function newCreateOpportunityStep(configuration) {
545
+ const { connection, connectionName, created, providerRejected, uncertain, defect, ...stepConfiguration } = configuration;
546
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
547
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createOpportunity(), connection: connection.reference, branches: [
548
+ goToBranch("created", created),
549
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
550
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
551
+ ...defect ? [goToBranch("defect", defect)] : []
552
+ ] });
553
+ }
554
+ function newListOpportunitiesStep(configuration) {
555
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
556
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
557
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listOpportunities(), connection: connection.reference, branches: [
558
+ goToBranch("listed", listed),
559
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
560
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
561
+ ...defect ? [goToBranch("defect", defect)] : []
562
+ ] });
563
+ }
564
+ function newUpdateOpportunityStep(configuration) {
565
+ const { connection, connectionName, updated, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
566
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
567
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateOpportunity(), connection: connection.reference, branches: [
568
+ goToBranch("updated", updated),
569
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
570
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
571
+ ...defect ? [goToBranch("defect", defect)] : []
572
+ ] });
573
+ }
574
+ function newDeleteOpportunityStep(configuration) {
575
+ const { connection, connectionName, deleted, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
576
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
577
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteOpportunity(), connection: connection.reference, branches: [
578
+ goToBranch("deleted", deleted),
579
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
580
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
581
+ ...defect ? [goToBranch("defect", defect)] : []
582
+ ] });
583
+ }
584
+ function newGetOpportunityStep(configuration) {
585
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
586
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
587
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getOpportunity(), connection: connection.reference, branches: [
588
+ goToBranch("found", found),
589
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
590
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
591
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
592
+ ...defect ? [goToBranch("defect", defect)] : []
593
+ ] });
594
+ }
595
+ function newCreateLeadStep(configuration) {
596
+ const { connection, connectionName, created, providerRejected, uncertain, defect, ...stepConfiguration } = configuration;
597
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
598
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createLead(), connection: connection.reference, branches: [
599
+ goToBranch("created", created),
600
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
601
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
602
+ ...defect ? [goToBranch("defect", defect)] : []
603
+ ] });
604
+ }
605
+ function newListLeadsStep(configuration) {
606
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
607
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
608
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listLeads(), connection: connection.reference, branches: [
609
+ goToBranch("listed", listed),
610
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
611
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
612
+ ...defect ? [goToBranch("defect", defect)] : []
613
+ ] });
614
+ }
615
+ function newUpdateLeadStep(configuration) {
616
+ const { connection, connectionName, updated, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
617
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
618
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateLead(), connection: connection.reference, branches: [
619
+ goToBranch("updated", updated),
620
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
621
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
622
+ ...defect ? [goToBranch("defect", defect)] : []
623
+ ] });
624
+ }
625
+ function newDeleteLeadStep(configuration) {
626
+ const { connection, connectionName, deleted, notFound, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
627
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
628
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteLead(), connection: connection.reference, branches: [
629
+ goToBranch("deleted", deleted),
630
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
631
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
632
+ ...defect ? [goToBranch("defect", defect)] : []
633
+ ] });
634
+ }
635
+ function newGetLeadStep(configuration) {
636
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
637
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
638
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getLead(), connection: connection.reference, branches: [
639
+ goToBranch("found", found),
640
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
641
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
642
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
643
+ ...defect ? [goToBranch("defect", defect)] : []
644
+ ] });
645
+ }
646
+
647
+ // src/project.ts
648
+ import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
649
+ import { z } from "zod";
650
+
651
+ // src/client.ts
652
+ import { SecretString, newQueryBranch as newQueryBranch2, newQueryRetry as newQueryRetry2 } from "@superdurable/connectors-sdk";
653
+ import { BodyTooLargeError, ProviderTransportError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
654
+
655
+ // src/limited.ts
656
+ import { definitionMaxSends, newMutationBranch as newMutationBranch2, newMutationUncertain } from "@superdurable/connectors-sdk";
657
+ import { CheckpointError, DispatchNotAllowedError, InsufficientTimeError, newFence } from "@superdurable/connectors-sdk/singledispatch";
658
+
659
+ // src/mutations.ts
660
+ import { newMutationBranch, newMutationRetry } from "@superdurable/connectors-sdk";
661
+
662
+ // src/queries.ts
663
+ import { newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
664
+ var ResourceQuery = class {
665
+ constructor(client, contract, empty, branch) {
666
+ this.client = client;
667
+ this.contract = contract;
668
+ this.empty = empty;
669
+ this.branch = branch;
670
+ }
671
+ client;
672
+ contract;
673
+ empty;
674
+ branch;
675
+ /** Return the manifest-generated Query definition. */
676
+ definition() {
677
+ return this.contract;
678
+ }
679
+ async read(call, path, decode, payload) {
680
+ const operation = this.contract.operation.operationId;
681
+ const outcome = await this.client.exchange(call, operation, path, this.branch === "found", payload);
682
+ if (outcome.failure) return outcome.retry ? newQueryRetry(outcome.failure, outcome.retryAfterMs) : newQueryBranch(outcome.branch, this.empty(), {}, outcome.failure);
683
+ try {
684
+ return newQueryBranch(this.branch, decode(JSON.parse(Buffer.from(outcome.body).toString("utf8"))));
685
+ } catch {
686
+ return newQueryBranch(
687
+ "invalidResponse",
688
+ this.empty(),
689
+ {},
690
+ { provider: "copper", operation, kind: "PROTOCOL", message: "Copper returned invalid JSON" }
691
+ );
692
+ }
693
+ }
694
+ defect() {
695
+ return newQueryBranch("defect", this.empty(), {}, {
696
+ provider: "copper",
697
+ operation: this.contract.operation.operationId,
698
+ kind: "VALIDATION",
699
+ message: "Copper query input is invalid"
700
+ });
701
+ }
702
+ };
703
+ function object(raw) {
704
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new TypeError("Copper returned a non-object");
705
+ return raw;
706
+ }
707
+ function text(item, key) {
708
+ const value = item[key];
709
+ if (value == null) return "";
710
+ if (typeof value !== "string") throw new TypeError("Copper returned a non-string field");
711
+ return value;
712
+ }
713
+ function id(item) {
714
+ const value = item.id;
715
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1) throw new TypeError("Copper returned an invalid ID");
716
+ return value;
717
+ }
718
+ function workEmail(item) {
719
+ if (item.emails == null) return "";
720
+ if (!Array.isArray(item.emails)) throw new TypeError("Copper returned an invalid email list");
721
+ const addresses = item.emails.map((entry) => {
722
+ const address = object(entry ?? {});
723
+ return { category: text(address, "category"), email: text(address, "email") };
724
+ });
725
+ return addresses.find((address) => address.category === "work")?.email ?? "";
726
+ }
727
+ function decodeList(raw, decode) {
728
+ if (!Array.isArray(raw)) throw new TypeError("Copper returned a non-array search response");
729
+ return raw.map((entry) => decode(entry));
730
+ }
731
+ function pagePayload(pageNumber, pageSize) {
732
+ if (!Number.isInteger(pageNumber) || pageNumber < 0 || pageNumber > 5e3 || !Number.isInteger(pageSize) || pageSize < 0 || pageSize > 200) return void 0;
733
+ const payload = {};
734
+ if (pageNumber) payload.page_number = pageNumber;
735
+ if (pageSize) payload.page_size = pageSize;
736
+ return payload;
737
+ }
738
+ function isValidName(value) {
739
+ return Buffer.byteLength(value) <= 255 && !/[\r\n]/.test(value);
740
+ }
741
+ function isValidDomain(value) {
742
+ return Buffer.byteLength(value) <= 253 && value.includes(".") && !"@ /\\\r\n ".split("").some((c) => value.includes(c)) && value.trim() === value;
743
+ }
744
+ function isValidEmail(value) {
745
+ const parts = value.split("@");
746
+ return Buffer.byteLength(value) <= 254 && parts.length === 2 && !!parts[0] && !!parts[1]?.includes(".") && !" /\\\r\n ".split("").some((c) => value.includes(c)) && value.trim() === value;
747
+ }
748
+ function isValidID(value) {
749
+ if (typeof value !== "string" || /[^0-9]/.test(value)) return false;
750
+ const digits = value.replace(/^0+/, "");
751
+ return digits.length > 0 && digits.length <= 19 && BigInt(digits) <= 9223372036854775807n;
752
+ }
753
+ function decodeCompany(raw) {
754
+ const item = object(raw);
755
+ const name = text(item, "name");
756
+ const details = text(item, "details");
757
+ const emailDomain = text(item, "email_domain");
758
+ if (!name.trim()) throw new TypeError("Copper returned incomplete company metadata");
759
+ return { id: id(item), name, ...details ? { details } : {}, ...emailDomain ? { emailDomain } : {} };
760
+ }
761
+ function decodePerson(raw) {
762
+ const item = object(raw);
763
+ const name = text(item, "name");
764
+ const details = text(item, "details");
765
+ const email = workEmail(item);
766
+ if (!name.trim()) throw new TypeError("Copper returned incomplete person metadata");
767
+ return { id: id(item), name, ...details ? { details } : {}, ...email ? { email } : {} };
768
+ }
769
+ function decodeLead(raw) {
770
+ const item = object(raw);
771
+ const name = text(item, "name");
772
+ const status = text(item, "status");
773
+ const companyName = text(item, "company_name");
774
+ if (!name || !status) throw new TypeError("Copper returned incomplete lead metadata");
775
+ return { id: id(item), name, status, companyName };
776
+ }
777
+ function decodeTask(raw) {
778
+ const item = object(raw);
779
+ const name = text(item, "name");
780
+ const status = text(item, "status");
781
+ if (!name.trim() || !status.trim()) throw new TypeError("Copper returned incomplete task metadata");
782
+ return { id: id(item), name, status };
783
+ }
784
+ function decodeProject(raw) {
785
+ const item = object(raw);
786
+ const name = text(item, "name");
787
+ const status = text(item, "status");
788
+ if (!name.trim() || !status.trim()) throw new TypeError("Copper returned incomplete project metadata");
789
+ return { id: id(item), name, status };
790
+ }
791
+ function decodeOpportunity(raw) {
792
+ const item = object(raw);
793
+ const name = text(item, "name");
794
+ const status = text(item, "status");
795
+ if (!name.trim() || !status.trim()) throw new TypeError("Copper returned incomplete opportunity metadata");
796
+ return { id: id(item), name, status };
797
+ }
798
+ function decodeUser(raw) {
799
+ const item = object(raw);
800
+ const name = text(item, "name");
801
+ const email = text(item, "email");
802
+ if (!name.trim() || !email.trim()) throw new TypeError("Copper returned incomplete user metadata");
803
+ return { id: id(item), name, email };
804
+ }
805
+ function decodeCustomerSource(raw) {
806
+ const item = object(raw);
807
+ const name = text(item, "name");
808
+ if (!name.trim()) throw new TypeError("Copper returned incomplete customer_source metadata");
809
+ return { id: id(item), name };
810
+ }
811
+ var GetCompanyOperation = class extends ResourceQuery {
812
+ /** Bind the provider client. */
813
+ constructor(client) {
814
+ super(client, GetCompanyDefinition, () => ({ id: 0, name: "" }), "found");
815
+ }
816
+ /** Validate input and read a bounded provider response. */
817
+ async invoke(call, input) {
818
+ const identity = input.companyId;
819
+ if (!isValidID(identity)) return this.defect();
820
+ return this.read(call, `/companies/${identity}`, decodeCompany);
821
+ }
822
+ };
823
+ var ListCompaniesOperation = class extends ResourceQuery {
824
+ /** Bind the provider client. */
825
+ constructor(client) {
826
+ super(client, ListCompaniesDefinition, () => ({ "companies": [] }), "listed");
827
+ }
828
+ /** Validate input and read a bounded provider response. */
829
+ async invoke(call, input) {
830
+ const payload = pagePayload(input.pageNumber ?? 0, input.pageSize ?? 0);
831
+ if (!payload) return this.defect();
832
+ if (input.name) {
833
+ const value = input.name;
834
+ if (!isValidName(value)) return this.defect();
835
+ payload.name = value;
836
+ }
837
+ if (input.emailDomain) {
838
+ const value = input.emailDomain;
839
+ if (!isValidDomain(value)) return this.defect();
840
+ payload.email_domains = value;
841
+ }
842
+ return this.read(call, "/companies/search", (value) => ({ companies: decodeList(value, decodeCompany) }), payload);
843
+ }
844
+ };
845
+ var GetPersonOperation = class extends ResourceQuery {
846
+ /** Bind the provider client. */
847
+ constructor(client) {
848
+ super(client, GetPersonDefinition, () => ({ id: 0, name: "" }), "found");
849
+ }
850
+ /** Validate input and read a bounded provider response. */
851
+ async invoke(call, input) {
852
+ const identity = input.personId;
853
+ if (!isValidID(identity)) return this.defect();
854
+ return this.read(call, `/people/${identity}`, decodePerson);
855
+ }
856
+ };
857
+ var ListPeopleOperation = class extends ResourceQuery {
858
+ /** Bind the provider client. */
859
+ constructor(client) {
860
+ super(client, ListPeopleDefinition, () => ({ "people": [] }), "listed");
861
+ }
862
+ /** Validate input and read a bounded provider response. */
863
+ async invoke(call, input) {
864
+ const payload = pagePayload(input.pageNumber ?? 0, input.pageSize ?? 0);
865
+ if (!payload) return this.defect();
866
+ if (input.name) {
867
+ const value = input.name;
868
+ if (!isValidName(value)) return this.defect();
869
+ payload.name = value;
870
+ }
871
+ if (input.email) {
872
+ const value = input.email;
873
+ if (!(Buffer.byteLength(value) <= 254 && !/[\r\n]/.test(value))) return this.defect();
874
+ payload.emails = [value];
875
+ }
876
+ return this.read(call, "/people/search", (value) => ({ people: decodeList(value, decodePerson) }), payload);
877
+ }
878
+ };
879
+ var ListCustomerSourcesOperation = class extends ResourceQuery {
880
+ /** Bind the provider client. */
881
+ constructor(client) {
882
+ super(client, ListCustomerSourcesDefinition, () => ({ "sources": [] }), "listed");
883
+ }
884
+ /** Validate input and read a bounded provider response. */
885
+ async invoke(call, input) {
886
+ void input;
887
+ return this.read(call, "/customer_sources", (value) => ({ sources: decodeList(value, decodeCustomerSource) }));
888
+ }
889
+ };
890
+ var ListUsersOperation = class extends ResourceQuery {
891
+ /** Bind the provider client. */
892
+ constructor(client) {
893
+ super(client, ListUsersDefinition, () => ({ "users": [] }), "listed");
894
+ }
895
+ /** Validate input and read a bounded provider response. */
896
+ async invoke(call, input) {
897
+ const payload = pagePayload(input.pageNumber ?? 0, input.pageSize ?? 0);
898
+ if (!payload) return this.defect();
899
+ return this.read(call, "/users/search", (value) => ({ users: decodeList(value, decodeUser) }), payload);
900
+ }
901
+ };
902
+ var ListTasksOperation = class extends ResourceQuery {
903
+ /** Bind the provider client. */
904
+ constructor(client) {
905
+ super(client, ListTasksDefinition, () => ({ "tasks": [] }), "listed");
906
+ }
907
+ /** Validate input and read a bounded provider response. */
908
+ async invoke(call, input) {
909
+ const payload = pagePayload(input.pageNumber ?? 0, input.pageSize ?? 0);
910
+ if (!payload) return this.defect();
911
+ if (input.status) {
912
+ const value = input.status;
913
+ if (!["Open", "Completed"].includes(value)) return this.defect();
914
+ payload.statuses = [value];
915
+ }
916
+ return this.read(call, "/tasks/search", (value) => ({ tasks: decodeList(value, decodeTask) }), payload);
917
+ }
918
+ };
919
+ var GetTaskOperation = class extends ResourceQuery {
920
+ /** Bind the provider client. */
921
+ constructor(client) {
922
+ super(client, GetTaskDefinition, () => ({ "id": 0, "name": "", "status": "" }), "found");
923
+ }
924
+ /** Validate input and read a bounded provider response. */
925
+ async invoke(call, input) {
926
+ const identity = input.taskId;
927
+ if (!isValidID(identity)) return this.defect();
928
+ return this.read(call, `/tasks/${identity}`, decodeTask);
929
+ }
930
+ };
931
+ var ListProjectsOperation = class extends ResourceQuery {
932
+ /** Bind the provider client. */
933
+ constructor(client) {
934
+ super(client, ListProjectsDefinition, () => ({ "projects": [] }), "listed");
935
+ }
936
+ /** Validate input and read a bounded provider response. */
937
+ async invoke(call, input) {
938
+ const payload = pagePayload(input.pageNumber ?? 0, input.pageSize ?? 0);
939
+ if (!payload) return this.defect();
940
+ if (input.name) {
941
+ const value = input.name;
942
+ if (!isValidName(value)) return this.defect();
943
+ payload.name = value;
944
+ }
945
+ return this.read(call, "/projects/search", (value) => ({ projects: decodeList(value, decodeProject) }), payload);
946
+ }
947
+ };
948
+ var GetProjectOperation = class extends ResourceQuery {
949
+ /** Bind the provider client. */
950
+ constructor(client) {
951
+ super(client, GetProjectDefinition, () => ({ "id": 0, "name": "", "status": "" }), "found");
952
+ }
953
+ /** Validate input and read a bounded provider response. */
954
+ async invoke(call, input) {
955
+ const identity = input.projectId;
956
+ if (!isValidID(identity)) return this.defect();
957
+ return this.read(call, `/projects/${identity}`, decodeProject);
958
+ }
959
+ };
960
+ var ListOpportunitiesOperation = class extends ResourceQuery {
961
+ /** Bind the provider client. */
962
+ constructor(client) {
963
+ super(client, ListOpportunitiesDefinition, () => ({ "opportunities": [] }), "listed");
964
+ }
965
+ /** Validate input and read a bounded provider response. */
966
+ async invoke(call, input) {
967
+ const payload = pagePayload(input.pageNumber ?? 0, input.pageSize ?? 0);
968
+ if (!payload) return this.defect();
969
+ if (input.name) {
970
+ const value = input.name;
971
+ if (!isValidName(value)) return this.defect();
972
+ payload.name = value;
973
+ }
974
+ return this.read(call, "/opportunities/search", (value) => ({ opportunities: decodeList(value, decodeOpportunity) }), payload);
975
+ }
976
+ };
977
+ var GetOpportunityOperation = class extends ResourceQuery {
978
+ /** Bind the provider client. */
979
+ constructor(client) {
980
+ super(client, GetOpportunityDefinition, () => ({ "id": 0, "name": "", "status": "" }), "found");
981
+ }
982
+ /** Validate input and read a bounded provider response. */
983
+ async invoke(call, input) {
984
+ const identity = input.opportunityId;
985
+ if (!isValidID(identity)) return this.defect();
986
+ return this.read(call, `/opportunities/${identity}`, decodeOpportunity);
987
+ }
988
+ };
989
+ var ListLeadsOperation = class extends ResourceQuery {
990
+ /** Bind the provider client. */
991
+ constructor(client) {
992
+ super(client, ListLeadsDefinition, () => ({ "leads": [] }), "listed");
993
+ }
994
+ /** Validate input and read a bounded provider response. */
995
+ async invoke(call, input) {
996
+ const payload = pagePayload(input.pageNumber ?? 0, input.pageSize ?? 0);
997
+ if (!payload) return this.defect();
998
+ if (input.name) {
999
+ const value = input.name;
1000
+ if (!isValidName(value)) return this.defect();
1001
+ payload.name = value;
1002
+ }
1003
+ if (input.email) {
1004
+ const value = input.email;
1005
+ if (!isValidEmail(value)) return this.defect();
1006
+ payload.emails = value;
1007
+ }
1008
+ return this.read(call, "/leads/search", (value) => ({ leads: decodeList(value, decodeLead) }), payload);
1009
+ }
1010
+ };
1011
+
1012
+ // src/mutations.ts
1013
+ var refusalStatuses = /* @__PURE__ */ new Set([400, 401, 403, 404, 411, 413, 414, 415, 422]);
1014
+ var CopperMutation = class {
1015
+ constructor(client, contract, empty, branch) {
1016
+ this.client = client;
1017
+ this.contract = contract;
1018
+ this.empty = empty;
1019
+ this.branch = branch;
1020
+ }
1021
+ client;
1022
+ contract;
1023
+ empty;
1024
+ branch;
1025
+ /** Return the manifest-generated Mutation definition. */
1026
+ definition() {
1027
+ return this.contract;
1028
+ }
1029
+ /** Preserve the logical identity of a Dex write across retries. */
1030
+ idempotencyKey(callID, input) {
1031
+ void input;
1032
+ return callID;
1033
+ }
1034
+ async write(call, path, decode, payload) {
1035
+ const response = await this.client.request(call, payload === void 0 ? "DELETE" : "PUT", path, payload);
1036
+ if (response.error === "credential") return this.terminal("defect", "AUTHENTICATION", "Copper credentials are unavailable");
1037
+ if (response.error) return this.retry("TRANSPORT", "Copper request failed", response.retryAfterMs);
1038
+ if (response.status === 429) return this.retry("RATE_LIMIT", "Copper rate limited the write", response.retryAfterMs);
1039
+ if (response.status >= 400) {
1040
+ if (isDefiniteRefusal(response)) {
1041
+ const branch = response.status === 404 ? "notFound" : "providerRejected";
1042
+ return this.terminal(branch, "PROVIDER_REJECTION", "Copper rejected the write");
1043
+ }
1044
+ return this.retry("AVAILABILITY", "Copper write outcome is unknown", response.retryAfterMs);
1045
+ }
1046
+ if (response.status !== 200) return this.retry("PROTOCOL", "Copper did not confirm the write");
1047
+ try {
1048
+ return newMutationBranch(this.branch, decode(JSON.parse(Buffer.from(response.body).toString("utf8"))));
1049
+ } catch {
1050
+ return this.retry("PROTOCOL", "Copper returned an invalid write response");
1051
+ }
1052
+ }
1053
+ invalid() {
1054
+ return this.terminal("defect", "VALIDATION", "Copper write input is invalid");
1055
+ }
1056
+ terminal(branch, kind, message) {
1057
+ return newMutationBranch(branch, this.empty(), {}, this.failure(kind, message));
1058
+ }
1059
+ retry(kind, message, delay = 0) {
1060
+ return newMutationRetry(this.failure(kind, message), delay);
1061
+ }
1062
+ failure(kind, message) {
1063
+ return { provider: "copper", operation: this.contract.operation.operationId, kind, message };
1064
+ }
1065
+ };
1066
+ function isDefiniteRefusal(response) {
1067
+ if (response.error || !refusalStatuses.has(response.status)) return false;
1068
+ try {
1069
+ const answer = object(JSON.parse(Buffer.from(response.body).toString("utf8")));
1070
+ const fields = Object.fromEntries(Object.entries(answer).map(([key, value]) => [key.toLowerCase(), value]));
1071
+ const error = fields.error;
1072
+ return !Object.hasOwn(fields, "id") && error != null && error !== "" && (typeof error !== "object" || Object.keys(error).length > 0);
1073
+ } catch {
1074
+ return false;
1075
+ }
1076
+ }
1077
+ function deletedRecord(raw) {
1078
+ const item = object(raw);
1079
+ if (item.is_deleted !== true) throw new TypeError("Copper did not confirm deletion");
1080
+ return { id: id(item), deleted: true };
54
1081
  }
1082
+ var UpdateCompanyOperation = class extends CopperMutation {
1083
+ /** Bind the Copper provider client. */
1084
+ constructor(client) {
1085
+ super(client, UpdateCompanyDefinition, () => ({ "id": 0, "name": "" }), "updated");
1086
+ }
1087
+ /** Validate the write and send it to Copper. */
1088
+ async invoke(call, input) {
1089
+ const identity = input.companyId;
1090
+ if (!isValidID(identity) || !input.name.trim()) return this.invalid();
1091
+ return this.write(call, `/companies/${identity}`, decodeCompany, {
1092
+ name: input.name,
1093
+ details: input.details
1094
+ });
1095
+ }
1096
+ };
1097
+ var DeleteCompanyOperation = class extends CopperMutation {
1098
+ /** Bind the Copper provider client. */
1099
+ constructor(client) {
1100
+ super(client, DeleteCompanyDefinition, () => ({ "id": 0, "deleted": false }), "deleted");
1101
+ }
1102
+ /** Validate the write and send it to Copper. */
1103
+ async invoke(call, input) {
1104
+ const identity = input.companyId;
1105
+ if (!isValidID(identity)) return this.invalid();
1106
+ return this.write(call, `/companies/${identity}`, deletedRecord);
1107
+ }
1108
+ };
1109
+ var UpdatePersonOperation = class extends CopperMutation {
1110
+ /** Bind the Copper provider client. */
1111
+ constructor(client) {
1112
+ super(client, UpdatePersonDefinition, () => ({ "id": 0, "name": "" }), "updated");
1113
+ }
1114
+ /** Validate the write and send it to Copper. */
1115
+ async invoke(call, input) {
1116
+ const identity = input.personId;
1117
+ if (!isValidID(identity) || !input.name.trim()) return this.invalid();
1118
+ return this.write(call, `/people/${identity}`, decodePerson, {
1119
+ name: input.name,
1120
+ details: input.details
1121
+ });
1122
+ }
1123
+ };
1124
+ var DeletePersonOperation = class extends CopperMutation {
1125
+ /** Bind the Copper provider client. */
1126
+ constructor(client) {
1127
+ super(client, DeletePersonDefinition, () => ({ "id": 0, "deleted": false }), "deleted");
1128
+ }
1129
+ /** Validate the write and send it to Copper. */
1130
+ async invoke(call, input) {
1131
+ const identity = input.personId;
1132
+ if (!isValidID(identity)) return this.invalid();
1133
+ return this.write(call, `/people/${identity}`, deletedRecord);
1134
+ }
1135
+ };
1136
+ var UpdateTaskOperation = class extends CopperMutation {
1137
+ /** Bind the Copper provider client. */
1138
+ constructor(client) {
1139
+ super(client, UpdateTaskDefinition, () => ({ "id": 0, "name": "", "status": "" }), "updated");
1140
+ }
1141
+ /** Validate the write and send it to Copper. */
1142
+ async invoke(call, input) {
1143
+ const identity = input.taskId;
1144
+ if (!isValidID(identity) || !input.name.trim()) return this.invalid();
1145
+ return this.write(call, `/tasks/${identity}`, decodeTask, {
1146
+ name: input.name,
1147
+ details: input.details
1148
+ });
1149
+ }
1150
+ };
1151
+ var DeleteTaskOperation = class extends CopperMutation {
1152
+ /** Bind the Copper provider client. */
1153
+ constructor(client) {
1154
+ super(client, DeleteTaskDefinition, () => ({ "id": 0, "deleted": false }), "deleted");
1155
+ }
1156
+ /** Validate the write and send it to Copper. */
1157
+ async invoke(call, input) {
1158
+ const identity = input.taskId;
1159
+ if (!isValidID(identity)) return this.invalid();
1160
+ return this.write(call, `/tasks/${identity}`, deletedRecord);
1161
+ }
1162
+ };
1163
+ var UpdateProjectOperation = class extends CopperMutation {
1164
+ /** Bind the Copper provider client. */
1165
+ constructor(client) {
1166
+ super(client, UpdateProjectDefinition, () => ({ "id": 0, "name": "", "status": "" }), "updated");
1167
+ }
1168
+ /** Validate the write and send it to Copper. */
1169
+ async invoke(call, input) {
1170
+ const identity = input.projectId;
1171
+ if (!isValidID(identity) || !input.name.trim()) return this.invalid();
1172
+ return this.write(call, `/projects/${identity}`, decodeProject, {
1173
+ name: input.name,
1174
+ details: input.details
1175
+ });
1176
+ }
1177
+ };
1178
+ var DeleteProjectOperation = class extends CopperMutation {
1179
+ /** Bind the Copper provider client. */
1180
+ constructor(client) {
1181
+ super(client, DeleteProjectDefinition, () => ({ "id": 0, "deleted": false }), "deleted");
1182
+ }
1183
+ /** Validate the write and send it to Copper. */
1184
+ async invoke(call, input) {
1185
+ const identity = input.projectId;
1186
+ if (!isValidID(identity)) return this.invalid();
1187
+ return this.write(call, `/projects/${identity}`, deletedRecord);
1188
+ }
1189
+ };
1190
+ var UpdateOpportunityOperation = class extends CopperMutation {
1191
+ /** Bind the Copper provider client. */
1192
+ constructor(client) {
1193
+ super(client, UpdateOpportunityDefinition, () => ({ "id": 0, "name": "", "status": "" }), "updated");
1194
+ }
1195
+ /** Validate the write and send it to Copper. */
1196
+ async invoke(call, input) {
1197
+ const identity = input.opportunityId;
1198
+ if (!isValidID(identity) || !input.name.trim()) return this.invalid();
1199
+ return this.write(call, `/opportunities/${identity}`, decodeOpportunity, {
1200
+ name: input.name,
1201
+ details: input.details
1202
+ });
1203
+ }
1204
+ };
1205
+ var DeleteOpportunityOperation = class extends CopperMutation {
1206
+ /** Bind the Copper provider client. */
1207
+ constructor(client) {
1208
+ super(client, DeleteOpportunityDefinition, () => ({ "id": 0, "deleted": false }), "deleted");
1209
+ }
1210
+ /** Validate the write and send it to Copper. */
1211
+ async invoke(call, input) {
1212
+ const identity = input.opportunityId;
1213
+ if (!isValidID(identity)) return this.invalid();
1214
+ return this.write(call, `/opportunities/${identity}`, deletedRecord);
1215
+ }
1216
+ };
1217
+ var UpdateLeadOperation = class extends CopperMutation {
1218
+ /** Bind the Copper provider client. */
1219
+ constructor(client) {
1220
+ super(client, UpdateLeadDefinition, () => ({ "id": 0, "name": "", "status": "", "companyName": "" }), "updated");
1221
+ }
1222
+ /** Validate the write and send it to Copper. */
1223
+ async invoke(call, input) {
1224
+ const identity = input.leadId;
1225
+ if (!isValidID(identity) || !input.name.trim()) return this.invalid();
1226
+ return this.write(call, `/leads/${identity}`, decodeLead, {
1227
+ name: input.name,
1228
+ details: input.details
1229
+ });
1230
+ }
1231
+ };
1232
+ var DeleteLeadOperation = class extends CopperMutation {
1233
+ /** Bind the Copper provider client. */
1234
+ constructor(client) {
1235
+ super(client, DeleteLeadDefinition, () => ({ "id": 0, "deleted": false }), "deleted");
1236
+ }
1237
+ /** Validate the write and send it to Copper. */
1238
+ async invoke(call, input) {
1239
+ const identity = input.leadId;
1240
+ if (!isValidID(identity)) return this.invalid();
1241
+ return this.write(call, `/leads/${identity}`, deletedRecord);
1242
+ }
1243
+ };
55
1244
 
56
- // src/project.ts
57
- import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
58
- import { z } from "zod";
1245
+ // src/limited.ts
1246
+ var LimitedMutation = class extends CopperMutation {
1247
+ async create(call, path, payload, decode, recovery, requireCheckpoint = true) {
1248
+ const maxSends = call.maxSendsOverride ?? definitionMaxSends(this.contract);
1249
+ let fence;
1250
+ try {
1251
+ fence = newFence(call, this.contract.stepDefaults.executeMethodTimeoutMs ?? 3e4, { maxSends });
1252
+ } catch {
1253
+ return this.terminal("defect", "LOCAL_DEFECT", "Copper dispatch fence is unavailable");
1254
+ }
1255
+ const decision = await fence.decide();
1256
+ if (decision.kind === "failClosed") return this.retry("AVAILABILITY", "Copper dispatch checkpoint is unreadable");
1257
+ const prior = decision.priorSendUpperBound ?? 0;
1258
+ const providerID = decision.marker?.providerId ?? "";
1259
+ if (recovery && (prior > 0 || decision.kind !== "sendAllowed")) {
1260
+ const result = await this.readSearch(call, path, providerID, decode, recovery);
1261
+ if (result) return result;
1262
+ }
1263
+ if (decision.kind !== "sendAllowed" && !recovery && providerID) return this.readByID(call, path, providerID, decode);
1264
+ if (decision.kind === "readBackRequired") return this.uncertain();
1265
+ let response;
1266
+ try {
1267
+ response = await fence.dispatch((signal) => this.client.request(call, "POST", path, payload, signal));
1268
+ } catch (error) {
1269
+ if (error instanceof CheckpointError || error instanceof DispatchNotAllowedError || error instanceof InsufficientTimeError)
1270
+ return this.retry("AVAILABILITY", "Copper dispatch did not start");
1271
+ return this.retry("TRANSPORT", "Copper creation outcome is unknown");
1272
+ }
1273
+ if (response.status === 429 || response.status === 503) {
1274
+ try {
1275
+ await fence.recordCanResend();
1276
+ } catch {
1277
+ return this.retry("AVAILABILITY", "Copper retry checkpoint is unavailable");
1278
+ }
1279
+ return this.retry(response.status === 429 ? "RATE_LIMIT" : "AVAILABILITY", "Copper did not create the record", response.retryAfterMs);
1280
+ }
1281
+ if (response.error || response.status >= 500) return this.retry("TRANSPORT", "Copper creation outcome is unknown");
1282
+ if (response.status >= 400) {
1283
+ if (prior > 0 || !isDefiniteRefusal(response)) {
1284
+ if (prior + 1 >= maxSends) return this.uncertain();
1285
+ return this.retry("AVAILABILITY", "Copper creation outcome is unknown");
1286
+ }
1287
+ try {
1288
+ await fence.recordCanResend();
1289
+ } catch {
1290
+ return this.retry("AVAILABILITY", "Copper refusal checkpoint is unavailable");
1291
+ }
1292
+ return this.terminal("providerRejected", "PROVIDER_REJECTION", "Copper rejected creation");
1293
+ }
1294
+ let value;
1295
+ try {
1296
+ if (response.status !== 200) throw new TypeError("Copper did not confirm creation");
1297
+ value = decode(JSON.parse(Buffer.from(response.body).toString("utf8")));
1298
+ } catch {
1299
+ return this.retry("PROTOCOL", "Copper creation response is invalid");
1300
+ }
1301
+ try {
1302
+ await fence.recordProviderId(String(value.id));
1303
+ } catch {
1304
+ if (requireCheckpoint) return this.retry("AVAILABILITY", "Copper provider ID checkpoint is unavailable");
1305
+ }
1306
+ return newMutationBranch2(this.branch, value);
1307
+ }
1308
+ async readSearch(call, path, providerID, decode, recovery) {
1309
+ const response = await this.client.request(call, "POST", `${path}/search`, recovery.payload);
1310
+ if (readBackUnavailable(response)) return this.retry("AVAILABILITY", "Copper read-back is unavailable");
1311
+ if (response.status !== 200) return void 0;
1312
+ try {
1313
+ const records = JSON.parse(Buffer.from(response.body).toString("utf8"));
1314
+ if (records === null && path === "/people") return void 0;
1315
+ if (!Array.isArray(records)) throw new TypeError("Copper returned invalid search results");
1316
+ for (const record of records) {
1317
+ const value = decode(record);
1318
+ const match = recovery.matches(record, value);
1319
+ if (match === void 0) return void 0;
1320
+ if (match) return String(value.id) === providerID ? newMutationBranch2(this.branch, value) : void 0;
1321
+ }
1322
+ } catch {
1323
+ return this.retry("AVAILABILITY", "Copper read-back is unavailable");
1324
+ }
1325
+ return void 0;
1326
+ }
1327
+ async readByID(call, path, providerID, decode) {
1328
+ const response = await this.client.request(call, "GET", `${path}/${encodeURIComponent(providerID)}`, void 0, void 0, true);
1329
+ if (readBackUnavailable(response)) return this.retry("AVAILABILITY", "Copper read-back is unavailable", response.retryAfterMs);
1330
+ if (response.status === 200) {
1331
+ try {
1332
+ const value = decode(JSON.parse(Buffer.from(response.body).toString("utf8")));
1333
+ if (String(value.id) === providerID) return newMutationBranch2(this.branch, value);
1334
+ } catch {
1335
+ }
1336
+ }
1337
+ return this.uncertain();
1338
+ }
1339
+ uncertain() {
1340
+ return newMutationUncertain(this.empty(), this.failure("TRANSPORT", "Copper creation outcome is unknown"));
1341
+ }
1342
+ };
1343
+ function readBackUnavailable(response) {
1344
+ return Boolean(response.error) || response.status === 429 || response.status >= 500;
1345
+ }
1346
+ function leadEmail(value) {
1347
+ const raw = object(value).email;
1348
+ return raw == null ? "" : text(object(raw), "email");
1349
+ }
1350
+ var CreateCompanyOperation = class extends LimitedMutation {
1351
+ /** Bind the provider client. */
1352
+ constructor(client) {
1353
+ super(client, CreateCompanyDefinition, () => ({ "id": 0, "name": "" }), "created");
1354
+ }
1355
+ /** Validate input and dispatch a bounded create. */
1356
+ async invoke(call, input) {
1357
+ if (!input.name.trim() || Buffer.byteLength(input.name) > 255 || !isValidDomain(input.emailDomain)) return this.invalid();
1358
+ return this.create(call, "/companies", { name: input.name, email_domain: input.emailDomain }, decodeCompany, {
1359
+ payload: { email_domains: input.emailDomain },
1360
+ matches: (_, value) => {
1361
+ if (value.emailDomain?.toLowerCase() !== input.emailDomain.toLowerCase()) return false;
1362
+ return value.name === input.name ? true : void 0;
1363
+ }
1364
+ });
1365
+ }
1366
+ };
1367
+ var CreatePersonOperation = class extends LimitedMutation {
1368
+ /** Bind the provider client. */
1369
+ constructor(client) {
1370
+ super(client, CreatePersonDefinition, () => ({ "id": 0, "name": "" }), "created");
1371
+ }
1372
+ /** Validate input and dispatch a bounded create. */
1373
+ async invoke(call, input) {
1374
+ if (!input.name.trim() || !input.email.includes("@") || /[\r\n]/.test(input.email)) return this.invalid();
1375
+ return this.create(call, "/people", { name: input.name, emails: [{ email: input.email, category: "work" }] }, decodePerson, {
1376
+ payload: { email: input.email },
1377
+ matches: (_, value) => value.email?.toLowerCase() === input.email.toLowerCase() && value.name === input.name
1378
+ }, false);
1379
+ }
1380
+ };
1381
+ var CreateTaskOperation = class extends LimitedMutation {
1382
+ /** Bind the provider client. */
1383
+ constructor(client) {
1384
+ super(client, CreateTaskDefinition, () => ({ "id": 0, "name": "", "status": "" }), "created");
1385
+ }
1386
+ /** Validate input and dispatch a bounded create. */
1387
+ async invoke(call, input) {
1388
+ if (!input.name.trim() || Buffer.byteLength(input.name) > 255) return this.invalid();
1389
+ return this.create(call, "/tasks", { name: input.name }, decodeTask);
1390
+ }
1391
+ };
1392
+ var CreateProjectOperation = class extends LimitedMutation {
1393
+ /** Bind the provider client. */
1394
+ constructor(client) {
1395
+ super(client, CreateProjectDefinition, () => ({ "id": 0, "name": "", "status": "" }), "created");
1396
+ }
1397
+ /** Validate input and dispatch a bounded create. */
1398
+ async invoke(call, input) {
1399
+ if (!input.name.trim() || Buffer.byteLength(input.name) > 255) return this.invalid();
1400
+ return this.create(call, "/projects", { name: input.name }, decodeProject, {
1401
+ payload: { name: input.name },
1402
+ matches: (_, value) => value.name === input.name
1403
+ });
1404
+ }
1405
+ };
1406
+ var CreateOpportunityOperation = class extends LimitedMutation {
1407
+ /** Bind the provider client. */
1408
+ constructor(client) {
1409
+ super(client, CreateOpportunityDefinition, () => ({ "id": 0, "name": "", "status": "" }), "created");
1410
+ }
1411
+ /** Validate input and dispatch a bounded create. */
1412
+ async invoke(call, input) {
1413
+ if (!input.name.trim() || Buffer.byteLength(input.name) > 255) return this.invalid();
1414
+ return this.create(call, "/opportunities", { name: input.name }, decodeOpportunity, {
1415
+ payload: { name: input.name },
1416
+ matches: (_, value) => value.name === input.name
1417
+ });
1418
+ }
1419
+ };
1420
+ var CreateLeadOperation = class extends LimitedMutation {
1421
+ /** Bind the provider client. */
1422
+ constructor(client) {
1423
+ super(client, CreateLeadDefinition, () => ({ "id": 0, "name": "", "status": "", "companyName": "" }), "created");
1424
+ }
1425
+ /** Validate input and dispatch a bounded create. */
1426
+ async invoke(call, input) {
1427
+ if (!input.name.trim() || Buffer.byteLength(input.name) > 255 || !isValidEmail(input.email)) return this.invalid();
1428
+ return this.create(call, "/leads", { name: input.name, email: { email: input.email, category: "work" } }, decodeLead, {
1429
+ payload: { emails: input.email },
1430
+ matches: (raw, value) => leadEmail(raw).toLowerCase() === input.email.toLowerCase() && value.name === input.name
1431
+ });
1432
+ }
1433
+ };
59
1434
 
60
1435
  // src/client.ts
61
- import { SecretString, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
62
- import { BodyTooLargeError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
63
1436
  var emptyStatuses = () => ({ statuses: [] });
64
1437
  var emptyLead = () => ({ id: 0, name: "", status: "", companyName: "" });
65
1438
  var userAgent = "Dex Connector (https://superdurable.io)";
@@ -88,46 +1461,192 @@ var CopperClient = class {
88
1461
  getLead() {
89
1462
  return new GetLeadOperation(this);
90
1463
  }
1464
+ /** Bind the getCompany Query. */
1465
+ getCompany() {
1466
+ return new GetCompanyOperation(this);
1467
+ }
1468
+ /** Bind the listCompanies Query. */
1469
+ listCompanies() {
1470
+ return new ListCompaniesOperation(this);
1471
+ }
1472
+ /** Bind the getPerson Query. */
1473
+ getPerson() {
1474
+ return new GetPersonOperation(this);
1475
+ }
1476
+ /** Bind the listPeople Query. */
1477
+ listPeople() {
1478
+ return new ListPeopleOperation(this);
1479
+ }
1480
+ /** Bind the listCustomerSources Query. */
1481
+ listCustomerSources() {
1482
+ return new ListCustomerSourcesOperation(this);
1483
+ }
1484
+ /** Bind the listUsers Query. */
1485
+ listUsers() {
1486
+ return new ListUsersOperation(this);
1487
+ }
1488
+ /** Bind the listTasks Query. */
1489
+ listTasks() {
1490
+ return new ListTasksOperation(this);
1491
+ }
1492
+ /** Bind the getTask Query. */
1493
+ getTask() {
1494
+ return new GetTaskOperation(this);
1495
+ }
1496
+ /** Bind the listProjects Query. */
1497
+ listProjects() {
1498
+ return new ListProjectsOperation(this);
1499
+ }
1500
+ /** Bind the getProject Query. */
1501
+ getProject() {
1502
+ return new GetProjectOperation(this);
1503
+ }
1504
+ /** Bind the listOpportunities Query. */
1505
+ listOpportunities() {
1506
+ return new ListOpportunitiesOperation(this);
1507
+ }
1508
+ /** Bind the getOpportunity Query. */
1509
+ getOpportunity() {
1510
+ return new GetOpportunityOperation(this);
1511
+ }
1512
+ /** Bind the listLeads Query. */
1513
+ listLeads() {
1514
+ return new ListLeadsOperation(this);
1515
+ }
1516
+ /** Bind the updateCompany Mutation. */
1517
+ updateCompany() {
1518
+ return new UpdateCompanyOperation(this);
1519
+ }
1520
+ /** Bind the deleteCompany Mutation. */
1521
+ deleteCompany() {
1522
+ return new DeleteCompanyOperation(this);
1523
+ }
1524
+ /** Bind the updatePerson Mutation. */
1525
+ updatePerson() {
1526
+ return new UpdatePersonOperation(this);
1527
+ }
1528
+ /** Bind the deletePerson Mutation. */
1529
+ deletePerson() {
1530
+ return new DeletePersonOperation(this);
1531
+ }
1532
+ /** Bind the updateTask Mutation. */
1533
+ updateTask() {
1534
+ return new UpdateTaskOperation(this);
1535
+ }
1536
+ /** Bind the deleteTask Mutation. */
1537
+ deleteTask() {
1538
+ return new DeleteTaskOperation(this);
1539
+ }
1540
+ /** Bind the updateProject Mutation. */
1541
+ updateProject() {
1542
+ return new UpdateProjectOperation(this);
1543
+ }
1544
+ /** Bind the deleteProject Mutation. */
1545
+ deleteProject() {
1546
+ return new DeleteProjectOperation(this);
1547
+ }
1548
+ /** Bind the updateOpportunity Mutation. */
1549
+ updateOpportunity() {
1550
+ return new UpdateOpportunityOperation(this);
1551
+ }
1552
+ /** Bind the deleteOpportunity Mutation. */
1553
+ deleteOpportunity() {
1554
+ return new DeleteOpportunityOperation(this);
1555
+ }
1556
+ /** Bind the updateLead Mutation. */
1557
+ updateLead() {
1558
+ return new UpdateLeadOperation(this);
1559
+ }
1560
+ /** Bind the deleteLead Mutation. */
1561
+ deleteLead() {
1562
+ return new DeleteLeadOperation(this);
1563
+ }
1564
+ /** Bind the createCompany Mutation. */
1565
+ createCompany() {
1566
+ return new CreateCompanyOperation(this);
1567
+ }
1568
+ /** Bind the createPerson Mutation. */
1569
+ createPerson() {
1570
+ return new CreatePersonOperation(this);
1571
+ }
1572
+ /** Bind the createTask Mutation. */
1573
+ createTask() {
1574
+ return new CreateTaskOperation(this);
1575
+ }
1576
+ /** Bind the createProject Mutation. */
1577
+ createProject() {
1578
+ return new CreateProjectOperation(this);
1579
+ }
1580
+ /** Bind the createOpportunity Mutation. */
1581
+ createOpportunity() {
1582
+ return new CreateOpportunityOperation(this);
1583
+ }
1584
+ /** Bind the createLead Mutation. */
1585
+ createLead() {
1586
+ return new CreateLeadOperation(this);
1587
+ }
91
1588
  /** Send one read and classify transport, HTTP, and response-size outcomes. */
92
- async exchange(call, operation, path, hasNotFound) {
1589
+ async exchange(call, operation, path, hasNotFound, payload) {
1590
+ const isSearch = payload !== void 0;
1591
+ const response = await this.request(call, isSearch ? "POST" : "GET", path, payload);
1592
+ const { status, retryAfterMs, error } = response;
1593
+ if (error === "credential") return { branch: "defect", failure: failure(operation, "AUTHENTICATION", "Copper credentials are invalid") };
1594
+ if (error === "request") return { retry: true, failure: failure(operation, isSearch ? "AVAILABILITY" : "TRANSPORT", "Copper request failed") };
1595
+ if (status === 429) return { retry: true, retryAfterMs, failure: failure(operation, "RATE_LIMIT", "Copper rate limited the request") };
1596
+ if (!isSearch && status === 408 || status >= 500) return { retry: true, retryAfterMs, failure: failure(operation, "AVAILABILITY", "Copper is temporarily unavailable") };
1597
+ if (status === 404 && hasNotFound) return { branch: "notFound", failure: failure(operation, "NOT_FOUND", "Copper did not find the resource") };
1598
+ if (isSearch || status === 200) {
1599
+ if (error === "interrupted") return { retry: true, failure: failure(operation, "TRANSPORT", "Copper response was interrupted") };
1600
+ if (error === "tooLarge") return { branch: "invalidResponse", failure: failure(operation, "RESPONSE_TOO_LARGE", "Copper response exceeded the configured limit") };
1601
+ }
1602
+ if (status !== 200) return { branch: "providerRejected", failure: failure(operation, "PROVIDER_REJECTION", `Copper rejected HTTP ${status}`) };
1603
+ return { body: response.body };
1604
+ }
1605
+ /** Send a bounded request to a connector-owned endpoint. */
1606
+ async request(call, method, path, payload, signal = call.context.cancellationSignal, writeCredentials = false) {
1607
+ if (!path.startsWith("/")) return emptyResponse("request");
93
1608
  let apiKey;
94
1609
  let userEmail;
95
1610
  try {
96
- const resolved = await this.credentials.resolve(call, call.context.cancellationSignal);
97
- apiKey = resolved.apiKey instanceof SecretString ? resolved.apiKey.reveal() : "";
98
- userEmail = resolved.userEmail instanceof SecretString ? resolved.userEmail.reveal() : "";
1611
+ const credentials = await this.credentials.resolve(call, signal);
1612
+ apiKey = credentials.apiKey instanceof SecretString ? credentials.apiKey.reveal() : "";
1613
+ userEmail = credentials.userEmail instanceof SecretString ? credentials.userEmail.reveal() : "";
99
1614
  } catch {
100
- return { branch: "defect", failure: failure(operation, "AUTHENTICATION", "connection credentials are unavailable or invalid") };
1615
+ return emptyResponse("credential");
101
1616
  }
102
- if (!isHeaderSafeCredential(apiKey) || !isHeaderSafeCredential(userEmail) || !userEmail.includes("@") || userEmail.trim() !== userEmail) return { branch: "defect", failure: failure(operation, "AUTHENTICATION", "connection credentials are unavailable or invalid") };
1617
+ if (!isHeaderSafeCredential(apiKey) || !isHeaderSafeCredential(userEmail) || !userEmail.includes("@") || method === "GET" && !writeCredentials && userEmail.trim() !== userEmail) return emptyResponse("credential");
103
1618
  const request = {
104
1619
  url: `${this.baseUrl}${path}`,
105
- method: "GET",
1620
+ method,
1621
+ ...payload === void 0 ? {} : { body: Buffer.from(JSON.stringify(payload)) },
106
1622
  headers: { Accept: "application/json", "Content-Type": "application/json", "X-PW-AccessToken": apiKey, "X-PW-Application": "developer_api", "X-PW-UserEmail": userEmail, "User-Agent": userAgent },
107
1623
  maxResponseBytes: this.maxResponseBytes,
108
1624
  timeoutMs: this.timeoutMs,
109
1625
  addressPolicy: this.baseUrl.startsWith("https://") ? "publicHTTPS" : "privateNetworkHTTP",
110
- signal: call.context.cancellationSignal
1626
+ signal
111
1627
  };
112
1628
  let response;
113
1629
  try {
114
1630
  response = await this.sendRequest(request);
115
1631
  } catch (error) {
116
- if (error instanceof BodyTooLargeError && error.status !== void 0) {
117
- response = { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() };
118
- if (response.status === 200) return { branch: "invalidResponse", failure: failure(operation, "RESPONSE_TOO_LARGE", "Copper response exceeded the configured limit") };
119
- } else return { retry: true, failure: failure(operation, "TRANSPORT", "Copper request failed") };
1632
+ if (error instanceof BodyTooLargeError && error.status !== void 0)
1633
+ return { status: error.status, body: new Uint8Array(), retryAfterMs: copperRetryAfter(error.headers ?? {}), error: "tooLarge" };
1634
+ if (error instanceof ProviderTransportError && error.status !== void 0)
1635
+ return { status: error.status, body: new Uint8Array(), retryAfterMs: copperRetryAfter(error.headers ?? {}), error: "interrupted" };
1636
+ return emptyResponse("request");
120
1637
  }
121
- const status = response.status;
122
- const retryAfter = parseRetryAfter(headerValue(response.headers["retry-after"]));
123
- if (status === 429) return { retry: true, retryAfterMs: retryAfter, failure: failure(operation, "RATE_LIMIT", "Copper rate limited the request") };
124
- if (status === 408 || status >= 500) return { retry: true, retryAfterMs: retryAfter, failure: failure(operation, "AVAILABILITY", "Copper is temporarily unavailable") };
125
- if (status === 404 && hasNotFound) return { branch: "notFound", failure: failure(operation, "NOT_FOUND", "Copper did not find the resource") };
126
- if (status !== 200) return { branch: "providerRejected", failure: failure(operation, "PROVIDER_REJECTION", `Copper rejected HTTP ${status}`) };
127
- if (response.body.length > this.maxResponseBytes) return { branch: "invalidResponse", failure: failure(operation, "RESPONSE_TOO_LARGE", "Copper response exceeded the configured limit") };
128
- return { body: response.body };
1638
+ const retryAfterMs = copperRetryAfter(response.headers);
1639
+ if (response.body.length > this.maxResponseBytes)
1640
+ return { status: response.status, body: new Uint8Array(), retryAfterMs, error: "tooLarge" };
1641
+ return { status: response.status, body: response.body, retryAfterMs };
129
1642
  }
130
1643
  };
1644
+ function emptyResponse(error) {
1645
+ return { status: 0, body: new Uint8Array(), retryAfterMs: 0, error };
1646
+ }
1647
+ function copperRetryAfter(headers) {
1648
+ return parseRetryAfter(headerValue(Object.entries(headers).find(([key]) => key.toLowerCase() === "retry-after")?.[1]));
1649
+ }
131
1650
  var ListLeadStatusesOperation = class {
132
1651
  /** Bind the provider client. */
133
1652
  constructor(client) {
@@ -142,8 +1661,8 @@ var ListLeadStatusesOperation = class {
142
1661
  async invoke(call, input) {
143
1662
  if (!input || typeof input !== "object") return terminal("listLeadStatuses", "defect", "VALIDATION", "lead status list input is invalid", emptyStatuses());
144
1663
  const result = await this.client.exchange(call, "listLeadStatuses", "/lead_statuses", false);
145
- if (result.retry) return newQueryRetry(result.failure, result.retryAfterMs);
146
- if (result.failure) return newQueryBranch(result.branch, emptyStatuses(), {}, result.failure);
1664
+ if (result.retry) return newQueryRetry2(result.failure, result.retryAfterMs);
1665
+ if (result.failure) return newQueryBranch2(result.branch, emptyStatuses(), {}, result.failure);
147
1666
  const document = parseJSON(result.body);
148
1667
  if (!Array.isArray(document)) return invalid("listLeadStatuses", emptyStatuses());
149
1668
  const statuses = [];
@@ -151,7 +1670,7 @@ var ListLeadStatusesOperation = class {
151
1670
  if (!isObject(item) || !isPositiveSafeInteger(item.id) || typeof item.name !== "string" || !item.name) return invalid("listLeadStatuses", emptyStatuses());
152
1671
  statuses.push({ id: item.id, name: item.name });
153
1672
  }
154
- return newQueryBranch("listed", { statuses });
1673
+ return newQueryBranch2("listed", { statuses });
155
1674
  }
156
1675
  };
157
1676
  var GetLeadOperation = class {
@@ -168,11 +1687,11 @@ var GetLeadOperation = class {
168
1687
  async invoke(call, input) {
169
1688
  if (!isValidLeadID(input)) return terminal("getLead", "defect", "VALIDATION", "lead ID must be a positive decimal identifier", emptyLead());
170
1689
  const result = await this.client.exchange(call, "getLead", `/leads/${input.leadId}`, true);
171
- if (result.retry) return newQueryRetry(result.failure, result.retryAfterMs);
172
- if (result.failure) return newQueryBranch(result.branch, emptyLead(), {}, result.failure);
1690
+ if (result.retry) return newQueryRetry2(result.failure, result.retryAfterMs);
1691
+ if (result.failure) return newQueryBranch2(result.branch, emptyLead(), {}, result.failure);
173
1692
  const document = parseJSON(result.body);
174
1693
  if (!isObject(document) || !isPositiveSafeInteger(document.id) || typeof document.name !== "string" || !document.name || typeof document.status !== "string" || !document.status || document.company_name !== void 0 && document.company_name !== null && typeof document.company_name !== "string") return invalid("getLead", emptyLead());
175
- return newQueryBranch("found", { id: document.id, name: document.name, status: document.status, companyName: document.company_name ?? "" });
1694
+ return newQueryBranch2("found", { id: document.id, name: document.name, status: document.status, companyName: document.company_name ?? "" });
176
1695
  }
177
1696
  };
178
1697
  function isValidLeadID(input) {
@@ -187,7 +1706,7 @@ function failure(operation, kind, message) {
187
1706
  return { provider: "copper", operation, kind, message };
188
1707
  }
189
1708
  function terminal(operation, branch, kind, message, empty) {
190
- return newQueryBranch(branch, empty, {}, failure(operation, kind, message));
1709
+ return newQueryBranch2(branch, empty, {}, failure(operation, kind, message));
191
1710
  }
192
1711
  function invalid(operation, empty) {
193
1712
  return terminal(operation, "invalidResponse", "PROTOCOL", "Copper returned invalid JSON", empty);
@@ -242,10 +1761,139 @@ function parseDurationMilliseconds(value) {
242
1761
  return milliseconds;
243
1762
  }
244
1763
  export {
1764
+ CompaniesPageSchema,
1765
+ CompanyMetadataSchema,
245
1766
  ConfigSchema,
246
1767
  Connection,
247
1768
  ConnectorID,
248
1769
  CopperClient,
1770
+ CreateCompanyBranch,
1771
+ CreateCompanyBranchCreated,
1772
+ CreateCompanyBranchDefect,
1773
+ CreateCompanyBranchProviderRejected,
1774
+ CreateCompanyBranchUncertain,
1775
+ CreateCompanyDefinition,
1776
+ CreateCompanyInputSchema,
1777
+ CreateCompanyMetadata,
1778
+ CreateCompanyOperation,
1779
+ CreateLeadBranch,
1780
+ CreateLeadBranchCreated,
1781
+ CreateLeadBranchDefect,
1782
+ CreateLeadBranchProviderRejected,
1783
+ CreateLeadBranchUncertain,
1784
+ CreateLeadDefinition,
1785
+ CreateLeadInputSchema,
1786
+ CreateLeadMetadata,
1787
+ CreateLeadOperation,
1788
+ CreateOpportunityBranch,
1789
+ CreateOpportunityBranchCreated,
1790
+ CreateOpportunityBranchDefect,
1791
+ CreateOpportunityBranchProviderRejected,
1792
+ CreateOpportunityBranchUncertain,
1793
+ CreateOpportunityDefinition,
1794
+ CreateOpportunityInputSchema,
1795
+ CreateOpportunityMetadata,
1796
+ CreateOpportunityOperation,
1797
+ CreatePersonBranch,
1798
+ CreatePersonBranchCreated,
1799
+ CreatePersonBranchDefect,
1800
+ CreatePersonBranchProviderRejected,
1801
+ CreatePersonBranchUncertain,
1802
+ CreatePersonDefinition,
1803
+ CreatePersonInputSchema,
1804
+ CreatePersonMetadata,
1805
+ CreatePersonOperation,
1806
+ CreateProjectBranch,
1807
+ CreateProjectBranchCreated,
1808
+ CreateProjectBranchDefect,
1809
+ CreateProjectBranchProviderRejected,
1810
+ CreateProjectBranchUncertain,
1811
+ CreateProjectDefinition,
1812
+ CreateProjectInputSchema,
1813
+ CreateProjectMetadata,
1814
+ CreateProjectOperation,
1815
+ CreateTaskBranch,
1816
+ CreateTaskBranchCreated,
1817
+ CreateTaskBranchDefect,
1818
+ CreateTaskBranchProviderRejected,
1819
+ CreateTaskBranchUncertain,
1820
+ CreateTaskDefinition,
1821
+ CreateTaskInputSchema,
1822
+ CreateTaskMetadata,
1823
+ CreateTaskOperation,
1824
+ CredentialMaterialError,
1825
+ CustomerSourceMetadataSchema,
1826
+ CustomerSourcesListSchema,
1827
+ DeleteCompanyBranch,
1828
+ DeleteCompanyBranchDefect,
1829
+ DeleteCompanyBranchDeleted,
1830
+ DeleteCompanyBranchNotFound,
1831
+ DeleteCompanyBranchProviderRejected,
1832
+ DeleteCompanyDefinition,
1833
+ DeleteCompanyInputSchema,
1834
+ DeleteCompanyMetadata,
1835
+ DeleteCompanyOperation,
1836
+ DeleteCompanyOutputSchema,
1837
+ DeleteLeadBranch,
1838
+ DeleteLeadBranchDefect,
1839
+ DeleteLeadBranchDeleted,
1840
+ DeleteLeadBranchNotFound,
1841
+ DeleteLeadBranchProviderRejected,
1842
+ DeleteLeadDefinition,
1843
+ DeleteLeadInputSchema,
1844
+ DeleteLeadMetadata,
1845
+ DeleteLeadOperation,
1846
+ DeleteLeadOutputSchema,
1847
+ DeleteOpportunityBranch,
1848
+ DeleteOpportunityBranchDefect,
1849
+ DeleteOpportunityBranchDeleted,
1850
+ DeleteOpportunityBranchNotFound,
1851
+ DeleteOpportunityBranchProviderRejected,
1852
+ DeleteOpportunityDefinition,
1853
+ DeleteOpportunityInputSchema,
1854
+ DeleteOpportunityMetadata,
1855
+ DeleteOpportunityOperation,
1856
+ DeleteOpportunityOutputSchema,
1857
+ DeletePersonBranch,
1858
+ DeletePersonBranchDefect,
1859
+ DeletePersonBranchDeleted,
1860
+ DeletePersonBranchNotFound,
1861
+ DeletePersonBranchProviderRejected,
1862
+ DeletePersonDefinition,
1863
+ DeletePersonInputSchema,
1864
+ DeletePersonMetadata,
1865
+ DeletePersonOperation,
1866
+ DeletePersonOutputSchema,
1867
+ DeleteProjectBranch,
1868
+ DeleteProjectBranchDefect,
1869
+ DeleteProjectBranchDeleted,
1870
+ DeleteProjectBranchNotFound,
1871
+ DeleteProjectBranchProviderRejected,
1872
+ DeleteProjectDefinition,
1873
+ DeleteProjectInputSchema,
1874
+ DeleteProjectMetadata,
1875
+ DeleteProjectOperation,
1876
+ DeleteProjectOutputSchema,
1877
+ DeleteTaskBranch,
1878
+ DeleteTaskBranchDefect,
1879
+ DeleteTaskBranchDeleted,
1880
+ DeleteTaskBranchNotFound,
1881
+ DeleteTaskBranchProviderRejected,
1882
+ DeleteTaskDefinition,
1883
+ DeleteTaskInputSchema,
1884
+ DeleteTaskMetadata,
1885
+ DeleteTaskOperation,
1886
+ DeleteTaskOutputSchema,
1887
+ GetCompanyBranch,
1888
+ GetCompanyBranchDefect,
1889
+ GetCompanyBranchFound,
1890
+ GetCompanyBranchInvalidResponse,
1891
+ GetCompanyBranchNotFound,
1892
+ GetCompanyBranchProviderRejected,
1893
+ GetCompanyDefinition,
1894
+ GetCompanyInputSchema,
1895
+ GetCompanyMetadata,
1896
+ GetCompanyOperation,
249
1897
  GetLeadBranch,
250
1898
  GetLeadBranchDefect,
251
1899
  GetLeadBranchFound,
@@ -256,9 +1904,68 @@ export {
256
1904
  GetLeadInputSchema,
257
1905
  GetLeadMetadata,
258
1906
  GetLeadOperation,
1907
+ GetOpportunityBranch,
1908
+ GetOpportunityBranchDefect,
1909
+ GetOpportunityBranchFound,
1910
+ GetOpportunityBranchInvalidResponse,
1911
+ GetOpportunityBranchNotFound,
1912
+ GetOpportunityBranchProviderRejected,
1913
+ GetOpportunityDefinition,
1914
+ GetOpportunityInputSchema,
1915
+ GetOpportunityMetadata,
1916
+ GetOpportunityOperation,
1917
+ GetPersonBranch,
1918
+ GetPersonBranchDefect,
1919
+ GetPersonBranchFound,
1920
+ GetPersonBranchInvalidResponse,
1921
+ GetPersonBranchNotFound,
1922
+ GetPersonBranchProviderRejected,
1923
+ GetPersonDefinition,
1924
+ GetPersonInputSchema,
1925
+ GetPersonMetadata,
1926
+ GetPersonOperation,
1927
+ GetProjectBranch,
1928
+ GetProjectBranchDefect,
1929
+ GetProjectBranchFound,
1930
+ GetProjectBranchInvalidResponse,
1931
+ GetProjectBranchNotFound,
1932
+ GetProjectBranchProviderRejected,
1933
+ GetProjectDefinition,
1934
+ GetProjectInputSchema,
1935
+ GetProjectMetadata,
1936
+ GetProjectOperation,
1937
+ GetTaskBranch,
1938
+ GetTaskBranchDefect,
1939
+ GetTaskBranchFound,
1940
+ GetTaskBranchInvalidResponse,
1941
+ GetTaskBranchNotFound,
1942
+ GetTaskBranchProviderRejected,
1943
+ GetTaskDefinition,
1944
+ GetTaskInputSchema,
1945
+ GetTaskMetadata,
1946
+ GetTaskOperation,
259
1947
  LeadMetadataSchema,
260
1948
  LeadStatusMetadataSchema,
261
1949
  LeadStatusesListSchema,
1950
+ LeadsPageSchema,
1951
+ ListCompaniesBranch,
1952
+ ListCompaniesBranchDefect,
1953
+ ListCompaniesBranchInvalidResponse,
1954
+ ListCompaniesBranchListed,
1955
+ ListCompaniesBranchProviderRejected,
1956
+ ListCompaniesDefinition,
1957
+ ListCompaniesInputSchema,
1958
+ ListCompaniesMetadata,
1959
+ ListCompaniesOperation,
1960
+ ListCustomerSourcesBranch,
1961
+ ListCustomerSourcesBranchDefect,
1962
+ ListCustomerSourcesBranchInvalidResponse,
1963
+ ListCustomerSourcesBranchListed,
1964
+ ListCustomerSourcesBranchProviderRejected,
1965
+ ListCustomerSourcesDefinition,
1966
+ ListCustomerSourcesInputSchema,
1967
+ ListCustomerSourcesMetadata,
1968
+ ListCustomerSourcesOperation,
262
1969
  ListLeadStatusesBranch,
263
1970
  ListLeadStatusesBranchDefect,
264
1971
  ListLeadStatusesBranchInvalidResponse,
@@ -268,11 +1975,161 @@ export {
268
1975
  ListLeadStatusesInputSchema,
269
1976
  ListLeadStatusesMetadata,
270
1977
  ListLeadStatusesOperation,
1978
+ ListLeadsBranch,
1979
+ ListLeadsBranchDefect,
1980
+ ListLeadsBranchInvalidResponse,
1981
+ ListLeadsBranchListed,
1982
+ ListLeadsBranchProviderRejected,
1983
+ ListLeadsDefinition,
1984
+ ListLeadsInputSchema,
1985
+ ListLeadsMetadata,
1986
+ ListLeadsOperation,
1987
+ ListOpportunitiesBranch,
1988
+ ListOpportunitiesBranchDefect,
1989
+ ListOpportunitiesBranchInvalidResponse,
1990
+ ListOpportunitiesBranchListed,
1991
+ ListOpportunitiesBranchProviderRejected,
1992
+ ListOpportunitiesDefinition,
1993
+ ListOpportunitiesInputSchema,
1994
+ ListOpportunitiesMetadata,
1995
+ ListOpportunitiesOperation,
1996
+ ListPeopleBranch,
1997
+ ListPeopleBranchDefect,
1998
+ ListPeopleBranchInvalidResponse,
1999
+ ListPeopleBranchListed,
2000
+ ListPeopleBranchProviderRejected,
2001
+ ListPeopleDefinition,
2002
+ ListPeopleInputSchema,
2003
+ ListPeopleMetadata,
2004
+ ListPeopleOperation,
2005
+ ListProjectsBranch,
2006
+ ListProjectsBranchDefect,
2007
+ ListProjectsBranchInvalidResponse,
2008
+ ListProjectsBranchListed,
2009
+ ListProjectsBranchProviderRejected,
2010
+ ListProjectsDefinition,
2011
+ ListProjectsInputSchema,
2012
+ ListProjectsMetadata,
2013
+ ListProjectsOperation,
2014
+ ListTasksBranch,
2015
+ ListTasksBranchDefect,
2016
+ ListTasksBranchInvalidResponse,
2017
+ ListTasksBranchListed,
2018
+ ListTasksBranchProviderRejected,
2019
+ ListTasksDefinition,
2020
+ ListTasksInputSchema,
2021
+ ListTasksMetadata,
2022
+ ListTasksOperation,
2023
+ ListUsersBranch,
2024
+ ListUsersBranchDefect,
2025
+ ListUsersBranchInvalidResponse,
2026
+ ListUsersBranchListed,
2027
+ ListUsersBranchProviderRejected,
2028
+ ListUsersDefinition,
2029
+ ListUsersInputSchema,
2030
+ ListUsersMetadata,
2031
+ ListUsersOperation,
2032
+ OpportunitiesPageSchema,
2033
+ OpportunityMetadataSchema,
2034
+ PeoplePageSchema,
2035
+ PersonMetadataSchema,
2036
+ ProjectMetadataSchema,
2037
+ ProjectsPageSchema,
271
2038
  ProviderID,
2039
+ TaskMetadataSchema,
2040
+ TasksPageSchema,
2041
+ UpdateCompanyBranch,
2042
+ UpdateCompanyBranchDefect,
2043
+ UpdateCompanyBranchNotFound,
2044
+ UpdateCompanyBranchProviderRejected,
2045
+ UpdateCompanyBranchUpdated,
2046
+ UpdateCompanyDefinition,
2047
+ UpdateCompanyInputSchema,
2048
+ UpdateCompanyMetadata,
2049
+ UpdateCompanyOperation,
2050
+ UpdateLeadBranch,
2051
+ UpdateLeadBranchDefect,
2052
+ UpdateLeadBranchNotFound,
2053
+ UpdateLeadBranchProviderRejected,
2054
+ UpdateLeadBranchUpdated,
2055
+ UpdateLeadDefinition,
2056
+ UpdateLeadInputSchema,
2057
+ UpdateLeadMetadata,
2058
+ UpdateLeadOperation,
2059
+ UpdateOpportunityBranch,
2060
+ UpdateOpportunityBranchDefect,
2061
+ UpdateOpportunityBranchNotFound,
2062
+ UpdateOpportunityBranchProviderRejected,
2063
+ UpdateOpportunityBranchUpdated,
2064
+ UpdateOpportunityDefinition,
2065
+ UpdateOpportunityInputSchema,
2066
+ UpdateOpportunityMetadata,
2067
+ UpdateOpportunityOperation,
2068
+ UpdatePersonBranch,
2069
+ UpdatePersonBranchDefect,
2070
+ UpdatePersonBranchNotFound,
2071
+ UpdatePersonBranchProviderRejected,
2072
+ UpdatePersonBranchUpdated,
2073
+ UpdatePersonDefinition,
2074
+ UpdatePersonInputSchema,
2075
+ UpdatePersonMetadata,
2076
+ UpdatePersonOperation,
2077
+ UpdateProjectBranch,
2078
+ UpdateProjectBranchDefect,
2079
+ UpdateProjectBranchNotFound,
2080
+ UpdateProjectBranchProviderRejected,
2081
+ UpdateProjectBranchUpdated,
2082
+ UpdateProjectDefinition,
2083
+ UpdateProjectInputSchema,
2084
+ UpdateProjectMetadata,
2085
+ UpdateProjectOperation,
2086
+ UpdateTaskBranch,
2087
+ UpdateTaskBranchDefect,
2088
+ UpdateTaskBranchNotFound,
2089
+ UpdateTaskBranchProviderRejected,
2090
+ UpdateTaskBranchUpdated,
2091
+ UpdateTaskDefinition,
2092
+ UpdateTaskInputSchema,
2093
+ UpdateTaskMetadata,
2094
+ UpdateTaskOperation,
2095
+ UserMetadataSchema,
2096
+ UsersPageSchema,
272
2097
  decodeCredentials,
2098
+ isCredentialMaterialError,
273
2099
  newConnection,
274
2100
  newConnectionWithOperations,
2101
+ newCreateCompanyStep,
2102
+ newCreateLeadStep,
2103
+ newCreateOpportunityStep,
2104
+ newCreatePersonStep,
2105
+ newCreateProjectStep,
2106
+ newCreateTaskStep,
2107
+ newDeleteCompanyStep,
2108
+ newDeleteLeadStep,
2109
+ newDeleteOpportunityStep,
2110
+ newDeletePersonStep,
2111
+ newDeleteProjectStep,
2112
+ newDeleteTaskStep,
2113
+ newGetCompanyStep,
275
2114
  newGetLeadStep,
2115
+ newGetOpportunityStep,
2116
+ newGetPersonStep,
2117
+ newGetProjectStep,
2118
+ newGetTaskStep,
2119
+ newListCompaniesStep,
2120
+ newListCustomerSourcesStep,
276
2121
  newListLeadStatusesStep,
277
- newProjectConnection2 as newProjectConnection
2122
+ newListLeadsStep,
2123
+ newListOpportunitiesStep,
2124
+ newListPeopleStep,
2125
+ newListProjectsStep,
2126
+ newListTasksStep,
2127
+ newListUsersStep,
2128
+ newProjectConnection2 as newProjectConnection,
2129
+ newUpdateCompanyStep,
2130
+ newUpdateLeadStep,
2131
+ newUpdateOpportunityStep,
2132
+ newUpdatePersonStep,
2133
+ newUpdateProjectStep,
2134
+ newUpdateTaskStep
278
2135
  };