@forgerock/login-widget 1.0.0-beta.1 → 1.0.0-beta.10
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/CHANGELOG.md +149 -91
- package/{modal.js → index.cjs} +21660 -14177
- package/index.cjs.map +1 -0
- package/{modal.d.ts → index.d.ts} +789 -386
- package/{modal.cjs → index.js} +21651 -14185
- package/index.js.map +1 -0
- package/package.json +10 -12
- package/widget.css +4 -0
- package/inline.cjs +0 -27528
- package/inline.cjs.map +0 -1
- package/inline.d.ts +0 -2022
- package/inline.js +0 -27521
- package/inline.js.map +0 -1
- package/modal.cjs.map +0 -1
- package/modal.js.map +0 -1
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
interface StringDict<T> {
|
|
2
|
-
[name: string]: T;
|
|
3
|
-
}
|
|
4
|
-
interface Tokens {
|
|
5
|
-
accessToken: string;
|
|
6
|
-
idToken?: string;
|
|
7
|
-
refreshToken?: string;
|
|
8
|
-
tokenExpiry?: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
1
|
declare enum ActionTypes {
|
|
12
2
|
Authenticate = "AUTHENTICATE",
|
|
13
3
|
Authorize = "AUTHORIZE",
|
|
@@ -21,6 +11,16 @@ declare enum ActionTypes {
|
|
|
21
11
|
UserInfo = "USER_INFO"
|
|
22
12
|
}
|
|
23
13
|
|
|
14
|
+
interface StringDict<T> {
|
|
15
|
+
[name: string]: T;
|
|
16
|
+
}
|
|
17
|
+
interface Tokens {
|
|
18
|
+
accessToken: string;
|
|
19
|
+
idToken?: string;
|
|
20
|
+
refreshToken?: string;
|
|
21
|
+
tokenExpiry?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
24
|
/**
|
|
25
25
|
* Types of callbacks directly supported by the SDK.
|
|
26
26
|
*/
|
|
@@ -225,15 +225,175 @@ interface TokenStoreObject {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
/**
|
|
228
|
-
*
|
|
228
|
+
* An event-handling function.
|
|
229
229
|
*/
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
230
|
+
declare type Listener = (e: FREvent) => void;
|
|
231
|
+
interface FREvent {
|
|
232
|
+
type: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Event dispatcher for subscribing and publishing categorized events.
|
|
237
|
+
*/
|
|
238
|
+
declare class Dispatcher {
|
|
239
|
+
private callbacks;
|
|
240
|
+
/**
|
|
241
|
+
* Subscribes to an event type.
|
|
242
|
+
*
|
|
243
|
+
* @param type The event type
|
|
244
|
+
* @param listener The function to subscribe to events of this type
|
|
245
|
+
*/
|
|
246
|
+
addEventListener(type: string, listener: Listener): void;
|
|
247
|
+
/**
|
|
248
|
+
* Unsubscribes from an event type.
|
|
249
|
+
*
|
|
250
|
+
* @param type The event type
|
|
251
|
+
* @param listener The function to unsubscribe from events of this type
|
|
252
|
+
*/
|
|
253
|
+
removeEventListener(type: string, listener: Listener): void;
|
|
254
|
+
/**
|
|
255
|
+
* Unsubscribes all listener functions to a single event type or all event types.
|
|
256
|
+
*
|
|
257
|
+
* @param type The event type, or all event types if not specified
|
|
258
|
+
*/
|
|
259
|
+
clearEventListeners(type?: string): void;
|
|
260
|
+
/**
|
|
261
|
+
* Publishes an event.
|
|
262
|
+
*
|
|
263
|
+
* @param event The event object to publish
|
|
264
|
+
*/
|
|
265
|
+
dispatchEvent<T extends FREvent>(event: T): void;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Types of steps returned by the authentication tree.
|
|
270
|
+
*/
|
|
271
|
+
declare enum StepType {
|
|
272
|
+
LoginFailure = "LoginFailure",
|
|
273
|
+
LoginSuccess = "LoginSuccess",
|
|
274
|
+
Step = "Step"
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Base interface for all types of authentication step responses.
|
|
279
|
+
*/
|
|
280
|
+
interface AuthResponse {
|
|
281
|
+
type: StepType;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Represents details of a failure in an authentication step.
|
|
285
|
+
*/
|
|
286
|
+
interface FailureDetail {
|
|
287
|
+
failureUrl?: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Represents a single step of an authentication tree.
|
|
292
|
+
*/
|
|
293
|
+
declare class FRStep implements AuthResponse {
|
|
294
|
+
payload: Step;
|
|
295
|
+
/**
|
|
296
|
+
* The type of step.
|
|
297
|
+
*/
|
|
298
|
+
readonly type = StepType.Step;
|
|
299
|
+
/**
|
|
300
|
+
* The callbacks contained in this step.
|
|
301
|
+
*/
|
|
302
|
+
callbacks: FRCallback[];
|
|
303
|
+
/**
|
|
304
|
+
* @param payload The raw payload returned by OpenAM
|
|
305
|
+
* @param callbackFactory A function that returns am implementation of FRCallback
|
|
306
|
+
*/
|
|
307
|
+
constructor(payload: Step, callbackFactory?: FRCallbackFactory);
|
|
308
|
+
/**
|
|
309
|
+
* Gets the first callback of the specified type in this step.
|
|
310
|
+
*
|
|
311
|
+
* @param type The type of callback to find.
|
|
312
|
+
*/
|
|
313
|
+
getCallbackOfType<T extends FRCallback>(type: CallbackType): T;
|
|
314
|
+
/**
|
|
315
|
+
* Gets all callbacks of the specified type in this step.
|
|
316
|
+
*
|
|
317
|
+
* @param type The type of callback to find.
|
|
318
|
+
*/
|
|
319
|
+
getCallbacksOfType<T extends FRCallback>(type: CallbackType): T[];
|
|
320
|
+
/**
|
|
321
|
+
* Sets the value of the first callback of the specified type in this step.
|
|
322
|
+
*
|
|
323
|
+
* @param type The type of callback to find.
|
|
324
|
+
* @param value The value to set for the callback.
|
|
325
|
+
*/
|
|
326
|
+
setCallbackValue(type: CallbackType, value: unknown): void;
|
|
327
|
+
/**
|
|
328
|
+
* Gets the step's description.
|
|
329
|
+
*/
|
|
330
|
+
getDescription(): string | undefined;
|
|
331
|
+
/**
|
|
332
|
+
* Gets the step's header.
|
|
333
|
+
*/
|
|
334
|
+
getHeader(): string | undefined;
|
|
335
|
+
/**
|
|
336
|
+
* Gets the step's stage.
|
|
337
|
+
*/
|
|
338
|
+
getStage(): string | undefined;
|
|
339
|
+
private convertCallbacks;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
declare type HandleStep = (step: FRStep) => Promise<FRStep>;
|
|
343
|
+
/**
|
|
344
|
+
* Options to use when making an HTTP call.
|
|
345
|
+
*/
|
|
346
|
+
interface HttpClientRequestOptions {
|
|
347
|
+
bypassAuthentication?: boolean;
|
|
348
|
+
authorization?: {
|
|
349
|
+
config?: ConfigOptions;
|
|
350
|
+
handleStep: HandleStep;
|
|
351
|
+
idToken?: string;
|
|
352
|
+
txnID?: string;
|
|
353
|
+
};
|
|
354
|
+
init: RequestInit;
|
|
355
|
+
requiresNewToken?: RequiresNewTokenFn;
|
|
356
|
+
timeout: number;
|
|
357
|
+
url: string;
|
|
235
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* A function that determines whether a new token is required based on a HTTP response.
|
|
361
|
+
*/
|
|
362
|
+
declare type RequiresNewTokenFn = (res: Response) => boolean;
|
|
236
363
|
|
|
364
|
+
/**
|
|
365
|
+
* HTTP client that includes bearer token injection and refresh.
|
|
366
|
+
* This module also supports authorization for policy protected endpoints.
|
|
367
|
+
*
|
|
368
|
+
* Example:
|
|
369
|
+
*
|
|
370
|
+
* ```js
|
|
371
|
+
* return forgerock.HttpClient.request({
|
|
372
|
+
* url: `https://example.com/protected/resource`,
|
|
373
|
+
* init: {
|
|
374
|
+
* method: 'GET',
|
|
375
|
+
* credentials: 'include',
|
|
376
|
+
* },
|
|
377
|
+
* authorization: {
|
|
378
|
+
* handleStep: async (step) => {
|
|
379
|
+
* step.getCallbackOfType('PasswordCallback').setPassword(pw);
|
|
380
|
+
* return Promise.resolve(step);
|
|
381
|
+
* },
|
|
382
|
+
* },
|
|
383
|
+
* });
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
declare abstract class HttpClient extends Dispatcher {
|
|
387
|
+
/**
|
|
388
|
+
* Makes a request using the specified options.
|
|
389
|
+
*
|
|
390
|
+
* @param options The options to use when making the request
|
|
391
|
+
*/
|
|
392
|
+
static request(options: HttpClientRequestOptions): Promise<Response>;
|
|
393
|
+
private static setAuthHeaders;
|
|
394
|
+
private static stepIterator;
|
|
395
|
+
private static _request;
|
|
396
|
+
}
|
|
237
397
|
|
|
238
398
|
declare function noop(): void;
|
|
239
399
|
|
|
@@ -392,6 +552,37 @@ declare class SvelteComponentTyped<Props extends Record<string, any> = any, Even
|
|
|
392
552
|
constructor(options: ComponentConstructorOptions<Props>);
|
|
393
553
|
}
|
|
394
554
|
|
|
555
|
+
/** Callback to inform of a value updates. */
|
|
556
|
+
declare type Subscriber<T> = (value: T) => void;
|
|
557
|
+
/** Unsubscribes from value updates. */
|
|
558
|
+
declare type Unsubscriber = () => void;
|
|
559
|
+
/** Callback to update a value. */
|
|
560
|
+
declare type Updater<T> = (value: T) => T;
|
|
561
|
+
/** Cleanup logic callback. */
|
|
562
|
+
declare type Invalidator<T> = (value?: T) => void;
|
|
563
|
+
/** Readable interface for subscribing. */
|
|
564
|
+
interface Readable<T> {
|
|
565
|
+
/**
|
|
566
|
+
* Subscribe on value changes.
|
|
567
|
+
* @param run subscription callback
|
|
568
|
+
* @param invalidate cleanup callback
|
|
569
|
+
*/
|
|
570
|
+
subscribe(this: void, run: Subscriber<T>, invalidate?: Invalidator<T>): Unsubscriber;
|
|
571
|
+
}
|
|
572
|
+
/** Writable interface for both updating and subscribing. */
|
|
573
|
+
interface Writable<T> extends Readable<T> {
|
|
574
|
+
/**
|
|
575
|
+
* Set value and inform subscribers.
|
|
576
|
+
* @param value to set
|
|
577
|
+
*/
|
|
578
|
+
set(this: void, value: T): void;
|
|
579
|
+
/**
|
|
580
|
+
* Update value using callback and inform subscribers.
|
|
581
|
+
* @param updater callback
|
|
582
|
+
*/
|
|
583
|
+
update(this: void, updater: Updater<T>): void;
|
|
584
|
+
}
|
|
585
|
+
|
|
395
586
|
interface MessageCreator {
|
|
396
587
|
[key: string]: (propertyName: string, params?: {
|
|
397
588
|
[key: string]: unknown;
|
|
@@ -402,28 +593,6 @@ interface ProcessedPropertyError {
|
|
|
402
593
|
messages: string[];
|
|
403
594
|
}
|
|
404
595
|
|
|
405
|
-
/**
|
|
406
|
-
* Types of steps returned by the authentication tree.
|
|
407
|
-
*/
|
|
408
|
-
declare enum StepType {
|
|
409
|
-
LoginFailure = "LoginFailure",
|
|
410
|
-
LoginSuccess = "LoginSuccess",
|
|
411
|
-
Step = "Step"
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Base interface for all types of authentication step responses.
|
|
416
|
-
*/
|
|
417
|
-
interface AuthResponse {
|
|
418
|
-
type: StepType;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Represents details of a failure in an authentication step.
|
|
422
|
-
*/
|
|
423
|
-
interface FailureDetail {
|
|
424
|
-
failureUrl?: string;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
596
|
declare class FRLoginFailure implements AuthResponse {
|
|
428
597
|
payload: Step;
|
|
429
598
|
/**
|
|
@@ -481,78 +650,14 @@ declare class FRLoginSuccess implements AuthResponse {
|
|
|
481
650
|
}
|
|
482
651
|
|
|
483
652
|
/**
|
|
484
|
-
*
|
|
485
|
-
*/
|
|
486
|
-
declare class FRStep implements AuthResponse {
|
|
487
|
-
payload: Step;
|
|
488
|
-
/**
|
|
489
|
-
* The type of step.
|
|
490
|
-
*/
|
|
491
|
-
readonly type = StepType.Step;
|
|
492
|
-
/**
|
|
493
|
-
* The callbacks contained in this step.
|
|
494
|
-
*/
|
|
495
|
-
callbacks: FRCallback[];
|
|
496
|
-
/**
|
|
497
|
-
* @param payload The raw payload returned by OpenAM
|
|
498
|
-
* @param callbackFactory A function that returns am implementation of FRCallback
|
|
499
|
-
*/
|
|
500
|
-
constructor(payload: Step, callbackFactory?: FRCallbackFactory);
|
|
501
|
-
/**
|
|
502
|
-
* Gets the first callback of the specified type in this step.
|
|
503
|
-
*
|
|
504
|
-
* @param type The type of callback to find.
|
|
505
|
-
*/
|
|
506
|
-
getCallbackOfType<T extends FRCallback>(type: CallbackType): T;
|
|
507
|
-
/**
|
|
508
|
-
* Gets all callbacks of the specified type in this step.
|
|
509
|
-
*
|
|
510
|
-
* @param type The type of callback to find.
|
|
511
|
-
*/
|
|
512
|
-
getCallbacksOfType<T extends FRCallback>(type: CallbackType): T[];
|
|
513
|
-
/**
|
|
514
|
-
* Sets the value of the first callback of the specified type in this step.
|
|
515
|
-
*
|
|
516
|
-
* @param type The type of callback to find.
|
|
517
|
-
* @param value The value to set for the callback.
|
|
518
|
-
*/
|
|
519
|
-
setCallbackValue(type: CallbackType, value: unknown): void;
|
|
520
|
-
/**
|
|
521
|
-
* Gets the step's description.
|
|
522
|
-
*/
|
|
523
|
-
getDescription(): string | undefined;
|
|
524
|
-
/**
|
|
525
|
-
* Gets the step's header.
|
|
526
|
-
*/
|
|
527
|
-
getHeader(): string | undefined;
|
|
528
|
-
/**
|
|
529
|
-
* Gets the step's stage.
|
|
530
|
-
*/
|
|
531
|
-
getStage(): string | undefined;
|
|
532
|
-
private convertCallbacks;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
declare type HandleStep = (step: FRStep) => Promise<FRStep>;
|
|
536
|
-
/**
|
|
537
|
-
* Options to use when making an HTTP call.
|
|
653
|
+
* Tokens returned after successful authentication.
|
|
538
654
|
*/
|
|
539
|
-
interface
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
idToken?: string;
|
|
545
|
-
txnID?: string;
|
|
546
|
-
};
|
|
547
|
-
init: RequestInit;
|
|
548
|
-
requiresNewToken?: RequiresNewTokenFn;
|
|
549
|
-
timeout: number;
|
|
550
|
-
url: string;
|
|
655
|
+
interface OAuth2Tokens {
|
|
656
|
+
accessToken: string;
|
|
657
|
+
idToken?: string;
|
|
658
|
+
refreshToken?: string;
|
|
659
|
+
tokenExpiry?: number;
|
|
551
660
|
}
|
|
552
|
-
/**
|
|
553
|
-
* A function that determines whether a new token is required based on a HTTP response.
|
|
554
|
-
*/
|
|
555
|
-
declare type RequiresNewTokenFn = (res: Response) => boolean;
|
|
556
661
|
|
|
557
662
|
interface GetTokensOptions extends ConfigOptions {
|
|
558
663
|
forceRenew?: boolean;
|
|
@@ -562,6 +667,38 @@ interface GetTokensOptions extends ConfigOptions {
|
|
|
562
667
|
|
|
563
668
|
type Maybe<T> = T | null | undefined;
|
|
564
669
|
|
|
670
|
+
interface UserStore extends Pick<Writable<UserStoreValue>, 'subscribe'> {
|
|
671
|
+
get: (getOptions?: ConfigOptions) => void;
|
|
672
|
+
reset: () => void;
|
|
673
|
+
}
|
|
674
|
+
interface UserStoreValue {
|
|
675
|
+
completed: boolean;
|
|
676
|
+
error: Maybe<{
|
|
677
|
+
code?: Maybe<number>;
|
|
678
|
+
message: Maybe<string>;
|
|
679
|
+
troubleshoot: Maybe<string>;
|
|
680
|
+
}>;
|
|
681
|
+
loading: boolean;
|
|
682
|
+
successful: boolean;
|
|
683
|
+
response: unknown;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
interface OAuthStore extends Pick<Writable<OAuthTokenStoreValue>, 'subscribe'> {
|
|
687
|
+
get: (getOptions?: GetTokensOptions) => void;
|
|
688
|
+
reset: () => void;
|
|
689
|
+
}
|
|
690
|
+
interface OAuthTokenStoreValue {
|
|
691
|
+
completed: boolean;
|
|
692
|
+
error: Maybe<{
|
|
693
|
+
code?: Maybe<number>;
|
|
694
|
+
message: Maybe<string>;
|
|
695
|
+
troubleshoot: Maybe<string>;
|
|
696
|
+
}>;
|
|
697
|
+
loading: boolean;
|
|
698
|
+
successful: boolean;
|
|
699
|
+
response: Maybe<OAuth2Tokens> | void;
|
|
700
|
+
}
|
|
701
|
+
|
|
565
702
|
interface CallbackMetadata {
|
|
566
703
|
derived: {
|
|
567
704
|
canForceUserInputOptionality: boolean;
|
|
@@ -573,12 +710,21 @@ interface CallbackMetadata {
|
|
|
573
710
|
idx: number;
|
|
574
711
|
platform?: Record<string, unknown>;
|
|
575
712
|
}
|
|
713
|
+
interface JourneyStore extends Pick<Writable<JourneyStoreValue>, 'subscribe'> {
|
|
714
|
+
next: (prevStep?: StepTypes, nextOptions?: StepOptions) => void;
|
|
715
|
+
pop: () => void;
|
|
716
|
+
push: (changeOptions: StepOptions) => void;
|
|
717
|
+
reset: () => void;
|
|
718
|
+
resume: (url: string, resumeOptions?: StepOptions) => void;
|
|
719
|
+
start: (startOptions?: StepOptions) => void;
|
|
720
|
+
}
|
|
576
721
|
interface JourneyStoreValue {
|
|
577
722
|
completed: boolean;
|
|
578
723
|
error: Maybe<{
|
|
579
724
|
code: Maybe<number>;
|
|
580
725
|
message: Maybe<string>;
|
|
581
726
|
step: Maybe<Step>;
|
|
727
|
+
troubleshoot: Maybe<string>;
|
|
582
728
|
}>;
|
|
583
729
|
loading: boolean;
|
|
584
730
|
metadata: {
|
|
@@ -601,45 +747,11 @@ interface StepMetadata {
|
|
|
601
747
|
}
|
|
602
748
|
type StepTypes = FRStep | FRLoginSuccess | FRLoginFailure | null;
|
|
603
749
|
|
|
604
|
-
|
|
605
|
-
completed: boolean;
|
|
606
|
-
error: Maybe<{
|
|
607
|
-
code?: Maybe<number>;
|
|
608
|
-
message: Maybe<string>;
|
|
609
|
-
}>;
|
|
610
|
-
loading: boolean;
|
|
611
|
-
successful: boolean;
|
|
612
|
-
response: Maybe<OAuth2Tokens> | void;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
interface UserStoreValue {
|
|
616
|
-
completed: boolean;
|
|
617
|
-
error: Maybe<{
|
|
618
|
-
code?: Maybe<number>;
|
|
619
|
-
message: Maybe<string>;
|
|
620
|
-
}>;
|
|
621
|
-
loading: boolean;
|
|
622
|
-
successful: boolean;
|
|
623
|
-
response: unknown;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
interface Response$1 {
|
|
627
|
-
journey?: JourneyStoreValue;
|
|
628
|
-
oauth?: OAuthTokenStoreValue;
|
|
629
|
-
user?: UserStoreValue;
|
|
630
|
-
}
|
|
631
|
-
interface JourneyOptions {
|
|
632
|
-
config?: StepOptions;
|
|
633
|
-
journey?: string;
|
|
634
|
-
oauth?: boolean;
|
|
635
|
-
resumeUrl?: string;
|
|
636
|
-
user?: boolean;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
declare type Primitive = string | number | bigint | boolean | null | undefined;
|
|
750
|
+
declare type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
640
751
|
|
|
641
752
|
declare namespace util {
|
|
642
753
|
type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
|
754
|
+
export type isAny<T> = 0 extends 1 & T ? true : false;
|
|
643
755
|
export const assertEqual: <A, B>(val: AssertEqual<A, B>) => AssertEqual<A, B>;
|
|
644
756
|
export function assertIs<T>(_arg: T): void;
|
|
645
757
|
export function assertNever(_x: never): never;
|
|
@@ -651,16 +763,36 @@ declare namespace util {
|
|
|
651
763
|
export const objectValues: (obj: any) => any[];
|
|
652
764
|
export const objectKeys: ObjectConstructor["keys"];
|
|
653
765
|
export const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
|
|
654
|
-
export type identity<T> = T
|
|
655
|
-
export type flatten<T> =
|
|
656
|
-
[k in keyof T]: T[k];
|
|
657
|
-
}>;
|
|
766
|
+
export type identity<T> = objectUtil.identity<T>;
|
|
767
|
+
export type flatten<T> = objectUtil.flatten<T>;
|
|
658
768
|
export type noUndefined<T> = T extends undefined ? never : T;
|
|
659
769
|
export const isInteger: NumberConstructor["isInteger"];
|
|
660
770
|
export function joinValues<T extends any[]>(array: T, separator?: string): string;
|
|
661
771
|
export const jsonStringifyReplacer: (_: string, value: any) => any;
|
|
662
772
|
export {};
|
|
663
773
|
}
|
|
774
|
+
declare namespace objectUtil {
|
|
775
|
+
export type MergeShapes<U, V> = {
|
|
776
|
+
[k in Exclude<keyof U, keyof V>]: U[k];
|
|
777
|
+
} & V;
|
|
778
|
+
type requiredKeys<T extends object> = {
|
|
779
|
+
[k in keyof T]: undefined extends T[k] ? never : k;
|
|
780
|
+
}[keyof T];
|
|
781
|
+
export type addQuestionMarks<T extends object, R extends keyof T = requiredKeys<T>> = Pick<Required<T>, R> & Partial<T>;
|
|
782
|
+
export type identity<T> = T;
|
|
783
|
+
export type flatten<T> = identity<{
|
|
784
|
+
[k in keyof T]: T[k];
|
|
785
|
+
}>;
|
|
786
|
+
export type noNeverKeys<T> = {
|
|
787
|
+
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
|
788
|
+
}[keyof T];
|
|
789
|
+
export type noNever<T> = identity<{
|
|
790
|
+
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
|
791
|
+
}>;
|
|
792
|
+
export const mergeShapes: <U, T>(first: U, second: T) => T & U;
|
|
793
|
+
export type extendShape<A, B> = flatten<Omit<A, keyof B> & B>;
|
|
794
|
+
export {};
|
|
795
|
+
}
|
|
664
796
|
declare const ZodParsedType: {
|
|
665
797
|
function: "function";
|
|
666
798
|
number: "number";
|
|
@@ -708,6 +840,7 @@ declare const ZodIssueCode: {
|
|
|
708
840
|
too_big: "too_big";
|
|
709
841
|
invalid_intersection_types: "invalid_intersection_types";
|
|
710
842
|
not_multiple_of: "not_multiple_of";
|
|
843
|
+
not_finite: "not_finite";
|
|
711
844
|
};
|
|
712
845
|
declare type ZodIssueCode = keyof typeof ZodIssueCode;
|
|
713
846
|
declare type ZodIssueBase = {
|
|
@@ -722,6 +855,7 @@ interface ZodInvalidTypeIssue extends ZodIssueBase {
|
|
|
722
855
|
interface ZodInvalidLiteralIssue extends ZodIssueBase {
|
|
723
856
|
code: typeof ZodIssueCode.invalid_literal;
|
|
724
857
|
expected: unknown;
|
|
858
|
+
received: unknown;
|
|
725
859
|
}
|
|
726
860
|
interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
|
|
727
861
|
code: typeof ZodIssueCode.unrecognized_keys;
|
|
@@ -751,7 +885,10 @@ interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
|
|
|
751
885
|
interface ZodInvalidDateIssue extends ZodIssueBase {
|
|
752
886
|
code: typeof ZodIssueCode.invalid_date;
|
|
753
887
|
}
|
|
754
|
-
declare type StringValidation = "email" | "url" | "uuid" | "regex" | "cuid" | {
|
|
888
|
+
declare type StringValidation = "email" | "url" | "emoji" | "uuid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "ip" | {
|
|
889
|
+
includes: string;
|
|
890
|
+
position?: number;
|
|
891
|
+
} | {
|
|
755
892
|
startsWith: string;
|
|
756
893
|
} | {
|
|
757
894
|
endsWith: string;
|
|
@@ -762,22 +899,27 @@ interface ZodInvalidStringIssue extends ZodIssueBase {
|
|
|
762
899
|
}
|
|
763
900
|
interface ZodTooSmallIssue extends ZodIssueBase {
|
|
764
901
|
code: typeof ZodIssueCode.too_small;
|
|
765
|
-
minimum: number;
|
|
902
|
+
minimum: number | bigint;
|
|
766
903
|
inclusive: boolean;
|
|
767
|
-
|
|
904
|
+
exact?: boolean;
|
|
905
|
+
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
|
768
906
|
}
|
|
769
907
|
interface ZodTooBigIssue extends ZodIssueBase {
|
|
770
908
|
code: typeof ZodIssueCode.too_big;
|
|
771
|
-
maximum: number;
|
|
909
|
+
maximum: number | bigint;
|
|
772
910
|
inclusive: boolean;
|
|
773
|
-
|
|
911
|
+
exact?: boolean;
|
|
912
|
+
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
|
774
913
|
}
|
|
775
914
|
interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
|
|
776
915
|
code: typeof ZodIssueCode.invalid_intersection_types;
|
|
777
916
|
}
|
|
778
917
|
interface ZodNotMultipleOfIssue extends ZodIssueBase {
|
|
779
918
|
code: typeof ZodIssueCode.not_multiple_of;
|
|
780
|
-
multipleOf: number;
|
|
919
|
+
multipleOf: number | bigint;
|
|
920
|
+
}
|
|
921
|
+
interface ZodNotFiniteIssue extends ZodIssueBase {
|
|
922
|
+
code: typeof ZodIssueCode.not_finite;
|
|
781
923
|
}
|
|
782
924
|
interface ZodCustomIssue extends ZodIssueBase {
|
|
783
925
|
code: typeof ZodIssueCode.custom;
|
|
@@ -785,19 +927,21 @@ interface ZodCustomIssue extends ZodIssueBase {
|
|
|
785
927
|
[k: string]: any;
|
|
786
928
|
};
|
|
787
929
|
}
|
|
788
|
-
declare type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodCustomIssue;
|
|
930
|
+
declare type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
|
|
789
931
|
declare type ZodIssue = ZodIssueOptionalMessage & {
|
|
932
|
+
fatal?: boolean;
|
|
790
933
|
message: string;
|
|
791
934
|
};
|
|
792
|
-
declare type
|
|
793
|
-
_errors: U[];
|
|
794
|
-
} & (T extends [any, ...any[]] ? {
|
|
935
|
+
declare type recursiveZodFormattedError<T> = T extends [any, ...any[]] ? {
|
|
795
936
|
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
796
937
|
} : T extends any[] ? {
|
|
797
938
|
[k: number]: ZodFormattedError<T[number]>;
|
|
798
939
|
} : T extends object ? {
|
|
799
940
|
[K in keyof T]?: ZodFormattedError<T[K]>;
|
|
800
|
-
} : unknown
|
|
941
|
+
} : unknown;
|
|
942
|
+
declare type ZodFormattedError<T, U = string> = {
|
|
943
|
+
_errors: U[];
|
|
944
|
+
} & recursiveZodFormattedError<NonNullable<T>>;
|
|
801
945
|
declare class ZodError<T = any> extends Error {
|
|
802
946
|
issues: ZodIssue[];
|
|
803
947
|
get errors(): ZodIssue[];
|
|
@@ -897,20 +1041,16 @@ declare namespace errorUtil {
|
|
|
897
1041
|
type ErrMessage = string | {
|
|
898
1042
|
message?: string;
|
|
899
1043
|
};
|
|
900
|
-
const errToObj: (message?:
|
|
901
|
-
message?: string | undefined;
|
|
902
|
-
} | undefined) => {
|
|
1044
|
+
const errToObj: (message?: ErrMessage | undefined) => {
|
|
903
1045
|
message?: string | undefined;
|
|
904
1046
|
};
|
|
905
|
-
const toString: (message?: string |
|
|
906
|
-
message?: string | undefined;
|
|
907
|
-
} | undefined) => string | undefined;
|
|
1047
|
+
const toString: (message?: ErrMessage | undefined) => string | undefined;
|
|
908
1048
|
}
|
|
909
1049
|
|
|
910
1050
|
declare namespace partialUtil {
|
|
911
|
-
type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<
|
|
912
|
-
[k in keyof
|
|
913
|
-
},
|
|
1051
|
+
type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<ZodRawShape> ? ZodObject<{
|
|
1052
|
+
[k in keyof T["shape"]]: ZodOptional<DeepPartial<T["shape"][k]>>;
|
|
1053
|
+
}, T["_def"]["unknownKeys"], T["_def"]["catchall"]> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? {
|
|
914
1054
|
[k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
|
|
915
1055
|
} extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
|
|
916
1056
|
}
|
|
@@ -924,6 +1064,9 @@ declare type ZodRawShape = {
|
|
|
924
1064
|
};
|
|
925
1065
|
declare type ZodTypeAny = ZodType<any, any, any>;
|
|
926
1066
|
declare type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
|
|
1067
|
+
declare type input<T extends ZodType<any, any, any>> = T["_input"];
|
|
1068
|
+
declare type output<T extends ZodType<any, any, any>> = T["_output"];
|
|
1069
|
+
|
|
927
1070
|
declare type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
|
|
928
1071
|
interface ZodTypeDef {
|
|
929
1072
|
errorMap?: ZodErrorMap;
|
|
@@ -963,18 +1106,18 @@ declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef
|
|
|
963
1106
|
safeParse(data: unknown, params?: Partial<ParseParams>): SafeParseReturnType<Input, Output>;
|
|
964
1107
|
parseAsync(data: unknown, params?: Partial<ParseParams>): Promise<Output>;
|
|
965
1108
|
safeParseAsync(data: unknown, params?: Partial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
|
|
966
|
-
/** Alias of safeParseAsync */
|
|
967
1109
|
spa: (data: unknown, params?: Partial<ParseParams> | undefined) => Promise<SafeParseReturnType<Input, Output>>;
|
|
968
1110
|
refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>;
|
|
969
1111
|
refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
|
|
970
1112
|
refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, Input>;
|
|
971
1113
|
refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, Output, Input>;
|
|
972
1114
|
_refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
|
|
973
|
-
superRefine
|
|
1115
|
+
superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects<this, RefinedOutput, Input>;
|
|
1116
|
+
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects<this, Output, Input>;
|
|
974
1117
|
constructor(def: Def);
|
|
975
1118
|
optional(): ZodOptional<this>;
|
|
976
1119
|
nullable(): ZodNullable<this>;
|
|
977
|
-
nullish(): ZodNullable<
|
|
1120
|
+
nullish(): ZodOptional<ZodNullable<this>>;
|
|
978
1121
|
array(): ZodArray<this>;
|
|
979
1122
|
promise(): ZodPromise<this>;
|
|
980
1123
|
or<T extends ZodTypeAny>(option: T): ZodUnion<[this, T]>;
|
|
@@ -982,11 +1125,18 @@ declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef
|
|
|
982
1125
|
transform<NewOut>(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>;
|
|
983
1126
|
default(def: util.noUndefined<Input>): ZodDefault<this>;
|
|
984
1127
|
default(def: () => util.noUndefined<Input>): ZodDefault<this>;
|
|
985
|
-
brand<B extends string | number | symbol>(): ZodBranded<this, B>;
|
|
1128
|
+
brand<B extends string | number | symbol>(brand?: B): ZodBranded<this, B>;
|
|
1129
|
+
catch(def: Output): ZodCatch<this>;
|
|
1130
|
+
catch(def: (ctx: {
|
|
1131
|
+
error: ZodError;
|
|
1132
|
+
input: Input;
|
|
1133
|
+
}) => Output): ZodCatch<this>;
|
|
986
1134
|
describe(description: string): this;
|
|
1135
|
+
pipe<T extends ZodTypeAny>(target: T): ZodPipeline<this, T>;
|
|
987
1136
|
isOptional(): boolean;
|
|
988
1137
|
isNullable(): boolean;
|
|
989
1138
|
}
|
|
1139
|
+
declare type IpVersion = "v4" | "v6";
|
|
990
1140
|
declare type ZodStringCheck = {
|
|
991
1141
|
kind: "min";
|
|
992
1142
|
value: number;
|
|
@@ -995,18 +1145,36 @@ declare type ZodStringCheck = {
|
|
|
995
1145
|
kind: "max";
|
|
996
1146
|
value: number;
|
|
997
1147
|
message?: string;
|
|
1148
|
+
} | {
|
|
1149
|
+
kind: "length";
|
|
1150
|
+
value: number;
|
|
1151
|
+
message?: string;
|
|
998
1152
|
} | {
|
|
999
1153
|
kind: "email";
|
|
1000
1154
|
message?: string;
|
|
1001
1155
|
} | {
|
|
1002
1156
|
kind: "url";
|
|
1003
1157
|
message?: string;
|
|
1158
|
+
} | {
|
|
1159
|
+
kind: "emoji";
|
|
1160
|
+
message?: string;
|
|
1004
1161
|
} | {
|
|
1005
1162
|
kind: "uuid";
|
|
1006
1163
|
message?: string;
|
|
1007
1164
|
} | {
|
|
1008
1165
|
kind: "cuid";
|
|
1009
1166
|
message?: string;
|
|
1167
|
+
} | {
|
|
1168
|
+
kind: "includes";
|
|
1169
|
+
value: string;
|
|
1170
|
+
position?: number;
|
|
1171
|
+
message?: string;
|
|
1172
|
+
} | {
|
|
1173
|
+
kind: "cuid2";
|
|
1174
|
+
message?: string;
|
|
1175
|
+
} | {
|
|
1176
|
+
kind: "ulid";
|
|
1177
|
+
message?: string;
|
|
1010
1178
|
} | {
|
|
1011
1179
|
kind: "startsWith";
|
|
1012
1180
|
value: string;
|
|
@@ -1022,42 +1190,80 @@ declare type ZodStringCheck = {
|
|
|
1022
1190
|
} | {
|
|
1023
1191
|
kind: "trim";
|
|
1024
1192
|
message?: string;
|
|
1193
|
+
} | {
|
|
1194
|
+
kind: "toLowerCase";
|
|
1195
|
+
message?: string;
|
|
1196
|
+
} | {
|
|
1197
|
+
kind: "toUpperCase";
|
|
1198
|
+
message?: string;
|
|
1199
|
+
} | {
|
|
1200
|
+
kind: "datetime";
|
|
1201
|
+
offset: boolean;
|
|
1202
|
+
precision: number | null;
|
|
1203
|
+
message?: string;
|
|
1204
|
+
} | {
|
|
1205
|
+
kind: "ip";
|
|
1206
|
+
version?: IpVersion;
|
|
1207
|
+
message?: string;
|
|
1025
1208
|
};
|
|
1026
1209
|
interface ZodStringDef extends ZodTypeDef {
|
|
1027
1210
|
checks: ZodStringCheck[];
|
|
1028
1211
|
typeName: ZodFirstPartyTypeKind.ZodString;
|
|
1212
|
+
coerce: boolean;
|
|
1029
1213
|
}
|
|
1030
1214
|
declare class ZodString extends ZodType<string, ZodStringDef> {
|
|
1031
1215
|
_parse(input: ParseInput): ParseReturnType<string>;
|
|
1032
|
-
protected _regex: (regex: RegExp, validation: StringValidation, message?:
|
|
1033
|
-
message?: string | undefined;
|
|
1034
|
-
} | undefined) => ZodEffects<this, string, string>;
|
|
1216
|
+
protected _regex: (regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage | undefined) => ZodEffects<this, string, string>;
|
|
1035
1217
|
_addCheck(check: ZodStringCheck): ZodString;
|
|
1036
1218
|
email(message?: errorUtil.ErrMessage): ZodString;
|
|
1037
1219
|
url(message?: errorUtil.ErrMessage): ZodString;
|
|
1220
|
+
emoji(message?: errorUtil.ErrMessage): ZodString;
|
|
1038
1221
|
uuid(message?: errorUtil.ErrMessage): ZodString;
|
|
1039
1222
|
cuid(message?: errorUtil.ErrMessage): ZodString;
|
|
1223
|
+
cuid2(message?: errorUtil.ErrMessage): ZodString;
|
|
1224
|
+
ulid(message?: errorUtil.ErrMessage): ZodString;
|
|
1225
|
+
ip(options?: string | {
|
|
1226
|
+
version?: "v4" | "v6";
|
|
1227
|
+
message?: string;
|
|
1228
|
+
}): ZodString;
|
|
1229
|
+
datetime(options?: string | {
|
|
1230
|
+
message?: string | undefined;
|
|
1231
|
+
precision?: number | null;
|
|
1232
|
+
offset?: boolean;
|
|
1233
|
+
}): ZodString;
|
|
1040
1234
|
regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString;
|
|
1235
|
+
includes(value: string, options?: {
|
|
1236
|
+
message?: string;
|
|
1237
|
+
position?: number;
|
|
1238
|
+
}): ZodString;
|
|
1041
1239
|
startsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
1042
1240
|
endsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
1043
1241
|
min(minLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
1044
1242
|
max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
1045
1243
|
length(len: number, message?: errorUtil.ErrMessage): ZodString;
|
|
1046
|
-
|
|
1047
|
-
* @deprecated Use z.string().min(1) instead.
|
|
1048
|
-
* @see {@link ZodString.min}
|
|
1049
|
-
*/
|
|
1050
|
-
nonempty: (message?: string | {
|
|
1051
|
-
message?: string | undefined;
|
|
1052
|
-
} | undefined) => ZodString;
|
|
1244
|
+
nonempty: (message?: errorUtil.ErrMessage | undefined) => ZodString;
|
|
1053
1245
|
trim: () => ZodString;
|
|
1246
|
+
toLowerCase: () => ZodString;
|
|
1247
|
+
toUpperCase: () => ZodString;
|
|
1248
|
+
get isDatetime(): boolean;
|
|
1054
1249
|
get isEmail(): boolean;
|
|
1055
1250
|
get isURL(): boolean;
|
|
1251
|
+
get isEmoji(): boolean;
|
|
1056
1252
|
get isUUID(): boolean;
|
|
1057
1253
|
get isCUID(): boolean;
|
|
1254
|
+
get isCUID2(): boolean;
|
|
1255
|
+
get isULID(): boolean;
|
|
1256
|
+
get isIP(): boolean;
|
|
1058
1257
|
get minLength(): number | null;
|
|
1059
1258
|
get maxLength(): number | null;
|
|
1060
|
-
static create: (params?:
|
|
1259
|
+
static create: (params?: ({
|
|
1260
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1261
|
+
invalid_type_error?: string | undefined;
|
|
1262
|
+
required_error?: string | undefined;
|
|
1263
|
+
description?: string | undefined;
|
|
1264
|
+
} & {
|
|
1265
|
+
coerce?: true | undefined;
|
|
1266
|
+
}) | undefined) => ZodString;
|
|
1061
1267
|
}
|
|
1062
1268
|
declare type ZodNumberCheck = {
|
|
1063
1269
|
kind: "min";
|
|
@@ -1076,23 +1282,30 @@ declare type ZodNumberCheck = {
|
|
|
1076
1282
|
kind: "multipleOf";
|
|
1077
1283
|
value: number;
|
|
1078
1284
|
message?: string;
|
|
1285
|
+
} | {
|
|
1286
|
+
kind: "finite";
|
|
1287
|
+
message?: string;
|
|
1079
1288
|
};
|
|
1080
1289
|
interface ZodNumberDef extends ZodTypeDef {
|
|
1081
1290
|
checks: ZodNumberCheck[];
|
|
1082
1291
|
typeName: ZodFirstPartyTypeKind.ZodNumber;
|
|
1292
|
+
coerce: boolean;
|
|
1083
1293
|
}
|
|
1084
1294
|
declare class ZodNumber extends ZodType<number, ZodNumberDef> {
|
|
1085
1295
|
_parse(input: ParseInput): ParseReturnType<number>;
|
|
1086
|
-
static create: (params?:
|
|
1296
|
+
static create: (params?: ({
|
|
1297
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1298
|
+
invalid_type_error?: string | undefined;
|
|
1299
|
+
required_error?: string | undefined;
|
|
1300
|
+
description?: string | undefined;
|
|
1301
|
+
} & {
|
|
1302
|
+
coerce?: boolean | undefined;
|
|
1303
|
+
}) | undefined) => ZodNumber;
|
|
1087
1304
|
gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1088
|
-
min: (value: number, message?:
|
|
1089
|
-
message?: string | undefined;
|
|
1090
|
-
} | undefined) => ZodNumber;
|
|
1305
|
+
min: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
1091
1306
|
gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1092
1307
|
lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1093
|
-
max: (value: number, message?:
|
|
1094
|
-
message?: string | undefined;
|
|
1095
|
-
} | undefined) => ZodNumber;
|
|
1308
|
+
max: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
1096
1309
|
lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1097
1310
|
protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
|
|
1098
1311
|
_addCheck(check: ZodNumberCheck): ZodNumber;
|
|
@@ -1102,12 +1315,28 @@ declare class ZodNumber extends ZodType<number, ZodNumberDef> {
|
|
|
1102
1315
|
nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1103
1316
|
nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1104
1317
|
multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1105
|
-
step: (value: number, message?:
|
|
1106
|
-
|
|
1107
|
-
|
|
1318
|
+
step: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
1319
|
+
finite(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1320
|
+
safe(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1108
1321
|
get minValue(): number | null;
|
|
1109
1322
|
get maxValue(): number | null;
|
|
1110
1323
|
get isInt(): boolean;
|
|
1324
|
+
get isFinite(): boolean;
|
|
1325
|
+
}
|
|
1326
|
+
interface ZodBooleanDef extends ZodTypeDef {
|
|
1327
|
+
typeName: ZodFirstPartyTypeKind.ZodBoolean;
|
|
1328
|
+
coerce: boolean;
|
|
1329
|
+
}
|
|
1330
|
+
declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef> {
|
|
1331
|
+
_parse(input: ParseInput): ParseReturnType<boolean>;
|
|
1332
|
+
static create: (params?: ({
|
|
1333
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1334
|
+
invalid_type_error?: string | undefined;
|
|
1335
|
+
required_error?: string | undefined;
|
|
1336
|
+
description?: string | undefined;
|
|
1337
|
+
} & {
|
|
1338
|
+
coerce?: boolean | undefined;
|
|
1339
|
+
}) | undefined) => ZodBoolean;
|
|
1111
1340
|
}
|
|
1112
1341
|
interface ZodUnknownDef extends ZodTypeDef {
|
|
1113
1342
|
typeName: ZodFirstPartyTypeKind.ZodUnknown;
|
|
@@ -1127,6 +1356,10 @@ declare class ZodVoid extends ZodType<void, ZodVoidDef> {
|
|
|
1127
1356
|
interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1128
1357
|
type: T;
|
|
1129
1358
|
typeName: ZodFirstPartyTypeKind.ZodArray;
|
|
1359
|
+
exactLength: {
|
|
1360
|
+
value: number;
|
|
1361
|
+
message?: string;
|
|
1362
|
+
} | null;
|
|
1130
1363
|
minLength: {
|
|
1131
1364
|
value: number;
|
|
1132
1365
|
message?: string;
|
|
@@ -1147,31 +1380,6 @@ declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinalit
|
|
|
1147
1380
|
nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
|
|
1148
1381
|
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodArray<T_1, "many">;
|
|
1149
1382
|
}
|
|
1150
|
-
declare namespace objectUtil {
|
|
1151
|
-
export type MergeShapes<U extends ZodRawShape, V extends ZodRawShape> = {
|
|
1152
|
-
[k in Exclude<keyof U, keyof V>]: U[k];
|
|
1153
|
-
} & V;
|
|
1154
|
-
type optionalKeys<T extends object> = {
|
|
1155
|
-
[k in keyof T]: undefined extends T[k] ? k : never;
|
|
1156
|
-
}[keyof T];
|
|
1157
|
-
type requiredKeys<T extends object> = {
|
|
1158
|
-
[k in keyof T]: undefined extends T[k] ? never : k;
|
|
1159
|
-
}[keyof T];
|
|
1160
|
-
export type addQuestionMarks<T extends object> = Partial<Pick<T, optionalKeys<T>>> & Pick<T, requiredKeys<T>>;
|
|
1161
|
-
export type identity<T> = T;
|
|
1162
|
-
export type flatten<T extends object> = identity<{
|
|
1163
|
-
[k in keyof T]: T[k];
|
|
1164
|
-
}>;
|
|
1165
|
-
export type noNeverKeys<T extends ZodRawShape> = {
|
|
1166
|
-
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
|
1167
|
-
}[keyof T];
|
|
1168
|
-
export type noNever<T extends ZodRawShape> = identity<{
|
|
1169
|
-
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
|
1170
|
-
}>;
|
|
1171
|
-
export const mergeShapes: <U extends ZodRawShape, T extends ZodRawShape>(first: U, second: T) => T & U;
|
|
1172
|
-
export {};
|
|
1173
|
-
}
|
|
1174
|
-
declare type extendShape<A, B> = Omit<A, keyof B> & B;
|
|
1175
1383
|
declare type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
1176
1384
|
interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1177
1385
|
typeName: ZodFirstPartyTypeKind.ZodObject;
|
|
@@ -1179,20 +1387,25 @@ interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends
|
|
|
1179
1387
|
catchall: Catchall;
|
|
1180
1388
|
unknownKeys: UnknownKeys;
|
|
1181
1389
|
}
|
|
1182
|
-
declare type
|
|
1390
|
+
declare type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>;
|
|
1391
|
+
declare type baseObjectOutputType<Shape extends ZodRawShape> = {
|
|
1183
1392
|
[k in keyof Shape]: Shape[k]["_output"];
|
|
1184
|
-
}
|
|
1185
|
-
declare type
|
|
1186
|
-
|
|
1187
|
-
}>;
|
|
1188
|
-
declare type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.flatten<objectUtil.addQuestionMarks<{
|
|
1393
|
+
};
|
|
1394
|
+
declare type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>;
|
|
1395
|
+
declare type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{
|
|
1189
1396
|
[k in keyof Shape]: Shape[k]["_input"];
|
|
1190
|
-
}>>;
|
|
1191
|
-
declare type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny> = ZodTypeAny extends Catchall ? baseObjectInputType<Shape> : objectUtil.flatten<baseObjectInputType<Shape> & {
|
|
1192
|
-
[k: string]: Catchall["_input"];
|
|
1193
1397
|
}>;
|
|
1194
|
-
declare type
|
|
1195
|
-
|
|
1398
|
+
declare type CatchallOutput<T extends ZodTypeAny> = ZodTypeAny extends T ? unknown : {
|
|
1399
|
+
[k: string]: T["_output"];
|
|
1400
|
+
};
|
|
1401
|
+
declare type CatchallInput<T extends ZodTypeAny> = ZodTypeAny extends T ? unknown : {
|
|
1402
|
+
[k: string]: T["_input"];
|
|
1403
|
+
};
|
|
1404
|
+
declare type PassthroughType<T extends UnknownKeysParam> = T extends "passthrough" ? {
|
|
1405
|
+
[k: string]: unknown;
|
|
1406
|
+
} : unknown;
|
|
1407
|
+
declare type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
|
|
1408
|
+
declare class ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>> extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input> {
|
|
1196
1409
|
private _cached;
|
|
1197
1410
|
_getCached(): {
|
|
1198
1411
|
shape: T;
|
|
@@ -1203,22 +1416,13 @@ declare class ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysPa
|
|
|
1203
1416
|
strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>;
|
|
1204
1417
|
strip(): ZodObject<T, "strip", Catchall>;
|
|
1205
1418
|
passthrough(): ZodObject<T, "passthrough", Catchall>;
|
|
1206
|
-
/**
|
|
1207
|
-
* @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
|
|
1208
|
-
* If you want to pass through unknown properties, use `.passthrough()` instead.
|
|
1209
|
-
*/
|
|
1210
1419
|
nonstrict: () => ZodObject<T, "passthrough", Catchall>;
|
|
1211
|
-
|
|
1212
|
-
|
|
1420
|
+
extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
1421
|
+
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, UnknownKeys, Catchall, objectOutputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall, UnknownKeys>, objectInputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall, UnknownKeys>>;
|
|
1422
|
+
merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<objectUtil.extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
|
|
1213
1423
|
setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & {
|
|
1214
1424
|
[k in Key]: Schema;
|
|
1215
1425
|
}, UnknownKeys, Catchall>;
|
|
1216
|
-
/**
|
|
1217
|
-
* Prior to zod@1.0.12 there was a bug in the
|
|
1218
|
-
* inferred type of merged objects. Please
|
|
1219
|
-
* upgrade if you are experiencing issues.
|
|
1220
|
-
*/
|
|
1221
|
-
merge<Incoming extends AnyZodObject>(merging: Incoming): ZodObject<extendShape<T, ReturnType<Incoming["_def"]["shape"]>>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
|
|
1222
1426
|
catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>;
|
|
1223
1427
|
pick<Mask extends {
|
|
1224
1428
|
[k in keyof T]?: true;
|
|
@@ -1238,10 +1442,15 @@ declare class ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysPa
|
|
|
1238
1442
|
required(): ZodObject<{
|
|
1239
1443
|
[k in keyof T]: deoptional<T[k]>;
|
|
1240
1444
|
}, UnknownKeys, Catchall>;
|
|
1445
|
+
required<Mask extends {
|
|
1446
|
+
[k in keyof T]?: true;
|
|
1447
|
+
}>(mask: Mask): ZodObject<objectUtil.noNever<{
|
|
1448
|
+
[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
|
|
1449
|
+
}>, UnknownKeys, Catchall>;
|
|
1241
1450
|
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
|
|
1242
|
-
static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<{ [k in keyof T_1]: T_1[k]
|
|
1243
|
-
static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<{ [k in keyof T_1]: T_1[k]
|
|
1244
|
-
static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<{ [k in keyof T_1]: T_1[k]
|
|
1451
|
+
static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>[k_1]; }, { [k_2 in keyof baseObjectInputType<T_1>]: baseObjectInputType<T_1>[k_2]; }>;
|
|
1452
|
+
static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>[k_1]; }, { [k_2 in keyof baseObjectInputType<T_1>]: baseObjectInputType<T_1>[k_2]; }>;
|
|
1453
|
+
static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k_1 in keyof objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, { [k in keyof baseObjectOutputType<T_1>]: undefined extends baseObjectOutputType<T_1>[k] ? never : k; }[keyof T_1]>[k_1]; }, { [k_2 in keyof baseObjectInputType<T_1>]: baseObjectInputType<T_1>[k_2]; }>;
|
|
1245
1454
|
}
|
|
1246
1455
|
declare type AnyZodObject = ZodObject<any, any, any>;
|
|
1247
1456
|
declare type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
|
|
@@ -1303,7 +1512,7 @@ declare class ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTy
|
|
|
1303
1512
|
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1304
1513
|
parameters(): Args;
|
|
1305
1514
|
returnType(): Returns;
|
|
1306
|
-
args<Items extends Parameters<typeof ZodTuple["create"]>[0]>(...items: Items): ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
|
|
1515
|
+
args<Items extends Parameters<(typeof ZodTuple)["create"]>[0]>(...items: Items): ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
|
|
1307
1516
|
returns<NewReturnType extends ZodType<any, any>>(returnType: NewReturnType): ZodFunction<Args, NewReturnType>;
|
|
1308
1517
|
implement<F extends InnerTypeOfFunction<Args, Returns>>(func: F): ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
1309
1518
|
strictImplement(func: InnerTypeOfFunction<Args, Returns>): InnerTypeOfFunction<Args, Returns>;
|
|
@@ -1320,7 +1529,7 @@ interface ZodLiteralDef<T = any> extends ZodTypeDef {
|
|
|
1320
1529
|
declare class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>> {
|
|
1321
1530
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1322
1531
|
get value(): T;
|
|
1323
|
-
static create: <T_1 extends
|
|
1532
|
+
static create: <T_1 extends Primitive>(value: T_1, params?: RawCreateParams) => ZodLiteral<T_1>;
|
|
1324
1533
|
}
|
|
1325
1534
|
declare type EnumValues = [string, ...string[]];
|
|
1326
1535
|
declare type Values<T extends EnumValues> = {
|
|
@@ -1333,6 +1542,8 @@ interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
|
|
|
1333
1542
|
declare type Writeable<T> = {
|
|
1334
1543
|
-readonly [P in keyof T]: T[P];
|
|
1335
1544
|
};
|
|
1545
|
+
declare type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
|
|
1546
|
+
declare type typecast<A, T> = A extends T ? A : never;
|
|
1336
1547
|
declare function createZodEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>;
|
|
1337
1548
|
declare function createZodEnum<U extends string, T extends [U, ...U[]]>(values: T, params?: RawCreateParams): ZodEnum<T>;
|
|
1338
1549
|
declare class ZodEnum<T extends [string, ...string[]]> extends ZodType<T[number], ZodEnumDef<T>> {
|
|
@@ -1341,6 +1552,8 @@ declare class ZodEnum<T extends [string, ...string[]]> extends ZodType<T[number]
|
|
|
1341
1552
|
get enum(): Values<T>;
|
|
1342
1553
|
get Values(): Values<T>;
|
|
1343
1554
|
get Enum(): Values<T>;
|
|
1555
|
+
extract<ToExtract extends readonly [T[number], ...T[number][]]>(values: ToExtract): ZodEnum<Writeable<ToExtract>>;
|
|
1556
|
+
exclude<ToExclude extends readonly [T[number], ...T[number][]]>(values: ToExclude): ZodEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>;
|
|
1344
1557
|
static create: typeof createZodEnum;
|
|
1345
1558
|
}
|
|
1346
1559
|
interface ZodNativeEnumDef<T extends EnumLike = EnumLike> extends ZodTypeDef {
|
|
@@ -1361,6 +1574,7 @@ interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
|
1361
1574
|
typeName: ZodFirstPartyTypeKind.ZodPromise;
|
|
1362
1575
|
}
|
|
1363
1576
|
declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
|
|
1577
|
+
unwrap(): T;
|
|
1364
1578
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1365
1579
|
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodPromise<T_1>;
|
|
1366
1580
|
}
|
|
@@ -1382,10 +1596,11 @@ interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
|
1382
1596
|
typeName: ZodFirstPartyTypeKind.ZodEffects;
|
|
1383
1597
|
effect: Effect<any>;
|
|
1384
1598
|
}
|
|
1385
|
-
declare class ZodEffects<T extends ZodTypeAny, Output = T
|
|
1599
|
+
declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {
|
|
1386
1600
|
innerType(): T;
|
|
1601
|
+
sourceType(): T;
|
|
1387
1602
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1388
|
-
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"], I
|
|
1603
|
+
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"], input<I>>;
|
|
1389
1604
|
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1390
1605
|
}
|
|
1391
1606
|
|
|
@@ -1415,7 +1630,34 @@ interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
|
1415
1630
|
declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
|
|
1416
1631
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1417
1632
|
removeDefault(): T;
|
|
1418
|
-
static create: <T_1 extends ZodTypeAny>(type: T_1, params
|
|
1633
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
|
|
1634
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1635
|
+
invalid_type_error?: string | undefined;
|
|
1636
|
+
required_error?: string | undefined;
|
|
1637
|
+
description?: string | undefined;
|
|
1638
|
+
} & {
|
|
1639
|
+
default: T_1["_input"] | (() => util.noUndefined<T_1["_input"]>);
|
|
1640
|
+
}) => ZodDefault<T_1>;
|
|
1641
|
+
}
|
|
1642
|
+
interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1643
|
+
innerType: T;
|
|
1644
|
+
catchValue: (ctx: {
|
|
1645
|
+
error: ZodError;
|
|
1646
|
+
input: unknown;
|
|
1647
|
+
}) => T["_input"];
|
|
1648
|
+
typeName: ZodFirstPartyTypeKind.ZodCatch;
|
|
1649
|
+
}
|
|
1650
|
+
declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
|
|
1651
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1652
|
+
removeCatch(): T;
|
|
1653
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
|
|
1654
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1655
|
+
invalid_type_error?: string | undefined;
|
|
1656
|
+
required_error?: string | undefined;
|
|
1657
|
+
description?: string | undefined;
|
|
1658
|
+
} & {
|
|
1659
|
+
catch: T_1["_output"] | (() => T_1["_output"]);
|
|
1660
|
+
}) => ZodCatch<T_1>;
|
|
1419
1661
|
}
|
|
1420
1662
|
interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {
|
|
1421
1663
|
type: T;
|
|
@@ -1427,10 +1669,19 @@ declare type BRAND<T extends string | number | symbol> = {
|
|
|
1427
1669
|
[k in T]: true;
|
|
1428
1670
|
};
|
|
1429
1671
|
};
|
|
1430
|
-
declare class ZodBranded<T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T["_output"] & BRAND<B>, ZodBrandedDef<T>, T["_input"]
|
|
1672
|
+
declare class ZodBranded<T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T["_output"] & BRAND<B>, ZodBrandedDef<T>, T["_input"]> {
|
|
1431
1673
|
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1432
1674
|
unwrap(): T;
|
|
1433
1675
|
}
|
|
1676
|
+
interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {
|
|
1677
|
+
in: A;
|
|
1678
|
+
out: B;
|
|
1679
|
+
typeName: ZodFirstPartyTypeKind.ZodPipeline;
|
|
1680
|
+
}
|
|
1681
|
+
declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
|
|
1682
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1683
|
+
static create<A extends ZodTypeAny, B extends ZodTypeAny>(a: A, b: B): ZodPipeline<A, B>;
|
|
1684
|
+
}
|
|
1434
1685
|
declare enum ZodFirstPartyTypeKind {
|
|
1435
1686
|
ZodString = "ZodString",
|
|
1436
1687
|
ZodNumber = "ZodNumber",
|
|
@@ -1438,6 +1689,7 @@ declare enum ZodFirstPartyTypeKind {
|
|
|
1438
1689
|
ZodBigInt = "ZodBigInt",
|
|
1439
1690
|
ZodBoolean = "ZodBoolean",
|
|
1440
1691
|
ZodDate = "ZodDate",
|
|
1692
|
+
ZodSymbol = "ZodSymbol",
|
|
1441
1693
|
ZodUndefined = "ZodUndefined",
|
|
1442
1694
|
ZodNull = "ZodNull",
|
|
1443
1695
|
ZodAny = "ZodAny",
|
|
@@ -1462,34 +1714,10 @@ declare enum ZodFirstPartyTypeKind {
|
|
|
1462
1714
|
ZodOptional = "ZodOptional",
|
|
1463
1715
|
ZodNullable = "ZodNullable",
|
|
1464
1716
|
ZodDefault = "ZodDefault",
|
|
1717
|
+
ZodCatch = "ZodCatch",
|
|
1465
1718
|
ZodPromise = "ZodPromise",
|
|
1466
|
-
ZodBranded = "ZodBranded"
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
declare const partialLinksSchema: ZodObject<{
|
|
1470
|
-
termsAndConditions: ZodOptional<ZodString>;
|
|
1471
|
-
}, "strict", ZodTypeAny, {
|
|
1472
|
-
termsAndConditions?: string | undefined;
|
|
1473
|
-
}, {
|
|
1474
|
-
termsAndConditions?: string | undefined;
|
|
1475
|
-
}>;
|
|
1476
|
-
|
|
1477
|
-
interface Logo {
|
|
1478
|
-
dark?: string;
|
|
1479
|
-
height?: number;
|
|
1480
|
-
light: string;
|
|
1481
|
-
width?: number;
|
|
1482
|
-
}
|
|
1483
|
-
interface Style {
|
|
1484
|
-
checksAndRadios?: 'animated' | 'standard';
|
|
1485
|
-
labels?: 'floating' | 'stacked';
|
|
1486
|
-
logo?: Logo;
|
|
1487
|
-
sections?: {
|
|
1488
|
-
header?: boolean;
|
|
1489
|
-
};
|
|
1490
|
-
stage?: {
|
|
1491
|
-
icon: boolean;
|
|
1492
|
-
};
|
|
1719
|
+
ZodBranded = "ZodBranded",
|
|
1720
|
+
ZodPipeline = "ZodPipeline"
|
|
1493
1721
|
}
|
|
1494
1722
|
|
|
1495
1723
|
declare const partialConfigSchema: ZodObject<{
|
|
@@ -1499,45 +1727,45 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1499
1727
|
name: ZodString;
|
|
1500
1728
|
value: ZodUnknown;
|
|
1501
1729
|
}, "strip", ZodTypeAny, {
|
|
1502
|
-
value?: unknown;
|
|
1503
1730
|
name: string;
|
|
1504
|
-
}, {
|
|
1505
1731
|
value?: unknown;
|
|
1732
|
+
}, {
|
|
1506
1733
|
name: string;
|
|
1734
|
+
value?: unknown;
|
|
1507
1735
|
}>, "many">>;
|
|
1508
1736
|
output: ZodArray<ZodObject<{
|
|
1509
1737
|
name: ZodString;
|
|
1510
1738
|
value: ZodUnknown;
|
|
1511
1739
|
}, "strip", ZodTypeAny, {
|
|
1512
|
-
value?: unknown;
|
|
1513
1740
|
name: string;
|
|
1514
|
-
}, {
|
|
1515
1741
|
value?: unknown;
|
|
1742
|
+
}, {
|
|
1516
1743
|
name: string;
|
|
1744
|
+
value?: unknown;
|
|
1517
1745
|
}>, "many">;
|
|
1518
1746
|
type: ZodNativeEnum<typeof CallbackType>;
|
|
1519
1747
|
}, "strip", ZodTypeAny, {
|
|
1520
|
-
input?: {
|
|
1521
|
-
value?: unknown;
|
|
1522
|
-
name: string;
|
|
1523
|
-
}[] | undefined;
|
|
1524
|
-
_id?: number | undefined;
|
|
1525
1748
|
type: CallbackType;
|
|
1526
1749
|
output: {
|
|
1527
|
-
value?: unknown;
|
|
1528
1750
|
name: string;
|
|
1751
|
+
value?: unknown;
|
|
1529
1752
|
}[];
|
|
1530
|
-
|
|
1753
|
+
_id?: number | undefined;
|
|
1531
1754
|
input?: {
|
|
1532
|
-
value?: unknown;
|
|
1533
1755
|
name: string;
|
|
1756
|
+
value?: unknown;
|
|
1534
1757
|
}[] | undefined;
|
|
1535
|
-
|
|
1758
|
+
}, {
|
|
1536
1759
|
type: CallbackType;
|
|
1537
1760
|
output: {
|
|
1538
|
-
value?: unknown;
|
|
1539
1761
|
name: string;
|
|
1762
|
+
value?: unknown;
|
|
1540
1763
|
}[];
|
|
1764
|
+
_id?: number | undefined;
|
|
1765
|
+
input?: {
|
|
1766
|
+
name: string;
|
|
1767
|
+
value?: unknown;
|
|
1768
|
+
}[] | undefined;
|
|
1541
1769
|
}>], ZodUnknown>, ZodType<FRCallback, ZodTypeDef, FRCallback>>>>;
|
|
1542
1770
|
clientId: ZodOptional<ZodOptional<ZodString>>;
|
|
1543
1771
|
middleware: ZodOptional<ZodOptional<ZodArray<ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>, "many">>>;
|
|
@@ -1573,6 +1801,8 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1573
1801
|
}>>;
|
|
1574
1802
|
timeout: ZodNumber;
|
|
1575
1803
|
}, "strip", ZodTypeAny, {
|
|
1804
|
+
timeout: number;
|
|
1805
|
+
baseUrl: string;
|
|
1576
1806
|
paths?: {
|
|
1577
1807
|
authenticate: string;
|
|
1578
1808
|
authorize: string;
|
|
@@ -1582,9 +1812,9 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1582
1812
|
revoke: string;
|
|
1583
1813
|
sessions: string;
|
|
1584
1814
|
} | undefined;
|
|
1815
|
+
}, {
|
|
1585
1816
|
timeout: number;
|
|
1586
1817
|
baseUrl: string;
|
|
1587
|
-
}, {
|
|
1588
1818
|
paths?: {
|
|
1589
1819
|
authenticate: string;
|
|
1590
1820
|
authorize: string;
|
|
@@ -1594,8 +1824,6 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1594
1824
|
revoke: string;
|
|
1595
1825
|
sessions: string;
|
|
1596
1826
|
} | undefined;
|
|
1597
|
-
timeout: number;
|
|
1598
|
-
baseUrl: string;
|
|
1599
1827
|
}>>;
|
|
1600
1828
|
support: ZodOptional<ZodOptional<ZodUnion<[ZodLiteral<"legacy">, ZodLiteral<"modern">]>>>;
|
|
1601
1829
|
tokenStore: ZodOptional<ZodOptional<ZodUnion<[ZodObject<{
|
|
@@ -1605,15 +1833,15 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1605
1833
|
refreshToken: ZodOptional<ZodString>;
|
|
1606
1834
|
tokenExpiry: ZodOptional<ZodNumber>;
|
|
1607
1835
|
}, "strip", ZodTypeAny, {
|
|
1836
|
+
accessToken: string;
|
|
1608
1837
|
idToken?: string | undefined;
|
|
1609
1838
|
refreshToken?: string | undefined;
|
|
1610
1839
|
tokenExpiry?: number | undefined;
|
|
1611
|
-
accessToken: string;
|
|
1612
1840
|
}, {
|
|
1841
|
+
accessToken: string;
|
|
1613
1842
|
idToken?: string | undefined;
|
|
1614
1843
|
refreshToken?: string | undefined;
|
|
1615
1844
|
tokenExpiry?: number | undefined;
|
|
1616
|
-
accessToken: string;
|
|
1617
1845
|
}>>>;
|
|
1618
1846
|
set: ZodFunction<ZodTuple<[ZodString], ZodUnknown>, ZodPromise<ZodVoid>>;
|
|
1619
1847
|
remove: ZodFunction<ZodTuple<[ZodString], ZodUnknown>, ZodPromise<ZodVoid>>;
|
|
@@ -1621,37 +1849,36 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1621
1849
|
set: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
1622
1850
|
remove: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
1623
1851
|
get: (args_0: string, ...args_1: unknown[]) => Promise<{
|
|
1852
|
+
accessToken: string;
|
|
1624
1853
|
idToken?: string | undefined;
|
|
1625
1854
|
refreshToken?: string | undefined;
|
|
1626
1855
|
tokenExpiry?: number | undefined;
|
|
1627
|
-
accessToken: string;
|
|
1628
1856
|
}>;
|
|
1629
1857
|
}, {
|
|
1630
1858
|
set: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
1631
1859
|
remove: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
1632
1860
|
get: (args_0: string, ...args_1: unknown[]) => Promise<{
|
|
1861
|
+
accessToken: string;
|
|
1633
1862
|
idToken?: string | undefined;
|
|
1634
1863
|
refreshToken?: string | undefined;
|
|
1635
1864
|
tokenExpiry?: number | undefined;
|
|
1636
|
-
accessToken: string;
|
|
1637
1865
|
}>;
|
|
1638
1866
|
}>, ZodLiteral<"indexedDB">, ZodLiteral<"sessionStorage">, ZodLiteral<"localStorage">]>>>;
|
|
1639
1867
|
tree: ZodOptional<ZodOptional<ZodString>>;
|
|
1640
1868
|
type: ZodOptional<ZodOptional<ZodString>>;
|
|
1641
1869
|
oauthThreshold: ZodOptional<ZodOptional<ZodNumber>>;
|
|
1642
1870
|
}, "strict", ZodTypeAny, {
|
|
1643
|
-
type?: string | undefined;
|
|
1644
1871
|
callbackFactory?: ((args_0: {
|
|
1645
|
-
input?: {
|
|
1646
|
-
value?: unknown;
|
|
1647
|
-
name: string;
|
|
1648
|
-
}[] | undefined;
|
|
1649
|
-
_id?: number | undefined;
|
|
1650
1872
|
type: CallbackType;
|
|
1651
1873
|
output: {
|
|
1652
|
-
value?: unknown;
|
|
1653
1874
|
name: string;
|
|
1875
|
+
value?: unknown;
|
|
1654
1876
|
}[];
|
|
1877
|
+
_id?: number | undefined;
|
|
1878
|
+
input?: {
|
|
1879
|
+
name: string;
|
|
1880
|
+
value?: unknown;
|
|
1881
|
+
}[] | undefined;
|
|
1655
1882
|
}, ...args_1: unknown[]) => FRCallback) | undefined;
|
|
1656
1883
|
clientId?: string | undefined;
|
|
1657
1884
|
middleware?: ((...args: unknown[]) => unknown)[] | undefined;
|
|
@@ -1659,6 +1886,8 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1659
1886
|
redirectUri?: string | undefined;
|
|
1660
1887
|
scope?: string | undefined;
|
|
1661
1888
|
serverConfig?: {
|
|
1889
|
+
timeout: number;
|
|
1890
|
+
baseUrl: string;
|
|
1662
1891
|
paths?: {
|
|
1663
1892
|
authenticate: string;
|
|
1664
1893
|
authorize: string;
|
|
@@ -1668,35 +1897,33 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1668
1897
|
revoke: string;
|
|
1669
1898
|
sessions: string;
|
|
1670
1899
|
} | undefined;
|
|
1671
|
-
timeout: number;
|
|
1672
|
-
baseUrl: string;
|
|
1673
1900
|
} | undefined;
|
|
1674
1901
|
support?: "modern" | "legacy" | undefined;
|
|
1675
1902
|
tokenStore?: "localStorage" | "indexedDB" | "sessionStorage" | {
|
|
1676
1903
|
set: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
1677
1904
|
remove: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
1678
1905
|
get: (args_0: string, ...args_1: unknown[]) => Promise<{
|
|
1906
|
+
accessToken: string;
|
|
1679
1907
|
idToken?: string | undefined;
|
|
1680
1908
|
refreshToken?: string | undefined;
|
|
1681
1909
|
tokenExpiry?: number | undefined;
|
|
1682
|
-
accessToken: string;
|
|
1683
1910
|
}>;
|
|
1684
1911
|
} | undefined;
|
|
1685
1912
|
tree?: string | undefined;
|
|
1913
|
+
type?: string | undefined;
|
|
1686
1914
|
oauthThreshold?: number | undefined;
|
|
1687
1915
|
}, {
|
|
1688
|
-
type?: string | undefined;
|
|
1689
1916
|
callbackFactory?: ((args_0: {
|
|
1690
|
-
input?: {
|
|
1691
|
-
value?: unknown;
|
|
1692
|
-
name: string;
|
|
1693
|
-
}[] | undefined;
|
|
1694
|
-
_id?: number | undefined;
|
|
1695
1917
|
type: CallbackType;
|
|
1696
1918
|
output: {
|
|
1697
|
-
value?: unknown;
|
|
1698
1919
|
name: string;
|
|
1920
|
+
value?: unknown;
|
|
1699
1921
|
}[];
|
|
1922
|
+
_id?: number | undefined;
|
|
1923
|
+
input?: {
|
|
1924
|
+
name: string;
|
|
1925
|
+
value?: unknown;
|
|
1926
|
+
}[] | undefined;
|
|
1700
1927
|
}, ...args_1: unknown[]) => FRCallback) | undefined;
|
|
1701
1928
|
clientId?: string | undefined;
|
|
1702
1929
|
middleware?: ((...args: unknown[]) => unknown)[] | undefined;
|
|
@@ -1704,6 +1931,8 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1704
1931
|
redirectUri?: string | undefined;
|
|
1705
1932
|
scope?: string | undefined;
|
|
1706
1933
|
serverConfig?: {
|
|
1934
|
+
timeout: number;
|
|
1935
|
+
baseUrl: string;
|
|
1707
1936
|
paths?: {
|
|
1708
1937
|
authenticate: string;
|
|
1709
1938
|
authorize: string;
|
|
@@ -1713,99 +1942,106 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1713
1942
|
revoke: string;
|
|
1714
1943
|
sessions: string;
|
|
1715
1944
|
} | undefined;
|
|
1716
|
-
timeout: number;
|
|
1717
|
-
baseUrl: string;
|
|
1718
1945
|
} | undefined;
|
|
1719
1946
|
support?: "modern" | "legacy" | undefined;
|
|
1720
1947
|
tokenStore?: "localStorage" | "indexedDB" | "sessionStorage" | {
|
|
1721
1948
|
set: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
1722
1949
|
remove: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
1723
1950
|
get: (args_0: string, ...args_1: unknown[]) => Promise<{
|
|
1951
|
+
accessToken: string;
|
|
1724
1952
|
idToken?: string | undefined;
|
|
1725
1953
|
refreshToken?: string | undefined;
|
|
1726
1954
|
tokenExpiry?: number | undefined;
|
|
1727
|
-
accessToken: string;
|
|
1728
1955
|
}>;
|
|
1729
1956
|
} | undefined;
|
|
1730
1957
|
tree?: string | undefined;
|
|
1958
|
+
type?: string | undefined;
|
|
1731
1959
|
oauthThreshold?: number | undefined;
|
|
1732
1960
|
}>;
|
|
1733
1961
|
|
|
1734
1962
|
declare const journeyConfigSchema: ZodObject<{
|
|
1735
|
-
forgotPassword: ZodObject<{
|
|
1963
|
+
forgotPassword: ZodOptional<ZodObject<{
|
|
1736
1964
|
journey: ZodOptional<ZodString>;
|
|
1737
1965
|
match: ZodArray<ZodString, "many">;
|
|
1738
1966
|
}, "strip", ZodTypeAny, {
|
|
1739
|
-
journey?: string | undefined;
|
|
1740
1967
|
match: string[];
|
|
1741
|
-
}, {
|
|
1742
1968
|
journey?: string | undefined;
|
|
1969
|
+
}, {
|
|
1743
1970
|
match: string[];
|
|
1744
|
-
|
|
1745
|
-
|
|
1971
|
+
journey?: string | undefined;
|
|
1972
|
+
}>>;
|
|
1973
|
+
forgotUsername: ZodOptional<ZodObject<{
|
|
1746
1974
|
journey: ZodOptional<ZodString>;
|
|
1747
1975
|
match: ZodArray<ZodString, "many">;
|
|
1748
1976
|
}, "strip", ZodTypeAny, {
|
|
1749
|
-
journey?: string | undefined;
|
|
1750
1977
|
match: string[];
|
|
1751
|
-
}, {
|
|
1752
1978
|
journey?: string | undefined;
|
|
1979
|
+
}, {
|
|
1753
1980
|
match: string[];
|
|
1754
|
-
|
|
1755
|
-
|
|
1981
|
+
journey?: string | undefined;
|
|
1982
|
+
}>>;
|
|
1983
|
+
login: ZodOptional<ZodObject<{
|
|
1756
1984
|
journey: ZodOptional<ZodString>;
|
|
1757
1985
|
match: ZodArray<ZodString, "many">;
|
|
1758
1986
|
}, "strip", ZodTypeAny, {
|
|
1759
|
-
journey?: string | undefined;
|
|
1760
1987
|
match: string[];
|
|
1761
|
-
}, {
|
|
1762
1988
|
journey?: string | undefined;
|
|
1989
|
+
}, {
|
|
1763
1990
|
match: string[];
|
|
1764
|
-
|
|
1765
|
-
|
|
1991
|
+
journey?: string | undefined;
|
|
1992
|
+
}>>;
|
|
1993
|
+
register: ZodOptional<ZodObject<{
|
|
1766
1994
|
journey: ZodOptional<ZodString>;
|
|
1767
1995
|
match: ZodArray<ZodString, "many">;
|
|
1768
1996
|
}, "strip", ZodTypeAny, {
|
|
1769
|
-
journey?: string | undefined;
|
|
1770
1997
|
match: string[];
|
|
1771
|
-
}, {
|
|
1772
1998
|
journey?: string | undefined;
|
|
1999
|
+
}, {
|
|
1773
2000
|
match: string[];
|
|
1774
|
-
}>;
|
|
1775
|
-
}, "strip", ZodTypeAny, {
|
|
1776
|
-
forgotPassword: {
|
|
1777
2001
|
journey?: string | undefined;
|
|
2002
|
+
}>>;
|
|
2003
|
+
}, "strip", ZodTypeAny, {
|
|
2004
|
+
forgotPassword?: {
|
|
1778
2005
|
match: string[];
|
|
1779
|
-
};
|
|
1780
|
-
forgotUsername: {
|
|
1781
2006
|
journey?: string | undefined;
|
|
2007
|
+
} | undefined;
|
|
2008
|
+
forgotUsername?: {
|
|
1782
2009
|
match: string[];
|
|
1783
|
-
};
|
|
1784
|
-
login: {
|
|
1785
2010
|
journey?: string | undefined;
|
|
2011
|
+
} | undefined;
|
|
2012
|
+
login?: {
|
|
1786
2013
|
match: string[];
|
|
1787
|
-
};
|
|
1788
|
-
register: {
|
|
1789
2014
|
journey?: string | undefined;
|
|
2015
|
+
} | undefined;
|
|
2016
|
+
register?: {
|
|
1790
2017
|
match: string[];
|
|
1791
|
-
};
|
|
1792
|
-
}, {
|
|
1793
|
-
forgotPassword: {
|
|
1794
2018
|
journey?: string | undefined;
|
|
2019
|
+
} | undefined;
|
|
2020
|
+
}, {
|
|
2021
|
+
forgotPassword?: {
|
|
1795
2022
|
match: string[];
|
|
1796
|
-
};
|
|
1797
|
-
forgotUsername: {
|
|
1798
2023
|
journey?: string | undefined;
|
|
2024
|
+
} | undefined;
|
|
2025
|
+
forgotUsername?: {
|
|
1799
2026
|
match: string[];
|
|
1800
|
-
};
|
|
1801
|
-
login: {
|
|
1802
2027
|
journey?: string | undefined;
|
|
2028
|
+
} | undefined;
|
|
2029
|
+
login?: {
|
|
1803
2030
|
match: string[];
|
|
1804
|
-
};
|
|
1805
|
-
register: {
|
|
1806
2031
|
journey?: string | undefined;
|
|
2032
|
+
} | undefined;
|
|
2033
|
+
register?: {
|
|
1807
2034
|
match: string[];
|
|
1808
|
-
|
|
2035
|
+
journey?: string | undefined;
|
|
2036
|
+
} | undefined;
|
|
2037
|
+
}>;
|
|
2038
|
+
|
|
2039
|
+
declare const partialLinksSchema: ZodObject<{
|
|
2040
|
+
termsAndConditions: ZodOptional<ZodString>;
|
|
2041
|
+
}, "strict", ZodTypeAny, {
|
|
2042
|
+
termsAndConditions?: string | undefined;
|
|
2043
|
+
}, {
|
|
2044
|
+
termsAndConditions?: string | undefined;
|
|
1809
2045
|
}>;
|
|
1810
2046
|
|
|
1811
2047
|
declare const partialStringsSchema: ZodObject<{
|
|
@@ -1823,6 +2059,7 @@ declare const partialStringsSchema: ZodObject<{
|
|
|
1823
2059
|
doesNotMeetMinimumCharacterLength: ZodOptional<ZodString>;
|
|
1824
2060
|
ensurePasswordIsMoreThan: ZodOptional<ZodString>;
|
|
1825
2061
|
ensurePasswordHasOne: ZodOptional<ZodString>;
|
|
2062
|
+
enterVerificationCode: ZodOptional<ZodString>;
|
|
1826
2063
|
exceedsMaximumCharacterLength: ZodOptional<ZodString>;
|
|
1827
2064
|
fieldCanNotContainFollowingCharacters: ZodOptional<ZodString>;
|
|
1828
2065
|
fieldCanNotContainFollowingValues: ZodOptional<ZodString>;
|
|
@@ -1866,16 +2103,17 @@ declare const partialStringsSchema: ZodObject<{
|
|
|
1866
2103
|
termsAndConditions: ZodOptional<ZodString>;
|
|
1867
2104
|
termsAndConditionsLinkText: ZodOptional<ZodString>;
|
|
1868
2105
|
tryAgain: ZodOptional<ZodString>;
|
|
2106
|
+
twoFactorAuthentication: ZodOptional<ZodString>;
|
|
1869
2107
|
useValidEmail: ZodOptional<ZodString>;
|
|
1870
2108
|
unrecoverableError: ZodOptional<ZodString>;
|
|
1871
2109
|
unknownNetworkError: ZodOptional<ZodString>;
|
|
2110
|
+
userName: ZodOptional<ZodString>;
|
|
1872
2111
|
usernameRequirements: ZodOptional<ZodString>;
|
|
2112
|
+
useTheAuthenticatorAppOnYourPhone: ZodOptional<ZodString>;
|
|
1873
2113
|
validatedCreatePasswordCallback: ZodOptional<ZodString>;
|
|
1874
2114
|
validatedCreateUsernameCallback: ZodOptional<ZodString>;
|
|
1875
2115
|
valueRequirements: ZodOptional<ZodString>;
|
|
1876
2116
|
}, "strict", ZodTypeAny, {
|
|
1877
|
-
loading?: string | undefined;
|
|
1878
|
-
termsAndConditions?: string | undefined;
|
|
1879
2117
|
alreadyHaveAnAccount?: string | undefined;
|
|
1880
2118
|
backToDefault?: string | undefined;
|
|
1881
2119
|
backToLogin?: string | undefined;
|
|
@@ -1890,6 +2128,7 @@ declare const partialStringsSchema: ZodObject<{
|
|
|
1890
2128
|
doesNotMeetMinimumCharacterLength?: string | undefined;
|
|
1891
2129
|
ensurePasswordIsMoreThan?: string | undefined;
|
|
1892
2130
|
ensurePasswordHasOne?: string | undefined;
|
|
2131
|
+
enterVerificationCode?: string | undefined;
|
|
1893
2132
|
exceedsMaximumCharacterLength?: string | undefined;
|
|
1894
2133
|
fieldCanNotContainFollowingCharacters?: string | undefined;
|
|
1895
2134
|
fieldCanNotContainFollowingValues?: string | undefined;
|
|
@@ -1897,6 +2136,7 @@ declare const partialStringsSchema: ZodObject<{
|
|
|
1897
2136
|
forgotUsername?: string | undefined;
|
|
1898
2137
|
givenName?: string | undefined;
|
|
1899
2138
|
inputRequiredError?: string | undefined;
|
|
2139
|
+
loading?: string | undefined;
|
|
1900
2140
|
loginButton?: string | undefined;
|
|
1901
2141
|
loginFailure?: string | undefined;
|
|
1902
2142
|
loginHeader?: string | undefined;
|
|
@@ -1929,18 +2169,20 @@ declare const partialStringsSchema: ZodObject<{
|
|
|
1929
2169
|
sn?: string | undefined;
|
|
1930
2170
|
submitButton?: string | undefined;
|
|
1931
2171
|
successMessage?: string | undefined;
|
|
2172
|
+
termsAndConditions?: string | undefined;
|
|
1932
2173
|
termsAndConditionsLinkText?: string | undefined;
|
|
1933
2174
|
tryAgain?: string | undefined;
|
|
2175
|
+
twoFactorAuthentication?: string | undefined;
|
|
1934
2176
|
useValidEmail?: string | undefined;
|
|
1935
2177
|
unrecoverableError?: string | undefined;
|
|
1936
2178
|
unknownNetworkError?: string | undefined;
|
|
2179
|
+
userName?: string | undefined;
|
|
1937
2180
|
usernameRequirements?: string | undefined;
|
|
2181
|
+
useTheAuthenticatorAppOnYourPhone?: string | undefined;
|
|
1938
2182
|
validatedCreatePasswordCallback?: string | undefined;
|
|
1939
2183
|
validatedCreateUsernameCallback?: string | undefined;
|
|
1940
2184
|
valueRequirements?: string | undefined;
|
|
1941
2185
|
}, {
|
|
1942
|
-
loading?: string | undefined;
|
|
1943
|
-
termsAndConditions?: string | undefined;
|
|
1944
2186
|
alreadyHaveAnAccount?: string | undefined;
|
|
1945
2187
|
backToDefault?: string | undefined;
|
|
1946
2188
|
backToLogin?: string | undefined;
|
|
@@ -1955,6 +2197,7 @@ declare const partialStringsSchema: ZodObject<{
|
|
|
1955
2197
|
doesNotMeetMinimumCharacterLength?: string | undefined;
|
|
1956
2198
|
ensurePasswordIsMoreThan?: string | undefined;
|
|
1957
2199
|
ensurePasswordHasOne?: string | undefined;
|
|
2200
|
+
enterVerificationCode?: string | undefined;
|
|
1958
2201
|
exceedsMaximumCharacterLength?: string | undefined;
|
|
1959
2202
|
fieldCanNotContainFollowingCharacters?: string | undefined;
|
|
1960
2203
|
fieldCanNotContainFollowingValues?: string | undefined;
|
|
@@ -1962,6 +2205,7 @@ declare const partialStringsSchema: ZodObject<{
|
|
|
1962
2205
|
forgotUsername?: string | undefined;
|
|
1963
2206
|
givenName?: string | undefined;
|
|
1964
2207
|
inputRequiredError?: string | undefined;
|
|
2208
|
+
loading?: string | undefined;
|
|
1965
2209
|
loginButton?: string | undefined;
|
|
1966
2210
|
loginFailure?: string | undefined;
|
|
1967
2211
|
loginHeader?: string | undefined;
|
|
@@ -1994,59 +2238,218 @@ declare const partialStringsSchema: ZodObject<{
|
|
|
1994
2238
|
sn?: string | undefined;
|
|
1995
2239
|
submitButton?: string | undefined;
|
|
1996
2240
|
successMessage?: string | undefined;
|
|
2241
|
+
termsAndConditions?: string | undefined;
|
|
1997
2242
|
termsAndConditionsLinkText?: string | undefined;
|
|
1998
2243
|
tryAgain?: string | undefined;
|
|
2244
|
+
twoFactorAuthentication?: string | undefined;
|
|
1999
2245
|
useValidEmail?: string | undefined;
|
|
2000
2246
|
unrecoverableError?: string | undefined;
|
|
2001
2247
|
unknownNetworkError?: string | undefined;
|
|
2248
|
+
userName?: string | undefined;
|
|
2002
2249
|
usernameRequirements?: string | undefined;
|
|
2250
|
+
useTheAuthenticatorAppOnYourPhone?: string | undefined;
|
|
2003
2251
|
validatedCreatePasswordCallback?: string | undefined;
|
|
2004
2252
|
validatedCreateUsernameCallback?: string | undefined;
|
|
2005
2253
|
valueRequirements?: string | undefined;
|
|
2006
2254
|
}>;
|
|
2007
2255
|
|
|
2008
|
-
declare const
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2256
|
+
declare const partialStyleSchema: ZodObject<{
|
|
2257
|
+
checksAndRadios: ZodOptional<ZodOptional<ZodUnion<[ZodLiteral<"animated">, ZodLiteral<"standard">]>>>;
|
|
2258
|
+
labels: ZodOptional<ZodOptional<ZodUnion<[ZodOptional<ZodLiteral<"floating">>, ZodLiteral<"stacked">]>>>;
|
|
2259
|
+
logo: ZodOptional<ZodOptional<ZodObject<{
|
|
2260
|
+
dark: ZodOptional<ZodString>;
|
|
2261
|
+
height: ZodOptional<ZodNumber>;
|
|
2262
|
+
light: ZodOptional<ZodString>;
|
|
2263
|
+
width: ZodOptional<ZodNumber>;
|
|
2264
|
+
}, "strict", ZodTypeAny, {
|
|
2265
|
+
dark?: string | undefined;
|
|
2266
|
+
height?: number | undefined;
|
|
2267
|
+
light?: string | undefined;
|
|
2268
|
+
width?: number | undefined;
|
|
2269
|
+
}, {
|
|
2270
|
+
dark?: string | undefined;
|
|
2271
|
+
height?: number | undefined;
|
|
2272
|
+
light?: string | undefined;
|
|
2273
|
+
width?: number | undefined;
|
|
2274
|
+
}>>>;
|
|
2275
|
+
sections: ZodOptional<ZodOptional<ZodObject<{
|
|
2276
|
+
header: ZodOptional<ZodBoolean>;
|
|
2277
|
+
}, "strip", ZodTypeAny, {
|
|
2278
|
+
header?: boolean | undefined;
|
|
2279
|
+
}, {
|
|
2280
|
+
header?: boolean | undefined;
|
|
2281
|
+
}>>>;
|
|
2282
|
+
stage: ZodOptional<ZodOptional<ZodObject<{
|
|
2283
|
+
icon: ZodOptional<ZodBoolean>;
|
|
2284
|
+
}, "strip", ZodTypeAny, {
|
|
2285
|
+
icon?: boolean | undefined;
|
|
2286
|
+
}, {
|
|
2287
|
+
icon?: boolean | undefined;
|
|
2288
|
+
}>>>;
|
|
2289
|
+
}, "strict", ZodTypeAny, {
|
|
2290
|
+
checksAndRadios?: "standard" | "animated" | undefined;
|
|
2291
|
+
labels?: "floating" | "stacked" | undefined;
|
|
2292
|
+
logo?: {
|
|
2293
|
+
dark?: string | undefined;
|
|
2294
|
+
height?: number | undefined;
|
|
2295
|
+
light?: string | undefined;
|
|
2296
|
+
width?: number | undefined;
|
|
2297
|
+
} | undefined;
|
|
2298
|
+
sections?: {
|
|
2299
|
+
header?: boolean | undefined;
|
|
2300
|
+
} | undefined;
|
|
2301
|
+
stage?: {
|
|
2302
|
+
icon?: boolean | undefined;
|
|
2303
|
+
} | undefined;
|
|
2304
|
+
}, {
|
|
2305
|
+
checksAndRadios?: "standard" | "animated" | undefined;
|
|
2306
|
+
labels?: "floating" | "stacked" | undefined;
|
|
2307
|
+
logo?: {
|
|
2308
|
+
dark?: string | undefined;
|
|
2309
|
+
height?: number | undefined;
|
|
2310
|
+
light?: string | undefined;
|
|
2311
|
+
width?: number | undefined;
|
|
2312
|
+
} | undefined;
|
|
2313
|
+
sections?: {
|
|
2314
|
+
header?: boolean | undefined;
|
|
2315
|
+
} | undefined;
|
|
2316
|
+
stage?: {
|
|
2317
|
+
icon?: boolean | undefined;
|
|
2318
|
+
} | undefined;
|
|
2319
|
+
}>;
|
|
2320
|
+
|
|
2321
|
+
interface JourneyOptions {
|
|
2322
|
+
oauth?: boolean;
|
|
2323
|
+
user?: boolean;
|
|
2324
|
+
}
|
|
2325
|
+
interface JourneyOptionsChange {
|
|
2326
|
+
forgerock?: StepOptions;
|
|
2327
|
+
journey: string;
|
|
2328
|
+
}
|
|
2329
|
+
interface JourneyOptionsStart {
|
|
2330
|
+
forgerock?: StepOptions;
|
|
2331
|
+
journey?: string;
|
|
2332
|
+
resumeUrl?: string;
|
|
2333
|
+
}
|
|
2334
|
+
interface WidgetConfigOptions {
|
|
2335
|
+
forgerock?: TypeOf<typeof partialConfigSchema>;
|
|
2336
|
+
content?: TypeOf<typeof partialStringsSchema>;
|
|
2337
|
+
journeys?: TypeOf<typeof journeyConfigSchema>;
|
|
2338
|
+
links?: TypeOf<typeof partialLinksSchema>;
|
|
2339
|
+
style?: TypeOf<typeof partialStyleSchema>;
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
|
|
2343
|
+
interface ComponentStoreValue {
|
|
2344
|
+
lastAction: 'close' | 'open' | 'mount' | null;
|
|
2345
|
+
error: {
|
|
2346
|
+
code: string;
|
|
2347
|
+
message: string;
|
|
2348
|
+
} | null;
|
|
2349
|
+
modal: {
|
|
2350
|
+
component: SvelteComponentDev$1;
|
|
2351
|
+
element: HTMLDialogElement;
|
|
2352
|
+
} | null;
|
|
2353
|
+
mounted: boolean;
|
|
2354
|
+
open: boolean | null;
|
|
2355
|
+
reason: 'auto' | 'external' | 'user' | null;
|
|
2356
|
+
type: 'inline' | 'modal' | null;
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
declare const api: {
|
|
2360
|
+
component: {
|
|
2361
|
+
close: (args?: {
|
|
2362
|
+
reason: "auto" | "external" | "user";
|
|
2363
|
+
} | undefined) => void;
|
|
2364
|
+
open: () => void;
|
|
2365
|
+
subscribe: (this: void, run: Subscriber<Pick<ComponentStoreValue, "reason" | "error" | "open" | "lastAction" | "mounted">>, invalidate?: ((value?: Pick<ComponentStoreValue, "reason" | "error" | "open" | "lastAction" | "mounted"> | undefined) => void) | undefined) => Unsubscriber;
|
|
2366
|
+
};
|
|
2367
|
+
configuration: (options?: WidgetConfigOptions | undefined) => {
|
|
2368
|
+
set(setOptions?: WidgetConfigOptions | undefined): void;
|
|
2369
|
+
};
|
|
2370
|
+
getStores: () => {
|
|
2371
|
+
journeyStore: JourneyStore;
|
|
2372
|
+
oauthStore: OAuthStore;
|
|
2373
|
+
userStore: UserStore;
|
|
2374
|
+
};
|
|
2375
|
+
journey: (options?: JourneyOptions | undefined) => {
|
|
2376
|
+
change: (changeOptions: JourneyOptionsChange) => Promise<unknown>;
|
|
2377
|
+
start: (startOptions?: JourneyOptionsStart | undefined) => Promise<unknown>;
|
|
2378
|
+
subscribe: (this: void, run: Subscriber<{
|
|
2379
|
+
journey: JourneyStoreValue;
|
|
2380
|
+
oauth: OAuthTokenStoreValue;
|
|
2381
|
+
user: UserStoreValue;
|
|
2382
|
+
}>, invalidate?: ((value?: {
|
|
2383
|
+
journey: JourneyStoreValue;
|
|
2384
|
+
oauth: OAuthTokenStoreValue;
|
|
2385
|
+
user: UserStoreValue;
|
|
2386
|
+
} | undefined) => void) | undefined) => Unsubscriber;
|
|
2387
|
+
};
|
|
2388
|
+
request: typeof HttpClient.request;
|
|
2389
|
+
user: {
|
|
2390
|
+
info(): {
|
|
2391
|
+
get: (options?: ConfigOptions | undefined) => Promise<unknown>;
|
|
2392
|
+
subscribe: (this: void, run: Subscriber<UserStoreValue>, invalidate?: ((value?: UserStoreValue | undefined) => void) | undefined) => Unsubscriber;
|
|
2393
|
+
};
|
|
2394
|
+
logout(): Promise<void>;
|
|
2395
|
+
tokens(): {
|
|
2396
|
+
get: (options?: ConfigOptions | undefined) => Promise<unknown>;
|
|
2397
|
+
subscribe: (this: void, run: Subscriber<OAuthTokenStoreValue>, invalidate?: ((value?: OAuthTokenStoreValue | undefined) => void) | undefined) => Unsubscriber;
|
|
2398
|
+
};
|
|
2399
|
+
};
|
|
2400
|
+
};
|
|
2401
|
+
declare const configuration: (options?: WidgetConfigOptions | undefined) => {
|
|
2402
|
+
set(setOptions?: WidgetConfigOptions | undefined): void;
|
|
2403
|
+
};
|
|
2404
|
+
declare const journey: (options?: JourneyOptions | undefined) => {
|
|
2405
|
+
change: (changeOptions: JourneyOptionsChange) => Promise<unknown>;
|
|
2406
|
+
start: (startOptions?: JourneyOptionsStart | undefined) => Promise<unknown>;
|
|
2407
|
+
subscribe: (this: void, run: Subscriber<{
|
|
2408
|
+
journey: JourneyStoreValue;
|
|
2409
|
+
oauth: OAuthTokenStoreValue;
|
|
2410
|
+
user: UserStoreValue;
|
|
2411
|
+
}>, invalidate?: ((value?: {
|
|
2412
|
+
journey: JourneyStoreValue;
|
|
2413
|
+
oauth: OAuthTokenStoreValue;
|
|
2414
|
+
user: UserStoreValue;
|
|
2415
|
+
} | undefined) => void) | undefined) => Unsubscriber;
|
|
2012
2416
|
};
|
|
2013
|
-
declare const
|
|
2014
|
-
close(args?: {
|
|
2015
|
-
reason:
|
|
2016
|
-
})
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
}) => void): void;
|
|
2020
|
-
onMount(fn: (dialog: HTMLDialogElement, form: HTMLFormElement) => void): void;
|
|
2021
|
-
open(options?: JourneyOptions): void;
|
|
2417
|
+
declare const component: () => {
|
|
2418
|
+
close: (args?: {
|
|
2419
|
+
reason: "auto" | "external" | "user";
|
|
2420
|
+
} | undefined) => void;
|
|
2421
|
+
open: () => void;
|
|
2422
|
+
subscribe: (this: void, run: Subscriber<Pick<ComponentStoreValue, "reason" | "error" | "open" | "lastAction" | "mounted">>, invalidate?: ((value?: Pick<ComponentStoreValue, "reason" | "error" | "open" | "lastAction" | "mounted"> | undefined) => void) | undefined) => Unsubscriber;
|
|
2022
2423
|
};
|
|
2023
|
-
declare const request:
|
|
2424
|
+
declare const request: typeof HttpClient.request;
|
|
2024
2425
|
declare const user: {
|
|
2025
|
-
|
|
2026
|
-
|
|
2426
|
+
info(): {
|
|
2427
|
+
get: (options?: ConfigOptions | undefined) => Promise<unknown>;
|
|
2428
|
+
subscribe: (this: void, run: Subscriber<UserStoreValue>, invalidate?: ((value?: UserStoreValue | undefined) => void) | undefined) => Unsubscriber;
|
|
2429
|
+
};
|
|
2027
2430
|
logout(): Promise<void>;
|
|
2028
|
-
tokens(
|
|
2431
|
+
tokens(): {
|
|
2432
|
+
get: (options?: ConfigOptions | undefined) => Promise<unknown>;
|
|
2433
|
+
subscribe: (this: void, run: Subscriber<OAuthTokenStoreValue>, invalidate?: ((value?: OAuthTokenStoreValue | undefined) => void) | undefined) => Unsubscriber;
|
|
2434
|
+
};
|
|
2029
2435
|
};
|
|
2030
|
-
|
|
2436
|
+
type ConfigurationApi = ReturnType<typeof api.configuration>;
|
|
2437
|
+
type JourneyApi = ReturnType<typeof api.journey>;
|
|
2438
|
+
type UserInfoApi = ReturnType<typeof api.user.info>;
|
|
2439
|
+
type UserTokensApi = ReturnType<typeof api.user.tokens>;
|
|
2031
2440
|
declare const __propDef: {
|
|
2032
2441
|
props: {
|
|
2033
|
-
|
|
2034
|
-
content: TypeOf<typeof partialStringsSchema>;
|
|
2035
|
-
journeys?: TypeOf<typeof journeyConfigSchema> | undefined;
|
|
2036
|
-
links?: TypeOf<typeof partialLinksSchema> | undefined;
|
|
2037
|
-
style?: Style | undefined;
|
|
2442
|
+
type?: "inline" | "modal" | undefined;
|
|
2038
2443
|
};
|
|
2039
2444
|
events: {
|
|
2040
|
-
'modal-mount': CustomEvent<any>;
|
|
2041
|
-
} & {
|
|
2042
2445
|
[evt: string]: CustomEvent<any>;
|
|
2043
2446
|
};
|
|
2044
2447
|
slots: {};
|
|
2045
2448
|
};
|
|
2046
|
-
type
|
|
2047
|
-
type
|
|
2048
|
-
type
|
|
2049
|
-
declare class
|
|
2449
|
+
type IndexProps = typeof __propDef.props;
|
|
2450
|
+
type IndexEvents = typeof __propDef.events;
|
|
2451
|
+
type IndexSlots = typeof __propDef.slots;
|
|
2452
|
+
declare class Index extends SvelteComponentTyped<IndexProps, IndexEvents, IndexSlots> {
|
|
2050
2453
|
}
|
|
2051
2454
|
|
|
2052
|
-
export {
|
|
2455
|
+
export { ConfigurationApi, IndexEvents, IndexProps, IndexSlots, JourneyApi, UserInfoApi, UserTokensApi, component, configuration, Index as default, journey, request, user };
|