@bisondesk/website-commons-sdk 1.0.42 → 1.0.43
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/types/events.d.ts +5 -31
- package/lib/types/events.d.ts.map +1 -1
- package/lib/types/events.js +1 -17
- package/lib/types/events.js.map +1 -1
- package/lib/types/user.d.ts +34 -44
- package/lib/types/user.d.ts.map +1 -1
- package/lib/types/user.js +19 -24
- package/lib/types/user.js.map +1 -1
- package/lib/types/vehicle.d.ts +8 -1
- package/lib/types/vehicle.d.ts.map +1 -1
- package/lib/types/vehicle.js.map +1 -1
- package/package.json +1 -2
- package/src/types/events.ts +15 -21
- package/src/types/user.ts +27 -33
- package/src/types/vehicle.ts +8 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/types/leasing.d.ts +0 -39
- package/lib/types/leasing.d.ts.map +0 -1
- package/lib/types/leasing.js +0 -12
- package/lib/types/leasing.js.map +0 -1
- package/src/types/events.test.ts +0 -107
- package/src/types/leasing.ts +0 -30
package/lib/types/leasing.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { WebsiteLeasingContract, WebsiteLeasingContractStatus } from '@bisondesk/websites-sdk/types/contracts';
|
|
2
|
-
import { WebsiteFinanceDocument } from '@bisondesk/websites-sdk/types/documents';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import { WebsiteVehicle } from './vehicle.js';
|
|
5
|
-
export type LeasingContractBFF = {
|
|
6
|
-
contract: WebsiteLeasingContract;
|
|
7
|
-
vehicle: WebsiteVehicle | undefined | WebsiteLeasingContract['vehicle'];
|
|
8
|
-
};
|
|
9
|
-
export declare const ListLeasingContractsQueryParams: z.ZodObject<z.objectUtil.extendShape<{
|
|
10
|
-
limit: z.ZodNumber;
|
|
11
|
-
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
12
|
-
}, {
|
|
13
|
-
status: z.ZodOptional<z.ZodNativeEnum<typeof WebsiteLeasingContractStatus>>;
|
|
14
|
-
overdue: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
-
}>, "strip", z.ZodTypeAny, {
|
|
16
|
-
limit: number;
|
|
17
|
-
offset: number;
|
|
18
|
-
status?: WebsiteLeasingContractStatus | undefined;
|
|
19
|
-
overdue?: boolean | undefined;
|
|
20
|
-
}, {
|
|
21
|
-
limit: number;
|
|
22
|
-
status?: WebsiteLeasingContractStatus | undefined;
|
|
23
|
-
offset?: number | undefined;
|
|
24
|
-
overdue?: boolean | undefined;
|
|
25
|
-
}>;
|
|
26
|
-
export type ListLeasingContractsQueryParams = z.input<typeof ListLeasingContractsQueryParams>;
|
|
27
|
-
export type { WebsiteFinanceDocument };
|
|
28
|
-
export declare const ListFinanceDocumentsQueryParams: z.ZodObject<{
|
|
29
|
-
limit: z.ZodNumber;
|
|
30
|
-
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
31
|
-
}, "strip", z.ZodTypeAny, {
|
|
32
|
-
limit: number;
|
|
33
|
-
offset: number;
|
|
34
|
-
}, {
|
|
35
|
-
limit: number;
|
|
36
|
-
offset?: number | undefined;
|
|
37
|
-
}>;
|
|
38
|
-
export type ListFinanceDocumentsQueryParams = z.input<typeof ListFinanceDocumentsQueryParams>;
|
|
39
|
-
//# sourceMappingURL=leasing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"leasing.d.ts","sourceRoot":"/","sources":["types/leasing.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,OAAO,EAAE,cAAc,GAAG,SAAS,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;CACzE,CAAC;AAOF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;EAG1C,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAE9F,YAAY,EAAE,sBAAsB,EAAE,CAAC;AAEvC,eAAO,MAAM,+BAA+B;;;;;;;;;EAAmB,CAAC;AAEhE,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
|
package/lib/types/leasing.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { WebsiteLeasingContractStatus, } from '@bisondesk/websites-sdk/types/contracts';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
const paginationSchema = z.object({
|
|
4
|
-
limit: z.number().int().nonnegative(),
|
|
5
|
-
offset: z.number().int().nonnegative().optional().default(0),
|
|
6
|
-
});
|
|
7
|
-
export const ListLeasingContractsQueryParams = paginationSchema.extend({
|
|
8
|
-
status: z.nativeEnum(WebsiteLeasingContractStatus).optional(),
|
|
9
|
-
overdue: z.boolean().optional(),
|
|
10
|
-
});
|
|
11
|
-
export const ListFinanceDocumentsQueryParams = paginationSchema;
|
|
12
|
-
//# sourceMappingURL=leasing.js.map
|
package/lib/types/leasing.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"leasing.js","sourceRoot":"/","sources":["types/leasing.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,4BAA4B,GAC7B,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACrC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CAC7D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACrE,MAAM,EAAE,CAAC,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC,QAAQ,EAAE;IAC7D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,+BAA+B,GAAG,gBAAgB,CAAC","sourcesContent":["import {\n WebsiteLeasingContract,\n WebsiteLeasingContractStatus,\n} from '@bisondesk/websites-sdk/types/contracts';\nimport { WebsiteFinanceDocument } from '@bisondesk/websites-sdk/types/documents';\nimport { z } from 'zod';\nimport { WebsiteVehicle } from './vehicle.js';\n\nexport type LeasingContractBFF = {\n contract: WebsiteLeasingContract;\n vehicle: WebsiteVehicle | undefined | WebsiteLeasingContract['vehicle'];\n};\n\nconst paginationSchema = z.object({\n limit: z.number().int().nonnegative(),\n offset: z.number().int().nonnegative().optional().default(0),\n});\n\nexport const ListLeasingContractsQueryParams = paginationSchema.extend({\n status: z.nativeEnum(WebsiteLeasingContractStatus).optional(),\n overdue: z.boolean().optional(),\n});\n\nexport type ListLeasingContractsQueryParams = z.input<typeof ListLeasingContractsQueryParams>;\n\nexport type { WebsiteFinanceDocument };\n\nexport const ListFinanceDocumentsQueryParams = paginationSchema;\n\nexport type ListFinanceDocumentsQueryParams = z.input<typeof ListFinanceDocumentsQueryParams>;\n"]}
|
package/src/types/events.test.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { omit } from 'lodash-es';
|
|
2
|
-
import { WebsiteEvent } from './events.js';
|
|
3
|
-
|
|
4
|
-
const VALID_UUID = '550e8400-e29b-41d4-a716-446655440000';
|
|
5
|
-
|
|
6
|
-
describe('WebsiteEvent', () => {
|
|
7
|
-
describe('delete', () => {
|
|
8
|
-
test('valid', () => {
|
|
9
|
-
const result = WebsiteEvent.safeParse({
|
|
10
|
-
action: 'delete',
|
|
11
|
-
vehicleId: VALID_UUID,
|
|
12
|
-
tenantId: 'tenant-1',
|
|
13
|
-
stockNumber: 'STK-001',
|
|
14
|
-
});
|
|
15
|
-
expect(result.success).toBe(true);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('valid with vehicle undefined', () => {
|
|
19
|
-
const result = WebsiteEvent.safeParse({
|
|
20
|
-
action: 'delete',
|
|
21
|
-
vehicleId: VALID_UUID,
|
|
22
|
-
tenantId: 'tenant-1',
|
|
23
|
-
stockNumber: 'STK-001',
|
|
24
|
-
vehicle: undefined,
|
|
25
|
-
});
|
|
26
|
-
expect(result.success).toBe(true);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test('rejects non-uuid vehicleId', () => {
|
|
30
|
-
const result = WebsiteEvent.safeParse({
|
|
31
|
-
action: 'delete',
|
|
32
|
-
vehicleId: 'not-a-uuid',
|
|
33
|
-
tenantId: 'tenant-1',
|
|
34
|
-
stockNumber: 'STK-001',
|
|
35
|
-
});
|
|
36
|
-
expect(result.success).toBe(false);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
describe('upsert', () => {
|
|
41
|
-
test('valid', () => {
|
|
42
|
-
const result = WebsiteEvent.safeParse({
|
|
43
|
-
action: 'upsert',
|
|
44
|
-
vehicleId: VALID_UUID,
|
|
45
|
-
tenantId: 'tenant-1',
|
|
46
|
-
stockNumber: 'STK-001',
|
|
47
|
-
vehicle: { id: '123', external: {} },
|
|
48
|
-
});
|
|
49
|
-
expect(result.success).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test('rejects non-uuid vehicleId', () => {
|
|
53
|
-
const result = WebsiteEvent.safeParse({
|
|
54
|
-
action: 'upsert',
|
|
55
|
-
vehicleId: 'abc',
|
|
56
|
-
tenantId: 'tenant-1',
|
|
57
|
-
stockNumber: 'STK-001',
|
|
58
|
-
vehicle: { id: '123' },
|
|
59
|
-
});
|
|
60
|
-
expect(result.success).toBe(false);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test('rejects null vehicle', () => {
|
|
64
|
-
const result = WebsiteEvent.safeParse({
|
|
65
|
-
action: 'upsert',
|
|
66
|
-
vehicleId: VALID_UUID,
|
|
67
|
-
tenantId: 'tenant-1',
|
|
68
|
-
stockNumber: 'STK-001',
|
|
69
|
-
vehicle: null,
|
|
70
|
-
});
|
|
71
|
-
expect(result.success).toBe(false);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('rejects missing vehicle', () => {
|
|
75
|
-
const result = WebsiteEvent.safeParse({
|
|
76
|
-
action: 'upsert',
|
|
77
|
-
vehicleId: VALID_UUID,
|
|
78
|
-
tenantId: 'tenant-1',
|
|
79
|
-
stockNumber: 'STK-001',
|
|
80
|
-
});
|
|
81
|
-
expect(result.success).toBe(false);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
test('rejects invalid action', () => {
|
|
86
|
-
const result = WebsiteEvent.safeParse({
|
|
87
|
-
action: 'unknown',
|
|
88
|
-
vehicleId: VALID_UUID,
|
|
89
|
-
tenantId: 'tenant-1',
|
|
90
|
-
stockNumber: 'STK-001',
|
|
91
|
-
});
|
|
92
|
-
expect(result.success).toBe(false);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
test.each(['vehicleId', 'tenantId', 'stockNumber'])('rejects missing %s', (field) => {
|
|
96
|
-
const base = {
|
|
97
|
-
action: 'delete',
|
|
98
|
-
vehicleId: VALID_UUID,
|
|
99
|
-
tenantId: 'tenant-1',
|
|
100
|
-
stockNumber: 'STK-001',
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const res = omit(base, field);
|
|
104
|
-
const result = WebsiteEvent.safeParse(res);
|
|
105
|
-
expect(result.success).toBe(false);
|
|
106
|
-
});
|
|
107
|
-
});
|
package/src/types/leasing.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
WebsiteLeasingContract,
|
|
3
|
-
WebsiteLeasingContractStatus,
|
|
4
|
-
} from '@bisondesk/websites-sdk/types/contracts';
|
|
5
|
-
import { WebsiteFinanceDocument } from '@bisondesk/websites-sdk/types/documents';
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
import { WebsiteVehicle } from './vehicle.js';
|
|
8
|
-
|
|
9
|
-
export type LeasingContractBFF = {
|
|
10
|
-
contract: WebsiteLeasingContract;
|
|
11
|
-
vehicle: WebsiteVehicle | undefined | WebsiteLeasingContract['vehicle'];
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const paginationSchema = z.object({
|
|
15
|
-
limit: z.number().int().nonnegative(),
|
|
16
|
-
offset: z.number().int().nonnegative().optional().default(0),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export const ListLeasingContractsQueryParams = paginationSchema.extend({
|
|
20
|
-
status: z.nativeEnum(WebsiteLeasingContractStatus).optional(),
|
|
21
|
-
overdue: z.boolean().optional(),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export type ListLeasingContractsQueryParams = z.input<typeof ListLeasingContractsQueryParams>;
|
|
25
|
-
|
|
26
|
-
export type { WebsiteFinanceDocument };
|
|
27
|
-
|
|
28
|
-
export const ListFinanceDocumentsQueryParams = paginationSchema;
|
|
29
|
-
|
|
30
|
-
export type ListFinanceDocumentsQueryParams = z.input<typeof ListFinanceDocumentsQueryParams>;
|