@apideck/unify 0.23.0 → 0.23.1

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.
Files changed (93) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +3 -3
  3. package/lib/config.js +3 -3
  4. package/models/components/note.d.ts +5 -0
  5. package/models/components/note.d.ts.map +1 -1
  6. package/models/components/note.js +4 -0
  7. package/models/components/note.js.map +1 -1
  8. package/models/components/noteinput.d.ts +5 -0
  9. package/models/components/noteinput.d.ts.map +1 -1
  10. package/models/components/noteinput.js +4 -0
  11. package/models/components/noteinput.js.map +1 -1
  12. package/package.json +5 -1
  13. package/src/__tests__/activities.test.ts +783 -0
  14. package/src/__tests__/agedcreditors.test.ts +279 -0
  15. package/src/__tests__/ageddebtors.test.ts +279 -0
  16. package/src/__tests__/apideckcompanies.test.ts +712 -0
  17. package/src/__tests__/apideckcustomers.test.ts +360 -0
  18. package/src/__tests__/apideckdepartments.test.ts +319 -0
  19. package/src/__tests__/apiresources.test.ts +61 -0
  20. package/src/__tests__/apis.test.ts +214 -0
  21. package/src/__tests__/applicants.test.ts +976 -0
  22. package/src/__tests__/applications.test.ts +329 -0
  23. package/src/__tests__/assertions.ts +13 -0
  24. package/src/__tests__/attachments.test.ts +363 -0
  25. package/src/__tests__/balancesheet.test.ts +451 -0
  26. package/src/__tests__/billpayments.test.ts +666 -0
  27. package/src/__tests__/bills.test.ts +1133 -0
  28. package/src/__tests__/collections.test.ts +115 -0
  29. package/src/__tests__/collectiontags.test.ts +66 -0
  30. package/src/__tests__/collectionticketcomments.test.ts +318 -0
  31. package/src/__tests__/collectiontickets.test.ts +436 -0
  32. package/src/__tests__/collectionusers.test.ts +122 -0
  33. package/src/__tests__/companies.test.ts +1059 -0
  34. package/src/__tests__/companyinfo.test.ts +218 -0
  35. package/src/__tests__/connectioncustommappings.test.ts +67 -0
  36. package/src/__tests__/connections.test.ts +1713 -0
  37. package/src/__tests__/connectionsettings.test.ts +280 -0
  38. package/src/__tests__/connectordocs.test.ts +28 -0
  39. package/src/__tests__/connectors.test.ts +751 -0
  40. package/src/__tests__/consumerrequestcounts.test.ts +41 -0
  41. package/src/__tests__/consumers.test.ts +517 -0
  42. package/src/__tests__/contacts.test.ts +957 -0
  43. package/src/__tests__/createcallback.test.ts +34 -0
  44. package/src/__tests__/creditnotes.test.ts +1362 -0
  45. package/src/__tests__/customers.test.ts +1089 -0
  46. package/src/__tests__/customfields.test.ts +50 -0
  47. package/src/__tests__/custommappings.test.ts +63 -0
  48. package/src/__tests__/departments.test.ts +359 -0
  49. package/src/__tests__/drivegroups.test.ts +318 -0
  50. package/src/__tests__/drives.test.ts +311 -0
  51. package/src/__tests__/employeepayrolls.test.ts +487 -0
  52. package/src/__tests__/employees.test.ts +1682 -0
  53. package/src/__tests__/employeeschedules.test.ts +456 -0
  54. package/src/__tests__/eventlogs.test.ts +157 -0
  55. package/src/__tests__/expenses.test.ts +566 -0
  56. package/src/__tests__/files.test.ts +392 -0
  57. package/src/__tests__/files.ts +56 -0
  58. package/src/__tests__/folders.test.ts +103 -0
  59. package/src/__tests__/invoiceitems.test.ts +586 -0
  60. package/src/__tests__/invoices.test.ts +1561 -0
  61. package/src/__tests__/jobs.test.ts +837 -0
  62. package/src/__tests__/journalentries.test.ts +1053 -0
  63. package/src/__tests__/leads.test.ts +897 -0
  64. package/src/__tests__/ledgeraccounts.test.ts +594 -0
  65. package/src/__tests__/locations.test.ts +561 -0
  66. package/src/__tests__/logs.test.ts +135 -0
  67. package/src/__tests__/messages.test.ts +396 -0
  68. package/src/__tests__/mockserver/README.md +52 -0
  69. package/src/__tests__/notes.test.ts +335 -0
  70. package/src/__tests__/opportunities.test.ts +503 -0
  71. package/src/__tests__/orders.test.ts +849 -0
  72. package/src/__tests__/payments.test.ts +557 -0
  73. package/src/__tests__/payrolls.test.ts +481 -0
  74. package/src/__tests__/pipelines.test.ts +383 -0
  75. package/src/__tests__/products.test.ts +505 -0
  76. package/src/__tests__/profitandloss.test.ts +221 -0
  77. package/src/__tests__/purchaseorders.test.ts +1464 -0
  78. package/src/__tests__/sessions.test.ts +70 -0
  79. package/src/__tests__/sharedlinks.test.ts +331 -0
  80. package/src/__tests__/stores.test.ts +39 -0
  81. package/src/__tests__/subsidiaries.test.ts +316 -0
  82. package/src/__tests__/suppliers.test.ts +1071 -0
  83. package/src/__tests__/taxrates.test.ts +472 -0
  84. package/src/__tests__/testclient.ts +48 -0
  85. package/src/__tests__/timeoffrequests.test.ts +381 -0
  86. package/src/__tests__/trackingcategories.test.ts +329 -0
  87. package/src/__tests__/uploadsessions.test.ts +142 -0
  88. package/src/__tests__/users.test.ts +667 -0
  89. package/src/__tests__/validateconnection.test.ts +32 -0
  90. package/src/__tests__/webhooks.test.ts +248 -0
  91. package/src/lib/config.ts +3 -3
  92. package/src/models/components/note.ts +9 -0
  93. package/src/models/components/noteinput.ts +9 -0
