@authhero/kysely-adapter 0.5.2 → 0.5.4

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.
@@ -374,6 +374,220 @@ declare const brandingSchema: z.ZodObject<{
374
374
  } | undefined;
375
375
  }>;
376
376
  export type Branding = z.infer<typeof brandingSchema>;
377
+ declare const PartialClientSchema: z.ZodObject<z.objectUtil.extendShape<{
378
+ id: z.ZodString;
379
+ name: z.ZodString;
380
+ domains: z.ZodArray<z.ZodObject<{
381
+ domain: z.ZodString;
382
+ dkim_private_key: z.ZodOptional<z.ZodString>;
383
+ dkim_public_key: z.ZodOptional<z.ZodString>;
384
+ email_api_key: z.ZodOptional<z.ZodString>;
385
+ email_service: z.ZodOptional<z.ZodUnion<[
386
+ z.ZodLiteral<"mailgun">,
387
+ z.ZodLiteral<"mailchannels">
388
+ ]>>;
389
+ }, "strip", z.ZodTypeAny, {
390
+ domain: string;
391
+ dkim_private_key?: string | undefined;
392
+ dkim_public_key?: string | undefined;
393
+ email_api_key?: string | undefined;
394
+ email_service?: "mailgun" | "mailchannels" | undefined;
395
+ }, {
396
+ domain: string;
397
+ dkim_private_key?: string | undefined;
398
+ dkim_public_key?: string | undefined;
399
+ email_api_key?: string | undefined;
400
+ email_service?: "mailgun" | "mailchannels" | undefined;
401
+ }>, "many">;
402
+ allowed_callback_urls: z.ZodArray<z.ZodString, "many">;
403
+ allowed_logout_urls: z.ZodArray<z.ZodString, "many">;
404
+ allowed_web_origins: z.ZodArray<z.ZodString, "many">;
405
+ email_validation: z.ZodUnion<[
406
+ z.ZodLiteral<"enabled">,
407
+ z.ZodLiteral<"disabled">,
408
+ z.ZodLiteral<"enforced">
409
+ ]>;
410
+ tenant_id: z.ZodString;
411
+ client_secret: z.ZodString;
412
+ disable_sign_ups: z.ZodBoolean;
413
+ tenant: z.ZodObject<{
414
+ name: z.ZodString;
415
+ audience: z.ZodOptional<z.ZodString>;
416
+ logo: z.ZodOptional<z.ZodString>;
417
+ primary_color: z.ZodOptional<z.ZodString>;
418
+ secondary_color: z.ZodOptional<z.ZodString>;
419
+ sender_email: z.ZodString;
420
+ sender_name: z.ZodString;
421
+ support_url: z.ZodOptional<z.ZodString>;
422
+ language: z.ZodOptional<z.ZodString>;
423
+ }, "strip", z.ZodTypeAny, {
424
+ name: string;
425
+ sender_email: string;
426
+ sender_name: string;
427
+ audience?: string | undefined;
428
+ logo?: string | undefined;
429
+ primary_color?: string | undefined;
430
+ secondary_color?: string | undefined;
431
+ support_url?: string | undefined;
432
+ language?: string | undefined;
433
+ }, {
434
+ name: string;
435
+ sender_email: string;
436
+ sender_name: string;
437
+ audience?: string | undefined;
438
+ logo?: string | undefined;
439
+ primary_color?: string | undefined;
440
+ secondary_color?: string | undefined;
441
+ support_url?: string | undefined;
442
+ language?: string | undefined;
443
+ }>;
444
+ }, {
445
+ connections: z.ZodArray<z.ZodObject<{
446
+ created_at: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
447
+ updated_at: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
448
+ id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
449
+ name: z.ZodOptional<z.ZodString>;
450
+ client_id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
451
+ client_secret: z.ZodOptional<z.ZodOptional<z.ZodString>>;
452
+ authorization_endpoint: z.ZodOptional<z.ZodOptional<z.ZodString>>;
453
+ response_type: z.ZodOptional<z.ZodOptional<z.ZodType<AuthorizationResponseType, z.ZodTypeDef, AuthorizationResponseType>>>;
454
+ response_mode: z.ZodOptional<z.ZodOptional<z.ZodType<AuthorizationResponseMode, z.ZodTypeDef, AuthorizationResponseMode>>>;
455
+ private_key: z.ZodOptional<z.ZodOptional<z.ZodString>>;
456
+ kid: z.ZodOptional<z.ZodOptional<z.ZodString>>;
457
+ team_id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
458
+ token_endpoint: z.ZodOptional<z.ZodOptional<z.ZodString>>;
459
+ token_exchange_basic_auth: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
460
+ userinfo_endpoint: z.ZodOptional<z.ZodOptional<z.ZodString>>;
461
+ scope: z.ZodOptional<z.ZodOptional<z.ZodString>>;
462
+ }, "strip", z.ZodTypeAny, {
463
+ created_at?: string | undefined;
464
+ updated_at?: string | undefined;
465
+ name?: string | undefined;
466
+ id?: string | undefined;
467
+ client_secret?: string | undefined;
468
+ client_id?: string | undefined;
469
+ response_type?: AuthorizationResponseType | undefined;
470
+ response_mode?: AuthorizationResponseMode | undefined;
471
+ scope?: string | undefined;
472
+ authorization_endpoint?: string | undefined;
473
+ private_key?: string | undefined;
474
+ kid?: string | undefined;
475
+ team_id?: string | undefined;
476
+ token_endpoint?: string | undefined;
477
+ token_exchange_basic_auth?: boolean | undefined;
478
+ userinfo_endpoint?: string | undefined;
479
+ }, {
480
+ created_at?: string | undefined;
481
+ updated_at?: string | undefined;
482
+ name?: string | undefined;
483
+ id?: string | undefined;
484
+ client_secret?: string | undefined;
485
+ client_id?: string | undefined;
486
+ response_type?: AuthorizationResponseType | undefined;
487
+ response_mode?: AuthorizationResponseMode | undefined;
488
+ scope?: string | undefined;
489
+ authorization_endpoint?: string | undefined;
490
+ private_key?: string | undefined;
491
+ kid?: string | undefined;
492
+ team_id?: string | undefined;
493
+ token_endpoint?: string | undefined;
494
+ token_exchange_basic_auth?: boolean | undefined;
495
+ userinfo_endpoint?: string | undefined;
496
+ }>, "many">;
497
+ }>, "strip", z.ZodTypeAny, {
498
+ name: string;
499
+ id: string;
500
+ allowed_web_origins: string[];
501
+ allowed_callback_urls: string[];
502
+ allowed_logout_urls: string[];
503
+ email_validation: "enabled" | "disabled" | "enforced";
504
+ client_secret: string;
505
+ disable_sign_ups: boolean;
506
+ domains: {
507
+ domain: string;
508
+ dkim_private_key?: string | undefined;
509
+ dkim_public_key?: string | undefined;
510
+ email_api_key?: string | undefined;
511
+ email_service?: "mailgun" | "mailchannels" | undefined;
512
+ }[];
513
+ tenant_id: string;
514
+ tenant: {
515
+ name: string;
516
+ sender_email: string;
517
+ sender_name: string;
518
+ audience?: string | undefined;
519
+ logo?: string | undefined;
520
+ primary_color?: string | undefined;
521
+ secondary_color?: string | undefined;
522
+ support_url?: string | undefined;
523
+ language?: string | undefined;
524
+ };
525
+ connections: {
526
+ created_at?: string | undefined;
527
+ updated_at?: string | undefined;
528
+ name?: string | undefined;
529
+ id?: string | undefined;
530
+ client_secret?: string | undefined;
531
+ client_id?: string | undefined;
532
+ response_type?: AuthorizationResponseType | undefined;
533
+ response_mode?: AuthorizationResponseMode | undefined;
534
+ scope?: string | undefined;
535
+ authorization_endpoint?: string | undefined;
536
+ private_key?: string | undefined;
537
+ kid?: string | undefined;
538
+ team_id?: string | undefined;
539
+ token_endpoint?: string | undefined;
540
+ token_exchange_basic_auth?: boolean | undefined;
541
+ userinfo_endpoint?: string | undefined;
542
+ }[];
543
+ }, {
544
+ name: string;
545
+ id: string;
546
+ allowed_web_origins: string[];
547
+ allowed_callback_urls: string[];
548
+ allowed_logout_urls: string[];
549
+ email_validation: "enabled" | "disabled" | "enforced";
550
+ client_secret: string;
551
+ disable_sign_ups: boolean;
552
+ domains: {
553
+ domain: string;
554
+ dkim_private_key?: string | undefined;
555
+ dkim_public_key?: string | undefined;
556
+ email_api_key?: string | undefined;
557
+ email_service?: "mailgun" | "mailchannels" | undefined;
558
+ }[];
559
+ tenant_id: string;
560
+ tenant: {
561
+ name: string;
562
+ sender_email: string;
563
+ sender_name: string;
564
+ audience?: string | undefined;
565
+ logo?: string | undefined;
566
+ primary_color?: string | undefined;
567
+ secondary_color?: string | undefined;
568
+ support_url?: string | undefined;
569
+ language?: string | undefined;
570
+ };
571
+ connections: {
572
+ created_at?: string | undefined;
573
+ updated_at?: string | undefined;
574
+ name?: string | undefined;
575
+ id?: string | undefined;
576
+ client_secret?: string | undefined;
577
+ client_id?: string | undefined;
578
+ response_type?: AuthorizationResponseType | undefined;
579
+ response_mode?: AuthorizationResponseMode | undefined;
580
+ scope?: string | undefined;
581
+ authorization_endpoint?: string | undefined;
582
+ private_key?: string | undefined;
583
+ kid?: string | undefined;
584
+ team_id?: string | undefined;
585
+ token_endpoint?: string | undefined;
586
+ token_exchange_basic_auth?: boolean | undefined;
587
+ userinfo_endpoint?: string | undefined;
588
+ }[];
589
+ }>;
590
+ export type PartialClient = z.infer<typeof PartialClientSchema>;
377
591
  declare const codeTypeSchema: z.ZodEnum<[
378
592
  "password_reset",
379
593
  "email_verification",
@@ -596,6 +810,188 @@ declare const hookSchema: z.ZodObject<z.objectUtil.extendShape<{
596
810
  enabled?: boolean | undefined;
597
811
  }>;
598
812
  export type Hook = z.infer<typeof hookSchema>;
813
+ declare const loginInsertSchema: z.ZodObject<{
814
+ login_id: z.ZodString;
815
+ auth0Client: z.ZodOptional<z.ZodString>;
816
+ authParams: z.ZodObject<{
817
+ client_id: z.ZodString;
818
+ vendor_id: z.ZodOptional<z.ZodString>;
819
+ response_type: z.ZodOptional<z.ZodNativeEnum<typeof AuthorizationResponseType>>;
820
+ response_mode: z.ZodOptional<z.ZodNativeEnum<typeof AuthorizationResponseMode>>;
821
+ redirect_uri: z.ZodOptional<z.ZodString>;
822
+ audience: z.ZodOptional<z.ZodString>;
823
+ state: z.ZodOptional<z.ZodString>;
824
+ nonce: z.ZodOptional<z.ZodString>;
825
+ scope: z.ZodOptional<z.ZodString>;
826
+ code_challenge_method: z.ZodOptional<z.ZodNativeEnum<typeof CodeChallengeMethod>>;
827
+ code_challenge: z.ZodOptional<z.ZodString>;
828
+ username: z.ZodOptional<z.ZodString>;
829
+ }, "strip", z.ZodTypeAny, {
830
+ client_id: string;
831
+ username?: string | undefined;
832
+ vendor_id?: string | undefined;
833
+ response_type?: AuthorizationResponseType | undefined;
834
+ response_mode?: AuthorizationResponseMode | undefined;
835
+ redirect_uri?: string | undefined;
836
+ audience?: string | undefined;
837
+ state?: string | undefined;
838
+ nonce?: string | undefined;
839
+ scope?: string | undefined;
840
+ code_challenge_method?: CodeChallengeMethod | undefined;
841
+ code_challenge?: string | undefined;
842
+ }, {
843
+ client_id: string;
844
+ username?: string | undefined;
845
+ vendor_id?: string | undefined;
846
+ response_type?: AuthorizationResponseType | undefined;
847
+ response_mode?: AuthorizationResponseMode | undefined;
848
+ redirect_uri?: string | undefined;
849
+ audience?: string | undefined;
850
+ state?: string | undefined;
851
+ nonce?: string | undefined;
852
+ scope?: string | undefined;
853
+ code_challenge_method?: CodeChallengeMethod | undefined;
854
+ code_challenge?: string | undefined;
855
+ }>;
856
+ expires_at: z.ZodString;
857
+ deleted_at: z.ZodString;
858
+ ip: z.ZodOptional<z.ZodString>;
859
+ }, "strip", z.ZodTypeAny, {
860
+ login_id: string;
861
+ expires_at: string;
862
+ authParams: {
863
+ client_id: string;
864
+ username?: string | undefined;
865
+ vendor_id?: string | undefined;
866
+ response_type?: AuthorizationResponseType | undefined;
867
+ response_mode?: AuthorizationResponseMode | undefined;
868
+ redirect_uri?: string | undefined;
869
+ audience?: string | undefined;
870
+ state?: string | undefined;
871
+ nonce?: string | undefined;
872
+ scope?: string | undefined;
873
+ code_challenge_method?: CodeChallengeMethod | undefined;
874
+ code_challenge?: string | undefined;
875
+ };
876
+ deleted_at: string;
877
+ auth0Client?: string | undefined;
878
+ ip?: string | undefined;
879
+ }, {
880
+ login_id: string;
881
+ expires_at: string;
882
+ authParams: {
883
+ client_id: string;
884
+ username?: string | undefined;
885
+ vendor_id?: string | undefined;
886
+ response_type?: AuthorizationResponseType | undefined;
887
+ response_mode?: AuthorizationResponseMode | undefined;
888
+ redirect_uri?: string | undefined;
889
+ audience?: string | undefined;
890
+ state?: string | undefined;
891
+ nonce?: string | undefined;
892
+ scope?: string | undefined;
893
+ code_challenge_method?: CodeChallengeMethod | undefined;
894
+ code_challenge?: string | undefined;
895
+ };
896
+ deleted_at: string;
897
+ auth0Client?: string | undefined;
898
+ ip?: string | undefined;
899
+ }>;
900
+ export type LoginInsert = z.infer<typeof loginInsertSchema>;
901
+ declare const loginSchema: z.ZodObject<{
902
+ created_at: z.ZodString;
903
+ updated_at: z.ZodString;
904
+ login_id: z.ZodString;
905
+ auth0Client: z.ZodOptional<z.ZodString>;
906
+ authParams: z.ZodObject<{
907
+ client_id: z.ZodString;
908
+ vendor_id: z.ZodOptional<z.ZodString>;
909
+ response_type: z.ZodOptional<z.ZodNativeEnum<typeof AuthorizationResponseType>>;
910
+ response_mode: z.ZodOptional<z.ZodNativeEnum<typeof AuthorizationResponseMode>>;
911
+ redirect_uri: z.ZodOptional<z.ZodString>;
912
+ audience: z.ZodOptional<z.ZodString>;
913
+ state: z.ZodOptional<z.ZodString>;
914
+ nonce: z.ZodOptional<z.ZodString>;
915
+ scope: z.ZodOptional<z.ZodString>;
916
+ code_challenge_method: z.ZodOptional<z.ZodNativeEnum<typeof CodeChallengeMethod>>;
917
+ code_challenge: z.ZodOptional<z.ZodString>;
918
+ username: z.ZodOptional<z.ZodString>;
919
+ }, "strip", z.ZodTypeAny, {
920
+ client_id: string;
921
+ username?: string | undefined;
922
+ vendor_id?: string | undefined;
923
+ response_type?: AuthorizationResponseType | undefined;
924
+ response_mode?: AuthorizationResponseMode | undefined;
925
+ redirect_uri?: string | undefined;
926
+ audience?: string | undefined;
927
+ state?: string | undefined;
928
+ nonce?: string | undefined;
929
+ scope?: string | undefined;
930
+ code_challenge_method?: CodeChallengeMethod | undefined;
931
+ code_challenge?: string | undefined;
932
+ }, {
933
+ client_id: string;
934
+ username?: string | undefined;
935
+ vendor_id?: string | undefined;
936
+ response_type?: AuthorizationResponseType | undefined;
937
+ response_mode?: AuthorizationResponseMode | undefined;
938
+ redirect_uri?: string | undefined;
939
+ audience?: string | undefined;
940
+ state?: string | undefined;
941
+ nonce?: string | undefined;
942
+ scope?: string | undefined;
943
+ code_challenge_method?: CodeChallengeMethod | undefined;
944
+ code_challenge?: string | undefined;
945
+ }>;
946
+ expires_at: z.ZodString;
947
+ deleted_at: z.ZodString;
948
+ ip: z.ZodOptional<z.ZodString>;
949
+ }, "strip", z.ZodTypeAny, {
950
+ created_at: string;
951
+ updated_at: string;
952
+ login_id: string;
953
+ expires_at: string;
954
+ authParams: {
955
+ client_id: string;
956
+ username?: string | undefined;
957
+ vendor_id?: string | undefined;
958
+ response_type?: AuthorizationResponseType | undefined;
959
+ response_mode?: AuthorizationResponseMode | undefined;
960
+ redirect_uri?: string | undefined;
961
+ audience?: string | undefined;
962
+ state?: string | undefined;
963
+ nonce?: string | undefined;
964
+ scope?: string | undefined;
965
+ code_challenge_method?: CodeChallengeMethod | undefined;
966
+ code_challenge?: string | undefined;
967
+ };
968
+ deleted_at: string;
969
+ auth0Client?: string | undefined;
970
+ ip?: string | undefined;
971
+ }, {
972
+ created_at: string;
973
+ updated_at: string;
974
+ login_id: string;
975
+ expires_at: string;
976
+ authParams: {
977
+ client_id: string;
978
+ username?: string | undefined;
979
+ vendor_id?: string | undefined;
980
+ response_type?: AuthorizationResponseType | undefined;
981
+ response_mode?: AuthorizationResponseMode | undefined;
982
+ redirect_uri?: string | undefined;
983
+ audience?: string | undefined;
984
+ state?: string | undefined;
985
+ nonce?: string | undefined;
986
+ scope?: string | undefined;
987
+ code_challenge_method?: CodeChallengeMethod | undefined;
988
+ code_challenge?: string | undefined;
989
+ };
990
+ deleted_at: string;
991
+ auth0Client?: string | undefined;
992
+ ip?: string | undefined;
993
+ }>;
994
+ export type Login = z.infer<typeof loginSchema>;
599
995
  declare const LogType: z.ZodEnum<[
600
996
  "sapi",
601
997
  "ssa",
@@ -2307,12 +2703,42 @@ export interface HooksAdapter {
2307
2703
  update: (tenant_id: string, hook_id: string, hook: Partial<HookInsert>) => Promise<boolean>;
2308
2704
  list: (tenant_id: string, params: ListParams) => Promise<ListHooksResponse>;
2309
2705
  }
2706
+ export interface ClientsAdapter {
2707
+ get: (id: string) => Promise<PartialClient | null>;
2708
+ }
2310
2709
  export interface ThemesAdapter {
2311
2710
  create: (tenant_id: string, theme: ThemeInsert) => Promise<Theme>;
2312
2711
  remove: (tenant_id: string, themeId: string) => Promise<boolean>;
2313
2712
  get: (tenant_id: string, themeId: string) => Promise<Theme | null>;
2314
2713
  update: (tenant_id: string, themeId: any, theme: Partial<ThemeInsert>) => Promise<boolean>;
2315
2714
  }
2715
+ export interface LoginsAdapter {
2716
+ create: (tenant_id: string, session: LoginInsert) => Promise<Login>;
2717
+ update: (tenant_id: string, login_id: string, session: Partial<Login>) => Promise<boolean>;
2718
+ get: (tenant_id: string, login_id: string) => Promise<Login | null>;
2719
+ remove: (tenant_id: string, login_id: string) => Promise<boolean>;
2720
+ }
2721
+ export interface DataAdapters {
2722
+ applications: ApplicationsAdapter;
2723
+ authenticationCodes: AuthenticationCodesAdapter;
2724
+ branding: BrandingAdapter;
2725
+ clients: ClientsAdapter;
2726
+ codes: CodesAdapter;
2727
+ connections: ConnectionsAdapter;
2728
+ domains: DomainsAdapter;
2729
+ hooks: HooksAdapter;
2730
+ keys: KeysAdapter;
2731
+ login: LoginsAdapter;
2732
+ logs: LogsDataAdapter;
2733
+ OTP: OTPAdapter;
2734
+ passwords: PasswordsAdapter;
2735
+ sessions: SessionsAdapter;
2736
+ tenants: TenantsDataAdapter;
2737
+ themes: ThemesAdapter;
2738
+ tickets: TicketsAdapter;
2739
+ universalLoginSessions: UniversalLoginSessionsAdapter;
2740
+ users: UserDataAdapter;
2741
+ }
2316
2742
  export interface SqlAuthenticationCode {
2317
2743
  code: string;
2318
2744
  tenant_id: string;
@@ -2471,74 +2897,7 @@ export interface Database {
2471
2897
  tickets: SqlTicket;
2472
2898
  universal_login_sessions: SqlUniversalLoginSession;
2473
2899
  }
2474
- declare function createAdapters(db: Kysely<Database>): {
2475
- applications: ApplicationsAdapter;
2476
- authenticationCodes: AuthenticationCodesAdapter;
2477
- branding: BrandingAdapter;
2478
- clients: {
2479
- get: (applicationId: string) => Promise<{
2480
- name: string;
2481
- id: string;
2482
- allowed_web_origins: string[];
2483
- allowed_callback_urls: string[];
2484
- allowed_logout_urls: string[];
2485
- email_validation: "enabled" | "disabled" | "enforced";
2486
- client_secret: string;
2487
- disable_sign_ups: boolean;
2488
- domains: {
2489
- domain: string;
2490
- dkim_private_key?: string | undefined;
2491
- dkim_public_key?: string | undefined;
2492
- email_api_key?: string | undefined;
2493
- email_service?: "mailgun" | "mailchannels" | undefined;
2494
- }[];
2495
- tenant_id: string;
2496
- tenant: {
2497
- name: string;
2498
- sender_email: string;
2499
- sender_name: string;
2500
- audience?: string | undefined;
2501
- logo?: string | undefined;
2502
- primary_color?: string | undefined;
2503
- secondary_color?: string | undefined;
2504
- support_url?: string | undefined;
2505
- language?: string | undefined;
2506
- };
2507
- connections: {
2508
- created_at?: string | undefined;
2509
- updated_at?: string | undefined;
2510
- name?: string | undefined;
2511
- id?: string | undefined;
2512
- client_secret?: string | undefined;
2513
- client_id?: string | undefined;
2514
- response_type?: AuthorizationResponseType | undefined;
2515
- response_mode?: AuthorizationResponseMode | undefined;
2516
- scope?: string | undefined;
2517
- authorization_endpoint?: string | undefined;
2518
- private_key?: string | undefined;
2519
- kid?: string | undefined;
2520
- team_id?: string | undefined;
2521
- token_endpoint?: string | undefined;
2522
- token_exchange_basic_auth?: boolean | undefined;
2523
- userinfo_endpoint?: string | undefined;
2524
- }[];
2525
- } | null>;
2526
- };
2527
- codes: CodesAdapter;
2528
- connections: ConnectionsAdapter;
2529
- domains: DomainsAdapter;
2530
- hooks: HooksAdapter;
2531
- keys: KeysAdapter;
2532
- logs: LogsDataAdapter;
2533
- OTP: OTPAdapter;
2534
- passwords: PasswordsAdapter;
2535
- users: UserDataAdapter;
2536
- sessions: SessionsAdapter;
2537
- tenants: TenantsDataAdapter;
2538
- themes: ThemesAdapter;
2539
- tickets: TicketsAdapter;
2540
- universalLoginSessions: UniversalLoginSessionsAdapter;
2541
- };
2900
+ declare function createAdapters(db: Kysely<Database>): DataAdapters;
2542
2901
 
2543
2902
  export {
2544
2903
  createAdapters as default,