@homespot-sdk/validators 0.0.638 → 0.0.640

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.
Files changed (4) hide show
  1. package/dist/index.d.ts +1229 -699
  2. package/dist/index.js +339 -156
  3. package/package.json +1 -1
  4. package/src/index.ts +345 -158
package/src/index.ts CHANGED
@@ -1,6 +1,30 @@
1
1
  import { makeApi, Zodios, type ZodiosOptions } from '@zodios/core';
2
2
  import { z } from 'zod';
3
3
 
4
+ const RolesRequest = z
5
+ .object({
6
+ name: z.string().min(1),
7
+ description: z.string().min(1),
8
+ permissions: z.array(
9
+ z.enum([
10
+ 'AGENCY_WRITE',
11
+ 'INVITATION_READ',
12
+ 'INVITATION_WRITE',
13
+ 'ROLE_READ',
14
+ 'ROLE_WRITE',
15
+ 'MEMBER_READ',
16
+ 'MEMBER_WRITE',
17
+ ])
18
+ ),
19
+ })
20
+ .passthrough();
21
+ const AssignRoleRequest = z.object({ roleId: z.number().int() }).passthrough();
22
+ const BatchAssignRoleRequest = z
23
+ .object({
24
+ roleId: z.number().int(),
25
+ memberIds: z.array(z.string().uuid()).min(1),
26
+ })
27
+ .passthrough();
4
28
  const AddressRequest = z