@@ -0,0 +1,1713 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { assert, expect, it, test } from "vitest";
6
+ import { Apideck } from "../index.js";
7
+ import { createTestHTTPClient } from "./testclient.js";
8
+
9
+ test("Connections Vault Connections All", async () => {
10
+ const testHttpClient = createTestHTTPClient("vault.connectionsAll");
11
+
12
+ const apideck = new Apideck({
13
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
14
+ httpClient: testHttpClient,
15
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
16
+ });
17
+
18
+ const result = await apideck.vault.connections.list({
19
+ api: "crm",
20
+ configured: true,
21
+ });
22
+ expect(result.httpMeta.response.status).toBe(200);
23
+ expect(result.getConnectionsResponse).toBeDefined();
24
+ expect(result.getConnectionsResponse).toEqual({
25
+ statusCode: 200,
26
+ status: "OK",
27
+ data: [
28
+ {
29
+ id: "crm+salesforce",
30
+ serviceId: "salesforce",
31
+ name: "Salesforce",
32
+ tagLine:
33
+ "CRM software solutions and enterprise cloud computing from Salesforce, the leader in customer relationship management (CRM) and PaaS. Free 30 day trial.",
34
+ unifiedApi: "crm",
35
+ state: "authorized",
36
+ integrationState: "configured",
37
+ authType: "oauth2",
38
+ oauthGrantType: "authorization_code",
39
+ enabled: true,
40
+ website: "https://www.salesforce.com",
41
+ icon:
42
+ "https://res.cloudinary.com/apideck/image/upload/v1529456047/catalog/salesforce/icon128x128.png",
43
+ logo:
44
+ "https://c1.sfdcstatic.com/content/dam/web/en_us/www/images/home/logo-salesforce-m.svg",
45
+ authorizeUrl:
46
+ "https://unify.apideck.com/vault/authorize/salesforce/<application-id>?state=<state>",
47
+ revokeUrl:
48
+ "https://unify.apideck.com/vault/revoke/salesforce/<application-id>?state=<state>",
49
+ settings: {
50
+ "instance_url": "https://eu28.salesforce.com",
51
+ "api_key": "12345xxxxxx",
52
+ },
53
+ metadata: {
54
+ "account": {
55
+ "name": "My Company",
56
+ "id": "c01458a5-7276-41ce-bc19-639906b0450a",
57
+ },
58
+ "plan": "enterprise",
59
+ },
60
+ formFields: [
61
+ {
62
+ id: "instance_url",
63
+ label: "Instance url",
64
+ placeholder: "",
65
+ type: "text",
66
+ required: true,
67
+ customField: false,
68
+ allowCustomValues: false,
69
+ disabled: false,
70
+ sensitive: false,
71
+ },
72
+ {
73
+ id: "api_key",
74
+ label: "API Key",
75
+ placeholder: "",
76
+ type: "text",
77
+ required: true,
78
+ customField: false,
79
+ allowCustomValues: false,
80
+ disabled: false,
81
+ sensitive: true,
82
+ },
83
+ ],
84
+ configuration: [
85
+ {
86
+ resource: "leads",
87
+ defaults: [
88
+ {
89
+ target: "custom_fields",
90
+ id: "ProductInterest",
91
+ options: [
92
+ {
93
+ label: "General Channel",
94
+ value: "general",
95
+ optionType: "simple",
96
+ },
97
+ ],
98
+ value: true,
99
+ },
100
+ {
101
+ target: "custom_fields",
102
+ id: "ProductInterest",
103
+ options: [
104
+ {
105
+ label: "General Channel",
106
+ value: true,
107
+ optionType: "simple",
108
+ },
109
+ {
110
+ label: "General Channel",
111
+ value: "general",
112
+ optionType: "simple",
113
+ },
114
+ ],
115
+ value: true,
116
+ },
117
+ {
118
+ target: "custom_fields",
119
+ id: "ProductInterest",
120
+ options: [
121
+ {
122
+ id: "1234",
123
+ label: "General Channel",
124
+ options: [],
125
+ optionType: "group",
126
+ },
127
+ {
128
+ label: "General Channel",
129
+ value: 123,
130
+ optionType: "simple",
131
+ },
132
+ ],
133
+ value: 10.5,
134
+ },
135
+ ],
136
+ },
137
+ {
138
+ resource: "leads",
139
+ defaults: [
140
+ {
141
+ target: "custom_fields",
142
+ id: "ProductInterest",
143
+ options: [
144
+ {
145
+ id: "1234",
146
+ label: "General Channel",
147
+ options: [
148
+ {
149
+ label: "General Channel",
150
+ value: 12.5,
151
+ optionType: "simple",
152
+ },
153
+ {
154
+ label: "General Channel",
155
+ value: "general",
156
+ optionType: "simple",
157
+ },
158
+ {
159
+ label: "General Channel",
160
+ value: 123,
161
+ optionType: "simple",
162
+ },
163
+ ],
164
+ optionType: "group",
165
+ },
166
+ {
167
+ id: "1234",
168
+ label: "General Channel",
169
+ options: [],
170
+ optionType: "group",
171
+ },
172
+ {
173
+ id: "1234",
174
+ label: "General Channel",
175
+ options: [
176
+ {
177
+ label: "General Channel",
178
+ value: [
179
+ "team",
180
+ "general",
181
+ ],
182
+ optionType: "simple",
183
+ },
184
+ ],
185
+ optionType: "group",
186
+ },
187
+ ],
188
+ value: "GC5000 series",
189
+ },
190
+ ],
191
+ },
192
+ ],
193
+ configurableResources: [
194
+ "opportunities",
195
+ "companies",
196
+ "contacts",
197
+ "leads",
198
+ ],
199
+ resourceSchemaSupport: [
200
+ "leads",
201
+ ],
202
+ resourceSettingsSupport: [
203
+ "leads",
204
+ ],
205
+ settingsRequiredForAuthorization: [
206
+ "client_id",
207
+ "client_secret",
208
+ ],
209
+ subscriptions: [
210
+ {
211
+ downstreamId: "5f5f5f5f5f5f5f5f5f5f5f5f",
212
+ unifyEventTypes: [
213
+ "crm.contact.created",
214
+ ],
215
+ downstreamEventTypes: [
216
+ "contacts.CREATED",
217
+ ],
218
+ executeUrl:
219
+ "https://unify.apideck.com/webhook/w/{lookupIdToken}/{serviceId}?e={downstreamEventType}",
220
+ createdAt: "2020-10-01T12:00:00.000Z",
221
+ },
222
+ ],
223
+ hasGuide: true,
224
+ createdAt: 1615563533390,
225
+ customMappings: [
226
+ {
227
+ id: "hris+employees+first_aid_training",
228
+ label: "First Aid Training",
229
+ description: "First Aid Training completed after 2019-01-01",
230
+ value: "$.root.training.first_aid",
231
+ key: "first_aid_training",
232
+ required: false,
233
+ customField: true,
234
+ consumerId: "test_user_id",
235
+ example: "Some value",
236
+ },
237
+ {
238
+ id: "hris+employees+first_aid_training",
239
+ label: "First Aid Training",
240
+ description: "First Aid Training completed after 2019-01-01",
241
+ value: "$.root.training.first_aid",
242
+ key: "first_aid_training",
243
+ required: false,
244
+ customField: true,
245
+ consumerId: "test_user_id",
246
+ example: "Some value",
247
+ },
248
+ {
249
+ id: "hris+employees+first_aid_training",
250
+ label: "First Aid Training",
251
+ description: "First Aid Training completed after 2019-01-01",
252
+ value: "$.root.training.first_aid",
253
+ key: "first_aid_training",
254
+ required: false,
255
+ customField: true,
256
+ consumerId: "test_user_id",
257
+ example: "Some value",
258
+ },
259
+ ],
260
+ updatedAt: 1616662325753,
261
+ },
262
+ {
263
+ id: "crm+salesforce",
264
+ serviceId: "salesforce",
265
+ name: "Salesforce",
266
+ tagLine:
267
+ "CRM software solutions and enterprise cloud computing from Salesforce, the leader in customer relationship management (CRM) and PaaS. Free 30 day trial.",
268
+ unifiedApi: "crm",
269
+ state: "authorized",
270
+ integrationState: "configured",
271
+ authType: "oauth2",
272
+ oauthGrantType: "authorization_code",
273
+ enabled: true,
274
+ website: "https://www.salesforce.com",
275
+ icon:
276
+ "https://res.cloudinary.com/apideck/image/upload/v1529456047/catalog/salesforce/icon128x128.png",
277
+ logo:
278
+ "https://c1.sfdcstatic.com/content/dam/web/en_us/www/images/home/logo-salesforce-m.svg",
279
+ authorizeUrl:
280
+ "https://unify.apideck.com/vault/authorize/salesforce/<application-id>?state=<state>",
281
+ revokeUrl:
282
+ "https://unify.apideck.com/vault/revoke/salesforce/<application-id>?state=<state>",
283
+ settings: {
284
+ "instance_url": "https://eu28.salesforce.com",
285
+ "api_key": "12345xxxxxx",
286
+ },
287
+ metadata: {
288
+ "account": {
289
+ "name": "My Company",
290
+ "id": "c01458a5-7276-41ce-bc19-639906b0450a",
291
+ },
292
+ "plan": "enterprise",
293
+ },
294
+ formFields: [
295
+ {
296
+ id: "instance_url",
297
+ label: "Instance url",
298
+ placeholder: "",
299
+ type: "text",
300
+ required: true,
301
+ customField: false,
302
+ allowCustomValues: false,
303
+ disabled: false,
304
+ sensitive: false,
305
+ },
306
+ {
307
+ id: "api_key",
308
+ label: "API Key",
309
+ placeholder: "",
310
+ type: "text",
311
+ required: true,
312
+ customField: false,
313
+ allowCustomValues: false,
314
+ disabled: false,
315
+ sensitive: true,
316
+ },
317
+ ],
318
+ configuration: [
319
+ {
320
+ resource: "leads",
321
+ defaults: [
322
+ {
323
+ target: "custom_fields",
324
+ id: "ProductInterest",
325
+ options: [
326
+ {
327
+ label: "General Channel",
328
+ value: 12.5,
329
+ optionType: "simple",
330
+ },
331
+ {
332
+ label: "General Channel",
333
+ value: 12.5,
334
+ optionType: "simple",
335
+ },
336
+ ],
337
+ value: [
338
+ 10.5,
339
+ ],
340
+ },
341
+ {
342
+ target: "custom_fields",
343
+ id: "ProductInterest",
344
+ options: [
345
+ {
346
+ label: "General Channel",
347
+ value: "general",
348
+ optionType: "simple",
349
+ },
350
+ ],
351
+ value: "GC5000 series",
352
+ },
353
+ ],
354
+ },
355
+ ],
356
+ configurableResources: [
357
+ "opportunities",
358
+ "companies",
359
+ "contacts",
360
+ "leads",
361
+ ],
362
+ resourceSchemaSupport: [
363
+ "leads",
364
+ ],
365
+ resourceSettingsSupport: [
366
+ "leads",
367
+ ],
368
+ settingsRequiredForAuthorization: [
369
+ "client_id",
370
+ "client_secret",
371
+ ],
372
+ subscriptions: [
373
+ {
374
+ downstreamId: "5f5f5f5f5f5f5f5f5f5f5f5f",
375
+ unifyEventTypes: [
376
+ "crm.contact.created",
377
+ ],
378
+ downstreamEventTypes: [
379
+ "contacts.CREATED",
380
+ ],
381
+ executeUrl:
382
+ "https://unify.apideck.com/webhook/w/{lookupIdToken}/{serviceId}?e={downstreamEventType}",
383
+ createdAt: "2020-10-01T12:00:00.000Z",
384
+ },
385
+ {
386
+ downstreamId: "5f5f5f5f5f5f5f5f5f5f5f5f",
387
+ unifyEventTypes: [
388
+ "crm.contact.created",
389
+ ],
390
+ downstreamEventTypes: [
391
+ "contacts.CREATED",
392
+ ],
393
+ executeUrl:
394
+ "https://unify.apideck.com/webhook/w/{lookupIdToken}/{serviceId}?e={downstreamEventType}",
395
+ createdAt: "2020-10-01T12:00:00.000Z",
396
+ },
397
+ {
398
+ downstreamId: "5f5f5f5f5f5f5f5f5f5f5f5f",
399
+ unifyEventTypes: [
400
+ "crm.contact.created",
401
+ ],
402
+ downstreamEventTypes: [
403
+ "contacts.CREATED",
404
+ ],
405
+ executeUrl:
406
+ "https://unify.apideck.com/webhook/w/{lookupIdToken}/{serviceId}?e={downstreamEventType}",
407
+ createdAt: "2020-10-01T12:00:00.000Z",
408
+ },
409
+ ],
410
+ hasGuide: true,
411
+ createdAt: 1615563533390,
412
+ customMappings: [
413
+ {
414
+ id: "hris+employees+first_aid_training",
415
+ label: "First Aid Training",
416
+ description: "First Aid Training completed after 2019-01-01",
417
+ value: "$.root.training.first_aid",
418
+ key: "first_aid_training",
419
+ required: false,
420
+ customField: true,
421
+ consumerId: "test_user_id",
422
+ example: "Some value",
423
+ },
424
+ ],
425
+ updatedAt: 1616662325753,
426
+ },
427
+ {
428
+ id: "crm+salesforce",
429
+ serviceId: "salesforce",
430
+ name: "Salesforce",
431
+ tagLine:
432
+ "CRM software solutions and enterprise cloud computing from Salesforce, the leader in customer relationship management (CRM) and PaaS. Free 30 day trial.",
433
+ unifiedApi: "crm",
434
+ state: "authorized",
435
+ integrationState: "configured",
436
+ authType: "oauth2",
437
+ oauthGrantType: "authorization_code",
438
+ enabled: true,
439
+ website: "https://www.salesforce.com",
440
+ icon:
441
+ "https://res.cloudinary.com/apideck/image/upload/v1529456047/catalog/salesforce/icon128x128.png",
442
+ logo:
443
+ "https://c1.sfdcstatic.com/content/dam/web/en_us/www/images/home/logo-salesforce-m.svg",
444
+ authorizeUrl:
445
+ "https://unify.apideck.com/vault/authorize/salesforce/<application-id>?state=<state>",
446
+ revokeUrl:
447
+ "https://unify.apideck.com/vault/revoke/salesforce/<application-id>?state=<state>",
448
+ settings: {
449
+ "instance_url": "https://eu28.salesforce.com",
450
+ "api_key": "12345xxxxxx",
451
+ },
452
+ metadata: {
453
+ "account": {
454
+ "name": "My Company",
455
+ "id": "c01458a5-7276-41ce-bc19-639906b0450a",
456
+ },
457
+ "plan": "enterprise",
458
+ },
459
+ formFields: [
460
+ {
461
+ id: "instance_url",
462
+ label: "Instance url",
463
+ placeholder: "",
464
+ type: "text",
465
+ required: true,
466
+ customField: false,
467
+ allowCustomValues: false,
468
+ disabled: false,
469
+ sensitive: false,
470
+ },
471
+ {
472
+ id: "api_key",
473
+ label: "API Key",
474
+ placeholder: "",
475
+ type: "text",
476
+ required: true,
477
+ customField: false,
478
+ allowCustomValues: false,
479
+ disabled: false,
480
+ sensitive: true,
481
+ },
482
+ ],
483
+ configuration: [
484
+ {
485
+ resource: "leads",
486
+ defaults: [
487
+ {
488
+ target: "custom_fields",
489
+ id: "ProductInterest",
490
+ options: [
491
+ {
492
+ label: "General Channel",
493
+ value: true,
494
+ optionType: "simple",
495
+ },
496
+ {
497
+ id: "1234",
498
+ label: "General Channel",
499
+ options: [
500
+ {
501
+ label: "General Channel",
502
+ value: [
503
+ "team",
504
+ "general",
505
+ ],
506
+ optionType: "simple",
507
+ },
508
+ {
509
+ label: "General Channel",
510
+ value: [
511
+ "team",
512
+ "general",
513
+ ],
514
+ optionType: "simple",
515
+ },
516
+ {
517
+ label: "General Channel",
518
+ value: "general",
519
+ optionType: "simple",
520
+ },
521
+ ],
522
+ optionType: "group",
523
+ },
524
+ {
525
+ label: "General Channel",
526
+ value: "general",
527
+ optionType: "simple",
528
+ },
529
+ ],
530
+ value: [
531
+ "GC6000 series",
532
+ 10,
533
+ "GC6000 series",
534
+ ],
535
+ },
536
+ {
537
+ target: "custom_fields",
538
+ id: "ProductInterest",
539
+ options: [
540
+ {
541
+ id: "1234",
542
+ label: "General Channel",
543
+ options: [],
544
+ optionType: "group",
545
+ },
546
+ {
547
+ label: "General Channel",
548
+ value: 123,
549
+ optionType: "simple",
550
+ },
551
+ {
552
+ id: "1234",
553
+ label: "General Channel",
554
+ options: [
555
+ {
556
+ label: "General Channel",
557
+ value: 123,
558
+ optionType: "simple",
559
+ },
560
+ {
561
+ label: "General Channel",
562
+ value: 123,
563
+ optionType: "simple",
564
+ },
565
+ ],
566
+ optionType: "group",
567
+ },
568
+ ],
569
+ value: "GC5000 series",
570
+ },
571
+ {
572
+ target: "custom_fields",
573
+ id: "ProductInterest",
574
+ options: [
575
+ {
576
+ label: "General Channel",
577
+ value: "general",
578
+ optionType: "simple",
579
+ },
580
+ {
581
+ id: "1234",
582
+ label: "General Channel",
583
+ options: [
584
+ {
585
+ label: "General Channel",
586
+ value: true,
587
+ optionType: "simple",
588
+ },
589
+ {
590
+ label: "General Channel",
591
+ value: 12.5,
592
+ optionType: "simple",
593
+ },
594
+ {
595
+ label: "General Channel",
596
+ value: [
597
+ "team",
598
+ "general",
599
+ ],
600
+ optionType: "simple",
601
+ },
602
+ ],
603
+ optionType: "group",
604
+ },
605
+ {
606
+ id: "1234",
607
+ label: "General Channel",
608
+ options: [],
609
+ optionType: "group",
610
+ },
611
+ ],
612
+ value: 10.5,
613
+ },
614
+ ],
615
+ },
616
+ {
617
+ resource: "leads",
618
+ defaults: [
619
+ {
620
+ target: "custom_fields",
621
+ id: "ProductInterest",
622
+ options: [
623
+ {
624
+ id: "1234",
625
+ label: "General Channel",
626
+ options: [
627
+ {
628
+ label: "General Channel",
629
+ value: "general",
630
+ optionType: "simple",
631
+ },
632
+ ],
633
+ optionType: "group",
634
+ },
635
+ {
636
+ id: "1234",
637
+ label: "General Channel",
638
+ options: [
639
+ {
640
+ label: "General Channel",
641
+ value: true,
642
+ optionType: "simple",
643
+ },
644
+ {
645
+ label: "General Channel",
646
+ value: 12.5,
647
+ optionType: "simple",
648
+ },
649
+ ],
650
+ optionType: "group",
651
+ },
652
+ {
653
+ label: "General Channel",
654
+ value: [
655
+ "team",
656
+ "general",
657
+ ],
658
+ optionType: "simple",
659
+ },
660
+ ],
661
+ value: 10,
662
+ },
663
+ {
664
+ target: "custom_fields",
665
+ id: "ProductInterest",
666
+ options: [
667
+ {
668
+ label: "General Channel",
669
+ value: "general",
670
+ optionType: "simple",
671
+ },
672
+ {
673
+ id: "1234",
674
+ label: "General Channel",
675
+ options: [
676
+ {
677
+ label: "General Channel",
678
+ value: 12.5,
679
+ optionType: "simple",
680
+ },
681
+ {
682
+ label: "General Channel",
683
+ value: 123,
684
+ optionType: "simple",
685
+ },
686
+ {
687
+ label: "General Channel",
688
+ value: 12.5,
689
+ optionType: "simple",
690
+ },
691
+ ],
692
+ optionType: "group",
693
+ },
694
+ ],
695
+ value: 10,
696
+ },
697
+ {
698
+ target: "custom_fields",
699
+ id: "ProductInterest",
700
+ options: [
701
+ {
702
+ label: "General Channel",
703
+ value: true,
704
+ optionType: "simple",
705
+ },
706
+ {
707
+ label: "General Channel",
708
+ value: "general",
709
+ optionType: "simple",
710
+ },
711
+ {
712
+ label: "General Channel",
713
+ value: 123,
714
+ optionType: "simple",
715
+ },
716
+ ],
717
+ value: "GC5000 series",
718
+ },
719
+ ],
720
+ },
721
+ ],
722
+ configurableResources: [
723
+ "opportunities",
724
+ "companies",
725
+ "contacts",
726
+ "leads",
727
+ ],
728
+ resourceSchemaSupport: [
729
+ "leads",
730
+ ],
731
+ resourceSettingsSupport: [
732
+ "leads",
733
+ ],
734
+ settingsRequiredForAuthorization: [
735
+ "client_id",
736
+ "client_secret",
737
+ ],
738
+ subscriptions: [
739
+ {
740
+ downstreamId: "5f5f5f5f5f5f5f5f5f5f5f5f",
741
+ unifyEventTypes: [
742
+ "crm.contact.created",
743
+ ],
744
+ downstreamEventTypes: [
745
+ "contacts.CREATED",
746
+ ],
747
+ executeUrl:
748
+ "https://unify.apideck.com/webhook/w/{lookupIdToken}/{serviceId}?e={downstreamEventType}",
749
+ createdAt: "2020-10-01T12:00:00.000Z",
750
+ },
751
+ {
752
+ downstreamId: "5f5f5f5f5f5f5f5f5f5f5f5f",
753
+ unifyEventTypes: [
754
+ "crm.contact.created",
755
+ ],
756
+ downstreamEventTypes: [
757
+ "contacts.CREATED",
758
+ ],
759
+ executeUrl:
760
+ "https://unify.apideck.com/webhook/w/{lookupIdToken}/{serviceId}?e={downstreamEventType}",
761
+ createdAt: "2020-10-01T12:00:00.000Z",
762
+ },
763
+ {
764
+ downstreamId: "5f5f5f5f5f5f5f5f5f5f5f5f",
765
+ unifyEventTypes: [
766
+ "crm.contact.created",
767
+ ],
768
+ downstreamEventTypes: [
769
+ "contacts.CREATED",
770
+ ],
771
+ executeUrl:
772
+ "https://unify.apideck.com/webhook/w/{lookupIdToken}/{serviceId}?e={downstreamEventType}",
773
+ createdAt: "2020-10-01T12:00:00.000Z",
774
+ },
775
+ ],
776
+ hasGuide: true,
777
+ createdAt: 1615563533390,
778
+ customMappings: [
779
+ {
780
+ id: "hris+employees+first_aid_training",
781
+ label: "First Aid Training",
782
+ description: "First Aid Training completed after 2019-01-01",
783
+ value: "$.root.training.first_aid",
784
+ key: "first_aid_training",
785
+ required: false,
786
+ customField: true,
787
+ consumerId: "test_user_id",
788
+ example: "Some value",
789
+ },
790
+ {
791
+ id: "hris+employees+first_aid_training",
792
+ label: "First Aid Training",
793
+ description: "First Aid Training completed after 2019-01-01",
794
+ value: "$.root.training.first_aid",
795
+ key: "first_aid_training",
796
+ required: false,
797
+ customField: true,
798
+ consumerId: "test_user_id",
799
+ example: "Some value",
800
+ },
801
+ {
802
+ id: "hris+employees+first_aid_training",
803
+ label: "First Aid Training",
804
+ description: "First Aid Training completed after 2019-01-01",
805
+ value: "$.root.training.first_aid",
806
+ key: "first_aid_training",
807
+ required: false,
808
+ customField: true,
809
+ consumerId: "test_user_id",
810
+ example: "Some value",
811
+ },
812
+ ],
813
+ updatedAt: 1616662325753,
814
+ },
815
+ ],
816
+ });
817
+ });
818
+
819
+ test("Connections Vault Connections One", async () => {
820
+ const testHttpClient = createTestHTTPClient("vault.connectionsOne");
821
+
822
+ const apideck = new Apideck({
823
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
824
+ httpClient: testHttpClient,
825
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
826
+ });
827
+
828
+ const result = await apideck.vault.connections.get({
829
+ serviceId: "pipedrive",
830
+ unifiedApi: "crm",
831
+ });
832
+ expect(result.httpMeta.response.status).toBe(200);
833
+ expect(result.getConnectionResponse).toBeDefined();
834
+ expect(result.getConnectionResponse).toEqual({
835
+ statusCode: 200,
836
+ status: "OK",
837
+ data: {
838
+ id: "crm+salesforce",
839
+ serviceId: "salesforce",
840
+ name: "Salesforce",
841
+ tagLine:
842
+ "CRM software solutions and enterprise cloud computing from Salesforce, the leader in customer relationship management (CRM) and PaaS. Free 30 day trial.",
843
+ unifiedApi: "crm",
844
+ state: "authorized",
845
+ integrationState: "configured",
846
+ authType: "oauth2",
847
+ oauthGrantType: "authorization_code",
848
+ enabled: true,
849
+ website: "https://www.salesforce.com",
850
+ icon:
851
+ "https://res.cloudinary.com/apideck/image/upload/v1529456047/catalog/salesforce/icon128x128.png",
852
+ logo:
853
+ "https://c1.sfdcstatic.com/content/dam/web/en_us/www/images/home/logo-salesforce-m.svg",
854
+ authorizeUrl:
855
+ "https://unify.apideck.com/vault/authorize/salesforce/<application-id>?state=<state>",
856
+ revokeUrl:
857
+ "https://unify.apideck.com/vault/revoke/salesforce/<application-id>?state=<state>",
858
+ settings: {
859
+ "instance_url": "https://eu28.salesforce.com",
860
+ "api_key": "12345xxxxxx",
861
+ },
862
+ metadata: {
863
+ "account": {
864
+ "name": "My Company",
865
+ "id": "c01458a5-7276-41ce-bc19-639906b0450a",
866
+ },
867
+ "plan": "enterprise",
868
+ },
869
+ formFields: [
870
+ {
871
+ id: "instance_url",
872
+ label: "Instance url",
873
+ placeholder: "",
874
+ type: "text",
875
+ required: true,
876
+ customField: false,
877
+ allowCustomValues: false,
878
+ disabled: false,
879
+ sensitive: false,
880
+ },
881
+ {
882
+ id: "api_key",
883
+ label: "API Key",
884
+ placeholder: "",
885
+ type: "text",
886
+ required: true,
887
+ customField: false,
888
+ allowCustomValues: false,
889
+ disabled: false,
890
+ sensitive: true,
891
+ },
892
+ ],
893
+ configuration: [
894
+ {
895
+ resource: "leads",
896
+ defaults: [
897
+ {
898
+ target: "custom_fields",
899
+ id: "ProductInterest",
900
+ options: [
901
+ {
902
+ id: "1234",
903
+ label: "General Channel",
904
+ options: [
905
+ {
906
+ label: "General Channel",
907
+ value: 12.5,
908
+ optionType: "simple",
909
+ },
910
+ {
911
+ label: "General Channel",
912
+ value: 12.5,
913
+ optionType: "simple",
914
+ },
915
+ {
916
+ label: "General Channel",
917
+ value: 123,
918
+ optionType: "simple",
919
+ },
920
+ ],
921
+ optionType: "group",
922
+ },
923
+ {
924
+ label: "General Channel",
925
+ value: [
926
+ "team",
927
+ "general",
928
+ ],
929
+ optionType: "simple",
930
+ },
931
+ ],
932
+ value: 10.5,
933
+ },
934
+ {
935
+ target: "custom_fields",
936
+ id: "ProductInterest",
937
+ options: [
938
+ {
939
+ label: "General Channel",
940
+ value: 123,
941
+ optionType: "simple",
942
+ },
943
+ {
944
+ label: "General Channel",
945
+ value: "general",
946
+ optionType: "simple",
947
+ },
948
+ {
949
+ id: "1234",
950
+ label: "General Channel",
951
+ options: [
952
+ {
953
+ label: "General Channel",
954
+ value: 123,
955
+ optionType: "simple",
956
+ },
957
+ {
958
+ label: "General Channel",
959
+ value: true,
960
+ optionType: "simple",
961
+ },
962
+ {
963
+ label: "General Channel",
964
+ value: true,
965
+ optionType: "simple",
966
+ },
967
+ ],
968
+ optionType: "group",
969
+ },
970
+ ],
971
+ value: 10.5,
972
+ },
973
+ ],
974
+ },
975
+ {
976
+ resource: "leads",
977
+ defaults: [
978
+ {
979
+ target: "custom_fields",
980
+ id: "ProductInterest",
981
+ options: [
982
+ {
983
+ label: "General Channel",
984
+ value: 123,
985
+ optionType: "simple",
986
+ },
987
+ ],
988
+ value: true,
989
+ },
990
+ ],
991
+ },
992
+ {
993
+ resource: "leads",
994
+ defaults: [
995
+ {
996
+ target: "custom_fields",
997
+ id: "ProductInterest",
998
+ options: [
999
+ {
1000
+ id: "1234",
1001
+ label: "General Channel",
1002
+ options: [
1003
+ {
1004
+ label: "General Channel",
1005
+ value: [
1006
+ "team",
1007
+ "general",
1008
+ ],
1009
+ optionType: "simple",
1010
+ },
1011
+ {
1012
+ label: "General Channel",
1013
+ value: 123,
1014
+ optionType: "simple",
1015
+ },
1016
+ ],
1017
+ optionType: "group",
1018
+ },
1019
+ {
1020
+ label: "General Channel",
1021
+ value: [
1022
+ "team",
1023
+ "general",
1024
+ ],
1025
+ optionType: "simple",
1026
+ },
1027
+ {
1028
+ label: "General Channel",
1029
+ value: 12.5,
1030
+ optionType: "simple",
1031
+ },
1032
+ ],
1033
+ value: "GC5000 series",
1034
+ },
1035
+ ],
1036
+ },
1037
+ ],
1038
+ configurableResources: [
1039
+ "opportunities",
1040
+ "companies",
1041
+ "contacts",
1042
+ "leads",
1043
+ ],
1044
+ resourceSchemaSupport: [
1045
+ "leads",
1046
+ ],
1047
+ resourceSettingsSupport: [
1048
+ "leads",
1049
+ ],
1050
+ settingsRequiredForAuthorization: [
1051
+ "client_id",
1052
+ "client_secret",
1053
+ ],
1054
+ subscriptions: [
1055
+ {
1056
+ downstreamId: "5f5f5f5f5f5f5f5f5f5f5f5f",
1057
+ unifyEventTypes: [
1058
+ "crm.contact.created",
1059
+ ],
1060
+ downstreamEventTypes: [
1061
+ "contacts.CREATED",
1062
+ ],
1063
+ executeUrl:
1064
+ "https://unify.apideck.com/webhook/w/{lookupIdToken}/{serviceId}?e={downstreamEventType}",
1065
+ createdAt: "2020-10-01T12:00:00.000Z",
1066
+ },
1067
+ ],
1068
+ hasGuide: true,
1069
+ createdAt: 1615563533390,
1070
+ customMappings: [
1071
+ {
1072
+ id: "hris+employees+first_aid_training",
1073
+ label: "First Aid Training",
1074
+ description: "First Aid Training completed after 2019-01-01",
1075
+ value: "$.root.training.first_aid",
1076
+ key: "first_aid_training",
1077
+ required: false,
1078
+ customField: true,
1079
+ consumerId: "test_user_id",
1080
+ example: "Some value",
1081
+ },
1082
+ {
1083
+ id: "hris+employees+first_aid_training",
1084
+ label: "First Aid Training",
1085
+ description: "First Aid Training completed after 2019-01-01",
1086
+ value: "$.root.training.first_aid",
1087
+ key: "first_aid_training",
1088
+ required: false,
1089
+ customField: true,
1090
+ consumerId: "test_user_id",
1091
+ example: "Some value",
1092
+ },
1093
+ ],
1094
+ updatedAt: 1616662325753,
1095
+ },
1096
+ });
1097
+ });
1098
+
1099
+ it.skip("Connections Vault Connections Update", async () => {
1100
+ assert.fail(
1101
+ "incomplete test found please make sure to address the following errors: [`workflow step vault.connectionsUpdate.test referencing operation vault.connectionsUpdate with expression in requestBody with type not currently supported`, `workflow step vault.connectionsUpdate.test referencing operation vault.connectionsUpdate with expression in requestBody with type not currently supported`]",
1102
+ );
1103
+ });
1104
+
1105
+ test("Connections Vault Connections Delete", async () => {
1106
+ const testHttpClient = createTestHTTPClient("vault.connectionsDelete");
1107
+
1108
+ const apideck = new Apideck({
1109
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1110
+ httpClient: testHttpClient,
1111
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1112
+ });
1113
+
1114
+ const result = await apideck.vault.connections.delete({
1115
+ serviceId: "pipedrive",
1116
+ unifiedApi: "crm",
1117
+ });
1118
+ expect([
1119
+ 204,
1120
+ 400,
1121
+ 401,
1122
+ 402,
1123
+ 404,
1124
+ 422,
1125
+ 400,
1126
+ 401,
1127
+ 402,
1128
+ 403,
1129
+ 404,
1130
+ 405,
1131
+ 406,
1132
+ 407,
1133
+ 408,
1134
+ 409,
1135
+ 410,
1136
+ 411,
1137
+ 412,
1138
+ 413,
1139
+ 414,
1140
+ 415,
1141
+ 416,
1142
+ 417,
1143
+ 418,
1144
+ 421,
1145
+ 422,
1146
+ 423,
1147
+ 424,
1148
+ 425,
1149
+ 426,
1150
+ 428,
1151
+ 429,
1152
+ 431,
1153
+ 451,
1154
+ 500,
1155
+ 501,
1156
+ 502,
1157
+ 503,
1158
+ 504,
1159
+ 505,
1160
+ 506,
1161
+ 507,
1162
+ 508,
1163
+ 510,
1164
+ 511,
1165
+ ]).not.toContain(result.httpMeta.response.status);
1166
+ expect(result.unexpectedErrorResponse).toBeDefined();
1167
+ expect(result.unexpectedErrorResponse).toEqual({
1168
+ statusCode: 400,
1169
+ error: "Bad Request",
1170
+ typeName: "RequestHeadersValidationError",
1171
+ message: "Invalid Params",
1172
+ detail: {
1173
+ "missing": [
1174
+ {
1175
+ "x-apideck-consumer-id": "required",
1176
+ },
1177
+ ],
1178
+ },
1179
+ ref: "https://developers.apideck.com/errors#unauthorizederror",
1180
+ });
1181
+ });
1182
+
1183
+ test("Connections Vault Connections Import", async () => {
1184
+ const testHttpClient = createTestHTTPClient("vault.connectionsImport");
1185
+
1186
+ const apideck = new Apideck({
1187
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1188
+ httpClient: testHttpClient,
1189
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1190
+ });
1191
+
1192
+ const result = await apideck.vault.connections.imports({
1193
+ serviceId: "pipedrive",
1194
+ unifiedApi: "crm",
1195
+ connectionImportData: {
1196
+ credentials: {
1197
+ refreshToken:
1198
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.cThIIoDvwdueQB468K5xDc5633seEFoqwxjF_xSJyQQ",
1199
+ accessToken:
1200
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
1201
+ },
1202
+ metadata: {
1203
+ "account": {
1204
+ "id": "c01458a5-7276-41ce-bc19-639906b0450a",
1205
+ "name": "My Company",
1206
+ },
1207
+ "plan": "enterprise",
1208
+ },
1209
+ },
1210
+ });
1211
+ expect(result.httpMeta.response.status).toBe(200);
1212
+ expect(result.createConnectionResponse).toBeDefined();
1213
+ expect(result.createConnectionResponse).toEqual({
1214
+ statusCode: 201,
1215
+ status: "OK",
1216
+ data: {
1217
+ id: "crm+salesforce",
1218
+ serviceId: "salesforce",
1219
+ name: "Salesforce",
1220
+ tagLine:
1221
+ "CRM software solutions and enterprise cloud computing from Salesforce, the leader in customer relationship management (CRM) and PaaS. Free 30 day trial.",
1222
+ unifiedApi: "crm",
1223
+ state: "authorized",
1224
+ integrationState: "configured",
1225
+ authType: "oauth2",
1226
+ oauthGrantType: "authorization_code",
1227
+ enabled: true,
1228
+ website: "https://www.salesforce.com",
1229
+ icon:
1230
+ "https://res.cloudinary.com/apideck/image/upload/v1529456047/catalog/salesforce/icon128x128.png",
1231
+ logo:
1232
+ "https://c1.sfdcstatic.com/content/dam/web/en_us/www/images/home/logo-salesforce-m.svg",
1233
+ authorizeUrl:
1234
+ "https://unify.apideck.com/vault/authorize/salesforce/<application-id>?state=<state>",
1235
+ revokeUrl:
1236
+ "https://unify.apideck.com/vault/revoke/salesforce/<application-id>?state=<state>",
1237
+ settings: {
1238
+ "instance_url": "https://eu28.salesforce.com",
1239
+ "api_key": "12345xxxxxx",
1240
+ },
1241
+ metadata: {
1242
+ "account": {
1243
+ "name": "My Company",
1244
+ "id": "c01458a5-7276-41ce-bc19-639906b0450a",
1245
+ },
1246
+ "plan": "enterprise",
1247
+ },
1248
+ formFields: [
1249
+ {
1250
+ id: "instance_url",
1251
+ label: "Instance url",
1252
+ placeholder: "",
1253
+ type: "text",
1254
+ required: true,
1255
+ customField: false,
1256
+ allowCustomValues: false,
1257
+ disabled: false,
1258
+ sensitive: false,
1259
+ },
1260
+ {
1261
+ id: "api_key",
1262
+ label: "API Key",
1263
+ placeholder: "",
1264
+ type: "text",
1265
+ required: true,
1266
+ customField: false,
1267
+ allowCustomValues: false,
1268
+ disabled: false,
1269
+ sensitive: true,
1270
+ },
1271
+ ],
1272
+ configuration: [
1273
+ {
1274
+ resource: "leads",
1275
+ defaults: [
1276
+ {
1277
+ target: "custom_fields",
1278
+ id: "ProductInterest",
1279
+ options: [
1280
+ {
1281
+ id: "1234",
1282
+ label: "General Channel",
1283
+ options: [
1284
+ {
1285
+ label: "General Channel",
1286
+ value: true,
1287
+ optionType: "simple",
1288
+ },
1289
+ {
1290
+ label: "General Channel",
1291
+ value: 12.5,
1292
+ optionType: "simple",
1293
+ },
1294
+ {
1295
+ label: "General Channel",
1296
+ value: true,
1297
+ optionType: "simple",
1298
+ },
1299
+ ],
1300
+ optionType: "group",
1301
+ },
1302
+ ],
1303
+ value: 10,
1304
+ },
1305
+ {
1306
+ target: "custom_fields",
1307
+ id: "ProductInterest",
1308
+ options: [
1309
+ {
1310
+ id: "1234",
1311
+ label: "General Channel",
1312
+ options: [
1313
+ {
1314
+ label: "General Channel",
1315
+ value: true,
1316
+ optionType: "simple",
1317
+ },
1318
+ {
1319
+ label: "General Channel",
1320
+ value: [
1321
+ "team",
1322
+ "general",
1323
+ ],
1324
+ optionType: "simple",
1325
+ },
1326
+ {
1327
+ label: "General Channel",
1328
+ value: "general",
1329
+ optionType: "simple",
1330
+ },
1331
+ ],
1332
+ optionType: "group",
1333
+ },
1334
+ {
1335
+ label: "General Channel",
1336
+ value: true,
1337
+ optionType: "simple",
1338
+ },
1339
+ {
1340
+ label: "General Channel",
1341
+ value: 123,
1342
+ optionType: "simple",
1343
+ },
1344
+ ],
1345
+ value: 10,
1346
+ },
1347
+ ],
1348
+ },
1349
+ {
1350
+ resource: "leads",
1351
+ defaults: [
1352
+ {
1353
+ target: "custom_fields",
1354
+ id: "ProductInterest",
1355
+ options: [
1356
+ {
1357
+ id: "1234",
1358
+ label: "General Channel",
1359
+ options: [
1360
+ {
1361
+ label: "General Channel",
1362
+ value: true,
1363
+ optionType: "simple",
1364
+ },
1365
+ {
1366
+ label: "General Channel",
1367
+ value: "general",
1368
+ optionType: "simple",
1369
+ },
1370
+ {
1371
+ label: "General Channel",
1372
+ value: true,
1373
+ optionType: "simple",
1374
+ },
1375
+ ],
1376
+ optionType: "group",
1377
+ },
1378
+ {
1379
+ id: "1234",
1380
+ label: "General Channel",
1381
+ options: [
1382
+ {
1383
+ label: "General Channel",
1384
+ value: true,
1385
+ optionType: "simple",
1386
+ },
1387
+ {
1388
+ label: "General Channel",
1389
+ value: true,
1390
+ optionType: "simple",
1391
+ },
1392
+ ],
1393
+ optionType: "group",
1394
+ },
1395
+ {
1396
+ id: "1234",
1397
+ label: "General Channel",
1398
+ options: [],
1399
+ optionType: "group",
1400
+ },
1401
+ ],
1402
+ value: "GC5000 series",
1403
+ },
1404
+ {
1405
+ target: "custom_fields",
1406
+ id: "ProductInterest",
1407
+ options: [
1408
+ {
1409
+ label: "General Channel",
1410
+ value: [
1411
+ "team",
1412
+ "general",
1413
+ ],
1414
+ optionType: "simple",
1415
+ },
1416
+ ],
1417
+ value: "GC5000 series",
1418
+ },
1419
+ {
1420
+ target: "custom_fields",
1421
+ id: "ProductInterest",
1422
+ options: [
1423
+ {
1424
+ id: "1234",
1425
+ label: "General Channel",
1426
+ options: [
1427
+ {
1428
+ label: "General Channel",
1429
+ value: true,
1430
+ optionType: "simple",
1431
+ },
1432
+ {
1433
+ label: "General Channel",
1434
+ value: 12.5,
1435
+ optionType: "simple",
1436
+ },
1437
+ {
1438
+ label: "General Channel",
1439
+ value: 12.5,
1440
+ optionType: "simple",
1441
+ },
1442
+ ],
1443
+ optionType: "group",
1444
+ },
1445
+ {
1446
+ label: "General Channel",
1447
+ value: "general",
1448
+ optionType: "simple",
1449
+ },
1450
+ {
1451
+ id: "1234",
1452
+ label: "General Channel",
1453
+ options: [
1454
+ {
1455
+ label: "General Channel",
1456
+ value: [
1457
+ "team",
1458
+ "general",
1459
+ ],
1460
+ optionType: "simple",
1461
+ },
1462
+ ],
1463
+ optionType: "group",
1464
+ },
1465
+ ],
1466
+ value: [
1467
+ 10,
1468
+ ],
1469
+ },
1470
+ ],
1471
+ },
1472
+ {
1473
+ resource: "leads",
1474
+ defaults: [
1475
+ {
1476
+ target: "custom_fields",
1477
+ id: "ProductInterest",
1478
+ options: [
1479
+ {
1480
+ label: "General Channel",
1481
+ value: "general",
1482
+ optionType: "simple",
1483
+ },
1484
+ ],
1485
+ value: [
1486
+ "GC6000 series",
1487
+ 10.5,
1488
+ 10,
1489
+ ],
1490
+ },
1491
+ ],
1492
+ },
1493
+ ],
1494
+ configurableResources: [
1495
+ "opportunities",
1496
+ "companies",
1497
+ "contacts",
1498
+ "leads",
1499
+ ],
1500
+ resourceSchemaSupport: [
1501
+ "leads",
1502
+ ],
1503
+ resourceSettingsSupport: [
1504
+ "leads",
1505
+ ],
1506
+ settingsRequiredForAuthorization: [
1507
+ "client_id",
1508
+ "client_secret",
1509
+ ],
1510
+ subscriptions: [
1511
+ {
1512
+ downstreamId: "5f5f5f5f5f5f5f5f5f5f5f5f",
1513
+ unifyEventTypes: [
1514
+ "crm.contact.created",
1515
+ ],
1516
+ downstreamEventTypes: [
1517
+ "contacts.CREATED",
1518
+ ],
1519
+ executeUrl:
1520
+ "https://unify.apideck.com/webhook/w/{lookupIdToken}/{serviceId}?e={downstreamEventType}",
1521
+ createdAt: "2020-10-01T12:00:00.000Z",
1522
+ },
1523
+ ],
1524
+ hasGuide: true,
1525
+ createdAt: 1615563533390,
1526
+ customMappings: [
1527
+ {
1528
+ id: "hris+employees+first_aid_training",
1529
+ label: "First Aid Training",
1530
+ description: "First Aid Training completed after 2019-01-01",
1531
+ value: "$.root.training.first_aid",
1532
+ key: "first_aid_training",
1533
+ required: false,
1534
+ customField: true,
1535
+ consumerId: "test_user_id",
1536
+ example: "Some value",
1537
+ },
1538
+ ],
1539
+ updatedAt: 1616662325753,
1540
+ },
1541
+ });
1542
+ });
1543
+
1544
+ test("Connections Vault Connections Token", async () => {
1545
+ const testHttpClient = createTestHTTPClient("vault.connectionsToken");
1546
+
1547
+ const apideck = new Apideck({
1548
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1549
+ httpClient: testHttpClient,
1550
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1551
+ });
1552
+
1553
+ const result = await apideck.vault.connections.token({
1554
+ serviceId: "pipedrive",
1555
+ unifiedApi: "crm",
1556
+ });
1557
+ expect(result.httpMeta.response.status).toBe(200);
1558
+ expect(result.getConnectionResponse).toBeDefined();
1559
+ expect(result.getConnectionResponse).toEqual({
1560
+ statusCode: 200,
1561
+ status: "OK",
1562
+ data: {
1563
+ id: "crm+salesforce",
1564
+ serviceId: "salesforce",
1565
+ name: "Salesforce",
1566
+ tagLine:
1567
+ "CRM software solutions and enterprise cloud computing from Salesforce, the leader in customer relationship management (CRM) and PaaS. Free 30 day trial.",
1568
+ unifiedApi: "crm",
1569
+ state: "authorized",
1570
+ integrationState: "configured",
1571
+ authType: "oauth2",
1572
+ oauthGrantType: "authorization_code",
1573
+ enabled: true,
1574
+ website: "https://www.salesforce.com",
1575
+ icon:
1576
+ "https://res.cloudinary.com/apideck/image/upload/v1529456047/catalog/salesforce/icon128x128.png",
1577
+ logo:
1578
+ "https://c1.sfdcstatic.com/content/dam/web/en_us/www/images/home/logo-salesforce-m.svg",
1579
+ authorizeUrl:
1580
+ "https://unify.apideck.com/vault/authorize/salesforce/<application-id>?state=<state>",
1581
+ revokeUrl:
1582
+ "https://unify.apideck.com/vault/revoke/salesforce/<application-id>?state=<state>",
1583
+ settings: {
1584
+ "instance_url": "https://eu28.salesforce.com",
1585
+ "api_key": "12345xxxxxx",
1586
+ },
1587
+ metadata: {
1588
+ "account": {
1589
+ "name": "My Company",
1590
+ "id": "c01458a5-7276-41ce-bc19-639906b0450a",
1591
+ },
1592
+ "plan": "enterprise",
1593
+ },
1594
+ formFields: [
1595
+ {
1596
+ id: "instance_url",
1597
+ label: "Instance url",
1598
+ placeholder: "",
1599
+ type: "text",
1600
+ required: true,
1601
+ customField: false,
1602
+ allowCustomValues: false,
1603
+ disabled: false,
1604
+ sensitive: false,
1605
+ },
1606
+ {
1607
+ id: "api_key",
1608
+ label: "API Key",
1609
+ placeholder: "",
1610
+ type: "text",
1611
+ required: true,
1612
+ customField: false,
1613
+ allowCustomValues: false,
1614
+ disabled: false,
1615
+ sensitive: true,
1616
+ },
1617
+ ],
1618
+ configuration: [
1619
+ {
1620
+ resource: "leads",
1621
+ defaults: [
1622
+ {
1623
+ target: "custom_fields",
1624
+ id: "ProductInterest",
1625
+ options: [
1626
+ {
1627
+ label: "General Channel",
1628
+ value: true,
1629
+ optionType: "simple",
1630
+ },
1631
+ {
1632
+ label: "General Channel",
1633
+ value: true,
1634
+ optionType: "simple",
1635
+ },
1636
+ ],
1637
+ value: [],
1638
+ },
1639
+ {
1640
+ target: "custom_fields",
1641
+ id: "ProductInterest",
1642
+ options: [
1643
+ {
1644
+ label: "General Channel",
1645
+ value: true,
1646
+ optionType: "simple",
1647
+ },
1648
+ ],
1649
+ value: "GC5000 series",
1650
+ },
1651
+ ],
1652
+ },
1653
+ ],
1654
+ configurableResources: [
1655
+ "opportunities",
1656
+ "companies",
1657
+ "contacts",
1658
+ "leads",
1659
+ ],
1660
+ resourceSchemaSupport: [
1661
+ "leads",
1662
+ ],
1663
+ resourceSettingsSupport: [
1664
+ "leads",
1665
+ ],
1666
+ settingsRequiredForAuthorization: [
1667
+ "client_id",
1668
+ "client_secret",
1669
+ ],
1670
+ subscriptions: [
1671
+ {
1672
+ downstreamId: "5f5f5f5f5f5f5f5f5f5f5f5f",
1673
+ unifyEventTypes: [
1674
+ "crm.contact.created",
1675
+ ],
1676
+ downstreamEventTypes: [
1677
+ "contacts.CREATED",
1678
+ ],
1679
+ executeUrl:
1680
+ "https://unify.apideck.com/webhook/w/{lookupIdToken}/{serviceId}?e={downstreamEventType}",
1681
+ createdAt: "2020-10-01T12:00:00.000Z",
1682
+ },
1683
+ ],
1684
+ hasGuide: true,
1685
+ createdAt: 1615563533390,
1686
+ customMappings: [
1687
+ {
1688
+ id: "hris+employees+first_aid_training",
1689
+ label: "First Aid Training",
1690
+ description: "First Aid Training completed after 2019-01-01",
1691
+ value: "$.root.training.first_aid",
1692
+ key: "first_aid_training",
1693
+ required: false,
1694
+ customField: true,
1695
+ consumerId: "test_user_id",
1696
+ example: "Some value",
1697
+ },
1698
+ {
1699
+ id: "hris+employees+first_aid_training",
1700
+ label: "First Aid Training",
1701
+ description: "First Aid Training completed after 2019-01-01",
1702
+ value: "$.root.training.first_aid",
1703
+ key: "first_aid_training",
1704
+ required: false,
1705
+ customField: true,
1706
+ consumerId: "test_user_id",
1707
+ example: "Some value",
1708
+ },
1709
+ ],
1710
+ updatedAt: 1616662325753,
1711
+ },
1712
+ });
1713
+ });