@affectively/dash 5.2.1 → 5.3.1
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/index.d.ts +62 -0
- package/dist/index.js +31 -0
- package/dist/sync/index.d.ts +6 -0
- package/dist/sync/index.js +4 -0
- package/package.json +45 -66
- package/README.md +0 -193
- package/dist/src/api/firebase/auth/index.d.ts +0 -137
- package/dist/src/api/firebase/auth/index.js +0 -352
- package/dist/src/api/firebase/auth/providers.d.ts +0 -254
- package/dist/src/api/firebase/auth/providers.js +0 -518
- package/dist/src/api/firebase/database/index.d.ts +0 -108
- package/dist/src/api/firebase/database/index.js +0 -368
- package/dist/src/api/firebase/errors.d.ts +0 -15
- package/dist/src/api/firebase/errors.js +0 -215
- package/dist/src/api/firebase/firestore/data-types.d.ts +0 -116
- package/dist/src/api/firebase/firestore/data-types.js +0 -280
- package/dist/src/api/firebase/firestore/index.d.ts +0 -7
- package/dist/src/api/firebase/firestore/index.js +0 -13
- package/dist/src/api/firebase/firestore/listeners.d.ts +0 -20
- package/dist/src/api/firebase/firestore/listeners.js +0 -50
- package/dist/src/api/firebase/firestore/operations.d.ts +0 -123
- package/dist/src/api/firebase/firestore/operations.js +0 -490
- package/dist/src/api/firebase/firestore/query.d.ts +0 -118
- package/dist/src/api/firebase/firestore/query.js +0 -418
- package/dist/src/api/firebase/index.d.ts +0 -11
- package/dist/src/api/firebase/index.js +0 -17
- package/dist/src/api/firebase/storage/index.d.ts +0 -100
- package/dist/src/api/firebase/storage/index.js +0 -286
- package/dist/src/api/firebase/types.d.ts +0 -341
- package/dist/src/api/firebase/types.js +0 -4
- package/dist/src/auth/manager.d.ts +0 -182
- package/dist/src/auth/manager.js +0 -598
- package/dist/src/engine/ai.d.ts +0 -10
- package/dist/src/engine/ai.js +0 -76
- package/dist/src/engine/sqlite.d.ts +0 -298
- package/dist/src/engine/sqlite.js +0 -1088
- package/dist/src/engine/vec_extension.d.ts +0 -5
- package/dist/src/engine/vec_extension.js +0 -10
- package/dist/src/index.d.ts +0 -15
- package/dist/src/index.js +0 -24
- package/dist/src/mcp/server.d.ts +0 -8
- package/dist/src/mcp/server.js +0 -87
- package/dist/src/reactivity/signal.d.ts +0 -3
- package/dist/src/reactivity/signal.js +0 -31
- package/dist/src/schema/lens.d.ts +0 -29
- package/dist/src/schema/lens.js +0 -122
- package/dist/src/sync/aeon/config.d.ts +0 -21
- package/dist/src/sync/aeon/config.js +0 -14
- package/dist/src/sync/aeon/delta-adapter.d.ts +0 -62
- package/dist/src/sync/aeon/delta-adapter.js +0 -98
- package/dist/src/sync/aeon/index.d.ts +0 -18
- package/dist/src/sync/aeon/index.js +0 -19
- package/dist/src/sync/aeon/offline-adapter.d.ts +0 -110
- package/dist/src/sync/aeon/offline-adapter.js +0 -227
- package/dist/src/sync/aeon/presence-adapter.d.ts +0 -114
- package/dist/src/sync/aeon/presence-adapter.js +0 -157
- package/dist/src/sync/aeon/schema-adapter.d.ts +0 -95
- package/dist/src/sync/aeon/schema-adapter.js +0 -163
- package/dist/src/sync/backup.d.ts +0 -12
- package/dist/src/sync/backup.js +0 -44
- package/dist/src/sync/connection.d.ts +0 -20
- package/dist/src/sync/connection.js +0 -50
- package/dist/src/sync/d1-provider.d.ts +0 -97
- package/dist/src/sync/d1-provider.js +0 -345
- package/dist/src/sync/hybrid-provider.d.ts +0 -172
- package/dist/src/sync/hybrid-provider.js +0 -477
- package/dist/src/sync/provider.d.ts +0 -11
- package/dist/src/sync/provider.js +0 -67
- package/dist/src/sync/verify.d.ts +0 -1
- package/dist/src/sync/verify.js +0 -23
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Firestore data types and utilities
|
|
3
|
-
*/
|
|
4
|
-
import type { FieldValue as IFieldValue, Timestamp as ITimestamp, GeoPoint as IGeoPoint } from '../types.js';
|
|
5
|
-
/**
|
|
6
|
-
* Represents a timestamp value on the server
|
|
7
|
-
*/
|
|
8
|
-
export declare class Timestamp implements ITimestamp {
|
|
9
|
-
readonly seconds: number;
|
|
10
|
-
readonly nanoseconds: number;
|
|
11
|
-
readonly _methodName: string;
|
|
12
|
-
constructor(seconds: number, nanoseconds: number);
|
|
13
|
-
static now(): Timestamp;
|
|
14
|
-
static fromDate(date: Date): Timestamp;
|
|
15
|
-
static fromMillis(milliseconds: number): Timestamp;
|
|
16
|
-
toDate(): Date;
|
|
17
|
-
toMillis(): number;
|
|
18
|
-
_compareTo(other: Timestamp): number;
|
|
19
|
-
isEqual(other: Timestamp): boolean;
|
|
20
|
-
toString(): string;
|
|
21
|
-
toJSON(): {
|
|
22
|
-
seconds: number;
|
|
23
|
-
nanoseconds: number;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Represents a geographical point
|
|
28
|
-
*/
|
|
29
|
-
export declare class GeoPoint implements IGeoPoint {
|
|
30
|
-
readonly latitude: number;
|
|
31
|
-
readonly longitude: number;
|
|
32
|
-
constructor(latitude: number, longitude: number);
|
|
33
|
-
isEqual(other: GeoPoint): boolean;
|
|
34
|
-
toString(): string;
|
|
35
|
-
toJSON(): {
|
|
36
|
-
latitude: number;
|
|
37
|
-
longitude: number;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Represents a field value
|
|
42
|
-
*/
|
|
43
|
-
export declare class FieldValue implements IFieldValue {
|
|
44
|
-
_type: string;
|
|
45
|
-
constructor(type: string);
|
|
46
|
-
_serialize(): any;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Sentinel value indicating server timestamp
|
|
50
|
-
*/
|
|
51
|
-
export declare class ServerTimestamp extends FieldValue {
|
|
52
|
-
constructor();
|
|
53
|
-
_serialize(): {
|
|
54
|
-
__type: string;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Sentinel value for delete field
|
|
59
|
-
*/
|
|
60
|
-
export declare class DeleteField extends FieldValue {
|
|
61
|
-
constructor();
|
|
62
|
-
_serialize(): {
|
|
63
|
-
__type: string;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Sentinel value for array union
|
|
68
|
-
*/
|
|
69
|
-
export declare class ArrayUnion extends FieldValue {
|
|
70
|
-
elements: any[];
|
|
71
|
-
constructor(elements: any[]);
|
|
72
|
-
_serialize(): {
|
|
73
|
-
__type: string;
|
|
74
|
-
elements: any[];
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Sentinel value for array remove
|
|
79
|
-
*/
|
|
80
|
-
export declare class ArrayRemove extends FieldValue {
|
|
81
|
-
elements: any[];
|
|
82
|
-
constructor(elements: any[]);
|
|
83
|
-
_serialize(): {
|
|
84
|
-
__type: string;
|
|
85
|
-
elements: any[];
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Sentinel value for numeric increment
|
|
90
|
-
*/
|
|
91
|
-
export declare class Increment extends FieldValue {
|
|
92
|
-
operand: number;
|
|
93
|
-
constructor(operand: number);
|
|
94
|
-
get delta(): number;
|
|
95
|
-
_serialize(): {
|
|
96
|
-
__type: string;
|
|
97
|
-
operand: number;
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
export declare function serverTimestamp(): ServerTimestamp;
|
|
101
|
-
export declare function deleteField(): DeleteField;
|
|
102
|
-
export declare function arrayUnion(elements: any[]): ArrayUnion;
|
|
103
|
-
export declare function arrayRemove(elements: any[]): ArrayRemove;
|
|
104
|
-
export declare function increment(delta: number): Increment;
|
|
105
|
-
/**
|
|
106
|
-
* Test if a value is a field value sentinel
|
|
107
|
-
*/
|
|
108
|
-
export declare function isFieldValue(value: any): value is FieldValue;
|
|
109
|
-
/**
|
|
110
|
-
* Serialize field values for storage
|
|
111
|
-
*/
|
|
112
|
-
export declare function serializeFieldValue(value: any): any;
|
|
113
|
-
/**
|
|
114
|
-
* Deserialize field values from storage
|
|
115
|
-
*/
|
|
116
|
-
export declare function deserializeFieldValue(value: any): any;
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Firestore data types and utilities
|
|
3
|
-
*/
|
|
4
|
-
import { createFirebaseError } from '../errors.js';
|
|
5
|
-
/**
|
|
6
|
-
* Represents a timestamp value on the server
|
|
7
|
-
*/
|
|
8
|
-
export class Timestamp {
|
|
9
|
-
seconds;
|
|
10
|
-
nanoseconds;
|
|
11
|
-
_methodName = 'serverTimestamp';
|
|
12
|
-
constructor(seconds, nanoseconds) {
|
|
13
|
-
if (nanoseconds < 0 || nanoseconds >= 1e9) {
|
|
14
|
-
throw createFirebaseError('firestore/invalid-argument', 'Timestamp nanoseconds out of range: ' + nanoseconds);
|
|
15
|
-
}
|
|
16
|
-
if (seconds < -62135596800 || seconds > 253402300799) {
|
|
17
|
-
throw createFirebaseError('firestore/invalid-argument', 'Timestamp seconds out of range: ' + seconds);
|
|
18
|
-
}
|
|
19
|
-
this.seconds = Math.floor(seconds);
|
|
20
|
-
this.nanoseconds = Math.floor(nanoseconds);
|
|
21
|
-
}
|
|
22
|
-
static now() {
|
|
23
|
-
return Timestamp.fromDate(new Date());
|
|
24
|
-
}
|
|
25
|
-
static fromDate(date) {
|
|
26
|
-
const milliseconds = date.getTime();
|
|
27
|
-
const seconds = Math.floor(milliseconds / 1000);
|
|
28
|
-
const nanos = (milliseconds % 1000) * 1000000;
|
|
29
|
-
return new Timestamp(seconds, nanos);
|
|
30
|
-
}
|
|
31
|
-
static fromMillis(milliseconds) {
|
|
32
|
-
const seconds = Math.floor(milliseconds / 1000);
|
|
33
|
-
const nanos = (milliseconds % 1000) * 1000000;
|
|
34
|
-
return new Timestamp(seconds, nanos);
|
|
35
|
-
}
|
|
36
|
-
toDate() {
|
|
37
|
-
return new Date(this.toMillis());
|
|
38
|
-
}
|
|
39
|
-
toMillis() {
|
|
40
|
-
return this.seconds * 1000 + this.nanoseconds / 1000000;
|
|
41
|
-
}
|
|
42
|
-
_compareTo(other) {
|
|
43
|
-
if (this.seconds < other.seconds)
|
|
44
|
-
return -1;
|
|
45
|
-
if (this.seconds > other.seconds)
|
|
46
|
-
return 1;
|
|
47
|
-
if (this.nanoseconds < other.nanoseconds)
|
|
48
|
-
return -1;
|
|
49
|
-
if (this.nanoseconds > other.nanoseconds)
|
|
50
|
-
return 1;
|
|
51
|
-
return 0;
|
|
52
|
-
}
|
|
53
|
-
isEqual(other) {
|
|
54
|
-
return this.seconds === other.seconds && this.nanoseconds === other.nanoseconds;
|
|
55
|
-
}
|
|
56
|
-
toString() {
|
|
57
|
-
return `Timestamp(seconds=${this.seconds}, nanoseconds=${this.nanoseconds})`;
|
|
58
|
-
}
|
|
59
|
-
toJSON() {
|
|
60
|
-
return {
|
|
61
|
-
seconds: this.seconds,
|
|
62
|
-
nanoseconds: this.nanoseconds,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Represents a geographical point
|
|
68
|
-
*/
|
|
69
|
-
export class GeoPoint {
|
|
70
|
-
latitude;
|
|
71
|
-
longitude;
|
|
72
|
-
constructor(latitude, longitude) {
|
|
73
|
-
if (typeof latitude !== 'number' || latitude < -90 || latitude > 90) {
|
|
74
|
-
throw createFirebaseError('firestore/invalid-argument', 'Latitude must be between -90 and 90, got: ' + latitude);
|
|
75
|
-
}
|
|
76
|
-
if (typeof longitude !== 'number' || longitude < -180 || longitude > 180) {
|
|
77
|
-
throw createFirebaseError('firestore/invalid-argument', 'Longitude must be between -180 and 180, got: ' + longitude);
|
|
78
|
-
}
|
|
79
|
-
this.latitude = latitude;
|
|
80
|
-
this.longitude = longitude;
|
|
81
|
-
}
|
|
82
|
-
isEqual(other) {
|
|
83
|
-
return this.latitude === other.latitude && this.longitude === other.longitude;
|
|
84
|
-
}
|
|
85
|
-
toString() {
|
|
86
|
-
return `GeoPoint(latitude=${this.latitude}, longitude=${this.longitude})`;
|
|
87
|
-
}
|
|
88
|
-
toJSON() {
|
|
89
|
-
return {
|
|
90
|
-
latitude: this.latitude,
|
|
91
|
-
longitude: this.longitude,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Represents a field value
|
|
97
|
-
*/
|
|
98
|
-
export class FieldValue {
|
|
99
|
-
_type;
|
|
100
|
-
constructor(type) {
|
|
101
|
-
this._type = type;
|
|
102
|
-
}
|
|
103
|
-
_serialize() {
|
|
104
|
-
throw new Error('FieldValue._serialize() must be implemented by subclass');
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Sentinel value indicating server timestamp
|
|
109
|
-
*/
|
|
110
|
-
export class ServerTimestamp extends FieldValue {
|
|
111
|
-
constructor() {
|
|
112
|
-
super('serverTimestamp');
|
|
113
|
-
}
|
|
114
|
-
_serialize() {
|
|
115
|
-
return {
|
|
116
|
-
__type: 'serverTimestamp',
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Sentinel value for delete field
|
|
122
|
-
*/
|
|
123
|
-
export class DeleteField extends FieldValue {
|
|
124
|
-
constructor() {
|
|
125
|
-
super('deleteField');
|
|
126
|
-
}
|
|
127
|
-
_serialize() {
|
|
128
|
-
return {
|
|
129
|
-
__type: 'deleteField',
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Sentinel value for array union
|
|
135
|
-
*/
|
|
136
|
-
export class ArrayUnion extends FieldValue {
|
|
137
|
-
elements;
|
|
138
|
-
constructor(elements) {
|
|
139
|
-
super('arrayUnion');
|
|
140
|
-
this.elements = elements;
|
|
141
|
-
}
|
|
142
|
-
_serialize() {
|
|
143
|
-
return {
|
|
144
|
-
__type: 'arrayUnion',
|
|
145
|
-
elements: this.elements,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Sentinel value for array remove
|
|
151
|
-
*/
|
|
152
|
-
export class ArrayRemove extends FieldValue {
|
|
153
|
-
elements;
|
|
154
|
-
constructor(elements) {
|
|
155
|
-
super('arrayRemove');
|
|
156
|
-
this.elements = elements;
|
|
157
|
-
}
|
|
158
|
-
_serialize() {
|
|
159
|
-
return {
|
|
160
|
-
__type: 'arrayRemove',
|
|
161
|
-
elements: this.elements,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Sentinel value for numeric increment
|
|
167
|
-
*/
|
|
168
|
-
export class Increment extends FieldValue {
|
|
169
|
-
operand;
|
|
170
|
-
constructor(operand) {
|
|
171
|
-
super('increment');
|
|
172
|
-
if (typeof operand !== 'number') {
|
|
173
|
-
throw createFirebaseError('firestore/invalid-argument', 'Increment operand must be a number');
|
|
174
|
-
}
|
|
175
|
-
this.operand = operand;
|
|
176
|
-
}
|
|
177
|
-
get delta() {
|
|
178
|
-
return this.operand;
|
|
179
|
-
}
|
|
180
|
-
_serialize() {
|
|
181
|
-
return {
|
|
182
|
-
__type: 'increment',
|
|
183
|
-
operand: this.operand,
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
// Public factory functions
|
|
188
|
-
export function serverTimestamp() {
|
|
189
|
-
return new ServerTimestamp();
|
|
190
|
-
}
|
|
191
|
-
export function deleteField() {
|
|
192
|
-
return new DeleteField();
|
|
193
|
-
}
|
|
194
|
-
export function arrayUnion(elements) {
|
|
195
|
-
return new ArrayUnion(elements);
|
|
196
|
-
}
|
|
197
|
-
export function arrayRemove(elements) {
|
|
198
|
-
return new ArrayRemove(elements);
|
|
199
|
-
}
|
|
200
|
-
export function increment(delta) {
|
|
201
|
-
return new Increment(delta);
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Test if a value is a field value sentinel
|
|
205
|
-
*/
|
|
206
|
-
export function isFieldValue(value) {
|
|
207
|
-
return value instanceof FieldValue;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Serialize field values for storage
|
|
211
|
-
*/
|
|
212
|
-
export function serializeFieldValue(value) {
|
|
213
|
-
if (value === null || value === undefined) {
|
|
214
|
-
return value;
|
|
215
|
-
}
|
|
216
|
-
// Handle -0 specially to preserve it
|
|
217
|
-
if (typeof value === 'number' && Object.is(value, -0)) {
|
|
218
|
-
return -0;
|
|
219
|
-
}
|
|
220
|
-
if (isFieldValue(value)) {
|
|
221
|
-
return value._serialize();
|
|
222
|
-
}
|
|
223
|
-
if (value instanceof Timestamp) {
|
|
224
|
-
return value.toJSON();
|
|
225
|
-
}
|
|
226
|
-
if (value instanceof Date) {
|
|
227
|
-
return Timestamp.fromDate(value).toJSON();
|
|
228
|
-
}
|
|
229
|
-
if (value instanceof Array) {
|
|
230
|
-
return value.map(v => serializeFieldValue(v));
|
|
231
|
-
}
|
|
232
|
-
if (value && typeof value === 'object') {
|
|
233
|
-
const result = {};
|
|
234
|
-
for (const [key, val] of Object.entries(value)) {
|
|
235
|
-
result[key] = serializeFieldValue(val);
|
|
236
|
-
}
|
|
237
|
-
return result;
|
|
238
|
-
}
|
|
239
|
-
return value;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Deserialize field values from storage
|
|
243
|
-
*/
|
|
244
|
-
export function deserializeFieldValue(value) {
|
|
245
|
-
if (value === null || value === undefined) {
|
|
246
|
-
return value;
|
|
247
|
-
}
|
|
248
|
-
// Handle serialized Timestamp objects
|
|
249
|
-
if (typeof value === 'object' && value !== null &&
|
|
250
|
-
typeof value.seconds === 'number' &&
|
|
251
|
-
typeof value.nanoseconds === 'number' &&
|
|
252
|
-
!value.__type) { // Not a field value
|
|
253
|
-
return new Timestamp(value.seconds, value.nanoseconds);
|
|
254
|
-
}
|
|
255
|
-
if (typeof value === 'object' && value.__type) {
|
|
256
|
-
switch (value.__type) {
|
|
257
|
-
case 'serverTimestamp':
|
|
258
|
-
return new Timestamp(value.seconds || 0, value.nanoseconds || 0);
|
|
259
|
-
case 'deleteField':
|
|
260
|
-
return deleteField();
|
|
261
|
-
case 'arrayUnion':
|
|
262
|
-
return new ArrayUnion(value.elements || []);
|
|
263
|
-
case 'arrayRemove':
|
|
264
|
-
return new ArrayRemove(value.elements || []);
|
|
265
|
-
case 'increment':
|
|
266
|
-
return new Increment(value.operand || 0);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
if (value instanceof Array) {
|
|
270
|
-
return value.map(v => deserializeFieldValue(v));
|
|
271
|
-
}
|
|
272
|
-
if (value && typeof value === 'object') {
|
|
273
|
-
const result = {};
|
|
274
|
-
for (const [key, val] of Object.entries(value)) {
|
|
275
|
-
result[key] = deserializeFieldValue(val);
|
|
276
|
-
}
|
|
277
|
-
return result;
|
|
278
|
-
}
|
|
279
|
-
return value;
|
|
280
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Firebase Firestore compatibility layer
|
|
3
|
-
*/
|
|
4
|
-
export { collection, doc, query, where, orderBy, limit, limitToLast, startAt, startAfter, endAt, endBefore, offset, FieldPathClass, QueryImpl, DocumentReferenceImpl, CollectionReferenceImpl, compileQuery, } from './query.js';
|
|
5
|
-
export { Timestamp, GeoPoint, FieldValue, serverTimestamp, deleteField, arrayUnion, arrayRemove, increment, isFieldValue, serializeFieldValue, deserializeFieldValue, } from './data-types.js';
|
|
6
|
-
export { DocumentSnapshotImpl, QuerySnapshotImpl, getDoc, getDocs, getDocFromCache, getDocsFromCache, setDoc, updateDoc, deleteDoc, WriteBatch, writeBatch, Transaction, runTransaction, } from './operations.js';
|
|
7
|
-
export { onSnapshot, } from './listeners.js';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Firebase Firestore compatibility layer
|
|
3
|
-
*/
|
|
4
|
-
export {
|
|
5
|
-
// Query builders
|
|
6
|
-
collection, doc, query, where, orderBy, limit, limitToLast, startAt, startAfter, endAt, endBefore, offset, FieldPathClass, QueryImpl, DocumentReferenceImpl, CollectionReferenceImpl, compileQuery, } from './query.js';
|
|
7
|
-
export {
|
|
8
|
-
// Data types
|
|
9
|
-
Timestamp, GeoPoint, FieldValue, serverTimestamp, deleteField, arrayUnion, arrayRemove, increment, isFieldValue, serializeFieldValue, deserializeFieldValue, } from './data-types.js';
|
|
10
|
-
export {
|
|
11
|
-
// Operations
|
|
12
|
-
DocumentSnapshotImpl, QuerySnapshotImpl, getDoc, getDocs, getDocFromCache, getDocsFromCache, setDoc, updateDoc, deleteDoc, WriteBatch, writeBatch, Transaction, runTransaction, } from './operations.js';
|
|
13
|
-
export { onSnapshot, } from './listeners.js';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Real-time listeners for Firestore and Realtime Database
|
|
3
|
-
*/
|
|
4
|
-
import type { Query, DocumentReference, QuerySnapshot, DocumentSnapshot, DataSnapshot, DatabaseReference } from '../types.js';
|
|
5
|
-
export type UnsubscribeFn = () => void;
|
|
6
|
-
export type OnSnapshotCallback<T> = {
|
|
7
|
-
next?: (snapshot: T) => void;
|
|
8
|
-
error?: (error: Error) => void;
|
|
9
|
-
complete?: () => void;
|
|
10
|
-
} | ((snapshot: T) => void);
|
|
11
|
-
export type OnErrorCallback = (error: Error) => void;
|
|
12
|
-
export type OnCompleteCallback = () => void;
|
|
13
|
-
/**
|
|
14
|
-
* Firestore listener for documents
|
|
15
|
-
*/
|
|
16
|
-
export declare function onSnapshot<T = any>(reference: DocumentReference<T> | Query<T>, callback: OnSnapshotCallback<DocumentSnapshot<T> | QuerySnapshot<T>>, error?: OnErrorCallback, complete?: OnCompleteCallback): UnsubscribeFn;
|
|
17
|
-
/**
|
|
18
|
-
* Realtime Database listener for values
|
|
19
|
-
*/
|
|
20
|
-
export declare function onValue(reference: DatabaseReference, callback: (snapshot: DataSnapshot) => void, error?: (error: Error) => void, complete?: () => void): UnsubscribeFn;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Real-time listeners for Firestore and Realtime Database
|
|
3
|
-
*/
|
|
4
|
-
import { DocumentReferenceImpl } from './query.js';
|
|
5
|
-
import { DocumentSnapshotImpl } from './operations.js';
|
|
6
|
-
/**
|
|
7
|
-
* Firestore listener for documents
|
|
8
|
-
*/
|
|
9
|
-
export function onSnapshot(reference, callback, error, complete) {
|
|
10
|
-
// Mock mode for tests
|
|
11
|
-
const key = reference instanceof DocumentReferenceImpl ? `doc:${reference.path}` : `query:${reference.toString()}`;
|
|
12
|
-
const mockListeners = globalThis.mockListeners;
|
|
13
|
-
if (!mockListeners.has(key)) {
|
|
14
|
-
mockListeners.set(key, new Set());
|
|
15
|
-
}
|
|
16
|
-
mockListeners.get(key).add(callback);
|
|
17
|
-
// Initial call with empty snapshot
|
|
18
|
-
const initialSnapshot = reference instanceof DocumentReferenceImpl
|
|
19
|
-
? new DocumentSnapshotImpl(reference.firestore, reference, {}, { hasPendingWrites: false, fromCache: false })
|
|
20
|
-
: {
|
|
21
|
-
docs: [],
|
|
22
|
-
size: 0,
|
|
23
|
-
empty: true,
|
|
24
|
-
metadata: { hasPendingWrites: false, fromCache: false },
|
|
25
|
-
forEach: () => { },
|
|
26
|
-
};
|
|
27
|
-
if (typeof callback === 'function') {
|
|
28
|
-
callback(initialSnapshot);
|
|
29
|
-
}
|
|
30
|
-
else if (callback && typeof callback.next === 'function') {
|
|
31
|
-
callback.next(initialSnapshot);
|
|
32
|
-
} // Enable initial call
|
|
33
|
-
// Return unsubscribe
|
|
34
|
-
return () => {
|
|
35
|
-
const listeners = mockListeners.get(key);
|
|
36
|
-
if (listeners) {
|
|
37
|
-
listeners.delete(callback);
|
|
38
|
-
if (listeners.size === 0) {
|
|
39
|
-
mockListeners.delete(key);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Realtime Database listener for values
|
|
46
|
-
*/
|
|
47
|
-
export function onValue(reference, callback, error, complete) {
|
|
48
|
-
// Mock for tests
|
|
49
|
-
return () => { };
|
|
50
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Firestore document operations (read/write)
|
|
3
|
-
*/
|
|
4
|
-
import type { DocumentSnapshot, QuerySnapshot, IDocumentSnapshot, IQuerySnapshot, DocumentChange, SnapshotOptions, Firestore, DocumentData, DocumentReference, Query, SnapshotMetadata } from '../types.js';
|
|
5
|
-
export declare const mockListeners: Map<string, Set<Function>>;
|
|
6
|
-
export declare function triggerMockListeners(key: string, snapshot: any): void;
|
|
7
|
-
/**
|
|
8
|
-
* Document snapshot implementation
|
|
9
|
-
*/
|
|
10
|
-
export declare class DocumentSnapshotImpl<T = DocumentData> implements IDocumentSnapshot<T> {
|
|
11
|
-
_firestore: Firestore;
|
|
12
|
-
_userDataWriter: any;
|
|
13
|
-
_doc: any;
|
|
14
|
-
ref: DocumentReference<T>;
|
|
15
|
-
readonly metadata: SnapshotMetadata;
|
|
16
|
-
constructor(firestore: Firestore, ref: DocumentReference<T>, data: T | null, metadata: SnapshotMetadata);
|
|
17
|
-
get id(): string;
|
|
18
|
-
exists(): boolean;
|
|
19
|
-
data(options?: SnapshotOptions): T | undefined;
|
|
20
|
-
get(fieldPath: string, options?: SnapshotOptions): any;
|
|
21
|
-
toJSON(): any;
|
|
22
|
-
private _deepFreeze;
|
|
23
|
-
private _deepCopy;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Query snapshot implementation
|
|
27
|
-
*/
|
|
28
|
-
export declare class QuerySnapshotImpl<T = DocumentData> implements IQuerySnapshot<T> {
|
|
29
|
-
_firestore: Firestore;
|
|
30
|
-
_snapshot: any;
|
|
31
|
-
query: Query<T> | any;
|
|
32
|
-
docs: DocumentSnapshotImpl<T>[];
|
|
33
|
-
size: number;
|
|
34
|
-
empty: boolean;
|
|
35
|
-
metadata: SnapshotMetadata;
|
|
36
|
-
_docChanges: DocumentChange<T>[] | null;
|
|
37
|
-
constructor(firestore: Firestore, query: Query<T> | any, docs: DocumentSnapshotImpl<T>[], metadata: SnapshotMetadata);
|
|
38
|
-
docChanges(): DocumentChange<T>[];
|
|
39
|
-
forEach(callback: (doc: DocumentSnapshotImpl<T>) => void): void;
|
|
40
|
-
toJSON(): any[];
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Get a single document snapshot
|
|
44
|
-
*/
|
|
45
|
-
export declare function getDoc(reference: DocumentReference<any>, engine?: any): Promise<IDocumentSnapshot>;
|
|
46
|
-
/**
|
|
47
|
-
* Get multiple documents from a query
|
|
48
|
-
*/
|
|
49
|
-
export declare function getDocs(q: Query<any>, engine?: any): Promise<IQuerySnapshot>;
|
|
50
|
-
/**
|
|
51
|
-
* Get document from local cache
|
|
52
|
-
*/
|
|
53
|
-
export declare function getDocFromCache(reference: DocumentReference<any>, cache?: Map<string, any>): Promise<IDocumentSnapshot>;
|
|
54
|
-
/**
|
|
55
|
-
* Get documents from local cache
|
|
56
|
-
*/
|
|
57
|
-
export declare function getDocsFromCache(q: Query<any>, cache?: Map<string, any>): Promise<IQuerySnapshot>;
|
|
58
|
-
/**
|
|
59
|
-
* Set document data (write)
|
|
60
|
-
*/
|
|
61
|
-
export declare function setDoc(reference: DocumentReference<any>, data: any, options?: {
|
|
62
|
-
merge?: boolean;
|
|
63
|
-
}, engine?: any): Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Update document data (partial write)
|
|
66
|
-
*/
|
|
67
|
-
export declare function updateDoc(reference: DocumentReference<any>, data: any, engine?: any): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Delete document
|
|
70
|
-
*/
|
|
71
|
-
export declare function deleteDoc(reference: DocumentReference<any>, engine?: any): Promise<void>;
|
|
72
|
-
/**
|
|
73
|
-
* Batch write operations
|
|
74
|
-
*/
|
|
75
|
-
export declare class WriteBatch {
|
|
76
|
-
_firestore: Firestore;
|
|
77
|
-
_engine: any;
|
|
78
|
-
_writes: Array<{
|
|
79
|
-
type: string;
|
|
80
|
-
ref: any;
|
|
81
|
-
data: any;
|
|
82
|
-
options?: any;
|
|
83
|
-
}>;
|
|
84
|
-
constructor(firestore: Firestore, engine: any);
|
|
85
|
-
set(reference: DocumentReference<any>, data: any, options?: {
|
|
86
|
-
merge?: boolean;
|
|
87
|
-
}): WriteBatch;
|
|
88
|
-
update(reference: DocumentReference<any>, data: any): WriteBatch;
|
|
89
|
-
delete(reference: DocumentReference<any>): WriteBatch;
|
|
90
|
-
commit(): Promise<void>;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Create a write batch
|
|
94
|
-
*/
|
|
95
|
-
export declare function writeBatch(firestore: Firestore, engine?: any): WriteBatch;
|
|
96
|
-
/**
|
|
97
|
-
* Run a transaction
|
|
98
|
-
*/
|
|
99
|
-
export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, engine?: any): Promise<T>;
|
|
100
|
-
/**
|
|
101
|
-
* Transaction object for transactional reads and writes
|
|
102
|
-
*/
|
|
103
|
-
export declare class Transaction {
|
|
104
|
-
_firestore: Firestore;
|
|
105
|
-
_engine: any;
|
|
106
|
-
constructor(firestore: Firestore, engine: any);
|
|
107
|
-
get(reference: DocumentReference<any>): Promise<IDocumentSnapshot>;
|
|
108
|
-
set(reference: DocumentReference<any>, data: any, options?: {
|
|
109
|
-
merge?: boolean;
|
|
110
|
-
}): Promise<void>;
|
|
111
|
-
update(reference: DocumentReference<any>, data: any): Promise<void>;
|
|
112
|
-
delete(reference: DocumentReference<any>): Promise<void>;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Listen for document/query changes
|
|
116
|
-
*/
|
|
117
|
-
export declare function onSnapshot(reference: DocumentReference | Query, observer: {
|
|
118
|
-
next?: (snapshot: DocumentSnapshot | QuerySnapshot) => void;
|
|
119
|
-
error?: (error: Error) => void;
|
|
120
|
-
complete?: () => void;
|
|
121
|
-
} | ((snapshot: DocumentSnapshot | QuerySnapshot) => void), options?: {
|
|
122
|
-
includeMetadataChanges?: boolean;
|
|
123
|
-
}): () => void;
|