@gatwech/core 0.0.11 → 1.0.0-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/api/index.d.mts +2 -2
  2. package/dist/context/index.d.mts +2 -2
  3. package/dist/db/adapter/index.d.mts +2 -2
  4. package/dist/db/index.d.mts +2 -2
  5. package/dist/env/index.d.mts +1 -1
  6. package/dist/env/index.mjs +1 -1
  7. package/dist/{env-JMSMESs1.mjs → env-ubiqEEZm.mjs} +10 -9
  8. package/dist/error/index.mjs +2 -2
  9. package/dist/{error-41YsFQ8b.mjs → error-DKIIiFmH.mjs} +1 -1
  10. package/dist/{index-DLP-K0uY.d.mts → index-CNtOUpmF.d.mts} +4 -3
  11. package/dist/index-Df0KhQRf.d.mts +3002 -0
  12. package/dist/index.d.mts +3 -3
  13. package/dist/oauth2/index.d.mts +2 -2
  14. package/dist/social-providers/index.d.mts +3 -3
  15. package/dist/social-providers/index.mjs +73 -2414
  16. package/dist/src/api/index.d.ts +119 -0
  17. package/dist/src/async_hooks/index.d.ts +6 -0
  18. package/dist/src/context/endpoint-context.d.ts +14 -0
  19. package/dist/src/context/index.d.ts +3 -0
  20. package/dist/src/context/request-state.d.ts +13 -0
  21. package/dist/src/context/transaction.d.ts +11 -0
  22. package/dist/src/db/adapter/index.d.ts +401 -0
  23. package/{src/db/index.ts → dist/src/db/index.d.ts} +2 -18
  24. package/dist/src/db/plugin.d.ts +10 -0
  25. package/dist/src/db/schema/account.d.ts +22 -0
  26. package/dist/src/db/schema/rate-limit.d.ts +10 -0
  27. package/dist/src/db/schema/session.d.ts +17 -0
  28. package/dist/src/db/schema/shared.d.ts +6 -0
  29. package/dist/src/db/schema/user.d.ts +16 -0
  30. package/{src/db/schema/verification.ts → dist/src/db/schema/verification.d.ts} +8 -8
  31. package/dist/src/db/type.d.ts +159 -0
  32. package/dist/src/env/color-depth.d.ts +1 -0
  33. package/dist/src/env/env-impl.d.ts +29 -0
  34. package/dist/src/env/index.d.ts +3 -0
  35. package/dist/src/env/logger.d.ts +52 -0
  36. package/dist/src/error/codes.d.ts +27 -0
  37. package/dist/src/error/index.d.ts +4 -0
  38. package/dist/src/oauth2/client-credentials-token.d.ts +21 -0
  39. package/dist/src/oauth2/create-authorization-url.d.ts +21 -0
  40. package/dist/src/oauth2/index.d.ts +6 -0
  41. package/dist/src/oauth2/oauth-provider.d.ts +178 -0
  42. package/dist/src/oauth2/refresh-access-token.d.ts +20 -0
  43. package/dist/src/oauth2/utils.d.ts +3 -0
  44. package/dist/src/oauth2/validate-authorization-code.d.ts +28 -0
  45. package/dist/src/social-providers/github.d.ts +89 -0
  46. package/dist/src/social-providers/google.d.ts +82 -0
  47. package/dist/src/social-providers/index.d.ts +93 -0
  48. package/dist/src/types/context.d.ts +177 -0
  49. package/dist/src/types/cookie.d.ts +15 -0
  50. package/dist/src/types/helper.d.ts +9 -0
  51. package/dist/src/types/index.d.ts +7 -0
  52. package/dist/src/types/init-options.d.ts +1140 -0
  53. package/dist/src/types/plugin-client.d.ts +88 -0
  54. package/dist/src/types/plugin.d.ts +120 -0
  55. package/dist/src/utils/error-codes.d.ts +9 -0
  56. package/dist/utils/index.mjs +1 -1
  57. package/package.json +11 -5
  58. package/.turbo/turbo-build.log +0 -42
  59. package/dist/index-DjrJweYn.d.mts +0 -7312
  60. package/src/api/index.ts +0 -57
  61. package/src/async_hooks/index.ts +0 -35
  62. package/src/context/endpoint-context.ts +0 -48
  63. package/src/context/index.ts +0 -21
  64. package/src/context/request-state.test.ts +0 -346
  65. package/src/context/request-state.ts +0 -75
  66. package/src/context/transaction.ts +0 -72
  67. package/src/db/adapter/index.ts +0 -466
  68. package/src/db/plugin.ts +0 -11
  69. package/src/db/schema/account.ts +0 -34
  70. package/src/db/schema/rate-limit.ts +0 -21
  71. package/src/db/schema/session.ts +0 -17
  72. package/src/db/schema/shared.ts +0 -7
  73. package/src/db/schema/user.ts +0 -16
  74. package/src/db/type.ts +0 -180
  75. package/src/env/color-depth.ts +0 -172
  76. package/src/env/env-impl.ts +0 -124
  77. package/src/env/index.ts +0 -23
  78. package/src/env/logger.test.ts +0 -33
  79. package/src/env/logger.ts +0 -145
  80. package/src/error/codes.ts +0 -31
  81. package/src/error/index.ts +0 -11
  82. package/src/oauth2/client-credentials-token.ts +0 -102
  83. package/src/oauth2/create-authorization-url.ts +0 -85
  84. package/src/oauth2/index.ts +0 -21
  85. package/src/oauth2/oauth-provider.ts +0 -211
  86. package/src/oauth2/refresh-access-token.ts +0 -124
  87. package/src/oauth2/utils.ts +0 -36
  88. package/src/oauth2/validate-authorization-code.ts +0 -154
  89. package/src/social-providers/apple.ts +0 -213
  90. package/src/social-providers/atlassian.ts +0 -132
  91. package/src/social-providers/cognito.ts +0 -269
  92. package/src/social-providers/discord.ts +0 -169
  93. package/src/social-providers/dropbox.ts +0 -112
  94. package/src/social-providers/facebook.ts +0 -204
  95. package/src/social-providers/figma.ts +0 -115
  96. package/src/social-providers/github.ts +0 -154
  97. package/src/social-providers/gitlab.ts +0 -152
  98. package/src/social-providers/google.ts +0 -171
  99. package/src/social-providers/huggingface.ts +0 -118
  100. package/src/social-providers/index.ts +0 -124
  101. package/src/social-providers/kakao.ts +0 -178
  102. package/src/social-providers/kick.ts +0 -92
  103. package/src/social-providers/line.ts +0 -169
  104. package/src/social-providers/linear.ts +0 -120
  105. package/src/social-providers/linkedin.ts +0 -110
  106. package/src/social-providers/microsoft-entra-id.ts +0 -245
  107. package/src/social-providers/naver.ts +0 -112
  108. package/src/social-providers/notion.ts +0 -108
  109. package/src/social-providers/paybin.ts +0 -122
  110. package/src/social-providers/paypal.ts +0 -263
  111. package/src/social-providers/polar.ts +0 -107
  112. package/src/social-providers/reddit.ts +0 -122
  113. package/src/social-providers/roblox.ts +0 -110
  114. package/src/social-providers/salesforce.ts +0 -159
  115. package/src/social-providers/slack.ts +0 -111
  116. package/src/social-providers/spotify.ts +0 -93
  117. package/src/social-providers/tiktok.ts +0 -210
  118. package/src/social-providers/twitch.ts +0 -111
  119. package/src/social-providers/twitter.ts +0 -198
  120. package/src/social-providers/vk.ts +0 -126
  121. package/src/social-providers/zoom.ts +0 -217
  122. package/src/types/context.ts +0 -269
  123. package/src/types/cookie.ts +0 -7
  124. package/src/types/helper.ts +0 -6
  125. package/src/types/index.ts +0 -21
  126. package/src/types/init-options.ts +0 -1346
  127. package/src/types/plugin-client.ts +0 -100
  128. package/src/types/plugin.ts +0 -158
  129. package/src/utils/error-codes.ts +0 -51
  130. package/tsconfig.json +0 -7
  131. package/tsdown.config.ts +0 -20
  132. /package/{src/index.ts → dist/src/index.d.ts} +0 -0
  133. /package/{src/utils/index.ts → dist/src/utils/index.d.ts} +0 -0
  134. /package/dist/{utils-BFQCAfNW.mjs → utils-CTOwq_Nj.mjs} +0 -0
