@zuzjs/flare 0.2.4 → 0.2.6
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/README.md +275 -33
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +176 -9
- package/dist/index.d.ts +176 -9
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -5,6 +5,7 @@ export { Anonymous, Apple, AuthGuard, AuthToken, CreateUserWithEmailAndPasswordI
|
|
|
5
5
|
* Client Configuration
|
|
6
6
|
*/
|
|
7
7
|
interface FlareConfig {
|
|
8
|
+
/** Base URL for the Flare API. */
|
|
8
9
|
endpoint: string;
|
|
9
10
|
/**
|
|
10
11
|
* Optional HTTP base URL for auth API calls.
|
|
@@ -14,15 +15,26 @@ interface FlareConfig {
|
|
|
14
15
|
* Example: '/api/flare' (relative, browser resolves against current origin)
|
|
15
16
|
*/
|
|
16
17
|
httpBase?: string;
|
|
18
|
+
/** Unique identifier for the application. */
|
|
17
19
|
appId: string;
|
|
20
|
+
/** API key for the application. */
|
|
18
21
|
apiKey?: string;
|
|
22
|
+
/** Public key for the application. */
|
|
19
23
|
publicKey?: string;
|
|
24
|
+
/** Whether to automatically reconnect on connection loss. */
|
|
20
25
|
autoReconnect?: boolean;
|
|
26
|
+
/** Delay between reconnection attempts in milliseconds. */
|
|
21
27
|
reconnectDelay?: number;
|
|
28
|
+
/** Maximum delay between reconnection attempts in milliseconds. */
|
|
22
29
|
maxReconnectDelay?: number;
|
|
30
|
+
/** Enable or disable debug mode. */
|
|
23
31
|
debug?: boolean;
|
|
32
|
+
/** Enable or disable request timing. */
|
|
24
33
|
requestTiming?: boolean;
|
|
34
|
+
/** Connection timeout in milliseconds. */
|
|
25
35
|
connectionTimeout?: number;
|
|
36
|
+
/** Enable automatic push notification registration on supported platforms. */
|
|
37
|
+
pushNotifications?: boolean;
|
|
26
38
|
}
|
|
27
39
|
type FlareAuthProviderId = "credentials" | "anonymous" | "google" | "facebook" | "github" | "dropbox" | "apple" | "twitter";
|
|
28
40
|
interface FlareAuthProviderPublicConfig {
|
|
@@ -65,12 +77,92 @@ interface FlareAuthUser {
|
|
|
65
77
|
email_verified: string;
|
|
66
78
|
[x: string]: any;
|
|
67
79
|
}
|
|
80
|
+
interface RegisterPushTokenInput {
|
|
81
|
+
token: string;
|
|
82
|
+
platform?: string;
|
|
83
|
+
deviceId?: string;
|
|
84
|
+
topics?: string[];
|
|
85
|
+
authAppId?: string;
|
|
86
|
+
}
|
|
87
|
+
interface BrowserPushTokenOptions {
|
|
88
|
+
/** Service worker registration used for PushManager subscription. */
|
|
89
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
90
|
+
/** Existing PushSubscription to reuse instead of subscribing again. */
|
|
91
|
+
subscription?: PushSubscription;
|
|
92
|
+
/** Public VAPID key used when creating a new PushSubscription. */
|
|
93
|
+
applicationServerKey?: string;
|
|
94
|
+
/** When true, unsubscribe old subscriptions before creating a new one. */
|
|
95
|
+
forceResubscribe?: boolean;
|
|
96
|
+
}
|
|
97
|
+
interface BrowserPushRegistrationOptions extends BrowserPushTokenOptions {
|
|
98
|
+
/** Optional explicit platform label. Defaults to "web". */
|
|
99
|
+
platform?: string;
|
|
100
|
+
deviceId?: string;
|
|
101
|
+
topics?: string[];
|
|
102
|
+
authAppId?: string;
|
|
103
|
+
}
|
|
104
|
+
interface SendPushNotificationInput {
|
|
105
|
+
title?: string;
|
|
106
|
+
body?: string;
|
|
107
|
+
image?: string;
|
|
108
|
+
data?: Record<string, unknown>;
|
|
109
|
+
tokens?: string[];
|
|
110
|
+
uid?: string;
|
|
111
|
+
topic?: string;
|
|
112
|
+
priority?: "normal" | "high";
|
|
113
|
+
ttlSeconds?: number;
|
|
114
|
+
dryRun?: boolean;
|
|
115
|
+
authAppId?: string;
|
|
116
|
+
}
|
|
117
|
+
interface PushSendResult {
|
|
118
|
+
sent: boolean;
|
|
119
|
+
appId: string;
|
|
120
|
+
targetCount: number;
|
|
121
|
+
successCount: number;
|
|
122
|
+
failureCount: number;
|
|
123
|
+
invalidatedTokenCount: number;
|
|
124
|
+
dryRun: boolean;
|
|
125
|
+
}
|
|
126
|
+
interface SendEmailInput {
|
|
127
|
+
to: string | string[];
|
|
128
|
+
tag: string;
|
|
129
|
+
values?: Record<string, unknown>;
|
|
130
|
+
authAppId?: string;
|
|
131
|
+
}
|
|
132
|
+
interface EmailSendResult {
|
|
133
|
+
sent: boolean;
|
|
134
|
+
appId: string;
|
|
135
|
+
tag: string;
|
|
136
|
+
recipientCount: number;
|
|
137
|
+
acceptedCount: number;
|
|
138
|
+
rejectedCount: number;
|
|
139
|
+
includeVerificationLink?: boolean;
|
|
140
|
+
linkId?: string;
|
|
141
|
+
verifyUrl?: string;
|
|
142
|
+
messageId?: string;
|
|
143
|
+
}
|
|
144
|
+
interface VerifyEmailLinkInput {
|
|
145
|
+
token: string;
|
|
146
|
+
tag?: string;
|
|
147
|
+
email?: string;
|
|
148
|
+
authAppId?: string;
|
|
149
|
+
}
|
|
150
|
+
interface EmailLinkVerifyResult {
|
|
151
|
+
verified: boolean;
|
|
152
|
+
alreadyVerified: boolean;
|
|
153
|
+
appId: string;
|
|
154
|
+
linkId: string;
|
|
155
|
+
email: string;
|
|
156
|
+
tag: string;
|
|
157
|
+
verifiedAt?: string;
|
|
158
|
+
acceptedByUid?: string;
|
|
159
|
+
}
|
|
68
160
|
type AuthStateListener = (session: FlareAuthSession & FlareAuthUser | null) => void;
|
|
69
161
|
type AuthConfigListener = (conf: FlareAuthConfig) => void;
|
|
70
162
|
interface SubscribeOptions {
|
|
71
163
|
skipSnapshot?: boolean;
|
|
72
164
|
}
|
|
73
|
-
type QueryOperator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "in" | "not-in" | "array-contains" | "array-contains-any" | "like" | "not-like" | "contains" | "exists" | "not-exists";
|
|
165
|
+
type QueryOperator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "in" | "not-in" | "array-contains" | "array-contains-any" | "elem-match" | "like" | "not-like" | "contains" | "exists" | "not-exists";
|
|
74
166
|
interface QueryConfig {
|
|
75
167
|
field: string;
|
|
76
168
|
op: QueryOperator;
|
|
@@ -78,9 +170,13 @@ interface QueryConfig {
|
|
|
78
170
|
}
|
|
79
171
|
/** OR group */
|
|
80
172
|
interface OrFilter {
|
|
81
|
-
or:
|
|
173
|
+
or: AnyFilter[];
|
|
174
|
+
}
|
|
175
|
+
/** AND group */
|
|
176
|
+
interface AndFilter {
|
|
177
|
+
and: AnyFilter[];
|
|
82
178
|
}
|
|
83
|
-
type AnyFilter = QueryConfig | OrFilter;
|
|
179
|
+
type AnyFilter = QueryConfig | OrFilter | AndFilter;
|
|
84
180
|
type WhereCondition = Record<string, string | number | boolean | any[]>;
|
|
85
181
|
interface OrderByClause {
|
|
86
182
|
field: string;
|
|
@@ -167,7 +263,7 @@ interface VectorSearchClause {
|
|
|
167
263
|
metric?: "cosine" | "euclidean" | "dotProduct";
|
|
168
264
|
minScore?: number;
|
|
169
265
|
}
|
|
170
|
-
/** Full structured query (
|
|
266
|
+
/** Full structured query (document query + SQL-style feature set) */
|
|
171
267
|
interface StructuredQuery {
|
|
172
268
|
where?: AnyFilter[];
|
|
173
269
|
orderBy?: OrderByClause[];
|
|
@@ -430,14 +526,48 @@ declare class CollectionReference<T = any, TPresetMap extends QueryPresetMap = {
|
|
|
430
526
|
constructor(client: FlareClient<TPresetMap>, collection: string);
|
|
431
527
|
doc(id: string): DocumentReference<T>;
|
|
432
528
|
private clone;
|
|
529
|
+
private normalizeFilterValue;
|
|
530
|
+
private normalizeFilter;
|
|
531
|
+
private toQueryFilters;
|
|
532
|
+
private appendOperatorFilter;
|
|
533
|
+
private appendAndFilters;
|
|
534
|
+
private toOrNode;
|
|
535
|
+
private toAndNode;
|
|
536
|
+
private appendOrFilters;
|
|
537
|
+
private appendFilters;
|
|
433
538
|
with<Name extends keyof TPresetMap & string>(name: Name, params: QueryPresetParams<TPresetMap[Name]>): CollectionQuery<QueryPresetRow<TPresetMap[Name]>, TPresetMap>;
|
|
434
539
|
with(name: string, params?: Record<string, unknown>): CollectionQuery<T, TPresetMap>;
|
|
435
540
|
/** ORM shorthand: .where({ age: ">= 25", role: "admin" }) */
|
|
436
541
|
where(condition: WhereCondition): CollectionQuery<T, TPresetMap>;
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
542
|
+
and(condition: WhereCondition): CollectionQuery<T, TPresetMap>;
|
|
543
|
+
or(condition: WhereCondition): CollectionQuery<T, TPresetMap>;
|
|
544
|
+
in(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
545
|
+
andIn(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
546
|
+
orIn(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
547
|
+
notIn(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
548
|
+
andNotIn(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
549
|
+
orNotIn(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
550
|
+
arrayContains(field: string, value: unknown): CollectionQuery<T, TPresetMap>;
|
|
551
|
+
andArrayContains(field: string, value: unknown): CollectionQuery<T, TPresetMap>;
|
|
552
|
+
orArrayContains(field: string, value: unknown): CollectionQuery<T, TPresetMap>;
|
|
553
|
+
arrayContainsAny(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
554
|
+
andArrayContainsAny(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
555
|
+
orArrayContainsAny(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
556
|
+
some(field: string, condition: Record<string, unknown>): CollectionQuery<T, TPresetMap>;
|
|
557
|
+
andSome(field: string, condition: Record<string, unknown>): CollectionQuery<T, TPresetMap>;
|
|
558
|
+
orSome(field: string, condition: Record<string, unknown>): CollectionQuery<T, TPresetMap>;
|
|
559
|
+
like(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
560
|
+
andLike(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
561
|
+
orLike(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
562
|
+
notLike(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
563
|
+
andNotLike(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
564
|
+
orNotLike(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
565
|
+
exists(field: string): CollectionQuery<T, TPresetMap>;
|
|
566
|
+
andExists(field: string): CollectionQuery<T, TPresetMap>;
|
|
567
|
+
orExists(field: string): CollectionQuery<T, TPresetMap>;
|
|
568
|
+
notExists(field: string): CollectionQuery<T, TPresetMap>;
|
|
569
|
+
andNotExists(field: string): CollectionQuery<T, TPresetMap>;
|
|
570
|
+
orNotExists(field: string): CollectionQuery<T, TPresetMap>;
|
|
441
571
|
/** Get items starting from the most recently created (descending sequence) */
|
|
442
572
|
latest(): CollectionQuery<T, TPresetMap>;
|
|
443
573
|
/** Get items starting from the first ever created (ascending sequence) */
|
|
@@ -781,6 +911,7 @@ declare class FlareAuth<TPresetMap extends QueryPresetMap = {}> extends FlareBas
|
|
|
781
911
|
protected csrfInitPromise?: Promise<void>;
|
|
782
912
|
protected csrfBootstrapAttempted: boolean;
|
|
783
913
|
protected socketAuthSyncPromise?: Promise<void>;
|
|
914
|
+
protected pushServiceWorkerInitPromise?: Promise<ServiceWorkerRegistration | null>;
|
|
784
915
|
protected authSession: FlareAuthSession | null;
|
|
785
916
|
protected authStateListeners: AuthStateListener[];
|
|
786
917
|
protected authConfigListeners: AuthConfigListener[];
|
|
@@ -977,6 +1108,39 @@ declare class FlareAuth<TPresetMap extends QueryPresetMap = {}> extends FlareBas
|
|
|
977
1108
|
email: string;
|
|
978
1109
|
sessionsRevoked?: number;
|
|
979
1110
|
}>;
|
|
1111
|
+
private toUint8ArrayFromBase64Url;
|
|
1112
|
+
private encodePushTokenFromSubscription;
|
|
1113
|
+
private fetchPushSetupConfig;
|
|
1114
|
+
setupPushServiceWorker(): Promise<ServiceWorkerRegistration | null>;
|
|
1115
|
+
requestPushPermission(): Promise<NotificationPermission>;
|
|
1116
|
+
acquireBrowserPushToken(options?: BrowserPushTokenOptions): Promise<{
|
|
1117
|
+
token: string;
|
|
1118
|
+
subscription: PushSubscription;
|
|
1119
|
+
}>;
|
|
1120
|
+
enableBrowserPush(options?: BrowserPushRegistrationOptions): Promise<{
|
|
1121
|
+
registered: boolean;
|
|
1122
|
+
appId: string;
|
|
1123
|
+
uid: string;
|
|
1124
|
+
token: string;
|
|
1125
|
+
platform?: string;
|
|
1126
|
+
subscription: PushSubscription;
|
|
1127
|
+
}>;
|
|
1128
|
+
registerPushToken(input: RegisterPushTokenInput): Promise<{
|
|
1129
|
+
registered: boolean;
|
|
1130
|
+
appId: string;
|
|
1131
|
+
uid: string;
|
|
1132
|
+
token: string;
|
|
1133
|
+
platform?: string;
|
|
1134
|
+
}>;
|
|
1135
|
+
unregisterPushToken(token: string, authAppId?: string): Promise<{
|
|
1136
|
+
unregistered: boolean;
|
|
1137
|
+
appId: string;
|
|
1138
|
+
token: string;
|
|
1139
|
+
removed: boolean;
|
|
1140
|
+
}>;
|
|
1141
|
+
sendPushNotification(input: SendPushNotificationInput): Promise<PushSendResult>;
|
|
1142
|
+
sendEmail(input: SendEmailInput): Promise<EmailSendResult>;
|
|
1143
|
+
verifyEmailLink(input: VerifyEmailLinkInput): Promise<EmailLinkVerifyResult>;
|
|
980
1144
|
signIn(providerId: ProviderId, options?: {
|
|
981
1145
|
returnTo?: string;
|
|
982
1146
|
metaTag?: string;
|
|
@@ -1062,7 +1226,10 @@ declare class FlareAuth<TPresetMap extends QueryPresetMap = {}> extends FlareBas
|
|
|
1062
1226
|
*/
|
|
1063
1227
|
|
|
1064
1228
|
declare class FlareClient<TPresetMap extends QueryPresetMap = {}> extends FlareAuth<TPresetMap> {
|
|
1229
|
+
private autoPushRegisteredIdentity?;
|
|
1065
1230
|
constructor(config: FlareConfig);
|
|
1231
|
+
private enableAutoPushNotificationsAfterAuth;
|
|
1232
|
+
autoEnablePushNotifications(): Promise<void>;
|
|
1066
1233
|
}
|
|
1067
1234
|
|
|
1068
1235
|
/**
|
|
@@ -1253,4 +1420,4 @@ declare const getFlare: () => FlareClient | null;
|
|
|
1253
1420
|
*/
|
|
1254
1421
|
declare const disconnectFlare: () => void;
|
|
1255
1422
|
|
|
1256
|
-
export { type AggregateFunction, type AggregateSpec, type AnyFilter, type AuthConfigListener, type AuthConfigResponse, type AuthResult, type AuthStateListener, type AuthWithPendingVerificationResult, type AuthWithTokenResult, type BaseMessage, type ChangeEvent, type ChangeOperation, type CollectionPresetMethods, type CollectionQuery, CollectionReference, type ConnectionState, type CsrfProxyConfig, type CursorValue, type DocAddedCallback, type DocChangedCallback, type DocDeletedCallback, type DocUpdatedCallback, DocumentQueryBuilder, DocumentReference, type DocumentSnapshot, FlareAction, type FlareAuthConfig, type FlareAuthProviderId, type FlareAuthProviderPublicConfig, type FlareAuthSession, type FlareAuthUser, type FlareConfig, FlareError, FlareErrors, FlareEvent, FlareResponseCodes, type FlareRule, type GroupByClause, type HavingClause, type JoinClause, type JoinQueryPattern, type NestedJoinClause, type OfflineOperation, type OrFilter, type OrderByClause, type PresenceCallback, type PresenceJoinCallback, type PresenceLeaveCallback, type PresenceMember, type QueryConfig, type QueryOperator, type QueryPresetMap, type QueryPresetParams, type QueryPresetRow, type QueryPresetSpec, type QuerySnapshot, type RulePermission, type SecurityRuleEntry, type SecurityRulesMap, type SnapshotEvent, type StructuredJoinClause, type StructuredQuery, type SubscribeMessage, type SubscribeOptions, type SubscriptionCallback, type SubscriptionData, type SubscriptionError, type SubscriptionErrorCallback, type SubscriptionHandle, type VectorFieldConfig, type VectorSearchClause, type WhereCondition, buildFlareHeaders, connectApp, createCsrfProxy, createCsrfProxyHandler, FlareClient as default, disconnectFlare, extractCsrfFromRequest, flareRulesToSecurityMap, getFlare, parseValue, parseWhereCondition, securityMapToFlareRules };
|
|
1423
|
+
export { type AggregateFunction, type AggregateSpec, type AndFilter, type AnyFilter, type AuthConfigListener, type AuthConfigResponse, type AuthResult, type AuthStateListener, type AuthWithPendingVerificationResult, type AuthWithTokenResult, type BaseMessage, type BrowserPushRegistrationOptions, type BrowserPushTokenOptions, type ChangeEvent, type ChangeOperation, type CollectionPresetMethods, type CollectionQuery, CollectionReference, type ConnectionState, type CsrfProxyConfig, type CursorValue, type DocAddedCallback, type DocChangedCallback, type DocDeletedCallback, type DocUpdatedCallback, DocumentQueryBuilder, DocumentReference, type DocumentSnapshot, type EmailLinkVerifyResult, type EmailSendResult, FlareAction, type FlareAuthConfig, type FlareAuthProviderId, type FlareAuthProviderPublicConfig, type FlareAuthSession, type FlareAuthUser, type FlareConfig, FlareError, FlareErrors, FlareEvent, FlareResponseCodes, type FlareRule, type GroupByClause, type HavingClause, type JoinClause, type JoinQueryPattern, type NestedJoinClause, type OfflineOperation, type OrFilter, type OrderByClause, type PresenceCallback, type PresenceJoinCallback, type PresenceLeaveCallback, type PresenceMember, type PushSendResult, type QueryConfig, type QueryOperator, type QueryPresetMap, type QueryPresetParams, type QueryPresetRow, type QueryPresetSpec, type QuerySnapshot, type RegisterPushTokenInput, type RulePermission, type SecurityRuleEntry, type SecurityRulesMap, type SendEmailInput, type SendPushNotificationInput, type SnapshotEvent, type StructuredJoinClause, type StructuredQuery, type SubscribeMessage, type SubscribeOptions, type SubscriptionCallback, type SubscriptionData, type SubscriptionError, type SubscriptionErrorCallback, type SubscriptionHandle, type VectorFieldConfig, type VectorSearchClause, type VerifyEmailLinkInput, type WhereCondition, buildFlareHeaders, connectApp, createCsrfProxy, createCsrfProxyHandler, FlareClient as default, disconnectFlare, extractCsrfFromRequest, flareRulesToSecurityMap, getFlare, parseValue, parseWhereCondition, securityMapToFlareRules };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { Anonymous, Apple, AuthGuard, AuthToken, CreateUserWithEmailAndPasswordI
|
|
|
5
5
|
* Client Configuration
|
|
6
6
|
*/
|
|
7
7
|
interface FlareConfig {
|
|
8
|
+
/** Base URL for the Flare API. */
|
|
8
9
|
endpoint: string;
|
|
9
10
|
/**
|
|
10
11
|
* Optional HTTP base URL for auth API calls.
|
|
@@ -14,15 +15,26 @@ interface FlareConfig {
|
|
|
14
15
|
* Example: '/api/flare' (relative, browser resolves against current origin)
|
|
15
16
|
*/
|
|
16
17
|
httpBase?: string;
|
|
18
|
+
/** Unique identifier for the application. */
|
|
17
19
|
appId: string;
|
|
20
|
+
/** API key for the application. */
|
|
18
21
|
apiKey?: string;
|
|
22
|
+
/** Public key for the application. */
|
|
19
23
|
publicKey?: string;
|
|
24
|
+
/** Whether to automatically reconnect on connection loss. */
|
|
20
25
|
autoReconnect?: boolean;
|
|
26
|
+
/** Delay between reconnection attempts in milliseconds. */
|
|
21
27
|
reconnectDelay?: number;
|
|
28
|
+
/** Maximum delay between reconnection attempts in milliseconds. */
|
|
22
29
|
maxReconnectDelay?: number;
|
|
30
|
+
/** Enable or disable debug mode. */
|
|
23
31
|
debug?: boolean;
|
|
32
|
+
/** Enable or disable request timing. */
|
|
24
33
|
requestTiming?: boolean;
|
|
34
|
+
/** Connection timeout in milliseconds. */
|
|
25
35
|
connectionTimeout?: number;
|
|
36
|
+
/** Enable automatic push notification registration on supported platforms. */
|
|
37
|
+
pushNotifications?: boolean;
|
|
26
38
|
}
|
|
27
39
|
type FlareAuthProviderId = "credentials" | "anonymous" | "google" | "facebook" | "github" | "dropbox" | "apple" | "twitter";
|
|
28
40
|
interface FlareAuthProviderPublicConfig {
|
|
@@ -65,12 +77,92 @@ interface FlareAuthUser {
|
|
|
65
77
|
email_verified: string;
|
|
66
78
|
[x: string]: any;
|
|
67
79
|
}
|
|
80
|
+
interface RegisterPushTokenInput {
|
|
81
|
+
token: string;
|
|
82
|
+
platform?: string;
|
|
83
|
+
deviceId?: string;
|
|
84
|
+
topics?: string[];
|
|
85
|
+
authAppId?: string;
|
|
86
|
+
}
|
|
87
|
+
interface BrowserPushTokenOptions {
|
|
88
|
+
/** Service worker registration used for PushManager subscription. */
|
|
89
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
90
|
+
/** Existing PushSubscription to reuse instead of subscribing again. */
|
|
91
|
+
subscription?: PushSubscription;
|
|
92
|
+
/** Public VAPID key used when creating a new PushSubscription. */
|
|
93
|
+
applicationServerKey?: string;
|
|
94
|
+
/** When true, unsubscribe old subscriptions before creating a new one. */
|
|
95
|
+
forceResubscribe?: boolean;
|
|
96
|
+
}
|
|
97
|
+
interface BrowserPushRegistrationOptions extends BrowserPushTokenOptions {
|
|
98
|
+
/** Optional explicit platform label. Defaults to "web". */
|
|
99
|
+
platform?: string;
|
|
100
|
+
deviceId?: string;
|
|
101
|
+
topics?: string[];
|
|
102
|
+
authAppId?: string;
|
|
103
|
+
}
|
|
104
|
+
interface SendPushNotificationInput {
|
|
105
|
+
title?: string;
|
|
106
|
+
body?: string;
|
|
107
|
+
image?: string;
|
|
108
|
+
data?: Record<string, unknown>;
|
|
109
|
+
tokens?: string[];
|
|
110
|
+
uid?: string;
|
|
111
|
+
topic?: string;
|
|
112
|
+
priority?: "normal" | "high";
|
|
113
|
+
ttlSeconds?: number;
|
|
114
|
+
dryRun?: boolean;
|
|
115
|
+
authAppId?: string;
|
|
116
|
+
}
|
|
117
|
+
interface PushSendResult {
|
|
118
|
+
sent: boolean;
|
|
119
|
+
appId: string;
|
|
120
|
+
targetCount: number;
|
|
121
|
+
successCount: number;
|
|
122
|
+
failureCount: number;
|
|
123
|
+
invalidatedTokenCount: number;
|
|
124
|
+
dryRun: boolean;
|
|
125
|
+
}
|
|
126
|
+
interface SendEmailInput {
|
|
127
|
+
to: string | string[];
|
|
128
|
+
tag: string;
|
|
129
|
+
values?: Record<string, unknown>;
|
|
130
|
+
authAppId?: string;
|
|
131
|
+
}
|
|
132
|
+
interface EmailSendResult {
|
|
133
|
+
sent: boolean;
|
|
134
|
+
appId: string;
|
|
135
|
+
tag: string;
|
|
136
|
+
recipientCount: number;
|
|
137
|
+
acceptedCount: number;
|
|
138
|
+
rejectedCount: number;
|
|
139
|
+
includeVerificationLink?: boolean;
|
|
140
|
+
linkId?: string;
|
|
141
|
+
verifyUrl?: string;
|
|
142
|
+
messageId?: string;
|
|
143
|
+
}
|
|
144
|
+
interface VerifyEmailLinkInput {
|
|
145
|
+
token: string;
|
|
146
|
+
tag?: string;
|
|
147
|
+
email?: string;
|
|
148
|
+
authAppId?: string;
|
|
149
|
+
}
|
|
150
|
+
interface EmailLinkVerifyResult {
|
|
151
|
+
verified: boolean;
|
|
152
|
+
alreadyVerified: boolean;
|
|
153
|
+
appId: string;
|
|
154
|
+
linkId: string;
|
|
155
|
+
email: string;
|
|
156
|
+
tag: string;
|
|
157
|
+
verifiedAt?: string;
|
|
158
|
+
acceptedByUid?: string;
|
|
159
|
+
}
|
|
68
160
|
type AuthStateListener = (session: FlareAuthSession & FlareAuthUser | null) => void;
|
|
69
161
|
type AuthConfigListener = (conf: FlareAuthConfig) => void;
|
|
70
162
|
interface SubscribeOptions {
|
|
71
163
|
skipSnapshot?: boolean;
|
|
72
164
|
}
|
|
73
|
-
type QueryOperator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "in" | "not-in" | "array-contains" | "array-contains-any" | "like" | "not-like" | "contains" | "exists" | "not-exists";
|
|
165
|
+
type QueryOperator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "in" | "not-in" | "array-contains" | "array-contains-any" | "elem-match" | "like" | "not-like" | "contains" | "exists" | "not-exists";
|
|
74
166
|
interface QueryConfig {
|
|
75
167
|
field: string;
|
|
76
168
|
op: QueryOperator;
|
|
@@ -78,9 +170,13 @@ interface QueryConfig {
|
|
|
78
170
|
}
|
|
79
171
|
/** OR group */
|
|
80
172
|
interface OrFilter {
|
|
81
|
-
or:
|
|
173
|
+
or: AnyFilter[];
|
|
174
|
+
}
|
|
175
|
+
/** AND group */
|
|
176
|
+
interface AndFilter {
|
|
177
|
+
and: AnyFilter[];
|
|
82
178
|
}
|
|
83
|
-
type AnyFilter = QueryConfig | OrFilter;
|
|
179
|
+
type AnyFilter = QueryConfig | OrFilter | AndFilter;
|
|
84
180
|
type WhereCondition = Record<string, string | number | boolean | any[]>;
|
|
85
181
|
interface OrderByClause {
|
|
86
182
|
field: string;
|
|
@@ -167,7 +263,7 @@ interface VectorSearchClause {
|
|
|
167
263
|
metric?: "cosine" | "euclidean" | "dotProduct";
|
|
168
264
|
minScore?: number;
|
|
169
265
|
}
|
|
170
|
-
/** Full structured query (
|
|
266
|
+
/** Full structured query (document query + SQL-style feature set) */
|
|
171
267
|
interface StructuredQuery {
|
|
172
268
|
where?: AnyFilter[];
|
|
173
269
|
orderBy?: OrderByClause[];
|
|
@@ -430,14 +526,48 @@ declare class CollectionReference<T = any, TPresetMap extends QueryPresetMap = {
|
|
|
430
526
|
constructor(client: FlareClient<TPresetMap>, collection: string);
|
|
431
527
|
doc(id: string): DocumentReference<T>;
|
|
432
528
|
private clone;
|
|
529
|
+
private normalizeFilterValue;
|
|
530
|
+
private normalizeFilter;
|
|
531
|
+
private toQueryFilters;
|
|
532
|
+
private appendOperatorFilter;
|
|
533
|
+
private appendAndFilters;
|
|
534
|
+
private toOrNode;
|
|
535
|
+
private toAndNode;
|
|
536
|
+
private appendOrFilters;
|
|
537
|
+
private appendFilters;
|
|
433
538
|
with<Name extends keyof TPresetMap & string>(name: Name, params: QueryPresetParams<TPresetMap[Name]>): CollectionQuery<QueryPresetRow<TPresetMap[Name]>, TPresetMap>;
|
|
434
539
|
with(name: string, params?: Record<string, unknown>): CollectionQuery<T, TPresetMap>;
|
|
435
540
|
/** ORM shorthand: .where({ age: ">= 25", role: "admin" }) */
|
|
436
541
|
where(condition: WhereCondition): CollectionQuery<T, TPresetMap>;
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
542
|
+
and(condition: WhereCondition): CollectionQuery<T, TPresetMap>;
|
|
543
|
+
or(condition: WhereCondition): CollectionQuery<T, TPresetMap>;
|
|
544
|
+
in(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
545
|
+
andIn(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
546
|
+
orIn(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
547
|
+
notIn(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
548
|
+
andNotIn(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
549
|
+
orNotIn(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
550
|
+
arrayContains(field: string, value: unknown): CollectionQuery<T, TPresetMap>;
|
|
551
|
+
andArrayContains(field: string, value: unknown): CollectionQuery<T, TPresetMap>;
|
|
552
|
+
orArrayContains(field: string, value: unknown): CollectionQuery<T, TPresetMap>;
|
|
553
|
+
arrayContainsAny(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
554
|
+
andArrayContainsAny(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
555
|
+
orArrayContainsAny(field: string, values: unknown[] | unknown): CollectionQuery<T, TPresetMap>;
|
|
556
|
+
some(field: string, condition: Record<string, unknown>): CollectionQuery<T, TPresetMap>;
|
|
557
|
+
andSome(field: string, condition: Record<string, unknown>): CollectionQuery<T, TPresetMap>;
|
|
558
|
+
orSome(field: string, condition: Record<string, unknown>): CollectionQuery<T, TPresetMap>;
|
|
559
|
+
like(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
560
|
+
andLike(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
561
|
+
orLike(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
562
|
+
notLike(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
563
|
+
andNotLike(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
564
|
+
orNotLike(field: string, value: string): CollectionQuery<T, TPresetMap>;
|
|
565
|
+
exists(field: string): CollectionQuery<T, TPresetMap>;
|
|
566
|
+
andExists(field: string): CollectionQuery<T, TPresetMap>;
|
|
567
|
+
orExists(field: string): CollectionQuery<T, TPresetMap>;
|
|
568
|
+
notExists(field: string): CollectionQuery<T, TPresetMap>;
|
|
569
|
+
andNotExists(field: string): CollectionQuery<T, TPresetMap>;
|
|
570
|
+
orNotExists(field: string): CollectionQuery<T, TPresetMap>;
|
|
441
571
|
/** Get items starting from the most recently created (descending sequence) */
|
|
442
572
|
latest(): CollectionQuery<T, TPresetMap>;
|
|
443
573
|
/** Get items starting from the first ever created (ascending sequence) */
|
|
@@ -781,6 +911,7 @@ declare class FlareAuth<TPresetMap extends QueryPresetMap = {}> extends FlareBas
|
|
|
781
911
|
protected csrfInitPromise?: Promise<void>;
|
|
782
912
|
protected csrfBootstrapAttempted: boolean;
|
|
783
913
|
protected socketAuthSyncPromise?: Promise<void>;
|
|
914
|
+
protected pushServiceWorkerInitPromise?: Promise<ServiceWorkerRegistration | null>;
|
|
784
915
|
protected authSession: FlareAuthSession | null;
|
|
785
916
|
protected authStateListeners: AuthStateListener[];
|
|
786
917
|
protected authConfigListeners: AuthConfigListener[];
|
|
@@ -977,6 +1108,39 @@ declare class FlareAuth<TPresetMap extends QueryPresetMap = {}> extends FlareBas
|
|
|
977
1108
|
email: string;
|
|
978
1109
|
sessionsRevoked?: number;
|
|
979
1110
|
}>;
|
|
1111
|
+
private toUint8ArrayFromBase64Url;
|
|
1112
|
+
private encodePushTokenFromSubscription;
|
|
1113
|
+
private fetchPushSetupConfig;
|
|
1114
|
+
setupPushServiceWorker(): Promise<ServiceWorkerRegistration | null>;
|
|
1115
|
+
requestPushPermission(): Promise<NotificationPermission>;
|
|
1116
|
+
acquireBrowserPushToken(options?: BrowserPushTokenOptions): Promise<{
|
|
1117
|
+
token: string;
|
|
1118
|
+
subscription: PushSubscription;
|
|
1119
|
+
}>;
|
|
1120
|
+
enableBrowserPush(options?: BrowserPushRegistrationOptions): Promise<{
|
|
1121
|
+
registered: boolean;
|
|
1122
|
+
appId: string;
|
|
1123
|
+
uid: string;
|
|
1124
|
+
token: string;
|
|
1125
|
+
platform?: string;
|
|
1126
|
+
subscription: PushSubscription;
|
|
1127
|
+
}>;
|
|
1128
|
+
registerPushToken(input: RegisterPushTokenInput): Promise<{
|
|
1129
|
+
registered: boolean;
|
|
1130
|
+
appId: string;
|
|
1131
|
+
uid: string;
|
|
1132
|
+
token: string;
|
|
1133
|
+
platform?: string;
|
|
1134
|
+
}>;
|
|
1135
|
+
unregisterPushToken(token: string, authAppId?: string): Promise<{
|
|
1136
|
+
unregistered: boolean;
|
|
1137
|
+
appId: string;
|
|
1138
|
+
token: string;
|
|
1139
|
+
removed: boolean;
|
|
1140
|
+
}>;
|
|
1141
|
+
sendPushNotification(input: SendPushNotificationInput): Promise<PushSendResult>;
|
|
1142
|
+
sendEmail(input: SendEmailInput): Promise<EmailSendResult>;
|
|
1143
|
+
verifyEmailLink(input: VerifyEmailLinkInput): Promise<EmailLinkVerifyResult>;
|
|
980
1144
|
signIn(providerId: ProviderId, options?: {
|
|
981
1145
|
returnTo?: string;
|
|
982
1146
|
metaTag?: string;
|
|
@@ -1062,7 +1226,10 @@ declare class FlareAuth<TPresetMap extends QueryPresetMap = {}> extends FlareBas
|
|
|
1062
1226
|
*/
|
|
1063
1227
|
|
|
1064
1228
|
declare class FlareClient<TPresetMap extends QueryPresetMap = {}> extends FlareAuth<TPresetMap> {
|
|
1229
|
+
private autoPushRegisteredIdentity?;
|
|
1065
1230
|
constructor(config: FlareConfig);
|
|
1231
|
+
private enableAutoPushNotificationsAfterAuth;
|
|
1232
|
+
autoEnablePushNotifications(): Promise<void>;
|
|
1066
1233
|
}
|
|
1067
1234
|
|
|
1068
1235
|
/**
|
|
@@ -1253,4 +1420,4 @@ declare const getFlare: () => FlareClient | null;
|
|
|
1253
1420
|
*/
|
|
1254
1421
|
declare const disconnectFlare: () => void;
|
|
1255
1422
|
|
|
1256
|
-
export { type AggregateFunction, type AggregateSpec, type AnyFilter, type AuthConfigListener, type AuthConfigResponse, type AuthResult, type AuthStateListener, type AuthWithPendingVerificationResult, type AuthWithTokenResult, type BaseMessage, type ChangeEvent, type ChangeOperation, type CollectionPresetMethods, type CollectionQuery, CollectionReference, type ConnectionState, type CsrfProxyConfig, type CursorValue, type DocAddedCallback, type DocChangedCallback, type DocDeletedCallback, type DocUpdatedCallback, DocumentQueryBuilder, DocumentReference, type DocumentSnapshot, FlareAction, type FlareAuthConfig, type FlareAuthProviderId, type FlareAuthProviderPublicConfig, type FlareAuthSession, type FlareAuthUser, type FlareConfig, FlareError, FlareErrors, FlareEvent, FlareResponseCodes, type FlareRule, type GroupByClause, type HavingClause, type JoinClause, type JoinQueryPattern, type NestedJoinClause, type OfflineOperation, type OrFilter, type OrderByClause, type PresenceCallback, type PresenceJoinCallback, type PresenceLeaveCallback, type PresenceMember, type QueryConfig, type QueryOperator, type QueryPresetMap, type QueryPresetParams, type QueryPresetRow, type QueryPresetSpec, type QuerySnapshot, type RulePermission, type SecurityRuleEntry, type SecurityRulesMap, type SnapshotEvent, type StructuredJoinClause, type StructuredQuery, type SubscribeMessage, type SubscribeOptions, type SubscriptionCallback, type SubscriptionData, type SubscriptionError, type SubscriptionErrorCallback, type SubscriptionHandle, type VectorFieldConfig, type VectorSearchClause, type WhereCondition, buildFlareHeaders, connectApp, createCsrfProxy, createCsrfProxyHandler, FlareClient as default, disconnectFlare, extractCsrfFromRequest, flareRulesToSecurityMap, getFlare, parseValue, parseWhereCondition, securityMapToFlareRules };
|
|
1423
|
+
export { type AggregateFunction, type AggregateSpec, type AndFilter, type AnyFilter, type AuthConfigListener, type AuthConfigResponse, type AuthResult, type AuthStateListener, type AuthWithPendingVerificationResult, type AuthWithTokenResult, type BaseMessage, type BrowserPushRegistrationOptions, type BrowserPushTokenOptions, type ChangeEvent, type ChangeOperation, type CollectionPresetMethods, type CollectionQuery, CollectionReference, type ConnectionState, type CsrfProxyConfig, type CursorValue, type DocAddedCallback, type DocChangedCallback, type DocDeletedCallback, type DocUpdatedCallback, DocumentQueryBuilder, DocumentReference, type DocumentSnapshot, type EmailLinkVerifyResult, type EmailSendResult, FlareAction, type FlareAuthConfig, type FlareAuthProviderId, type FlareAuthProviderPublicConfig, type FlareAuthSession, type FlareAuthUser, type FlareConfig, FlareError, FlareErrors, FlareEvent, FlareResponseCodes, type FlareRule, type GroupByClause, type HavingClause, type JoinClause, type JoinQueryPattern, type NestedJoinClause, type OfflineOperation, type OrFilter, type OrderByClause, type PresenceCallback, type PresenceJoinCallback, type PresenceLeaveCallback, type PresenceMember, type PushSendResult, type QueryConfig, type QueryOperator, type QueryPresetMap, type QueryPresetParams, type QueryPresetRow, type QueryPresetSpec, type QuerySnapshot, type RegisterPushTokenInput, type RulePermission, type SecurityRuleEntry, type SecurityRulesMap, type SendEmailInput, type SendPushNotificationInput, type SnapshotEvent, type StructuredJoinClause, type StructuredQuery, type SubscribeMessage, type SubscribeOptions, type SubscriptionCallback, type SubscriptionData, type SubscriptionError, type SubscriptionErrorCallback, type SubscriptionHandle, type VectorFieldConfig, type VectorSearchClause, type VerifyEmailLinkInput, type WhereCondition, buildFlareHeaders, connectApp, createCsrfProxy, createCsrfProxyHandler, FlareClient as default, disconnectFlare, extractCsrfFromRequest, flareRulesToSecurityMap, getFlare, parseValue, parseWhereCondition, securityMapToFlareRules };
|