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.
- package/README.md +4 -3
- package/dist/actions/manager.js +6 -2
- package/dist/actions/store.js +33 -19
- package/dist/adapters/local/expo-sqlite.js +4 -2
- package/dist/adapters/local/libsql.js +3 -1
- package/dist/adapters/local/op-sqlite.js +2 -1
- package/dist/adapters/network/index.js +10 -5
- package/dist/adapters/remote/convex.js +37 -10
- package/dist/adapters/remote/firestore.js +11 -4
- package/dist/adapters/remote/self-hosted.js +8 -4
- package/dist/adapters/remote/supabase.js +95 -29
- package/dist/auth/apple.js +8 -4
- package/dist/auth/github.js +15 -7
- package/dist/auth/google.js +7 -4
- package/dist/auth/identity.js +5 -1
- package/dist/auth/local.js +74 -21
- package/dist/auth/microsoft.js +22 -8
- package/dist/auth/session.js +45 -34
- package/dist/auth/unified.js +3 -2
- package/dist/backups/cloud-storage.js +10 -7
- package/dist/backups/encryption.js +4 -2
- package/dist/backups/onedrive.js +3 -3
- package/dist/backups/operations.js +4 -2
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +3 -0
- package/dist/config/resolve-local.js +18 -6
- package/dist/config/resolve-remote.js +2 -1
- package/dist/core/client.d.ts +2 -2
- package/dist/core/client.js +64 -26
- package/dist/core/index.d.ts +1 -1
- package/dist/core/maintenance.js +5 -4
- package/dist/core/meta-store.js +3 -3
- package/dist/core/outbox-store.js +32 -25
- package/dist/core/query-builder.js +23 -10
- package/dist/core/query.js +19 -7
- package/dist/core/schema-manager.js +6 -2
- package/dist/core/sync-worker.js +38 -12
- package/dist/core/table-manager.js +8 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/devtools/BenchmarkModal.d.ts +1 -1
- package/dist/devtools/BenchmarkModal.js +234 -54
- package/dist/devtools/SyncInspector.js +260 -37
- package/dist/email/index.d.ts +17 -18
- package/dist/email/index.js +46 -72
- package/dist/keys/generator.js +4 -1
- package/dist/keys/manager.js +22 -4
- package/dist/keys/signed-token.js +12 -4
- package/dist/keys/store.js +23 -16
- package/dist/kv/manager.js +5 -2
- package/dist/kv/store.js +13 -13
- package/dist/react/auth.js +12 -12
- package/dist/react/backups.js +1 -1
- package/dist/react/index.js +14 -9
- package/dist/react/runner.js +1 -1
- package/dist/react/status.js +6 -2
- package/dist/reactive/event-emitter.js +2 -2
- package/dist/scheduler/cron.js +3 -1
- package/dist/scheduler/store.js +37 -31
- package/dist/schema/generator.js +37 -34
- package/dist/search/manager.js +3 -1
- package/dist/search/store.js +17 -16
- package/dist/server/email.d.ts +8 -0
- package/dist/server/email.js +48 -3
- package/dist/server/index.js +4 -4
- package/dist/server/sync.js +11 -4
- package/dist/storage/driver.js +2 -1
- package/dist/storage/expo.js +5 -2
- package/dist/storage/manager.js +3 -1
- package/dist/storage/store.js +26 -25
- package/dist/utils/dynamic.js +4 -2
- package/dist/utils/logger.js +13 -6
- package/dist/utils/portability.js +21 -9
- 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) ||
|
|
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, {
|
|
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
|
|
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 ||
|
|
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, {
|
|
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