@@ -1,217 +0,0 @@
1
- import { betterFetch } from "@better-fetch/fetch";
2
- import type { OAuthProvider, ProviderOptions } from "../oauth2";
3
- import { generateCodeChallenge, validateAuthorizationCode } from "../oauth2";
4
-
5
- export type LoginType =
6
- | 0 /** Facebook OAuth */
7
- | 1 /** Google OAuth */
8
- | 24 /** Apple OAuth */
9
- | 27 /** Microsoft OAuth */
10
- | 97 /** Mobile device */
11
- | 98 /** RingCentral OAuth */
12
- | 99 /** API user */
13
- | 100 /** Zoom Work email */
14
- | 101; /** Single Sign-On (SSO) */
15
-
16
- export type AccountStatus = "pending" | "active" | "inactive";
17
-
18
- export type PronounOption =
19
- | 1 /** Ask the user every time */
20
- | 2 /** Always display */
21
- | 3; /** Do not display */
22
-
23
- export interface PhoneNumber {
24
- /** The country code of the phone number (Example: "+1") */
25
- code: string;
26
-
27
- /** The country of the phone number (Example: "US") */
28
- country: string;
29
-
30
- /** The label for the phone number (Example: "Mobile") */
31
- label: string;
32
-
33
- /** The phone number itself (Example: "800000000") */
34
- number: string;
35
-
36
- /** Whether the phone number has been verified (Example: true) */
37
- verified: boolean;
38
- }
39
-
40
- /**
41
- * See the full documentation below:
42
- * https://developers.zoom.us/docs/api/users/#tag/users/GET/users/{userId}
43
- */
44
- export interface ZoomProfile extends Record<string, any> {
45
- /** The user's account ID (Example: "q6gBJVO5TzexKYTb_I2rpg") */
46
- account_id: string;
47
- /** The user's account number (Example: 10009239) */
48
- account_number: number;
49
- /** The user's cluster (Example: "us04") */
50
- cluster: string;
51
- /** The user's CMS ID. Only enabled for Kaltura integration (Example: "KDcuGIm1QgePTO8WbOqwIQ") */
52
- cms_user_id: string;
53
- /** The user's cost center (Example: "cost center") */
54
- cost_center: string;
55
- /** User create time (Example: "2018-10-31T04:32:37Z") */
56
- created_at: string;
57
- /** Department (Example: "Developers") */
58
- dept: string;
59
- /** User's display name (Example: "Jill Chill") */
60
- display_name: string;
61
- /** User's email address (Example: "jchill@example.com") */
62
- email: string;
63
- /** User's first name (Example: "Jill") */
64
- first_name: string;
65
- /** IDs of the web groups that the user belongs to (Example: ["RSMaSp8sTEGK0_oamiA2_w"]) */
66
- group_ids: string[];
67
- /** User ID (Example: "zJKyaiAyTNC-MWjiWC18KQ") */
68
- id: string;
69
- /** IM IDs of the groups that the user belongs to (Example: ["t-_-d56CSWG-7BF15LLrOw"]) */
70
- im_group_ids: string[];
71
- /** The user's JID (Example: "jchill@example.com") */
72
- jid: string;
73
- /** The user's job title (Example: "API Developer") */
74
- job_title: string;
75
- /** Default language for the Zoom Web Portal (Example: "en-US") */
76
- language: string;
77
- /** User last login client version (Example: "5.9.6.4993(mac)") */
78
- last_client_version: string;
79
- /** User last login time (Example: "2021-05-05T20:40:30Z") */
80
- last_login_time: string;
81
- /** User's last name (Example: "Chill") */
82
- last_name: string;
83
- /** The time zone of the user (Example: "Asia/Shanghai") */
84
- timezone: string;
85
- /** User's location (Example: "Paris") */
86
- location: string;
87
- /** The user's login method (Example: 101) */
88
- login_types: LoginType[];
89
- /** User's personal meeting URL (Example: "example.com") */
90
- personal_meeting_url: string;
91
- /** This field has been deprecated and will not be supported in the future.
92
- * Use the phone_numbers field instead of this field.
93
- * The user's phone number (Example: "+1 800000000") */
94
- // @deprecated true
95
- phone_number?: string | undefined;
96
- /** The URL for user's profile picture (Example: "example.com") */
97
- pic_url: string;
98
- /** Personal Meeting ID (PMI) (Example: 3542471135) */
99
- pmi: number;
100
- /** Unique identifier of the user's assigned role (Example: "0") */
101
- role_id: string;
102
- /** User's role name (Example: "Admin") */
103
- role_name: string;
104
- /** Status of user's account (Example: "pending") */
105
- status: AccountStatus;
106
- /** Use the personal meeting ID (PMI) for instant meetings (Example: false) */
107
- use_pmi: boolean;
108
- /** The time and date when the user was created (Example: "2018-10-31T04:32:37Z") */
109
- user_created_at: string;
110
- /** Displays whether user is verified or not (Example: 1) */
111
- verified: number;
112
- /** The user's Zoom Workplace plan option (Example: 64) */
113
- zoom_one_type: number;
114
- /** The user's company (Example: "Jill") */
115
- company?: string | undefined;
116
- /** Custom attributes that have been assigned to the user (Example: [{ "key": "cbf_cywdkexrtqc73f97gd4w6g", "name": "A1", "value": "1" }]) */
117
- custom_attributes?:
118
- | { key: string; name: string; value: string }[]
119
- | undefined;
120
- /** The employee's unique ID. This field only returns when SAML single sign-on (SSO) is enabled.
121
- * The `login_type` value is `101` (SSO) (Example: "HqDyI037Qjili1kNsSIrIg") */
122
- employee_unique_id?: string | undefined;
123
- /** The manager for the user (Example: "thill@example.com") */
124
- manager?: string | undefined;
125
- /** The user's country for the company phone number (Example: "US")
126
- * @deprecated true */
127
- phone_country?: string | undefined;
128
- /** The phone number's ISO country code (Example: "+1") */
129
- phone_numbers?: PhoneNumber[] | undefined;
130
- /** The user's plan type (Example: "1") */
131
- plan_united_type?: string | undefined;
132
- /** The user's pronouns (Example: "3123") */
133
- pronouns?: string | undefined;
134
- /** The user's display pronouns setting (Example: 1) */
135
- pronouns_option?: PronounOption | undefined;
136
- /** Personal meeting room URL, if the user has one (Example: "example.com") */
137
- vanity_url?: string | undefined;
138
- }
139
-
140
- export interface ZoomOptions extends ProviderOptions<ZoomProfile> {
141
- clientId: string;
142
- pkce?: boolean | undefined;
143
- }
144
-
145
- export const zoom = (userOptions: ZoomOptions) => {
146
- const options = {
147
- pkce: true,
148
- ...userOptions,
149
- };
150
-
151
- return {
152
- id: "zoom",
153
- name: "Zoom",
154
- createAuthorizationURL: async ({ state, redirectURI, codeVerifier }) => {
155
- const params = new URLSearchParams({
156
- response_type: "code",
157
- redirect_uri: options.redirectURI ? options.redirectURI : redirectURI,
158
- client_id: options.clientId,
159
- state,
160
- });
161
-
162
- if (options.pkce) {
163
- const codeChallenge = await generateCodeChallenge(codeVerifier);
164
- params.set("code_challenge_method", "S256");
165
- params.set("code_challenge", codeChallenge);
166
- }
167
-
168
- const url = new URL("https://zoom.us/oauth/authorize");
169
- url.search = params.toString();
170
-
171
- return url;
172
- },
173
- validateAuthorizationCode: async ({ code, redirectURI, codeVerifier }) => {
174
- return validateAuthorizationCode({
175
- code,
176
- redirectURI: options.redirectURI || redirectURI,
177
- codeVerifier,
178
- options,
179
- tokenEndpoint: "https://zoom.us/oauth/token",
180
- authentication: "post",
181
- });
182
- },
183
- async getUserInfo(token) {
184
- if (options.getUserInfo) {
185
- return options.getUserInfo(token);
186
- }
187
- const { data: profile, error } = await betterFetch<ZoomProfile>(
188
- "https://api.zoom.us/v2/users/me",
189
- {
190
- headers: {
191
- authorization: `Bearer ${token.accessToken}`,
192
- },
193
- },
194
- );
195
-
196
- if (error) {
197
- return null;
198
- }
199
-
200
- const userMap = await options.mapProfileToUser?.(profile);
201
-
202
- return {
203
- user: {
204
- id: profile.id,
205
- name: profile.display_name,
206
- image: profile.pic_url,
207
- email: profile.email,
208
- emailVerified: Boolean(profile.verified),
209
- ...userMap,
210
- },
211
- data: {
212
- ...profile,
213
- },
214
- };
215
- },
216
- } satisfies OAuthProvider<ZoomProfile>;
217
- };
@@ -1,269 +0,0 @@
1
- import type { CookieOptions, EndpointContext } from "better-call";
2
- import type {
3
- Account,
4
- PayvoAuthDBSchema,
5
- DBPreservedModels,
6
- SecondaryStorage,
7
- Session,
8
- User,
9
- Verification,
10
- } from "../db";
11
- import type { DBAdapter, Where } from "../db/adapter";
12
- import { createLogger } from "../env";
13
- import type { OAuthProvider } from "../oauth2";
14
- import type { PayvoAuthCookies } from "./cookie";
15
- import type { LiteralUnion } from "./helper";
16
- import type {
17
- PayvoAuthOptions,
18
- PayvoAuthRateLimitOptions,
19
- } from "./init-options";
20
-
21
- export type GenericEndpointContext<
22
- Options extends PayvoAuthOptions = PayvoAuthOptions,
23
- > = EndpointContext<string, any> & {
24
- context: AuthContext<Options>;
25
- };
26
-
27
- export interface InternalAdapter<
28
- Options extends PayvoAuthOptions = PayvoAuthOptions,
29
- > {
30
- createOAuthUser(
31
- user: Omit<User, "id" | "createdAt" | "updatedAt">,
32
- account: Omit<Account, "userId" | "id" | "createdAt" | "updatedAt"> &
33
- Partial<Account>
34
- ): Promise<{ user: User; account: Account }>;
35
-
36
- createUser<T extends Record<string, any>>(
37
- user: Omit<User, "id" | "createdAt" | "updatedAt" | "emailVerified"> &
38
- Partial<User> &
39
- Record<string, any>
40
- ): Promise<T & User>;
41
-
42
- createAccount<T extends Record<string, any>>(
43
- account: Omit<Account, "id" | "createdAt" | "updatedAt"> &
44
- Partial<Account> &
45
- T
46
- ): Promise<T & Account>;
47
-
48
- listSessions(userId: string): Promise<Session[]>;
49
-
50
- listUsers(
51
- limit?: number | undefined,
52
- offset?: number | undefined,
53
- sortBy?: { field: string; direction: "asc" | "desc" } | undefined,
54
- where?: Where[] | undefined
55
- ): Promise<User[]>;
56
-
57
- countTotalUsers(where?: Where[] | undefined): Promise<number>;
58
-
59
- deleteUser(userId: string): Promise<void>;
60
-
61
- createSession(
62
- userId: string,
63
- dontRememberMe?: boolean | undefined,
64
- override?: (Partial<Session> & Record<string, any>) | undefined,
65
- overrideAll?: boolean | undefined
66
- ): Promise<Session>;
67
-
68
- findSession(token: string): Promise<{
69
- session: Session & Record<string, any>;
70
- user: User & Record<string, any>;
71
- } | null>;
72
-
73
- findSessions(
74
- sessionTokens: string[]
75
- ): Promise<{ session: Session; user: User }[]>;
76
-
77
- updateSession(
78
- sessionToken: string,
79
- session: Partial<Session> & Record<string, any>
80
- ): Promise<Session | null>;
81
-
82
- deleteSession(token: string): Promise<void>;
83
-
84
- deleteAccounts(userId: string): Promise<void>;
85
-
86
- deleteAccount(accountId: string): Promise<void>;
87
-
88
- deleteSessions(userIdOrSessionTokens: string | string[]): Promise<void>;
89
-
90
- findOAuthUser(
91
- email: string,
92
- accountId: string,
93
- providerId: string
94
- ): Promise<{ user: User; accounts: Account[] } | null>;
95
-
96
- findUserByEmail(
97
- email: string,
98
- options?: { includeAccounts: boolean } | undefined
99
- ): Promise<{ user: User; accounts: Account[] } | null>;
100
-
101
- findUserById(userId: string): Promise<User | null>;
102
-
103
- linkAccount(
104
- account: Omit<Account, "id" | "createdAt" | "updatedAt"> & Partial<Account>
105
- ): Promise<Account>;
106
-
107
- // fixme: any type
108
- updateUser(
109
- userId: string,
110
- data: Partial<User> & Record<string, any>
111
- ): Promise<any>;
112
-
113
- updateUserByEmail(
114
- email: string,
115
- data: Partial<User & Record<string, any>>
116
- ): Promise<User>;
117
-
118
- updatePassword(userId: string, password: string): Promise<void>;
119
-
120
- findAccounts(userId: string): Promise<Account[]>;
121
-
122
- findAccount(accountId: string): Promise<Account | null>;
123
-
124
- findAccountByProviderId(
125
- accountId: string,
126
- providerId: string
127
- ): Promise<Account | null>;
128
-
129
- findAccountByUserId(userId: string): Promise<Account[]>;
130
-
131
- updateAccount(id: string, data: Partial<Account>): Promise<Account>;
132
-
133
- createVerificationValue(
134
- data: Omit<Verification, "createdAt" | "id" | "updatedAt"> &
135
- Partial<Verification>
136
- ): Promise<Verification>;
137
-
138
- findVerificationValue(identifier: string): Promise<Verification | null>;
139
-
140
- deleteVerificationValue(id: string): Promise<void>;
141
-
142
- deleteVerificationByIdentifier(identifier: string): Promise<void>;
143
-
144
- updateVerificationValue(
145
- id: string,
146
- data: Partial<Verification>
147
- ): Promise<Verification>;
148
- }
149
-
150
- type CreateCookieGetterFn = (
151
- cookieName: string,
152
- overrideAttributes?: Partial<CookieOptions> | undefined
153
- ) => {
154
- name: string;
155
- attributes: CookieOptions;
156
- };
157
-
158
- type CheckPasswordFn<Options extends PayvoAuthOptions = PayvoAuthOptions> = (
159
- userId: string,
160
- ctx: GenericEndpointContext<Options>
161
- ) => Promise<boolean>;
162
-
163
- export type AuthContext<Options extends PayvoAuthOptions = PayvoAuthOptions> = {
164
- options: Options;
165
- appName: string;
166
- baseURL: string;
167
- trustedOrigins: string[];
168
- oauthConfig: {
169
- /**
170
- * This is dangerous and should only be used in dev or staging environments.
171
- */
172
- skipStateCookieCheck?: boolean | undefined;
173
- /**
174
- * Strategy for storing OAuth state
175
- *
176
- * - "cookie": Store state in an encrypted cookie (stateless)
177
- * - "database": Store state in the database
178
- *
179
- * @default "cookie"
180
- */
181
- storeStateStrategy: "database" | "cookie";
182
- };
183
- /**
184
- * New session that will be set after the request
185
- * meaning: there is a `set-cookie` header that will set
186
- * the session cookie. This is the fetched session. And it's set
187
- * by `setNewSession` method.
188
- */
189
- newSession: {
190
- session: Session & Record<string, any>;
191
- user: User & Record<string, any>;
192
- } | null;
193
- session: {
194
- session: Session & Record<string, any>;
195
- user: User & Record<string, any>;
196
- } | null;
197
- setNewSession: (
198
- session: {
199
- session: Session & Record<string, any>;
200
- user: User & Record<string, any>;
201
- } | null
202
- ) => void;
203
- socialProviders: OAuthProvider[];
204
- authCookies: PayvoAuthCookies;
205
- logger: ReturnType<typeof createLogger>;
206
- rateLimit: {
207
- enabled: boolean;
208
- window: number;
209
- max: number;
210
- storage: "memory" | "database" | "secondary-storage";
211
- } & PayvoAuthRateLimitOptions;
212
- adapter: DBAdapter<Options>;
213
- internalAdapter: InternalAdapter<Options>;
214
- createAuthCookie: CreateCookieGetterFn;
215
- secret: string;
216
- sessionConfig: {
217
- updateAge: number;
218
- expiresIn: number;
219
- freshAge: number;
220
- cookieRefreshCache:
221
- | false
222
- | {
223
- enabled: true;
224
- updateAge: number;
225
- };
226
- };
227
- generateId: (options: {
228
- model: LiteralUnion<DBPreservedModels, string>;
229
- size?: number | undefined;
230
- }) => string | false;
231
- secondaryStorage: SecondaryStorage | undefined;
232
- password: {
233
- hash: (password: string) => Promise<string>;
234
- verify: (data: { password: string; hash: string }) => Promise<boolean>;
235
- config: {
236
- minPasswordLength: number;
237
- maxPasswordLength: number;
238
- };
239
- checkPassword: CheckPasswordFn<Options>;
240
- };
241
- tables: PayvoAuthDBSchema;
242
- runMigrations: () => Promise<void>;
243
- publishTelemetry: (event: {
244
- type: string;
245
- anonymousId?: string | undefined;
246
- payload: Record<string, any>;
247
- }) => Promise<void>;
248
- /**
249
- * This skips the origin check for all requests.
250
- *
251
- * set to true by default for `test` environments and `false`
252
- * for other environments.
253
- *
254
- * It's inferred from the `options.advanced?.disableCSRFCheck`
255
- * option or `options.advanced?.disableOriginCheck` option.
256
- *
257
- * @default false
258
- */
259
- skipOriginCheck: boolean;
260
- /**
261
- * This skips the CSRF check for all requests.
262
- *
263
- * This is inferred from the `options.advanced?.
264
- * disableCSRFCheck` option.
265
- *
266
- * @default false
267
- */
268
- skipCSRFCheck: boolean;
269
- };
@@ -1,7 +0,0 @@
1
- import type { CookieOptions } from "better-call";
2
-
3
- export type PayvoAuthCookies = {
4
- sessionToken: { name: string; options: CookieOptions };
5
- sessionData: { name: string; options: CookieOptions };
6
- dontRememberToken: { name: string; options: CookieOptions };
7
- };
@@ -1,6 +0,0 @@
1
- type Primitive = string | number | symbol | bigint | boolean | null | undefined;
2
-
3
- export type LiteralString = "" | (string & Record<never, never>);
4
- export type LiteralUnion<LiteralType, BaseType extends Primitive> =
5
- | LiteralType
6
- | (BaseType & Record<never, never>);
@@ -1,21 +0,0 @@
1
- export type { StandardSchemaV1 } from "@standard-schema/spec";
2
- export type {
3
- AuthContext,
4
- GenericEndpointContext,
5
- InternalAdapter,
6
- } from "./context";
7
- export type { PayvoAuthCookies } from "./cookie";
8
- export type * from "./helper";
9
- export type {
10
- PayvoAuthAdvancedOptions,
11
- PayvoAuthOptions,
12
- PayvoAuthRateLimitOptions,
13
- GenerateIdFn,
14
- } from "./init-options";
15
- export type { PayvoAuthPlugin, HookEndpointContext } from "./plugin";
16
- export type {
17
- PayvoAuthClientOptions,
18
- PayvoAuthClientPlugin,
19
- ClientAtomListener,
20
- ClientStore,
21
- } from "./plugin-client";