@neondatabase/neon-js 0.1.0-alpha.1 → 0.1.0-alpha.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/dist/index.d.ts DELETED
@@ -1,147 +0,0 @@
1
- import { AdminUserAttributes, AuthApiError, AuthChangeEvent, AuthClient as AuthClient$1, AuthError, AuthResponse, Provider as OAuthProvider, Session, SignInWithOAuthCredentials, SignInWithPasswordCredentials as SignInCredentials, SignUpWithPasswordCredentials as SignUpCredentials, Subscription, User, UserAttributes, UserResponse, VerifyOtpParams as VerifyOTPParams, isAuthError } from "@supabase/auth-js";
2
- import { StackClientApp, StackClientAppConstructorOptions, StackServerApp, StackServerAppConstructorOptions } from "@stackframe/js";
3
- import { PostgrestClient } from "@supabase/postgrest-js";
4
- import { StackClientInterface } from "@stackframe/stack-shared";
5
- import { InternalSession } from "@stackframe/stack-shared/dist/sessions";
6
-
7
- //#region src/auth/auth-interface.d.ts
8
- type _AuthClientSupabaseInstance = InstanceType<typeof AuthClient$1>;
9
- type AuthClient = { [K in keyof _AuthClientSupabaseInstance as _AuthClientSupabaseInstance[K] extends never ? never : K]: _AuthClientSupabaseInstance[K] };
10
- //#endregion
11
- //#region src/auth/adapters/stack-auth/stack-auth-types.d.ts
12
- interface StackAppInternals {
13
- _getSession(overrideTokenStoreInit?: any): Promise<InternalSession>;
14
- _getSessionFromTokenStore(tokenStore: any): InternalSession;
15
- _getOrCreateTokenStore(cookieHelper: any, overrideTokenStoreInit?: any): any;
16
- _createCookieHelper(): Promise<any>;
17
- _interface: StackClientInterface;
18
- redirectToAfterSignOut(): Promise<void>;
19
- }
20
- /**
21
- * Stack Auth client
22
- * This type extends StackServerApp or StackClientApp to include the _interface property
23
- * This is a workaround to get the _interface property from the StackAuthAdapter
24
- */
25
- type StackAuthClient = (StackServerApp | StackClientApp) & StackAppInternals;
26
- /**
27
- * OnAuthStateChangeConfig type
28
- * This type is used to configure the onAuthStateChange function
29
- * It is based on the OnAuthStateChangeConfig type from Stack Auth (not exported)
30
- */
31
- interface OnAuthStateChangeConfig {
32
- enableTokenRefreshDetection?: boolean;
33
- tokenRefreshCheckInterval?: number;
34
- }
35
- //#endregion
36
- //#region src/auth/adapters/stack-auth/stack-auth-adapter.d.ts
37
- /**
38
- * Stack Auth adapter implementing the AuthClient interface
39
- */
40
- declare class StackAuthAdapter<HasTokenStore extends boolean = boolean, ProjectId extends string = string> implements AuthClient {
41
- stackAuth: StackAuthClient;
42
- private stateChangeEmitters;
43
- private broadcastChannel;
44
- private tokenRefreshCheckInterval;
45
- private config;
46
- constructor(params: StackServerAppConstructorOptions<HasTokenStore, ProjectId>, config?: OnAuthStateChangeConfig);
47
- admin: AuthClient['admin'];
48
- mfa: AuthClient['mfa'];
49
- initialize: AuthClient['initialize'];
50
- signUp: AuthClient['signUp'];
51
- signInAnonymously: AuthClient['signInAnonymously'];
52
- signInWithPassword: AuthClient['signInWithPassword'];
53
- signInWithOAuth: AuthClient['signInWithOAuth'];
54
- signInWithOtp: AuthClient['signInWithOtp'];
55
- signInWithIdToken: AuthClient['signInWithIdToken'];
56
- signInWithSSO: AuthClient['signInWithSSO'];
57
- signInWithWeb3: AuthClient['signInWithWeb3'];
58
- signOut: AuthClient['signOut'];
59
- verifyOtp: AuthClient['verifyOtp'];
60
- /**
61
- * Fetches fresh session data from Stack Auth API.
62
- * Always makes a network request to get the latest user metadata.
63
- * Used when we need fresh data (after setSession, refreshSession, etc.)
64
- */
65
- private _fetchFreshSession;
66
- getSession: AuthClient['getSession'];
67
- refreshSession: AuthClient['refreshSession'];
68
- setSession: AuthClient['setSession'];
69
- getUser: AuthClient['getUser'];
70
- getClaims: AuthClient['getClaims'];
71
- updateUser: AuthClient['updateUser'];
72
- getUserIdentities: AuthClient['getUserIdentities'];
73
- linkIdentity: AuthClient['linkIdentity'];
74
- unlinkIdentity: AuthClient['unlinkIdentity'];
75
- resetPasswordForEmail: AuthClient['resetPasswordForEmail'];
76
- reauthenticate: AuthClient['reauthenticate'];
77
- resend: AuthClient['resend'];
78
- onAuthStateChange: AuthClient['onAuthStateChange'];
79
- private _getSessionFromStackAuthInternals;
80
- private _getCachedTokensFromStackAuthInternals;
81
- private emitInitialSession;
82
- private notifyAllSubscribers;
83
- private initializeBroadcastChannel;
84
- private closeBroadcastChannel;
85
- private startTokenRefreshDetection;
86
- private stopTokenRefreshDetection;
87
- /**
88
- * Exchange an OAuth authorization code for a session.
89
- *
90
- * Note: Stack Auth handles OAuth callbacks automatically via callOAuthCallback().
91
- * This method delegates to Stack Auth's internal flow which:
92
- * - Retrieves the code and state from the current URL
93
- * - Retrieves the PKCE verifier from cookies (stored during signInWithOAuth)
94
- * - Exchanges the code for access/refresh tokens
95
- * - Creates and stores the user session
96
- *
97
- * @param authCode - The authorization code (Stack Auth reads this from URL automatically)
98
- * @returns Session data or error
99
- */
100
- exchangeCodeForSession: AuthClient['exchangeCodeForSession'];
101
- startAutoRefresh: AuthClient['startAutoRefresh'];
102
- stopAutoRefresh: AuthClient['stopAutoRefresh'];
103
- }
104
- //#endregion
105
- //#region src/client/neon-client.d.ts
106
- type NeonClientConstructorOptions<SchemaName> = {
107
- url: string;
108
- options?: {
109
- db?: {
110
- schema?: Exclude<SchemaName, '__InternalSupabase'>;
111
- };
112
- global?: {
113
- fetch: typeof fetch;
114
- headers?: Record<string, string>;
115
- };
116
- };
117
- };
118
- type DefaultSchemaName<Database> = 'public' extends keyof Database ? 'public' : string & keyof Database;
119
- declare class NeonClient<Database = any, SchemaName extends string & keyof Database = DefaultSchemaName<Database>> extends PostgrestClient<Database, {
120
- PostgrestVersion: '12';
121
- }, Exclude<SchemaName, '__InternalSupabase'>> {
122
- auth?: AuthClient;
123
- constructor({
124
- url,
125
- options
126
- }: NeonClientConstructorOptions<SchemaName>);
127
- }
128
- //#endregion
129
- //#region src/client/client-factory.d.ts
130
- type StackAuthOptions<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = StackClientAppConstructorOptions<HasTokenStore, ProjectId> | StackServerAppConstructorOptions<HasTokenStore, ProjectId>;
131
- type CreateClientOptions<SchemaName> = NeonClientConstructorOptions<SchemaName> & {
132
- auth: StackAuthOptions;
133
- };
134
- /**
135
- * Factory function to create NeonClient with seamless auth integration
136
- *
137
- * @param options - Configuration options
138
- * @returns NeonClient instance with auth-aware fetch wrapper
139
- * @throws AuthRequiredError when making requests without authentication
140
- */
141
- declare function createClient<Database = any, SchemaName extends string & keyof Database = DefaultSchemaName<Database>>({
142
- url,
143
- auth: authOptions,
144
- options
145
- }: CreateClientOptions<SchemaName>): NeonClient<Database, SchemaName>;
146
- //#endregion
147
- export { type AdminUserAttributes, AuthApiError, type AuthChangeEvent, type AuthClient, AuthError, type AuthResponse, type CreateClientOptions, NeonClient, type OAuthProvider, type Session, type SignInCredentials, type SignInWithOAuthCredentials, type SignUpCredentials, StackAuthAdapter, type Subscription, type User, type UserAttributes, type UserResponse, type VerifyOTPParams, createClient, isAuthError };