@homespot-sdk/validators 0.0.617 → 0.0.621
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/dist/index.js +79 -83
- package/package.json +11 -2
- package/tsconfig.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.createApiClient = createApiClient;
|
|
5
|
-
const core_1 = require("@zodios/core");
|
|
6
|
-
const zod_1 = require("zod");
|
|
7
|
-
const SocialMediaRequest = zod_1.z
|
|
1
|
+
import { makeApi, Zodios } from '@zodios/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
const SocialMediaRequest = z
|
|
8
4
|
.object({
|
|
9
|
-
type:
|
|
5
|
+
type: z.enum([
|
|
10
6
|
'FACEBOOK',
|
|
11
7
|
'YOUTUBE',
|
|
12
8
|
'INSTAGRAM',
|
|
13
9
|
'TIKTOK',
|
|
14
10
|
'LINKEDIN',
|
|
15
11
|
]),
|
|
16
|
-
url:
|
|
12
|
+
url: z.string().optional(),
|
|
17
13
|
})
|
|
18
14
|
.passthrough();
|
|
19
|
-
const SocialMediasRequest =
|
|
20
|
-
.object({ data:
|
|
15
|
+
const SocialMediasRequest = z
|
|
16
|
+
.object({ data: z.array(SocialMediaRequest).min(1).max(5) })
|
|
21
17
|
.passthrough();
|
|
22
|
-
const RolesRequest =
|
|
18
|
+
const RolesRequest = z
|
|
23
19
|
.object({
|
|
24
|
-
name:
|
|
25
|
-
description:
|
|
26
|
-
authorities:
|
|
20
|
+
name: z.string().min(1),
|
|
21
|
+
description: z.string().min(1),
|
|
22
|
+
authorities: z.array(z.enum([
|
|
27
23
|
'properties_read',
|
|
28
24
|
'properties_write',
|
|
29
25
|
'agents_read',
|
|
@@ -31,65 +27,65 @@ const RolesRequest = zod_1.z
|
|
|
31
27
|
])),
|
|
32
28
|
})
|
|
33
29
|
.passthrough();
|
|
34
|
-
const PhotoRequest =
|
|
30
|
+
const PhotoRequest = z
|
|
35
31
|
.object({
|
|
36
|
-
photo:
|
|
37
|
-
type:
|
|
38
|
-
width:
|
|
39
|
-
height:
|
|
32
|
+
photo: z.string().min(0).max(255),
|
|
33
|
+
type: z.enum(['JPEG', 'JPG', 'PNG', 'WEBP']),
|
|
34
|
+
width: z.number().int().gte(10).lte(11000),
|
|
35
|
+
height: z.number().int().gte(10).lte(11000).optional(),
|
|
40
36
|
})
|
|
41
37
|
.passthrough();
|
|
42
|
-
const AddressRequest =
|
|
38
|
+
const AddressRequest = z
|
|
43
39
|
.object({
|
|
44
|
-
country:
|
|
45
|
-
city:
|
|
46
|
-
district:
|
|
47
|
-
subdistrict:
|
|
48
|
-
street:
|
|
40
|
+
country: z.string().min(0).max(100),
|
|
41
|
+
city: z.string().min(0).max(100),
|
|
42
|
+
district: z.string().min(0).max(100),
|
|
43
|
+
subdistrict: z.string().min(0).max(100),
|
|
44
|
+
street: z.string().min(0).max(255),
|
|
49
45
|
})
|
|
50
46
|
.passthrough();
|
|
51
|
-
const CreateAgencyRequest =
|
|
47
|
+
const CreateAgencyRequest = z
|
|
52
48
|
.object({
|
|
53
|
-
name:
|
|
54
|
-
email:
|
|
55
|
-
seats:
|
|
56
|
-
subDomain:
|
|
57
|
-
phone:
|
|
49
|
+
name: z.string().min(1),
|
|
50
|
+
email: z.string().min(1).email(),
|
|
51
|
+
seats: z.number().int(),
|
|
52
|
+
subDomain: z.string().min(1),
|
|
53
|
+
phone: z.string().min(1),
|
|
58
54
|
address: AddressRequest,
|
|
59
|
-
yearSince:
|
|
55
|
+
yearSince: z.number().int(),
|
|
60
56
|
})
|
|
61
57
|
.passthrough();
|
|
62
|
-
const InviteMemberRequest =
|
|
63
|
-
.object({ emails:
|
|
58
|
+
const InviteMemberRequest = z
|
|
59
|
+
.object({ emails: z.array(z.string()).min(1) })
|
|
64
60
|
.passthrough();
|
|
65
|
-
const PresignedUrlResponse =
|
|
66
|
-
.object({ originalName:
|
|
61
|
+
const PresignedUrlResponse = z
|
|
62
|
+
.object({ originalName: z.string(), key: z.string(), url: z.string() })
|
|
67
63
|
.passthrough();
|
|
68
|
-
const PresignedUrlsResponse =
|
|
69
|
-
.object({ data:
|
|
64
|
+
const PresignedUrlsResponse = z
|
|
65
|
+
.object({ data: z.array(PresignedUrlResponse) })
|
|
70
66
|
.passthrough();
|
|
71
|
-
const IdResponse =
|
|
72
|
-
const UploadAcknowledgmentResponse =
|
|
73
|
-
.object({ success:
|
|
67
|
+
const IdResponse = z.object({ id: z.string() }).passthrough();
|
|
68
|
+
const UploadAcknowledgmentResponse = z
|
|
69
|
+
.object({ success: z.array(z.string()), fail: z.array(z.string()) })
|
|
74
70
|
.passthrough();
|
|
75
|
-
const InvitationViewResponse =
|
|
71
|
+
const InvitationViewResponse = z
|
|
76
72
|
.object({
|
|
77
|
-
invitationId:
|
|
78
|
-
email:
|
|
79
|
-
status:
|
|
73
|
+
invitationId: z.string().uuid(),
|
|
74
|
+
email: z.string(),
|
|
75
|
+
status: z.enum([
|
|
80
76
|
'PENDING',
|
|
81
77
|
'ACCEPTED',
|
|
82
78
|
'REJECTED',
|
|
83
79
|
'CANCELLED',
|
|
84
80
|
'EXPIRED',
|
|
85
81
|
]),
|
|
86
|
-
createdAt:
|
|
87
|
-
expiresAt:
|
|
88
|
-
acceptedAt:
|
|
89
|
-
acceptedBy:
|
|
82
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
83
|
+
expiresAt: z.string().datetime({ offset: true }),
|
|
84
|
+
acceptedAt: z.string().datetime({ offset: true }).optional(),
|
|
85
|
+
acceptedBy: z.string().optional(),
|
|
90
86
|
})
|
|
91
87
|
.passthrough();
|
|
92
|
-
|
|
88
|
+
export const schemas = {
|
|
93
89
|
SocialMediaRequest,
|
|
94
90
|
SocialMediasRequest,
|
|
95
91
|
RolesRequest,
|
|
@@ -103,7 +99,7 @@ exports.schemas = {
|
|
|
103
99
|
UploadAcknowledgmentResponse,
|
|
104
100
|
InvitationViewResponse,
|
|
105
101
|
};
|
|
106
|
-
const endpoints =
|
|
102
|
+
const endpoints = makeApi([
|
|
107
103
|
{
|
|
108
104
|
method: 'post',
|
|
109
105
|
path: '/agency',
|
|
@@ -116,7 +112,7 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
116
112
|
schema: CreateAgencyRequest,
|
|
117
113
|
},
|
|
118
114
|
],
|
|
119
|
-
response:
|
|
115
|
+
response: z.void(),
|
|
120
116
|
},
|
|
121
117
|
{
|
|
122
118
|
method: 'get',
|
|
@@ -127,10 +123,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
127
123
|
{
|
|
128
124
|
name: 'agencyId',
|
|
129
125
|
type: 'Path',
|
|
130
|
-
schema:
|
|
126
|
+
schema: z.string().uuid(),
|
|
131
127
|
},
|
|
132
128
|
],
|
|
133
|
-
response:
|
|
129
|
+
response: z.void(),
|
|
134
130
|
},
|
|
135
131
|
{
|
|
136
132
|
method: 'post',
|
|
@@ -141,10 +137,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
141
137
|
{
|
|
142
138
|
name: 'agencyId',
|
|
143
139
|
type: 'Path',
|
|
144
|
-
schema:
|
|
140
|
+
schema: z.string().uuid(),
|
|
145
141
|
},
|
|
146
142
|
],
|
|
147
|
-
response:
|
|
143
|
+
response: z.void(),
|
|
148
144
|
},
|
|
149
145
|
{
|
|
150
146
|
method: 'get',
|
|
@@ -155,10 +151,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
155
151
|
{
|
|
156
152
|
name: 'agencyId',
|
|
157
153
|
type: 'Path',
|
|
158
|
-
schema:
|
|
154
|
+
schema: z.string().uuid(),
|
|
159
155
|
},
|
|
160
156
|
],
|
|
161
|
-
response:
|
|
157
|
+
response: z.void(),
|
|
162
158
|
},
|
|
163
159
|
{
|
|
164
160
|
method: 'post',
|
|
@@ -174,10 +170,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
174
170
|
{
|
|
175
171
|
name: 'agencyId',
|
|
176
172
|
type: 'Path',
|
|
177
|
-
schema:
|
|
173
|
+
schema: z.string().uuid(),
|
|
178
174
|
},
|
|
179
175
|
],
|
|
180
|
-
response:
|
|
176
|
+
response: z.void(),
|
|
181
177
|
},
|
|
182
178
|
{
|
|
183
179
|
method: 'post',
|
|
@@ -188,15 +184,15 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
188
184
|
{
|
|
189
185
|
name: 'agencyId',
|
|
190
186
|
type: 'Path',
|
|
191
|
-
schema:
|
|
187
|
+
schema: z.string().uuid(),
|
|
192
188
|
},
|
|
193
189
|
{
|
|
194
190
|
name: 'invitationId',
|
|
195
191
|
type: 'Path',
|
|
196
|
-
schema:
|
|
192
|
+
schema: z.string().uuid(),
|
|
197
193
|
},
|
|
198
194
|
],
|
|
199
|
-
response:
|
|
195
|
+
response: z.void(),
|
|
200
196
|
},
|
|
201
197
|
{
|
|
202
198
|
method: 'put',
|
|
@@ -212,10 +208,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
212
208
|
{
|
|
213
209
|
name: 'agencyId',
|
|
214
210
|
type: 'Path',
|
|
215
|
-
schema:
|
|
211
|
+
schema: z.string().uuid(),
|
|
216
212
|
},
|
|
217
213
|
],
|
|
218
|
-
response:
|
|
214
|
+
response: z.void(),
|
|
219
215
|
},
|
|
220
216
|
{
|
|
221
217
|
method: 'post',
|
|
@@ -231,10 +227,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
231
227
|
{
|
|
232
228
|
name: 'agencyId',
|
|
233
229
|
type: 'Path',
|
|
234
|
-
schema:
|
|
230
|
+
schema: z.string().uuid(),
|
|
235
231
|
},
|
|
236
232
|
],
|
|
237
|
-
response:
|
|
233
|
+
response: z.void(),
|
|
238
234
|
},
|
|
239
235
|
{
|
|
240
236
|
method: 'post',
|
|
@@ -250,10 +246,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
250
246
|
{
|
|
251
247
|
name: 'agencyId',
|
|
252
248
|
type: 'Path',
|
|
253
|
-
schema:
|
|
249
|
+
schema: z.string().uuid(),
|
|
254
250
|
},
|
|
255
251
|
],
|
|
256
|
-
response:
|
|
252
|
+
response: z.void(),
|
|
257
253
|
},
|
|
258
254
|
{
|
|
259
255
|
method: 'post',
|
|
@@ -269,10 +265,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
269
265
|
{
|
|
270
266
|
name: 'agencyId',
|
|
271
267
|
type: 'Path',
|
|
272
|
-
schema:
|
|
268
|
+
schema: z.string().uuid(),
|
|
273
269
|
},
|
|
274
270
|
],
|
|
275
|
-
response:
|
|
271
|
+
response: z.void(),
|
|
276
272
|
},
|
|
277
273
|
{
|
|
278
274
|
method: 'put',
|
|
@@ -288,15 +284,15 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
288
284
|
{
|
|
289
285
|
name: 'agencyId',
|
|
290
286
|
type: 'Path',
|
|
291
|
-
schema:
|
|
287
|
+
schema: z.string().uuid(),
|
|
292
288
|
},
|
|
293
289
|
{
|
|
294
290
|
name: 'roleId',
|
|
295
291
|
type: 'Path',
|
|
296
|
-
schema:
|
|
292
|
+
schema: z.number().int(),
|
|
297
293
|
},
|
|
298
294
|
],
|
|
299
|
-
response:
|
|
295
|
+
response: z.void(),
|
|
300
296
|
},
|
|
301
297
|
{
|
|
302
298
|
method: 'delete',
|
|
@@ -307,15 +303,15 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
307
303
|
{
|
|
308
304
|
name: 'agencyId',
|
|
309
305
|
type: 'Path',
|
|
310
|
-
schema:
|
|
306
|
+
schema: z.string().uuid(),
|
|
311
307
|
},
|
|
312
308
|
{
|
|
313
309
|
name: 'roleId',
|
|
314
310
|
type: 'Path',
|
|
315
|
-
schema:
|
|
311
|
+
schema: z.number().int(),
|
|
316
312
|
},
|
|
317
313
|
],
|
|
318
|
-
response:
|
|
314
|
+
response: z.void(),
|
|
319
315
|
},
|
|
320
316
|
{
|
|
321
317
|
method: 'put',
|
|
@@ -331,13 +327,13 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
331
327
|
{
|
|
332
328
|
name: 'agencyId',
|
|
333
329
|
type: 'Path',
|
|
334
|
-
schema:
|
|
330
|
+
schema: z.string().uuid(),
|
|
335
331
|
},
|
|
336
332
|
],
|
|
337
|
-
response:
|
|
333
|
+
response: z.void(),
|
|
338
334
|
},
|
|
339
335
|
]);
|
|
340
|
-
|
|
341
|
-
function createApiClient(baseUrl, options) {
|
|
342
|
-
return new
|
|
336
|
+
export const api = new Zodios(endpoints);
|
|
337
|
+
export function createApiClient(baseUrl, options) {
|
|
338
|
+
return new Zodios(baseUrl, endpoints, options);
|
|
343
339
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homespot-sdk/validators",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.621",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "dist/index.js",
|
|
5
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
6
14
|
"scripts": {
|
|
7
15
|
"build": "tsc"
|
|
8
16
|
},
|
|
@@ -14,6 +22,7 @@
|
|
|
14
22
|
"@zodios/core": "^10.9.6"
|
|
15
23
|
},
|
|
16
24
|
"devDependencies": {
|
|
17
|
-
"typescript": "^5.0.0"
|
|
25
|
+
"typescript": "^5.0.0",
|
|
26
|
+
"@types/node": "^20.0.0"
|
|
18
27
|
}
|
|
19
28
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"module": "
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
5
6
|
"declaration": true,
|
|
6
7
|
"outDir": "./dist",
|
|
7
8
|
"strict": true,
|
|
8
9
|
"noImplicitAny": true,
|
|
9
10
|
"skipLibCheck": true,
|
|
10
|
-
"esModuleInterop": true
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"lib": ["ESNext", "DOM"]
|
|
11
13
|
},
|
|
12
|
-
"include": ["src"]
|
|
13
14
|
}
|