local-lite 1.0.2 → 1.0.4

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.
Files changed (73) hide show
  1. package/README.md +4 -3
  2. package/dist/actions/manager.js +6 -2
  3. package/dist/actions/store.js +33 -19
  4. package/dist/adapters/local/expo-sqlite.js +4 -2
  5. package/dist/adapters/local/libsql.js +3 -1
  6. package/dist/adapters/local/op-sqlite.js +2 -1
  7. package/dist/adapters/network/index.js +10 -5
  8. package/dist/adapters/remote/convex.js +37 -10
  9. package/dist/adapters/remote/firestore.js +11 -4
  10. package/dist/adapters/remote/self-hosted.js +8 -4
  11. package/dist/adapters/remote/supabase.js +95 -29
  12. package/dist/auth/apple.js +8 -4
  13. package/dist/auth/github.js +15 -7
  14. package/dist/auth/google.js +7 -4
  15. package/dist/auth/identity.js +5 -1
  16. package/dist/auth/local.js +74 -21
  17. package/dist/auth/microsoft.js +22 -8
  18. package/dist/auth/session.js +45 -34
  19. package/dist/auth/unified.js +3 -2
  20. package/dist/backups/cloud-storage.js +10 -7
  21. package/dist/backups/encryption.js +4 -2
  22. package/dist/backups/onedrive.js +3 -3
  23. package/dist/backups/operations.js +4 -2
  24. package/dist/config/index.d.ts +1 -1
  25. package/dist/config/index.js +3 -0
  26. package/dist/config/resolve-local.js +18 -6
  27. package/dist/config/resolve-remote.js +2 -1
  28. package/dist/core/client.d.ts +2 -2
  29. package/dist/core/client.js +64 -26
  30. package/dist/core/index.d.ts +1 -1
  31. package/dist/core/maintenance.js +5 -4
  32. package/dist/core/meta-store.js +3 -3
  33. package/dist/core/outbox-store.js +32 -25
  34. package/dist/core/query-builder.js +23 -10
  35. package/dist/core/query.js +19 -7
  36. package/dist/core/schema-manager.js +6 -2
  37. package/dist/core/sync-worker.js +38 -12
  38. package/dist/core/table-manager.js +8 -2
  39. package/dist/core/types.d.ts +1 -1
  40. package/dist/devtools/BenchmarkModal.d.ts +1 -1
  41. package/dist/devtools/BenchmarkModal.js +234 -54
  42. package/dist/devtools/SyncInspector.js +260 -37
  43. package/dist/email/index.d.ts +17 -18
  44. package/dist/email/index.js +46 -72
  45. package/dist/keys/generator.js +4 -1
  46. package/dist/keys/manager.js +22 -4
  47. package/dist/keys/signed-token.js +12 -4
  48. package/dist/keys/store.js +23 -16
  49. package/dist/kv/manager.js +5 -2
  50. package/dist/kv/store.js +13 -13
  51. package/dist/react/auth.js +12 -12
  52. package/dist/react/backups.js +1 -1
  53. package/dist/react/index.js +14 -9
  54. package/dist/react/runner.js +1 -1
  55. package/dist/react/status.js +6 -2
  56. package/dist/reactive/event-emitter.js +2 -2
  57. package/dist/scheduler/cron.js +3 -1
  58. package/dist/scheduler/store.js +37 -31
  59. package/dist/schema/generator.js +37 -34
  60. package/dist/search/manager.js +3 -1
  61. package/dist/search/store.js +17 -16
  62. package/dist/server/email.d.ts +8 -0
  63. package/dist/server/email.js +48 -3
  64. package/dist/server/index.js +4 -4
  65. package/dist/server/sync.js +11 -4
  66. package/dist/storage/driver.js +2 -1
  67. package/dist/storage/expo.js +5 -2
  68. package/dist/storage/manager.js +3 -1
  69. package/dist/storage/store.js +26 -25
  70. package/dist/utils/dynamic.js +4 -2
  71. package/dist/utils/logger.js +13 -6
  72. package/dist/utils/portability.js +21 -9
  73. package/package.json +1 -1
@@ -21,7 +21,10 @@ function escapeCsvValue(val, delimiter) {
21
21
  str = String(val);
22
22
  }
23
23
  // Quote if contains delimiter, double quote, or newlines
