@rebasepro/firebase 0.0.1-canary.2 → 0.0.1-canary.eb08332

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 (47) hide show
  1. package/README.md +97 -3
  2. package/dist/components/FirebaseLoginView.d.ts +3 -3
  3. package/dist/components/RebaseFirebaseApp.d.ts +2 -1
  4. package/dist/components/RebaseFirebaseAppProps.d.ts +9 -13
  5. package/dist/components/social_icons.d.ts +6 -6
  6. package/dist/hooks/index.d.ts +3 -1
  7. package/dist/hooks/useAppCheck.d.ts +2 -2
  8. package/dist/hooks/useBuildUserManagement.d.ts +78 -0
  9. package/dist/hooks/useFirebaseAccessGate.d.ts +44 -0
  10. package/dist/hooks/useFirebaseAuthController.d.ts +2 -2
  11. package/dist/hooks/useFirebaseRealTimeDBDelegate.d.ts +2 -2
  12. package/dist/hooks/useFirebaseStorageSource.d.ts +1 -1
  13. package/dist/hooks/{useFirestoreDataSource.d.ts → useFirestoreDriver.d.ts} +9 -9
  14. package/dist/index.es.js +2598 -2663
  15. package/dist/index.es.js.map +1 -1
  16. package/dist/index.umd.js +2704 -2702
  17. package/dist/index.umd.js.map +1 -1
  18. package/dist/types/auth.d.ts +2 -2
  19. package/dist/types/text_search.d.ts +3 -3
  20. package/dist/utils/algolia.d.ts +7 -6
  21. package/dist/utils/collections_firestore.d.ts +4 -4
  22. package/package.json +75 -65
  23. package/src/components/FirebaseLoginView.tsx +53 -50
  24. package/src/components/RebaseFirebaseApp.tsx +82 -56
  25. package/src/components/RebaseFirebaseAppProps.tsx +10 -24
  26. package/src/components/social_icons.tsx +8 -8
  27. package/src/hooks/index.ts +3 -1
  28. package/src/hooks/useAppCheck.ts +5 -5
  29. package/src/hooks/useBuildUserManagement.tsx +366 -0
  30. package/src/hooks/useFirebaseAccessGate.tsx +145 -0
  31. package/src/hooks/useFirebaseAuthController.ts +6 -8
  32. package/src/hooks/useFirebaseRealTimeDBDelegate.ts +70 -79
  33. package/src/hooks/useFirebaseStorageSource.ts +23 -25
  34. package/src/hooks/useFirestoreDriver.ts +812 -0
  35. package/src/hooks/useInitialiseFirebase.ts +2 -2
  36. package/src/types/auth.tsx +2 -2
  37. package/src/types/text_search.ts +3 -3
  38. package/src/utils/algolia.ts +6 -9
  39. package/src/utils/collections_firestore.ts +25 -29
  40. package/src/utils/database.ts +2 -2
  41. package/src/utils/local_text_search_controller.ts +12 -12
  42. package/src/utils/pinecone.ts +3 -3
  43. package/src/utils/rebase_search_controller.ts +23 -22
  44. package/src/utils/text_search_controller.ts +2 -2
  45. package/dist/social_icons.d.ts +0 -6
  46. package/src/hooks/useFirestoreDataSource.ts +0 -796
  47. package/src/social_icons.tsx +0 -135
@@ -71,9 +71,9 @@ export function useInitialiseFirebase({
71
71
  setConfigError(undefined);
72
72
  setFirebaseConfigLoading(false);
73
73
  setFirebaseApp(initialisedFirebaseApp);
74
- } catch (e: any) {
74
+ } catch (e: unknown) {
75
75
  console.error("Error initialising Firebase", e);
76
- setConfigError(hostingError + "\n" + (e.message ?? JSON.stringify(e)));
76
+ setConfigError(hostingError + "\n" + (e instanceof Error ? e.message : JSON.stringify(e)));
77
77
  }
78
78
  }, [name]);
79
79
 