5
29
  .object({
6
30
  country: z.string().min(0).max(100),
@@ -36,28 +60,6 @@ const SocialMediaRequest = z
36
60
  const SocialMediasRequest = z
37
61
  .object({ data: z.array(SocialMediaRequest).min(1).max(5) })
38
62
  .passthrough();
39
- const RolesRequest = z
40
- .object({
41
- name: z.string().min(1),
42
- description: z.string().min(1),
43
- authorities: z.array(
44
- z.enum([
45
- 'properties_read',
46
- 'properties_write',
47
- 'agents_read',
48
- 'agents_write',
49
- ])
50
- ),
51
- })
52
- .passthrough();
53
- const pageable = z
54
- .object({
55
- page: z.number().int().gte(0),
56
- size: z.number().int().gte(1),
57
- sort: z.array(z.string()),
58
- })
59
- .partial()
60
- .passthrough();
61
63
  const InvitationDetailsRequest = z
62
64
  .object({ email: z.string().min(1), roleId: z.number().int() })
63
65
  .passthrough();
@@ -91,12 +93,15 @@ const OrganizationSummaryViewResponse = z
91
93
  roleId: z.number().int().optional(),
92
94
  memberId: z.string().uuid(),
93
95
  roleName: z.string(),
94
- authorities: z.array(
96
+ permissions: z.array(
95
97
  z.enum([
96
- 'properties_read',
97
- 'properties_write',
98
- 'agents_read',
99
- 'agents_write',
98
+ 'AGENCY_WRITE',
99
+ 'INVITATION_READ',
100
+ 'INVITATION_WRITE',
101
+ 'ROLE_READ',
102
+ 'ROLE_WRITE',
103
+ 'MEMBER_READ',
104
+ 'MEMBER_WRITE',
100
105
  ])
101
106
  ),
102
107
  status: z.enum(['NEW', 'ACTIVE', 'PAYMENT_FAILED', 'INACTIVE']),
@@ -111,54 +116,55 @@ const UserContextViewResponse = z
111
116
  organizations: z.array(OrganizationSummaryViewResponse),
112
117
  })
113
118
  .passthrough();
114
- const Pageable = z
119
+ const RoleResponse = z
115
120
  .object({
116
- page: z.number().int().gte(0),
117
- size: z.number().int().gte(1),
118
- sort: z.array(z.string()),
121
+ id: z.number().int(),
122
+ name: z.string(),
123
+ description: z.string(),
124
+ permissions: z.array(
125
+ z.enum([
126
+ 'AGENCY_WRITE',
127
+ 'INVITATION_READ',
128
+ 'INVITATION_WRITE',
129
+ 'ROLE_READ',
130
+ 'ROLE_WRITE',
131
+ 'MEMBER_READ',
132
+ 'MEMBER_WRITE',
133
+ ])
134
+ ),
119
135
  })
136
+ .passthrough();
137
+ const SortObject = z
138
+ .object({ empty: z.boolean(), sorted: z.boolean(), unsorted: z.boolean() })
120
139
  .partial()
121
140
  .passthrough();
122
- const MemberViewResponse = z
141
+ const PageableObject = z
123
142
  .object({
124
- userId: z.string(),
125
- firstName: z.string(),
126
- lastName: z.string(),
127
- phone: z.string().optional(),
128
- email: z.string(),
129
- roleId: z.number().int(),
130
- roleName: z.string(),
131
- joinedAt: z.string().datetime({ offset: true }),
143
+ offset: z.number().int(),
144
+ sort: SortObject,
145
+ unpaged: z.boolean(),
146
+ paged: z.boolean(),
147
+ pageNumber: z.number().int(),
148
+ pageSize: z.number().int(),
132
149
  })
150
+ .partial()
133
151
  .passthrough();
134
- const PageMetadata = z
152
+ const PageRoleResponse = z
135
153
  .object({
136
- size: z.number().int(),
137
- number: z.number().int(),
138
154
  totalElements: z.number().int(),
139
155
  totalPages: z.number().int(),
156
+ size: z.number().int(),
157
+ content: z.array(RoleResponse),
158
+ number: z.number().int(),
159
+ first: z.boolean(),
160
+ last: z.boolean(),
161
+ numberOfElements: z.number().int(),
162
+ sort: SortObject,
163
+ pageable: PageableObject,
164
+ empty: z.boolean(),
140
165
  })
141
166
  .partial()
142
167
  .passthrough();
143
- const PagedModelMemberViewResponse = z
144
- .object({ content: z.array(MemberViewResponse), page: PageMetadata })
145
- .partial()
146
- .passthrough();
147
- const InvitationViewResponse = z
148
- .object({
149
- invitationId: z.string().uuid(),
150
- email: z.string(),
151
- status: z.enum(['PENDING', 'ACCEPTED', 'CANCELLED', 'EXPIRED']),
152
- createdAt: z.string().datetime({ offset: true }),
153
- expiresAt: z.string().datetime({ offset: true }),
154
- acceptedAt: z.string().datetime({ offset: true }).optional(),
155
- acceptedBy: z.string().optional(),
156
- })
157
- .passthrough();
158
- const PagedModelInvitationViewResponse = z
159
- .object({ content: z.array(InvitationViewResponse), page: PageMetadata })
160
- .partial()
161
- .passthrough();
162
168
  const InvitationDetailsResponse = z
163
169
  .object({
164
170
  invitationId: z.string().uuid(),
@@ -169,7 +175,7 @@ const InvitationDetailsResponse = z
169
175
  agencyLogo: z.string().optional(),
170
176
  })
171
177
  .passthrough();
172
- const AgencyPeekViewResponse = z
178
+ const AgencySummaryResponse = z
173
179
  .object({
174
180
  id: z.string().uuid(),
175
181
  owner: z.string(),
@@ -184,8 +190,17 @@ const AgencyPeekViewResponse = z
184
190
  logo: z.string().optional(),
185
191
  })
186
192
  .passthrough();
187
- const PagedModelAgencyPeekViewResponse = z
188
- .object({ content: z.array(AgencyPeekViewResponse), page: PageMetadata })
193
+ const PageMetadata = z
194
+ .object({
195
+ size: z.number().int(),
196
+ number: z.number().int(),
197
+ totalElements: z.number().int(),
198
+ totalPages: z.number().int(),
199
+ })
200
+ .partial()
201
+ .passthrough();
202
+ const PagedModelAgencySummaryResponse = z
203
+ .object({ content: z.array(AgencySummaryResponse), page: PageMetadata })
189
204
  .partial()
190
205
  .passthrough();
191
206
  const AddressViewResponse = z
@@ -197,7 +212,7 @@ const AddressViewResponse = z
197
212
  street: z.string(),
198
213
  })
