@apideck/unify 0.40.0 → 0.41.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.
Files changed (96) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +4 -4
  3. package/lib/config.js +4 -4
  4. package/package.json +6 -2
  5. package/src/__tests__/activities.test.ts +1141 -0
  6. package/src/__tests__/agedcreditors.test.ts +280 -0
  7. package/src/__tests__/ageddebtors.test.ts +280 -0
  8. package/src/__tests__/apideckcompanies.test.ts +1082 -0
  9. package/src/__tests__/apideckcustomers.test.ts +364 -0
  10. package/src/__tests__/apideckdepartments.test.ts +497 -0
  11. package/src/__tests__/apiresources.test.ts +62 -0
  12. package/src/__tests__/apis.test.ts +216 -0
  13. package/src/__tests__/applicants.test.ts +1445 -0
  14. package/src/__tests__/applications.test.ts +515 -0
  15. package/src/__tests__/assertions.ts +13 -0
  16. package/src/__tests__/attachments.test.ts +371 -0
  17. package/src/__tests__/balancesheet.test.ts +453 -0
  18. package/src/__tests__/bankaccounts.test.ts +324 -0
  19. package/src/__tests__/bankfeedaccounts.test.ts +343 -0
  20. package/src/__tests__/bankfeedstatements.test.ts +408 -0
  21. package/src/__tests__/billpayments.test.ts +1031 -0
  22. package/src/__tests__/bills.test.ts +1630 -0
  23. package/src/__tests__/categories.test.ts +127 -0
  24. package/src/__tests__/collections.test.ts +120 -0
  25. package/src/__tests__/collectiontags.test.ts +68 -0
  26. package/src/__tests__/collectionticketcomments.test.ts +501 -0
  27. package/src/__tests__/collectiontickets.test.ts +627 -0
  28. package/src/__tests__/collectionusers.test.ts +126 -0
  29. package/src/__tests__/companies.test.ts +1642 -0
  30. package/src/__tests__/companyinfo.test.ts +219 -0
  31. package/src/__tests__/connectionconsent.test.ts +89 -0
  32. package/src/__tests__/connectionconsents.test.ts +31 -0
  33. package/src/__tests__/connectioncustommappings.test.ts +69 -0
  34. package/src/__tests__/connections.test.ts +2127 -0
  35. package/src/__tests__/connectionsettings.test.ts +687 -0
  36. package/src/__tests__/connectordocs.test.ts +29 -0
  37. package/src/__tests__/connectors.test.ts +753 -0
  38. package/src/__tests__/consumerrequestcounts.test.ts +42 -0
  39. package/src/__tests__/consumers.test.ts +523 -0
  40. package/src/__tests__/contacts.test.ts +1421 -0
  41. package/src/__tests__/createcallback.test.ts +36 -0
  42. package/src/__tests__/creditnotes.test.ts +2040 -0
  43. package/src/__tests__/customers.test.ts +1600 -0
  44. package/src/__tests__/customfields.test.ts +52 -0
  45. package/src/__tests__/custommappings.test.ts +65 -0
  46. package/src/__tests__/customobjects.test.ts +408 -0
  47. package/src/__tests__/customobjectschemas.test.ts +734 -0
  48. package/src/__tests__/departments.test.ts +529 -0
  49. package/src/__tests__/drivegroups.test.ts +496 -0
  50. package/src/__tests__/drives.test.ts +487 -0
  51. package/src/__tests__/employeepayrolls.test.ts +491 -0
  52. package/src/__tests__/employees.test.ts +2968 -0
  53. package/src/__tests__/employeeschedules.test.ts +457 -0
  54. package/src/__tests__/eventlogs.test.ts +158 -0
  55. package/src/__tests__/expensecategories.test.ts +324 -0
  56. package/src/__tests__/expensereports.test.ts +634 -0
  57. package/src/__tests__/expenses.test.ts +867 -0
  58. package/src/__tests__/files.test.ts +506 -0
  59. package/src/__tests__/files.ts +56 -0
  60. package/src/__tests__/folders.test.ts +390 -0
  61. package/src/__tests__/invoiceitems.test.ts +855 -0
  62. package/src/__tests__/invoices.test.ts +2173 -0
  63. package/src/__tests__/jobs.test.ts +1150 -0
  64. package/src/__tests__/journalentries.test.ts +1542 -0
  65. package/src/__tests__/leads.test.ts +1341 -0
  66. package/src/__tests__/ledgeraccounts.test.ts +829 -0
  67. package/src/__tests__/locations.test.ts +856 -0
  68. package/src/__tests__/logs.test.ts +137 -0
  69. package/src/__tests__/messages.test.ts +588 -0
  70. package/src/__tests__/notes.test.ts +523 -0
  71. package/src/__tests__/opportunities.test.ts +718 -0
  72. package/src/__tests__/orders.test.ts +854 -0
  73. package/src/__tests__/payments.test.ts +867 -0
  74. package/src/__tests__/payrolls.test.ts +485 -0
  75. package/src/__tests__/pipelines.test.ts +574 -0
  76. package/src/__tests__/products.test.ts +509 -0
  77. package/src/__tests__/profitandloss.test.ts +223 -0
  78. package/src/__tests__/projects.test.ts +480 -0
  79. package/src/__tests__/proxy.test.ts +41 -0
  80. package/src/__tests__/purchaseorders.test.ts +2139 -0
  81. package/src/__tests__/quotes.test.ts +678 -0
  82. package/src/__tests__/refunds.test.ts +812 -0
  83. package/src/__tests__/sessions.test.ts +72 -0
  84. package/src/__tests__/sharedlinks.test.ts +511 -0
  85. package/src/__tests__/stores.test.ts +41 -0
  86. package/src/__tests__/subsidiaries.test.ts +496 -0
  87. package/src/__tests__/suppliers.test.ts +1574 -0
  88. package/src/__tests__/taxrates.test.ts +701 -0
  89. package/src/__tests__/testclient.ts +48 -0
  90. package/src/__tests__/timeoffrequests.test.ts +588 -0
  91. package/src/__tests__/trackingcategories.test.ts +515 -0
  92. package/src/__tests__/uploadsessions.test.ts +221 -0
  93. package/src/__tests__/users.test.ts +1020 -0
  94. package/src/__tests__/validateconnection.test.ts +34 -0
  95. package/src/__tests__/webhooks.test.ts +254 -0
  96. package/src/lib/config.ts +4 -4