@@ -1,6 +1,6 @@
1
1
  import { ApplicationVerifier, ConfirmationResult, User as FirebaseUser } from "@firebase/auth";
2
2
 
3
- import { AuthController, Role, User } from "@rebasepro/core";
3
+ import type { AuthController, User } from "@rebasepro/types";
4
4
 
5
5
  /**
6
6
  * @group Firebase
@@ -69,6 +69,6 @@ export type FirebaseAuthController<USER extends User = FirebaseUserWrapper, Extr
69
69
 
70
70
  setUser: (user: USER | null) => void;
71
71
 
72
- setUserRoles: (roles: Role[]) => void;
72
+ setUserRoles: (roles: string[]) => void;
73
73
 
74
74
  };
@@ -1,6 +1,6 @@
1
1
  import { User as FirebaseUser } from "@firebase/auth";
2
2
  import { FirebaseApp } from "@firebase/app";
3
- import { EntityCollection } from "@rebasepro/core";
3
+ import { CollectionConfig } from "@rebasepro/types";
4
4
 
5
5
  export type FirestoreTextSearchControllerBuilder = (props: {
6
6
  firebaseApp: FirebaseApp;
@@ -25,7 +25,7 @@ export type FirestoreTextSearchController = {
25
25
  init: (props: {
26
26
  path: string,
27
27
  databaseId?: string,
28
- collection?: EntityCollection
28
+ collection?: CollectionConfig
29
29
  }) => Promise<boolean>,
30
30
  /**
31
31
  * Do the search and return a list of ids.
@@ -36,7 +36,7 @@ export type FirestoreTextSearchController = {
36
36
  path: string,
37
37
  currentUser?: FirebaseUser,
38
38
  databaseId?: string,
39
- collection?: EntityCollection
39
+ collection?: CollectionConfig
40
40
  }) => (Promise<readonly string[] | undefined>),
41
41
 
42
42
  };
@@ -8,23 +8,20 @@ import { buildExternalSearchController } from "./text_search_controller";
8
8
  * @param query
9
9
  * @group Firebase
10
10
  */