199
214
  .passthrough();
200
- const AgencyViewResponse = z
215
+ const AgencyProfileResponse = z
201
216
  .object({
202
217
  name: z.string(),
203
218
  email: z.string(),
@@ -208,14 +223,76 @@ const AgencyViewResponse = z
208
223
  yearSince: z.number().int(),
209
224
  })
210
225
  .passthrough();
226
+ const MemberViewResponse = z
227
+ .object({
228
+ userId: z.string(),
229
+ firstName: z.string(),
230
+ lastName: z.string(),
231
+ phone: z.string().optional(),
232
+ email: z.string(),
233
+ roleId: z.number().int(),
234
+ roleName: z.string(),
235
+ joinedAt: z.string().datetime({ offset: true }),
236
+ })
237
+ .passthrough();
238
+ const PagedModelMemberViewResponse = z
239
+ .object({ content: z.array(MemberViewResponse), page: PageMetadata })
240
+ .partial()
241
+ .passthrough();
242
+ const InvitationViewResponse = z
243
+ .object({
244
+ invitationId: z.string().uuid(),
245
+ email: z.string(),
246
+ status: z.enum(['PENDING', 'ACCEPTED', 'CANCELLED', 'EXPIRED']),
247
+ createdAt: z.string().datetime({ offset: true }),
248
+ expiresAt: z.string().datetime({ offset: true }),
249
+ acceptedAt: z.string().datetime({ offset: true }).optional(),
250
+ acceptedBy: z.string().optional(),
251
+ })
252
+ .passthrough();
253
+ const PagedModelInvitationViewResponse = z
254
+ .object({ content: z.array(InvitationViewResponse), page: PageMetadata })
255
+ .partial()
256
+ .passthrough();
257
+ const PermissionResponse = z
258
+ .object({
259
+ permission: z.enum([
260
+ 'AGENCY_WRITE',
261
+ 'INVITATION_READ',
262
+ 'INVITATION_WRITE',
263
+ 'ROLE_READ',
264
+ 'ROLE_WRITE',
265
+ 'MEMBER_READ',
266
+ 'MEMBER_WRITE',
267
+ ]),
268
+ implied: z.array(
269
+ z.enum([
270
+ 'AGENCY_WRITE',
271
+ 'INVITATION_READ',
272
+ 'INVITATION_WRITE',
273
+ 'ROLE_READ',
274
+ 'ROLE_WRITE',
275
+ 'MEMBER_READ',
276
+ 'MEMBER_WRITE',
277
+ ])
278
+ ),
279
+ })
280
+ .passthrough();
281
+ const GroupedPermissionsResponse = z
282
+ .object({
283
+ group: z.enum(['AGENCY', 'INVITATION', 'ROLE', 'MEMBER']),
284
+ permissions: z.array(PermissionResponse),
285
+ })
286
+ .passthrough();
211
287
 