24
- if (str.includes(delimiter) || str.includes('"') || str.includes('\n') || str.includes('\r')) {
24
+ if (str.includes(delimiter) ||
25
+ str.includes('"') ||
26
+ str.includes('\n') ||
27
+ str.includes('\r')) {
25
28
  return `"${str.replace(/"/g, '""')}"`;
26
29
  }
27
30
  return str;
@@ -103,7 +106,7 @@ function parseCsv(text, delimiter = ',') {
103
106
  async function exportTablesToJson(client, tables, options = {}) {
104
107
  let targetTables = tables && tables.length > 0 ? tables : client.tables;
105
108
  if (!options.includeInternal) {
106
- targetTables = targetTables.filter(t => !(0, sql_js_1.isInternalTable)(t));
109
+ targetTables = targetTables.filter((t) => !(0, sql_js_1.isInternalTable)(t));
107
110
  }
108
111
  const result = {
109
112
  version: 1,
@@ -165,7 +168,10 @@ async function importTablesFromJson(client, jsonString, options = {}) {
165
168
  if (!id)
166
169
  continue;
167
170
  // Upsert row
168
- await tx.mutate(table, id, 'INSERT', row, { primaryKey: pk, skipOutbox });
171
+ await tx.mutate(table, id, 'INSERT', row, {
172
+ primaryKey: pk,
173
+ skipOutbox,
174
+ });
169
175
  rowCounts[table]++;
170
176
  }
171
177
  });
@@ -181,7 +187,9 @@ async function exportTableToCsv(client, tableName, options = {}) {
181
187
  const rows = await client.findMany(tableName);
182
188
  if (rows.length === 0) {
183
189
  if (options.columns && includeHeader) {
184
- return options.columns.map(c => escapeCsvValue(c, delimiter)).join(delimiter);
190
+ return options.columns
191
+ .map((c) => escapeCsvValue(c, delimiter))
192
+ .join(delimiter);
185
193
  }
186
194
  return '';
187
195
  }
@@ -191,10 +199,10 @@ async function exportTableToCsv(client, tableName, options = {}) {
191
199
  : Object.keys(rows[0]);
192
200
  const lines = [];
193
201
  if (includeHeader) {
194
- lines.push(columns.map(c => escapeCsvValue(c, delimiter)).join(delimiter));
202
+ lines.push(columns.map((c) => escapeCsvValue(c, delimiter)).join(delimiter));
195
203
  }
196
204
  for (const row of rows) {
197
- const values = columns.map(col => escapeCsvValue(row[col], delimiter));
205
+ const values = columns.map((col) => escapeCsvValue(row[col], delimiter));
198
206
  lines.push(values.join(delimiter));
199
207
  }
200
208
  return lines.join('\n');
@@ -218,7 +226,7 @@ async function importTableFromCsv(client, tableName, csvString, options = {}) {
218
226
  let columns;
219
227
  let dataRows;
220
228
  if (hasHeader) {
221
- columns = parsedRows[0].map(c => c.trim());
229
+ columns = parsedRows[0].map((c) => c.trim());
222
230
  dataRows = parsedRows.slice(1);
223
231
  }
224
232
  else {
@@ -235,7 +243,8 @@ async function importTableFromCsv(client, tableName, csvString, options = {}) {
235
243
  await tx.query(`DELETE FROM ${safeTable}`);
236
244
  }
237
245
  for (const rowVals of dataRows) {
238
- if (rowVals.length === 0 || (rowVals.length === 1 && !rowVals[0].trim())) {
246
+ if (rowVals.length === 0 ||
247
+ (rowVals.length === 1 && !rowVals[0].trim())) {
239
248
  continue;
240
249
  }
241
250
  const payload = {};
@@ -274,7 +283,10 @@ async function importTableFromCsv(client, tableName, csvString, options = {}) {
274
283
  const id = String(payload[pk] ?? payload.id);
275
284
  if (!id)
276
285
  continue;
277
- await tx.mutate(tableName, id, 'INSERT', payload, { primaryKey: pk, skipOutbox });
286
+ await tx.mutate(tableName, id, 'INSERT', payload, {
287
+ primaryKey: pk,
288
+ skipOutbox,
289
+ });
278
290
  importedCount++;
279
291
  }
280
292
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-lite",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Never let a lost connection break a promise. Local-first sync that faithfully keeps data safe until you're back online.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",