faire-auth 1.0.0
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/LICENSE +661 -0
- package/README.md +34 -0
- package/dist/access-B5bBI4uT.mjs +39 -0
- package/dist/access-Crt-IJ2P.cjs +51 -0
- package/dist/adapter-factory-BXei1QRX.mjs +881 -0
- package/dist/adapter-factory-DT-_2aHJ.cjs +893 -0
- package/dist/adapters/drizzle-adapter/index.cjs +208 -0
- package/dist/adapters/drizzle-adapter/index.d.cts +48 -0
- package/dist/adapters/drizzle-adapter/index.d.mts +48 -0
- package/dist/adapters/drizzle-adapter/index.mjs +207 -0
- package/dist/adapters/index.cjs +23 -0
- package/dist/adapters/index.d.cts +157 -0
- package/dist/adapters/index.d.mts +157 -0
- package/dist/adapters/index.mjs +17 -0
- package/dist/adapters/kysely-adapter/index.cjs +11 -0
- package/dist/adapters/kysely-adapter/index.d.cts +52 -0
- package/dist/adapters/kysely-adapter/index.d.mts +52 -0
- package/dist/adapters/kysely-adapter/index.mjs +9 -0
- package/dist/adapters/memory-adapter/index.cjs +9 -0
- package/dist/adapters/memory-adapter/index.d.cts +15 -0
- package/dist/adapters/memory-adapter/index.d.mts +15 -0
- package/dist/adapters/memory-adapter/index.mjs +9 -0
- package/dist/adapters/mongodb-adapter/index.cjs +9 -0
- package/dist/adapters/mongodb-adapter/index.d.cts +4 -0
- package/dist/adapters/mongodb-adapter/index.d.mts +4 -0
- package/dist/adapters/mongodb-adapter/index.mjs +9 -0
- package/dist/adapters/prisma-adapter/index.cjs +156 -0
- package/dist/adapters/prisma-adapter/index.d.cts +35 -0
- package/dist/adapters/prisma-adapter/index.d.mts +35 -0
- package/dist/adapters/prisma-adapter/index.mjs +155 -0
- package/dist/adapters/test.cjs +797 -0
- package/dist/adapters/test.d.cts +82 -0
- package/dist/adapters/test.d.mts +82 -0
- package/dist/adapters/test.mjs +793 -0
- package/dist/api/index.cjs +20 -0
- package/dist/api/index.d.cts +3 -0
- package/dist/api/index.d.mts +3 -0
- package/dist/api/index.mjs +20 -0
- package/dist/api/middleware/index.cjs +16 -0
- package/dist/api/middleware/index.d.cts +16 -0
- package/dist/api/middleware/index.d.mts +16 -0
- package/dist/api/middleware/index.mjs +11 -0
- package/dist/api-Bm89BLgN.cjs +1899 -0
- package/dist/api-_B7qO28y.mjs +1892 -0
- package/dist/auth-Bo9PDt5j.cjs +739 -0
- package/dist/auth-Ds4AG4h4.mjs +709 -0
- package/dist/bearer-0SeEmaS4.mjs +54 -0
- package/dist/bearer-CHeREcGT.cjs +60 -0
- package/dist/bun-sqlite-dialect-CfkBo2v5.mjs +155 -0
- package/dist/bun-sqlite-dialect-wuaC2-gh.cjs +156 -0
- package/dist/chunk-Ceigfy4P.mjs +39 -0
- package/dist/chunk-oakRccI5.cjs +60 -0
- package/dist/client/index.cjs +22 -0
- package/dist/client/index.d.cts +8 -0
- package/dist/client/index.d.mts +8 -0
- package/dist/client/index.mjs +19 -0
- package/dist/client/lynx/index.cjs +79 -0
- package/dist/client/lynx/index.d.cts +156 -0
- package/dist/client/lynx/index.d.mts +156 -0
- package/dist/client/lynx/index.mjs +76 -0
- package/dist/client/plugins/index.cjs +11 -0
- package/dist/client/plugins/index.d.cts +17 -0
- package/dist/client/plugins/index.d.mts +17 -0
- package/dist/client/plugins/index.mjs +10 -0
- package/dist/client/react/index.cjs +79 -0
- package/dist/client/react/index.d.cts +156 -0
- package/dist/client/react/index.d.mts +156 -0
- package/dist/client/react/index.mjs +76 -0
- package/dist/client/solid/index.cjs +51 -0
- package/dist/client/solid/index.d.cts +90 -0
- package/dist/client/solid/index.d.mts +90 -0
- package/dist/client/solid/index.mjs +50 -0
- package/dist/client/svelte/index.cjs +28 -0
- package/dist/client/svelte/index.d.cts +110 -0
- package/dist/client/svelte/index.d.mts +110 -0
- package/dist/client/svelte/index.mjs +28 -0
- package/dist/client/vue/index.cjs +68 -0
- package/dist/client/vue/index.d.cts +123 -0
- package/dist/client/vue/index.d.mts +123 -0
- package/dist/client/vue/index.mjs +67 -0
- package/dist/cookies-B5xeA6i8.cjs +456 -0
- package/dist/cookies-Ch1JfQIz.mjs +367 -0
- package/dist/crypto/index.cjs +11 -0
- package/dist/crypto/index.d.cts +22 -0
- package/dist/crypto/index.d.mts +22 -0
- package/dist/crypto/index.mjs +5 -0
- package/dist/crypto-CcTxYH82.cjs +57 -0
- package/dist/crypto-CyQRFtkq.mjs +41 -0
- package/dist/db/index.cjs +40 -0
- package/dist/db/index.d.cts +4 -0
- package/dist/db/index.d.mts +4 -0
- package/dist/db/index.mjs +16 -0
- package/dist/db-BTKyYu-_.cjs +1180 -0
- package/dist/db-xiJtoDgz.mjs +1119 -0
- package/dist/defu-B0Svx_x4.cjs +34 -0
- package/dist/defu-SZkpHhbR.mjs +28 -0
- package/dist/email-verification-C-AsfJsb.cjs +247 -0
- package/dist/email-verification-CWhj2qfb.mjs +228 -0
- package/dist/hono-BEq1NYVX.cjs +526 -0
- package/dist/hono-Cdukwu5K.cjs +13 -0
- package/dist/hono-CoKYWnXA.mjs +7 -0
- package/dist/hono-Covz10jU.mjs +508 -0
- package/dist/hono-DOM31WQz.d.cts +18 -0
- package/dist/hono-DuE14mmj.d.mts +18 -0
- package/dist/index-B-WeOMzg.d.cts +13350 -0
- package/dist/index-B09P9p5_.d.cts +33 -0
- package/dist/index-B5_0QTLg.d.mts +3 -0
- package/dist/index-B7SKyR_a.d.cts +3 -0
- package/dist/index-BVHscLQl.d.cts +992 -0
- package/dist/index-C2-2QDyS.d.cts +35 -0
- package/dist/index-CTwrVluH.d.mts +41 -0
- package/dist/index-CWAqWfoZ.d.cts +27 -0
- package/dist/index-CYSShrFx.d.mts +27 -0
- package/dist/index-Qu-iJGNr.d.mts +992 -0
- package/dist/index-cs4Sh0En.d.cts +41 -0
- package/dist/index-jlessPI0.d.mts +13350 -0
- package/dist/index-ppgcFe12.d.mts +33 -0
- package/dist/index-to0RO38U.d.mts +35 -0
- package/dist/index.cjs +85 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +27 -0
- package/dist/integrations/next-js.cjs +50 -0
- package/dist/integrations/next-js.d.cts +23 -0
- package/dist/integrations/next-js.d.mts +23 -0
- package/dist/integrations/next-js.mjs +49 -0
- package/dist/integrations/node.cjs +139 -0
- package/dist/integrations/node.d.cts +22 -0
- package/dist/integrations/node.d.mts +22 -0
- package/dist/integrations/node.mjs +134 -0
- package/dist/integrations/react-start.cjs +37 -0
- package/dist/integrations/react-start.d.cts +17 -0
- package/dist/integrations/react-start.d.mts +17 -0
- package/dist/integrations/react-start.mjs +37 -0
- package/dist/integrations/solid-start.cjs +14 -0
- package/dist/integrations/solid-start.d.cts +13 -0
- package/dist/integrations/solid-start.d.mts +13 -0
- package/dist/integrations/solid-start.mjs +13 -0
- package/dist/integrations/svelte-kit.cjs +52 -0
- package/dist/integrations/svelte-kit.d.cts +42 -0
- package/dist/integrations/svelte-kit.d.mts +42 -0
- package/dist/integrations/svelte-kit.mjs +49 -0
- package/dist/ip-B5SwXaMB.cjs +54 -0
- package/dist/ip-BjNYspCH.mjs +36 -0
- package/dist/json-B1v2qRTQ.mjs +24 -0
- package/dist/json-CcJ2HjGo.cjs +30 -0
- package/dist/kysely-adapter-Bxi7sPdG.cjs +288 -0
- package/dist/kysely-adapter-DRuoT_X8.mjs +270 -0
- package/dist/logged-CyGfp8_H.mjs +187 -0
- package/dist/logged-DQK3C64b.cjs +193 -0
- package/dist/memory-adapter-BlnDIAAX.cjs +154 -0
- package/dist/memory-adapter-Db3tsJTn.mjs +148 -0
- package/dist/middleware-CE6OhDkq.mjs +29 -0
- package/dist/middleware-CWvRH4EW.cjs +47 -0
- package/dist/mongodb-adapter-C_qGQED5.mjs +291 -0
- package/dist/mongodb-adapter-C_qfK87x.cjs +297 -0
- package/dist/node-sqlite-dialect-BfBzyOAg.mjs +155 -0
- package/dist/node-sqlite-dialect-mJWC8LWQ.cjs +156 -0
- package/dist/oauth2/index.cjs +25 -0
- package/dist/oauth2/index.d.cts +42 -0
- package/dist/oauth2/index.d.mts +42 -0
- package/dist/oauth2/index.mjs +16 -0
- package/dist/oauth2-B8M0lW9l.mjs +159 -0
- package/dist/oauth2-BLeOEi7Y.cjs +177 -0
- package/dist/origin-check-8Gajklvh.mjs +228 -0
- package/dist/origin-check-id9lTnqZ.cjs +246 -0
- package/dist/parser-CdncAl9i.cjs +83 -0
- package/dist/parser-CeAer-RM.mjs +71 -0
- package/dist/passkey-B6N20LSS.cjs +512 -0
- package/dist/passkey-DJsR_GX3.mjs +505 -0
- package/dist/plugins/access/index.cjs +4 -0
- package/dist/plugins/access/index.d.cts +2 -0
- package/dist/plugins/access/index.d.mts +2 -0
- package/dist/plugins/access/index.mjs +3 -0
- package/dist/plugins/bearer/index.cjs +7 -0
- package/dist/plugins/bearer/index.d.cts +4 -0
- package/dist/plugins/bearer/index.d.mts +4 -0
- package/dist/plugins/bearer/index.mjs +7 -0
- package/dist/plugins/index.cjs +49 -0
- package/dist/plugins/index.d.cts +9326 -0
- package/dist/plugins/index.d.mts +9326 -0
- package/dist/plugins/index.mjs +26 -0
- package/dist/plugins/passkey/index.cjs +15 -0
- package/dist/plugins/passkey/index.d.cts +4 -0
- package/dist/plugins/passkey/index.d.mts +4 -0
- package/dist/plugins/passkey/index.mjs +15 -0
- package/dist/plugins-C1lm2Wj3.cjs +5254 -0
- package/dist/plugins-Dai1QkRU.mjs +5199 -0
- package/dist/request-1NL_1lyJ.mjs +58 -0
- package/dist/request-CPNlp-DK.cjs +100 -0
- package/dist/schema-D-qjygfE.cjs +179 -0
- package/dist/schema-DTIwLLmf.mjs +125 -0
- package/dist/session-De9POJTW.cjs +641 -0
- package/dist/session-rH8ougDl.mjs +538 -0
- package/dist/social-providers/index.cjs +10 -0
- package/dist/social-providers/index.d.cts +2 -0
- package/dist/social-providers/index.d.mts +2 -0
- package/dist/social-providers/index.mjs +5 -0
- package/dist/social-providers-DcFNUT0S.cjs +13 -0
- package/dist/social-providers-DoYJhBe3.mjs +9 -0
- package/dist/state--f7fwIGh.cjs +99 -0
- package/dist/state-CqJfCIl9.mjs +86 -0
- package/dist/test-utils/index.cjs +27492 -0
- package/dist/test-utils/index.d.cts +4584 -0
- package/dist/test-utils/index.d.mts +4584 -0
- package/dist/test-utils/index.mjs +27490 -0
- package/dist/types/index.cjs +0 -0
- package/dist/types/index.d.cts +3 -0
- package/dist/types/index.d.mts +3 -0
- package/dist/types/index.mjs +1 -0
- package/dist/url-BoUuoIwZ.mjs +88 -0
- package/dist/url-D2yvKaM7.cjs +118 -0
- package/dist/utils/cookies.cjs +51 -0
- package/dist/utils/cookies.d.cts +179 -0
- package/dist/utils/cookies.d.mts +179 -0
- package/dist/utils/cookies.mjs +7 -0
- package/dist/utils-44aDDP8f.cjs +2 -0
- package/dist/utils-D4vZd1-9.mjs +4 -0
- package/dist/vanilla-Bu2PmFzE.cjs +30 -0
- package/dist/vanilla-TfHqeiC7.mjs +25 -0
- package/package.json +470 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { $ as Client, B as DefaultApp, dt as IsSignal, et as ClientOptions, it as InferActions, nt as FaireAuthClientPlugin, pt as SessionQueryParams, st as InferErrorCodes } from "../../index-B-WeOMzg.cjs";
|
|
2
|
+
import "../../hono-DOM31WQz.cjs";
|
|
3
|
+
import * as _faire_auth_core_types34 from "@faire-auth/core/types";
|
|
4
|
+
import { AnyHono, Prettify, UnionToIntersection } from "@faire-auth/core/types";
|
|
5
|
+
import * as hono36 from "hono";
|
|
6
|
+
import { Hono } from "hono";
|
|
7
|
+
import * as _faire_auth_core_db1 from "@faire-auth/core/db";
|
|
8
|
+
import { BASE_ERROR_CODES } from "@faire-auth/core/error";
|
|
9
|
+
import * as _better_fetch_fetch9 from "@better-fetch/fetch";
|
|
10
|
+
import { BetterFetchError } from "@better-fetch/fetch";
|
|
11
|
+
import * as nanostores2 from "nanostores";
|
|
12
|
+
import { Store, StoreValue } from "nanostores";
|
|
13
|
+
import { DependencyList } from "@lynx-js/react";
|
|
14
|
+
export * from "@better-fetch/fetch";
|
|
15
|
+
export * from "nanostores";
|
|
16
|
+
|
|
17
|
+
//#region src/client/lynx/lynx-store.d.ts
|
|
18
|
+
type StoreKeys<T> = T extends {
|
|
19
|
+
setKey: (k: infer K, v: any) => unknown;
|
|
20
|
+
} ? K : never;
|
|
21
|
+
interface UseStoreOptions<SomeStore> {
|
|
22
|
+
/**
|
|
23
|
+
* @default
|
|
24
|
+
* ```ts
|
|
25
|
+
* [store, options.keys]
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
deps?: DependencyList;
|
|
29
|
+
/**
|
|
30
|
+
* Will re-render components only on specific key changes.
|
|
31
|
+
*/
|
|
32
|
+
keys?: StoreKeys<SomeStore>[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Subscribe to store changes and get store's value.
|
|
36
|
+
*
|
|
37
|
+
* Can be used with store builder too.
|
|
38
|
+
*
|
|
39
|
+
* ```js
|
|
40
|
+
* import { useStore } from 'nanostores/react'
|
|
41
|
+
*
|
|
42
|
+
* import { router } from '../store/router'
|
|
43
|
+
*
|
|
44
|
+
* export const Layout = () => {
|
|
45
|
+
* let page = useStore(router)
|
|
46
|
+
* if (page.route === 'home') {
|
|
47
|
+
* return <HomePage />
|
|
48
|
+
* } else {
|
|
49
|
+
* return <Error404 />
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @param store Store instance.
|
|
55
|
+
* @returns Store value.
|
|
56
|
+
*/
|
|
57
|
+
declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/client/lynx/index.d.ts
|
|
60
|
+
declare function capitalizeFirstLetter(str: string): string;
|
|
61
|
+
type InferResolvedHooks<O extends ClientOptions> = O["plugins"] extends Array<infer Plugin> ? Plugin extends FaireAuthClientPlugin ? Plugin["getAtoms"] extends ((fetch: any) => infer Atoms) ? Atoms extends Record<string, any> ? { [key in keyof Atoms as IsSignal<key> extends true ? never : key extends string ? `use${Capitalize<key>}` : never]: () => ReturnType<Atoms[key]["get"]> } : {} : {} : {} : {};
|
|
62
|
+
declare const createAuthClient: <App extends AnyHono = DefaultApp>() => <Option extends ClientOptions>(options: Option) => UnionToIntersection<InferResolvedHooks<Option>> & (App extends Hono<any, infer S extends hono36.Schema, infer P extends string> ? Client<S, P, Option> : never) & InferActions<Option> & {
|
|
63
|
+
useSession: () => {
|
|
64
|
+
data: App extends Hono<any, infer S_1 extends hono36.Schema, infer P_1 extends string> ? (S_1[`${P_1}/get-session`]["$get"]["output"] & {
|
|
65
|
+
success: true;
|
|
66
|
+
})["data"] : never;
|
|
67
|
+
isPending: boolean;
|
|
68
|
+
error: BetterFetchError | null;
|
|
69
|
+
refetch: (queryParams?: {
|
|
70
|
+
query?: SessionQueryParams;
|
|
71
|
+
}) => void;
|
|
72
|
+
};
|
|
73
|
+
$Infer: {
|
|
74
|
+
Session: NonNullable<App extends Hono<any, infer S_1 extends hono36.Schema, infer P_1 extends string> ? (S_1[`${P_1}/get-session`]["$get"]["output"] & {
|
|
75
|
+
success: true;
|
|
76
|
+
})["data"] : never>;
|
|
77
|
+
};
|
|
78
|
+
$fetch: _better_fetch_fetch9.BetterFetch<{
|
|
79
|
+
plugins: (_better_fetch_fetch9.BetterFetchPlugin | {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
hooks: {};
|
|
83
|
+
})[];
|
|
84
|
+
method: string;
|
|
85
|
+
output?: _better_fetch_fetch9.StandardSchemaV1 | typeof Blob | typeof File;
|
|
86
|
+
query?: any;
|
|
87
|
+
baseURL: string;
|
|
88
|
+
headers?: HeadersInit & (HeadersInit | {
|
|
89
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
90
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
91
|
+
authorization: "Bearer" | "Basic";
|
|
92
|
+
});
|
|
93
|
+
redirect?: RequestRedirect;
|
|
94
|
+
params?: any;
|
|
95
|
+
body?: any;
|
|
96
|
+
throw?: boolean;
|
|
97
|
+
auth?: {
|
|
98
|
+
type: "Bearer";
|
|
99
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
100
|
+
} | {
|
|
101
|
+
type: "Basic";
|
|
102
|
+
username: string | (() => string | undefined) | undefined;
|
|
103
|
+
password: string | (() => string | undefined) | undefined;
|
|
104
|
+
} | {
|
|
105
|
+
type: "Custom";
|
|
106
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
107
|
+
value: string | (() => string | undefined) | undefined;
|
|
108
|
+
};
|
|
109
|
+
window?: null;
|
|
110
|
+
cache?: RequestCache;
|
|
111
|
+
credentials?: RequestCredentials;
|
|
112
|
+
integrity?: string;
|
|
113
|
+
keepalive?: boolean;
|
|
114
|
+
mode?: RequestMode;
|
|
115
|
+
priority?: RequestPriority;
|
|
116
|
+
referrer?: string;
|
|
117
|
+
referrerPolicy?: ReferrerPolicy;
|
|
118
|
+
signal?: AbortSignal | null;
|
|
119
|
+
onRetry?: (response: _better_fetch_fetch9.ResponseContext) => Promise<void> | void;
|
|
120
|
+
hookOptions?: {
|
|
121
|
+
cloneResponse?: boolean;
|
|
122
|
+
};
|
|
123
|
+
timeout?: number;
|
|
124
|
+
duplex?: "full" | "half";
|
|
125
|
+
jsonParser: (text: string) => Promise<any> | any;
|
|
126
|
+
retry?: _better_fetch_fetch9.RetryOptions;
|
|
127
|
+
retryAttempt?: number;
|
|
128
|
+
errorSchema?: _better_fetch_fetch9.StandardSchemaV1;
|
|
129
|
+
disableValidation?: boolean;
|
|
130
|
+
catchAllError?: boolean;
|
|
131
|
+
defaultOutput?: _better_fetch_fetch9.StandardSchemaV1;
|
|
132
|
+
defaultError?: _better_fetch_fetch9.StandardSchemaV1;
|
|
133
|
+
schema?: _better_fetch_fetch9.Schema;
|
|
134
|
+
customFetchImpl: any;
|
|
135
|
+
}, unknown, unknown, _better_fetch_fetch9.Schema>;
|
|
136
|
+
$store: {
|
|
137
|
+
notify: (signal?: _faire_auth_core_types34.LiteralStringUnion<"$sessionSignal">) => void;
|
|
138
|
+
listen: (signal: _faire_auth_core_types34.LiteralStringUnion<"$sessionSignal">, listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
139
|
+
atoms: {
|
|
140
|
+
session: nanostores2.PreinitializedWritableAtom<{
|
|
141
|
+
data: {
|
|
142
|
+
user: _faire_auth_core_db1.User;
|
|
143
|
+
session: _faire_auth_core_db1.Session;
|
|
144
|
+
} | null;
|
|
145
|
+
error: BetterFetchError | null;
|
|
146
|
+
isPending: boolean;
|
|
147
|
+
isRefetching: boolean;
|
|
148
|
+
refetch: () => void;
|
|
149
|
+
}> & object;
|
|
150
|
+
$sessionSignal: nanostores2.PreinitializedWritableAtom<boolean> & object;
|
|
151
|
+
} & Record<string, nanostores2.WritableAtom<any>>;
|
|
152
|
+
};
|
|
153
|
+
$ERROR_CODES: Prettify<InferErrorCodes<Option> & typeof BASE_ERROR_CODES>;
|
|
154
|
+
};
|
|
155
|
+
//#endregion
|
|
156
|
+
export { capitalizeFirstLetter, createAuthClient, useStore };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { $ as Client, B as DefaultApp, dt as IsSignal, et as ClientOptions, it as InferActions, nt as FaireAuthClientPlugin, pt as SessionQueryParams, st as InferErrorCodes } from "../../index-jlessPI0.mjs";
|
|
2
|
+
import "../../hono-DuE14mmj.mjs";
|
|
3
|
+
import { BASE_ERROR_CODES } from "@faire-auth/core/error";
|
|
4
|
+
import * as hono35 from "hono";
|
|
5
|
+
import { Hono } from "hono";
|
|
6
|
+
import * as _faire_auth_core_db0 from "@faire-auth/core/db";
|
|
7
|
+
import * as _better_fetch_fetch0 from "@better-fetch/fetch";
|
|
8
|
+
import { BetterFetchError } from "@better-fetch/fetch";
|
|
9
|
+
import * as nanostores0 from "nanostores";
|
|
10
|
+
import { Store, StoreValue } from "nanostores";
|
|
11
|
+
import { DependencyList } from "@lynx-js/react";
|
|
12
|
+
import * as _faire_auth_core_types33 from "@faire-auth/core/types";
|
|
13
|
+
import { AnyHono, Prettify, UnionToIntersection } from "@faire-auth/core/types";
|
|
14
|
+
export * from "@better-fetch/fetch";
|
|
15
|
+
export * from "nanostores";
|
|
16
|
+
|
|
17
|
+
//#region src/client/lynx/lynx-store.d.ts
|
|
18
|
+
type StoreKeys<T> = T extends {
|
|
19
|
+
setKey: (k: infer K, v: any) => unknown;
|
|
20
|
+
} ? K : never;
|
|
21
|
+
interface UseStoreOptions<SomeStore> {
|
|
22
|
+
/**
|
|
23
|
+
* @default
|
|
24
|
+
* ```ts
|
|
25
|
+
* [store, options.keys]
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
deps?: DependencyList;
|
|
29
|
+
/**
|
|
30
|
+
* Will re-render components only on specific key changes.
|
|
31
|
+
*/
|
|
32
|
+
keys?: StoreKeys<SomeStore>[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Subscribe to store changes and get store's value.
|
|
36
|
+
*
|
|
37
|
+
* Can be used with store builder too.
|
|
38
|
+
*
|
|
39
|
+
* ```js
|
|
40
|
+
* import { useStore } from 'nanostores/react'
|
|
41
|
+
*
|
|
42
|
+
* import { router } from '../store/router'
|
|
43
|
+
*
|
|
44
|
+
* export const Layout = () => {
|
|
45
|
+
* let page = useStore(router)
|
|
46
|
+
* if (page.route === 'home') {
|
|
47
|
+
* return <HomePage />
|
|
48
|
+
* } else {
|
|
49
|
+
* return <Error404 />
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @param store Store instance.
|
|
55
|
+
* @returns Store value.
|
|
56
|
+
*/
|
|
57
|
+
declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/client/lynx/index.d.ts
|
|
60
|
+
declare function capitalizeFirstLetter(str: string): string;
|
|
61
|
+
type InferResolvedHooks<O extends ClientOptions> = O["plugins"] extends Array<infer Plugin> ? Plugin extends FaireAuthClientPlugin ? Plugin["getAtoms"] extends ((fetch: any) => infer Atoms) ? Atoms extends Record<string, any> ? { [key in keyof Atoms as IsSignal<key> extends true ? never : key extends string ? `use${Capitalize<key>}` : never]: () => ReturnType<Atoms[key]["get"]> } : {} : {} : {} : {};
|
|
62
|
+
declare const createAuthClient: <App extends AnyHono = DefaultApp>() => <Option extends ClientOptions>(options: Option) => UnionToIntersection<InferResolvedHooks<Option>> & (App extends Hono<any, infer S extends hono35.Schema, infer P extends string> ? Client<S, P, Option> : never) & InferActions<Option> & {
|
|
63
|
+
useSession: () => {
|
|
64
|
+
data: App extends Hono<any, infer S_1 extends hono35.Schema, infer P_1 extends string> ? (S_1[`${P_1}/get-session`]["$get"]["output"] & {
|
|
65
|
+
success: true;
|
|
66
|
+
})["data"] : never;
|
|
67
|
+
isPending: boolean;
|
|
68
|
+
error: BetterFetchError | null;
|
|
69
|
+
refetch: (queryParams?: {
|
|
70
|
+
query?: SessionQueryParams;
|
|
71
|
+
}) => void;
|
|
72
|
+
};
|
|
73
|
+
$Infer: {
|
|
74
|
+
Session: NonNullable<App extends Hono<any, infer S_1 extends hono35.Schema, infer P_1 extends string> ? (S_1[`${P_1}/get-session`]["$get"]["output"] & {
|
|
75
|
+
success: true;
|
|
76
|
+
})["data"] : never>;
|
|
77
|
+
};
|
|
78
|
+
$fetch: _better_fetch_fetch0.BetterFetch<{
|
|
79
|
+
plugins: (_better_fetch_fetch0.BetterFetchPlugin | {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
hooks: {};
|
|
83
|
+
})[];
|
|
84
|
+
method: string;
|
|
85
|
+
output?: _better_fetch_fetch0.StandardSchemaV1 | typeof Blob | typeof File;
|
|
86
|
+
query?: any;
|
|
87
|
+
baseURL: string;
|
|
88
|
+
headers?: HeadersInit & (HeadersInit | {
|
|
89
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
90
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
91
|
+
authorization: "Bearer" | "Basic";
|
|
92
|
+
});
|
|
93
|
+
redirect?: RequestRedirect;
|
|
94
|
+
params?: any;
|
|
95
|
+
body?: any;
|
|
96
|
+
throw?: boolean;
|
|
97
|
+
auth?: {
|
|
98
|
+
type: "Bearer";
|
|
99
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
100
|
+
} | {
|
|
101
|
+
type: "Basic";
|
|
102
|
+
username: string | (() => string | undefined) | undefined;
|
|
103
|
+
password: string | (() => string | undefined) | undefined;
|
|
104
|
+
} | {
|
|
105
|
+
type: "Custom";
|
|
106
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
107
|
+
value: string | (() => string | undefined) | undefined;
|
|
108
|
+
};
|
|
109
|
+
window?: null;
|
|
110
|
+
cache?: RequestCache;
|
|
111
|
+
credentials?: RequestCredentials;
|
|
112
|
+
integrity?: string;
|
|
113
|
+
keepalive?: boolean;
|
|
114
|
+
mode?: RequestMode;
|
|
115
|
+
priority?: RequestPriority;
|
|
116
|
+
referrer?: string;
|
|
117
|
+
referrerPolicy?: ReferrerPolicy;
|
|
118
|
+
signal?: AbortSignal | null;
|
|
119
|
+
onRetry?: (response: _better_fetch_fetch0.ResponseContext) => Promise<void> | void;
|
|
120
|
+
hookOptions?: {
|
|
121
|
+
cloneResponse?: boolean;
|
|
122
|
+
};
|
|
123
|
+
timeout?: number;
|
|
124
|
+
duplex?: "full" | "half";
|
|
125
|
+
jsonParser: (text: string) => Promise<any> | any;
|
|
126
|
+
retry?: _better_fetch_fetch0.RetryOptions;
|
|
127
|
+
retryAttempt?: number;
|
|
128
|
+
errorSchema?: _better_fetch_fetch0.StandardSchemaV1;
|
|
129
|
+
disableValidation?: boolean;
|
|
130
|
+
catchAllError?: boolean;
|
|
131
|
+
defaultOutput?: _better_fetch_fetch0.StandardSchemaV1;
|
|
132
|
+
defaultError?: _better_fetch_fetch0.StandardSchemaV1;
|
|
133
|
+
schema?: _better_fetch_fetch0.Schema;
|
|
134
|
+
customFetchImpl: any;
|
|
135
|
+
}, unknown, unknown, _better_fetch_fetch0.Schema>;
|
|
136
|
+
$store: {
|
|
137
|
+
notify: (signal?: _faire_auth_core_types33.LiteralStringUnion<"$sessionSignal">) => void;
|
|
138
|
+
listen: (signal: _faire_auth_core_types33.LiteralStringUnion<"$sessionSignal">, listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
139
|
+
atoms: {
|
|
140
|
+
session: nanostores0.PreinitializedWritableAtom<{
|
|
141
|
+
data: {
|
|
142
|
+
user: _faire_auth_core_db0.User;
|
|
143
|
+
session: _faire_auth_core_db0.Session;
|
|
144
|
+
} | null;
|
|
145
|
+
error: BetterFetchError | null;
|
|
146
|
+
isPending: boolean;
|
|
147
|
+
isRefetching: boolean;
|
|
148
|
+
refetch: () => void;
|
|
149
|
+
}> & object;
|
|
150
|
+
$sessionSignal: nanostores0.PreinitializedWritableAtom<boolean> & object;
|
|
151
|
+
} & Record<string, nanostores0.WritableAtom<any>>;
|
|
152
|
+
};
|
|
153
|
+
$ERROR_CODES: Prettify<InferErrorCodes<Option> & typeof BASE_ERROR_CODES>;
|
|
154
|
+
};
|
|
155
|
+
//#endregion
|
|
156
|
+
export { capitalizeFirstLetter, createAuthClient, useStore };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { t as getBaseURL } from "../../url-BoUuoIwZ.mjs";
|
|
2
|
+
import "../../request-1NL_1lyJ.mjs";
|
|
3
|
+
import "../../defu-SZkpHhbR.mjs";
|
|
4
|
+
import { n as getClientConfig, t as createHonoClient } from "../../hono-Covz10jU.mjs";
|
|
5
|
+
import "../../parser-CeAer-RM.mjs";
|
|
6
|
+
import { listenKeys } from "nanostores";
|
|
7
|
+
import { useCallback, useRef, useSyncExternalStore } from "@lynx-js/react";
|
|
8
|
+
|
|
9
|
+
//#region src/client/lynx/lynx-store.ts
|
|
10
|
+
/**
|
|
11
|
+
* Subscribe to store changes and get store's value.
|
|
12
|
+
*
|
|
13
|
+
* Can be used with store builder too.
|
|
14
|
+
*
|
|
15
|
+
* ```js
|
|
16
|
+
* import { useStore } from 'nanostores/react'
|
|
17
|
+
*
|
|
18
|
+
* import { router } from '../store/router'
|
|
19
|
+
*
|
|
20
|
+
* export const Layout = () => {
|
|
21
|
+
* let page = useStore(router)
|
|
22
|
+
* if (page.route === 'home') {
|
|
23
|
+
* return <HomePage />
|
|
24
|
+
* } else {
|
|
25
|
+
* return <Error404 />
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param store Store instance.
|
|
31
|
+
* @returns Store value.
|
|
32
|
+
*/
|
|
33
|
+
function useStore(store, options = {}) {
|
|
34
|
+
let snapshotRef = useRef(store.get());
|
|
35
|
+
const { keys, deps = [store, keys] } = options;
|
|
36
|
+
let subscribe = useCallback((onChange) => {
|
|
37
|
+
const emitChange = (value) => {
|
|
38
|
+
if (snapshotRef.current === value) return;
|
|
39
|
+
snapshotRef.current = value;
|
|
40
|
+
onChange();
|
|
41
|
+
};
|
|
42
|
+
emitChange(store.value);
|
|
43
|
+
if (keys?.length) return listenKeys(store, keys, emitChange);
|
|
44
|
+
return store.listen(emitChange);
|
|
45
|
+
}, deps);
|
|
46
|
+
let get = () => snapshotRef.current;
|
|
47
|
+
return useSyncExternalStore(subscribe, get, get);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/client/lynx/index.ts
|
|
52
|
+
function getAtomKey(str) {
|
|
53
|
+
return `use${capitalizeFirstLetter(str)}`;
|
|
54
|
+
}
|
|
55
|
+
function capitalizeFirstLetter(str) {
|
|
56
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
57
|
+
}
|
|
58
|
+
const createAuthClient = () => (options) => {
|
|
59
|
+
const baseURL = getBaseURL(options.baseURL, options.basePath);
|
|
60
|
+
const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, $store, atomListeners } = getClientConfig(options);
|
|
61
|
+
let resolvedHooks = {};
|
|
62
|
+
for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[getAtomKey(key)] = () => useStore(value);
|
|
63
|
+
const routes = {
|
|
64
|
+
...pluginsActions,
|
|
65
|
+
...resolvedHooks,
|
|
66
|
+
$fetch,
|
|
67
|
+
$store
|
|
68
|
+
};
|
|
69
|
+
return createHonoClient({
|
|
70
|
+
baseURL,
|
|
71
|
+
createFetchOptions: options.fetchOptions
|
|
72
|
+
}, routes, $fetch, pluginsAtoms, atomListeners);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { capitalizeFirstLetter, createAuthClient, useStore };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { I as FaireAuthOptions } from "../../index-B-WeOMzg.cjs";
|
|
2
|
+
import "../../hono-DOM31WQz.cjs";
|
|
3
|
+
export * from "@simplewebauthn/server";
|
|
4
|
+
|
|
5
|
+
//#region src/client/plugins/infer-plugin.d.ts
|
|
6
|
+
declare const InferServerPlugin: <AuthOrOption extends {
|
|
7
|
+
options: FaireAuthOptions;
|
|
8
|
+
} | FaireAuthOptions, ID extends string>() => {
|
|
9
|
+
id: "infer-server-plugin";
|
|
10
|
+
$InferServerPlugin: (AuthOrOption extends {
|
|
11
|
+
options: infer O;
|
|
12
|
+
} ? O : AuthOrOption)["plugins"] extends (infer P)[] ? P extends {
|
|
13
|
+
id: ID;
|
|
14
|
+
} ? P : never : never;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { InferServerPlugin };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { I as FaireAuthOptions } from "../../index-jlessPI0.mjs";
|
|
2
|
+
import "../../hono-DuE14mmj.mjs";
|
|
3
|
+
export * from "@simplewebauthn/server";
|
|
4
|
+
|
|
5
|
+
//#region src/client/plugins/infer-plugin.d.ts
|
|
6
|
+
declare const InferServerPlugin: <AuthOrOption extends {
|
|
7
|
+
options: FaireAuthOptions;
|
|
8
|
+
} | FaireAuthOptions, ID extends string>() => {
|
|
9
|
+
id: "infer-server-plugin";
|
|
10
|
+
$InferServerPlugin: (AuthOrOption extends {
|
|
11
|
+
options: infer O;
|
|
12
|
+
} ? O : AuthOrOption)["plugins"] extends (infer P)[] ? P extends {
|
|
13
|
+
id: ID;
|
|
14
|
+
} ? P : never : never;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { InferServerPlugin };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const require_chunk = require('../../chunk-oakRccI5.cjs');
|
|
2
|
+
const require_url = require('../../url-D2yvKaM7.cjs');
|
|
3
|
+
require('../../request-CPNlp-DK.cjs');
|
|
4
|
+
require('../../defu-B0Svx_x4.cjs');
|
|
5
|
+
const require_hono = require('../../hono-BEq1NYVX.cjs');
|
|
6
|
+
require('../../parser-CdncAl9i.cjs');
|
|
7
|
+
let nanostores = require("nanostores");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
|
|
10
|
+
//#region src/client/react/react-store.ts
|
|
11
|
+
/**
|
|
12
|
+
* Subscribe to store changes and get store's value.
|
|
13
|
+
*
|
|
14
|
+
* Can be used with store builder too.
|
|
15
|
+
*
|
|
16
|
+
* ```js
|
|
17
|
+
* import { useStore } from 'nanostores/react'
|
|
18
|
+
*
|
|
19
|
+
* import { router } from '../store/router'
|
|
20
|
+
*
|
|
21
|
+
* export const Layout = () => {
|
|
22
|
+
* let page = useStore(router)
|
|
23
|
+
* if (page.route === 'home') {
|
|
24
|
+
* return <HomePage />
|
|
25
|
+
* } else {
|
|
26
|
+
* return <Error404 />
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param store Store instance.
|
|
32
|
+
* @returns Store value.
|
|
33
|
+
*/
|
|
34
|
+
function useStore(store, options = {}) {
|
|
35
|
+
let snapshotRef = (0, react.useRef)(store.get());
|
|
36
|
+
const { keys, deps = [store, keys] } = options;
|
|
37
|
+
let subscribe = (0, react.useCallback)((onChange) => {
|
|
38
|
+
const emitChange = (value) => {
|
|
39
|
+
if (snapshotRef.current === value) return;
|
|
40
|
+
snapshotRef.current = value;
|
|
41
|
+
onChange();
|
|
42
|
+
};
|
|
43
|
+
emitChange(store.value);
|
|
44
|
+
if (keys?.length) return (0, nanostores.listenKeys)(store, keys, emitChange);
|
|
45
|
+
return store.listen(emitChange);
|
|
46
|
+
}, deps);
|
|
47
|
+
let get = () => snapshotRef.current;
|
|
48
|
+
return (0, react.useSyncExternalStore)(subscribe, get, get);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/client/react/index.ts
|
|
53
|
+
function getAtomKey(str) {
|
|
54
|
+
return `use${capitalizeFirstLetter(str)}`;
|
|
55
|
+
}
|
|
56
|
+
function capitalizeFirstLetter(str) {
|
|
57
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
58
|
+
}
|
|
59
|
+
const createAuthClient = () => (options) => {
|
|
60
|
+
const baseURL = require_url.getBaseURL(options.baseURL, options.basePath);
|
|
61
|
+
const { pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = require_hono.getClientConfig(options);
|
|
62
|
+
let resolvedHooks = {};
|
|
63
|
+
for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[getAtomKey(key)] = () => useStore(value);
|
|
64
|
+
const routes = {
|
|
65
|
+
...pluginsActions,
|
|
66
|
+
...resolvedHooks,
|
|
67
|
+
$fetch,
|
|
68
|
+
$store
|
|
69
|
+
};
|
|
70
|
+
return require_hono.createHonoClient({
|
|
71
|
+
baseURL,
|
|
72
|
+
createFetchOptions: options.fetchOptions
|
|
73
|
+
}, routes, $fetch, pluginsAtoms, atomListeners);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
78
|
+
exports.createAuthClient = createAuthClient;
|
|
79
|
+
exports.useStore = useStore;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { $ as Client, B as DefaultApp, dt as IsSignal, et as ClientOptions, it as InferActions, nt as FaireAuthClientPlugin, pt as SessionQueryParams, st as InferErrorCodes } from "../../index-B-WeOMzg.cjs";
|
|
2
|
+
import "../../hono-DOM31WQz.cjs";
|
|
3
|
+
import * as _faire_auth_core_types32 from "@faire-auth/core/types";
|
|
4
|
+
import { AnyHono, Prettify, UnionToIntersection } from "@faire-auth/core/types";
|
|
5
|
+
import * as hono33 from "hono";
|
|
6
|
+
import { Hono } from "hono";
|
|
7
|
+
import * as _faire_auth_core_db0 from "@faire-auth/core/db";
|
|
8
|
+
import { BASE_ERROR_CODES } from "@faire-auth/core/error";
|
|
9
|
+
import * as _better_fetch_fetch0 from "@better-fetch/fetch";
|
|
10
|
+
import { BetterFetchError } from "@better-fetch/fetch";
|
|
11
|
+
import * as nanostores0 from "nanostores";
|
|
12
|
+
import { Store, StoreValue } from "nanostores";
|
|
13
|
+
import { DependencyList } from "react";
|
|
14
|
+
export * from "@better-fetch/fetch";
|
|
15
|
+
export * from "nanostores";
|
|
16
|
+
|
|
17
|
+
//#region src/client/react/react-store.d.ts
|
|
18
|
+
type StoreKeys<T> = T extends {
|
|
19
|
+
setKey: (k: infer K, v: any) => unknown;
|
|
20
|
+
} ? K : never;
|
|
21
|
+
interface UseStoreOptions<SomeStore> {
|
|
22
|
+
/**
|
|
23
|
+
* @default
|
|
24
|
+
* ```ts
|
|
25
|
+
* [store, options.keys]
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
deps?: DependencyList;
|
|
29
|
+
/**
|
|
30
|
+
* Will re-render components only on specific key changes.
|
|
31
|
+
*/
|
|
32
|
+
keys?: StoreKeys<SomeStore>[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Subscribe to store changes and get store's value.
|
|
36
|
+
*
|
|
37
|
+
* Can be used with store builder too.
|
|
38
|
+
*
|
|
39
|
+
* ```js
|
|
40
|
+
* import { useStore } from 'nanostores/react'
|
|
41
|
+
*
|
|
42
|
+
* import { router } from '../store/router'
|
|
43
|
+
*
|
|
44
|
+
* export const Layout = () => {
|
|
45
|
+
* let page = useStore(router)
|
|
46
|
+
* if (page.route === 'home') {
|
|
47
|
+
* return <HomePage />
|
|
48
|
+
* } else {
|
|
49
|
+
* return <Error404 />
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @param store Store instance.
|
|
55
|
+
* @returns Store value.
|
|
56
|
+
*/
|
|
57
|
+
declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/client/react/index.d.ts
|
|
60
|
+
declare function capitalizeFirstLetter(str: string): string;
|
|
61
|
+
type InferResolvedHooks<O extends ClientOptions> = O["plugins"] extends Array<infer Plugin> ? Plugin extends FaireAuthClientPlugin ? Plugin["getAtoms"] extends ((fetch: any) => infer Atoms) ? Atoms extends Record<string, any> ? { [key in keyof Atoms as IsSignal<key> extends true ? never : key extends string ? `use${Capitalize<key>}` : never]: () => ReturnType<Atoms[key]["get"]> } : {} : {} : {} : {};
|
|
62
|
+
declare const createAuthClient: <App extends AnyHono = DefaultApp>() => <Option extends ClientOptions>(options: Option) => UnionToIntersection<InferResolvedHooks<Option>> & (App extends Hono<any, infer S extends hono33.Schema, infer P extends string> ? Client<S, P, Option> : never) & InferActions<Option> & {
|
|
63
|
+
useSession: () => {
|
|
64
|
+
data: (App extends Hono<any, infer S_1 extends hono33.Schema, infer P_1 extends string> ? (S_1[`${P_1}/get-session`]["$get"]["output"] & {
|
|
65
|
+
success: true;
|
|
66
|
+
})["data"] : never) | null;
|
|
67
|
+
isPending: boolean;
|
|
68
|
+
error: BetterFetchError | null;
|
|
69
|
+
refetch: (queryParams?: {
|
|
70
|
+
query?: SessionQueryParams;
|
|
71
|
+
}) => void;
|
|
72
|
+
};
|
|
73
|
+
$Infer: {
|
|
74
|
+
Session: NonNullable<App extends Hono<any, infer S_1 extends hono33.Schema, infer P_1 extends string> ? (S_1[`${P_1}/get-session`]["$get"]["output"] & {
|
|
75
|
+
success: true;
|
|
76
|
+
})["data"] : never>;
|
|
77
|
+
};
|
|
78
|
+
$fetch: _better_fetch_fetch0.BetterFetch<{
|
|
79
|
+
plugins: (_better_fetch_fetch0.BetterFetchPlugin | {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
hooks: {};
|
|
83
|
+
})[];
|
|
84
|
+
method: string;
|
|
85
|
+
output?: _better_fetch_fetch0.StandardSchemaV1 | typeof Blob | typeof File;
|
|
86
|
+
query?: any;
|
|
87
|
+
baseURL: string;
|
|
88
|
+
headers?: HeadersInit & (HeadersInit | {
|
|
89
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
90
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
91
|
+
authorization: "Bearer" | "Basic";
|
|
92
|
+
});
|
|
93
|
+
redirect?: RequestRedirect;
|
|
94
|
+
params?: any;
|
|
95
|
+
body?: any;
|
|
96
|
+
throw?: boolean;
|
|
97
|
+
auth?: {
|
|
98
|
+
type: "Bearer";
|
|
99
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
100
|
+
} | {
|
|
101
|
+
type: "Basic";
|
|
102
|
+
username: string | (() => string | undefined) | undefined;
|
|
103
|
+
password: string | (() => string | undefined) | undefined;
|
|
104
|
+
} | {
|
|
105
|
+
type: "Custom";
|
|
106
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
107
|
+
value: string | (() => string | undefined) | undefined;
|
|
108
|
+
};
|
|
109
|
+
window?: null;
|
|
110
|
+
cache?: RequestCache;
|
|
111
|
+
credentials?: RequestCredentials;
|
|
112
|
+
integrity?: string;
|
|
113
|
+
keepalive?: boolean;
|
|
114
|
+
mode?: RequestMode;
|
|
115
|
+
priority?: RequestPriority;
|
|
116
|
+
referrer?: string;
|
|
117
|
+
referrerPolicy?: ReferrerPolicy;
|
|
118
|
+
signal?: AbortSignal | null;
|
|
119
|
+
onRetry?: (response: _better_fetch_fetch0.ResponseContext) => Promise<void> | void;
|
|
120
|
+
hookOptions?: {
|
|
121
|
+
cloneResponse?: boolean;
|
|
122
|
+
};
|
|
123
|
+
timeout?: number;
|
|
124
|
+
duplex?: "full" | "half";
|
|
125
|
+
jsonParser: (text: string) => Promise<any> | any;
|
|
126
|
+
retry?: _better_fetch_fetch0.RetryOptions;
|
|
127
|
+
retryAttempt?: number;
|
|
128
|
+
errorSchema?: _better_fetch_fetch0.StandardSchemaV1;
|
|
129
|
+
disableValidation?: boolean;
|
|
130
|
+
catchAllError?: boolean;
|
|
131
|
+
defaultOutput?: _better_fetch_fetch0.StandardSchemaV1;
|
|
132
|
+
defaultError?: _better_fetch_fetch0.StandardSchemaV1;
|
|
133
|
+
schema?: _better_fetch_fetch0.Schema;
|
|
134
|
+
customFetchImpl: any;
|
|
135
|
+
}, unknown, unknown, _better_fetch_fetch0.Schema>;
|
|
136
|
+
$store: {
|
|
137
|
+
notify: (signal?: _faire_auth_core_types32.LiteralStringUnion<"$sessionSignal">) => void;
|
|
138
|
+
listen: (signal: _faire_auth_core_types32.LiteralStringUnion<"$sessionSignal">, listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
139
|
+
atoms: {
|
|
140
|
+
session: nanostores0.PreinitializedWritableAtom<{
|
|
141
|
+
data: {
|
|
142
|
+
user: _faire_auth_core_db0.User;
|
|
143
|
+
session: _faire_auth_core_db0.Session;
|
|
144
|
+
} | null;
|
|
145
|
+
error: BetterFetchError | null;
|
|
146
|
+
isPending: boolean;
|
|
147
|
+
isRefetching: boolean;
|
|
148
|
+
refetch: () => void;
|
|
149
|
+
}> & object;
|
|
150
|
+
$sessionSignal: nanostores0.PreinitializedWritableAtom<boolean> & object;
|
|
151
|
+
} & Record<string, nanostores0.WritableAtom<any>>;
|
|
152
|
+
};
|
|
153
|
+
$ERROR_CODES: Prettify<InferErrorCodes<Option> & typeof BASE_ERROR_CODES>;
|
|
154
|
+
};
|
|
155
|
+
//#endregion
|
|
156
|
+
export { capitalizeFirstLetter, createAuthClient, useStore };
|