@rebasepro/client 0.1.2 → 0.2.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/LICENSE +21 -6
- package/dist/auth.d.ts +8 -6
- package/dist/index.es.js +2 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -9
- package/src/auth.ts +4 -8
- package/src/index.ts +1 -1
- package/src/transport.ts +2 -2
package/LICENSE
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rebase
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/auth.d.ts
CHANGED
|
@@ -24,8 +24,8 @@ export type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "TOKEN_REFRESHED" | "
|
|
|
24
24
|
export interface AuthConfig {
|
|
25
25
|
needsSetup: boolean;
|
|
26
26
|
registrationEnabled: boolean;
|
|
27
|
-
googleEnabled: boolean;
|
|
28
27
|
emailServiceEnabled: boolean;
|
|
28
|
+
enabledProviders: string[];
|
|
29
29
|
}
|
|
30
30
|
export interface AuthStorage {
|
|
31
31
|
getItem: (key: string) => string | null;
|
|
@@ -50,11 +50,13 @@ export declare function createAuth(transport: Transport, options?: CreateAuthOpt
|
|
|
50
50
|
accessToken: string;
|
|
51
51
|
refreshToken: string;
|
|
52
52
|
}>;
|
|
53
|
-
signInWithGoogle: (
|
|
54
|
-
idToken
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
signInWithGoogle: (payload: {
|
|
54
|
+
idToken: string;
|
|
55
|
+
} | {
|
|
56
|
+
accessToken: string;
|
|
57
|
+
} | {
|
|
58
|
+
code: string;
|
|
59
|
+
redirectUri: string;
|
|
58
60
|
}) => Promise<{
|
|
59
61
|
user: RebaseUser;
|
|
60
62
|
accessToken: string;
|
package/dist/index.es.js
CHANGED
|
@@ -381,13 +381,12 @@ function createAuth(transport, options) {
|
|
|
381
381
|
refreshToken: session.refreshToken
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
|
-
async function signInWithGoogle(
|
|
384
|
+
async function signInWithGoogle(payload) {
|
|
385
385
|
const fetchFn = getFetch();
|
|
386
|
-
const body = typeof tokenOrPayload === "string" ? { idToken: tokenOrPayload } : tokenOrPayload;
|
|
387
386
|
const res = await fetchFn(authUrl("/google"), {
|
|
388
387
|
method: "POST",
|
|
389
388
|
headers: { "Content-Type": "application/json" },
|
|
390
|
-
body: JSON.stringify(
|
|
389
|
+
body: JSON.stringify(payload)
|
|
391
390
|
});
|
|
392
391
|
const responseBody = await res.json().catch(() => ({}));
|
|
393
392
|
if (!res.ok) throwApiError(res.status, responseBody, res.statusText);
|