@bisondesk/core-sdk 1.0.237 → 1.0.238
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/apis/leasing.js +18 -2
- package/lib/cjs/apis/leasing.js.map +1 -1
- package/lib/cjs/apis/opportunities.js +1 -19
- package/lib/cjs/apis/opportunities.js.map +1 -1
- package/lib/cjs/types/leasing.js.map +1 -1
- package/lib/cjs/types/search.js.map +1 -1
- package/lib/esm/apis/leasing.js +16 -1
- package/lib/esm/apis/leasing.js.map +1 -1
- package/lib/esm/apis/opportunities.js +0 -17
- package/lib/esm/apis/opportunities.js.map +1 -1
- package/lib/esm/types/leasing.js.map +1 -1
- package/lib/esm/types/search.js.map +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/apis/leasing.d.ts +3 -0
- package/lib/types/apis/leasing.d.ts.map +1 -1
- package/lib/types/apis/opportunities.d.ts +0 -2
- package/lib/types/apis/opportunities.d.ts.map +1 -1
- package/lib/types/types/leasing.d.ts +0 -4
- package/lib/types/types/leasing.d.ts.map +1 -1
- package/lib/types/types/search.d.ts +7 -2
- package/lib/types/types/search.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/apis/leasing.ts +27 -1
- package/src/apis/opportunities.ts +0 -27
- package/src/types/leasing.ts +0 -5
- package/src/types/search.ts +10 -2
package/src/apis/leasing.ts
CHANGED
|
@@ -33,7 +33,33 @@ export const listLeasingClients = async (
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const body = await response.text();
|
|
36
|
-
throw new XError(response.statusText, { tenantId, offset, limit });
|
|
36
|
+
throw new XError(response.statusText, { tenantId, body, offset, limit });
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const listLeasingContracts = async (
|
|
40
|
+
tenantId: string,
|
|
41
|
+
offset: number,
|
|
42
|
+
limit: number,
|
|
43
|
+
opts?: { serviceId: string }
|
|
44
|
+
): Promise<LeasingContract[]> => {
|
|
45
|
+
const auth = await getAdminAuth();
|
|
46
|
+
const response: Response = await fetch(
|
|
47
|
+
`${process.env.CORE_API_ORIGIN}/api/leasing/contracts?offset=${offset}&limit=${limit}`,
|
|
48
|
+
{
|
|
49
|
+
headers: cleanHeaders({
|
|
50
|
+
Authorization: auth,
|
|
51
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
52
|
+
[SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,
|
|
53
|
+
}),
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
if (response.ok) {
|
|
58
|
+
return response.status === 200 ? (response.json() as any) : undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const body = await response.text();
|
|
62
|
+
throw new XError(response.statusText, { tenantId, body, offset, limit });
|
|
37
63
|
};
|
|
38
64
|
|
|
39
65
|
export const getLeasingConditions = async (
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
|
|
2
2
|
import { XError } from '@bisondesk/commons-sdk/errors';
|
|
3
3
|
import fetch, { Response } from 'node-fetch';
|
|
4
|
-
import { AmortizationTable, AmortizationTableRequest } from '../types/leasing';
|
|
5
4
|
import { LeasingQuoteParams } from '../types/leasing-settings';
|
|
6
5
|
import {
|
|
7
6
|
NewOpportunity,
|
|
@@ -105,29 +104,3 @@ export const getLeasingQuoteParams = async (
|
|
|
105
104
|
const body = await response.text();
|
|
106
105
|
throw new XError(response.statusText, { body, tenantId, settingId });
|
|
107
106
|
};
|
|
108
|
-
|
|
109
|
-
export const computeAmortizationTable = async (
|
|
110
|
-
tenantId: string,
|
|
111
|
-
input: AmortizationTableRequest
|
|
112
|
-
): Promise<AmortizationTable | undefined> => {
|
|
113
|
-
const auth = await getAdminAuth();
|
|
114
|
-
const response: Response = await fetch(
|
|
115
|
-
`${process.env.CORE_API_ORIGIN}/api/leasing/amortization-table`,
|
|
116
|
-
{
|
|
117
|
-
method: 'POST',
|
|
118
|
-
headers: cleanHeaders({
|
|
119
|
-
Authorization: auth,
|
|
120
|
-
'Content-Type': 'application/json',
|
|
121
|
-
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
122
|
-
}),
|
|
123
|
-
body: JSON.stringify(input),
|
|
124
|
-
}
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
if (response.ok) {
|
|
128
|
-
return response.status === 200 ? response.json() : undefined;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const body = await response.text();
|
|
132
|
-
throw new XError(response.statusText, { body, tenantId, input });
|
|
133
|
-
};
|
package/src/types/leasing.ts
CHANGED
|
@@ -132,11 +132,6 @@ export type ListOverdueRemindersRequest = {
|
|
|
132
132
|
sortBy: SortFilter;
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
-
export type ListBecrisDeclarationsRequest = {
|
|
136
|
-
offset: number;
|
|
137
|
-
limit: number;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
135
|
export type NewLeasingConditions = {
|
|
141
136
|
parameters: {
|
|
142
137
|
yearlyRoadTax: string;
|
package/src/types/search.ts
CHANGED
|
@@ -88,10 +88,18 @@ export type SortFilter = {
|
|
|
88
88
|
export type SearchRequest = {
|
|
89
89
|
fullText?: string;
|
|
90
90
|
limit: number;
|
|
91
|
-
offset?: number;
|
|
92
91
|
query?: ComplexFilter<ElasticsearchOperator>;
|
|
93
92
|
sortBy?: SortFilter[];
|
|
94
|
-
}
|
|
93
|
+
} & (
|
|
94
|
+
| {
|
|
95
|
+
infinite?: false;
|
|
96
|
+
offset?: number;
|
|
97
|
+
}
|
|
98
|
+
| {
|
|
99
|
+
infinite: true;
|
|
100
|
+
nextToken?: string;
|
|
101
|
+
}
|
|
102
|
+
);
|
|
95
103
|
|
|
96
104
|
export type PublicSearchRequest = {
|
|
97
105
|
limit: number;
|