@rebasepro/client-firebase 0.0.1-canary.4d4fb3e → 0.0.1-canary.ca2cb6e
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/components/RebaseFirebaseAppProps.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useAppCheck.d.ts +1 -1
- package/dist/hooks/useBuildUserManagement.d.ts +46 -0
- package/dist/index.es.js +451 -148
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +452 -152
- package/dist/index.umd.js.map +1 -1
- package/package.json +61 -59
- package/src/components/FirebaseLoginView.tsx +37 -47
- package/src/components/RebaseFirebaseApp.tsx +42 -26
- package/src/components/RebaseFirebaseAppProps.tsx +1 -1
- package/src/components/social_icons.tsx +8 -8
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAppCheck.ts +1 -1
- package/src/hooks/useBuildUserManagement.tsx +374 -0
- package/src/hooks/useFirebaseAuthController.ts +1 -1
- package/src/hooks/useFirebaseRealTimeDBDelegate.ts +8 -8
- package/src/hooks/useFirebaseStorageSource.ts +15 -16
- package/src/hooks/useFirestoreDriver.ts +19 -13
- package/src/utils/algolia.ts +1 -1
- package/src/utils/collections_firestore.ts +4 -5
- package/src/utils/local_text_search_controller.ts +4 -4
- package/src/utils/pinecone.ts +1 -1
- package/src/utils/rebase_search_controller.ts +6 -5
|
@@ -9,14 +9,14 @@ export function buildCollectionId(idOrPath: string, parentCollectionIds?: string
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
export const docsToCollectionTree = (docs: DocumentSnapshot[]): EntityCollection[] => {
|
|
14
13
|
|
|
15
14
|
const collectionsMap = docs.map((doc) => {
|
|
16
15
|
const id: string = doc.id;
|
|
17
16
|
const collection = docToCollection(doc);
|
|
18
17
|
return { [id]: collection };
|
|
19
|
-
}).reduce((a, b) => ({ ...a,
|
|
18
|
+
}).reduce((a, b) => ({ ...a,
|
|
19
|
+
...b }), {});
|
|
20
20
|
|
|
21
21
|
const orderedKeys = Object.keys(collectionsMap).sort((a, b) => b.split(COLLECTION_PATH_SEPARATOR).length - a.split(COLLECTION_PATH_SEPARATOR).length);
|
|
22
22
|
|
|
@@ -52,7 +52,6 @@ export const docToCollection = (doc: DocumentSnapshot): EntityCollection => {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
|
|
56
55
|
/**
|
|
57
56
|
* Converts enum values from object format to array format.
|
|
58
57
|
* Firestore doesn't preserve object key order, so we must use arrays.
|
|
@@ -65,7 +64,7 @@ export const docToCollection = (doc: DocumentSnapshot): EntityCollection => {
|
|
|
65
64
|
*/
|
|
66
65
|
function normalizeEnumValuesToArray(
|
|
67
66
|
enumValues: unknown,
|
|
68
|
-
sortObjectFormat
|
|
67
|
+
sortObjectFormat = false
|
|
69
68
|
): unknown[] {
|
|
70
69
|
if (Array.isArray(enumValues)) {
|
|
71
70
|
// Already an array - preserve order! This order is intentional
|
|
@@ -103,7 +102,7 @@ function normalizeEnumValuesToArray(
|
|
|
103
102
|
*/
|
|
104
103
|
function normalizePropertiesEnumValues(
|
|
105
104
|
properties: Properties,
|
|
106
|
-
sortObjectFormat
|
|
105
|
+
sortObjectFormat = false
|
|
107
106
|
): Properties {
|
|
108
107
|
const result: Properties = {};
|
|
109
108
|
Object.entries(properties).forEach(([key, property]) => {
|
|
@@ -8,7 +8,7 @@ import { FirestoreTextSearchController, FirestoreTextSearchControllerBuilder } f
|
|
|
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,
|
|
@@ -95,9 +95,9 @@ export const localSearchControllerBuilder: FirestoreTextSearchControllerBuilder
|
|
|
95
95
|
const bExactMatch = b.item.id === searchString;
|
|
96
96
|
|
|
97
97
|
if (aExactMatch && !bExactMatch) {
|
|
98
|
-
return -1;
|
|
98
|
+
return -1; // Prioritize item A
|
|
99
99
|
} else if (!aExactMatch && bExactMatch) {
|
|
100
|
-
return 1;
|
|
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);
|
|
@@ -108,7 +108,7 @@ export const localSearchControllerBuilder: FirestoreTextSearchControllerBuilder
|
|
|
108
108
|
|
|
109
109
|
return {
|
|
110
110
|
init,
|
|
111
|
-
search
|
|
111
|
+
search
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
package/src/utils/pinecone.ts
CHANGED
|
@@ -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({
|
|
@@ -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
|
|
@@ -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
|
|
|
@@ -327,7 +327,7 @@ export function buildRebaseSearchController(
|
|
|
327
327
|
query_by: queryBy,
|
|
328
328
|
per_page: 100,
|
|
329
329
|
prefix: true, // Enable prefix matching
|
|
330
|
-
typo_tokens_threshold: 1
|
|
330
|
+
typo_tokens_threshold: 1 // Allow some typos
|
|
331
331
|
};
|
|
332
332
|
|
|
333
333
|
// Add filter for subcollection queries
|
|
@@ -351,6 +351,7 @@ export function buildRebaseSearchController(
|
|
|
351
351
|
}
|
|
352
352
|
};
|
|
353
353
|
|
|
354
|
-
return { init,
|
|
354
|
+
return { init,
|
|
355
|
+
search };
|
|
355
356
|
};
|
|
356
357
|
}
|