@triplit/react 0.0.31 → 0.0.33

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,11 +1,5 @@
1
1
  # @triplit/react
2
2
 
3
- ## 0.0.31
4
-
5
- ### Patch Changes
6
-
7
- - @triplit/client@0.0.31
8
-
9
3
  ## 0.0.30
10
4
 
11
5
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,586 +1,10 @@
1
- import { KeyValuePair, ScanStorageArgs, TupleStorageApi, WriteOps, AsyncTupleStorageApi, Callback, ScanArgs, Tuple, AsyncTupleDatabaseClient, AsyncTupleRootTransactionApi, Unsubscribe } from "tuple-database";
2
- import BTree from "sorted-btree";
3
- import { Static, TBoolean, TNumber, TObject, TRecord, TSchema, TString, TTuple } from "@sinclair/typebox";
4
- import { TuplePrefix, TupleToObject, RemoveTupleValuePairPrefix } from "tuple-database/database/typeHelpers";
5
- declare class MemoryBTree implements TupleStorageApi {
6
- btree: BTree<any, any>;
7
- constructor();
8
- scan(args?: ScanStorageArgs | undefined): KeyValuePair[];
9
- commit(writes: WriteOps<KeyValuePair>): void;
10
- close(): void;
11
- wipe(): void;
12
- }
13
- declare class CachedIndexedDbStorage implements AsyncTupleStorageApi {
14
- dbName: string;
15
- constructor(dbName: string);
16
- scan(args?: ScanStorageArgs | undefined): Promise<KeyValuePair[]>;
17
- commit(writes: WriteOps<KeyValuePair>): Promise<void>;
18
- close(): Promise<void>;
19
- }
20
- type Timestamp = [sequence: number, client: string];
21
- declare const _Timestamp1: import("@sinclair/typebox").TReadonly<TTuple<[TNumber, TString<string>]>>;
22
- type TimestampType = Static<typeof _Timestamp1>;
23
- type RegisterBaseType = TNumber | TBoolean | TString;
24
- type RegisterTypeFromBaseType<T extends RegisterBaseType> = TTuple<[
25
- T,
26
- typeof _Timestamp1
27
- ]> & {
28
- 'x-crdt-type': 'Register';
29
- 'x-serialized-type': T['type'];
30
- };
31
- declare function Register<T extends RegisterBaseType>(type: T): RegisterTypeFromBaseType<T>;
32
- type ValidSetDataTypes = TNumber | TString;
33
- type SetTypeFromValidTypes<T extends ValidSetDataTypes> = TRecord<T, ReturnType<typeof Register<TBoolean>>> & {
34
- 'x-crdt-type': 'Set';
35
- 'x-serialized-type': T extends TNumber ? 'set_number' : T extends TString ? 'set_string' : never;
36
- };
37
- declare class Schema {
38
- static string: () => RegisterTypeFromBaseType<TString<string>>;
39
- static number: () => RegisterTypeFromBaseType<TNumber>;
40
- static Boolean: () => RegisterTypeFromBaseType<TBoolean>;
41
- static Record(schema: SchemaConfig): RecordType;
42
- static Set<T extends ValidSetDataTypes>(type: ReturnType<typeof Register<T>>): SetTypeFromValidTypes<T>;
43
- static Schema<Config extends SchemaConfig>(config: Config): TObject<Config>;
44
- }
45
- type RecordType = TObject<SchemaConfig>;
46
- type RegisterType = ReturnType<typeof Register<TNumber | TBoolean | TString>>;
47
- type SetType = ReturnType<typeof Schema.Set>;
48
- type DataType = RegisterType | SetType | RecordType;
49
- type SchemaConfig = Record<keyof any, DataType>;
50
- type Model<T extends SchemaConfig> = ReturnType<typeof Schema.Schema<T>>;
51
- type Collection<T extends SchemaConfig> = {
52
- attributes: Model<T>;
53
- rules?: CollectionRules<Model<T>>;
54
- };
55
- type Models<CollectionName extends string, T extends SchemaConfig> = Record<CollectionName, Collection<T>>;
56
- type ValueSerializedSchemaType = 'string' | 'number' | 'boolean';
57
- type SetSerializedSchemaType = 'set_string' | 'set_number';
58
- type SerializedSchemaType = ValueSerializedSchemaType | SetSerializedSchemaType;
59
- interface SetProxy<T> {
60
- add: (value: T) => void;
61
- remove: (value: T) => void;
62
- has: (value: T) => boolean;
63
- }
64
- type ProxyType<T extends TSchema & {
65
- 'x-serialized-type': SerializedSchemaType;
66
- }> = T['x-serialized-type'] extends 'set_string' ? SetProxy<string> : T['x-serialized-type'] extends 'set_number' ? SetProxy<number> : Static<T> extends [infer U, TimestampType] ? U : never;
67
- type ProxySchema<T extends ReturnType<typeof Schema.Schema>> = {
68
- [k in keyof T['properties']]: k extends string ? ProxyType<T['properties'][k]> : never;
69
- };
70
- type ProxyTypeFromModel<T extends Model<any> | undefined> = T extends Model<any> ? ProxySchema<T> : any;
71
- type TypeFromModel<T extends TSchema> = Static<T>;
72
- type JSONTypeFromModel<T extends Model<any> | undefined> = T extends Model<any> ? UnTimestampedObject<Static<T>> : any;
73
- type TimestampedObject = {
74
- [key: string | number]: [value: any, timestamp: TimestampType] | TimestampedObject;
75
- };
76
- type UnTimestampedObject<T extends TimestampedObject> = {
77
- [k in keyof T]: T[k] extends TimestampedObject ? UnTimestampedObject<T[k]> : T[k] extends [value: infer V, timestamp: TimestampType] ? V : never;
78
- };
79
- type StorageScope = {
80
- read?: string[];
81
- write?: string[];
82
- };
83
- type TransactionScope<TupleSchema extends KeyValuePair> = {
84
- read: AsyncTupleRootTransactionApi<TupleSchema>[];
85
- write: AsyncTupleRootTransactionApi<TupleSchema>[];
86
- };
87
- declare class MultiTupleStore<TupleSchema extends KeyValuePair> {
88
- readonly storageScope?: StorageScope;
89
- storage: Record<string, AsyncTupleDatabaseClient<TupleSchema>>;
90
- constructor({ storage, storageScope, }: {
91
- storage: Record<string, AsyncTupleDatabaseClient<TupleSchema>>;
92
- storageScope?: {
93
- read?: string[];
94
- write?: string[];
95
- };
96
- });
97
- getStorageClients(context?: 'read' | 'write'): AsyncTupleDatabaseClient<TupleSchema>[];
98
- scan<T extends Tuple, P extends TuplePrefix<T>>(args?: ScanArgs<T, P> | undefined, txId?: string | undefined): Promise<Extract<TupleSchema, {
99
- key: TupleToObject<P>;
100
- }>[]>;
101
- subscribe<T extends Tuple, P extends TuplePrefix<T>>(args: ScanArgs<T, P>, callback: Callback<Extract<TupleSchema, {
102
- key: TupleToObject<P>;
103
- }>>): Unsubscribe;
104
- exists<T extends Tuple>(tuple: T, txId?: string | undefined): Promise<boolean>;
105
- subspace<P extends TuplePrefix<TupleSchema['key']>>(prefix: P): MultiTupleStore<RemoveTupleValuePairPrefix<TupleSchema, P>>;
106
- transact(scope?: StorageScope): MultiTupleTransaction<TupleSchema>;
107
- autoTransact<T>(callback: (tx: MultiTupleTransaction<TupleSchema>) => Promise<T>, scope: StorageScope | undefined): Promise<T>;
108
- clear(): Promise<void>;
109
- close(): void;
110
- }
111
- declare class ScopedMultiTupleOperator<TupleSchema extends KeyValuePair> {
112
- readonly txScope: TransactionScope<TupleSchema>;
113
- constructor({ txScope }: {
114
- txScope: TransactionScope<TupleSchema>;
115
- });
116
- scan<T extends Tuple, P extends TuplePrefix<T>>(args?: ScanArgs<T, P> | undefined): Promise<TupleSchema[]>;
117
- exists<T extends Tuple>(tuple: T): Promise<boolean>;
118
- remove(tuple: Tuple): void;
119
- set<Key extends Tuple>(tuple: Key, value: Extract<TupleSchema, {
120
- key: TupleToObject<Key>;
121
- }> extends unknown ? Extract<TupleSchema, {
122
- key: TupleToObject<Key>;
123
- }>['value'] : never): void;
124
- }
125
- declare class MultiTupleTransaction<TupleSchema extends KeyValuePair> extends ScopedMultiTupleOperator<TupleSchema> {
126
- readonly txs: Record<string, AsyncTupleRootTransactionApi<TupleSchema>>;
127
- readonly store: MultiTupleStore<TupleSchema>;
128
- isCanceled: boolean;
129
- constructor({ store, scope, }: {
130
- store: MultiTupleStore<TupleSchema>;
131
- scope?: StorageScope;
132
- });
133
- withScope(scope: StorageScope): ScopedMultiTupleOperator<TupleSchema>;
134
- commit(): Promise<void>;
135
- cancel(): Promise<void>;
136
- }
137
- interface Clock {
138
- assignToStore(store: TripleStore): Promise<void>;
139
- getCurrentTimestamp(): Promise<Timestamp>;
140
- getNextTimestamp(): Promise<Timestamp>;
141
- setTick(tick: number): Promise<void>;
142
- }
143
- type Path = string;
144
- type Value = any;
145
- type Operator = '=' | '<' | '>' | '<=' | '>=' | '!=' | 'like' | 'nlike';
146
- type FilterStatement<M extends Model<any> | undefined> = [
147
- M extends Model<any> ? keyof M['properties'] : Path,
148
- Operator,
149
- Value
150
- ];
151
- type FilterGroup<M extends Model<any> | undefined> = {
152
- mod: 'or' | 'and';
153
- filters: WhereFilter<M>[];
154
- };
155
- type WhereFilter<M extends Model<any> | undefined> = FilterStatement<M> | FilterGroup<M>;
156
- type QueryWhere<M extends Model<any> | undefined> = WhereFilter<M>[];
157
- type ValueCursor = [value: Value, entityId: EntityId];
158
- interface Query<M extends Model<any> | undefined> {
159
- where: QueryWhere<M>;
160
- select: (M extends Model<any> ? keyof M['properties'] : Path)[];
161
- order?: [
162
- property: M extends Model<any> ? keyof M['properties'] : Path,
163
- direction: 'ASC' | 'DESC'
164
- ];
165
- limit?: number;
166
- after?: ValueCursor;
167
- entityId?: string;
168
- vars?: Record<string, any>;
169
- }
170
- type StoreSchema<M extends Models<any, any> | undefined> = M extends Models<any, any> ? {
171
- version: number;
172
- collections: M;
173
- } : M extends undefined ? undefined : never;
174
- type _Value1 = number | string | boolean | null;
175
- type EntityId = string;
176
- type AttributeItem = string | number;
177
- type Attribute = AttributeItem[];
178
- type Expired = boolean;
179
- type TenantId = string;
180
- type EAV = [EntityId, Attribute, _Value1];
181
- type TripleRow = {
182
- id: EntityId;
183
- attribute: Attribute;
184
- value: _Value1;
185
- timestamp: Timestamp;
186
- expired: Expired;
187
- };
188
- type TripleMetadata = {
189
- expired: Expired;
190
- };
191
- type EAVIndex = {
192
- key: ['EAV', EntityId, Attribute, _Value1, Timestamp];
193
- value: TripleMetadata;
194
- };
195
- type AVEIndex = {
196
- key: ['AVE', Attribute, _Value1, EntityId, Timestamp];
197
- value: TripleMetadata;
198
- };
199
- type VAEIndex = {
200
- key: ['VAE', _Value1, Attribute, EntityId, Timestamp];
201
- value: TripleMetadata;
202
- };
203
- type ClientTimestampIndex = {
204
- key: ['clientTimestamp', string, Timestamp, EntityId, Attribute, _Value1];
205
- value: TripleMetadata;
206
- };
207
- type MetadataIndex = {
208
- key: ['metadata', EntityId, ...Attribute];
209
- value: any;
210
- };
211
- type WithTenantIdPrefix<T extends KeyValuePair> = {
212
- key: [TenantId, ...T['key']];
213
- value: T['value'];
214
- };
215
- type TripleIndex = EAVIndex | AVEIndex | VAEIndex | ClientTimestampIndex;
216
- type TupleIndex = TripleIndex | MetadataIndex;
217
- interface TripleStoreApi {
218
- insertTriple(tripleRow: TripleRow): void;
219
- insertTriples(triplesInput: TripleRow[]): void;
220
- deleteTriple(tripleRow: TripleRow): void;
221
- deleteTriples(triplesInput: TripleRow[]): void;
222
- setValue(...triple: EAV): void;
223
- findByCollection(collection: string, direction?: 'ASC' | 'DESC'): Promise<TripleRow[]>;
224
- findMaxTimestamp(clientId: string): Promise<Timestamp | undefined>;
225
- findByClientTimestamp(clientId: string, scanDirection: 'lt' | 'lte' | 'gt' | 'gte', timestamp: Timestamp | undefined): Promise<TripleRow[]>;
226
- findByEAV([entityId, attribute, value]: [
227
- entityId?: EntityId,
228
- attribute?: Attribute,
229
- value?: _Value1
230
- ], direction?: 'ASC' | 'DESC'): Promise<TripleRow[]>;
231
- findByAVE([attribute, value, entityId]: [
232
- attribute?: Attribute,
233
- value?: _Value1,
234
- entityId?: EntityId
235
- ], direction?: 'ASC' | 'DESC'): Promise<TripleRow[]>;
236
- findByEntity(id?: EntityId): Promise<TripleRow[]>;
237
- findByEntityAttribute(id: EntityId, attribute: Attribute): Promise<TripleRow[]>;
238
- findByAttribute(attribute: Attribute): Promise<TripleRow[]>;
239
- readMetadataTuples(entityId: string, attribute?: Attribute): Promise<EAV[]>;
240
- updateMetadataTuples(updates: EAV[]): Promise<void>;
241
- deleteMetadataTuples(deletes: [entityId: string, attribute?: Attribute][]): Promise<void>;
242
- readSchema(): Promise<StoreSchema<Models<any, any>> | undefined>;
243
- }
244
- type MetadataListener = (changes: {
245
- updates: EAV[];
246
- deletes: [entityId: string, attribute?: Attribute][];
247
- }) => void | Promise<void>;
248
- declare class TripleStoreOperator implements TripleStoreApi {
249
- tupleOperator: ScopedMultiTupleOperator<TupleIndex>;
250
- schema?: StoreSchema<Models<any, any>>;
251
- readonly clock: Clock;
252
- assignedTimestamp?: Timestamp;
253
- constructor({ tupleOperator, schema, clock, }: {
254
- tupleOperator: ScopedMultiTupleOperator<TupleIndex>;
255
- clock: Clock;
256
- schema?: StoreSchema<Models<any, any>>;
257
- });
258
- readSchema(): Promise<{
259
- version: number;
260
- collections: Models<any, any>;
261
- } | undefined>;
262
- getTransactionTimestamp(): Promise<Timestamp>;
263
- findByCollection(collection: string, direction?: 'ASC' | 'DESC' | undefined): Promise<TripleRow[]>;
264
- findValuesInRange(attribute: Attribute, constraints: {
265
- greaterThan?: ValueCursor;
266
- lessThan?: ValueCursor;
267
- direction?: 'ASC' | 'DESC';
268
- } | undefined): Promise<TripleRow[]>;
269
- findByEAV(tupleArgs: [
270
- entityId?: string | undefined,
271
- attribute?: Attribute | undefined,
272
- value?: _Value1 | undefined
273
- ], direction?: 'ASC' | 'DESC' | undefined): Promise<TripleRow[]>;
274
- findByAVE(tupleArgs: [
275
- attribute?: Attribute | undefined,
276
- value?: _Value1 | undefined,
277
- entityId?: string | undefined
278
- ], direction?: 'ASC' | 'DESC' | undefined): Promise<TripleRow[]>;
279
- findByEntity(id?: string | undefined): Promise<TripleRow[]>;
280
- findByEntityAttribute(id: string, attribute: Attribute): Promise<TripleRow[]>;
281
- findByAttribute(attribute: Attribute): Promise<TripleRow[]>;
282
- getEntity(entityId: string): Promise<{} | null>;
283
- getEntities(collectionName: string): Promise<Map<any, any>>;
284
- findMaxTimestamp(clientId: string): Promise<Timestamp | undefined>;
285
- findByClientTimestamp(clientId: string, scanDirection: 'lt' | 'lte' | 'gt' | 'gte' | 'eq', timestamp: Timestamp | undefined): Promise<TripleRow[]>;
286
- insertTriple(tripleRow: TripleRow): Promise<void>;
287
- insertTriples(triplesInput: TripleRow[]): Promise<void>;
288
- deleteTriple(trip: TripleRow): Promise<void>;
289
- deleteTriples(triples: TripleRow[]): Promise<void>;
290
- readMetadataTuples(entityId: string, attribute?: Attribute): Promise<EAV[]>;
291
- updateMetadataTuples(updates: EAV[]): Promise<void>;
292
- deleteMetadataTuples(deletes: [entityId: string, attribute?: Attribute][]): Promise<void>;
293
- onMetadataChange(callback: MetadataListener): () => void;
294
- setValue(id: EntityId, attribute: Attribute, value: _Value1): Promise<void>;
295
- }
296
- declare class TripleStoreTransaction extends TripleStoreOperator {
297
- tupleTx: MultiTupleTransaction<TupleIndex>;
298
- constructor({ tupleTx, clock, schema, }: {
299
- tupleTx: MultiTupleTransaction<TupleIndex>;
300
- clock: Clock;
301
- schema?: StoreSchema<Models<any, any>>;
302
- });
303
- commit(): Promise<void>;
304
- cancel(): Promise<void>;
305
- withScope(scope: StorageScope): TripleStoreOperator;
306
- }
307
- declare class TripleStore implements TripleStoreApi {
308
- stores: Record<string, AsyncTupleDatabaseClient<WithTenantIdPrefix<TupleIndex>>>;
309
- storageScope: string[];
310
- tupleStore: MultiTupleStore<TupleIndex>;
311
- clock: Clock;
312
- tenantId: string;
313
- ensureInitializedSchema: Promise<void>;
314
- constructor({ storage, stores, tenantId, schema, clock, storageScope, }: {
315
- storage?: (TupleStorageApi | AsyncTupleStorageApi) | Record<string, TupleStorageApi | AsyncTupleStorageApi>;
316
- stores?: Record<string, AsyncTupleDatabaseClient<WithTenantIdPrefix<TupleIndex>>>;
317
- tenantId?: string;
318
- schema?: StoreSchema<Models<any, any>>;
319
- storageScope?: string[];
320
- clock?: Clock;
321
- });
322
- findByCollection(collection: string, direction?: 'ASC' | 'DESC' | undefined): Promise<TripleRow[]>;
323
- findValuesInRange(attribute: Attribute, constraints: {
324
- greaterThan?: ValueCursor;
325
- lessThan?: ValueCursor;
326
- direction?: 'ASC' | 'DESC';
327
- } | undefined): Promise<TripleRow[]>;
328
- findByEAV([entityId, attribute, value]: [
329
- entityId?: string | undefined,
330
- attribute?: Attribute | undefined,
331
- value?: _Value1 | undefined
332
- ], direction?: 'ASC' | 'DESC' | undefined): Promise<TripleRow[]>;
333
- findByAVE([attribute, value, entityId]: [
334
- attribute?: Attribute | undefined,
335
- value?: _Value1 | undefined,
336
- entityId?: string | undefined
337
- ], direction?: 'ASC' | 'DESC' | undefined): Promise<TripleRow[]>;
338
- findByEntity(id?: string | undefined): Promise<TripleRow[]>;
339
- findByEntityAttribute(id: string, attribute: Attribute): Promise<TripleRow[]>;
340
- findByAttribute(attribute: Attribute): Promise<TripleRow[]>;
341
- getEntity(entityId: string): Promise<{} | null>;
342
- getEntities(collectionName: string): Promise<Map<any, any>>;
343
- findMaxTimestamp(clientId: string): Promise<Timestamp | undefined>;
344
- findByClientTimestamp(clientId: string, scanDirection: 'lt' | 'lte' | 'gt' | 'gte' | 'eq', timestamp: Timestamp | undefined): Promise<TripleRow[]>;
345
- transact(callback: (tx: TripleStoreTransaction) => Promise<void>, scope?: Parameters<typeof this.tupleStore.transact>[0]): Promise<string | undefined>;
346
- setStorageScope(storageKeys: (keyof typeof this.stores)[]): TripleStore;
347
- setValue(entity: string, attribute: Attribute, value: _Value1): Promise<void>;
348
- insertTriple(tripleRow: TripleRow): Promise<void>;
349
- insertTriples(triplesInput: TripleRow[]): Promise<void>;
350
- onInsert(callback: (triples: TripleRow[]) => void): () => void;
351
- onWrite(callback: (writes: {
352
- inserts: TripleRow[];
353
- deletes: TripleRow[];
354
- }) => void): import("tuple-database").Unsubscribe;
355
- deleteTriple(triple: TripleRow): Promise<void>;
356
- deleteTriples(triples: TripleRow[]): Promise<void>;
357
- readMetadataTuples(entityId: string, attribute?: Attribute): Promise<EAV[]>;
358
- updateMetadataTuples(updates: EAV[]): Promise<void>;
359
- deleteMetadataTuples(deletes: [entityId: string, attribute?: Attribute][]): Promise<void>;
360
- readSchema(): Promise<{
361
- version: number;
362
- collections: Models<any, any>;
363
- } | undefined>;
364
- clear(): Promise<void>;
365
- }
366
- type toBuilder<T extends {}> = {
367
- [k in keyof Required<T>]: (value: T[k]) => toBuilder<T>;
368
- } & {
369
- build: () => T;
370
- };
371
- type CollectionQuery<M extends Model<any> | undefined> = Query<M> & {
372
- collectionName: string;
373
- };
374
- type FetchResult<C extends CollectionQuery<any>> = C extends CollectionQuery<infer M> ? M extends Model<any> ? Map<string, UnTimestampedObject<TypeFromModel<M>>> : M extends undefined ? Map<string, any> : never : never;
375
- declare class DBTransaction<M extends Models<any, any> | undefined> {
376
- readonly storeTx: TripleStoreTransaction;
377
- readonly variables?: Record<string, any> | undefined;
378
- constructor(storeTx: TripleStoreTransaction, variables?: Record<string, any> | undefined);
379
- getCollectionSchema<CN extends CollectionNameFromModels<M>>(collectionName: CN): Promise<CollectionFromModels<M, CN> | undefined>;
380
- getSchema(): Promise<{
381
- version: number;
382
- collections: Models<any, any>;
383
- } | undefined>;
384
- commit(): Promise<void>;
385
- cancel(): Promise<void>;
386
- insert(collectionName: CollectionNameFromModels<M>, doc: any, id?: string): Promise<void>;
387
- update<CN extends CollectionNameFromModels<M>>(collectionName: CN, entityId: string, updater: (entity: ProxyTypeFromModel<ModelFromModels<M, CN>>) => Promise<void>): Promise<void>;
388
- fetch<Q extends CollectionQuery<ModelFromModels<M>>>(query: Q): Promise<FetchResult<Q>>;
389
- fetchById(collectionName: CollectionNameFromModels<M>, id: string): Promise<{} | TypeFromModel<M[CollectionNameFromModels<M>]> | null>;
390
- createCollection(params: CreateCollectionOperation[1]): Promise<void>;
391
- dropCollection(params: DropCollectionOperation[1]): Promise<void>;
392
- renameAttribute(params: RenameAttributeOperation[1]): Promise<void>;
393
- addAttribute(params: AddAttributeOperation[1]): Promise<void>;
394
- dropAttribute(params: DropAttributeOperation[1]): Promise<void>;
395
- }
396
- type Reference = `ref:${string}`;
397
- type AttributeType = 'string' | 'number' | 'boolean' | 'set_string' | 'set_number' | 'record' | Reference;
398
- type CollectionAttribute = {
399
- type: AttributeType;
400
- };
401
- interface Rule<M extends Model<any>> {
402
- filter: QueryWhere<M>;
403
- description?: string;
404
- }
405
- interface CollectionRules<M extends Model<any>> {
406
- read?: Rule<M>[];
407
- write?: Rule<M>[];
408
- }
409
- type CreateCollectionOperation = [
410
- 'create_collection',
411
- {
412
- name: string;
413
- attributes: {
414
- [path: string]: CollectionAttribute;
415
- };
416
- rules?: CollectionRules<any>;
417
- }
418
- ];
419
- type DropCollectionOperation = ['drop_collection', {
420
- name: string;
421
- }];
422
- type AddAttributeOperation = [
423
- 'add_attribute',
424
- {
425
- collection: string;
426
- path: string;
427
- attribute: CollectionAttribute;
428
- }
429
- ];
430
- type DropAttributeOperation = [
431
- 'drop_attribute',
432
- {
433
- collection: string;
434
- path: string;
435
- }
436
- ];
437
- type RenameAttributeOperation = [
438
- 'rename_attribute',
439
- {
440
- collection: string;
441
- path: string;
442
- newPath: string;
443
- }
444
- ];
445
- type DBOperation = CreateCollectionOperation | DropCollectionOperation | AddAttributeOperation | DropAttributeOperation | RenameAttributeOperation;
446
- type Migration = {
447
- up: DBOperation[];
448
- down: DBOperation[];
449
- version: number;
450
- parent: number;
451
- };
452
- type StorageSource = AsyncTupleStorageApi;
453
- interface DBConfig<M extends Models<any, any> | undefined> {
454
- schema?: {
455
- collections: NonNullable<M>;
456
- version?: number;
457
- };
458
- migrations?: Migration[];
459
- source?: StorageSource;
460
- sources?: Record<string, StorageSource>;
461
- tenantId?: string;
462
- clock?: Clock;
463
- variables?: Record<string, any>;
464
- }
465
- type CollectionFromModels<M extends Models<any, any> | undefined, CN extends CollectionNameFromModels<M> = CollectionNameFromModels<M>> = M extends Models<any, any> ? M[CN] : M extends undefined ? undefined : never;
466
- type ModelFromModels<M extends Models<any, any> | undefined, CN extends CollectionNameFromModels<M> = CollectionNameFromModels<M>> = M extends Models<any, any> ? M[CN]['attributes'] : M extends undefined ? undefined : never;
467
- type CollectionNameFromModels<M extends Models<any, any> | undefined> = M extends Models<any, any> ? keyof M : M extends undefined ? string : never;
468
- declare class DB<M extends Models<any, any> | undefined> {
469
- tripleStore: TripleStore;
470
- ensureMigrated: Promise<void>;
471
- variables: Record<string, any>;
472
- constructor({ schema, source, sources, tenantId, migrations, clock, variables, }?: DBConfig<M>);
473
- getClientId(): Promise<string>;
474
- getSchema(): Promise<{
475
- version: number;
476
- collections: Models<any, any>;
477
- } | undefined>;
478
- getCollectionSchema<CN extends CollectionNameFromModels<M>>(collectionName: CN): Promise<CollectionFromModels<M, CN> | undefined>;
479
- static ABORT_TRANSACTION: symbol;
480
- transact(callback: (tx: DBTransaction<M>) => Promise<void>, storeScope?: {
481
- read: string[];
482
- write: string[];
483
- }): Promise<string | undefined>;
484
- updateVariables(variables: Record<string, any>): void;
485
- fetch<Q extends CollectionQuery<ModelFromModels<M>>>(query: Q, { scope, skipRules }?: {
486
- scope?: string[];
487
- skipRules?: boolean;
488
- }): Promise<FetchResult<Q>>;
489
- fetchById<Schema extends Model<any>>(collectionName: CollectionNameFromModels<M>, id: string): Promise<{} | null>;
490
- insert(collectionName: CollectionNameFromModels<M>, doc: any, id?: string, storeScope?: {
491
- read: string[];
492
- write: string[];
493
- }): Promise<string | undefined>;
494
- subscribe<Q extends CollectionQuery<ModelFromModels<M>>>(query: Q, onResults: (results: FetchResult<Q>) => void, onError?: (error: any) => void, { scope, skipRules }?: {
495
- scope?: string[];
496
- skipRules?: boolean;
497
- }): () => Promise<void>;
498
- subscribeTriples<Q extends CollectionQuery<ModelFromModels<M>>>(query: Q, onResults: (results: TripleRow[]) => void, onError?: (error: any) => void, { scope, skipRules }?: {
499
- scope?: string[];
500
- skipRules?: boolean;
501
- }): () => Promise<void>;
502
- update<CN extends CollectionNameFromModels<M>>(collectionName: CN, entityId: string, updater: (entity: ProxyTypeFromModel<ModelFromModels<M, CN>>) => Promise<void>, storeScope?: {
503
- read: string[];
504
- write: string[];
505
- }): Promise<string | undefined>;
506
- query<CN extends CollectionNameFromModels<M>>(collectionName: CN, params?: Query<ModelFromModels<M, CN>>): toBuilder<CollectionQuery<ModelFromModels<M, CN>>>;
507
- createCollection(params: CreateCollectionOperation[1]): Promise<void>;
508
- dropCollection(params: DropCollectionOperation[1]): Promise<void>;
509
- renameAttribute(params: RenameAttributeOperation[1]): Promise<void>;
510
- addAttribute(params: AddAttributeOperation[1]): Promise<void>;
511
- dropAttribute(params: DropAttributeOperation[1]): Promise<void>;
512
- migrate(migrations: Migration[], direction: 'up' | 'down'): Promise<void>;
513
- getCollectionStats(): Promise<Map<any, any>>;
514
- clear(): Promise<void>;
515
- }
516
- type Storage = IndexedDbStorage | MemoryStorage;
517
- interface SyncOptions {
518
- server?: string;
519
- apiKey?: string;
520
- secure?: boolean;
521
- }
522
- interface AuthOptions {
523
- claimsPath?: string;
524
- token?: string;
525
- }
526
- interface RemoteQueryParams extends Query<any> {
527
- collection: string;
528
- }
529
- declare class SyncEngine {
530
- constructor(options: SyncOptions, db: DB<any>);
531
- get token(): string | undefined;
532
- private get httpUri();
533
- subscribe(params: RemoteQueryParams): () => void;
534
- disconnectQuery(id: string): void;
535
- onTxCommit(txId: string, callback: () => void): () => boolean | undefined;
536
- onTxFailure(txId: string, callback: (e: unknown) => void): () => boolean | undefined;
537
- private get isOpen();
538
- connect(): Promise<void>;
539
- updateConnection(options: Partial<SyncOptions>): void;
540
- disconnect(): void;
541
- get connectionStatus(): "OPEN" | "CLOSING" | "CLOSED" | "CONNECTING" | "UNKNOWN";
542
- retry(txId: string): Promise<void>;
543
- rollback(txIds: string | string[]): Promise<void>;
544
- }
545
- interface DBOptions<M extends Models<any, any> | undefined> {
546
- schema?: {
547
- collections: NonNullable<M>;
548
- version?: number;
549
- };
550
- migrations?: Migration[];
551
- variables?: Record<string, any>;
552
- storage?: {
553
- cache?: Storage;
554
- outbox?: Storage;
555
- };
556
- }
557
- type SyncStatus = 'pending' | 'confirmed' | 'all';
558
- type ClientQuery<M extends Model<any> | undefined> = CollectionQuery<M> & {
559
- syncStatus?: SyncStatus;
560
- };
561
- declare class TriplitClient<M extends Models<any, any> | undefined = undefined> {
562
- db: DB<M>;
563
- syncEngine: SyncEngine;
564
- authOptions: AuthOptions;
565
- constructor(options?: {
566
- db?: DBOptions<M>;
567
- sync?: Omit<SyncOptions, 'apiKey'>;
568
- auth?: AuthOptions;
569
- });
570
- transact(callback: (tx: DBTransaction<M>) => Promise<void>): Promise<string | undefined>;
571
- query<CN extends CollectionNameFromModels<M>>(collectionName: CN): toBuilder<ClientQuery<ModelFromModels<M, CN>>>;
572
- fetch(clientQueryBuilder: toBuilder<ClientQuery<ModelFromModels<M>>>): Promise<ModelFromModels<M, CollectionNameFromModels<M>> extends infer T ? T extends ModelFromModels<M, CollectionNameFromModels<M>> ? T extends import("@triplit/db").TObject<any> ? Map<string, import("@triplit/db").UnTimestampedObject<import("@triplit/db").TypeFromModel<T>>> : T extends undefined ? Map<string, any> : never : never : never>;
573
- insert(collectionName: CollectionNameFromModels<M>, object: JSONTypeFromModel<M[typeof collectionName]>, id?: string): Promise<string | undefined>;
574
- update<CN extends CollectionNameFromModels<M>>(collectionName: CN, entityId: string, updater: (entity: ProxyTypeFromModel<ModelFromModels<M, CN>>) => Promise<void>): Promise<string | undefined>;
575
- subscribe<CQ extends ClientQuery<ModelFromModels<M>>>(query: CQ, onResults: (results: FetchResult<CQ>) => void, onError?: (error: any) => void): () => void;
576
- updateAuthOptions(options: Partial<AuthOptions>): void;
577
- }
1
+ import { FetchResult, TriplitClient, ClientQuery, toBuilder, Models, CollectionNameFromModels } from "@triplit/client";
578
2
  export function useQuery<CQ extends ClientQuery<any>>(client: TriplitClient<any>, query: toBuilder<CQ>): {
579
3
  fetchingLocal: boolean;
580
4
  results: FetchResult<CQ> | undefined;
581
5
  error: any;
582
6
  };
