@rebasepro/firebase 0.11.1-canary.gfd39654 → 0.12.1-canary.gdfba2a1

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.
Files changed (36) hide show
  1. package/dist/components/FirebaseLoginView.d.ts +1 -1
  2. package/dist/components/RebaseFirebaseAppProps.d.ts +1 -1
  3. package/dist/hooks/useAppCheck.d.ts +1 -1
  4. package/dist/hooks/useFirebaseAuthController.d.ts +1 -1
  5. package/dist/hooks/useFirebaseRealTimeDBDelegate.d.ts +1 -1
  6. package/dist/hooks/useFirebaseStorageSource.d.ts +1 -1
  7. package/dist/hooks/useFirestoreDriver.d.ts +2 -2
  8. package/dist/hooks/useInitialiseFirebase.d.ts +1 -1
  9. package/dist/hooks/useRecaptcha.d.ts +1 -1
  10. package/dist/index.es.js +16 -12
  11. package/dist/index.es.js.map +1 -1
  12. package/dist/types/appcheck.d.ts +1 -1
  13. package/dist/types/auth.d.ts +1 -1
  14. package/dist/types/text_search.d.ts +2 -2
  15. package/dist/utils/collections_firestore.d.ts +1 -1
  16. package/dist/utils/database.d.ts +1 -1
  17. package/dist/utils/pinecone.d.ts +1 -1
  18. package/package.json +17 -16
  19. package/src/components/FirebaseLoginView.tsx +2 -2
  20. package/src/components/RebaseFirebaseApp.tsx +1 -1
  21. package/src/components/RebaseFirebaseAppProps.tsx +1 -1
  22. package/src/hooks/useAppCheck.ts +2 -2
  23. package/src/hooks/useFirebaseAuthController.ts +2 -2
  24. package/src/hooks/useFirebaseRealTimeDBDelegate.ts +2 -2
  25. package/src/hooks/useFirebaseStorageSource.ts +2 -2
  26. package/src/hooks/useFirestoreDriver.ts +5 -5
  27. package/src/hooks/useInitialiseFirebase.ts +1 -1
  28. package/src/hooks/useRecaptcha.tsx +1 -1
  29. package/src/types/appcheck.ts +1 -1
  30. package/src/types/auth.tsx +1 -1
  31. package/src/types/text_search.ts +2 -2
  32. package/src/utils/collections_firestore.ts +1 -1
  33. package/src/utils/database.ts +2 -2
  34. package/src/utils/local_text_search_controller.ts +2 -2
  35. package/src/utils/pinecone.ts +1 -1
  36. package/src/utils/rebase_search_controller.ts +2 -2
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode } from "react";
2
- import { FirebaseApp } from "@firebase/app";
2
+ import { FirebaseApp } from "firebase/app";
3
3
  import type { FirebaseAuthController, FirebaseSignInOption, FirebaseSignInProvider } from "../types/auth";
4
4
  /**
5
5
  * @category Firebase
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { CollectionConfig } from "@rebasepro/types";
3
3
  import { AnalyticsEvent, AppView, AppViewsBuilder, CollectionConfigsBuilder, RebasePlugin, Locale, PropertyConfig } from "@rebasepro/admin-types";
4
4
  import { FirebaseAccessGate } from "../hooks/useFirebaseAccessGate";
5
- import { FirebaseApp } from "@firebase/app";
5
+ import { FirebaseApp } from "firebase/app";
6
6
  import { FirebaseLoginViewProps } from "./FirebaseLoginView";
7
7
  import { AppCheckOptions, FirebaseSignInOption, FirebaseSignInProvider, FirebaseUserWrapper, FirestoreTextSearchControllerBuilder } from "../types";
8
8
  import { FirestoreIndexesBuilder } from "../hooks";
@@ -1,4 +1,4 @@
1
- import { FirebaseApp } from "@firebase/app";
1
+ import { FirebaseApp } from "firebase/app";
2
2
  import { AppCheckOptions } from "../types";
3
3
  /**
4
4
  * @group Firebase
@@ -1,4 +1,4 @@
1
- import { FirebaseApp } from "@firebase/app";
1
+ import { FirebaseApp } from "firebase/app";
2
2
  import { FirebaseAuthController, FirebaseSignInOption, FirebaseSignInProvider, FirebaseUserWrapper } from "../types";
3
3
  import type { User } from "@rebasepro/types";
4
4
  export interface FirebaseAuthControllerProps {
@@ -1,4 +1,4 @@
1
- import { FirebaseApp } from "@firebase/app";
1
+ import { FirebaseApp } from "firebase/app";
2
2
  import { DataDriver } from "@rebasepro/types";
3
3
  export declare function useFirebaseRTDBDelegate({ firebaseApp }: {
4
4
  firebaseApp?: FirebaseApp;
@@ -1,4 +1,4 @@
1
- import { FirebaseApp } from "@firebase/app";
1
+ import { FirebaseApp } from "firebase/app";
2
2
  import { StorageSource } from "@rebasepro/types";
3
3
  /**
4
4
  * @group Firebase
@@ -1,7 +1,7 @@
1
1
  import { DataDriver, CollectionConfig } from "@rebasepro/types";
2
2
  import { FilterCombination } from "@rebasepro/admin-types";
3
- import { Firestore } from "@firebase/firestore";
4
- import { FirebaseApp } from "@firebase/app";
3
+ import { Firestore } from "firebase/firestore";
4
+ import { FirebaseApp } from "firebase/app";
5
5
  import { FirestoreTextSearchControllerBuilder } from "../types/text_search";
6
6
  /**
7
7
  * @group Firebase
@@ -1,4 +1,4 @@
1
- import { FirebaseApp } from "@firebase/app";
1
+ import { FirebaseApp } from "firebase/app";
2
2
  /**
3
3
  * @group Firebase
4
4
  */
