@oxide/turnstile.ts 0.6.6 → 0.7.0-rc.0
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/{Api-DUOjHzpm.d.cts → Api-Z7zZcVks.d.cts} +146 -34
- package/dist/{Api-DUOjHzpm.d.ts → Api-Z7zZcVks.d.ts} +146 -34
- package/dist/Api.cjs +87 -0
- package/dist/Api.d.cts +1 -1
- package/dist/Api.d.ts +1 -1
- package/dist/Api.js +87 -0
- package/dist/retry.cjs +87 -0
- package/dist/retry.d.cts +1 -1
- package/dist/retry.d.ts +1 -1
- package/dist/retry.js +87 -0
- package/dist/validate.cjs +197 -41
- package/dist/validate.d.cts +1444 -663
- package/dist/validate.d.ts +1444 -663
- package/dist/validate.js +181 -41
- package/package.json +1 -1
- package/src/Api.ts +201 -32
- package/src/util.ts +1 -1
- package/src/validate.ts +196 -47
package/src/validate.ts
CHANGED
|
@@ -51,6 +51,8 @@ export const TypedUuidForRoleId = z.preprocess(processResponseBody, z.string().u
|
|
|
51
51
|
|
|
52
52
|
export const TypedUuidForListingId = z.preprocess(processResponseBody, z.string().uuid())
|
|
53
53
|
|
|
54
|
+
export const TypedUuidForPoolId = z.preprocess(processResponseBody, z.string().uuid())
|
|
55
|
+
|
|
54
56
|
export const TypedUuidForReviewerId = z.preprocess(processResponseBody, z.string().uuid())
|
|
55
57
|
|
|
56
58
|
export const TypedUuidForReviewId = z.preprocess(processResponseBody, z.string().uuid())
|
|
@@ -115,6 +117,10 @@ export const TurnstilePermission = z.preprocess(
|
|
|
115
117
|
'GetListingsAll',
|
|
116
118
|
'CreateListing',
|
|
117
119
|
'ManageListingsAll',
|
|
120
|
+
'GetPoolsAssigned',
|
|
121
|
+
'GetPoolsAll',
|
|
122
|
+
'CreatePool',
|
|
123
|
+
'ManagePoolsAll',
|
|
118
124
|
'GetReviewersAssigned',
|
|
119
125
|
'GetReviewersAll',
|
|
120
126
|
'GetReviewerSelf',
|
|
@@ -225,6 +231,8 @@ export const TurnstilePermission = z.preprocess(
|
|
|
225
231
|
z.object({ 'GetRoles': TypedUuidForRoleId.array().refine(...uniqueItems) }),
|
|
226
232
|
z.object({ 'GetListing': TypedUuidForListingId }),
|
|
227
233
|
z.object({ 'GetListings': TypedUuidForListingId.array().refine(...uniqueItems) }),
|
|
234
|
+
z.object({ 'GetPool': TypedUuidForPoolId }),
|
|
235
|
+
z.object({ 'GetPools': TypedUuidForPoolId.array().refine(...uniqueItems) }),
|
|
228
236
|
z.object({ 'GetReviewer': TypedUuidForReviewerId }),
|
|
229
237
|
z.object({ 'GetReviewers': TypedUuidForReviewerId.array().refine(...uniqueItems) }),
|
|
230
238
|
z.object({ 'CreateReviewer': TypedUuidForUserId }),
|
|
@@ -547,6 +555,20 @@ export const ApplicationStateRecord = z.preprocess(
|
|
|
547
555
|
}),
|
|
548
556
|
)
|
|
549
557
|
|
|
558
|
+
export const ListingPoolAssociation = z.preprocess(processResponseBody, z.enum(['first', 'early_positive', 'positive']))
|
|
559
|
+
|
|
560
|
+
export const PoolAction = z.preprocess(
|
|
561
|
+
processResponseBody,
|
|
562
|
+
z.union([
|
|
563
|
+
z.object({
|
|
564
|
+
'action': z.enum(['add']),
|
|
565
|
+
'association': ListingPoolAssociation,
|
|
566
|
+
'count': z.number().min(0).max(4294967295),
|
|
567
|
+
}),
|
|
568
|
+
z.object({ 'action': z.enum(['triage']) }),
|
|
569
|
+
]),
|
|
570
|
+
)
|
|
571
|
+
|
|
550
572
|
export const ReviewScore = z.preprocess(
|
|
551
573
|
processResponseBody,
|
|
552
574
|
z.enum(['emphatic_yes', 'yes', 'pass', 'no', 'emphatic_no', 'incomplete']),
|
|
@@ -566,6 +588,7 @@ export const Reviews = z.preprocess(
|
|
|
566
588
|
export const ExpandedApplicationSummary = z.preprocess(
|
|
567
589
|
processResponseBody,
|
|
568
590
|
z.object({
|
|
591
|
+
'action': PoolAction,
|
|
569
592
|
'applicant': ApplicantInfo,
|
|
570
593
|
'application': Application,
|
|
571
594
|
'documents': Document.array(),
|
|
@@ -594,6 +617,11 @@ export const ApplicationSummaryResponse = z.preprocess(
|
|
|
594
617
|
z.object({ 'summary': ExpandedApplicationSummary, 'users': Evaluator.array() }),
|
|
595
618
|
)
|
|
596
619
|
|
|
620
|
+
export const AssignPool = z.preprocess(
|
|
621
|
+
processResponseBody,
|
|
622
|
+
z.object({ 'association': ListingPoolAssociation, 'listing': TypedUuidForListingId }),
|
|
623
|
+
)
|
|
624
|
+
|
|
597
625
|
export const AttachDocument = z.preprocess(
|
|
598
626
|
processResponseBody,
|
|
599
627
|
z.object({ 'externalId': z.string(), 'mime': z.string().optional() }),
|
|
@@ -673,6 +701,15 @@ export const CreateMapper = z.preprocess(
|
|
|
673
701
|
}),
|
|
674
702
|
)
|
|
675
703
|
|
|
704
|
+
export const CreatePool = z.preprocess(
|
|
705
|
+
processResponseBody,
|
|
706
|
+
z.object({
|
|
707
|
+
'description': z.string().optional(),
|
|
708
|
+
'name': z.string(),
|
|
709
|
+
'reviwers': TypedUuidForReviewerId.array().optional(),
|
|
710
|
+
}),
|
|
711
|
+
)
|
|
712
|
+
|
|
676
713
|
export const CreateReview = z.preprocess(
|
|
677
714
|
processResponseBody,
|
|
678
715
|
z.object({
|
|
@@ -694,6 +731,9 @@ export const CreateReviewAssignments = z.preprocess(
|
|
|
694
731
|
z.object({ 'reviewers': TypedUuidForReviewerId.array() }),
|
|
695
732
|
)
|
|
696
733
|
|
|
734
|
+
/**
|
|
735
|
+
* Failures that can occur when assigning a reviewer
|
|
736
|
+
*/
|
|
697
737
|
export const ReviewAssignmentCreationError = z.preprocess(
|
|
698
738
|
processResponseBody,
|
|
699
739
|
z.enum(['DoesNotExist', 'Forbidden', 'Internal']),
|
|
@@ -716,52 +756,14 @@ export const ReviewAssignment = z.preprocess(
|
|
|
716
756
|
}),
|
|
717
757
|
)
|
|
718
758
|
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
export const RenderedEmail = z.preprocess(
|
|
724
|
-
processResponseBody,
|
|
725
|
-
z.object({
|
|
726
|
-
'from': z.string(),
|
|
727
|
-
'html': z.string().optional(),
|
|
728
|
-
'name': z.string(),
|
|
729
|
-
'subject': z.string(),
|
|
730
|
-
'text': z.string(),
|
|
731
|
-
}),
|
|
732
|
-
)
|
|
733
|
-
|
|
734
|
-
export const RecipientId = z.preprocess(
|
|
735
|
-
processResponseBody,
|
|
736
|
-
z.union([
|
|
737
|
-
z.object({ 'Applicant': TypedUuidForApplicantId }),
|
|
738
|
-
z.object({ 'Custom': z.string() }),
|
|
739
|
-
z.object({ 'Reviewer': TypedUuidForReviewerId }),
|
|
740
|
-
]),
|
|
741
|
-
)
|
|
742
|
-
|
|
743
|
-
export const NotificationStatus = z.preprocess(processResponseBody, z.enum(['Failed', 'Pending', 'Scheduled', 'Sent']))
|
|
744
|
-
|
|
745
|
-
export const Notification_for_RenderedEmail = z.preprocess(
|
|
746
|
-
processResponseBody,
|
|
747
|
-
z.object({
|
|
748
|
-
'createdAt': z.coerce.date(),
|
|
749
|
-
'deletedAt': z.coerce.date().optional(),
|
|
750
|
-
'id': TypedUuidForNotificationId,
|
|
751
|
-
'kind': z.string(),
|
|
752
|
-
'medium': NotificationMedium,
|
|
753
|
-
'message': RenderedEmail.optional(),
|
|
754
|
-
'recipient': RecipientId,
|
|
755
|
-
'status': NotificationStatus,
|
|
756
|
-
'updatedAt': z.coerce.date(),
|
|
757
|
-
}),
|
|
758
|
-
)
|
|
759
|
-
|
|
760
|
-
export const CreatedAssignment = z.preprocess(
|
|
761
|
-
processResponseBody,
|
|
762
|
-
z.object({ 'assignment': ReviewAssignment, 'notification': Notification_for_RenderedEmail }),
|
|
763
|
-
)
|
|
759
|
+
/**
|
|
760
|
+
* Wrapper containing the assignment object
|
|
761
|
+
*/
|
|
762
|
+
export const CreatedAssignment = z.preprocess(processResponseBody, z.object({ 'assignment': ReviewAssignment }))
|
|
764
763
|
|
|
764
|
+
/**
|
|
765
|
+
* Aggregate collection of results indexed by the reviewer ids that were requested to be assigned to the applcation
|
|
766
|
+
*/
|
|
765
767
|
export const CreateReviewAssignmentsResponse = z.preprocess(
|
|
766
768
|
processResponseBody,
|
|
767
769
|
z.object({
|
|
@@ -899,6 +901,21 @@ export const Listing = z.preprocess(
|
|
|
899
901
|
}),
|
|
900
902
|
)
|
|
901
903
|
|
|
904
|
+
export const TypedUuidForListingPoolId = z.preprocess(processResponseBody, z.string().uuid())
|
|
905
|
+
|
|
906
|
+
export const ListingPool = z.preprocess(
|
|
907
|
+
processResponseBody,
|
|
908
|
+
z.object({
|
|
909
|
+
'association': ListingPoolAssociation,
|
|
910
|
+
'createdAt': z.coerce.date(),
|
|
911
|
+
'deletedAt': z.coerce.date().optional(),
|
|
912
|
+
'id': TypedUuidForListingPoolId,
|
|
913
|
+
'listingId': TypedUuidForListingId,
|
|
914
|
+
'poolId': TypedUuidForPoolId,
|
|
915
|
+
'updatedAt': z.coerce.date(),
|
|
916
|
+
}),
|
|
917
|
+
)
|
|
918
|
+
|
|
902
919
|
export const TypedUuidForMagicLinkRedirectUriId = z.preprocess(processResponseBody, z.string().uuid())
|
|
903
920
|
|
|
904
921
|
export const MagicLinkRedirectUri = z.preprocess(
|
|
@@ -980,11 +997,52 @@ export const Mapper = z.preprocess(
|
|
|
980
997
|
}),
|
|
981
998
|
)
|
|
982
999
|
|
|
1000
|
+
export const NotificationMedium = z.preprocess(processResponseBody, z.enum(['Email']))
|
|
1001
|
+
|
|
1002
|
+
export const NotificationStatus = z.preprocess(processResponseBody, z.enum(['Failed', 'Pending', 'Scheduled', 'Sent']))
|
|
1003
|
+
|
|
1004
|
+
export const TypedUuidForNotificationId = z.preprocess(processResponseBody, z.string().uuid())
|
|
1005
|
+
|
|
1006
|
+
export const RenderedEmail = z.preprocess(
|
|
1007
|
+
processResponseBody,
|
|
1008
|
+
z.object({
|
|
1009
|
+
'from': z.string(),
|
|
1010
|
+
'html': z.string().optional(),
|
|
1011
|
+
'name': z.string(),
|
|
1012
|
+
'subject': z.string(),
|
|
1013
|
+
'text': z.string(),
|
|
1014
|
+
}),
|
|
1015
|
+
)
|
|
1016
|
+
|
|
1017
|
+
export const RecipientId = z.preprocess(
|
|
1018
|
+
processResponseBody,
|
|
1019
|
+
z.union([
|
|
1020
|
+
z.object({ 'Applicant': TypedUuidForApplicantId }),
|
|
1021
|
+
z.object({ 'Custom': z.string() }),
|
|
1022
|
+
z.object({ 'Reviewer': TypedUuidForReviewerId }),
|
|
1023
|
+
]),
|
|
1024
|
+
)
|
|
1025
|
+
|
|
1026
|
+
export const Notification_for_RenderedEmail = z.preprocess(
|
|
1027
|
+
processResponseBody,
|
|
1028
|
+
z.object({
|
|
1029
|
+
'createdAt': z.coerce.date(),
|
|
1030
|
+
'deletedAt': z.coerce.date().optional(),
|
|
1031
|
+
'id': TypedUuidForNotificationId,
|
|
1032
|
+
'kind': z.string(),
|
|
1033
|
+
'medium': NotificationMedium,
|
|
1034
|
+
'message': RenderedEmail.optional(),
|
|
1035
|
+
'recipient': RecipientId,
|
|
1036
|
+
'status': NotificationStatus,
|
|
1037
|
+
'updatedAt': z.coerce.date(),
|
|
1038
|
+
}),
|
|
1039
|
+
)
|
|
1040
|
+
|
|
983
1041
|
export const OAuthAuthzCodeExchangeBody = z.preprocess(
|
|
984
1042
|
processResponseBody,
|
|
985
1043
|
z.object({
|
|
986
|
-
'clientId': TypedUuidForOAuthClientId,
|
|
987
|
-
'clientSecret': SecretString,
|
|
1044
|
+
'clientId': TypedUuidForOAuthClientId.optional(),
|
|
1045
|
+
'clientSecret': SecretString.optional(),
|
|
988
1046
|
'code': z.string(),
|
|
989
1047
|
'grantType': z.string(),
|
|
990
1048
|
'pkceVerifier': z.string().optional(),
|
|
@@ -1115,6 +1173,20 @@ export const Operation_for_TurnstilePermission_and_TransitionApplicationToDeferr
|
|
|
1115
1173
|
|
|
1116
1174
|
export const OptionalTransitionBody = z.preprocess(processResponseBody, z.object({ 'message': EmailConfig.optional() }))
|
|
1117
1175
|
|
|
1176
|
+
export const Pool = z.preprocess(
|
|
1177
|
+
processResponseBody,
|
|
1178
|
+
z.object({
|
|
1179
|
+
'createdAt': z.coerce.date(),
|
|
1180
|
+
'deletedAt': z.coerce.date().optional(),
|
|
1181
|
+
'description': z.string().optional(),
|
|
1182
|
+
'id': TypedUuidForPoolId,
|
|
1183
|
+
'listings': ListingPool.array(),
|
|
1184
|
+
'name': z.string(),
|
|
1185
|
+
'reviewers': TypedUuidForReviewerId.array(),
|
|
1186
|
+
'updatedAt': z.coerce.date(),
|
|
1187
|
+
}),
|
|
1188
|
+
)
|
|
1189
|
+
|
|
1118
1190
|
export const RegisterApplicant = z.preprocess(processResponseBody, z.object({ 'email': z.string() }))
|
|
1119
1191
|
|
|
1120
1192
|
export const Review = z.preprocess(
|
|
@@ -1425,6 +1497,16 @@ export const ViewApplicationParams = z.preprocess(
|
|
|
1425
1497
|
}),
|
|
1426
1498
|
)
|
|
1427
1499
|
|
|
1500
|
+
export const ApplyReviewActionParams = z.preprocess(
|
|
1501
|
+
processResponseBody,
|
|
1502
|
+
z.object({
|
|
1503
|
+
path: z.object({
|
|
1504
|
+
application: TypedUuidForApplicationId,
|
|
1505
|
+
}),
|
|
1506
|
+
query: z.object({}),
|
|
1507
|
+
}),
|
|
1508
|
+
)
|
|
1509
|
+
|
|
1428
1510
|
export const ListApplicationReviewAssignmentsParams = z.preprocess(
|
|
1429
1511
|
processResponseBody,
|
|
1430
1512
|
z.object({
|
|
@@ -1489,6 +1571,16 @@ export const GetApplicationInterviewCodeParams = z.preprocess(
|
|
|
1489
1571
|
}),
|
|
1490
1572
|
)
|
|
1491
1573
|
|
|
1574
|
+
export const SimulateReviewActionParams = z.preprocess(
|
|
1575
|
+
processResponseBody,
|
|
1576
|
+
z.object({
|
|
1577
|
+
path: z.object({
|
|
1578
|
+
application: TypedUuidForApplicationId,
|
|
1579
|
+
}),
|
|
1580
|
+
query: z.object({}),
|
|
1581
|
+
}),
|
|
1582
|
+
)
|
|
1583
|
+
|
|
1492
1584
|
export const SubmitApplicationParams = z.preprocess(
|
|
1493
1585
|
processResponseBody,
|
|
1494
1586
|
z.object({
|
|
@@ -1564,6 +1656,7 @@ export const ListApplicationSummariesParams = z.preprocess(
|
|
|
1564
1656
|
z.object({
|
|
1565
1657
|
path: z.object({}),
|
|
1566
1658
|
query: z.object({
|
|
1659
|
+
applicant: TypedUuidForApplicantId.optional(),
|
|
1567
1660
|
state: ScalarApplicationState.optional(),
|
|
1568
1661
|
}),
|
|
1569
1662
|
}),
|
|
@@ -2100,6 +2193,62 @@ export const DeleteOauthClientSecretParams = z.preprocess(
|
|
|
2100
2193
|
}),
|
|
2101
2194
|
)
|
|
2102
2195
|
|
|
2196
|
+
export const ListPoolsParams = z.preprocess(
|
|
2197
|
+
processResponseBody,
|
|
2198
|
+
z.object({
|
|
2199
|
+
path: z.object({}),
|
|
2200
|
+
query: z.object({}),
|
|
2201
|
+
}),
|
|
2202
|
+
)
|
|
2203
|
+
|
|
2204
|
+
export const CreatePoolParams = z.preprocess(
|
|
2205
|
+
processResponseBody,
|
|
2206
|
+
z.object({
|
|
2207
|
+
path: z.object({}),
|
|
2208
|
+
query: z.object({}),
|
|
2209
|
+
}),
|
|
2210
|
+
)
|
|
2211
|
+
|
|
2212
|
+
export const ViewPoolParams = z.preprocess(
|
|
2213
|
+
processResponseBody,
|
|
2214
|
+
z.object({
|
|
2215
|
+
path: z.object({
|
|
2216
|
+
pool: TypedUuidForPoolId,
|
|
2217
|
+
}),
|
|
2218
|
+
query: z.object({}),
|
|
2219
|
+
}),
|
|
2220
|
+
)
|
|
2221
|
+
|
|
2222
|
+
export const UpdatePoolParams = z.preprocess(
|
|
2223
|
+
processResponseBody,
|
|
2224
|
+
z.object({
|
|
2225
|
+
path: z.object({
|
|
2226
|
+
pool: TypedUuidForPoolId,
|
|
2227
|
+
}),
|
|
2228
|
+
query: z.object({}),
|
|
2229
|
+
}),
|
|
2230
|
+
)
|
|
2231
|
+
|
|
2232
|
+
export const AssignPoolParams = z.preprocess(
|
|
2233
|
+
processResponseBody,
|
|
2234
|
+
z.object({
|
|
2235
|
+
path: z.object({
|
|
2236
|
+
pool: TypedUuidForPoolId,
|
|
2237
|
+
}),
|
|
2238
|
+
query: z.object({}),
|
|
2239
|
+
}),
|
|
2240
|
+
)
|
|
2241
|
+
|
|
2242
|
+
export const UnassignPoolParams = z.preprocess(
|
|
2243
|
+
processResponseBody,
|
|
2244
|
+
z.object({
|
|
2245
|
+
path: z.object({
|
|
2246
|
+
assignment: TypedUuidForListingPoolId,
|
|
2247
|
+
}),
|
|
2248
|
+
query: z.object({}),
|
|
2249
|
+
}),
|
|
2250
|
+
)
|
|
2251
|
+
|
|
2103
2252
|
export const ListReviewsParams = z.preprocess(
|
|
2104
2253
|
processResponseBody,
|
|
2105
2254
|
z.object({
|