583
- export function useEntity<M extends Model<any>>(client: TriplitClient<any>, collectionName: CollectionNameFromModels<M>, id: string): {
7
+ export function useEntity<M extends Models<any, any> | undefined, CN extends CollectionNameFromModels<M>>(client: TriplitClient<M>, collectionName: CN, id: string): {
584
8
  fetchingLocal: boolean;
585
9
  results: any;
586
10
  error: any;
@@ -1 +1 @@
1
- {"mappings":";;;;AAeA,yBAAiC,YAAW,eAAe;IACzD,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;;IAIvB,IAAI,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,SAAS,GAAG,YAAY,EAAE;IAmBxD,MAAM,CAAC,MAAM,EAAE,SAAS,YAAY,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E,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,KAAK,IAAI,EAC7C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI;IAqChC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC;CAShD;AE9jBD,yBAAyB,EAAE,SAAS,YAAY,GAAG,CAAC,EAClD,MAAM,EAAE,cAAc,GAAG,CAAC,EAC1B,KAAK,EAAE,UAAU,EAAE,CAAC;;;;EAwCrB;AC9CD,0BAA0B,CAAC,SAAS,MAAM,GAAG,CAAC,EAC5C,MAAM,EAAE,cAAc,GAAG,CAAC,EAC1B,cAAc,EAAE,yBAAyB,CAAC,CAAC,EAC3C,EAAE,EAAE,MAAM;;;;EAWX","sources":["packages/react/db/src/storage/memory-btree.ts","packages/react/db/src/storage/cached-indexed-db.ts","packages/react/db/src/errors.ts","packages/react/db/src/timestamp.ts","packages/react/db/src/utility-types.ts","packages/react/db/src/utils.ts","packages/react/db/src/schema.ts","packages/react/db/src/multi-tuple-store.ts","packages/react/db/src/clocks/clock.ts","packages/react/db/src/clocks/memory-clock.ts","packages/react/db/src/query.ts","packages/react/db/src/triple-store.ts","packages/react/db/src/document.ts","packages/react/db/src/utils/builder.ts","packages/react/db/src/utils/pipeline.ts","packages/react/db/src/db-helpers.ts","packages/react/db/src/collection-query.ts","packages/react/db/src/db-transaction.ts","packages/react/db/src/db.ts","packages/react/db/src/clocks/durable-clock.ts","packages/react/db/src/index.ts","packages/react/client/src/token.ts","packages/react/client/src/triplit-client.ts","packages/react/client/src/index.ts","packages/react/src/src/use-query.ts","packages/react/src/src/use-entity.ts","packages/react/src/src/index.ts","packages/react/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"export * from './use-query';\nexport * from './use-entity';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
1
+ {"mappings":";AAQA,yBAAyB,EAAE,SAAS,YAAY,GAAG,CAAC,EAClD,MAAM,EAAE,cAAc,GAAG,CAAC,EAC1B,KAAK,EAAE,UAAU,EAAE,CAAC;;;;EAwCrB;AC3CD,0BACE,CAAC,SAAS,OAAO,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,EACtC,EAAE,SAAS,yBAAyB,CAAC,CAAC,EACtC,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM;;;;EAUzD","sources":["packages/react/src/src/use-query.ts","packages/react/src/src/use-entity.ts","packages/react/src/src/index.ts","packages/react/src/index.ts"],"sourcesContent":[null,null,null,"export * from './use-query';\nexport * from './use-entity';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;ACQM,SAAU,0CACd,MAA0B,EAC1B,KAAoB;IAEpB,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAA,EAC5B;IAEF,MAAM,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,qBAAA,EAAS;IACnD,MAAM,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,qBAAA,EAAc;IACxC,+DAA+D;IAE/D,MAAM,aAAa,SAAS,MAAM;IAClC,MAAM,mBAAmB,cAAc,KAAK,UAAU;IAEtD,CAAA,GAAA,sBAAA,EAAU;QACR,IAAI,CAAC,QAAQ;QACb,WAAW;QACX,iBAAiB;QACjB,MAAM,cAAc,OAAO,UACzB,YACA,CAAC;YACC,iBAAiB;YACjB,SAAS;YACT,WAAW;QACb,GACA,CAAC;YACC,iBAAiB;YACjB,SAAS;QACX;QAGF,OAAO;YACL;QACF;IACF,GAAG;QAAC;QAAkB;KAAO;IAE7B,OAAO;uBACL;iBAEA,AADA,kBAAkB;QAClB;eACA;IACD;AACH;;;;;;;AC9CM,SAAU,0CACd,MAA0B,EAC1B,cAA2C,EAC3C,EAAU;IAEV,MAAM,iBAAE,aAAa,WAAE,OAAO,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,yCAAA,EACxC,QACA,OAAO,MAAM,gBAAgB,SAAS;IAExC,OAAO;uBACL;QACA,SAAS,UAAU,QAAQ,IAAI,MAAM;eACrC;IACD;AACH;;","sources":["packages/react/src/index.ts","packages/react/src/use-query.ts","packages/react/src/use-entity.ts"],"sourcesContent":["export * from './use-query';\nexport * from './use-entity';\n","import { useEffect, useState } from 'react';\nimport {\n FetchResult,\n TriplitClient,\n ClientQuery,\n toBuilder,\n} from '@triplit/client';\n\nexport function useQuery<CQ extends ClientQuery<any>>(\n client: TriplitClient<any>,\n query: toBuilder<CQ>\n) {\n const [results, setResults] = useState<FetchResult<CQ> | undefined>(\n undefined\n );\n const [fetchingLocal, setFetchingLocal] = useState(false);\n const [error, setError] = useState<any>(undefined);\n // const [fetchingRemote, setFetchingRemote] = useState(false);\n\n const builtQuery = query && query.build();\n const stringifiedQuery = builtQuery && JSON.stringify(builtQuery);\n\n useEffect(() => {\n if (!client) return;\n setResults(undefined);\n setFetchingLocal(true);\n const unsubscribe = client.subscribe(\n builtQuery,\n (localResults) => {\n setFetchingLocal(false);\n setError(undefined);\n setResults(localResults);\n },\n (error) => {\n setFetchingLocal(false);\n setError(error);\n }\n );\n\n return () => {\n unsubscribe();\n };\n }, [stringifiedQuery, client]);\n\n return {\n fetchingLocal,\n // fetchingRemote,\n results,\n error,\n };\n}\n","import { TriplitClient } from '@triplit/client';\nimport { CollectionNameFromModels, Model } from '@triplit/db';\nimport { useQuery } from './use-query';\n\nexport function useEntity<M extends Model<any>>(\n client: TriplitClient<any>,\n collectionName: CollectionNameFromModels<M>,\n id: string\n) {\n const { fetchingLocal, results, error } = useQuery(\n client,\n client.query(collectionName).entityId(id)\n );\n return {\n fetchingLocal,\n results: results ? results.get(id) : undefined,\n error,\n };\n}\n"],"names":[],"version":3,"file":"index.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;ACQM,SAAU,0CACd,MAA0B,EAC1B,KAAoB;IAEpB,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAA,EAC5B;IAEF,MAAM,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,qBAAA,EAAS;IACnD,MAAM,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,qBAAA,EAAc;IACxC,+DAA+D;IAE/D,MAAM,aAAa,SAAS,MAAM;IAClC,MAAM,mBAAmB,cAAc,KAAK,UAAU;IAEtD,CAAA,GAAA,sBAAA,EAAU;QACR,IAAI,CAAC,QAAQ;QACb,WAAW;QACX,iBAAiB;QACjB,MAAM,cAAc,OAAO,UACzB,YACA,CAAC;YACC,iBAAiB;YACjB,SAAS;YACT,WAAW;QACb,GACA,CAAC;YACC,iBAAiB;YACjB,SAAS;QACX;QAGF,OAAO;YACL;QACF;IACF,GAAG;QAAC;QAAkB;KAAO;IAE7B,OAAO;uBACL;iBAEA,AADA,kBAAkB;QAClB;eACA;IACD;AACH;;;;;;;AC3CM,SAAU,0CAGd,MAAwB,EAAE,cAAkB,EAAE,EAAU;IACxD,MAAM,iBAAE,aAAa,WAAE,OAAO,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,yCAAA,EACxC,QACA,OAAO,MAAM,gBAAgB,SAAS;IAExC,OAAO;uBACL;QACA,SAAS,UAAU,QAAQ,IAAI,MAAM;eACrC;IACD;AACH;;","sources":["packages/react/src/index.ts","packages/react/src/use-query.ts","packages/react/src/use-entity.ts"],"sourcesContent":["export * from './use-query';\nexport * from './use-entity';\n","import { useEffect, useState } from 'react';\nimport {\n FetchResult,\n TriplitClient,\n ClientQuery,\n toBuilder,\n} from '@triplit/client';\n\nexport function useQuery<CQ extends ClientQuery<any>>(\n client: TriplitClient<any>,\n query: toBuilder<CQ>\n) {\n const [results, setResults] = useState<FetchResult<CQ> | undefined>(\n undefined\n );\n const [fetchingLocal, setFetchingLocal] = useState(false);\n const [error, setError] = useState<any>(undefined);\n // const [fetchingRemote, setFetchingRemote] = useState(false);\n\n const builtQuery = query && query.build();\n const stringifiedQuery = builtQuery && JSON.stringify(builtQuery);\n\n useEffect(() => {\n if (!client) return;\n setResults(undefined);\n setFetchingLocal(true);\n const unsubscribe = client.subscribe(\n builtQuery,\n (localResults) => {\n setFetchingLocal(false);\n setError(undefined);\n setResults(localResults);\n },\n (error) => {\n setFetchingLocal(false);\n setError(error);\n }\n );\n\n return () => {\n unsubscribe();\n };\n }, [stringifiedQuery, client]);\n\n return {\n fetchingLocal,\n // fetchingRemote,\n results,\n error,\n };\n}\n","import {\n TriplitClient,\n Models,\n CollectionNameFromModels,\n} from '@triplit/client';\nimport { useQuery } from './use-query';\n\nexport function useEntity<\n M extends Models<any, any> | undefined,\n CN extends CollectionNameFromModels<M>\n>(client: TriplitClient<M>, collectionName: CN, id: string) {\n const { fetchingLocal, results, error } = useQuery(\n client,\n client.query(collectionName).entityId(id)\n );\n return {\n fetchingLocal,\n results: results ? results.get(id) : undefined,\n error,\n };\n}\n"],"names":[],"version":3,"file":"index.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;ACQM,SAAU,0CACd,MAA0B,EAC1B,KAAoB;IAEpB,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAA,EAC5B;IAEF,MAAM,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,eAAA,EAAS;IACnD,MAAM,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,eAAA,EAAc;IACxC,+DAA+D;IAE/D,MAAM,aAAa,SAAS,MAAM;IAClC,MAAM,mBAAmB,cAAc,KAAK,UAAU;IAEtD,CAAA,GAAA,gBAAA,EAAU;QACR,IAAI,CAAC,QAAQ;QACb,WAAW;QACX,iBAAiB;QACjB,MAAM,cAAc,OAAO,UACzB,YACA,CAAC;YACC,iBAAiB;YACjB,SAAS;YACT,WAAW;QACb,GACA,CAAC;YACC,iBAAiB;YACjB,SAAS;QACX;QAGF,OAAO;YACL;QACF;IACF,GAAG;QAAC;QAAkB;KAAO;IAE7B,OAAO;uBACL;iBAEA,AADA,kBAAkB;QAClB;eACA;IACD;AACH;;;;;;;AC9CM,SAAU,0CACd,MAA0B,EAC1B,cAA2C,EAC3C,EAAU;IAEV,MAAM,iBAAE,aAAa,WAAE,OAAO,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,yCAAA,EACxC,QACA,OAAO,MAAM,gBAAgB,SAAS;IAExC,OAAO;uBACL;QACA,SAAS,UAAU,QAAQ,IAAI,MAAM;eACrC;IACD;AACH;;","sources":["packages/react/src/index.ts","packages/react/src/use-query.ts","packages/react/src/use-entity.ts"],"sourcesContent":["export * from './use-query';\nexport * from './use-entity';\n","import { useEffect, useState } from 'react';\nimport {\n FetchResult,\n TriplitClient,\n ClientQuery,\n toBuilder,\n} from '@triplit/client';\n\nexport function useQuery<CQ extends ClientQuery<any>>(\n client: TriplitClient<any>,\n query: toBuilder<CQ>\n) {\n const [results, setResults] = useState<FetchResult<CQ> | undefined>(\n undefined\n );\n const [fetchingLocal, setFetchingLocal] = useState(false);\n const [error, setError] = useState<any>(undefined);\n // const [fetchingRemote, setFetchingRemote] = useState(false);\n\n const builtQuery = query && query.build();\n const stringifiedQuery = builtQuery && JSON.stringify(builtQuery);\n\n useEffect(() => {\n if (!client) return;\n setResults(undefined);\n setFetchingLocal(true);\n const unsubscribe = client.subscribe(\n builtQuery,\n (localResults) => {\n setFetchingLocal(false);\n setError(undefined);\n setResults(localResults);\n },\n (error) => {\n setFetchingLocal(false);\n setError(error);\n }\n );\n\n return () => {\n unsubscribe();\n };\n }, [stringifiedQuery, client]);\n\n return {\n fetchingLocal,\n // fetchingRemote,\n results,\n error,\n };\n}\n","import { TriplitClient } from '@triplit/client';\nimport { CollectionNameFromModels, Model } from '@triplit/db';\nimport { useQuery } from './use-query';\n\nexport function useEntity<M extends Model<any>>(\n client: TriplitClient<any>,\n collectionName: CollectionNameFromModels<M>,\n id: string\n) {\n const { fetchingLocal, results, error } = useQuery(\n client,\n client.query(collectionName).entityId(id)\n );\n return {\n fetchingLocal,\n results: results ? results.get(id) : undefined,\n error,\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;;;ACQM,SAAU,0CACd,MAA0B,EAC1B,KAAoB;IAEpB,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAA,EAC5B;IAEF,MAAM,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,eAAA,EAAS;IACnD,MAAM,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,eAAA,EAAc;IACxC,+DAA+D;IAE/D,MAAM,aAAa,SAAS,MAAM;IAClC,MAAM,mBAAmB,cAAc,KAAK,UAAU;IAEtD,CAAA,GAAA,gBAAA,EAAU;QACR,IAAI,CAAC,QAAQ;QACb,WAAW;QACX,iBAAiB;QACjB,MAAM,cAAc,OAAO,UACzB,YACA,CAAC;YACC,iBAAiB;YACjB,SAAS;YACT,WAAW;QACb,GACA,CAAC;YACC,iBAAiB;YACjB,SAAS;QACX;QAGF,OAAO;YACL;QACF;IACF,GAAG;QAAC;QAAkB;KAAO;IAE7B,OAAO;uBACL;iBAEA,AADA,kBAAkB;QAClB;eACA;IACD;AACH;;;;;;;AC3CM,SAAU,0CAGd,MAAwB,EAAE,cAAkB,EAAE,EAAU;IACxD,MAAM,iBAAE,aAAa,WAAE,OAAO,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,yCAAA,EACxC,QACA,OAAO,MAAM,gBAAgB,SAAS;IAExC,OAAO;uBACL;QACA,SAAS,UAAU,QAAQ,IAAI,MAAM;eACrC;IACD;AACH;;","sources":["packages/react/src/index.ts","packages/react/src/use-query.ts","packages/react/src/use-entity.ts"],"sourcesContent":["export * from './use-query';\nexport * from './use-entity';\n","import { useEffect, useState } from 'react';\nimport {\n FetchResult,\n TriplitClient,\n ClientQuery,\n toBuilder,\n} from '@triplit/client';\n\nexport function useQuery<CQ extends ClientQuery<any>>(\n client: TriplitClient<any>,\n query: toBuilder<CQ>\n) {\n const [results, setResults] = useState<FetchResult<CQ> | undefined>(\n undefined\n );\n const [fetchingLocal, setFetchingLocal] = useState(false);\n const [error, setError] = useState<any>(undefined);\n // const [fetchingRemote, setFetchingRemote] = useState(false);\n\n const builtQuery = query && query.build();\n const stringifiedQuery = builtQuery && JSON.stringify(builtQuery);\n\n useEffect(() => {\n if (!client) return;\n setResults(undefined);\n setFetchingLocal(true);\n const unsubscribe = client.subscribe(\n builtQuery,\n (localResults) => {\n setFetchingLocal(false);\n setError(undefined);\n setResults(localResults);\n },\n (error) => {\n setFetchingLocal(false);\n setError(error);\n }\n );\n\n return () => {\n unsubscribe();\n };\n }, [stringifiedQuery, client]);\n\n return {\n fetchingLocal,\n // fetchingRemote,\n results,\n error,\n };\n}\n","import {\n TriplitClient,\n Models,\n CollectionNameFromModels,\n} from '@triplit/client';\nimport { useQuery } from './use-query';\n\nexport function useEntity<\n M extends Models<any, any> | undefined,\n CN extends CollectionNameFromModels<M>\n>(client: TriplitClient<M>, collectionName: CN, id: string) {\n const { fetchingLocal, results, error } = useQuery(\n client,\n client.query(collectionName).entityId(id)\n );\n return {\n fetchingLocal,\n results: results ? results.get(id) : undefined,\n error,\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@triplit/react",
3
3
  "packageManager": "yarn@3.4.1",
4
- "version": "0.0.31",
4
+ "version": "0.0.33",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/module.js",
@@ -15,7 +15,7 @@
15
15
  "/dist"
16
16
  ],
17
17
  "dependencies": {
18
- "@triplit/client": "^0.0.31"
18
+ "@triplit/client": "0.0.33"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@parcel/config-default": "^2.9.3",