@@ -1,4 +1,4 @@
1
- import { RecaptchaVerifier } from "@firebase/auth";
1
+ import { RecaptchaVerifier } from "firebase/auth";
2
2
  declare global {
3
3
  interface Window {
4
4
  recaptchaVerifier: RecaptchaVerifier;
package/dist/index.es.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
2
  import { deepEqual } from "fast-equals";
3
- import { FacebookAuthProvider, GithubAuthProvider, GoogleAuthProvider, OAuthProvider, PhoneAuthProvider, PhoneMultiFactorGenerator, RecaptchaVerifier, TwitterAuthProvider, createUserWithEmailAndPassword, fetchSignInMethodsForEmail, getAuth, getMultiFactorResolver, onAuthStateChanged, sendPasswordResetEmail, signInAnonymously, signInWithEmailAndPassword, signInWithPhoneNumber, signInWithPopup, signOut } from "@firebase/auth";
4
- import { deleteObject, getDownloadURL, getMetadata, getStorage, list, ref, uploadBytesResumable } from "@firebase/storage";
5
- import { deleteApp, getApps, initializeApp } from "@firebase/app";
6
- import { getToken, initializeAppCheck } from "@firebase/app-check";
3
+ import { FacebookAuthProvider, GithubAuthProvider, GoogleAuthProvider, OAuthProvider, PhoneAuthProvider, PhoneMultiFactorGenerator, RecaptchaVerifier, TwitterAuthProvider, createUserWithEmailAndPassword, fetchSignInMethodsForEmail, getAuth, getMultiFactorResolver, onAuthStateChanged, sendPasswordResetEmail, signInAnonymously, signInWithEmailAndPassword, signInWithPhoneNumber, signInWithPopup, signOut } from "firebase/auth";
4
+ import { deleteObject, getDownloadURL, getMetadata, getStorage, list, ref, uploadBytesResumable } from "firebase/storage";
5
+ import { deleteApp, getApps, initializeApp } from "firebase/app";
6
+ import { getToken, initializeAppCheck } from "firebase/app-check";
7
7
  import { DEFAULT_DATA_SOURCE_KEY, EntityReference, GeoPoint } from "@rebasepro/types";
8
- import { DocumentReference, GeoPoint as GeoPoint$1, Timestamp, VectorValue, collection, deleteDoc, deleteField, doc, getCountFromServer, getDoc, getDocs, getFirestore, limit, onSnapshot, orderBy, query, serverTimestamp, setDoc, startAfter, vector, where } from "@firebase/firestore";
8
+ import { DocumentReference, GeoPoint as GeoPoint$1, Timestamp, VectorValue, collection, deleteDoc, deleteField, doc, getCountFromServer, getDoc, getDocs, getFirestore, limit, onSnapshot, orderBy, query, serverTimestamp, setDoc, startAfter, vector, where } from "firebase/firestore";
9
9
  import { COLLECTION_PATH_SEPARATOR, buildRebaseData, sortProperties, stripCollectionPath } from "@rebasepro/common";
10
10
  import Fuse from "fuse.js";
11
- import { getFunctions, httpsCallable } from "@firebase/functions";
12
- import { get, getDatabase, limitToFirst, onValue, orderByChild, orderByKey, push, query as query$1, ref as ref$1, remove, set, startAt } from "@firebase/database";
11
+ import { getFunctions, httpsCallable } from "firebase/functions";
12
+ import { get, getDatabase, limitToFirst, onValue, orderByChild, orderByKey, push, query as query$1, ref as ref$1, remove, set, startAt } from "firebase/database";
13
13
  import { removeUndefined } from "@rebasepro/utils";
14
14
  import { AdminModeControllerProvider, ErrorView, ModeControllerProvider, Rebase, RebaseLogo, RebaseRoutes, SnackbarProvider, useBrowserTitleAndIcon, useBuildAdminModeController, useBuildLocalConfigurationPersistence, useBuildModeController, useModeController, useSnackbarController } from "@rebasepro/app";
15
15
  import { AppBar, CollectionRegistryContext, Drawer, NavigationStateContext, RebaseRoute, Scaffold, SideDialogs, SidePanelProvider, UrlContext, useBuildCollectionRegistryController, useBuildNavigationStateController, useBuildUrlController } from "@rebasepro/admin";
@@ -472,10 +472,11 @@ function useAppCheck({ firebaseApp, options }) {
472
472
  setAppCheckLoading(true);
473
473
  const { provider, isTokenAutoRefreshEnabled } = options;
474
474
  removeCurrentAppCheckDiv();
475
- verifyToken(initializeAppCheck(firebaseApp, {
475
+ const appCheck = initializeAppCheck(firebaseApp, {
476
476
  provider,
477
477
  isTokenAutoRefreshEnabled
478
- })).then(() => {
478
+ });
479
+ verifyToken(appCheck).then(() => {
479
480
  setAppCheckLoading(false);
480
481
  });
481
482
  initialCheck.current = true;
@@ -513,7 +514,8 @@ var docsToCollectionTree = (docs) => {
513
514
  Object.keys(collectionsMap).sort((a, b) => b.split(COLLECTION_PATH_SEPARATOR).length - a.split(COLLECTION_PATH_SEPARATOR).length).forEach((id) => {
514
515
  const collection = collectionsMap[id];
515
516
  if (id.includes(COLLECTION_PATH_SEPARATOR)) {
516
- const parentCollection = collectionsMap[id.split(COLLECTION_PATH_SEPARATOR).slice(0, -1).join(COLLECTION_PATH_SEPARATOR)];
517
+ const parentId = id.split(COLLECTION_PATH_SEPARATOR).slice(0, -1).join(COLLECTION_PATH_SEPARATOR);
518
+ const parentCollection = collectionsMap[parentId];
517
519
  if (parentCollection) parentCollection.subcollections = () => [...parentCollection.subcollections?.() ?? [], collection];
518
520
  delete collectionsMap[id];
519
521
  }
@@ -698,7 +700,8 @@ var localSearchControllerBuilder = ({ firebaseApp }) => {
698
700
  return new Promise((resolve, reject) => {
699
701
  if (collectionProp) {
700
702
  console.debug("Init local search controller", path);
701
- listeners[path] = onSnapshot(query(collection(databaseId ? getFirestore(firebaseApp, databaseId) : getFirestore(firebaseApp), path)), {
703
+ const col = collection(databaseId ? getFirestore(firebaseApp, databaseId) : getFirestore(firebaseApp), path);
704
+ listeners[path] = onSnapshot(query(col), {
702
705
  next: (entity) => {
703
706
  if (entity.metadata.fromCache && entity.metadata.hasPendingWrites) return;
704
707
  const docs = entity.docs.map((doc) => ({
@@ -1575,7 +1578,8 @@ function useBuildUserManagement({ authController, dataSourceDelegate, roles: rol
1575
1578
  console.debug("Updating users", rows);
1576
1579
  setUsersError(void 0);
1577
1580
  try {
1578
- setUsersWithRoleIds(rowsToUsers(rows));
1581
+ const newUsers = rowsToUsers(rows);
1582
+ setUsersWithRoleIds(newUsers);
1579
1583
  } catch (e) {
1580
1584
  setUsersWithRoleIds([]);
1581
1585
  console.error("Error loading users", e);