11
- export function performAlgoliaTextSearch(client: any, indexName: string, query: string): Promise<readonly string[]> {
11
+ export function performAlgoliaTextSearch(client: { searchSingleIndex: (params: Record<string, unknown>) => Promise<{ hits: Array<{ objectID: string }> }> }, indexName: string, query: string): Promise<readonly string[]> {
12
12
 
13
13
  console.debug("Performing Algolia query", client, query);
14
14
 
15
15
  return client.searchSingleIndex({
16
16
  indexName,
17
- searchParams: { query },
18
- }).then(({ hits }: any) => {
19
- return hits.map((hit: any) => hit.objectID as string);
17
+ searchParams: { query }
18
+ }).then(({ hits }) => {
19
+ return hits.map((hit) => hit.objectID);
20
20
  })
21
- .catch((err: any) => {
21
+ .catch((err: unknown) => {
22
22
  console.error(err);
23
23
  return [];
24
24
  });
25
25
  }
26
26
 
27
- /**
28
- * @deprecated Use `buildExternalSearchController` instead
29
- */
30
- export const buildAlgoliaSearchController = buildExternalSearchController;
27
+
@@ -1,27 +1,22 @@
1
1
  import { deleteField, DocumentSnapshot } from "@firebase/firestore";
2
- import {
3
- Properties,
4
- Property,
5
- sortProperties,
6
- } from "@rebasepro/core";
7
- import { PersistedCollection } from "@rebasepro/studio";
8
- import { COLLECTION_PATH_SEPARATOR, stripCollectionPath } from "@rebasepro/common";
9
-
10
- export function buildCollectionId(idOrPath: string, parentCollectionIds?: string[]): string {
11
- if (!parentCollectionIds)
2
+ import { CollectionConfig, FirebaseCollectionConfig, Properties, Property } from "@rebasepro/types";
3
+ import { COLLECTION_PATH_SEPARATOR, sortProperties, stripCollectionPath } from "@rebasepro/common";
4
+
5
+ export function buildCollectionId(idOrPath: string, parentCollectionSlugs?: string[], parentEntityIds?: string[]): string {
6
+ if (!parentCollectionSlugs)
12
7
  return stripCollectionPath(idOrPath);
13
- return [...parentCollectionIds.map(stripCollectionPath), stripCollectionPath(idOrPath)].join(COLLECTION_PATH_SEPARATOR);
8
+ return [...parentCollectionSlugs.map(stripCollectionPath), stripCollectionPath(idOrPath)].join(COLLECTION_PATH_SEPARATOR);
14
9
  }
15
10
 
16
11
 
17
-
18
- export const docsToCollectionTree = (docs: DocumentSnapshot[]): PersistedCollection[] => {
12
+ export const docsToCollectionTree = (docs: DocumentSnapshot[]): CollectionConfig[] => {
19
13
 
20
14
  const collectionsMap = docs.map((doc) => {
21
15
  const id: string = doc.id;
22
16
  const collection = docToCollection(doc);
23
17
  return { [id]: collection };
24
- }).reduce((a, b) => ({ ...a, ...b }), {});
18
+ }).reduce((a, b) => ({ ...a,
19
+ ...b }), {});
25
20
 
26
21
  const orderedKeys = Object.keys(collectionsMap).sort((a, b) => b.split(COLLECTION_PATH_SEPARATOR).length - a.split(COLLECTION_PATH_SEPARATOR).length);
27
22
 
@@ -31,7 +26,7 @@ export const docsToCollectionTree = (docs: DocumentSnapshot[]): PersistedCollect
31
26
  const parentId = id.split(COLLECTION_PATH_SEPARATOR).slice(0, -1).join(COLLECTION_PATH_SEPARATOR);
32
27
  const parentCollection = collectionsMap[parentId];
33
28
  if (parentCollection)
34
- parentCollection.subcollections = () => [...(parentCollection.subcollections?.() ?? []), collection];
29
+ (parentCollection as FirebaseCollectionConfig).subcollections = () => [...((parentCollection as FirebaseCollectionConfig).subcollections?.() ?? []), collection];
35
30
  delete collectionsMap[id];
36
31
  }
37
32
  });
@@ -39,7 +34,7 @@ export const docsToCollectionTree = (docs: DocumentSnapshot[]): PersistedCollect
39
34
  return Object.values(collectionsMap);
40
35
  }
41
36
 
42
- export const docToCollection = (doc: DocumentSnapshot): PersistedCollection => {
37
+ export const docToCollection = (doc: DocumentSnapshot): CollectionConfig => {
43
38
  const data = doc.data();
44
39
  if (!data)
45
40
  throw Error("Entity collection has not been persisted correctly");
@@ -53,11 +48,10 @@ export const docToCollection = (doc: DocumentSnapshot): PersistedCollection => {
53
48
  ...data,
54
49
  properties: sortedProperties,
55
50
  slug: data.id ?? data.alias ?? data.slug
56
- } as PersistedCollection;
51
+ } as CollectionConfig;
57
52
  }
58
53
 
59
54
 
60
-
61
55
  /**
62
56
  * Converts enum values from object format to array format.
63
57
  * Firestore doesn't preserve object key order, so we must use arrays.
@@ -70,7 +64,7 @@ export const docToCollection = (doc: DocumentSnapshot): PersistedCollection => {
70
64
  */