@@ -0,0 +1,1082 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { expect, test } from "vitest";
6
+ import { Apideck } from "../index.js";
7
+ import { createTestHTTPClient } from "./testclient.js";
8
+
9
+ test("Apideck Companies Hris Companies All", async () => {
10
+ const testHttpClient = createTestHTTPClient("hris.companiesAll");
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.hris.companies.list({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ passThrough: {
23
+ "search": "San Francisco",
24
+ },
25
+ fields: "id,updated_at",
26
+ });
27
+ expect(result.httpMeta.response.status).toBe(200);
28
+ expect(result.getHrisCompaniesResponse).toBeDefined();
29
+ expect(result.getHrisCompaniesResponse).toEqual({
30
+ statusCode: 200,
31
+ status: "OK",
32
+ service: "undefined",
33
+ resource: "Companies",
34
+ operation: "all",
35
+ data: [
36
+ {
37
+ id: "12345",
38
+ legalName: "SpaceX",
39
+ displayName: "SpaceX",
40
+ subdomain: "company",
41
+ status: "active",
42
+ companyNumber: "123456-AB",
43
+ currency: "USD",
44
+ addresses: [
45
+ {
46
+ id: "123",
47
+ type: "primary",
48
+ string: "25 Spring Street, Blackburn, VIC 3130",
49
+ name: "HQ US",
50
+ line1: "Main street",
51
+ line2: "apt #",
52
+ line3: "Suite #",
53
+ line4: "delivery instructions",
54
+ streetNumber: "25",
55
+ city: "San Francisco",
56
+ state: "CA",
57
+ postalCode: "94104",
58
+ country: "US",
59
+ latitude: "40.759211",
60
+ longitude: "-73.984638",
61
+ county: "Santa Clara",
62
+ contactName: "Elon Musk",
63
+ salutation: "Mr",
64
+ phoneNumber: "111-111-1111",
65
+ fax: "122-111-1111",
66
+ email: "elon@musk.com",
67
+ website: "https://elonmusk.com",
68
+ notes: "Address notes or delivery instructions.",
69
+ rowVersion: "1-12345",
70
+ },
71
+ {
72
+ id: "123",
73
+ type: "primary",
74
+ string: "25 Spring Street, Blackburn, VIC 3130",
75
+ name: "HQ US",
76
+ line1: "Main street",
77
+ line2: "apt #",
78
+ line3: "Suite #",
79
+ line4: "delivery instructions",
80
+ streetNumber: "25",
81
+ city: "San Francisco",
82
+ state: "CA",
83
+ postalCode: "94104",
84
+ country: "US",
85
+ latitude: "40.759211",
86
+ longitude: "-73.984638",
87
+ county: "Santa Clara",
88
+ contactName: "Elon Musk",
89
+ salutation: "Mr",
90
+ phoneNumber: "111-111-1111",
91
+ fax: "122-111-1111",
92
+ email: "elon@musk.com",
93
+ website: "https://elonmusk.com",
94
+ notes: "Address notes or delivery instructions.",
95
+ rowVersion: "1-12345",
96
+ },
97
+ ],
98
+ phoneNumbers: [
99
+ {
100
+ id: "12345",
101
+ countryCode: "1",
102
+ areaCode: "323",
103
+ number: "111-111-1111",
104
+ extension: "105",
105
+ type: "primary",
106
+ },
107
+ {
108
+ id: "12345",
109
+ countryCode: "1",
110
+ areaCode: "323",
111
+ number: "111-111-1111",
112
+ extension: "105",
113
+ type: "primary",
114
+ },
115
+ {
116
+ id: "12345",
117
+ countryCode: "1",
118
+ areaCode: "323",
119
+ number: "111-111-1111",
120
+ extension: "105",
121
+ type: "primary",
122
+ },
123
+ ],
124
+ emails: [
125
+ {
126
+ id: "123",
127
+ email: "elon@musk.com",
128
+ type: "primary",
129
+ },
130
+ ],
131
+ websites: [
132
+ {
133
+ id: "12345",
134
+ url: "http://example.com",
135
+ type: "primary",
136
+ },
137
+ ],
138
+ debtorId: "12345",
139
+ deleted: false,
140
+ updatedBy: "12345",
141
+ createdBy: "12345",
142
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
143
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
144
+ passThrough: [
145
+ {
146
+ serviceId: "<id>",
147
+ extendPaths: [
148
+ {
149
+ path: "$.nested.property",
150
+ value: {
151
+ "TaxClassificationRef": {
152
+ "value": "EUC-99990201-V1-00020000",
153
+ },
154
+ },
155
+ },
156
+ {
157
+ path: "$.nested.property",
158
+ value: {
159
+ "TaxClassificationRef": {
160
+ "value": "EUC-99990201-V1-00020000",
161
+ },
162
+ },
163
+ },
164
+ ],
165
+ },
166
+ ],
167
+ },
168
+ {
169
+ id: "12345",
170
+ legalName: "SpaceX",
171
+ displayName: "SpaceX",
172
+ subdomain: "company",
173
+ status: "active",
174
+ companyNumber: "123456-AB",
175
+ currency: "USD",
176
+ addresses: [
177
+ {
178
+ id: "123",
179
+ type: "primary",
180
+ string: "25 Spring Street, Blackburn, VIC 3130",
181
+ name: "HQ US",
182
+ line1: "Main street",
183
+ line2: "apt #",
184
+ line3: "Suite #",
185
+ line4: "delivery instructions",
186
+ streetNumber: "25",
187
+ city: "San Francisco",
188
+ state: "CA",
189
+ postalCode: "94104",
190
+ country: "US",
191
+ latitude: "40.759211",
192
+ longitude: "-73.984638",
193
+ county: "Santa Clara",
194
+ contactName: "Elon Musk",
195
+ salutation: "Mr",
196
+ phoneNumber: "111-111-1111",
197
+ fax: "122-111-1111",
198
+ email: "elon@musk.com",
199
+ website: "https://elonmusk.com",
200
+ notes: "Address notes or delivery instructions.",
201
+ rowVersion: "1-12345",
202
+ },
203
+ {
204
+ id: "123",
205
+ type: "primary",
206
+ string: "25 Spring Street, Blackburn, VIC 3130",
207
+ name: "HQ US",
208
+ line1: "Main street",
209
+ line2: "apt #",
210
+ line3: "Suite #",
211
+ line4: "delivery instructions",
212
+ streetNumber: "25",
213
+ city: "San Francisco",
214
+ state: "CA",
215
+ postalCode: "94104",
216
+ country: "US",
217
+ latitude: "40.759211",
218
+ longitude: "-73.984638",
219
+ county: "Santa Clara",
220
+ contactName: "Elon Musk",
221
+ salutation: "Mr",
222
+ phoneNumber: "111-111-1111",
223
+ fax: "122-111-1111",
224
+ email: "elon@musk.com",
225
+ website: "https://elonmusk.com",
226
+ notes: "Address notes or delivery instructions.",
227
+ rowVersion: "1-12345",
228
+ },
229
+ ],
230
+ phoneNumbers: [
231
+ {
232
+ id: "12345",
233
+ countryCode: "1",
234
+ areaCode: "323",
235
+ number: "111-111-1111",
236
+ extension: "105",
237
+ type: "primary",
238
+ },
239
+ ],
240
+ emails: [
241
+ {
242
+ id: "123",
243
+ email: "elon@musk.com",
244
+ type: "primary",
245
+ },
246
+ {
247
+ id: "123",
248
+ email: "elon@musk.com",
249
+ type: "primary",
250
+ },
251
+ {
252
+ id: "123",
253
+ email: "elon@musk.com",
254
+ type: "primary",
255
+ },
256
+ ],
257
+ websites: [
258
+ {
259
+ id: "12345",
260
+ url: "http://example.com",
261
+ type: "primary",
262
+ },
263
+ ],
264
+ debtorId: "12345",
265
+ deleted: false,
266
+ updatedBy: "12345",
267
+ createdBy: "12345",
268
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
269
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
270
+ passThrough: [
271
+ {
272
+ serviceId: "<id>",
273
+ extendPaths: [
274
+ {
275
+ path: "$.nested.property",
276
+ value: {
277
+ "TaxClassificationRef": {
278
+ "value": "EUC-99990201-V1-00020000",
279
+ },
280
+ },
281
+ },
282
+ {
283
+ path: "$.nested.property",
284
+ value: {
285
+ "TaxClassificationRef": {
286
+ "value": "EUC-99990201-V1-00020000",
287
+ },
288
+ },
289
+ },
290
+ {
291
+ path: "$.nested.property",
292
+ value: {
293
+ "TaxClassificationRef": {
294
+ "value": "EUC-99990201-V1-00020000",
295
+ },
296
+ },
297
+ },
298
+ ],
299
+ },
300
+ ],
301
+ },
302
+ {
303
+ id: "12345",
304
+ legalName: "SpaceX",
305
+ displayName: "SpaceX",
306
+ subdomain: "company",
307
+ status: "active",
308
+ companyNumber: "123456-AB",
309
+ currency: "USD",
310
+ addresses: [
311
+ {
312
+ id: "123",
313
+ type: "primary",
314
+ string: "25 Spring Street, Blackburn, VIC 3130",
315
+ name: "HQ US",
316
+ line1: "Main street",
317
+ line2: "apt #",
318
+ line3: "Suite #",
319
+ line4: "delivery instructions",
320
+ streetNumber: "25",
321
+ city: "San Francisco",
322
+ state: "CA",
323
+ postalCode: "94104",
324
+ country: "US",
325
+ latitude: "40.759211",
326
+ longitude: "-73.984638",
327
+ county: "Santa Clara",
328
+ contactName: "Elon Musk",
329
+ salutation: "Mr",
330
+ phoneNumber: "111-111-1111",
331
+ fax: "122-111-1111",
332
+ email: "elon@musk.com",
333
+ website: "https://elonmusk.com",
334
+ notes: "Address notes or delivery instructions.",
335
+ rowVersion: "1-12345",
336
+ },
337
+ {
338
+ id: "123",
339
+ type: "primary",
340
+ string: "25 Spring Street, Blackburn, VIC 3130",
341
+ name: "HQ US",
342
+ line1: "Main street",
343
+ line2: "apt #",
344
+ line3: "Suite #",
345
+ line4: "delivery instructions",
346
+ streetNumber: "25",
347
+ city: "San Francisco",
348
+ state: "CA",
349
+ postalCode: "94104",
350
+ country: "US",
351
+ latitude: "40.759211",
352
+ longitude: "-73.984638",
353
+ county: "Santa Clara",
354
+ contactName: "Elon Musk",
355
+ salutation: "Mr",
356
+ phoneNumber: "111-111-1111",
357
+ fax: "122-111-1111",
358
+ email: "elon@musk.com",
359
+ website: "https://elonmusk.com",
360
+ notes: "Address notes or delivery instructions.",
361
+ rowVersion: "1-12345",
362
+ },
363
+ ],
364
+ phoneNumbers: [
365
+ {
366
+ id: "12345",
367
+ countryCode: "1",
368
+ areaCode: "323",
369
+ number: "111-111-1111",
370
+ extension: "105",
371
+ type: "primary",
372
+ },
373
+ {
374
+ id: "12345",
375
+ countryCode: "1",
376
+ areaCode: "323",
377
+ number: "111-111-1111",
378
+ extension: "105",
379
+ type: "primary",
380
+ },
381
+ ],
382
+ emails: [
383
+ {
384
+ id: "123",
385
+ email: "elon@musk.com",
386
+ type: "primary",
387
+ },
388
+ ],
389
+ websites: [
390
+ {
391
+ id: "12345",
392
+ url: "http://example.com",
393
+ type: "primary",
394
+ },
395
+ ],
396
+ debtorId: "12345",
397
+ deleted: false,
398
+ updatedBy: "12345",
399
+ createdBy: "12345",
400
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
401
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
402
+ passThrough: [
403
+ {
404
+ serviceId: "<id>",
405
+ extendPaths: [
406
+ {
407
+ path: "$.nested.property",
408
+ value: {
409
+ "TaxClassificationRef": {
410
+ "value": "EUC-99990201-V1-00020000",
411
+ },
412
+ },
413
+ },
414
+ {
415
+ path: "$.nested.property",
416
+ value: {
417
+ "TaxClassificationRef": {
418
+ "value": "EUC-99990201-V1-00020000",
419
+ },
420
+ },
421
+ },
422
+ ],
423
+ },
424
+ {
425
+ serviceId: "<id>",
426
+ extendPaths: [
427
+ {
428
+ path: "$.nested.property",
429
+ value: {
430
+ "TaxClassificationRef": {
431
+ "value": "EUC-99990201-V1-00020000",
432
+ },
433
+ },
434
+ },
435
+ ],
436
+ },
437
+ ],
438
+ },
439
+ ],
440
+ meta: {
441
+ itemsOnPage: 50,
442
+ cursors: {
443
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
444
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
445
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
446
+ },
447
+ },
448
+ links: {
449
+ previous:
450
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
451
+ current: "https://unify.apideck.com/crm/companies",
452
+ next:
453
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
454
+ },
455
+ });
456
+ });
457
+
458
+ test("Apideck Companies Hris Companies Add", async () => {
459
+ const testHttpClient = createTestHTTPClient("hris.companiesAdd");
460
+
461
+ const apideck = new Apideck({
462
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
463
+ httpClient: testHttpClient,
464
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
465
+ });
466
+
467
+ const result = await apideck.hris.companies.create({
468
+ consumerId: "test-consumer",
469
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
470
+ serviceId: "salesforce",
471
+ hrisCompany: {
472
+ legalName: "SpaceX",
473
+ displayName: "SpaceX",
474
+ subdomain: "company",
475
+ status: "active",
476
+ companyNumber: "123456-AB",
477
+ currency: "USD",
478
+ addresses: [
479
+ {
480
+ id: "123",
481
+ type: "primary",
482
+ string: "25 Spring Street, Blackburn, VIC 3130",
483
+ name: "HQ US",
484
+ line1: "Main street",
485
+ line2: "apt #",
486
+ line3: "Suite #",
487
+ line4: "delivery instructions",
488
+ streetNumber: "25",
489
+ city: "San Francisco",
490
+ state: "CA",
491
+ postalCode: "94104",
492
+ country: "US",
493
+ latitude: "40.759211",
494
+ longitude: "-73.984638",
495
+ county: "Santa Clara",
496
+ contactName: "Elon Musk",
497
+ salutation: "Mr",
498
+ phoneNumber: "111-111-1111",
499
+ fax: "122-111-1111",
500
+ email: "elon@musk.com",
501
+ website: "https://elonmusk.com",
502
+ notes: "Address notes or delivery instructions.",
503
+ rowVersion: "1-12345",
504
+ },
505
+ {
506
+ id: "123",
507
+ type: "primary",
508
+ string: "25 Spring Street, Blackburn, VIC 3130",
509
+ name: "HQ US",
510
+ line1: "Main street",
511
+ line2: "apt #",
512
+ line3: "Suite #",
513
+ line4: "delivery instructions",
514
+ streetNumber: "25",
515
+ city: "San Francisco",
516
+ state: "CA",
517
+ postalCode: "94104",
518
+ country: "US",
519
+ latitude: "40.759211",
520
+ longitude: "-73.984638",
521
+ county: "Santa Clara",
522
+ contactName: "Elon Musk",
523
+ salutation: "Mr",
524
+ phoneNumber: "111-111-1111",
525
+ fax: "122-111-1111",
526
+ email: "elon@musk.com",
527
+ website: "https://elonmusk.com",
528
+ notes: "Address notes or delivery instructions.",
529
+ rowVersion: "1-12345",
530
+ },
531
+ ],
532
+ phoneNumbers: [
533
+ {
534
+ id: "12345",
535
+ countryCode: "1",
536
+ areaCode: "323",
537
+ number: "111-111-1111",
538
+ extension: "105",
539
+ type: "primary",
540
+ },
541
+ {
542
+ id: "12345",
543
+ countryCode: "1",
544
+ areaCode: "323",
545
+ number: "111-111-1111",
546
+ extension: "105",
547
+ type: "primary",
548
+ },
549
+ ],
550
+ emails: [
551
+ {
552
+ id: "123",
553
+ email: "elon@musk.com",
554
+ type: "primary",
555
+ },
556
+ {
557
+ id: "123",
558
+ email: "elon@musk.com",
559
+ type: "primary",
560
+ },
561
+ ],
562
+ websites: [
563
+ {
564
+ id: "12345",
565
+ url: "http://example.com",
566
+ type: "primary",
567
+ },
568
+ ],
569
+ debtorId: "12345",
570
+ passThrough: [
571
+ {
572
+ serviceId: "<id>",
573
+ extendPaths: [
574
+ {
575
+ path: "$.nested.property",
576
+ value: {
577
+ "TaxClassificationRef": {
578
+ "value": "EUC-99990201-V1-00020000",
579
+ },
580
+ },
581
+ },
582
+ {
583
+ path: "$.nested.property",
584
+ value: {
585
+ "TaxClassificationRef": {
586
+ "value": "EUC-99990201-V1-00020000",
587
+ },
588
+ },
589
+ },
590
+ {
591
+ path: "$.nested.property",
592
+ value: {
593
+ "TaxClassificationRef": {
594
+ "value": "EUC-99990201-V1-00020000",
595
+ },
596
+ },
597
+ },
598
+ ],
599
+ },
600
+ ],
601
+ },
602
+ });
603
+ expect(result.httpMeta.response.status).toBe(201);
604
+ expect(result.createHrisCompanyResponse).toBeDefined();
605
+ expect(result.createHrisCompanyResponse).toEqual({
606
+ statusCode: 200,
607
+ status: "OK",
608
+ service: "undefined",
609
+ resource: "Companies",
610
+ operation: "add",
611
+ data: {
612
+ id: "12345",
613
+ },
614
+ });
615
+ });
616
+
617
+ test("Apideck Companies Hris Companies One", async () => {
618
+ const testHttpClient = createTestHTTPClient("hris.companiesOne");
619
+
620
+ const apideck = new Apideck({
621
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
622
+ httpClient: testHttpClient,
623
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
624
+ });
625
+
626
+ const result = await apideck.hris.companies.get({
627
+ id: "<id>",
628
+ consumerId: "test-consumer",
629
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
630
+ serviceId: "salesforce",
631
+ fields: "id,updated_at",
632
+ });
633
+ expect(result.httpMeta.response.status).toBe(200);
634
+ expect(result.getHrisCompanyResponse).toBeDefined();
635
+ expect(result.getHrisCompanyResponse).toEqual({
636
+ statusCode: 200,
637
+ status: "OK",
638
+ service: "undefined",
639
+ resource: "Companies",
640
+ operation: "one",
641
+ data: {
642
+ id: "12345",
643
+ legalName: "SpaceX",
644
+ displayName: "SpaceX",
645
+ subdomain: "company",
646
+ status: "active",
647
+ companyNumber: "123456-AB",
648
+ currency: "USD",
649
+ addresses: [
650
+ {
651
+ id: "123",
652
+ type: "primary",
653
+ string: "25 Spring Street, Blackburn, VIC 3130",
654
+ name: "HQ US",
655
+ line1: "Main street",
656
+ line2: "apt #",
657
+ line3: "Suite #",
658
+ line4: "delivery instructions",
659
+ streetNumber: "25",
660
+ city: "San Francisco",
661
+ state: "CA",
662
+ postalCode: "94104",
663
+ country: "US",
664
+ latitude: "40.759211",
665
+ longitude: "-73.984638",
666
+ county: "Santa Clara",
667
+ contactName: "Elon Musk",
668
+ salutation: "Mr",
669
+ phoneNumber: "111-111-1111",
670
+ fax: "122-111-1111",
671
+ email: "elon@musk.com",
672
+ website: "https://elonmusk.com",
673
+ notes: "Address notes or delivery instructions.",
674
+ rowVersion: "1-12345",
675
+ },
676
+ {
677
+ id: "123",
678
+ type: "primary",
679
+ string: "25 Spring Street, Blackburn, VIC 3130",
680
+ name: "HQ US",
681
+ line1: "Main street",
682
+ line2: "apt #",
683
+ line3: "Suite #",
684
+ line4: "delivery instructions",
685
+ streetNumber: "25",
686
+ city: "San Francisco",
687
+ state: "CA",
688
+ postalCode: "94104",
689
+ country: "US",
690
+ latitude: "40.759211",
691
+ longitude: "-73.984638",
692
+ county: "Santa Clara",
693
+ contactName: "Elon Musk",
694
+ salutation: "Mr",
695
+ phoneNumber: "111-111-1111",
696
+ fax: "122-111-1111",
697
+ email: "elon@musk.com",
698
+ website: "https://elonmusk.com",
699
+ notes: "Address notes or delivery instructions.",
700
+ rowVersion: "1-12345",
701
+ },
702
+ {
703
+ id: "123",
704
+ type: "primary",
705
+ string: "25 Spring Street, Blackburn, VIC 3130",
706
+ name: "HQ US",
707
+ line1: "Main street",
708
+ line2: "apt #",
709
+ line3: "Suite #",
710
+ line4: "delivery instructions",
711
+ streetNumber: "25",
712
+ city: "San Francisco",
713
+ state: "CA",
714
+ postalCode: "94104",
715
+ country: "US",
716
+ latitude: "40.759211",
717
+ longitude: "-73.984638",
718
+ county: "Santa Clara",
719
+ contactName: "Elon Musk",
720
+ salutation: "Mr",
721
+ phoneNumber: "111-111-1111",
722
+ fax: "122-111-1111",
723
+ email: "elon@musk.com",
724
+ website: "https://elonmusk.com",
725
+ notes: "Address notes or delivery instructions.",
726
+ rowVersion: "1-12345",
727
+ },
728
+ ],
729
+ phoneNumbers: [
730
+ {
731
+ id: "12345",
732
+ countryCode: "1",
733
+ areaCode: "323",
734
+ number: "111-111-1111",
735
+ extension: "105",
736
+ type: "primary",
737
+ },
738
+ {
739
+ id: "12345",
740
+ countryCode: "1",
741
+ areaCode: "323",
742
+ number: "111-111-1111",
743
+ extension: "105",
744
+ type: "primary",
745
+ },
746
+ ],
747
+ emails: [
748
+ {
749
+ id: "123",
750
+ email: "elon@musk.com",
751
+ type: "primary",
752
+ },
753
+ {
754
+ id: "123",
755
+ email: "elon@musk.com",
756
+ type: "primary",
757
+ },
758
+ ],
759
+ websites: [
760
+ {
761
+ id: "12345",
762
+ url: "http://example.com",
763
+ type: "primary",
764
+ },
765
+ {
766
+ id: "12345",
767
+ url: "http://example.com",
768
+ type: "primary",
769
+ },
770
+ ],
771
+ debtorId: "12345",
772
+ deleted: false,
773
+ updatedBy: "12345",
774
+ createdBy: "12345",
775
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
776
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
777
+ passThrough: [
778
+ {
779
+ serviceId: "<id>",
780
+ extendPaths: [
781
+ {
782
+ path: "$.nested.property",
783
+ value: {
784
+ "TaxClassificationRef": {
785
+ "value": "EUC-99990201-V1-00020000",
786
+ },
787
+ },
788
+ },
789
+ {
790
+ path: "$.nested.property",
791
+ value: {
792
+ "TaxClassificationRef": {
793
+ "value": "EUC-99990201-V1-00020000",
794
+ },
795
+ },
796
+ },
797
+ ],
798
+ },
799
+ {
800
+ serviceId: "<id>",
801
+ extendPaths: [
802
+ {
803
+ path: "$.nested.property",
804
+ value: {
805
+ "TaxClassificationRef": {
806
+ "value": "EUC-99990201-V1-00020000",
807
+ },
808
+ },
809
+ },
810
+ {
811
+ path: "$.nested.property",
812
+ value: {
813
+ "TaxClassificationRef": {
814
+ "value": "EUC-99990201-V1-00020000",
815
+ },
816
+ },
817
+ },
818
+ ],
819
+ },
820
+ {
821
+ serviceId: "<id>",
822
+ extendPaths: [
823
+ {
824
+ path: "$.nested.property",
825
+ value: {
826
+ "TaxClassificationRef": {
827
+ "value": "EUC-99990201-V1-00020000",
828
+ },
829
+ },
830
+ },
831
+ ],
832
+ },
833
+ ],
834
+ },
835
+ });
836
+ });
837
+
838
+ test("Apideck Companies Hris Companies Update", async () => {
839
+ const testHttpClient = createTestHTTPClient("hris.companiesUpdate");
840
+
841
+ const apideck = new Apideck({
842
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
843
+ httpClient: testHttpClient,
844
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
845
+ });
846
+
847
+ const result = await apideck.hris.companies.update({
848
+ id: "<id>",
849
+ consumerId: "test-consumer",
850
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
851
+ serviceId: "salesforce",
852
+ hrisCompany: {
853
+ legalName: "SpaceX",
854
+ displayName: "SpaceX",
855
+ subdomain: "company",
856
+ status: "active",
857
+ companyNumber: "123456-AB",
858
+ currency: "USD",
859
+ addresses: [
860
+ {
861
+ id: "123",
862
+ type: "primary",
863
+ string: "25 Spring Street, Blackburn, VIC 3130",
864
+ name: "HQ US",
865
+ line1: "Main street",
866
+ line2: "apt #",
867
+ line3: "Suite #",
868
+ line4: "delivery instructions",
869
+ streetNumber: "25",
870
+ city: "San Francisco",
871
+ state: "CA",
872
+ postalCode: "94104",
873
+ country: "US",
874
+ latitude: "40.759211",
875
+ longitude: "-73.984638",
876
+ county: "Santa Clara",
877
+ contactName: "Elon Musk",
878
+ salutation: "Mr",
879
+ phoneNumber: "111-111-1111",
880
+ fax: "122-111-1111",
881
+ email: "elon@musk.com",
882
+ website: "https://elonmusk.com",
883
+ notes: "Address notes or delivery instructions.",
884
+ rowVersion: "1-12345",
885
+ },
886
+ {
887
+ id: "123",
888
+ type: "primary",
889
+ string: "25 Spring Street, Blackburn, VIC 3130",
890
+ name: "HQ US",
891
+ line1: "Main street",
892
+ line2: "apt #",
893
+ line3: "Suite #",
894
+ line4: "delivery instructions",
895
+ streetNumber: "25",
896
+ city: "San Francisco",
897
+ state: "CA",
898
+ postalCode: "94104",
899
+ country: "US",
900
+ latitude: "40.759211",
901
+ longitude: "-73.984638",
902
+ county: "Santa Clara",
903
+ contactName: "Elon Musk",
904
+ salutation: "Mr",
905
+ phoneNumber: "111-111-1111",
906
+ fax: "122-111-1111",
907
+ email: "elon@musk.com",
908
+ website: "https://elonmusk.com",
909
+ notes: "Address notes or delivery instructions.",
910
+ rowVersion: "1-12345",
911
+ },
912
+ {
913
+ id: "123",
914
+ type: "primary",
915
+ string: "25 Spring Street, Blackburn, VIC 3130",
916
+ name: "HQ US",
917
+ line1: "Main street",
918
+ line2: "apt #",
919
+ line3: "Suite #",
920
+ line4: "delivery instructions",
921
+ streetNumber: "25",
922
+ city: "San Francisco",
923
+ state: "CA",
924
+ postalCode: "94104",
925
+ country: "US",
926
+ latitude: "40.759211",
927
+ longitude: "-73.984638",
928
+ county: "Santa Clara",
929
+ contactName: "Elon Musk",
930
+ salutation: "Mr",
931
+ phoneNumber: "111-111-1111",
932
+ fax: "122-111-1111",
933
+ email: "elon@musk.com",
934
+ website: "https://elonmusk.com",
935
+ notes: "Address notes or delivery instructions.",
936
+ rowVersion: "1-12345",
937
+ },
938
+ ],
939
+ phoneNumbers: [
940
+ {
941
+ id: "12345",
942
+ countryCode: "1",
943
+ areaCode: "323",
944
+ number: "111-111-1111",
945
+ extension: "105",
946
+ type: "primary",
947
+ },
948
+ {
949
+ id: "12345",
950
+ countryCode: "1",
951
+ areaCode: "323",
952
+ number: "111-111-1111",
953
+ extension: "105",
954
+ type: "primary",
955
+ },
956
+ ],
957
+ emails: [
958
+ {
959
+ id: "123",
960
+ email: "elon@musk.com",
961
+ type: "primary",
962
+ },
963
+ {
964
+ id: "123",
965
+ email: "elon@musk.com",
966
+ type: "primary",
967
+ },
968
+ ],
969
+ websites: [
970
+ {
971
+ id: "12345",
972
+ url: "http://example.com",
973
+ type: "primary",
974
+ },
975
+ {
976
+ id: "12345",
977
+ url: "http://example.com",
978
+ type: "primary",
979
+ },
980
+ {
981
+ id: "12345",
982
+ url: "http://example.com",
983
+ type: "primary",
984
+ },
985
+ ],
986
+ debtorId: "12345",
987
+ passThrough: [
988
+ {
989
+ serviceId: "<id>",
990
+ extendPaths: [
991
+ {
992
+ path: "$.nested.property",
993
+ value: {
994
+ "TaxClassificationRef": {
995
+ "value": "EUC-99990201-V1-00020000",
996
+ },
997
+ },
998
+ },
999
+ {
1000
+ path: "$.nested.property",
1001
+ value: {
1002
+ "TaxClassificationRef": {
1003
+ "value": "EUC-99990201-V1-00020000",
1004
+ },
1005
+ },
1006
+ },
1007
+ ],
1008
+ },
1009
+ {
1010
+ serviceId: "<id>",
1011
+ extendPaths: [
1012
+ {
1013
+ path: "$.nested.property",
1014
+ value: {
1015
+ "TaxClassificationRef": {
1016
+ "value": "EUC-99990201-V1-00020000",
1017
+ },
1018
+ },
1019
+ },
1020
+ {
1021
+ path: "$.nested.property",
1022
+ value: {
1023
+ "TaxClassificationRef": {
1024
+ "value": "EUC-99990201-V1-00020000",
1025
+ },
1026
+ },
1027
+ },
1028
+ {
1029
+ path: "$.nested.property",
1030
+ value: {
1031
+ "TaxClassificationRef": {
1032
+ "value": "EUC-99990201-V1-00020000",
1033
+ },
1034
+ },
1035
+ },
1036
+ ],
1037
+ },
1038
+ ],
1039
+ },
1040
+ });
1041
+ expect(result.httpMeta.response.status).toBe(200);
1042
+ expect(result.updateHrisCompanyResponse).toBeDefined();
1043
+ expect(result.updateHrisCompanyResponse).toEqual({
1044
+ statusCode: 200,
1045
+ status: "OK",
1046
+ service: "undefined",
1047
+ resource: "Companies",
1048
+ operation: "update",
1049
+ data: {
1050
+ id: "12345",
1051
+ },
1052
+ });
1053
+ });
1054
+
1055
+ test("Apideck Companies Hris Companies Delete", async () => {
1056
+ const testHttpClient = createTestHTTPClient("hris.companiesDelete");
1057
+
1058
+ const apideck = new Apideck({
1059
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1060
+ httpClient: testHttpClient,
1061
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1062
+ });
1063
+
1064
+ const result = await apideck.hris.companies.delete({
1065
+ id: "<id>",
1066
+ consumerId: "test-consumer",
1067
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1068
+ serviceId: "salesforce",
1069
+ });
1070
+ expect(result.httpMeta.response.status).toBe(200);
1071
+ expect(result.deleteHrisCompanyResponse).toBeDefined();
1072
+ expect(result.deleteHrisCompanyResponse).toEqual({
1073
+ statusCode: 200,
1074
+ status: "OK",
1075
+ service: "undefined",
1076
+ resource: "Companies",
1077
+ operation: "delete",
1078
+ data: {
1079
+ id: "12345",
1080
+ },
1081
+ });
1082
+ });