clefbase 1.3.1 → 1.3.2
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/auth/index.d.ts +128 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +192 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
import { HttpClient } from "../http";
|
|
2
2
|
import type { AuthUser, AuthResult } from "../types";
|
|
3
|
+
interface GisNotification {
|
|
4
|
+
isNotDisplayed(): boolean;
|
|
5
|
+
isSkippedMoment(): boolean;
|
|
6
|
+
isDismissedMoment(): boolean;
|
|
7
|
+
getNotDisplayedReason(): string;
|
|
8
|
+
getSkippedReason(): string;
|
|
9
|
+
getDismissedReason(): string;
|
|
10
|
+
}
|
|
11
|
+
interface GoogleAccountsId {
|
|
12
|
+
initialize(config: {
|
|
13
|
+
client_id: string;
|
|
14
|
+
callback: (response: {
|
|
15
|
+
credential: string;
|
|
16
|
+
}) => void;
|
|
17
|
+
auto_select?: boolean;
|
|
18
|
+
cancel_on_tap_outside?: boolean;
|
|
19
|
+
}): void;
|
|
20
|
+
prompt(momentListener?: (n: GisNotification) => void): void;
|
|
21
|
+
renderButton(parent: HTMLElement, options: {
|
|
22
|
+
type?: "standard" | "icon";
|
|
23
|
+
theme?: "outline" | "filled_blue" | "filled_black";
|
|
24
|
+
size?: "large" | "medium" | "small";
|
|
25
|
+
text?: "signin_with" | "signup_with" | "continue_with" | "signin";
|
|
26
|
+
shape?: "rectangular" | "pill" | "circle" | "square";
|
|
27
|
+
logo_alignment?: "left" | "center";
|
|
28
|
+
width?: number;
|
|
29
|
+
locale?: string;
|
|
30
|
+
}): void;
|
|
31
|
+
disableAutoSelect(): void;
|
|
32
|
+
revoke(hint: string, done: () => void): void;
|
|
33
|
+
}
|
|
34
|
+
declare global {
|
|
35
|
+
interface Window {
|
|
36
|
+
google?: {
|
|
37
|
+
accounts: {
|
|
38
|
+
id: GoogleAccountsId;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Options for rendering a Google-branded sign-in button.
|
|
45
|
+
* Pass to `auth.signInWithGoogle()` to show a button instead of One Tap.
|
|
46
|
+
*/
|
|
47
|
+
export interface GoogleButtonOptions {
|
|
48
|
+
/** The DOM element to render the button into. */
|
|
49
|
+
container: HTMLElement;
|
|
50
|
+
theme?: "outline" | "filled_blue" | "filled_black";
|
|
51
|
+
size?: "large" | "medium" | "small";
|
|
52
|
+
text?: "signin_with" | "signup_with" | "continue_with" | "signin";
|
|
53
|
+
shape?: "rectangular" | "pill";
|
|
54
|
+
/** Pixel width of the button (min 200, max 400). */
|
|
55
|
+
width?: number;
|
|
56
|
+
locale?: string;
|
|
57
|
+
}
|
|
3
58
|
type AuthStateCallback = (user: AuthUser | null) => void;
|
|
4
59
|
/**
|
|
5
60
|
* Authentication service. Obtain via `getAuth(app)`.
|
|
@@ -14,9 +69,12 @@ export declare class Auth {
|
|
|
14
69
|
private readonly http;
|
|
15
70
|
private readonly store;
|
|
16
71
|
private listeners;
|
|
72
|
+
/** Cached Google Client ID. `null` = confirmed not configured. `undefined` = not yet fetched. */
|
|
73
|
+
private _googleClientId;
|
|
17
74
|
constructor(http: HttpClient);
|
|
18
75
|
private notify;
|
|
19
76
|
private handleResult;
|
|
77
|
+
private resolveGoogleClientId;
|
|
20
78
|
/** @internal — used by Storage to attach the bearer token to upload requests */
|
|
21
79
|
getAuthHeaders(): Record<string, string>;
|
|
22
80
|
/** The currently signed-in user, or null. */
|
|
@@ -44,6 +102,76 @@ export declare class Auth {
|
|
|
44
102
|
* const { user, token } = await auth.signIn("alice@example.com", "pass");
|
|
45
103
|
*/
|
|
46
104
|
signIn(email: string, password: string): Promise<AuthResult>;
|
|
105
|
+
/**
|
|
106
|
+
* Sign in with Google using the Google Identity Services popup or One Tap.
|
|
107
|
+
*
|
|
108
|
+
* Browser-only. The GIS script (`accounts.google.com/gsi/client`) is loaded
|
|
109
|
+
* automatically — no manual `<script>` tag needed.
|
|
110
|
+
*
|
|
111
|
+
* Without `buttonOptions`, the Google One Tap prompt is shown.
|
|
112
|
+
* Pass `{ container }` to render a fully styled Google button instead —
|
|
113
|
+
* which is more reliable since One Tap can be suppressed by the browser.
|
|
114
|
+
*
|
|
115
|
+
* Automatically handles new sign-ups: if the Google account has never been
|
|
116
|
+
* seen before, a new user record is created server-side.
|
|
117
|
+
*
|
|
118
|
+
* @throws `ClefbaseError` with code `GOOGLE_NOT_CONFIGURED` if no Client ID
|
|
119
|
+
* has been set in the project's auth settings.
|
|
120
|
+
* @throws `ClefbaseError` with code `GOOGLE_PROMPT_SUPPRESSED` if One Tap
|
|
121
|
+
* could not be displayed (switch to button mode in that case).
|
|
122
|
+
* @throws `ClefbaseError` with code `GOOGLE_SIGN_IN_CANCELLED` if the user
|
|
123
|
+
* dismissed the popup.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* // One Tap prompt
|
|
127
|
+
* const { user } = await auth.signInWithGoogle();
|
|
128
|
+
*
|
|
129
|
+
* // Branded Google button
|
|
130
|
+
* const { user } = await auth.signInWithGoogle({
|
|
131
|
+
* container: document.getElementById("google-btn")!,
|
|
132
|
+
* theme: "filled_blue",
|
|
133
|
+
* size: "large",
|
|
134
|
+
* text: "continue_with",
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* // React example
|
|
138
|
+
* const btnRef = useRef<HTMLDivElement>(null);
|
|
139
|
+
* await auth.signInWithGoogle({ container: btnRef.current! });
|
|
140
|
+
*/
|
|
141
|
+
signInWithGoogle(buttonOptions?: GoogleButtonOptions): Promise<AuthResult>;
|
|
142
|
+
/**
|
|
143
|
+
* Sign in with Google using a raw ID token string.
|
|
144
|
+
*
|
|
145
|
+
* Use this when you already have a `credential` from Google's callback —
|
|
146
|
+
* for example with a custom button implementation, React Native Google
|
|
147
|
+
* Sign-In, or any other flow that gives you an ID token directly.
|
|
148
|
+
*
|
|
149
|
+
* Works in both browser and Node.js environments.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* // Inside a GIS callback
|
|
153
|
+
* google.accounts.id.initialize({
|
|
154
|
+
* client_id: "...",
|
|
155
|
+
* callback: async ({ credential }) => {
|
|
156
|
+
* const { user } = await auth.signInWithGoogleToken(credential);
|
|
157
|
+
* },
|
|
158
|
+
* });
|
|
159
|
+
*
|
|
160
|
+
* // React Native
|
|
161
|
+
* const { idToken } = await GoogleSignin.signIn();
|
|
162
|
+
* const { user } = await auth.signInWithGoogleToken(idToken);
|
|
163
|
+
*/
|
|
164
|
+
signInWithGoogleToken(idToken: string): Promise<AuthResult>;
|
|
165
|
+
/**
|
|
166
|
+
* Returns `true` if Google Sign-In is configured for this project.
|
|
167
|
+
* Useful for conditionally rendering a "Sign in with Google" button.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* if (await auth.isGoogleSignInEnabled()) {
|
|
171
|
+
* showGoogleButton();
|
|
172
|
+
* }
|
|
173
|
+
*/
|
|
174
|
+
isGoogleSignInEnabled(): Promise<boolean>;
|
|
47
175
|
/** Sign out and clear the local session. */
|
|
48
176
|
signOut(): Promise<void>;
|
|
49
177
|
/** Re-fetch the current user's profile from the server and update the cache. */
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.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AAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1D,qEAAqE;IAC/D,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlF,uEAAuE;IACjE,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5C,oDAAoD;IAC9C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIlD;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,IAAI;CAO5D"}
|
package/dist/auth/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Auth = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
4
5
|
class SessionStore {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.session = null;
|
|
@@ -46,6 +47,44 @@ class SessionStore {
|
|
|
46
47
|
catch { /* ignore */ }
|
|
47
48
|
}
|
|
48
49
|
}
|
|
50
|
+
// ─── GIS script loader ────────────────────────────────────────────────────────
|
|
51
|
+
const GIS_SCRIPT_URL = "https://accounts.google.com/gsi/client";
|
|
52
|
+
let _gisLoading = null;
|
|
53
|
+
function loadGisScript() {
|
|
54
|
+
if (typeof window === "undefined") {
|
|
55
|
+
return Promise.reject(new types_1.ClefbaseError("signInWithGoogle() requires a browser environment. " +
|
|
56
|
+
"Use signInWithGoogleToken(idToken) for server/Node.js contexts.", "UNSUPPORTED_ENVIRONMENT"));
|
|
57
|
+
}
|
|
58
|
+
if (window.google?.accounts?.id)
|
|
59
|
+
return Promise.resolve();
|
|
60
|
+
if (_gisLoading)
|
|
61
|
+
return _gisLoading;
|
|
62
|
+
_gisLoading = new Promise((resolve, reject) => {
|
|
63
|
+
if (window.google?.accounts?.id) {
|
|
64
|
+
resolve();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const existing = document.querySelector(`script[src="${GIS_SCRIPT_URL}"]`);
|
|
68
|
+
const onLoad = () => resolve();
|
|
69
|
+
const onError = () => {
|
|
70
|
+
_gisLoading = null;
|
|
71
|
+
reject(new types_1.ClefbaseError("Failed to load the Google Identity Services script. Check your internet connection and Content Security Policy.", "GOOGLE_SCRIPT_LOAD_ERROR"));
|
|
72
|
+
};
|
|
73
|
+
if (existing) {
|
|
74
|
+
existing.addEventListener("load", onLoad, { once: true });
|
|
75
|
+
existing.addEventListener("error", onError, { once: true });
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const script = document.createElement("script");
|
|
79
|
+
script.src = GIS_SCRIPT_URL;
|
|
80
|
+
script.async = true;
|
|
81
|
+
script.defer = true;
|
|
82
|
+
script.addEventListener("load", onLoad, { once: true });
|
|
83
|
+
script.addEventListener("error", onError, { once: true });
|
|
84
|
+
document.head.appendChild(script);
|
|
85
|
+
});
|
|
86
|
+
return _gisLoading;
|
|
87
|
+
}
|
|
49
88
|
/**
|
|
50
89
|
* Authentication service. Obtain via `getAuth(app)`.
|
|
51
90
|
*
|
|
@@ -60,7 +99,8 @@ class Auth {
|
|
|
60
99
|
this.http = http;
|
|
61
100
|
this.store = new SessionStore();
|
|
62
101
|
this.listeners = [];
|
|
63
|
-
|
|
102
|
+
/** Cached Google Client ID. `null` = confirmed not configured. `undefined` = not yet fetched. */
|
|
103
|
+
this._googleClientId = undefined;
|
|
64
104
|
this.store.load();
|
|
65
105
|
}
|
|
66
106
|
// ── Internals ─────────────────────────────────────────────────────────────
|
|
@@ -81,6 +121,23 @@ class Auth {
|
|
|
81
121
|
this.notify(result.user);
|
|
82
122
|
return result;
|
|
83
123
|
}
|
|
124
|
+
async resolveGoogleClientId() {
|
|
125
|
+
if (this._googleClientId !== undefined) {
|
|
126
|
+
if (!this._googleClientId) {
|
|
127
|
+
throw new types_1.ClefbaseError("Google Sign-In is not enabled for this project. " +
|
|
128
|
+
"Add a Google Client ID in your Clefbase auth settings.", "GOOGLE_NOT_CONFIGURED");
|
|
129
|
+
}
|
|
130
|
+
return this._googleClientId;
|
|
131
|
+
}
|
|
132
|
+
const cfg = await this.http.get("/google/config");
|
|
133
|
+
if (!cfg.enabled || !cfg.clientId) {
|
|
134
|
+
this._googleClientId = null;
|
|
135
|
+
throw new types_1.ClefbaseError("Google Sign-In is not enabled for this project. " +
|
|
136
|
+
"Add a Google Client ID in your Clefbase auth settings.", "GOOGLE_NOT_CONFIGURED");
|
|
137
|
+
}
|
|
138
|
+
this._googleClientId = cfg.clientId;
|
|
139
|
+
return this._googleClientId;
|
|
140
|
+
}
|
|
84
141
|
/** @internal — used by Storage to attach the bearer token to upload requests */
|
|
85
142
|
getAuthHeaders() {
|
|
86
143
|
const s = this.store.load();
|
|
@@ -116,6 +173,133 @@ class Auth {
|
|
|
116
173
|
const result = await this.http.post("/signin", { email, password });
|
|
117
174
|
return this.handleResult(result);
|
|
118
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Sign in with Google using the Google Identity Services popup or One Tap.
|
|
178
|
+
*
|
|
179
|
+
* Browser-only. The GIS script (`accounts.google.com/gsi/client`) is loaded
|
|
180
|
+
* automatically — no manual `<script>` tag needed.
|
|
181
|
+
*
|
|
182
|
+
* Without `buttonOptions`, the Google One Tap prompt is shown.
|
|
183
|
+
* Pass `{ container }` to render a fully styled Google button instead —
|
|
184
|
+
* which is more reliable since One Tap can be suppressed by the browser.
|
|
185
|
+
*
|
|
186
|
+
* Automatically handles new sign-ups: if the Google account has never been
|
|
187
|
+
* seen before, a new user record is created server-side.
|
|
188
|
+
*
|
|
189
|
+
* @throws `ClefbaseError` with code `GOOGLE_NOT_CONFIGURED` if no Client ID
|
|
190
|
+
* has been set in the project's auth settings.
|
|
191
|
+
* @throws `ClefbaseError` with code `GOOGLE_PROMPT_SUPPRESSED` if One Tap
|
|
192
|
+
* could not be displayed (switch to button mode in that case).
|
|
193
|
+
* @throws `ClefbaseError` with code `GOOGLE_SIGN_IN_CANCELLED` if the user
|
|
194
|
+
* dismissed the popup.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* // One Tap prompt
|
|
198
|
+
* const { user } = await auth.signInWithGoogle();
|
|
199
|
+
*
|
|
200
|
+
* // Branded Google button
|
|
201
|
+
* const { user } = await auth.signInWithGoogle({
|
|
202
|
+
* container: document.getElementById("google-btn")!,
|
|
203
|
+
* theme: "filled_blue",
|
|
204
|
+
* size: "large",
|
|
205
|
+
* text: "continue_with",
|
|
206
|
+
* });
|
|
207
|
+
*
|
|
208
|
+
* // React example
|
|
209
|
+
* const btnRef = useRef<HTMLDivElement>(null);
|
|
210
|
+
* await auth.signInWithGoogle({ container: btnRef.current! });
|
|
211
|
+
*/
|
|
212
|
+
async signInWithGoogle(buttonOptions) {
|
|
213
|
+
const clientId = await this.resolveGoogleClientId();
|
|
214
|
+
await loadGisScript();
|
|
215
|
+
const gis = window.google.accounts.id;
|
|
216
|
+
return new Promise((resolve, reject) => {
|
|
217
|
+
gis.initialize({
|
|
218
|
+
client_id: clientId,
|
|
219
|
+
auto_select: false,
|
|
220
|
+
cancel_on_tap_outside: true,
|
|
221
|
+
callback: async ({ credential }) => {
|
|
222
|
+
try {
|
|
223
|
+
resolve(await this.signInWithGoogleToken(credential));
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
reject(err);
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
if (buttonOptions?.container) {
|
|
231
|
+
const { container, theme, size, text, shape, width, locale } = buttonOptions;
|
|
232
|
+
gis.renderButton(container, {
|
|
233
|
+
type: "standard",
|
|
234
|
+
theme: theme ?? "outline",
|
|
235
|
+
size: size ?? "large",
|
|
236
|
+
text: text ?? "signin_with",
|
|
237
|
+
shape: shape ?? "rectangular",
|
|
238
|
+
logo_alignment: "left",
|
|
239
|
+
width,
|
|
240
|
+
locale,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
gis.prompt((n) => {
|
|
245
|
+
if (n.isNotDisplayed()) {
|
|
246
|
+
reject(new types_1.ClefbaseError(`Google One Tap could not be displayed (${n.getNotDisplayedReason()}). ` +
|
|
247
|
+
"Pass a { container } element to render a sign-in button instead.", "GOOGLE_PROMPT_SUPPRESSED"));
|
|
248
|
+
}
|
|
249
|
+
else if (n.isSkippedMoment() || n.isDismissedMoment()) {
|
|
250
|
+
reject(new types_1.ClefbaseError("Google Sign-In was cancelled by the user.", "GOOGLE_SIGN_IN_CANCELLED"));
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Sign in with Google using a raw ID token string.
|
|
258
|
+
*
|
|
259
|
+
* Use this when you already have a `credential` from Google's callback —
|
|
260
|
+
* for example with a custom button implementation, React Native Google
|
|
261
|
+
* Sign-In, or any other flow that gives you an ID token directly.
|
|
262
|
+
*
|
|
263
|
+
* Works in both browser and Node.js environments.
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* // Inside a GIS callback
|
|
267
|
+
* google.accounts.id.initialize({
|
|
268
|
+
* client_id: "...",
|
|
269
|
+
* callback: async ({ credential }) => {
|
|
270
|
+
* const { user } = await auth.signInWithGoogleToken(credential);
|
|
271
|
+
* },
|
|
272
|
+
* });
|
|
273
|
+
*
|
|
274
|
+
* // React Native
|
|
275
|
+
* const { idToken } = await GoogleSignin.signIn();
|
|
276
|
+
* const { user } = await auth.signInWithGoogleToken(idToken);
|
|
277
|
+
*/
|
|
278
|
+
async signInWithGoogleToken(idToken) {
|
|
279
|
+
if (!idToken || typeof idToken !== "string") {
|
|
280
|
+
throw new types_1.ClefbaseError("idToken must be a non-empty string.", "INVALID_ARGUMENT");
|
|
281
|
+
}
|
|
282
|
+
const result = await this.http.post("/google", { idToken });
|
|
283
|
+
return this.handleResult(result);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Returns `true` if Google Sign-In is configured for this project.
|
|
287
|
+
* Useful for conditionally rendering a "Sign in with Google" button.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* if (await auth.isGoogleSignInEnabled()) {
|
|
291
|
+
* showGoogleButton();
|
|
292
|
+
* }
|
|
293
|
+
*/
|
|
294
|
+
async isGoogleSignInEnabled() {
|
|
295
|
+
try {
|
|
296
|
+
const cfg = await this.http.get("/google/config");
|
|
297
|
+
return cfg.enabled && Boolean(cfg.clientId);
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
119
303
|
/** Sign out and clear the local session. */
|
|
120
304
|
async signOut() {
|
|
121
305
|
const token = this.currentToken;
|
|
@@ -127,6 +311,13 @@ class Auth {
|
|
|
127
311
|
}
|
|
128
312
|
this.store.clear();
|
|
129
313
|
this.notify(null);
|
|
314
|
+
// Tell GIS to disable auto-select so the user isn't silently re-signed in
|
|
315
|
+
if (typeof window !== "undefined" && window.google?.accounts?.id) {
|
|
316
|
+
try {
|
|
317
|
+
window.google.accounts.id.disableAutoSelect();
|
|
318
|
+
}
|
|
319
|
+
catch { /* ignore */ }
|
|
320
|
+
}
|
|
130
321
|
}
|
|
131
322
|
/** Re-fetch the current user's profile from the server and update the cache. */
|
|
132
323
|
async refreshCurrentUser() {
|
package/dist/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":";;;AAEA,oCAAyC;AAUzC,MAAM,YAAY;IAAlB;QACU,YAAO,GAA4B,IAAI,CAAC;QAC/B,QAAG,GAAG,aAAa,CAAC;IAiCvC,CAAC;IA/BC,IAAY,EAAE;QACZ,IAAI,CAAC;YAAC,OAAO,OAAO,YAAY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QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QAC1D,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC;CACF;AAxVD,oBAwVC"}
|
package/dist/cli.js
CHANGED
|
@@ -34405,7 +34405,7 @@ async function runSitesList(cwd = process.cwd()) {
|
|
|
34405
34405
|
}
|
|
34406
34406
|
|
|
34407
34407
|
// package.json
|
|
34408
|
-
var version = "1.3.
|
|
34408
|
+
var version = "1.3.2";
|
|
34409
34409
|
|
|
34410
34410
|
// src/cli/index.ts
|
|
34411
34411
|
var program2 = new Command();
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
export { ClefbaseApp, initClefbase, getApp, getDatabase, getAuth, getStorage, getHosting, } from "./app";
|
|
20
20
|
export { Database, CollectionReference, DocumentReference, Query } from "./db";
|
|
21
21
|
export { Auth } from "./auth";
|
|
22
|
+
export type { GoogleButtonOptions } from "./auth";
|
|
22
23
|
export { ClefbaseStorage, StorageReference, BucketReference } from "./storage";
|
|
23
24
|
export type { StorageFile } from "./storage";
|
|
24
25
|
export type { StorageImageStatus } from "./react/StorageImage";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,MAAM,EACN,WAAW,EACX,OAAO,EACP,UAAU,EACV,UAAU,GACX,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAG/E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,MAAM,EACN,WAAW,EACX,OAAO,EACP,UAAU,EACV,UAAU,GACX,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAG/E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQ7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC3D,YAAY,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,GACb,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,iFAAiF;AACjF,6BAQe;AAPb,kGAAA,WAAW,OAAA;AACX,mGAAA,YAAY,OAAA;AACZ,6FAAA,MAAM,OAAA;AACN,kGAAA,WAAW,OAAA;AACX,8FAAA,OAAO,OAAA;AACP,iGAAA,UAAU,OAAA;AACV,iGAAA,UAAU,OAAA;AAGZ,iFAAiF;AACjF,2BAA+E;AAAtE,8FAAA,QAAQ,OAAA;AAAE,yGAAA,mBAAmB,OAAA;AAAE,uGAAA,iBAAiB,OAAA;AAAE,2FAAA,KAAK,OAAA;AAEhE,iFAAiF;AACjF,+BAA8B;AAArB,4FAAA,IAAI,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,iFAAiF;AACjF,6BAQe;AAPb,kGAAA,WAAW,OAAA;AACX,mGAAA,YAAY,OAAA;AACZ,6FAAA,MAAM,OAAA;AACN,kGAAA,WAAW,OAAA;AACX,8FAAA,OAAO,OAAA;AACP,iGAAA,UAAU,OAAA;AACV,iGAAA,UAAU,OAAA;AAGZ,iFAAiF;AACjF,2BAA+E;AAAtE,8FAAA,QAAQ,OAAA;AAAE,yGAAA,mBAAmB,OAAA;AAAE,uGAAA,iBAAiB,OAAA;AAAE,2FAAA,KAAK,OAAA;AAEhE,iFAAiF;AACjF,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAGb,iFAAiF;AACjF,qCAA+E;AAAtE,0GAAA,eAAe,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAAE,0GAAA,eAAe,OAAA;AAW3D,iFAAiF;AACjF,qCAA2D;AAAlD,0GAAA,eAAe,OAAA;AAAE,wGAAA,aAAa,OAAA;AAyBvC,iCAAwC;AAA/B,sGAAA,aAAa,OAAA"}
|