@homespot-sdk/validators 0.0.5

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 ADDED
@@ -0,0 +1,361 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.api = exports.schemas = void 0;
4
+ exports.createApiClient = createApiClient;
5
+ const core_1 = require("@zodios/core");
6
+ const zod_1 = require("zod");
7
+ const SocialMediaRequest = zod_1.z
8
+ .object({
9
+ type: zod_1.z.enum([
10
+ 'FACEBOOK',
11
+ 'YOUTUBE',
12
+ 'INSTAGRAM',
13
+ 'TIKTOK',
14
+ 'LINKEDIN',
15
+ ]),
16
+ url: zod_1.z.string().optional(),
17
+ })
18
+ .strict()
19
+ .passthrough();
20
+ const SocialMediasRequest = zod_1.z
21
+ .object({ data: zod_1.z.array(SocialMediaRequest).min(1).max(5) })
22
+ .strict()
23
+ .passthrough();
24
+ const RolesRequest = zod_1.z
25
+ .object({
26
+ name: zod_1.z.string().min(1),
27
+ description: zod_1.z.string().min(1),
28
+ authorities: zod_1.z.array(zod_1.z.enum([
29
+ 'properties_read',
30
+ 'properties_write',
31
+ 'agents_read',
32
+ 'agents_write',
33
+ ])),
34
+ })
35
+ .strict()
36
+ .passthrough();
37
+ const PhotoRequest = zod_1.z
38
+ .object({
39
+ photo: zod_1.z.string().min(0).max(255),
40
+ type: zod_1.z.enum(['JPEG', 'JPG', 'PNG', 'WEBP']),
41
+ width: zod_1.z.number().int().gte(10).lte(11000),
42
+ height: zod_1.z.number().int().gte(10).lte(11000).optional(),
43
+ })
44
+ .strict()
45
+ .passthrough();
46
+ const AddressRequest = zod_1.z
47
+ .object({
48
+ placeId: zod_1.z.string().min(0).max(255),
49
+ cadastralCode: zod_1.z.string().min(0).max(255),
50
+ fullName: zod_1.z.string().min(0).max(500),
51
+ lat: zod_1.z.number().gte(-90).lte(90),
52
+ lng: zod_1.z.number().gte(-180).lte(180),
53
+ country: zod_1.z.string().min(0).max(100),
54
+ city: zod_1.z.string().min(0).max(100),
55
+ street: zod_1.z.string().min(0).max(255),
56
+ })
57
+ .strict()
58
+ .passthrough();
59
+ const CreateAgencyRequest = zod_1.z
60
+ .object({
61
+ name: zod_1.z.string().min(1),
62
+ slogan: zod_1.z.string().min(1),
63
+ logoUrl: zod_1.z.string().min(1),
64
+ coverImage: zod_1.z.string().min(1),
65
+ email: zod_1.z.string().min(1).email(),
66
+ seats: zod_1.z.number().int(),
67
+ domain: zod_1.z.string().min(1),
68
+ phone: zod_1.z.string().min(1),
69
+ website: zod_1.z.string().min(1),
70
+ address: AddressRequest,
71
+ yearSince: zod_1.z.number().int(),
72
+ })
73
+ .strict()
74
+ .passthrough();
75
+ const InviteMemberRequest = zod_1.z
76
+ .object({ emails: zod_1.z.array(zod_1.z.string()).min(1) })
77
+ .strict()
78
+ .passthrough();
79
+ const PresignedUrlResponse = zod_1.z
80
+ .object({ originalName: zod_1.z.string(), key: zod_1.z.string(), url: zod_1.z.string() })
81
+ .strict()
82
+ .passthrough();
83
+ const PresignedUrlsResponse = zod_1.z
84
+ .object({ data: zod_1.z.array(PresignedUrlResponse) })
85
+ .strict()
86
+ .passthrough();
87
+ const IdResponse = zod_1.z.object({ id: zod_1.z.string() }).strict().passthrough();
88
+ const UploadAcknowledgmentResponse = zod_1.z
89
+ .object({ success: zod_1.z.array(zod_1.z.string()), fail: zod_1.z.array(zod_1.z.string()) })
90
+ .strict()
91
+ .passthrough();
92
+ const InvitationViewResponse = zod_1.z
93
+ .object({
94
+ invitationId: zod_1.z.string().uuid(),
95
+ email: zod_1.z.string(),
96
+ status: zod_1.z.enum([
97
+ 'PENDING',
98
+ 'ACCEPTED',
99
+ 'REJECTED',
100
+ 'CANCELLED',
101
+ 'EXPIRED',
102
+ ]),
103
+ createdAt: zod_1.z.string().datetime({ offset: true }),
104
+ expiresAt: zod_1.z.string().datetime({ offset: true }),
105
+ acceptedAt: zod_1.z.string().datetime({ offset: true }).optional(),
106
+ acceptedBy: zod_1.z.string().optional(),
107
+ })
108
+ .strict()
109
+ .passthrough();
110
+ exports.schemas = {
111
+ SocialMediaRequest,
112
+ SocialMediasRequest,
113
+ RolesRequest,
114
+ PhotoRequest,
115
+ AddressRequest,
116
+ CreateAgencyRequest,
117
+ InviteMemberRequest,
118
+ PresignedUrlResponse,
119
+ PresignedUrlsResponse,
120
+ IdResponse,
121
+ UploadAcknowledgmentResponse,
122
+ InvitationViewResponse,
123
+ };
124
+ const endpoints = (0, core_1.makeApi)([
125
+ {
126
+ method: 'post',
127
+ path: '/agency',
128
+ alias: 'createAgency',
129
+ requestFormat: 'json',
130
+ parameters: [
131
+ {
132
+ name: 'body',
133
+ type: 'Body',
134
+ schema: CreateAgencyRequest,
135
+ },
136
+ ],
137
+ response: zod_1.z.void(),
138
+ },
139
+ {
140
+ method: 'get',
141
+ path: '/agency/:agencyId',
142
+ alias: 'getAgency',
143
+ requestFormat: 'json',
144
+ parameters: [
145
+ {
146
+ name: 'agencyId',
147
+ type: 'Path',
148
+ schema: zod_1.z.string().uuid(),
149
+ },
150
+ ],
151
+ response: zod_1.z.void(),
152
+ },
153
+ {
154
+ method: 'post',
155
+ path: '/agency/:agencyId/activate',
156
+ alias: 'activateAgency',
157
+ requestFormat: 'json',
158
+ parameters: [
159
+ {
160
+ name: 'agencyId',
161
+ type: 'Path',
162
+ schema: zod_1.z.string().uuid(),
163
+ },
164
+ ],
165
+ response: zod_1.z.void(),
166
+ },
167
+ {
168
+ method: 'get',
169
+ path: '/agency/:agencyId/invitation',
170
+ alias: 'getAllInvitations',
171
+ requestFormat: 'json',
172
+ parameters: [
173
+ {
174
+ name: 'agencyId',
175
+ type: 'Path',
176
+ schema: zod_1.z.string().uuid(),
177
+ },
178
+ ],
179
+ response: zod_1.z.void(),
180
+ },
181
+ {
182
+ method: 'post',
183
+ path: '/agency/:agencyId/invitation',
184
+ alias: 'inviteMember',
185
+ requestFormat: 'json',
186
+ parameters: [
187
+ {
188
+ name: 'body',
189
+ type: 'Body',
190
+ schema: InviteMemberRequest,
191
+ },
192
+ {
193
+ name: 'agencyId',
194
+ type: 'Path',
195
+ schema: zod_1.z.string().uuid(),
196
+ },
197
+ ],
198
+ response: zod_1.z.void(),
199
+ },
200
+ {
201
+ method: 'post',
202
+ path: '/agency/:agencyId/invitation/:invitationId',
203
+ alias: 'inviteAccepted',
204
+ requestFormat: 'json',
205
+ parameters: [
206
+ {
207
+ name: 'agencyId',
208
+ type: 'Path',
209
+ schema: zod_1.z.string().uuid(),
210
+ },
211
+ {
212
+ name: 'invitationId',
213
+ type: 'Path',
214
+ schema: zod_1.z.string().uuid(),
215
+ },
216
+ ],
217
+ response: zod_1.z.void(),
218
+ },
219
+ {
220
+ method: 'put',
221
+ path: '/agency/:agencyId/presigned-urls',
222
+ alias: 'generatePresignedUrl',
223
+ requestFormat: 'json',
224
+ parameters: [
225
+ {
226
+ name: 'body',
227
+ type: 'Body',
228
+ schema: PhotoRequest,
229
+ },
230
+ {
231
+ name: 'agencyId',
232
+ type: 'Path',
233
+ schema: zod_1.z.string().uuid(),
234
+ },
235
+ ],
236
+ response: zod_1.z.void(),
237
+ },
238
+ {
239
+ method: 'post',
240
+ path: '/agency/:agencyId/presigned-urls/notify/cover',
241
+ alias: 'notifyCoverUploadCompletion',
242
+ requestFormat: 'json',
243
+ parameters: [
244
+ {
245
+ name: 'body',
246
+ type: 'Body',
247
+ schema: PhotoRequest,
248
+ },
249
+ {
250
+ name: 'agencyId',
251
+ type: 'Path',
252
+ schema: zod_1.z.string().uuid(),
253
+ },
254
+ ],
255
+ response: zod_1.z.void(),
256
+ },
257
+ {
258
+ method: 'post',
259
+ path: '/agency/:agencyId/presigned-urls/notify/logo',
260
+ alias: 'notifyLogoUploadCompletion',
261
+ requestFormat: 'json',
262
+ parameters: [
263
+ {
264
+ name: 'body',
265
+ type: 'Body',
266
+ schema: PhotoRequest,
267
+ },
268
+ {
269
+ name: 'agencyId',
270
+ type: 'Path',
271
+ schema: zod_1.z.string().uuid(),
272
+ },
273
+ ],
274
+ response: zod_1.z.void(),
275
+ },
276
+ {
277
+ method: 'post',
278
+ path: '/agency/:agencyId/roles',
279
+ alias: 'addRole',
280
+ requestFormat: 'json',
281
+ parameters: [
282
+ {
283
+ name: 'body',
284
+ type: 'Body',
285
+ schema: RolesRequest,
286
+ },
287
+ {
288
+ name: 'agencyId',
289
+ type: 'Path',
290
+ schema: zod_1.z.string().uuid(),
291
+ },
292
+ ],
293
+ response: zod_1.z.void(),
294
+ },
295
+ {
296
+ method: 'put',
297
+ path: '/agency/:agencyId/roles/:roleId',
298
+ alias: 'updateRole',
299
+ requestFormat: 'json',
300
+ parameters: [
301
+ {
302
+ name: 'body',
303
+ type: 'Body',
304
+ schema: RolesRequest,
305
+ },
306
+ {
307
+ name: 'agencyId',
308
+ type: 'Path',
309
+ schema: zod_1.z.string().uuid(),
310
+ },
311
+ {
312
+ name: 'roleId',
313
+ type: 'Path',
314
+ schema: zod_1.z.number().int(),
315
+ },
316
+ ],
317
+ response: zod_1.z.void(),
318
+ },
319
+ {
320
+ method: 'delete',
321
+ path: '/agency/:agencyId/roles/:roleId',
322
+ alias: 'removeRole',
323
+ requestFormat: 'json',
324
+ parameters: [
325
+ {
326
+ name: 'agencyId',
327
+ type: 'Path',
328
+ schema: zod_1.z.string().uuid(),
329
+ },
330
+ {
331
+ name: 'roleId',
332
+ type: 'Path',
333
+ schema: zod_1.z.number().int(),
334
+ },
335
+ ],
336
+ response: zod_1.z.void(),
337
+ },
338
+ {
339
+ method: 'put',
340
+ path: '/agency/:agencyId/social-media',
341
+ alias: 'updateSocialUrls',
342
+ requestFormat: 'json',
343
+ parameters: [
344
+ {
345
+ name: 'body',
346
+ type: 'Body',
347
+ schema: SocialMediasRequest,
348
+ },
349
+ {
350
+ name: 'agencyId',
351
+ type: 'Path',
352
+ schema: zod_1.z.string().uuid(),
353
+ },
354
+ ],
355
+ response: zod_1.z.void(),
356
+ },
357
+ ]);
358
+ exports.api = new core_1.Zodios(endpoints);
359
+ function createApiClient(baseUrl, options) {
360
+ return new core_1.Zodios(baseUrl, endpoints, options);
361
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@homespot-sdk/validators",
3
+ "version": "0.0.5",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "scripts": {
7
+ "build": "tsc"
8
+ },
9
+ "peerDependencies": {
10
+ "zod": "^3.0.0"
11
+ },
12
+ "dependencies": {
13
+ "zod": "^3.0.0",
14
+ "@zodios/core": "^10.9.6"
15
+ },
16
+ "devDependencies": {
17
+ "typescript": "^5.0.0"
18
+ }
19
+ }