@homespot-sdk/validators 0.0.616 → 0.0.620
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 -94
- package/package.json +11 -2
- package/src/index.ts +1 -12
- package/tsconfig.json +5 -3
package/dist/index.js
CHANGED
|
@@ -1,106 +1,91 @@
|
|
|
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
|
-
.strict()
|
|
19
14
|
.passthrough();
|
|
20
|
-
const SocialMediasRequest =
|
|
21
|
-
.object({ data:
|
|
22
|
-
.strict()
|
|
15
|
+
const SocialMediasRequest = z
|
|
16
|
+
.object({ data: z.array(SocialMediaRequest).min(1).max(5) })
|
|
23
17
|
.passthrough();
|
|
24
|
-
const RolesRequest =
|
|
18
|
+
const RolesRequest = z
|
|
25
19
|
.object({
|
|
26
|
-
name:
|
|
27
|
-
description:
|
|
28
|
-
authorities:
|
|
20
|
+
name: z.string().min(1),
|
|
21
|
+
description: z.string().min(1),
|
|
22
|
+
authorities: z.array(z.enum([
|
|
29
23
|
'properties_read',
|
|
30
24
|
'properties_write',
|
|
31
25
|
'agents_read',
|
|
32
26
|
'agents_write',
|
|
33
27
|
])),
|
|
34
28
|
})
|
|
35
|
-
.strict()
|
|
36
29
|
.passthrough();
|
|
37
|
-
const PhotoRequest =
|
|
30
|
+
const PhotoRequest = z
|
|
38
31
|
.object({
|
|
39
|
-
photo:
|
|
40
|
-
type:
|
|
41
|
-
width:
|
|
42
|
-
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(),
|
|
43
36
|
})
|
|
44
|
-
.strict()
|
|
45
37
|
.passthrough();
|
|
46
|
-
const AddressRequest =
|
|
38
|
+
const AddressRequest = z
|
|
47
39
|
.object({
|
|
48
|
-
country:
|
|
49
|
-
city:
|
|
50
|
-
district:
|
|
51
|
-
subdistrict:
|
|
52
|
-
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),
|
|
53
45
|
})
|
|
54
|
-
.strict()
|
|
55
46
|
.passthrough();
|
|
56
|
-
const CreateAgencyRequest =
|
|
47
|
+
const CreateAgencyRequest = z
|
|
57
48
|
.object({
|
|
58
|
-
name:
|
|
59
|
-
email:
|
|
60
|
-
seats:
|
|
61
|
-
subDomain:
|
|
62
|
-
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),
|
|
63
54
|
address: AddressRequest,
|
|
64
|
-
yearSince:
|
|
55
|
+
yearSince: z.number().int(),
|
|
65
56
|
})
|
|
66
|
-
.strict()
|
|
67
57
|
.passthrough();
|
|
68
|
-
const InviteMemberRequest =
|
|
69
|
-
.object({ emails:
|
|
70
|
-
.strict()
|
|
58
|
+
const InviteMemberRequest = z
|
|
59
|
+
.object({ emails: z.array(z.string()).min(1) })
|
|
71
60
|
.passthrough();
|
|
72
|
-
const PresignedUrlResponse =
|
|
73
|
-
.object({ originalName:
|
|
74
|
-
.strict()
|
|
61
|
+
const PresignedUrlResponse = z
|
|
62
|
+
.object({ originalName: z.string(), key: z.string(), url: z.string() })
|
|
75
63
|
.passthrough();
|
|
76
|
-
const PresignedUrlsResponse =
|
|
77
|
-
.object({ data:
|
|
78
|
-
.strict()
|
|
64
|
+
const PresignedUrlsResponse = z
|
|
65
|
+
.object({ data: z.array(PresignedUrlResponse) })
|
|
79
66
|
.passthrough();
|
|
80
|
-
const IdResponse =
|
|
81
|
-
const UploadAcknowledgmentResponse =
|
|
82
|
-
.object({ success:
|
|
83
|
-
.strict()
|
|
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()) })
|
|
84
70
|
.passthrough();
|
|
85
|
-
const InvitationViewResponse =
|
|
71
|
+
const InvitationViewResponse = z
|
|
86
72
|
.object({
|
|
87
|
-
invitationId:
|
|
88
|
-
email:
|
|
89
|
-
status:
|
|
73
|
+
invitationId: z.string().uuid(),
|
|
74
|
+
email: z.string(),
|
|
75
|
+
status: z.enum([
|
|
90
76
|
'PENDING',
|
|
91
77
|
'ACCEPTED',
|
|
92
78
|
'REJECTED',
|
|
93
79
|
'CANCELLED',
|
|
94
80
|
'EXPIRED',
|
|
95
81
|
]),
|
|
96
|
-
createdAt:
|
|
97
|
-
expiresAt:
|
|
98
|
-
acceptedAt:
|
|
99
|
-
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(),
|
|
100
86
|
})
|
|
101
|
-
.strict()
|
|
102
87
|
.passthrough();
|
|
103
|
-
|
|
88
|
+
export const schemas = {
|
|
104
89
|
SocialMediaRequest,
|
|
105
90
|
SocialMediasRequest,
|
|
106
91
|
RolesRequest,
|
|
@@ -114,7 +99,7 @@ exports.schemas = {
|
|
|
114
99
|
UploadAcknowledgmentResponse,
|
|
115
100
|
InvitationViewResponse,
|
|
116
101
|
};
|
|
117
|
-
const endpoints =
|
|
102
|
+
const endpoints = makeApi([
|
|
118
103
|
{
|
|
119
104
|
method: 'post',
|
|
120
105
|
path: '/agency',
|
|
@@ -127,7 +112,7 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
127
112
|
schema: CreateAgencyRequest,
|
|
128
113
|
},
|
|
129
114
|
],
|
|
130
|
-
response:
|
|
115
|
+
response: z.void(),
|
|
131
116
|
},
|
|
132
117
|
{
|
|
133
118
|
method: 'get',
|
|
@@ -138,10 +123,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
138
123
|
{
|
|
139
124
|
name: 'agencyId',
|
|
140
125
|
type: 'Path',
|
|
141
|
-
schema:
|
|
126
|
+
schema: z.string().uuid(),
|
|
142
127
|
},
|
|
143
128
|
],
|
|
144
|
-
response:
|
|
129
|
+
response: z.void(),
|
|
145
130
|
},
|
|
146
131
|
{
|
|
147
132
|
method: 'post',
|
|
@@ -152,10 +137,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
152
137
|
{
|
|
153
138
|
name: 'agencyId',
|
|
154
139
|
type: 'Path',
|
|
155
|
-
schema:
|
|
140
|
+
schema: z.string().uuid(),
|
|
156
141
|
},
|
|
157
142
|
],
|
|
158
|
-
response:
|
|
143
|
+
response: z.void(),
|
|
159
144
|
},
|
|
160
145
|
{
|
|
161
146
|
method: 'get',
|
|
@@ -166,10 +151,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
166
151
|
{
|
|
167
152
|
name: 'agencyId',
|
|
168
153
|
type: 'Path',
|
|
169
|
-
schema:
|
|
154
|
+
schema: z.string().uuid(),
|
|
170
155
|
},
|
|
171
156
|
],
|
|
172
|
-
response:
|
|
157
|
+
response: z.void(),
|
|
173
158
|
},
|
|
174
159
|
{
|
|
175
160
|
method: 'post',
|
|
@@ -185,10 +170,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
185
170
|
{
|
|
186
171
|
name: 'agencyId',
|
|
187
172
|
type: 'Path',
|
|
188
|
-
schema:
|
|
173
|
+
schema: z.string().uuid(),
|
|
189
174
|
},
|
|
190
175
|
],
|
|
191
|
-
response:
|
|
176
|
+
response: z.void(),
|
|
192
177
|
},
|
|
193
178
|
{
|
|
194
179
|
method: 'post',
|
|
@@ -199,15 +184,15 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
199
184
|
{
|
|
200
185
|
name: 'agencyId',
|
|
201
186
|
type: 'Path',
|
|
202
|
-
schema:
|
|
187
|
+
schema: z.string().uuid(),
|
|
203
188
|
},
|
|
204
189
|
{
|
|
205
190
|
name: 'invitationId',
|
|
206
191
|
type: 'Path',
|
|
207
|
-
schema:
|
|
192
|
+
schema: z.string().uuid(),
|
|
208
193
|
},
|
|
209
194
|
],
|
|
210
|
-
response:
|
|
195
|
+
response: z.void(),
|
|
211
196
|
},
|
|
212
197
|
{
|
|
213
198
|
method: 'put',
|
|
@@ -223,10 +208,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
223
208
|
{
|
|
224
209
|
name: 'agencyId',
|
|
225
210
|
type: 'Path',
|
|
226
|
-
schema:
|
|
211
|
+
schema: z.string().uuid(),
|
|
227
212
|
},
|
|
228
213
|
],
|
|
229
|
-
response:
|
|
214
|
+
response: z.void(),
|
|
230
215
|
},
|
|
231
216
|
{
|
|
232
217
|
method: 'post',
|
|
@@ -242,10 +227,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
242
227
|
{
|
|
243
228
|
name: 'agencyId',
|
|
244
229
|
type: 'Path',
|
|
245
|
-
schema:
|
|
230
|
+
schema: z.string().uuid(),
|
|
246
231
|
},
|
|
247
232
|
],
|
|
248
|
-
response:
|
|
233
|
+
response: z.void(),
|
|
249
234
|
},
|
|
250
235
|
{
|
|
251
236
|
method: 'post',
|
|
@@ -261,10 +246,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
261
246
|
{
|
|
262
247
|
name: 'agencyId',
|
|
263
248
|
type: 'Path',
|
|
264
|
-
schema:
|
|
249
|
+
schema: z.string().uuid(),
|
|
265
250
|
},
|
|
266
251
|
],
|
|
267
|
-
response:
|
|
252
|
+
response: z.void(),
|
|
268
253
|
},
|
|
269
254
|
{
|
|
270
255
|
method: 'post',
|
|
@@ -280,10 +265,10 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
280
265
|
{
|
|
281
266
|
name: 'agencyId',
|
|
282
267
|
type: 'Path',
|
|
283
|
-
schema:
|
|
268
|
+
schema: z.string().uuid(),
|
|
284
269
|
},
|
|
285
270
|
],
|
|
286
|
-
response:
|
|
271
|
+
response: z.void(),
|
|
287
272
|
},
|
|
288
273
|
{
|
|
289
274
|
method: 'put',
|
|
@@ -299,15 +284,15 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
299
284
|
{
|
|
300
285
|
name: 'agencyId',
|
|
301
286
|
type: 'Path',
|
|
302
|
-
schema:
|
|
287
|
+
schema: z.string().uuid(),
|
|
303
288
|
},
|
|
304
289
|
{
|
|
305
290
|
name: 'roleId',
|
|
306
291
|
type: 'Path',
|
|
307
|
-
schema:
|
|
292
|
+
schema: z.number().int(),
|
|
308
293
|
},
|
|
309
294
|
],
|
|
310
|
-
response:
|
|
295
|
+
response: z.void(),
|
|
311
296
|
},
|
|
312
297
|
{
|
|
313
298
|
method: 'delete',
|
|
@@ -318,15 +303,15 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
318
303
|
{
|
|
319
304
|
name: 'agencyId',
|
|
320
305
|
type: 'Path',
|
|
321
|
-
schema:
|
|
306
|
+
schema: z.string().uuid(),
|
|
322
307
|
},
|
|
323
308
|
{
|
|
324
309
|
name: 'roleId',
|
|
325
310
|
type: 'Path',
|
|
326
|
-
schema:
|
|
311
|
+
schema: z.number().int(),
|
|
327
312
|
},
|
|
328
313
|
],
|
|
329
|
-
response:
|
|
314
|
+
response: z.void(),
|
|
330
315
|
},
|
|
331
316
|
{
|
|
332
317
|
method: 'put',
|
|
@@ -342,13 +327,13 @@ const endpoints = (0, core_1.makeApi)([
|
|
|
342
327
|
{
|
|
343
328
|
name: 'agencyId',
|
|
344
329
|
type: 'Path',
|
|
345
|
-
schema:
|
|
330
|
+
schema: z.string().uuid(),
|
|
346
331
|
},
|
|
347
332
|
],
|
|
348
|
-
response:
|
|
333
|
+
response: z.void(),
|
|
349
334
|
},
|
|
350
335
|
]);
|
|
351
|
-
|
|
352
|
-
function createApiClient(baseUrl, options) {
|
|
353
|
-
return new
|
|
336
|
+
export const api = new Zodios(endpoints);
|
|
337
|
+
export function createApiClient(baseUrl, options) {
|
|
338
|
+
return new Zodios(baseUrl, endpoints, options);
|
|
354
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.620",
|
|
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/src/index.ts
CHANGED
|
@@ -12,11 +12,9 @@ const SocialMediaRequest = z
|
|
|
12
12
|
]),
|
|
13
13
|
url: z.string().optional(),
|
|
14
14
|
})
|
|
15
|
-
.strict()
|
|
16
15
|
.passthrough();
|
|
17
16
|
const SocialMediasRequest = z
|
|
18
17
|
.object({ data: z.array(SocialMediaRequest).min(1).max(5) })
|
|
19
|
-
.strict()
|
|
20
18
|
.passthrough();
|
|
21
19
|
const RolesRequest = z
|
|
22
20
|
.object({
|
|
@@ -31,7 +29,6 @@ const RolesRequest = z
|
|
|
31
29
|
])
|
|
32
30
|
),
|
|
33
31
|
})
|
|
34
|
-
.strict()
|
|
35
32
|
.passthrough();
|
|
36
33
|
const PhotoRequest = z
|
|
37
34
|
.object({
|
|
@@ -40,7 +37,6 @@ const PhotoRequest = z
|
|
|
40
37
|
width: z.number().int().gte(10).lte(11000),
|
|
41
38
|
height: z.number().int().gte(10).lte(11000).optional(),
|
|
42
39
|
})
|
|
43
|
-
.strict()
|
|
44
40
|
.passthrough();
|
|
45
41
|
const AddressRequest = z
|
|
46
42
|
.object({
|
|
@@ -50,7 +46,6 @@ const AddressRequest = z
|
|
|
50
46
|
subdistrict: z.string().min(0).max(100),
|
|
51
47
|
street: z.string().min(0).max(255),
|
|
52
48
|
})
|
|
53
|
-
.strict()
|
|
54
49
|
.passthrough();
|
|
55
50
|
const CreateAgencyRequest = z
|
|
56
51
|
.object({
|
|
@@ -62,24 +57,19 @@ const CreateAgencyRequest = z
|
|
|
62
57
|
address: AddressRequest,
|
|
63
58
|
yearSince: z.number().int(),
|
|
64
59
|
})
|
|
65
|
-
.strict()
|
|
66
60
|
.passthrough();
|
|
67
61
|
const InviteMemberRequest = z
|
|
68
62
|
.object({ emails: z.array(z.string()).min(1) })
|
|
69
|
-
.strict()
|
|
70
63
|
.passthrough();
|
|
71
64
|
const PresignedUrlResponse = z
|
|
72
65
|
.object({ originalName: z.string(), key: z.string(), url: z.string() })
|
|
73
|
-
.strict()
|
|
74
66
|
.passthrough();
|
|
75
67
|
const PresignedUrlsResponse = z
|
|
76
68
|
.object({ data: z.array(PresignedUrlResponse) })
|
|
77
|
-
.strict()
|
|
78
69
|
.passthrough();
|
|
79
|
-
const IdResponse = z.object({ id: z.string() }).
|
|
70
|
+
const IdResponse = z.object({ id: z.string() }).passthrough();
|
|
80
71
|
const UploadAcknowledgmentResponse = z
|
|
81
72
|
.object({ success: z.array(z.string()), fail: z.array(z.string()) })
|
|
82
|
-
.strict()
|
|
83
73
|
.passthrough();
|
|
84
74
|
const InvitationViewResponse = z
|
|
85
75
|
.object({
|
|
@@ -97,7 +87,6 @@ const InvitationViewResponse = z
|
|
|
97
87
|
acceptedAt: z.string().datetime({ offset: true }).optional(),
|
|
98
88
|
acceptedBy: z.string().optional(),
|
|
99
89
|
})
|
|
100
|
-
.strict()
|
|
101
90
|
.passthrough();
|
|
102
91
|
|
|
103
92
|
export const schemas = {
|
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
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
14
|
"include": ["src"]
|
|
13
15
|
}
|