UNPKG

29.3 kBTypeScriptView Raw
1import { FirebaseApp } from 'firebase/app';
2import * as vue_demi from 'vue-demi';
3import { MaybeRefOrGetter, App, Ref } from 'vue-demi';
4import * as firebase_database from 'firebase/database';
5import { DataSnapshot, DatabaseReference, Query } from 'firebase/database';
6import { _ as _RefWithState, a as _Simplify, b as _DataSourceOptions, R as ResetOption, c as _Nullable, d as _FirestoreDataSource } from './shared/vuefire.cc4a8ea4.js';
7import * as firebase_firestore from 'firebase/firestore';
8import { SnapshotOptions, SnapshotListenOptions, FirestoreDataConverter, DocumentData, FirestoreError, CollectionReference, Query as Query$1, DocumentReference, Timestamp, GeoPoint } from 'firebase/firestore';
9import * as firebase_auth from 'firebase/auth';
10import { User, Dependencies, Auth } from 'firebase/auth';
11import { AppCheckOptions, AppCheck } from 'firebase/app-check';
12import * as firebase_storage from 'firebase/storage';
13import { StorageReference, FullMetadata, SettableMetadata, UploadTaskSnapshot, UploadTask, StorageError, UploadMetadata } from 'firebase/storage';
14
15/**
16 * Convert firebase Database snapshot of a ref **that exists** into a bindable data record.
17 *
18 * @param snapshot
19 * @return
20 */
21declare function createRecordFromDatabaseSnapshot(snapshot: DataSnapshot): VueDatabaseDocumentData<unknown>;
22interface DatabaseSnapshotSerializer<T = unknown> {
23 (snapshot: DataSnapshot): VueDatabaseDocumentData<T>;
24}
25interface _RefDatabase<T> extends _RefWithState<T, Error> {
26}
27/**
28 * Type used by default by the `serialize` option.
29 */
30type VueDatabaseDocumentData<T = unknown> = null | (T & {
31 /**
32 * id of the document
33 */
34 readonly id: string;
35});
36/**
37 * Same as VueDatabaseDocumentData but for a query.
38 */
39type VueDatabaseQueryData<T = unknown> = Array<_Simplify<NonNullable<VueDatabaseDocumentData<T>>>>;
40
41/**
42 * Global option type when binding one database reference
43 * @internal
44 */
45interface _DatabaseRefOptions<DataT = unknown> extends _DataSourceOptions<DataT> {
46 /**
47 * Function to transform snapshots into data. **Make sure to reuse the original serializer to add the object `id`**.
48 * See https://vuefire.vuejs.org/guide/global-options.html
49 */
50 serialize?: DatabaseSnapshotSerializer;
51}
52/**
53 * Global defaults type override options for all database bindings. This type remove make some optional values required.
54 * @internal
55 */
56interface _DatabaseRefOptionsWithDefaults extends _DatabaseRefOptions<unknown> {
57 /**
58 * @defaultValue `false`
59 */
60 reset: ResetOption;
61 /**
62 * @defaultValue `true`
63 */
64 wait: boolean;
65 serialize: DatabaseSnapshotSerializer;
66}
67declare const DEFAULT_OPTIONS$1: _DatabaseRefOptionsWithDefaults;
68
69/**
70 * Options when calling `useDatabaseList()` and `useDatabaseObject()`.
71 */
72interface UseDatabaseRefOptions<DataT = unknown> extends _DatabaseRefOptions<DataT> {
73}
74
75type UseListOptions<DataT = unknown> = UseDatabaseRefOptions<DataT>;
76/**
77 * Creates a reactive variable connected to the database as an array. Each element in the array will contain an `id`
78 * property. Note that if you override the `serialize` option, it should **also set an `id` property** in order for this
79 * to work.
80 *
81 * @param reference - Reference or query to the database
82 * @param options - optional options
83 */
84declare function useDatabaseList<T = unknown>(reference: MaybeRefOrGetter<_Nullable<DatabaseReference | Query>>, options?: UseListOptions<T>): _RefDatabase<VueDatabaseQueryData<T>>;
85/**
86 * @deprecated use `useDatabaseList()` instead
87 */
88declare const useList: typeof useDatabaseList;
89type UseObjectOptions<DataT = unknown> = UseDatabaseRefOptions<DataT>;
90/**
91 * Creates a reactive variable connected to the database as an object. If the reference is a primitive, it will be
92 * converted to an object containing a `$value` property with the primitive value and an `id` property with the
93 * reference's key.
94 *
95 * @param reference - Reference or query to the database
96 * @param options - optional options
97 */
98declare function useDatabaseObject<T = unknown>(reference: MaybeRefOrGetter<_Nullable<DatabaseReference>>, options?: UseObjectOptions<T>): _RefDatabase<VueDatabaseDocumentData<T> | undefined>;
99/**
100 * @deprecated use `useDatabaseObject()` instead
101 */
102declare const useObject: typeof useDatabaseObject;
103/**
104 * Retrieves the Database instance.
105 *
106 * @param name - name of the application
107 * @returns the Database instance
108 */
109declare function useDatabase(name?: string): firebase_database.Database;
110
111/**
112 * Options when binding a Firestore document or collection.
113 */
114interface FirestoreRefOptions<TData = unknown> extends _DataSourceOptions<TData> {
115 /**
116 * The maximum depth to bind nested refs. A nested ref that isn't bound will stay as the ref path while a bound ref
117 * will contain the same data as if the ref was bound directly.
118 */
119 maxRefDepth?: number;
120 /**
121 * @inheritDoc {SnapshotOptions}
122 */
123 snapshotOptions?: SnapshotOptions;
124 /**
125 * @inheritDoc {SnapshotListenOptions}
126 */
127 snapshotListenOptions?: SnapshotListenOptions;
128 /**
129 * Default Firestore converter to use with snapshots.
130 */
131 converter?: FirestoreDataConverter<unknown>;
132}
133/**
134 * Type of the global options for firestore refs. Some values cannot be `undefined`.
135 * @internal
136 */
137interface _FirestoreRefOptionsWithDefaults extends FirestoreRefOptions {
138 /**
139 * @defaultValue `false`
140 */
141 reset: ResetOption;
142 /**
143 * @defaultValue `true`
144 */
145 wait: boolean;
146 /**
147 * @defaultValue `2`
148 */
149 maxRefDepth: number;
150 /**
151 * Default Firestore converter to use with snapshots. Make sure to reuse the original serializer to add the object id.
152 * See https://vuefire.vuejs.org/guide/global-options.html
153 */
154 converter: FirestoreDataConverter<unknown>;
155 /**
156 * @defaultValue `{ serverTimestamps: 'estimate' }` to avoid `null` values
157 */
158 snapshotOptions: SnapshotOptions;
159}
160/**
161 * Global default options
162 */
163declare const DEFAULT_OPTIONS: _FirestoreRefOptionsWithDefaults;
164
165interface _UseFirestoreRefOptions<TData = unknown> extends FirestoreRefOptions<TData> {
166 /**
167 * @deprecated: use `.withConverter()` instead
168 */
169 converter?: FirestoreDataConverter<unknown>;
170}
171/**
172 * Infers the type from a firestore reference. If it is not a reference, it returns the type as is.
173 *
174 * @internal
175 */
176type _InferReferenceType<R> = R extends CollectionReference<infer T> | Query$1<infer T> | DocumentReference<infer T> ? T : R;
177/**
178 * Type used by default by the `firestoreDefaultConverter`.
179 */
180type VueFirestoreDocumentData<T = DocumentData> = null | (T & {
181 /**
182 * id of the document
183 */
184 readonly id: string;
185});
186type VueFirestoreQueryData<T = DocumentData> = Array<_Simplify<NonNullable<VueFirestoreDocumentData<T>>>>;
187/**
188 * @internal
189 */
190interface _RefFirestore<T> extends _RefWithState<T, FirestoreError> {
191}
192
193interface UseCollectionOptions<TData = unknown> extends _UseFirestoreRefOptions<TData> {
194}
195
196/**
197 * Creates a reactive collection (usually an array) of documents from a collection ref or a query from Firestore. Extracts the type of the
198 * query or converter.
199 *
200 * @param collectionRef - query or collection
201 * @param options - optional options
202 */
203declare function useCollection<R extends CollectionReference<unknown> | Query$1<unknown>>(collectionRef: MaybeRefOrGetter<_Nullable<R>>, options?: UseCollectionOptions<_InferReferenceType<R>[]>): _RefFirestore<_InferReferenceType<R>[]>;
204/**
205 * Creates a reactive collection (usually an array) of documents from a collection ref or a query from Firestore.
206 * Accepts a generic to **enforce the type** of the returned Ref. Note you can (and probably should) use
207 * `.withConverter()` to have stricter type safe version of a collection reference.
208 *
209 * @param collectionRef - query or collection
210 * @param options - optional options
211 */
212declare function useCollection<T>(collectionRef: MaybeRefOrGetter<_Nullable<CollectionReference<unknown> | Query$1<unknown>>>, options?: UseCollectionOptions<T[]>): _RefFirestore<VueFirestoreQueryData<T>>;
213interface UseDocumentOptions<TData = unknown> extends _UseFirestoreRefOptions<TData> {
214}
215/**
216 * Creates a reactive document from a document ref from Firestore. Automatically extracts the type of the converter or
217 * the document.
218 *
219 * @param documentRef - document reference
220 * @param options - optional options
221 */
222declare function useDocument<R extends DocumentReference<unknown>>(documentRef: MaybeRefOrGetter<_Nullable<R>>, options?: UseDocumentOptions<_InferReferenceType<R>>): _RefFirestore<_InferReferenceType<R> | undefined>;
223/**
224 * Creates a reactive collection (usually an array) of documents from a collection ref or a query from Firestore.
225 * Accepts a generic to **enforce the type** of the returned Ref. Note you can (and probably should) use
226 * `.withConverter()` to have stricter type safe version of a collection reference.
227 *
228 * @param documentRef - query or collection
229 * @param options - optional options
230 */
231declare function useDocument<T>(documentRef: MaybeRefOrGetter<_Nullable<DocumentReference>>, options?: UseDocumentOptions<T>): _RefFirestore<VueFirestoreDocumentData<T> | undefined>;
232/**
233 * Retrieves the Firestore instance.
234 *
235 * @param name - name of the application
236 * @returns the Firestore instance
237 */
238declare function useFirestore(name?: string): firebase_firestore.Firestore;
239
240/**
241 * Default converter for Firestore data. Can be overridden globally by setting `globalFirestoreOptions.converter`.
242 */
243declare const firestoreDefaultConverter: FirestoreDataConverter<VueFirestoreDocumentData>;
244/**
245 * Custom stringifier for [devalue](https://github.com/Rich-Harris/devalue) to support Firestore Timestamp and GeoPoint
246 * on SSR.
247 */
248declare const devalueCustomStringifiers: {
249 TimeStamp: (data: unknown) => false | {
250 seconds: number;
251 nanoseconds: number;
252 };
253 GeoPoint: (data: unknown) => false | {
254 latitude: number;
255 longitude: number;
256 };
257};
258/**
259 * Custom parsers for [devalue](https://github.com/Rich-Harris/devalue) to support Firestore Timestamp and GeoPoint on
260 * SSR.
261 */
262declare const devalueCustomParsers: {
263 TimeStamp: (data: ReturnType<Timestamp["toJSON"]>) => Timestamp;
264 GeoPoint: (data: ReturnType<GeoPoint["toJSON"]>) => GeoPoint;
265};
266
267/**
268 * Options for the Firebase Database Plugin that enables the Options API such as `$databaseBind` and `$databaseUnbind`.
269 */
270interface DatabasePluginOptions extends _DatabaseRefOptions {
271 /**
272 * @deprecated: was largely unused and not very useful. Please open an issue with use cases if you need this.
273 */
274 bindName?: string;
275 /**
276 * @deprecated: was largely unused and not very useful. Please open an issue with use cases if you need this.
277 */
278 unbindName?: string;
279}
280type VueFirebaseObject = Record<string, Query | DatabaseReference>;
281type FirebaseOption = VueFirebaseObject | (() => VueFirebaseObject);
282/**
283 * Install this plugin if you want to add `$databaseBind` and `$databaseUnbind` functions. Note this plugin is only necessary if
284 * you use the Options API. If you **exclusively use the Composition API** (e.g. `useDatabaseObject()` and `useDatabaseList()`), you
285 * should not add it.
286 *
287 * @deprecated Use `VueFire` and `VueFireDatabaseOptionsAPI` with the `modules` option instead.
288 *
289 * @param app
290 * @param pluginOptions
291 */
292declare function databasePlugin(app: App, pluginOptions?: DatabasePluginOptions, firebaseApp?: FirebaseApp): void;
293/**
294 * VueFire Database Module to be added to the `VueFire` Vue plugin options. If you **exclusively use the Composition
295 * API** (e.g. `useDatabaseObject()` and `useDatabaseList()`), you should not add it.
296 *
297 * @example
298 *
299 * ```ts
300 * import { createApp } from 'vue'
301 * import { VueFire, VueFireDatabaseOptionsAPI } from 'vuefire'
302 *
303 * const app = createApp(App)
304 * app.use(VueFire, {
305 * modules: [VueFireDatabaseOptionsAPI()],
306 * })
307 * ```
308 */
309declare function VueFireDatabaseOptionsAPI(pluginOptions?: DatabasePluginOptions): (firebaseApp: FirebaseApp, app: App) => void;
310declare module 'vue' {
311 interface ComponentCustomProperties {
312 /**
313 * Binds a reference
314 *
315 * @param name
316 * @param reference
317 * @param options
318 */
319 $databaseBind(name: string, reference: DatabaseReference | Query, options?: _DatabaseRefOptions): Promise<DataSnapshot>;
320 /**
321 * {@inheritDoc ComponentCustomProperties.$databaseBind}
322 * @deprecated Use `$databaseBind` instead.
323 */
324 $rtdbBind(name: string, reference: DatabaseReference | Query, options?: _DatabaseRefOptions): Promise<DataSnapshot>;
325 /**
326 * Unbinds a bound reference
327 */
328 $databaseUnbind: (name: string, reset?: ResetOption) => void;
329 /**
330 * {@inheritDoc ComponentCustomProperties.$databaseUnbind}
331 * @deprecated Use `$databaseUnbind` instead.
332 */
333 $rtdbUnbind: (name: string, reset?: ResetOption) => void;
334 /**
335 * Bound database references
336 */
337 $firebaseRefs: Readonly<Record<string, DatabaseReference>>;
338 }
339 interface ComponentCustomOptions {
340 /**
341 * Calls `$databaseBind` at created
342 */
343 firebase?: FirebaseOption;
344 }
345}
346
347type VueFirestoreObject = Record<string, _FirestoreDataSource>;
348type FirestoreOption = VueFirestoreObject | (() => VueFirestoreObject);
349/**
350 * Options for the Firebase Database Plugin that enables the Options API such as `$firestoreBind` and
351 * `$firestoreUnbind`.
352 */
353interface FirestorePluginOptions extends FirestoreRefOptions {
354 /**
355 * @deprecated: was largely unused and not very useful. Please open an issue with use cases if you need this.
356 */
357 bindName?: string;
358 /**
359 * @deprecated: was largely unused and not very useful. Please open an issue with use cases if you need this.
360 */
361 unbindName?: string;
362}
363/**
364 * Install this plugin to add `$firestoreBind` and `$firestoreUnbind` functions. Note this plugin is not necessary if
365 * you exclusively use the Composition API (`useDocument()` and `useCollection()`).
366 * @deprecated Use `VueFire` and `VueFireFirestoreOptionsAPI` with the `modules` option instead.b
367 *
368 * @param app
369 * @param pluginOptions
370 */
371declare const firestorePlugin: (app: App, pluginOptions?: FirestorePluginOptions, firebaseApp?: FirebaseApp) => void;
372/**
373 * VueFire Firestore Module to be added to the `VueFire` Vue plugin options.
374 *
375 * @example
376 *
377 * ```ts
378 * import { createApp } from 'vue'
379 * import { VueFire, VueFireFirestoreOptionsAPI } from 'vuefire'
380 *
381 * const app = createApp(App)
382 * app.use(VueFire, {
383 * modules: [VueFireFirestoreOptionsAPI()],
384 * })
385 * ```
386 */
387declare function VueFireFirestoreOptionsAPI(pluginOptions?: FirestorePluginOptions): (firebaseApp: FirebaseApp, app: App) => void;
388declare module 'vue' {
389 interface ComponentCustomProperties {
390 /**
391 * Binds a reference
392 *
393 * @param name
394 * @param reference
395 * @param options
396 */
397 $firestoreBind<T = DocumentData>(name: string, reference: Query$1<T> | CollectionReference<T>, options?: FirestoreRefOptions): Promise<T[]>;
398 $firestoreBind<T = DocumentData>(name: string, reference: DocumentReference<T>, options?: FirestoreRefOptions): Promise<T>;
399 /**
400 * Unbinds a bound reference
401 */
402 $firestoreUnbind: (name: string, reset?: ResetOption) => void;
403 /**
404 * Bound firestore references
405 */
406 $firestoreRefs: Readonly<Record<string, DocumentReference<unknown> | CollectionReference<unknown>>>;
407 }
408 interface ComponentCustomOptions {
409 /**
410 * Calls `$firestoreBind` before mounting the component
411 */
412 firestore?: FirestoreOption;
413 }
414}
415
416/**
417 * Gets the firebase app instance.
418 *
419 * @param name - optional firebase app name
420 * @returns the firebase app
421 */
422declare function useFirebaseApp(name?: string): FirebaseApp;
423
424/**
425 * Returns a reactive variable of the currently authenticated user in the firebase app. The ref is null if no user is
426 * authenticated or when the user logs out. The ref is undefined until the user is initially loaded.
427 * @param name - name of the application
428 */
429declare function useCurrentUser(name?: string): Ref<_Nullable<User>, _Nullable<User>>;
430/**
431 * Helper that returns a computed boolean that becomes `true` as soon as the current user is no longer `undefined`. Note
432 * this doesn't ensure the user is logged in, only if the initial signing process has run.
433 *
434 * @param name - name of the application
435 */
436declare function useIsCurrentUserLoaded(name?: string): vue_demi.ComputedRef<boolean>;
437/**
438 * Updates the current user profile and updates the current user state. This function internally calls `updateProfile()`
439 * from 'firebase/auth' and then updates the current user state.
440 *
441 * @param profile - the new profile information
442 */
443declare function updateCurrentUserProfile(profile: {
444 displayName?: _Nullable<string>;
445 photoURL?: _Nullable<string>;
446}): Promise<void>;
447/**
448 * Returns a promise that resolves the current user once the user is loaded. Must be called after the firebase app is
449 * initialized.
450 * @param name - name of the firebase application
451 */
452declare function getCurrentUser(name?: string): Promise<_Nullable<User>>;
453
454/**
455 * Options for VueFire Auth module.
456 */
457interface VueFireAuthOptions {
458 /**
459 * Initial value of the user. Used during SSR.
460 */
461 initialUser?: _Nullable<User>;
462 /**
463 * Options to pass to `initializeAuth()`.
464 */
465 dependencies: Dependencies;
466}
467/**
468 * VueFire Auth Module to be added to the `VueFire` Vue plugin options. This calls the `VueFireAuthWithDependencies()`
469 * with **all** the dependencies, increasing bundle size. Consider using `VueFireAuthWithDependencies()` instead to
470 * better control the bundle size.
471 *
472 * @see https://firebase.google.com/docs/auth/web/custom-dependencies
473 *
474 * @example
475 *
476 *```ts
477 *import { createApp } from 'vue'
478 *import { VueFire, VueFireAuth } from 'vuefire'
479 *
480 *const app = createApp(App)
481 *app.use(VueFire, {
482 * modules: [VueFireAuth()],
483 *})
484 *```
485 *
486 * @param initialUser - initial value of the user. used for SSR
487 */
488declare function VueFireAuth(initialUser?: _Nullable<User>): VueFireModule;
489/**
490 * Key to be used to inject the auth instance into components. It allows avoiding to call `getAuth()`, which isn't tree
491 * shakable.
492 * @internal
493 */
494declare const _VueFireAuthKey: unique symbol;
495/**
496 * Options for VueFire Auth module when passing the auth instance directly.
497 */
498interface VueFireAuthOptionsFromAuth extends Pick<VueFireAuthOptions, 'initialUser'> {
499 /**
500 * Auth instance to use.
501 */
502 auth: Auth;
503}
504/**
505 * VueFire Auth Module to be added to the `VueFire` Vue plugin options. It accepts an auth instance rather than the
506 * dependencies. It allows manually calling emulators and other advanced use cases. Prefer using
507 * `VueFireAuthWithDependencies()` and `VueFireAuth()` for most use cases.
508 *
509 * @param options - auth instance and initial user
510 */
511declare function VueFireAuthOptionsFromAuth({ auth, initialUser, }: VueFireAuthOptionsFromAuth): VueFireModule;
512/**
513 * VueFire Auth Module to be added to the `VueFire` Vue plugin options. It accepts dependencies to pass to
514 * `initializeAuth()` to better control the bundle size.
515 *
516 * @param options - user and options to pass to `initializeAuth()`.
517 */
518declare function VueFireAuthWithDependencies({ dependencies, initialUser, }: VueFireAuthOptions): VueFireModule;
519/**
520 * initializes auth for both the server and client.
521 * @internal
522 */
523declare function _VueFireAuthInit(firebaseApp: FirebaseApp, app: App, initialUser: _Nullable<User>, dependencies?: Dependencies, auth?: Auth): readonly [vue_demi.Ref<{
524 readonly emailVerified: boolean;
525 readonly isAnonymous: boolean;
526 readonly metadata: {
527 readonly creationTime?: string | undefined;
528 readonly lastSignInTime?: string | undefined;
529 };
530 readonly providerData: {
531 readonly displayName: string | null;
532 readonly email: string | null;
533 readonly phoneNumber: string | null;
534 readonly photoURL: string | null;
535 readonly providerId: string;
536 readonly uid: string;
537 }[];
538 readonly refreshToken: string;
539 readonly tenantId: string | null;
540 delete: () => Promise<void>;
541 getIdToken: (forceRefresh?: boolean) => Promise<string>;
542 getIdTokenResult: (forceRefresh?: boolean) => Promise<firebase_auth.IdTokenResult>;
543 reload: () => Promise<void>;
544 toJSON: () => object;
545 readonly displayName: string | null;
546 readonly email: string | null;
547 readonly phoneNumber: string | null;
548 readonly photoURL: string | null;
549 readonly providerId: string;
550 readonly uid: string;
551} | null | undefined, _Nullable<User> | {
552 readonly emailVerified: boolean;
553 readonly isAnonymous: boolean;
554 readonly metadata: {
555 readonly creationTime?: string | undefined;
556 readonly lastSignInTime?: string | undefined;
557 };
558 readonly providerData: {
559 readonly displayName: string | null;
560 readonly email: string | null;
561 readonly phoneNumber: string | null;
562 readonly photoURL: string | null;
563 readonly providerId: string;
564 readonly uid: string;
565 }[];
566 readonly refreshToken: string;
567 readonly tenantId: string | null;
568 delete: () => Promise<void>;
569 getIdToken: (forceRefresh?: boolean) => Promise<string>;
570 getIdTokenResult: (forceRefresh?: boolean) => Promise<firebase_auth.IdTokenResult>;
571 reload: () => Promise<void>;
572 toJSON: () => object;
573 readonly displayName: string | null;
574 readonly email: string | null;
575 readonly phoneNumber: string | null;
576 readonly photoURL: string | null;
577 readonly providerId: string;
578 readonly uid: string;
579}>, Auth];
580/**
581 * Retrieves the Firebase Auth instance. **Returns `null` on the server**. When using this function on the client in
582 * TypeScript, you can force the type with `useFirebaseAuth()!`.
583 *
584 * @returns the Auth instance
585 */
586declare function useFirebaseAuth(): Auth | null;
587
588/**
589 * Allows awaiting for all pending data sources. Useful to wait for SSR
590 *
591 * @param app - the firebase app
592 * @returns - a Promise that resolves with an array of all the resolved pending promises
593 */
594declare function usePendingPromises(app?: FirebaseApp): Promise<(readonly [string, unknown])[]>;
595
596interface SSRStore {
597 f: Record<string, unknown>;
598 r: Record<string, unknown>;
599 s: Record<string, string>;
600 u: Record<string, unknown>;
601}
602/**
603 * Allows getting the initial state set during SSR on the client.
604 *
605 * @param initialState - the initial state to set for the firebase app during SSR. Pass undefined to not set it
606 * @param firebaseApp - the firebase app to get the initial state for
607 * @returns the initial states for the current firebaseApp
608 */
609declare function useSSRInitialState(initialState: SSRStore | undefined, firebaseApp: FirebaseApp): SSRStore;
610
611/**
612 * The current app-check token as a `Ref`. Note this ref is always undefined on the server.
613 */
614declare function useAppCheckToken(): Ref<string | undefined, string | undefined>;
615interface VueFireAppCheckOptions extends AppCheckOptions {
616 /**
617 * Setups the debug token global. See https://firebase.google.com/docs/app-check/web/debug-provider. Note you should
618 * set to false in production (or not set it at all). It can be set to a string to force a specific debug token.
619 */
620 debug?: boolean | string;
621}
622/**
623 * VueFire AppCheck Module to be added to the `VueFire` Vue plugin options. This module **is client only** and shouldn't be added on server.
624 *
625 * @example
626 *
627 * ```ts
628 * import { createApp } from 'vue'
629 * import { VueFire, VueFireAppCheck } from 'vuefire'
630 *
631 * const app = createApp(App)
632 * app.use(VueFire, {
633 * modules: [VueFireAppCheck()],
634 * })
635 * ```
636 */
637declare function VueFireAppCheck(options: VueFireAppCheckOptions): (firebaseApp: FirebaseApp, app: App) => void;
638/**
639 * Retrieves the Firebase App Check instance.
640 *
641 * @param name - name of the application
642 */
643declare function useAppCheck(name?: string): AppCheck;
644
645/**
646 * Retrieves the Storage instance.
647 *
648 * @param name - name of the application
649 * @returns the Database instance
650 */
651declare function useFirebaseStorage(name?: string): firebase_storage.FirebaseStorage;
652/**
653 * Retrieves a reactive download URL of a `StorageReference`. Updates automatically if the `StorageReference` changes.
654 *
655 * @param storageRef - StorageReference
656 */
657declare function useStorageFileUrl(storageRef: MaybeRefOrGetter<_Nullable<StorageReference>>): {
658 url: vue_demi.Ref<string | null | undefined, string | null | undefined>;
659 refresh: () => Promise<string | null>;
660 promise: vue_demi.ShallowRef<Promise<string | null>, Promise<string | null>>;
661};
662/**
663 * Returns a reactive version of the metadata of a `StorageReference`. Updates automatically if the `StorageReference`
664 * changes.
665 *
666 * @param storageRef - StorageReference
667 */
668declare function useStorageFileMetadata(storageRef: MaybeRefOrGetter<_Nullable<StorageReference>>): {
669 metadata: vue_demi.ShallowRef<FullMetadata | null | undefined, FullMetadata | null | undefined>;
670 update: (newMetadata: SettableMetadata) => Promise<FullMetadata | null>;
671 refresh: () => Promise<FullMetadata | null>;
672 promise: vue_demi.ShallowRef<Promise<FullMetadata | null>, Promise<FullMetadata | null>>;
673};
674/**
675 * Reactive information (url, metadata) of a `StorageReference`. Allows updating and deleting the storage object.
676 *
677 * @param storageRef - StorageReference
678 */
679declare function useStorageFile(storageRef: MaybeRefOrGetter<_Nullable<StorageReference>>): {
680 url: vue_demi.Ref<string | null | undefined, string | null | undefined>;
681 metadata: vue_demi.ShallowRef<FullMetadata | null | undefined, FullMetadata | null | undefined>;
682 snapshot: vue_demi.ShallowRef<UploadTaskSnapshot | null | undefined, UploadTaskSnapshot | null | undefined>;
683 uploadTask: vue_demi.ShallowRef<UploadTask | null | undefined, UploadTask | null | undefined>;
684 uploadError: vue_demi.ShallowRef<StorageError | null | undefined, StorageError | null | undefined>;
685 uploadProgress: vue_demi.ComputedRef<number | null>;
686 upload: (newData: Blob | Uint8Array | ArrayBuffer, newMetadata?: UploadMetadata) => Promise<unknown> | undefined;
687 updateMetadata: (newMetadata: SettableMetadata) => Promise<FullMetadata | null>;
688 refresh: () => Promise<[string | null, FullMetadata | null]>;
689};
690/**
691 * @deprecated use `useFirebaseStorage()` instead
692 */
693declare const useStorage: typeof useFirebaseStorage;
694/**
695 * @deprecated use `useStorageFileUrl()` instead
696 */
697declare const useStorageUrl: typeof useStorageFileUrl;
698/**
699 * @deprecated use `useStorageFileMetadata()` instead
700 */
701declare const useStorageMetadata: typeof useStorageFileMetadata;
702/**
703 * @deprecated use `useStorageFile()` instead
704 */
705declare const useStorageObject: typeof useStorageFile;
706
707/**
708 * @module vuefire
709 */
710
711/**
712 * Options for VueFire Vue plugin.
713 */
714interface VueFireOptions {
715 /**
716 * The firebase app used by VueFire and associated with the different modules.
717 */
718 firebaseApp: FirebaseApp;
719 /**
720 * Array of VueFire modules that should be added to the application. e.g. `[VueFireAuth, VueFireDatabase]`. Remember
721 * to import them from `vuefire`.
722 */
723 modules?: VueFireModule[];
724}
725/**
726 * A VueFire module that can be passed to the VueFire Vue plugin in the `modules` option.
727 */
728interface VueFireModule {
729 (firebaseApp: FirebaseApp, app: App): void;
730}
731/**
732 * VueFire Vue plugin.
733 */
734declare function VueFire(app: App, { firebaseApp, modules }: VueFireOptions): void;
735
736export { type DatabasePluginOptions, type DatabaseSnapshotSerializer, type FirebaseOption, type FirestoreOption, type FirestorePluginOptions, type UseCollectionOptions, type UseDatabaseRefOptions, type UseDocumentOptions, type UseListOptions, type UseObjectOptions, type VueDatabaseDocumentData, type VueDatabaseQueryData, VueFire, VueFireAppCheck, type VueFireAppCheckOptions, VueFireAuth, type VueFireAuthOptions, VueFireAuthOptionsFromAuth, VueFireAuthWithDependencies, VueFireDatabaseOptionsAPI, VueFireFirestoreOptionsAPI, type VueFireModule, type VueFireOptions, type VueFirebaseObject, type VueFirestoreDocumentData, type VueFirestoreObject, type VueFirestoreQueryData, type _RefDatabase, type _RefFirestore, _VueFireAuthInit, _VueFireAuthKey, createRecordFromDatabaseSnapshot as databaseDefaultSerializer, databasePlugin, devalueCustomParsers, devalueCustomStringifiers, firestoreDefaultConverter, firestorePlugin, getCurrentUser, DEFAULT_OPTIONS$1 as globalDatabaseOptions, DEFAULT_OPTIONS as globalFirestoreOptions, databasePlugin as rtdbPlugin, updateCurrentUserProfile, useAppCheck, useAppCheckToken, useCollection, useCurrentUser, useDatabase, useDatabaseList, useDatabaseObject, useDocument, useFirebaseApp, useFirebaseAuth, useFirebaseStorage, useFirestore, useIsCurrentUserLoaded, useList, useObject, usePendingPromises, useSSRInitialState, useStorage, useStorageFile, useStorageFileMetadata, useStorageFileUrl, useStorageMetadata, useStorageObject, useStorageUrl };