@bisondesk/core-sdk 1.0.588 → 1.0.590

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 (164) hide show
  1. package/lib/apis/crm.js.map +1 -1
  2. package/lib/apis/debtors.js.map +1 -1
  3. package/lib/apis/email-templates.js.map +1 -1
  4. package/lib/apis/insights.d.ts.map +1 -1
  5. package/lib/apis/insights.js.map +1 -1
  6. package/lib/apis/leasing-administration.js.map +1 -1
  7. package/lib/apis/leasing.d.ts +1 -1
  8. package/lib/apis/leasing.d.ts.map +1 -1
  9. package/lib/apis/leasing.js.map +1 -1
  10. package/lib/apis/offers.d.ts.map +1 -1
  11. package/lib/apis/offers.js.map +1 -1
  12. package/lib/apis/opportunities.d.ts.map +1 -1
  13. package/lib/apis/opportunities.js.map +1 -1
  14. package/lib/apis/tenants.js.map +1 -1
  15. package/lib/apis/users.d.ts.map +1 -1
  16. package/lib/apis/users.js +1 -1
  17. package/lib/apis/users.js.map +1 -1
  18. package/lib/apis/vehicle-sales.js.map +1 -1
  19. package/lib/apis/vehicles.js.map +1 -1
  20. package/lib/types/leasing-administration.js.map +1 -1
  21. package/lib/types/leasing.d.ts.map +1 -1
  22. package/lib/types/leasing.js.map +1 -1
  23. package/lib/types/offers.d.ts.map +1 -1
  24. package/lib/types/offers.js +1 -4
  25. package/lib/types/offers.js.map +1 -1
  26. package/lib/types/opportunities.d.ts +4 -0
  27. package/lib/types/opportunities.d.ts.map +1 -1
  28. package/lib/types/opportunities.js.map +1 -1
  29. package/lib/types/prospects.d.ts +4 -5
  30. package/lib/types/prospects.d.ts.map +1 -1
  31. package/lib/types/prospects.js.map +1 -1
  32. package/lib/types/quotes.d.ts.map +1 -1
  33. package/lib/types/quotes.js.map +1 -1
  34. package/lib/types/recently-viewed.js.map +1 -1
  35. package/lib/types/tenants.d.ts +2 -1
  36. package/lib/types/tenants.d.ts.map +1 -1
  37. package/lib/types/tenants.js +1 -0
  38. package/lib/types/tenants.js.map +1 -1
  39. package/lib/types/transports.d.ts +110 -0
  40. package/lib/types/transports.d.ts.map +1 -0
  41. package/lib/types/transports.js +44 -0
  42. package/lib/types/transports.js.map +1 -0
  43. package/lib/types/vehicles.d.ts +11 -2
  44. package/lib/types/vehicles.d.ts.map +1 -1
  45. package/lib/types/vehicles.js.map +1 -1
  46. package/lib/utils/debtors-dossiers.js.map +1 -1
  47. package/lib/utils/forms.js.map +1 -1
  48. package/lib/utils/integrations/vehicles.js.map +1 -1
  49. package/lib/utils/interests.js.map +1 -1
  50. package/lib/utils/leasing.d.ts +1 -1
  51. package/lib/utils/leasing.d.ts.map +1 -1
  52. package/lib/utils/leasing.js.map +1 -1
  53. package/lib/utils/opportunities.js.map +1 -1
  54. package/lib/utils/search.d.ts +1 -1
  55. package/lib/utils/search.d.ts.map +1 -1
  56. package/lib/utils/search.js.map +1 -1
  57. package/lib/utils/slug.js.map +1 -1
  58. package/lib/utils/vehicles.js.map +1 -1
  59. package/lib/utils/vehicles.test.js +1 -1
  60. package/lib/utils/vehicles.test.js.map +1 -1
  61. package/package.json +15 -10
  62. package/src/apis/crm.ts +14 -14
  63. package/src/apis/debtors.ts +1 -1
  64. package/src/apis/email-templates.ts +2 -2
  65. package/src/apis/insights.ts +3 -3
  66. package/src/apis/leasing-administration.ts +2 -2
  67. package/src/apis/leasing.ts +19 -19
  68. package/src/apis/offers.ts +9 -12
  69. package/src/apis/opportunities.ts +21 -24
  70. package/src/apis/tenants.ts +3 -3
  71. package/src/apis/users.ts +2 -2
  72. package/src/apis/vehicle-sales.ts +4 -4
  73. package/src/apis/vehicles.ts +12 -12
  74. package/src/types/activities.js +13 -0
  75. package/src/types/activities.js.map +1 -0
  76. package/src/types/comparables.js +2 -0
  77. package/src/types/comparables.js.map +1 -0
  78. package/src/types/crm.js +58 -0
  79. package/src/types/crm.js.map +1 -0
  80. package/src/types/dashboard.js +2 -0
  81. package/src/types/dashboard.js.map +1 -0
  82. package/src/types/definitions.js +2 -0
  83. package/src/types/definitions.js.map +1 -0
  84. package/src/types/fields.js +2 -0
  85. package/src/types/fields.js.map +1 -0
  86. package/src/types/insights.js +2 -0
  87. package/src/types/insights.js.map +1 -0
  88. package/src/types/interests.js +6 -0
  89. package/src/types/interests.js.map +1 -0
  90. package/src/types/internal-events.js +18 -0
  91. package/src/types/internal-events.js.map +1 -0
  92. package/src/types/internet-opportunities.js +2 -0
  93. package/src/types/internet-opportunities.js.map +1 -0
  94. package/src/types/internet-vehicles.js +2 -0
  95. package/src/types/internet-vehicles.js.map +1 -0
  96. package/src/types/leasing-administration.js +2 -0
  97. package/src/types/leasing-administration.js.map +1 -0
  98. package/src/types/leasing-administration.ts +3 -3
  99. package/src/types/leasing-debtors.js +2 -0
  100. package/src/types/leasing-debtors.js.map +1 -0
  101. package/src/types/leasing-search.js +2 -0
  102. package/src/types/leasing-search.js.map +1 -0
  103. package/src/types/leasing-settings.js +7 -0
  104. package/src/types/leasing-settings.js.map +1 -0
  105. package/src/types/leasing.js +38 -0
  106. package/src/types/leasing.js.map +1 -0
  107. package/src/types/leasing.ts +2 -2
  108. package/src/types/marketing.js +35 -0
  109. package/src/types/marketing.js.map +1 -0
  110. package/src/types/offers.js +56 -0
  111. package/src/types/offers.ts +1 -4
  112. package/src/types/opportunities.js +107 -0
  113. package/src/types/opportunities.js.map +1 -0
  114. package/src/types/opportunities.ts +4 -0
  115. package/src/types/payments.js +7 -0
  116. package/src/types/picklists.js +2 -0
  117. package/src/types/picklists.js.map +1 -0
  118. package/src/types/prospects.ts +4 -5
  119. package/src/types/quotes.js +42 -0
  120. package/src/types/quotes.ts +5 -5
  121. package/src/types/recently-viewed.js +2 -0
  122. package/src/types/recently-viewed.js.map +1 -0
  123. package/src/types/recently-viewed.ts +1 -1
  124. package/src/types/reservations.js +5 -0
  125. package/src/types/reservations.js.map +1 -0
  126. package/src/types/roi-ratings.js +5 -0
  127. package/src/types/roi-ratings.js.map +1 -0
  128. package/src/types/saved-filters.js +9 -0
  129. package/src/types/saved-filters.js.map +1 -0
  130. package/src/types/search.js +2 -0
  131. package/src/types/search.js.map +1 -0
  132. package/src/types/settings.js +2 -0
  133. package/src/types/settings.js.map +1 -0
  134. package/src/types/templates.js +2 -0
  135. package/src/types/templates.js.map +1 -0
  136. package/src/types/tenants.js +21 -0
  137. package/src/types/tenants.js.map +1 -0
  138. package/src/types/tenants.ts +1 -0
  139. package/src/types/transports.ts +149 -0
  140. package/src/types/user-performance.js +7 -0
  141. package/src/types/user-performance.js.map +1 -0
  142. package/src/types/utils.js +2 -0
  143. package/src/types/validation.js +2 -0
  144. package/src/types/validation.js.map +1 -0
  145. package/src/types/vehicle-sales.js +6 -0
  146. package/src/types/vehicle-sales.js.map +1 -0
  147. package/src/types/vehicles.js +98 -0
  148. package/src/types/vehicles.js.map +1 -0
  149. package/src/types/vehicles.ts +13 -2
  150. package/src/utils/debtors-dossiers.ts +1 -1
  151. package/src/utils/forms.ts +1 -1
  152. package/src/utils/integrations/vehicles.ts +1 -1
  153. package/src/utils/interests.ts +2 -2
  154. package/src/utils/leasing.js +6 -0
  155. package/src/utils/leasing.js.map +1 -0
  156. package/src/utils/leasing.ts +6 -6
  157. package/src/utils/opportunities.js +48 -0
  158. package/src/utils/opportunities.js.map +1 -0
  159. package/src/utils/opportunities.ts +1 -1
  160. package/src/utils/search.ts +16 -16
  161. package/src/utils/slug.ts +1 -1
  162. package/src/utils/vehicles.test.ts +1 -1
  163. package/src/utils/vehicles.ts +1 -1
  164. package/tsconfig.tsbuildinfo +1 -1
