@githat/nextjs 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +73 -1
- package/dist/index.d.ts +73 -1
- package/dist/index.js +475 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +471 -1
- package/dist/index.mjs.map +1 -1
- package/dist/middleware.d.mts +35 -3
- package/dist/middleware.d.ts +35 -3
- package/dist/middleware.js +57 -50
- package/dist/middleware.js.map +1 -1
- package/dist/middleware.mjs +56 -51
- package/dist/middleware.mjs.map +1 -1
- package/dist/proxy.d.mts +78 -0
- package/dist/proxy.d.ts +78 -0
- package/dist/proxy.js +138 -0
- package/dist/proxy.js.map +1 -0
- package/dist/proxy.mjs +101 -0
- package/dist/proxy.mjs.map +1 -0
- package/dist/server.d.mts +50 -1
- package/dist/server.d.ts +50 -1
- package/dist/server.js +19 -2
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +17 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +6 -1
package/dist/index.d.mts
CHANGED
|
@@ -60,6 +60,12 @@ interface SignUpResult {
|
|
|
60
60
|
interface GitHatContextValue extends AuthState, AuthActions {
|
|
61
61
|
config: GitHatConfig;
|
|
62
62
|
}
|
|
63
|
+
interface PasswordResetResult {
|
|
64
|
+
success: boolean;
|
|
65
|
+
}
|
|
66
|
+
interface EmailVerificationResult {
|
|
67
|
+
success: boolean;
|
|
68
|
+
}
|
|
63
69
|
|
|
64
70
|
interface GitHatProviderProps {
|
|
65
71
|
config: GitHatConfig;
|
|
@@ -84,6 +90,21 @@ declare function useGitHat(): {
|
|
|
84
90
|
}>;
|
|
85
91
|
getOrgMetadata: () => Promise<OrgMetadata$1>;
|
|
86
92
|
updateOrgMetadata: (updates: OrgMetadata$1) => Promise<OrgMetadata$1>;
|
|
93
|
+
forgotPassword: (email: string) => Promise<{
|
|
94
|
+
success: boolean;
|
|
95
|
+
}>;
|
|
96
|
+
resetPassword: (token: string, newPassword: string) => Promise<{
|
|
97
|
+
success: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
changePassword: (currentPassword: string, newPassword: string) => Promise<{
|
|
100
|
+
success: boolean;
|
|
101
|
+
}>;
|
|
102
|
+
verifyEmail: (token: string) => Promise<{
|
|
103
|
+
success: boolean;
|
|
104
|
+
}>;
|
|
105
|
+
resendVerificationEmail: (email: string) => Promise<{
|
|
106
|
+
success: boolean;
|
|
107
|
+
}>;
|
|
87
108
|
};
|
|
88
109
|
|
|
89
110
|
interface DataItem {
|
|
@@ -226,6 +247,38 @@ interface ProtectedRouteProps {
|
|
|
226
247
|
}
|
|
227
248
|
declare function ProtectedRoute({ children, fallback }: ProtectedRouteProps): react_jsx_runtime.JSX.Element | null;
|
|
228
249
|
|
|
250
|
+
interface ForgotPasswordFormProps {
|
|
251
|
+
onSuccess?: (email: string) => void;
|
|
252
|
+
onError?: (error: Error) => void;
|
|
253
|
+
signInUrl?: string;
|
|
254
|
+
}
|
|
255
|
+
declare function ForgotPasswordForm({ onSuccess, onError, signInUrl, }: ForgotPasswordFormProps): react_jsx_runtime.JSX.Element;
|
|
256
|
+
|
|
257
|
+
interface ResetPasswordFormProps {
|
|
258
|
+
token: string;
|
|
259
|
+
onSuccess?: () => void;
|
|
260
|
+
onError?: (error: Error) => void;
|
|
261
|
+
signInUrl?: string;
|
|
262
|
+
minPasswordLength?: number;
|
|
263
|
+
}
|
|
264
|
+
declare function ResetPasswordForm({ token, onSuccess, onError, signInUrl, minPasswordLength, }: ResetPasswordFormProps): react_jsx_runtime.JSX.Element;
|
|
265
|
+
|
|
266
|
+
interface VerifyEmailStatusProps {
|
|
267
|
+
token: string;
|
|
268
|
+
onSuccess?: () => void;
|
|
269
|
+
onError?: (error: Error) => void;
|
|
270
|
+
signInUrl?: string;
|
|
271
|
+
redirectDelay?: number;
|
|
272
|
+
}
|
|
273
|
+
declare function VerifyEmailStatus({ token, onSuccess, onError, signInUrl, redirectDelay, }: VerifyEmailStatusProps): react_jsx_runtime.JSX.Element;
|
|
274
|
+
|
|
275
|
+
interface ChangePasswordFormProps {
|
|
276
|
+
onSuccess?: () => void;
|
|
277
|
+
onError?: (error: Error) => void;
|
|
278
|
+
minPasswordLength?: number;
|
|
279
|
+
}
|
|
280
|
+
declare function ChangePasswordForm({ onSuccess, onError, minPasswordLength, }: ChangePasswordFormProps): react_jsx_runtime.JSX.Element;
|
|
281
|
+
|
|
229
282
|
/**
|
|
230
283
|
* @githat/nextjs/server
|
|
231
284
|
*
|
|
@@ -255,5 +308,24 @@ interface VerifyOptions {
|
|
|
255
308
|
interface OrgMetadata {
|
|
256
309
|
[key: string]: unknown;
|
|
257
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* Handler function that receives the request and verified auth payload.
|
|
313
|
+
*/
|
|
314
|
+
type AuthenticatedHandler = (request: Request, auth: AuthPayload) => Promise<Response> | Response;
|
|
315
|
+
/**
|
|
316
|
+
* Options for the withAuth wrapper.
|
|
317
|
+
*/
|
|
318
|
+
interface WithAuthOptions {
|
|
319
|
+
/**
|
|
320
|
+
* Secret key for local JWT verification.
|
|
321
|
+
* Defaults to process.env.GITHAT_SECRET_KEY if not provided.
|
|
322
|
+
*/
|
|
323
|
+
secretKey?: string;
|
|
324
|
+
/**
|
|
325
|
+
* Custom response to return when authentication fails.
|
|
326
|
+
* Defaults to JSON { error: 'Unauthorized' } with status 401.
|
|
327
|
+
*/
|
|
328
|
+
onUnauthorized?: () => Response;
|
|
329
|
+
}
|
|
258
330
|
|
|
259
|
-
export { type AuthActions, type AuthPayload, type AuthState, type BatchOperation, type BatchResult, type DataItem, type DeleteResult, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, type OrgMetadata, OrgSwitcher, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, type VerifyOptions, useAuth, useData, useGitHat };
|
|
331
|
+
export { type AuthActions, type AuthPayload, type AuthState, type AuthenticatedHandler, type BatchOperation, type BatchResult, ChangePasswordForm, type DataItem, type DeleteResult, type EmailVerificationResult, ForgotPasswordForm, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, type OrgMetadata, OrgSwitcher, type PasswordResetResult, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, ResetPasswordForm, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, VerifyEmailStatus, type VerifyOptions, type WithAuthOptions, useAuth, useData, useGitHat };
|
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,12 @@ interface SignUpResult {
|
|
|
60
60
|
interface GitHatContextValue extends AuthState, AuthActions {
|
|
61
61
|
config: GitHatConfig;
|
|
62
62
|
}
|
|
63
|
+
interface PasswordResetResult {
|
|
64
|
+
success: boolean;
|
|
65
|
+
}
|
|
66
|
+
interface EmailVerificationResult {
|
|
67
|
+
success: boolean;
|
|
68
|
+
}
|
|
63
69
|
|
|
64
70
|
interface GitHatProviderProps {
|
|
65
71
|
config: GitHatConfig;
|
|
@@ -84,6 +90,21 @@ declare function useGitHat(): {
|
|
|
84
90
|
}>;
|
|
85
91
|
getOrgMetadata: () => Promise<OrgMetadata$1>;
|
|
86
92
|
updateOrgMetadata: (updates: OrgMetadata$1) => Promise<OrgMetadata$1>;
|
|
93
|
+
forgotPassword: (email: string) => Promise<{
|
|
94
|
+
success: boolean;
|
|
95
|
+
}>;
|
|
96
|
+
resetPassword: (token: string, newPassword: string) => Promise<{
|
|
97
|
+
success: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
changePassword: (currentPassword: string, newPassword: string) => Promise<{
|
|
100
|
+
success: boolean;
|
|
101
|
+
}>;
|
|
102
|
+
verifyEmail: (token: string) => Promise<{
|
|
103
|
+
success: boolean;
|
|
104
|
+
}>;
|
|
105
|
+
resendVerificationEmail: (email: string) => Promise<{
|
|
106
|
+
success: boolean;
|
|
107
|
+
}>;
|
|
87
108
|
};
|
|
88
109
|
|
|
89
110
|
interface DataItem {
|
|
@@ -226,6 +247,38 @@ interface ProtectedRouteProps {
|
|
|
226
247
|
}
|
|
227
248
|
declare function ProtectedRoute({ children, fallback }: ProtectedRouteProps): react_jsx_runtime.JSX.Element | null;
|
|
228
249
|
|
|
250
|
+
interface ForgotPasswordFormProps {
|
|
251
|
+
onSuccess?: (email: string) => void;
|
|
252
|
+
onError?: (error: Error) => void;
|
|
253
|
+
signInUrl?: string;
|
|
254
|
+
}
|
|
255
|
+
declare function ForgotPasswordForm({ onSuccess, onError, signInUrl, }: ForgotPasswordFormProps): react_jsx_runtime.JSX.Element;
|
|
256
|
+
|
|
257
|
+
interface ResetPasswordFormProps {
|
|
258
|
+
token: string;
|
|
259
|
+
onSuccess?: () => void;
|
|
260
|
+
onError?: (error: Error) => void;
|
|
261
|
+
signInUrl?: string;
|
|
262
|
+
minPasswordLength?: number;
|
|
263
|
+
}
|
|
264
|
+
declare function ResetPasswordForm({ token, onSuccess, onError, signInUrl, minPasswordLength, }: ResetPasswordFormProps): react_jsx_runtime.JSX.Element;
|
|
265
|
+
|
|
266
|
+
interface VerifyEmailStatusProps {
|
|
267
|
+
token: string;
|
|
268
|
+
onSuccess?: () => void;
|
|
269
|
+
onError?: (error: Error) => void;
|
|
270
|
+
signInUrl?: string;
|
|
271
|
+
redirectDelay?: number;
|
|
272
|
+
}
|
|
273
|
+
declare function VerifyEmailStatus({ token, onSuccess, onError, signInUrl, redirectDelay, }: VerifyEmailStatusProps): react_jsx_runtime.JSX.Element;
|
|
274
|
+
|
|
275
|
+
interface ChangePasswordFormProps {
|
|
276
|
+
onSuccess?: () => void;
|
|
277
|
+
onError?: (error: Error) => void;
|
|
278
|
+
minPasswordLength?: number;
|
|
279
|
+
}
|
|
280
|
+
declare function ChangePasswordForm({ onSuccess, onError, minPasswordLength, }: ChangePasswordFormProps): react_jsx_runtime.JSX.Element;
|
|
281
|
+
|
|
229
282
|
/**
|
|
230
283
|
* @githat/nextjs/server
|
|
231
284
|
*
|
|
@@ -255,5 +308,24 @@ interface VerifyOptions {
|
|
|
255
308
|
interface OrgMetadata {
|
|
256
309
|
[key: string]: unknown;
|
|
257
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* Handler function that receives the request and verified auth payload.
|
|
313
|
+
*/
|
|
314
|
+
type AuthenticatedHandler = (request: Request, auth: AuthPayload) => Promise<Response> | Response;
|
|
315
|
+
/**
|
|
316
|
+
* Options for the withAuth wrapper.
|
|
317
|
+
*/
|
|
318
|
+
interface WithAuthOptions {
|
|
319
|
+
/**
|
|
320
|
+
* Secret key for local JWT verification.
|
|
321
|
+
* Defaults to process.env.GITHAT_SECRET_KEY if not provided.
|
|
322
|
+
*/
|
|
323
|
+
secretKey?: string;
|
|
324
|
+
/**
|
|
325
|
+
* Custom response to return when authentication fails.
|
|
326
|
+
* Defaults to JSON { error: 'Unauthorized' } with status 401.
|
|
327
|
+
*/
|
|
328
|
+
onUnauthorized?: () => Response;
|
|
329
|
+
}
|
|
258
330
|
|
|
259
|
-
export { type AuthActions, type AuthPayload, type AuthState, type BatchOperation, type BatchResult, type DataItem, type DeleteResult, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, type OrgMetadata, OrgSwitcher, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, type VerifyOptions, useAuth, useData, useGitHat };
|
|
331
|
+
export { type AuthActions, type AuthPayload, type AuthState, type AuthenticatedHandler, type BatchOperation, type BatchResult, ChangePasswordForm, type DataItem, type DeleteResult, type EmailVerificationResult, ForgotPasswordForm, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, type OrgMetadata, OrgSwitcher, type PasswordResetResult, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, ResetPasswordForm, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, VerifyEmailStatus, type VerifyOptions, type WithAuthOptions, useAuth, useData, useGitHat };
|