@promakeai/dbreact 1.0.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.js ADDED
@@ -0,0 +1,648 @@
1
+ // index.ts
2
+ import {
3
+ ORM,
4
+ defineSchema,
5
+ f,
6
+ buildWhereClause as buildWhereClause2,
7
+ resolvePopulate,
8
+ getPopulatableFields,
9
+ validatePopulate,
10
+ parseJSONSchema
11
+ } from "@promakeai/orm";
12
+
13
+ // providers/DbProvider.tsx
14
+ import {
15
+ createContext,
16
+ useContext,
17
+ useState,
18
+ useEffect,
19
+ useMemo,
20
+ useCallback,
21
+ useRef
22
+ } from "react";
23
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
24
+ import { jsxDEV } from "react/jsx-dev-runtime";
25
+ var DbContext = createContext(null);
26
+ var DbLangContext = createContext(null);
27
+ var defaultQueryClient = new QueryClient({
28
+ defaultOptions: {
29
+ queries: {
30
+ staleTime: 1000 * 60 * 5,
31
+ gcTime: 1000 * 60 * 30,
32
+ refetchOnWindowFocus: false
33
+ }
34
+ }
35
+ });
36
+ function DbProvider({
37
+ adapter,
38
+ lang: langProp = "en",
39
+ fallbackLang = "en",
40
+ autoConnect = true,
41
+ queryClient = defaultQueryClient,
42
+ children
43
+ }) {
44
+ const [isConnected, setIsConnected] = useState(false);
45
+ const [error, setError] = useState(null);
46
+ const [lang, setLangState] = useState(langProp);
47
+ const isFirstRender = useRef(true);
48
+ useEffect(() => {
49
+ if (langProp !== lang) {
50
+ setLangState(langProp);
51
+ }
52
+ }, [langProp]);
53
+ useEffect(() => {
54
+ if (isFirstRender.current) {
55
+ isFirstRender.current = false;
56
+ return;
57
+ }
58
+ queryClient.invalidateQueries();
59
+ }, [lang]);
60
+ useEffect(() => {
61
+ if (!autoConnect)
62
+ return;
63
+ let mounted = true;
64
+ async function connect() {
65
+ try {
66
+ await adapter.connect?.();
67
+ if (mounted) {
68
+ setIsConnected(true);
69
+ setError(null);
70
+ }
71
+ } catch (err) {
72
+ if (mounted) {
73
+ setError(err instanceof Error ? err : new Error(String(err)));
74
+ setIsConnected(false);
75
+ }
76
+ }
77
+ }
78
+ connect();
79
+ return () => {
80
+ mounted = false;
81
+ };
82
+ }, [adapter, autoConnect]);
83
+ const setLang = useCallback((newLang) => {
84
+ setLangState(newLang);
85
+ }, []);
86
+ const dbContextValue = useMemo(() => ({
87
+ adapter,
88
+ isConnected,
89
+ error
90
+ }), [adapter, isConnected, error]);
91
+ const langContextValue = useMemo(() => ({
92
+ lang,
93
+ fallbackLang,
94
+ setLang
95
+ }), [lang, fallbackLang, setLang]);
96
+ return /* @__PURE__ */ jsxDEV(QueryClientProvider, {
97
+ client: queryClient,
98
+ children: /* @__PURE__ */ jsxDEV(DbContext.Provider, {
99
+ value: dbContextValue,
100
+ children: /* @__PURE__ */ jsxDEV(DbLangContext.Provider, {
101
+ value: langContextValue,
102
+ children
103
+ }, undefined, false, undefined, this)
104
+ }, undefined, false, undefined, this)
105
+ }, undefined, false, undefined, this);
106
+ }
107
+ function useDb() {
108
+ const context = useContext(DbContext);
109
+ if (!context) {
110
+ throw new Error("useDb must be used within a DbProvider");
111
+ }
112
+ return context;
113
+ }
114
+ function useAdapter() {
115
+ const { adapter } = useDb();
116
+ return adapter;
117
+ }
118
+ function useDbLang() {
119
+ const context = useContext(DbLangContext);
120
+ if (!context) {
121
+ throw new Error("useDbLang must be used within a DbProvider");
122
+ }
123
+ return context;
124
+ }
125
+ // hooks/useDbHooks.ts
126
+ import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
127
+ function useDbList(table, options) {
128
+ const adapter = useAdapter();
129
+ const { lang, fallbackLang } = useDbLang();
130
+ return useQuery({
131
+ queryKey: [table, "list", options, lang],
132
+ queryFn: () => adapter.list(table, {
133
+ ...options,
134
+ lang,
135
+ fallbackLang
136
+ }),
137
+ enabled: options?.enabled ?? true
138
+ });
139
+ }
140
+ function useDbGet(table, idOrOptions, maybeOptions) {
141
+ const adapter = useAdapter();
142
+ const { lang, fallbackLang } = useDbLang();
143
+ const isWhereMode = typeof idOrOptions === "object" && idOrOptions !== null && "where" in idOrOptions;
144
+ const where = isWhereMode ? idOrOptions.where : { id: idOrOptions };
145
+ const enabled = isWhereMode ? idOrOptions.enabled ?? true : (maybeOptions?.enabled ?? true) && idOrOptions !== undefined;
146
+ return useQuery({
147
+ queryKey: [table, "single", where, lang],
148
+ queryFn: () => adapter.findOne(table, { where, lang, fallbackLang }),
149
+ enabled
150
+ });
151
+ }
152
+ function useDbCreate(table) {
153
+ const adapter = useAdapter();
154
+ const queryClient = useQueryClient();
155
+ return useMutation({
156
+ mutationFn: (data) => adapter.create(table, data),
157
+ onSuccess: () => {
158
+ queryClient.invalidateQueries({ queryKey: [table] });
159
+ }
160
+ });
161
+ }
162
+ function useDbUpdate(table) {
163
+ const adapter = useAdapter();
164
+ const queryClient = useQueryClient();
165
+ return useMutation({
166
+ mutationFn: ({ id, data }) => adapter.update(table, id, data),
167
+ onSuccess: (_, { id }) => {
168
+ queryClient.invalidateQueries({ queryKey: [table] });
169
+ queryClient.invalidateQueries({ queryKey: [table, "single", id] });
170
+ }
171
+ });
172
+ }
173
+ function useDbDelete(table) {
174
+ const adapter = useAdapter();
175
+ const queryClient = useQueryClient();
176
+ return useMutation({
177
+ mutationFn: (id) => adapter.delete(table, id),
178
+ onSuccess: () => {
179
+ queryClient.invalidateQueries({ queryKey: [table] });
180
+ }
181
+ });
182
+ }
183
+ // adapters/SqliteAdapter.ts
184
+ import initSqlJs from "sql.js";
185
+ import {
186
+ buildWhereClause,
187
+ buildTranslationQuery,
188
+ buildTranslationQueryById,
189
+ buildTranslationUpsert,
190
+ extractTranslatableData,
191
+ getTranslatableFields,
192
+ toTranslationTableName,
193
+ toTranslationFKName,
194
+ deserializeRow,
195
+ serializeRow
196
+ } from "@promakeai/orm";
197
+
198
+ class SqliteAdapter {
199
+ db = null;
200
+ SQL = null;
201
+ config;
202
+ schema;
203
+ defaultLang;
204
+ constructor(config = {}) {
205
+ this.config = {
206
+ storageKey: config.storageKey ?? "dbreact_db",
207
+ wasmPath: config.wasmPath ?? "https://sql.js.org/dist/sql-wasm.wasm",
208
+ initialData: config.initialData ?? new Uint8Array,
209
+ schema: config.schema,
210
+ defaultLang: config.defaultLang
211
+ };
212
+ this.schema = config.schema;
213
+ this.defaultLang = config.defaultLang;
214
+ }
215
+ setSchema(schema) {
216
+ this.schema = schema;
217
+ this.config.schema = schema;
218
+ }
219
+ async connect() {
220
+ this.SQL = await initSqlJs({
221
+ locateFile: (file) => file === "sql-wasm.wasm" ? this.config.wasmPath : file
222
+ });
223
+ const saved = localStorage.getItem(this.config.storageKey);
224
+ if (saved) {
225
+ const data = Uint8Array.from(atob(saved), (c) => c.charCodeAt(0));
226
+ this.db = new this.SQL.Database(data);
227
+ } else if (this.config.initialData.length > 0) {
228
+ this.db = new this.SQL.Database(this.config.initialData);
229
+ this.persist();
230
+ } else {
231
+ this.db = new this.SQL.Database;
232
+ }
233
+ }
234
+ persist() {
235
+ if (!this.db)
236
+ return;
237
+ const data = this.db.export();
238
+ const base64 = btoa(String.fromCharCode(...data));
239
+ localStorage.setItem(this.config.storageKey, base64);
240
+ }
241
+ getDb() {
242
+ if (!this.db) {
243
+ throw new Error("Database not connected. Call connect() first.");
244
+ }
245
+ return this.db;
246
+ }
247
+ runQuery(sql, params = []) {
248
+ const db = this.getDb();
249
+ const result = db.exec(sql, params);
250
+ if (result.length === 0 || result[0].values.length === 0) {
251
+ return [];
252
+ }
253
+ const columns = result[0].columns;
254
+ return result[0].values.map((row) => {
255
+ const obj = {};
256
+ columns.forEach((col, i) => {
257
+ obj[col] = row[i];
258
+ });
259
+ return obj;
260
+ });
261
+ }
262
+ deserializeResults(table, rows) {
263
+ const tableSchema = this.schema?.tables[table];
264
+ if (!tableSchema || rows.length === 0)
265
+ return rows;
266
+ return rows.map((row) => deserializeRow(row, tableSchema.fields));
267
+ }
268
+ serializeData(table, data) {
269
+ const tableSchema = this.schema?.tables[table];
270
+ if (!tableSchema)
271
+ return data;
272
+ return serializeRow(data, tableSchema.fields);
273
+ }
274
+ buildSelectQuery(table, options, countOnly = false) {
275
+ const select = countOnly ? "COUNT(*) as count" : "*";
276
+ let sql = `SELECT ${select} FROM ${table}`;
277
+ const params = [];
278
+ if (options?.where) {
279
+ const where = buildWhereClause(options.where);
280
+ if (where.sql) {
281
+ sql += ` WHERE ${where.sql}`;
282
+ params.push(...where.params);
283
+ }
284
+ }
285
+ if (!countOnly) {
286
+ if (options?.orderBy && options.orderBy.length > 0) {
287
+ const orderParts = options.orderBy.map((o) => `${o.field} ${o.direction}`);
288
+ sql += ` ORDER BY ${orderParts.join(", ")}`;
289
+ }
290
+ if (options?.limit !== undefined) {
291
+ sql += ` LIMIT ?`;
292
+ params.push(options.limit);
293
+ }
294
+ if (options?.offset !== undefined) {
295
+ sql += ` OFFSET ?`;
296
+ params.push(options.offset);
297
+ }
298
+ }
299
+ return { sql, params };
300
+ }
301
+ async list(table, options) {
302
+ if (options?.lang && this.schema?.tables[table]) {
303
+ return this.listWithLang(table, options);
304
+ }
305
+ const { sql, params } = this.buildSelectQuery(table, options);
306
+ const rows = this.runQuery(sql, params);
307
+ return this.deserializeResults(table, rows);
308
+ }
309
+ async listWithLang(table, options) {
310
+ const tableSchema = this.schema?.tables[table];
311
+ if (!tableSchema) {
312
+ const { sql: sql2, params: params2 } = this.buildSelectQuery(table, options);
313
+ return this.deserializeResults(table, this.runQuery(sql2, params2));
314
+ }
315
+ const translatableFields = getTranslatableFields(tableSchema);
316
+ if (translatableFields.length === 0) {
317
+ const { sql: sql2, params: params2 } = this.buildSelectQuery(table, options);
318
+ return this.deserializeResults(table, this.runQuery(sql2, params2));
319
+ }
320
+ const { sql, params } = buildTranslationQuery({
321
+ table,
322
+ schema: this.schema,
323
+ lang: options.lang,
324
+ fallbackLang: options.fallbackLang ?? this.defaultLang,
325
+ where: options.where,
326
+ orderBy: options.orderBy,
327
+ limit: options.limit,
328
+ offset: options.offset
329
+ });
330
+ return this.deserializeResults(table, this.runQuery(sql, params));
331
+ }
332
+ async get(table, id, options) {
333
+ if (options?.lang && this.schema?.tables[table]) {
334
+ return this.getWithLang(table, id, options);
335
+ }
336
+ const results = await this.list(table, { where: { id }, limit: 1 });
337
+ return results[0] ?? null;
338
+ }
339
+ async findOne(table, options) {
340
+ const results = await this.list(table, { ...options, limit: 1 });
341
+ return results[0] ?? null;
342
+ }
343
+ async getWithLang(table, id, options) {
344
+ const tableSchema = this.schema?.tables[table];
345
+ if (!tableSchema) {
346
+ const results = await this.list(table, { where: { id }, limit: 1 });
347
+ return results[0] ?? null;
348
+ }
349
+ const translatableFields = getTranslatableFields(tableSchema);
350
+ if (translatableFields.length === 0) {
351
+ const results = await this.list(table, { where: { id }, limit: 1 });
352
+ return results[0] ?? null;
353
+ }
354
+ const { sql, params } = buildTranslationQueryById(table, this.schema, id, options.lang, options.fallbackLang ?? this.defaultLang);
355
+ const rows = this.runQuery(sql, params);
356
+ const deserialized = this.deserializeResults(table, rows);
357
+ return deserialized[0] ?? null;
358
+ }
359
+ async count(table, options) {
360
+ const { sql, params } = this.buildSelectQuery(table, options, true);
361
+ const result = this.runQuery(sql, params);
362
+ return result[0]?.count ?? 0;
363
+ }
364
+ async paginate(table, page, limit, options) {
365
+ const total = await this.count(table, options);
366
+ const totalPages = Math.ceil(total / limit);
367
+ const offset = (page - 1) * limit;
368
+ const data = await this.list(table, {
369
+ ...options,
370
+ limit,
371
+ offset
372
+ });
373
+ return {
374
+ data,
375
+ page,
376
+ limit,
377
+ total,
378
+ totalPages,
379
+ hasMore: page < totalPages
380
+ };
381
+ }
382
+ async create(table, data) {
383
+ const db = this.getDb();
384
+ const tableSchema = this.schema?.tables[table];
385
+ const serializedData = this.serializeData(table, data);
386
+ if (tableSchema) {
387
+ const { mainData, translatableData } = extractTranslatableData(serializedData, tableSchema);
388
+ const columns2 = Object.keys(mainData);
389
+ const values2 = Object.values(mainData);
390
+ const placeholders2 = columns2.map(() => "?").join(", ");
391
+ const sql2 = `INSERT INTO ${table} (${columns2.join(", ")}) VALUES (${placeholders2})`;
392
+ db.run(sql2, values2);
393
+ const lastId2 = db.exec("SELECT last_insert_rowid() as id")[0].values[0][0];
394
+ this.persist();
395
+ if (Object.keys(translatableData).length > 0 && this.defaultLang) {
396
+ await this.upsertTranslation(table, lastId2, this.defaultLang, translatableData);
397
+ }
398
+ const result2 = await this.get(table, lastId2);
399
+ return result2;
400
+ }
401
+ const columns = Object.keys(serializedData);
402
+ const values = Object.values(serializedData);
403
+ const placeholders = columns.map(() => "?").join(", ");
404
+ const sql = `INSERT INTO ${table} (${columns.join(", ")}) VALUES (${placeholders})`;
405
+ db.run(sql, values);
406
+ const lastId = db.exec("SELECT last_insert_rowid() as id")[0].values[0][0];
407
+ this.persist();
408
+ const result = await this.get(table, lastId);
409
+ return result;
410
+ }
411
+ async createWithTranslations(table, data, translations) {
412
+ const db = this.getDb();
413
+ const tableSchema = this.schema?.tables[table];
414
+ const serializedData = this.serializeData(table, data);
415
+ let mainData = serializedData;
416
+ let translatableData = {};
417
+ if (tableSchema) {
418
+ const extracted = extractTranslatableData(serializedData, tableSchema);
419
+ mainData = extracted.mainData;
420
+ translatableData = extracted.translatableData;
421
+ }
422
+ const columns = Object.keys(mainData);
423
+ const values = Object.values(mainData);
424
+ const placeholders = columns.map(() => "?").join(", ");
425
+ const sql = `INSERT INTO ${table} (${columns.join(", ")}) VALUES (${placeholders})`;
426
+ db.run(sql, values);
427
+ const lastId = db.exec("SELECT last_insert_rowid() as id")[0].values[0][0];
428
+ if (translations) {
429
+ for (const [lang, langData] of Object.entries(translations)) {
430
+ await this.upsertTranslation(table, lastId, lang, langData);
431
+ }
432
+ } else if (Object.keys(translatableData).length > 0 && this.defaultLang) {
433
+ await this.upsertTranslation(table, lastId, this.defaultLang, translatableData);
434
+ }
435
+ this.persist();
436
+ const result = await this.get(table, lastId);
437
+ return result;
438
+ }
439
+ async update(table, id, data) {
440
+ const db = this.getDb();
441
+ const tableSchema = this.schema?.tables[table];
442
+ const serializedData = this.serializeData(table, data);
443
+ if (tableSchema) {
444
+ const { mainData, translatableData } = extractTranslatableData(serializedData, tableSchema);
445
+ if (Object.keys(mainData).length > 0) {
446
+ const columns2 = Object.keys(mainData);
447
+ const values2 = Object.values(mainData);
448
+ const setParts2 = columns2.map((col) => `${col} = ?`).join(", ");
449
+ const sql2 = `UPDATE ${table} SET ${setParts2} WHERE id = ?`;
450
+ db.run(sql2, [...values2, id]);
451
+ }
452
+ if (Object.keys(translatableData).length > 0 && this.defaultLang) {
453
+ await this.upsertTranslation(table, id, this.defaultLang, translatableData);
454
+ }
455
+ this.persist();
456
+ const result2 = await this.get(table, id);
457
+ return result2;
458
+ }
459
+ const columns = Object.keys(serializedData);
460
+ const values = Object.values(serializedData);
461
+ const setParts = columns.map((col) => `${col} = ?`).join(", ");
462
+ const sql = `UPDATE ${table} SET ${setParts} WHERE id = ?`;
463
+ db.run(sql, [...values, id]);
464
+ this.persist();
465
+ const result = await this.get(table, id);
466
+ return result;
467
+ }
468
+ async upsertTranslation(table, id, lang, data) {
469
+ const db = this.getDb();
470
+ if (!this.schema) {
471
+ throw new Error(`No schema found for table: ${table}`);
472
+ }
473
+ const { sql, params } = buildTranslationUpsert(table, this.schema, id, lang, data);
474
+ db.run(sql, params);
475
+ this.persist();
476
+ }
477
+ async getTranslations(table, id) {
478
+ const tableSchema = this.schema?.tables[table];
479
+ if (!tableSchema) {
480
+ return [];
481
+ }
482
+ const translationTable = toTranslationTableName(table);
483
+ const fkName = toTranslationFKName(table);
484
+ const sql = `SELECT * FROM ${translationTable} WHERE ${fkName} = ?`;
485
+ return this.runQuery(sql, [id]);
486
+ }
487
+ async delete(table, id) {
488
+ const db = this.getDb();
489
+ if (this.schema?.tables[table]) {
490
+ const translationTable = toTranslationTableName(table);
491
+ const fkName = toTranslationFKName(table);
492
+ try {
493
+ db.run(`DELETE FROM ${translationTable} WHERE ${fkName} = ?`, [id]);
494
+ } catch {}
495
+ }
496
+ const sql = `DELETE FROM ${table} WHERE id = ?`;
497
+ db.run(sql, [id]);
498
+ this.persist();
499
+ const changes = db.getRowsModified();
500
+ return changes > 0;
501
+ }
502
+ async execute(query, params) {
503
+ const db = this.getDb();
504
+ db.run(query, params);
505
+ this.persist();
506
+ const changes = db.getRowsModified();
507
+ const result = db.exec("SELECT last_insert_rowid() as id");
508
+ const lastInsertRowid = result[0]?.values[0]?.[0] ?? 0;
509
+ return { changes, lastInsertRowid };
510
+ }
511
+ async raw(query, params) {
512
+ return this.runQuery(query, params ?? []);
513
+ }
514
+ async seed(data) {
515
+ const db = this.getDb();
516
+ for (const [table, records] of Object.entries(data)) {
517
+ for (const record of records) {
518
+ const serialized = this.serializeData(table, record);
519
+ const columns = Object.keys(serialized);
520
+ const values = Object.values(serialized);
521
+ const placeholders = columns.map(() => "?").join(", ");
522
+ const sql = `INSERT INTO ${table} (${columns.join(", ")}) VALUES (${placeholders})`;
523
+ db.run(sql, values);
524
+ }
525
+ }
526
+ this.persist();
527
+ }
528
+ async getTables() {
529
+ const result = this.runQuery("SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'");
530
+ return result.map((row) => row.name);
531
+ }
532
+ async getTableSchema(table) {
533
+ const db = this.getDb();
534
+ const result = db.exec(`PRAGMA table_info(${table})`);
535
+ if (result.length === 0 || result[0].values.length === 0) {
536
+ return [];
537
+ }
538
+ return result[0].values.map((row) => ({
539
+ name: String(row[1]),
540
+ type: String(row[2]),
541
+ notnull: Number(row[3]),
542
+ pk: Number(row[5])
543
+ }));
544
+ }
545
+ close() {
546
+ if (this.db) {
547
+ this.persist();
548
+ this.db.close();
549
+ this.db = null;
550
+ }
551
+ }
552
+ async beginTransaction() {
553
+ await this.execute("BEGIN TRANSACTION");
554
+ }
555
+ async commit() {
556
+ await this.execute("COMMIT");
557
+ this.persist();
558
+ }
559
+ async rollback() {
560
+ await this.execute("ROLLBACK");
561
+ }
562
+ async createMany(table, records, options) {
563
+ const db = this.getDb();
564
+ const ids = [];
565
+ const tableSchema = this.schema?.tables[table];
566
+ for (const record of records) {
567
+ const serializedRecord = this.serializeData(table, record);
568
+ let mainData = serializedRecord;
569
+ let translatableData = {};
570
+ if (tableSchema) {
571
+ const extracted = extractTranslatableData(serializedRecord, tableSchema);
572
+ mainData = extracted.mainData;
573
+ translatableData = extracted.translatableData;
574
+ }
575
+ const columns = Object.keys(mainData);
576
+ const values = Object.values(mainData);
577
+ const placeholders = columns.map(() => "?").join(", ");
578
+ const insertType = options?.ignore ? "INSERT OR IGNORE" : "INSERT";
579
+ const sql = `${insertType} INTO ${table} (${columns.join(", ")}) VALUES (${placeholders})`;
580
+ db.run(sql, values);
581
+ const lastId = db.exec("SELECT last_insert_rowid() as id")[0].values[0][0];
582
+ if (db.getRowsModified() > 0) {
583
+ ids.push(lastId);
584
+ if (Object.keys(translatableData).length > 0 && this.defaultLang) {
585
+ await this.upsertTranslation(table, lastId, this.defaultLang, translatableData);
586
+ }
587
+ }
588
+ }
589
+ this.persist();
590
+ return { created: ids.length, ids };
591
+ }
592
+ async updateMany(table, updates) {
593
+ let updated = 0;
594
+ for (const { id, data } of updates) {
595
+ await this.update(table, id, data);
596
+ updated++;
597
+ }
598
+ return { updated };
599
+ }
600
+ async deleteMany(table, ids) {
601
+ let deleted = 0;
602
+ for (const id of ids) {
603
+ const success = await this.delete(table, id);
604
+ if (success)
605
+ deleted++;
606
+ }
607
+ return { deleted };
608
+ }
609
+ export() {
610
+ return this.getDb().export();
611
+ }
612
+ async import(data) {
613
+ if (!this.SQL) {
614
+ throw new Error("Database not connected. Call connect() first.");
615
+ }
616
+ this.db?.close();
617
+ this.db = new this.SQL.Database(data);
618
+ this.persist();
619
+ }
620
+ clear() {
621
+ if (!this.SQL) {
622
+ throw new Error("Database not connected. Call connect() first.");
623
+ }
624
+ this.db?.close();
625
+ this.db = new this.SQL.Database;
626
+ this.persist();
627
+ }
628
+ }
629
+ export {
630
+ validatePopulate,
631
+ useDbUpdate,
632
+ useDbList,
633
+ useDbLang,
634
+ useDbGet,
635
+ useDbDelete,
636
+ useDbCreate,
637
+ useDb,
638
+ useAdapter,
639
+ resolvePopulate,
640
+ parseJSONSchema,
641
+ getPopulatableFields,
642
+ f,
643
+ defineSchema,
644
+ buildWhereClause2 as buildWhereClause,
645
+ SqliteAdapter,
646
+ ORM,
647
+ DbProvider
648
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DbProvider.d.ts","sourceRoot":"","sources":["../../providers/DbProvider.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAuB,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACf,MAAM,UAAU,CAAC;AAqBlB,UAAU,eAAgB,SAAQ,gBAAgB;IAChD,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,IAAI,EAAE,QAAe,EACrB,YAAmB,EACnB,WAAkB,EAClB,WAAgC,EAChC,QAAQ,GACT,EAAE,eAAe,2CAqFjB;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,cAAc,CAMtC;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,YAAY,CAGzC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,kBAAkB,CAM9C"}