212
288
  export const schemas = {
289
+ RolesRequest,
290
+ AssignRoleRequest,
291
+ BatchAssignRoleRequest,
213
292
  AddressRequest,
214
293
  CreateAgencyRequest,
215
294
  SocialMediaRequest,
216
295
  SocialMediasRequest,
217
- RolesRequest,
218
- pageable,
219
296
  InvitationDetailsRequest,
220
297
  InviteMemberRequest,
221
298
  PhotoRequest,
@@ -226,41 +303,25 @@ export const schemas = {
226
303
  OrganizationSummaryViewResponse,
227
304
  UserSummaryViewResponse,
228
305
  UserContextViewResponse,
229
- Pageable,
230
- MemberViewResponse,
306
+ RoleResponse,
307
+ SortObject,
308
+ PageableObject,
309
+ PageRoleResponse,
310
+ InvitationDetailsResponse,
311
+ AgencySummaryResponse,
231
312
  PageMetadata,
313
+ PagedModelAgencySummaryResponse,
314
+ AddressViewResponse,
315
+ AgencyProfileResponse,
316
+ MemberViewResponse,
232
317
  PagedModelMemberViewResponse,
233
318
  InvitationViewResponse,
234
319
  PagedModelInvitationViewResponse,
235
- InvitationDetailsResponse,
236
- AgencyPeekViewResponse,
237
- PagedModelAgencyPeekViewResponse,
238
- AddressViewResponse,
239
- AgencyViewResponse,
320
+ PermissionResponse,
321
+ GroupedPermissionsResponse,
240
322
  };
241
323
 
242
324
  const endpoints = makeApi([
243
- {
244
- method: 'get',
245
- path: '/agency',
246
- alias: 'getAllAgencies',
247
- requestFormat: 'json',
248
- parameters: [
249
- {
250
- name: 'status',
251
- type: 'Query',
252
- schema: z
253
- .enum(['NEW', 'ACTIVE', 'PAYMENT_FAILED', 'INACTIVE'])
254
- .optional(),
255
- },
256
- {
257
- name: 'pageable',
258
- type: 'Query',
259
- schema: pageable,
260
- },
261
- ],
262
- response: z.void(),
263
- },
264
325
  {
265
326
  method: 'post',
266
327
  path: '/agency',
@@ -276,21 +337,7 @@ const endpoints = makeApi([
276
337
  response: z.void(),
277
338
  },
278
339
  {
279
- method: 'get',
280
- path: '/agency/:agencyId',
281
- alias: 'getAgency',
282
- requestFormat: 'json',
283
- parameters: [
284
- {
285
- name: 'agencyId',
286
- type: 'Path',
287
- schema: z.string().uuid(),
288
- },
289
- ],
290
- response: z.void(),
291
- },
292
- {
293
- method: 'post',
340
+ method: 'put',
294
341
  path: '/agency/:agencyId/activate',
295
342
  alias: 'activateAgency',
296
343
  requestFormat: 'json',
@@ -365,111 +412,213 @@ const endpoints = makeApi([
365
412
  response: z.void(),
366
413
  },
367
414
  {
368
- method: 'post',
369
- path: '/agency/roles',
370
- alias: 'addRole',
415
+ method: 'get',
416
+ path: '/agency/roles/permissions',
417
+ alias: 'listPermissionCatalog',
418
+ requestFormat: 'json',
419
+ response: z.void(),
420
+ },
421
+ {
422
+ method: 'put',
423
+ path: '/agency/social-media',
424
+ alias: 'updateSocialUrls',
371
425
  requestFormat: 'json',
372
426
  parameters: [
373
427
  {
374
428
  name: 'body',
375
429
  type: 'Body',
376
- schema: RolesRequest,
430
+ schema: SocialMediasRequest,
377
431
  },
378
432
  ],
379
433
  response: z.void(),
380
434
  },
381
435
  {
382
- method: 'put',
383
- path: '/agency/roles/:roleId',
384
- alias: 'updateRole',
436
+ method: 'get',
437
+ path: '/invitation',
438
+ alias: 'getSentInvitations',
439
+ requestFormat: 'json',
440
+ parameters: [
441
+ {
442
+ name: 'page',
443
+ type: 'Query',
444
+ schema: z.number().int().gte(0).optional().default(0),
445
+ },
446
+ {
447
+ name: 'size',
448
+ type: 'Query',
449
+ schema: z.number().int().gte(1).optional().default(10),
450
+ },
451
+ {
452
+ name: 'sort',
453
+ type: 'Query',
454
+ schema: z
455
+ .array(z.string())
456
+ .optional()
457
+ .default(['createdAt,ASC']),
458
+ },
459
+ ],
460
+ response: z.void(),
461
+ },
462
+ {
463
+ method: 'post',
464
+ path: '/invitation',
465
+ alias: 'sendInvitation',
385
466
  requestFormat: 'json',
386
467
  parameters: [
387
468
  {
388
469
  name: 'body',
389
470
  type: 'Body',
390
- schema: RolesRequest,
471
+ schema: InviteMemberRequest,
391
472
  },
473
+ ],
474
+ response: z.void(),
475
+ },
476
+ {
477
+ method: 'post',
478
+ path: '/invitation/:invitationId',
479
+ alias: 'acceptInvitation',
480
+ requestFormat: 'json',
481
+ parameters: [
392
482
  {
393
- name: 'roleId',
483
+ name: 'agencyId',
484
+ type: 'Query',
485
+ schema: z.string().uuid(),
486
+ },
487
+ {
488
+ name: 'invitationId',
394
489
  type: 'Path',
395
- schema: z.number().int(),
490
+ schema: z.string().uuid(),
396
491
  },
397
492
  ],
398
493
  response: z.void(),
399
494
  },
400
495
  {
401
- method: 'delete',
402
- path: '/agency/roles/:roleId',
403
- alias: 'removeRole',
496
+ method: 'get',
497
+ path: '/member',
498
+ alias: 'getAllMembers',
404
499
  requestFormat: 'json',
405
500
  parameters: [
406
501
  {
407
502
  name: 'roleId',
503
+ type: 'Query',
504
+ schema: z.number().int().optional(),
505
+ },
506
+ {
507
+ name: 'page',
508
+ type: 'Query',
509
+ schema: z.number().int().gte(0).optional().default(0),
510
+ },
511
+ {
512
+ name: 'size',
513
+ type: 'Query',
514
+ schema: z.number().int().gte(1).optional().default(10),
515
+ },
516
+ {
517
+ name: 'sort',
518
+ type: 'Query',
519
+ schema: z
520
+ .array(z.string())
521
+ .optional()
522
+ .default(['joinedAt,DESC']),
523
+ },
524
+ ],
525
+ response: z.void(),
526
+ },
527
+ {
528
+ method: 'put',
529
+ path: '/member/:memberId/role',
530
+ alias: 'assignRole',
531
+ requestFormat: 'json',
532
+ parameters: [
533
+ {
534
+ name: 'body',
535
+ type: 'Body',
536
+ schema: z.object({ roleId: z.number().int() }).passthrough(),
537
+ },
538
+ {
539
+ name: 'memberId',
408
540
  type: 'Path',
409
- schema: z.number().int(),
541
+ schema: z.string().uuid(),
410
542
  },
411
543
  ],
412
544
  response: z.void(),
413
545
  },
414
546
  {
415
547
  method: 'put',
416
- path: '/agency/social-media',
417
- alias: 'updateSocialUrls',
548
+ path: '/member/role',
549
+ alias: 'assignRoleBatch',
418
550
  requestFormat: 'json',
419
551
  parameters: [
420
552
  {
421
553
  name: 'body',
422
554
  type: 'Body',
423
- schema: SocialMediasRequest,
555
+ schema: BatchAssignRoleRequest,
424
556
  },
425
557
  ],
426
558
  response: z.void(),
427
559
  },
428
560
  {
429
561
  method: 'get',
430
- path: '/agency/subdomain/:subDomain',
431
- alias: 'getAgencyBySubdomain',
562
+ path: '/public/agency',
563
+ alias: 'getAllAgencies',
432
564
  requestFormat: 'json',
433
565
  parameters: [
434
566
  {
435
- name: 'subDomain',
436
- type: 'Path',
437
- schema: z.string(),
567
+ name: 'status',
568
+ type: 'Query',
569
+ schema: z
570
+ .enum(['NEW', 'ACTIVE', 'PAYMENT_FAILED', 'INACTIVE'])
571
+ .optional(),
572
+ },
573
+ {
574
+ name: 'page',
575
+ type: 'Query',
576
+ schema: z.number().int().gte(0).optional().default(0),
577
+ },
578
+ {
579
+ name: 'size',
580
+ type: 'Query',
581
+ schema: z.number().int().gte(1).optional().default(10),
582
+ },
583
+ {
584
+ name: 'sort',
585
+ type: 'Query',
586
+ schema: z.array(z.string()).optional().default(['name,ASC']),
438
587
  },
439
588
  ],
440
589
  response: z.void(),
441
590
  },
442
591
  {
443
592
  method: 'get',
444
- path: '/invitation',
445
- alias: 'getAllInvitations',
593
+ path: '/public/agency/:agencyId',
594
+ alias: 'getAgency',
446
595
  requestFormat: 'json',
447
596
  parameters: [
448
597
  {
449
- name: 'pageable',
450
- type: 'Query',
451
- schema: pageable,
598
+ name: 'agencyId',
599
+ type: 'Path',
600
+ schema: z.string().uuid(),
452
601
  },
453
602
  ],
454
603
  response: z.void(),
455
604
  },
456
605
  {
457
- method: 'post',
458
- path: '/invitation',
459
- alias: 'inviteMember',
606
+ method: 'get',
607
+ path: '/public/agency/subdomain/:subDomain',
608
+ alias: 'getAgencyBySubdomain',
460
609
  requestFormat: 'json',
461
610
  parameters: [
462
611
  {
463
- name: 'body',
464
- type: 'Body',
465
- schema: InviteMemberRequest,
612
+ name: 'subDomain',
613
+ type: 'Path',
614
+ schema: z.string(),
466
615
  },
467
616
  ],
468
617
  response: z.void(),
469
618
  },
470
619
  {
471
620
  method: 'get',
472
- path: '/invitation/:invitationId',
621
+ path: '/public/invitation/:invitationId',
473
622
  alias: 'getInvitationDetails',
474
623
  requestFormat: 'json',
475
624
  parameters: [
@@ -487,34 +636,72 @@ const endpoints = makeApi([
487
636
  response: z.void(),
488
637
  },
489
638
  {
490
- method: 'post',
491
- path: '/invitation/:invitationId',
492
- alias: 'inviteAccepted',
639
+ method: 'get',
640
+ path: '/roles',
641
+ alias: 'listRoles',
493
642
  requestFormat: 'json',
494
643
  parameters: [
495
644
  {
496
- name: 'agencyId',
645
+ name: 'page',
497
646
  type: 'Query',
498
- schema: z.string().uuid(),
647
+ schema: z.number().int().gte(0).optional().default(0),
499
648
  },
500
649
  {
501
- name: 'invitationId',
650
+ name: 'size',
651
+ type: 'Query',
652
+ schema: z.number().int().gte(1).optional().default(20),
653
+ },
654
+ {
655
+ name: 'sort',
656
+ type: 'Query',
657
+ schema: z.array(z.string()).optional(),
658
+ },
659
+ ],
660
+ response: z.void(),
661
+ },
662
+ {
663
+ method: 'post',
664
+ path: '/roles',
665
+ alias: 'createRole',
666
+ requestFormat: 'json',
667
+ parameters: [
668
+ {
669
+ name: 'body',
670
+ type: 'Body',
671
+ schema: RolesRequest,
672
+ },
673
+ ],
674
+ response: z.void(),
675
+ },
676
+ {
677
+ method: 'put',
678
+ path: '/roles/:roleId',
679
+ alias: 'updateRole',
680
+ requestFormat: 'json',
681
+ parameters: [
682
+ {
683
+ name: 'body',
684
+ type: 'Body',
685
+ schema: RolesRequest,
686
+ },
687
+ {
688
+ name: 'roleId',
502
689
  type: 'Path',
503
- schema: z.string().uuid(),
690
+ schema: z.number().int(),
504
691
  },
505
692
  ],
506
693
  response: z.void(),
507
694
  },
508
695
  {
509
- method: 'get',
510
- path: '/member',
511
- alias: 'getAllMembers',
696
+ method: 'delete',
697
+ path: '/roles/:roleId',
698
+ alias: 'removeRole',
512
699
  requestFormat: 'json',
513
700
  parameters: [
514
701
  {
515
- name: 'pageable',
516
- type: 'Query',
517
- schema: pageable,
702
+ name: 'roleId',
703
+ type: 'Path',
704
+ schema: z.number().int(),
518
705
  },
519
706
  ],
520
707
  response: z.void(),