71
65
  function normalizeEnumValuesToArray(
72
66
  enumValues: unknown,
73
- sortObjectFormat: boolean = false
67
+ sortObjectFormat = false
74
68
  ): unknown[] {
75
69
  if (Array.isArray(enumValues)) {
76
70
  // Already an array - preserve order! This order is intentional
@@ -108,29 +102,31 @@ function normalizeEnumValuesToArray(
108
102
  */
109
103
  function normalizePropertiesEnumValues(
110
104
  properties: Properties,
111
- sortObjectFormat: boolean = false
105
+ sortObjectFormat = false
112
106
  ): Properties {
113
107
  const result: Properties = {};
114
108
  Object.entries(properties).forEach(([key, property]) => {
115
109
  if (typeof property === "object" && property !== null) {
116
110
  const normalizedProperty = { ...property } as Record<string, unknown>;
117
111
 
118
- // Handle direct enumValues
119
- if (normalizedProperty.enumValues) {
120
- normalizedProperty.enumValues = normalizeEnumValuesToArray(
121
- normalizedProperty.enumValues,
112
+ // Handle direct enum values
113
+ if (normalizedProperty.enum) {
114
+ normalizedProperty.enum = normalizeEnumValuesToArray(
115
+ normalizedProperty.enum,
122
116
  sortObjectFormat
123
117
  );
124
118
  }
125
119
 
120
+ const propType = normalizedProperty.type ?? normalizedProperty.dataType;
121
+
126
122
  // Handle array properties with enum values in "of"
127
- if (normalizedProperty.dataType === "array" && typeof normalizedProperty.of === "object" && normalizedProperty.of !== null) {
123
+ if (propType === "array" && typeof normalizedProperty.of === "object" && normalizedProperty.of !== null) {
128
124
  const ofProp = normalizedProperty.of as Record<string, unknown>;
129
- if (ofProp.enumValues) {
125
+ if (ofProp.enum) {
130
126
  normalizedProperty.of = {
131
127
  ...ofProp,
132
- enumValues: normalizeEnumValuesToArray(
133
- ofProp.enumValues,
128
+ enum: normalizeEnumValuesToArray(
129
+ ofProp.enum,
134
130
  sortObjectFormat
135
131
  )
136
132
  };
@@ -138,7 +134,7 @@ function normalizePropertiesEnumValues(
138
134
  }
139
135
 
140
136
  // Handle map properties recursively
141
- if (normalizedProperty.dataType === "map" && normalizedProperty.properties) {
137
+ if (propType === "map" && normalizedProperty.properties) {
142
138
  normalizedProperty.properties = normalizePropertiesEnumValues(
143
139
  normalizedProperty.properties as Properties,
144
140
  sortObjectFormat
@@ -12,8 +12,8 @@ export async function getFirestoreDataInPath(firebaseApp: FirebaseApp, path: str
12
12
  const firestore = getFirestore(firebaseApp);
13
13
  if (!parentPaths || parentPaths.length === 0) {
14
14
  const q = query(collection(firestore, path), limitClause(limit));
15
- return getDocs(q).then((querySnapshot) => {
16
- return querySnapshot.docs.map(doc => doc.data());
15
+ return getDocs(q).then((queryEntity) => {
16
+ return queryEntity.docs.map(doc => doc.data());
17
17
  });
18
18
  } else {
19
19
  let currentDocs: QueryDocumentSnapshot[] | undefined = undefined;
@@ -2,13 +2,13 @@ import { collection, getFirestore, onSnapshot, query } from "@firebase/firestore
2
2
  import Fuse from "fuse.js"
3
3
 
4
4
  import { FirebaseApp } from "@firebase/app";
5
- import { EntityCollection } from "@rebasepro/core";
5
+ import { CollectionConfig } from "@rebasepro/types";
6
6
  import { FirestoreTextSearchController, FirestoreTextSearchControllerBuilder } from "../types";
7
7
 
8
8
  const MAX_SEARCH_RESULTS = 80;
9
9
 
10
10
  export const localSearchControllerBuilder: FirestoreTextSearchControllerBuilder = ({
11
- firebaseApp,
11
+ firebaseApp
12
12
  }: {
13
13
 
14
14
  firebaseApp: FirebaseApp,
@@ -32,7 +32,7 @@ export const localSearchControllerBuilder: FirestoreTextSearchControllerBuilder
32
32
  databaseId
33
33
  }: {
34
34
  path: string,
35
- collection?: EntityCollection,
35
+ collection?: CollectionConfig,
36
36
  databaseId?: string
37
37
  }): Promise<boolean> => {
38
38
 
@@ -42,18 +42,18 @@ export const localSearchControllerBuilder: FirestoreTextSearchControllerBuilder
42
42
 
43
43
  currentPath = path;
44
44
 
45
- return new Promise(async (resolve, reject) => {
45
+ return new Promise((resolve, reject) => {
46
46
  if (collectionProp) {
47
47
  console.debug("Init local search controller", path);
48
48
  const firestore = databaseId ? getFirestore(firebaseApp, databaseId) : getFirestore(firebaseApp);
49
49
  const col = collection(firestore, path);
50
50
  listeners[path] = onSnapshot(query(col),
51
51
  {
52
- next: (snapshot) => {
53
- if (snapshot.metadata.fromCache && snapshot.metadata.hasPendingWrites) {
52
+ next: (entity) => {
53
+ if (entity.metadata.fromCache && entity.metadata.hasPendingWrites) {
54
54
  return;
55
55
  }
56
- const docs = snapshot.docs.map(doc => ({
56
+ const docs = entity.docs.map(doc => ({
57
57
  id: doc.id,
58
58
  ...doc.data()
59
59
  }));
@@ -95,24 +95,24 @@ export const localSearchControllerBuilder: FirestoreTextSearchControllerBuilder
95
95
  const bExactMatch = b.item.id === searchString;
96
96
 
97
97
  if (aExactMatch && !bExactMatch) {
98
- return -1; // Prioritize item A
98
+ return -1; // Prioritize item A
99
99
  } else if (!aExactMatch && bExactMatch) {
100
- return 1; // Prioritize item B
100
+ return 1; // Prioritize item B
101
101
  } else {
102
102
  // If both are exact matches or both are not, sort by Fuse's original score
103
103
  return (a.score ?? 0) - (b.score ?? 0);
104
104
  }
105
105
  });
106
- return searchResult.map((e: any) => e.item.id);
106
+ return searchResult.map((e) => e.item.id);
107
107
  };
108
108
 
109
109
  return {
110
110
  init,
111
- search,
111
+ search
112
112
  }
113
113
  }
114
114
 
115
- function buildIndex(list: (object & { id: string })[], collection: EntityCollection) {
115
+ function buildIndex(list: (object & { id: string })[], collection: CollectionConfig) {
116
116
 
117
117
  const keys = ["id", ...Object.keys(collection.properties)];
118
118
 
@@ -1,6 +1,6 @@
1
1
  import { User as FirebaseUser } from "@firebase/auth";
2
2
  import { FirestoreTextSearchController, FirestoreTextSearchControllerBuilder } from "../types";
3
- import { EntityCollection } from "@rebasepro/core";
3
+ import { CollectionConfig } from "@rebasepro/types";
4
4
 
5
5
  const DEFAULT_SERVER = "https://api.rebase.pro";
6
6
 
@@ -32,7 +32,7 @@ export async function performPineconeTextSearch({
32
32
  method: "POST",
33
33
  headers: {
34
34
  "Content-Type": "application/json",
35
- Authorization: `Basic ${firebaseToken}`,
35
+ Authorization: `Basic ${firebaseToken}`
36
36
  // "x-de-version": version
37
37
  },
38
38
  body: JSON.stringify({
@@ -60,7 +60,7 @@ export function buildPineconeSearchController({
60
60
 
61
61
  const init = (props: {
62
62
  path: string,
63
- collection?: EntityCollection
63
+ collection?: CollectionConfig
64
64
  }) => {
65
65
  // do nothing
66
66
  return Promise.resolve(isPathSupported(props.path));
@@ -1,7 +1,7 @@
1
1
  import { FirestoreTextSearchController, FirestoreTextSearchControllerBuilder } from "../types";
2
2
  import { FirebaseApp } from "@firebase/app";
3
3
  import { getFunctions, httpsCallable } from "@firebase/functions";
4
- import { EntityCollection } from "@rebasepro/core";
4
+ import { CollectionConfig } from "@rebasepro/types";
5
5
 
6
6
  /**
7
7
  * Configuration returned by the Rebase Search Extension
@@ -96,7 +96,7 @@ export function buildRebaseSearchController(
96
96
  const extensionInstanceId = options?.extensionInstanceId || "typesense-search";
97
97
 
98
98
  let searchConfig: SearchConfig | null = null;
99
- let typesenseClient: any = null;
99
+ let typesenseClient: unknown = null;
100
100
  let initPromise: Promise<void> | null = null;
101
101
 
102
102
  return ({ firebaseApp }: { firebaseApp: FirebaseApp }): FirestoreTextSearchController => {
@@ -115,7 +115,7 @@ export function buildRebaseSearchController(
115
115
  protocol: options.customConfig.protocol || "https",
116
116
  apiKey: options.customConfig.apiKey,
117
117
  path: options.customConfig.path,
118
- collectionsToIndex: ["*"],
118
+ collectionsToIndex: ["*"]
119
119
  };
120
120
  } else {
121
121
  // Fetch config from extension
@@ -131,12 +131,12 @@ export function buildRebaseSearchController(
131
131
  if (options?.collections && options.collections.length > 0) {
132
132
  searchConfig.collectionsToIndex = options.collections;
133
133
  }
134
- } catch (error: any) {
134
+ } catch (error: unknown) {
135
135
  console.error("Failed to get search config from extension:", error);
136
136
  throw new Error(
137
137
  "Failed to initialize Rebase Search. " +
138
138
  "Make sure the rebase-search extension is installed and configured. " +
139
- `Error: ${error.message || error}`
139
+ `Error: ${error instanceof Error ? error.message : String(error)}`
140
140
  );
141
141
  }
142
142
  }
@@ -153,12 +153,12 @@ export function buildRebaseSearchController(
153
153
  host: searchConfig.host,
154
154
  port: searchConfig.port,
155
155
  protocol: searchConfig.protocol,
156
- path: searchConfig.path || "",
156
+ path: searchConfig.path || ""
157
157
  }],
158
158
  apiKey: searchConfig.apiKey,
159
159
  connectionTimeoutSeconds: 5,
160
160
  retryIntervalSeconds: 0.5,
161
- numRetries: 2,
161
+ numRetries: 2
162
162
  });
163
163
  };
164
164
 
@@ -204,7 +204,7 @@ export function buildRebaseSearchController(
204
204
  */
205
205
  const init = async (props: {
206
206
  path: string;
207
- collection?: EntityCollection;
207
+ collection?: CollectionConfig;
208
208
  databaseId?: string;
209
209
  }): Promise<boolean> => {
210
210
  try {
@@ -253,11 +253,11 @@ export function buildRebaseSearchController(
253
253
  }
254
254
 
255
255
  try {
256
- const collection = await typesenseClient.collections(collectionName).retrieve();
256
+ const collection = await (typesenseClient as Record<string, (...args: any[]) => any>).collections(collectionName).retrieve();
257
257
 
258
258
  // Extract string fields from the schema
259
- const stringFields = collection.fields
260
- .filter((f: any) => {
259
+ const stringFields = (collection.fields as Array<{ type: string; name: string }>)
260
+ .filter((f) => {
261
261
  // Include string and string[] types, exclude internal fields
262
262
  const isStringType = f.type === "string" ||
263
263
  f.type === "string[]" ||
@@ -266,12 +266,12 @@ export function buildRebaseSearchController(
266
266
  const isNotInternal = !f.name.startsWith("_") && f.name !== ".*";
267
267
  return isStringType && isNotInternal;
268
268
  })
269
- .map((f: any) => f.name);
269
+ .map((f) => f.name);
270
270
 
271
271
  schemaCache.set(collectionName, stringFields);
272
272
  return stringFields;
273
- } catch (error: any) {
274
- if (error.httpStatus === 404) {
273
+ } catch (error: unknown) {
274
+ if (error instanceof Error && "httpStatus" in error && (error as Record<string, unknown>).httpStatus === 404) {
275
275
  throw new Error(
276
276
  `Collection "${collectionName}" not found in Typesense. ` +
277
277
  "Make sure the collection has been indexed. Try running the backfill function."
@@ -289,7 +289,7 @@ export function buildRebaseSearchController(
289
289
  searchString: string;
290
290
  path: string;
291
291
  databaseId?: string;
292
- collection?: EntityCollection;
292
+ collection?: CollectionConfig;
293
293
  }): Promise<readonly string[] | undefined> => {
294
294
  if (!typesenseClient) {
295
295
  // Ensure client is initialized
@@ -322,12 +322,12 @@ export function buildRebaseSearchController(
322
322
  const queryBy = searchableFields.join(",");
323
323
 
324
324
  try {
325
- const searchParams: any = {
325
+ const searchParams: Record<string, unknown> = {
326
326
  q: props.searchString,
327
327
  query_by: queryBy,
328
328
  per_page: 100,
329
329
  prefix: true, // Enable prefix matching
330
- typo_tokens_threshold: 1, // Allow some typos
330
+ typo_tokens_threshold: 1 // Allow some typos
331
331
  };
332
332
 
333
333
  // Add filter for subcollection queries
@@ -335,22 +335,23 @@ export function buildRebaseSearchController(
335
335
  searchParams.filter_by = parentFilter;
336
336
  }
337
337
 
338
- const result = await typesenseClient
338
+ const result = await (typesenseClient as Record<string, (...args: any[]) => any>)
339
339
  .collections(collectionName)
340
340
  .documents()
341
341
  .search(searchParams);
342
342
 
343
343
  // Extract document IDs from hits
344
- const ids = result.hits?.map((hit: any) => hit.document.id) ?? [];
344
+ const ids = (result.hits as Array<{ document: { id: string } }> | undefined)?.map((hit) => hit.document.id) ?? [];
345
345
 
346
346
  return ids as readonly string[];
347
- } catch (error: any) {
347
+ } catch (error: unknown) {
348
348
  // Parse error message for user-friendly display
349
- const message = error.message || error.toString();
349
+ const message = error instanceof Error ? error.message : String(error);
350
350
  throw new Error(`Search failed: ${message}`);
351
351
  }
352
352
  };
353
353
 
354
- return { init, search };
354
+ return { init,
355
+ search };
355
356
  };
356
357
  }
@@ -1,5 +1,5 @@
1
1
  import { FirestoreTextSearchController, FirestoreTextSearchControllerBuilder } from "../types";
2
- import { EntityCollection } from "@rebasepro/core";
2
+ import { CollectionConfig } from "@rebasepro/types";
3
3
 
4
4
  /**
5
5
  * Utility function to perform a text search in an external index,
@@ -20,7 +20,7 @@ export function buildExternalSearchController({
20
20
 
21
21
  const init = (props: {
22
22
  path: string,
23
- collection?: EntityCollection
23
+ collection?: CollectionConfig
24
24
  }) => {
25
25
  return Promise.resolve(isPathSupported(props.path));
26
26
  }
@@ -1,6 +0,0 @@
1
- export declare const googleIcon: (mode: "light" | "dark") => import("react/jsx-runtime").JSX.Element;
2
- export declare const appleIcon: (mode: "light" | "dark") => import("react/jsx-runtime").JSX.Element;
3
- export declare const githubIcon: (mode: "light" | "dark") => import("react/jsx-runtime").JSX.Element;
4
- export declare const facebookIcon: (mode: "light" | "dark") => import("react/jsx-runtime").JSX.Element;
5
- export declare const microsoftIcon: (mode: "light" | "dark") => import("react/jsx-runtime").JSX.Element;
6
- export declare const twitterIcon: (mode: "light" | "dark") => import("react/jsx-runtime").JSX.Element;