package/src/apis/crm.ts CHANGED
@@ -27,7 +27,7 @@ const emptyPaginatedList = {
27
27
  export const getCrmOrganization = async (
28
28
  tenantId: string,
29
29
  organizationId: string,
30
- opts?: { serviceId: string }
30
+ opts?: { serviceId: string },
31
31
  ): Promise<Organization | undefined> => {
32
32
  const auth = await getAdminAuth();
33
33
  const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/${organizationId}`;
@@ -52,7 +52,7 @@ export const getCrmOrganization = async (
52
52
  export const getCrmOrganizationByExternalId = async (
53
53
  tenantId: string,
54
54
  externalId: string,
55
- opts?: { serviceId: string }
55
+ opts?: { serviceId: string },
56
56
  ): Promise<Organization | undefined> => {
57
57
  const auth = await getAdminAuth();
58
58
  const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/external-id/${externalId}`;
@@ -76,7 +76,7 @@ export const getCrmOrganizationByExternalId = async (
76
76
 
77
77
  export const getCrmOrganizationsByVatNumber = async (
78
78
  tenantId: string,
79
- vatNumber: string
79
+ vatNumber: string,
80
80
  ): Promise<Organization[]> => {
81
81
  const auth = await getAdminAuth();
82
82
  const url = `${process.env.CORE_API_ORIGIN}/admin/crm/organizations/vat/${encodeURIComponent(vatNumber)}`;
@@ -98,7 +98,7 @@ export const getCrmOrganizationsByVatNumber = async (
98
98
  export const saveCrmOrganization = async (
99
99
  tenantId: string,
100
100
  org: Organization | NewOrganization,
101
- opts?: { serviceId: string }
101
+ opts?: { serviceId: string },
102
102
  ): Promise<Organization> => {
103
103
  const auth = await getAdminAuth();
104
104
  const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations`;
@@ -126,7 +126,7 @@ export const patchCrmOrganization = async (
126
126
  tenantId: string,
127
127
  organizationId: string,
128
128
  changes: Patch[],
129
- opts?: { serviceId: string }
129
+ opts?: { serviceId: string },
130
130
  ): Promise<Organization> => {
131
131
  const auth = await getAdminAuth();
132
132
  const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/${organizationId}`;
@@ -161,7 +161,7 @@ export const patchCrmOrganization = async (
161
161
  export const searchCrmOrganizations = async (
162
162
  tenantId: string,
163
163
  req: SearchRequest,
164
- opts?: { serviceId: string }
164
+ opts?: { serviceId: string },
165
165
  ): Promise<PaginatedList<SearchOrganization, ReferenceData>> => {
166
166
  const auth = await getAdminAuth();
167
167
  const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/search/results`;
@@ -187,7 +187,7 @@ export const searchCrmOrganizations = async (
187
187
 
188
188
  export const listUsedBranchIdsForOrganization = async (
189
189
  tenantId: string,
190
- organizationId: string
190
+ organizationId: string,
191
191
  ): Promise<string[]> => {
192
192
  const auth = await getAdminAuth();
193
193
  const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/${organizationId}/branches`;
@@ -212,7 +212,7 @@ export const listUsedBranchIdsForOrganization = async (
212
212
  export const searchCrmContacts = async (
213
213
  tenantId: string,
214
214
  req: SearchRequest,
215
- opts?: { serviceId: string }
215
+ opts?: { serviceId: string },
216
216
  ): Promise<PaginatedList<SearchContact, ReferenceData>> => {
217
217
  const auth = await getAdminAuth();
218
218
  const url = `${process.env.CORE_API_ORIGIN}/api/crm/contacts/search/results`;
@@ -239,7 +239,7 @@ export const searchCrmContacts = async (
239
239
  export const deleteCrmOrganization = async (
240
240
  tenantId: string,
241
241
  orgId: string,
242
- opts?: { serviceId: string }
242
+ opts?: { serviceId: string },
243
243
  ): Promise<void> => {
244
244
  const auth = await getAdminAuth();
245
245
  const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/${orgId}`;
@@ -262,7 +262,7 @@ export const deleteCrmOrganization = async (
262
262
  export const listCrmContacts = async (
263
263
  tenantId: string,
264
264
  organizationId: string,
265
- opts?: { serviceId: string }
265
+ opts?: { serviceId: string },
266
266
  ): Promise<Contact[]> => {
267
267
  const auth = await getAdminAuth();
268
268
  const url = `${process.env.CORE_API_ORIGIN}/admin/crm/organizations/${organizationId}/contacts`;
@@ -285,7 +285,7 @@ export const listCrmContacts = async (
285
285
  export const listPotentialDuplicateOrgs = async (
286
286
  tenantId: string,
287
287
  org: Partial<Organization>,
288
- opts?: { serviceId?: string; limit?: number; offset?: number }
288
+ opts?: { serviceId?: string; limit?: number; offset?: number },
289
289
  ): Promise<PaginatedList<SearchOrganization, ReferenceData>> => {
290
290
  const auth = await getAdminAuth();
291
291
  const limit = opts?.limit ?? '';
@@ -314,7 +314,7 @@ export const listPotentialDuplicateOrgs = async (
314
314
  export const getCrmContact = async (
315
315
  tenantId: string,
316
316
  contactId: string,
317
- opts?: { serviceId: string }
317
+ opts?: { serviceId: string },
318
318
  ): Promise<Contact | undefined> => {
319
319
  const auth = await getAdminAuth();
320
320
  const url = `${process.env.CORE_API_ORIGIN}/api/crm/contacts/${contactId}`;
@@ -337,7 +337,7 @@ export const getCrmContact = async (
337
337
  export const saveCrmContact = async (
338
338
  tenantId: string,
339
339
  contact: Contact | NewContact,
340
- opts?: { serviceId: string }
340
+ opts?: { serviceId: string },
341
341
  ): Promise<Contact> => {
342
342
  const auth = await getAdminAuth();
343
343
  const url = `${process.env.CORE_API_ORIGIN}/api/crm/contacts`;
@@ -365,7 +365,7 @@ export const deleteCrmContact = async (
365
365
  tenantId: string,
366
366
  contactId: string,
367
367
  orgId: string = '',
368
- opts?: { serviceId: string }
368
+ opts?: { serviceId: string },
369
369
  ): Promise<void> => {
370
370
  const auth = await getAdminAuth();
371
371
  const url = `${process.env.CORE_API_ORIGIN}/api/crm/contacts/${contactId}?orgId=${orgId}`;
@@ -8,7 +8,7 @@ import { ReferenceData } from '../types/utils.js';
8
8
 
9
9
  export const searchDebtorsInfo = async (
10
10
  tenantId: string,
11
- request: SearchRequest
11
+ request: SearchRequest,
12
12
  ): Promise<PaginatedList<SearchDebtorInfo, ReferenceData> | undefined> => {
13
13
  const auth = await getAdminAuth();
14
14
  const method = 'POST';
@@ -6,7 +6,7 @@ import { Template } from '../types/templates.js';
6
6
  export const getEmailTemplate = async (
7
7
  tenantId: string,
8
8
  templateId: string,
9
- country: string
9
+ country: string,
10
10
  ): Promise<Template> => {
11
11
  const auth = await getAdminAuth();
12
12
  const response: Response = await fetch(
@@ -18,7 +18,7 @@ export const getEmailTemplate = async (
18
18
  [TENANT_ID_ADMIN_HEADER]: tenantId,
19
19
  'Content-Type': 'application/json',
20
20
  },
21
- }
21
+ },
22
22
  );
23
23
 
24
24
  if (response.ok) {
@@ -1,7 +1,7 @@
1
1
  import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
2
- import { NextList } from '@bisondesk/commons-sdk/types';
3
2
  import { XError } from '@bisondesk/commons-sdk/errors';
4
3
  import { getAdminAuth } from '@bisondesk/commons-sdk/fetch';
4
+ import { NextList } from '@bisondesk/commons-sdk/types';
5
5
  import fetch, { Response } from 'node-fetch';
6
6
  import { InsightsSimilarRequest, InsightsVehicleComparableResponse } from '../types/insights.js';
7
7
  import { ReferenceData } from '../types/utils.js';
@@ -9,7 +9,7 @@ import { SearchVehicle } from '../types/vehicles.js';
9
9
 
10
10
  export const getStockVehicleComparableWithMeta = async (
11
11
  tenantId: string,
12
- vehicleId: string
12
+ vehicleId: string,
13
13
  ): Promise<InsightsVehicleComparableResponse> => {
14
14
  const auth = await getAdminAuth();
15
15
  const url = `${process.env.CORE_API_ORIGIN}/api/insights/comparable/stock-vehicle/${vehicleId}`;
@@ -30,7 +30,7 @@ export const getStockVehicleComparableWithMeta = async (
30
30
 
31
31
  export const getSimilarStockVehicles = async (
32
32
  tenantId: string,
33
- request: InsightsSimilarRequest
33
+ request: InsightsSimilarRequest,
34
34
  ): Promise<NextList<SearchVehicle, ReferenceData>> => {
35
35
  const auth = await getAdminAuth();
36
36
  const url = `${process.env.CORE_API_ORIGIN}/api/insights/similar/stock`;
@@ -11,7 +11,7 @@ import {
11
11
  export const createLeasingAdminUpload = async (
12
12
  tenantId: string,
13
13
  data: NewLeasingAdminUploadRequest,
14
- opts?: { serviceId: string }
14
+ opts?: { serviceId: string },
15
15
  ): Promise<LeasingAdminUpload> => {
16
16
  const auth = await getAdminAuth();
17
17
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/administration/uploads`;
@@ -40,7 +40,7 @@ export const updateLeasingAdminUploadStatus = async (
40
40
  handlerId: string,
41
41
  uploadId: string,
42
42
  newStatus: LeasingAdminUploadStatus,
43
- opts?: { serviceId: string }
43
+ opts?: { serviceId: string },
44
44
  ): Promise<LeasingAdminUpload> => {
45
45
  const auth = await getAdminAuth();
46
46
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/administration/uploads/${handlerId}/${uploadId}/status`;
@@ -3,7 +3,6 @@ import { XError } from '@bisondesk/commons-sdk/errors';
3
3
  import { cleanHeaders, fetchJson, getAdminAuth } from '@bisondesk/commons-sdk/fetch';
4
4
  import { AttachmentValue, PaginatedList } from '@bisondesk/commons-sdk/types';
5
5
  import fetch, { Response } from 'node-fetch';
6
- import { SearchLeasingContract } from '../types/leasing-search.js';
7
6
  import {
8
7
  AmortizationDocs,
9
8
  AmortizationTable,
@@ -14,6 +13,7 @@ import {
14
13
  NewLeasingConditions,
15
14
  NewLeasingContract,
16
15
  } from '../types/leasing.js';
16
+ import { SearchLeasingContract } from '../types/leasing-search.js';
17
17
  import { SearchRequest } from '../types/search.js';
18
18
  import { DataRecord, ReferenceData } from '../types/utils.js';
19
19
 
@@ -21,7 +21,7 @@ export const listLeasingClients = async (
21
21
  tenantId: string,
22
22
  offset: number,
23
23
  limit: number,
24
- opts?: { serviceId: string }
24
+ opts?: { serviceId: string },
25
25
  ): Promise<string[]> => {
26
26
  const auth = await getAdminAuth();
27
27
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/clients?offset=${offset}&limit=${limit}`;
@@ -45,7 +45,7 @@ export const listLeasingContracts = async (
45
45
  tenantId: string,
46
46
  offset: number,
47
47
  limit: number,
48
- opts?: { serviceId: string }
48
+ opts?: { serviceId: string },
49
49
  ): Promise<LeasingContract[]> => {
50
50
  const auth = await getAdminAuth();
51
51
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts?offset=${offset}&limit=${limit}`;
@@ -67,7 +67,7 @@ export const listLeasingContracts = async (
67
67
 
68
68
  export const getLeasingConditions = async (
69
69
  tenantId: string,
70
- conditionsId: string
70
+ conditionsId: string,
71
71
  ): Promise<LeasingConditions | undefined> => {
72
72
  const auth = await getAdminAuth();
73
73
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/conditions/${conditionsId}`;
@@ -88,7 +88,7 @@ export const getLeasingConditions = async (
88
88
 
89
89
  export const createLeasingConditions = async (
90
90
  tenantId: string,
91
- conditions: NewLeasingConditions
91
+ conditions: NewLeasingConditions,
92
92
  ): Promise<LeasingConditions> => {
93
93
  const auth = await getAdminAuth();
94
94
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/conditions`;
@@ -113,7 +113,7 @@ export const createLeasingConditions = async (
113
113
 
114
114
  export const getLeasingContractByStockNumber = async (
115
115
  tenantId: string,
116
- stockNumber: string
116
+ stockNumber: string,
117
117
  ): Promise<LeasingContract | undefined> => {
118
118
  const auth = await getAdminAuth();
119
119
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/stock-number/${stockNumber}`;
@@ -127,7 +127,7 @@ export const getLeasingContractByStockNumber = async (
127
127
 
128
128
  export const getLeasingContractByVehicleId = async (
129
129
  tenantId: string,
130
- vehicleId: string
130
+ vehicleId: string,
131
131
  ): Promise<LeasingContract | undefined> => {
132
132
  const auth = await getAdminAuth();
133
133
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/vehicle-id/${vehicleId}`;
@@ -141,7 +141,7 @@ export const getLeasingContractByVehicleId = async (
141
141
 
142
142
  export const getLeasingContractByNumber = async (
143
143
  tenantId: string,
144
- contractNumber: string
144
+ contractNumber: string,
145
145
  ): Promise<LeasingContract | undefined> => {
146
146
  const auth = await getAdminAuth();
147
147
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/number/${contractNumber}`;
@@ -162,7 +162,7 @@ export const getLeasingContractByNumber = async (
162
162
 
163
163
  export const getLeasingContract = async (
164
164
  tenantId: string,
165
- contractId: string
165
+ contractId: string,
166
166
  ): Promise<DataRecord<LeasingContract> | undefined> => {
167
167
  const auth = await getAdminAuth();
168
168
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}`;
@@ -184,13 +184,13 @@ export const getLeasingContract = async (
184
184
  export const getLeasingContractDebtInfo = async (
185
185
  tenantId: string,
186
186
  contractId: string,
187
- date?: Date
187
+ date?: Date,
188
188
  ): Promise<LeasingContractDebtInfo | undefined> => {
189
189
  const auth = await getAdminAuth();
190
190
 
191
191
  const url = new URL(
192
192
  `/api/leasing/contracts/${contractId}/debt-info`,
193
- process.env.CORE_API_ORIGIN
193
+ process.env.CORE_API_ORIGIN,
194
194
  );
195
195
 
196
196
  if (date != null) {
@@ -214,7 +214,7 @@ export const getLeasingContractDebtInfo = async (
214
214
 
215
215
  export const searchLeasingContracts = async (
216
216
  tenantId: string,
217
- request: SearchRequest
217
+ request: SearchRequest,
218
218
  ): Promise<PaginatedList<SearchLeasingContract, ReferenceData> | undefined> => {
219
219
  const auth = await getAdminAuth();
220
220
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/search/results`;
@@ -240,7 +240,7 @@ export const searchLeasingContracts = async (
240
240
  export const findLeasingContracts = async (
241
241
  tenantId: string,
242
242
  clientId: string,
243
- vehicleId: string
243
+ vehicleId: string,
244
244
  ): Promise<LeasingContract[]> => {
245
245
  const auth = await getAdminAuth();
246
246
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/find?clientId=${clientId}&vehicleId=${vehicleId}`;
@@ -261,7 +261,7 @@ export const findLeasingContracts = async (
261
261
 
262
262
  export const upsertLeasingContract = async (
263
263
  tenantId: string,
264
- contract: NewLeasingContract | LeasingContract
264
+ contract: NewLeasingContract | LeasingContract,
265
265
  ): Promise<LeasingContract> => {
266
266
  const auth = await getAdminAuth();
267
267
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts`;
@@ -286,7 +286,7 @@ export const upsertLeasingContract = async (
286
286
 
287
287
  export const getLeasingAmortizations = async (
288
288
  tenantId: string,
289
- contractId: string
289
+ contractId: string,
290
290
  ): Promise<AmortizationTable | undefined> => {
291
291
  const auth = await getAdminAuth();
292
292
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}/amortization`;
@@ -308,7 +308,7 @@ export const getLeasingAmortizations = async (
308
308
  export const addAmortizationDocs = async (
309
309
  tenantId: string,
310
310
  contractId: string,
311
- docs: AmortizationDocs
311
+ docs: AmortizationDocs,
312
312
  ): Promise<AmortizationDocs> => {
313
313
  const auth = await getAdminAuth();
314
314
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}/amortization/add-docs`;
@@ -333,7 +333,7 @@ export const addAmortizationDocs = async (
333
333
 
334
334
  export const listAmortizationDocsByContract = async (
335
335
  tenantId: string,
336
- contractId: string
336
+ contractId: string,
337
337
  ): Promise<AmortizationDocs[]> => {
338
338
  const auth = await getAdminAuth();
339
339
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}/amortization/docs`;
@@ -354,7 +354,7 @@ export const listAmortizationDocsByContract = async (
354
354
 
355
355
  export const printLeasingAmortization = async (
356
356
  tenantId: string,
357
- contractId: string
357
+ contractId: string,
358
358
  ): Promise<AttachmentValue | undefined> => {
359
359
  const auth = await getAdminAuth();
360
360
  const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}/amortization/print`;
@@ -375,7 +375,7 @@ export const printLeasingAmortization = async (
375
375
 
376
376
  export const getDocumentAmortizationData = async (
377
377
  tenantId: string,
378
- documentId: string
378
+ documentId: string,
379
379
  ): Promise<DocumentAmortizationData[] | undefined> => {
380
380
  const auth = await getAdminAuth();
381
381
  const url = `${process.env.CORE_API_ORIGIN}/api/documents/finance/${documentId}/leasing`;
@@ -4,18 +4,15 @@ import { NewOffer, Offer } from '../types/offers.js';
4
4
 
5
5
  export const createOffer = async (tenantId: string, offer: NewOffer): Promise<Offer> => {
6
6
  const auth = await getAdminAuth();
7
- const response: Offer | undefined = await fetchJson(
8
- `${process.env.CORE_API_ORIGIN}/api/offers`,
9
- {
10
- method: 'POST',
11
- headers: cleanHeaders({
12
- Authorization: auth,
13
- [TENANT_ID_ADMIN_HEADER]: tenantId,
14
- 'Content-Type': 'application/json',
15
- }),
16
- body: JSON.stringify(offer),
17
- }
18
- );
7
+ const response: Offer | undefined = await fetchJson(`${process.env.CORE_API_ORIGIN}/api/offers`, {
8
+ method: 'POST',
9
+ headers: cleanHeaders({
10
+ Authorization: auth,
11
+ [TENANT_ID_ADMIN_HEADER]: tenantId,
12
+ 'Content-Type': 'application/json',
13
+ }),
14
+ body: JSON.stringify(offer),
15
+ });
19
16
 
20
17
  if (response == null) {
21
18
  throw new Error('Offer not created');
@@ -15,7 +15,7 @@ import { OpportunityReservation } from '../types/reservations.js';
15
15
 
16
16
  export const listOpportunities = async (
17
17
  tenantId: string,
18
- filterOptions: ListOpportunitiesFilters = {}
18
+ filterOptions: ListOpportunitiesFilters = {},
19
19
  ): Promise<Opportunity[]> => {
20
20
  const auth = await getAdminAuth();
21
21
  const result = await fetchJson<Opportunity[]>(
@@ -28,7 +28,7 @@ export const listOpportunities = async (
28
28
  'Content-Type': 'application/json',
29
29
  }),
30
30
  body: JSON.stringify(filterOptions),
31
- }
31
+ },
32
32
  );
33
33
 
34
34
  return result ?? [];
@@ -36,7 +36,7 @@ export const listOpportunities = async (
36
36
 
37
37
  export const getOpportunityById = async (
38
38
  tenantId: string,
39
- opportunityId: string
39
+ opportunityId: string,
40
40
  ): Promise<Opportunity | undefined> => {
41
41
  const auth = await getAdminAuth();
42
42
  return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}`, {
@@ -49,7 +49,7 @@ export const getOpportunityById = async (
49
49
 
50
50
  export const getOpportunityBff = async (
51
51
  tenantId: string,
52
- opportunityId: string
52
+ opportunityId: string,
53
53
  ): Promise<OpportunityBFF | undefined> => {
54
54
  const auth = await getAdminAuth();
55
55
  return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}/bff`, {
@@ -63,7 +63,7 @@ export const getOpportunityBff = async (
63
63
  export const updateOpportunity = async (
64
64
  tenantId: string,
65
65
  opportunity: OpportunityUpdate,
66
- opportunityId: string
66
+ opportunityId: string,
67
67
  ): Promise<OpportunityBFF | undefined> => {
68
68
  const auth = await getAdminAuth();
69
69
  return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}`, {
@@ -78,7 +78,7 @@ export const updateOpportunity = async (
78
78
 
79
79
  export const createOpportunity = async (
80
80
  tenantId: string,
81
- opportunity: NewOpportunity
81
+ opportunity: NewOpportunity,
82
82
  ): Promise<Opportunity> => {
83
83
  const auth = await getAdminAuth();
84
84
  const response: Opportunity | undefined = await fetchJson(
@@ -91,7 +91,7 @@ export const createOpportunity = async (
91
91
  'Content-Type': 'application/json',
92
92
  }),
93
93
  body: JSON.stringify(opportunity),
94
- }
94
+ },
95
95
  );
96
96
 
97
97
  if (response == null) {
@@ -106,18 +106,15 @@ export const createOpportunity = async (
106
106
  //
107
107
  export const createBid = async (tenantId: string, bid: NewBid): Promise<Bid> => {
108
108
  const auth = await getAdminAuth();
109
- const response: Bid | undefined = await fetchJson(
110
- `${process.env.CORE_API_ORIGIN}/api/bids`,
111
- {
112
- method: 'POST',
113
- headers: cleanHeaders({
114
- Authorization: auth,
115
- [TENANT_ID_ADMIN_HEADER]: tenantId,
116
- 'Content-Type': 'application/json',
117
- }),
118
- body: JSON.stringify(bid),
119
- }
120
- );
109
+ const response: Bid | undefined = await fetchJson(`${process.env.CORE_API_ORIGIN}/api/bids`, {
110
+ method: 'POST',
111
+ headers: cleanHeaders({
112
+ Authorization: auth,
113
+ [TENANT_ID_ADMIN_HEADER]: tenantId,
114
+ 'Content-Type': 'application/json',
115
+ }),
116
+ body: JSON.stringify(bid),
117
+ });
121
118
 
122
119
  if (response == null) {
123
120
  throw new Error('Bid not created');
@@ -128,7 +125,7 @@ export const createBid = async (tenantId: string, bid: NewBid): Promise<Bid> =>
128
125
 
129
126
  export const getLeasingQuoteParams = async (
130
127
  tenantId: string,
131
- settingId: string
128
+ settingId: string,
132
129
  ): Promise<LeasingQuoteParams | undefined> => {
133
130
  const auth = await getAdminAuth();
134
131
  return fetchJson(
@@ -138,7 +135,7 @@ export const getLeasingQuoteParams = async (
138
135
  Authorization: auth,
139
136
  [TENANT_ID_ADMIN_HEADER]: tenantId,
140
137
  }),
141
- }
138
+ },
142
139
  );
143
140
  };
144
141
 
@@ -147,7 +144,7 @@ export const getLeasingQuoteParams = async (
147
144
  //
148
145
  export const getQuoteById = async (
149
146
  tenantId: string,
150
- quoteId: string
147
+ quoteId: string,
151
148
  ): Promise<Quote | undefined> => {
152
149
  const auth = await getAdminAuth();
153
150
  return fetchJson(`${process.env.CORE_API_ORIGIN}/api/quotes/${quoteId}`, {
@@ -163,7 +160,7 @@ export const getQuoteById = async (
163
160
  //
164
161
  export const getReservationByVehicleId = async (
165
162
  tenantId: string,
166
- vehicleId: string
163
+ vehicleId: string,
167
164
  ): Promise<OpportunityReservation | undefined> => {
168
165
  const auth = await getAdminAuth();
169
166
  return fetchJson(
@@ -173,6 +170,6 @@ export const getReservationByVehicleId = async (
173
170
  Authorization: auth,
174
171
  [TENANT_ID_ADMIN_HEADER]: tenantId,
175
172
  }),
176
- }
173
+ },
177
174
  );
178
175
  };
@@ -76,7 +76,7 @@ export const listTenantsSyncSettings = async (): Promise<TenantSyncSettings[]> =
76
76
  };
77
77
 
78
78
  export const getTenantsSyncSettings = async (
79
- tenantId: string
79
+ tenantId: string,
80
80
  ): Promise<TenantSyncSettings | undefined> => {
81
81
  const auth = await getAdminAuth();
82
82
  const url = `${process.env.CORE_API_ORIGIN}/admin/tenants/settings/sync/${tenantId}`;
@@ -113,7 +113,7 @@ export const getTenant = async (tenantId: string): Promise<Tenant | undefined> =
113
113
  };
114
114
 
115
115
  export const getTenantByHyperdmsId = async (
116
- hyperdmsTenantId: string
116
+ hyperdmsTenantId: string,
117
117
  ): Promise<Tenant | undefined> => {
118
118
  const auth = await getAdminAuth();
119
119
  const url = `${process.env.CORE_API_ORIGIN}/admin/tenants/hyperdms/${hyperdmsTenantId}`;
@@ -132,7 +132,7 @@ export const getTenantByHyperdmsId = async (
132
132
  };
133
133
 
134
134
  export const getTenantByHyperportalId = async (
135
- hyperportalTenantId: string
135
+ hyperportalTenantId: string,
136
136
  ): Promise<Tenant | undefined> => {
137
137
  const auth = await getAdminAuth();
138
138
  const url = `${process.env.CORE_API_ORIGIN}/admin/tenants/hyperportal/${hyperportalTenantId}`;
package/src/apis/users.ts CHANGED
@@ -1,8 +1,8 @@
1
+ import { URL } from 'url';
1
2
  import { AppRoles, TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
2
3
  import { XError } from '@bisondesk/commons-sdk/errors';
3
4
  import { cleanHeaders, getAdminAuth } from '@bisondesk/commons-sdk/fetch';
4
5
  import fetch, { Response } from 'node-fetch';
5
- import { URL } from 'url';
6
6
  import { User } from '../types/users.js';
7
7
 
8
8
  export const getUser = async (tenantId: string, userId: string): Promise<User | undefined> => {
@@ -25,7 +25,7 @@ export const getUser = async (tenantId: string, userId: string): Promise<User |
25
25
 
26
26
  export const listUsers = async (
27
27
  tenantId: string,
28
- opts?: { roles?: AppRoles[]; includeInactive?: boolean }
28
+ opts?: { roles?: AppRoles[]; includeInactive?: boolean },
29
29
  ): Promise<User[]> => {
30
30
  const auth = await getAdminAuth();
31
31
  const url = `${process.env.CORE_API_ORIGIN}/api/users`;
@@ -10,7 +10,7 @@ import {
10
10
  export const getVehicleSaleInfo = async (
11
11
  tenantId: string,
12
12
  vehicleId: string,
13
- opts?: { serviceId: string }
13
+ opts?: { serviceId: string },
14
14
  ): Promise<DataRecord<VehicleSaleInfo> | undefined> => {
15
15
  const auth = await getAdminAuth();
16
16
  return fetchJson(`${process.env.CORE_API_ORIGIN}/api/vehicle-sales/${vehicleId}`, {
@@ -25,7 +25,7 @@ export const getVehicleSaleInfo = async (
25
25
  export const getExternalVehicleSale = async (
26
26
  tenantId: string,
27
27
  saleId: string,
28
- opts?: { serviceId: string }
28
+ opts?: { serviceId: string },
29
29
  ): Promise<ExternalVehicleSale | undefined> => {
30
30
  const auth = await getAdminAuth();
31
31
  return fetchJson(`${process.env.CORE_API_ORIGIN}/api/external-sales/${saleId}`, {
@@ -40,7 +40,7 @@ export const getExternalVehicleSale = async (
40
40
  export const saveExternalVehicleSale = async (
41
41
  tenantId: string,
42
42
  data: NewExternalVehicleSale,
43
- opts?: { serviceId: string }
43
+ opts?: { serviceId: string },
44
44
  ): Promise<ExternalVehicleSale | undefined> => {
45
45
  const auth = await getAdminAuth();
46
46
  return fetchJson(`${process.env.CORE_API_ORIGIN}/api/external-sales`, {
@@ -58,7 +58,7 @@ export const saveExternalVehicleSale = async (
58
58
  export const deleteExternalVehicleSale = async (
59
59
  tenantId: string,
60
60
  saleId: string,
61
- opts?: { serviceId: string }
61
+ opts?: { serviceId: string },
62
62
  ): Promise<void> => {
63
63
  const auth = await getAdminAuth();
64
64
  return fetchJson(`${process.env.CORE_API_ORIGIN}/api/external-sales/${saleId}`, {