@evolu/common 8.12.0 → 8.14.0
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/src/Callbacks.d.ts +12 -1
- package/dist/src/Callbacks.d.ts.map +1 -1
- package/dist/src/Callbacks.js +3 -0
- package/dist/src/Error.d.ts +10 -4
- package/dist/src/Error.d.ts.map +1 -1
- package/dist/src/Error.js +10 -4
- package/dist/src/Object.d.ts +65 -0
- package/dist/src/Object.d.ts.map +1 -1
- package/dist/src/Object.js +142 -0
- package/dist/src/Resource.d.ts +0 -5
- package/dist/src/Resource.d.ts.map +1 -1
- package/dist/src/Resource.js +6 -13
- package/dist/src/Sqlite.d.ts.map +1 -1
- package/dist/src/Sqlite.js +7 -0
- package/dist/src/Task.d.ts +10 -8
- package/dist/src/Task.d.ts.map +1 -1
- package/dist/src/Task.js +41 -5
- package/dist/src/Worker.d.ts +3 -3
- package/dist/src/local-first/Db.d.ts +8 -3
- package/dist/src/local-first/Db.d.ts.map +1 -1
- package/dist/src/local-first/Db.js +56 -19
- package/dist/src/local-first/Evolu.d.ts +147 -39
- package/dist/src/local-first/Evolu.d.ts.map +1 -1
- package/dist/src/local-first/Evolu.js +53 -9
- package/dist/src/local-first/Owner.d.ts +9 -0
- package/dist/src/local-first/Owner.d.ts.map +1 -1
- package/dist/src/local-first/Owner.js +9 -0
- package/dist/src/local-first/Protocol.d.ts +6 -4
- package/dist/src/local-first/Protocol.d.ts.map +1 -1
- package/dist/src/local-first/Protocol.js +1 -6
- package/dist/src/local-first/Schema.d.ts +7 -1
- package/dist/src/local-first/Schema.d.ts.map +1 -1
- package/dist/src/local-first/Shared.d.ts +550 -153
- package/dist/src/local-first/Shared.d.ts.map +1 -1
- package/dist/src/local-first/Shared.js +724 -273
- package/dist/src/local-first/Storage.d.ts +16 -12
- package/dist/src/local-first/Storage.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Callbacks.test.ts +20 -0
- package/src/Callbacks.ts +17 -1
- package/src/Error.ts +10 -4
- package/src/Object.test.ts +296 -0
- package/src/Object.ts +163 -0
- package/src/Resource.test.ts +20 -16
- package/src/Resource.ts +6 -20
- package/src/Sqlite.ts +7 -0
- package/src/Task.test.ts +233 -62
- package/src/Task.ts +47 -13
- package/src/Worker.ts +3 -3
- package/src/local-first/Db.ts +88 -18
- package/src/local-first/Evolu.test.ts +381 -11
- package/src/local-first/Evolu.ts +219 -51
- package/src/local-first/Owner.ts +9 -0
- package/src/local-first/Protocol.test.ts +42 -60
- package/src/local-first/Protocol.ts +7 -9
- package/src/local-first/Schema.ts +8 -2
- package/src/local-first/Shared.test.ts +2714 -644
- package/src/local-first/Shared.ts +1245 -401
- package/src/local-first/Storage.ts +18 -19
|
@@ -465,8 +465,9 @@ export interface ProtocolWriteKeyError
|
|
|
465
465
|
extends OwnerError, Typed<"ProtocolWriteKeyError"> {}
|
|
466
466
|
|
|
467
467
|
/**
|
|
468
|
-
* Error indicating a serious relay-side write failure.
|
|
469
|
-
*
|
|
468
|
+
* Error indicating a serious relay-side write failure. Sync state shows it as
|
|
469
|
+
* the failure of that relay's route; apps show a generic sync error for the
|
|
470
|
+
* owner's `Error` status.
|
|
470
471
|
*/
|
|
471
472
|
export interface ProtocolWriteError
|
|
472
473
|
extends OwnerError, Typed<"ProtocolWriteError"> {}
|
|
@@ -489,8 +490,9 @@ export interface ProtocolQuotaError
|
|
|
489
490
|
extends OwnerError, Typed<"ProtocolQuotaError"> {}
|
|
490
491
|
|
|
491
492
|
/**
|
|
492
|
-
* Error indicating a serious relay-side synchronization failure.
|
|
493
|
-
*
|
|
493
|
+
* Error indicating a serious relay-side synchronization failure. Sync state
|
|
494
|
+
* shows it as the failure of that relay's route; apps show a generic sync error
|
|
495
|
+
* for the owner's `Error` status.
|
|
494
496
|
*/
|
|
495
497
|
export interface ProtocolSyncError
|
|
496
498
|
extends OwnerError, Typed<"ProtocolSyncError"> {}
|
|
@@ -1286,13 +1288,9 @@ export const applyProtocolMessageAsRelay =
|
|
|
1286
1288
|
);
|
|
1287
1289
|
|
|
1288
1290
|
if (!result.ok) {
|
|
1289
|
-
const isQuotaError = result.error.type === "StorageQuotaError";
|
|
1290
|
-
if (!isQuotaError) run.deps.console.error(result.error);
|
|
1291
1291
|
const message = createProtocolMessageBuffer(ownerId, {
|
|
1292
1292
|
messageType: MessageType.Response,
|
|
1293
|
-
errorCode:
|
|
1294
|
-
? ProtocolErrorCode.QuotaError
|
|
1295
|
-
: ProtocolErrorCode.WriteError,
|
|
1293
|
+
errorCode: ProtocolErrorCode.QuotaError,
|
|
1296
1294
|
}).unwrap();
|
|
1297
1295
|
return ok({ type: "Response", message });
|
|
1298
1296
|
}
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
type withDefault,
|
|
44
44
|
} from "../Type.ts";
|
|
45
45
|
import type { CompileTimeError, Simplify } from "../Types.ts";
|
|
46
|
-
import type { Evolu, maxMutationSize } from "./Evolu.ts";
|
|
46
|
+
import type { Evolu, EvoluErrorDep, maxMutationSize } from "./Evolu.ts";
|
|
47
47
|
import type { AppOwner, OwnerIdBytes } from "./Owner.ts";
|
|
48
48
|
import {
|
|
49
49
|
OwnerEncryptionKey,
|
|
@@ -514,7 +514,13 @@ export interface MutationOptions {
|
|
|
514
514
|
* Called after the mutation's changes are stored and subscribed queries
|
|
515
515
|
* reflect them. Useful for follow-up work (e.g., notifications, navigation)
|
|
516
516
|
* after insert, update, or upsert. It never runs when the database is
|
|
517
|
-
* unavailable
|
|
517
|
+
* unavailable or the mutation could not be stored, which
|
|
518
|
+
* {@link EvoluErrorDep.evoluError} reports.
|
|
519
|
+
*
|
|
520
|
+
* An Evolu instance stores its mutations in batches, each in one transaction.
|
|
521
|
+
* A batch holds the mutations made before Evolu sends it in a microtask,
|
|
522
|
+
* usually one synchronous block, and {@link Evolu.requestSync} sends it early.
|
|
523
|
+
* When one mutation cannot be stored, none of its batch is.
|
|
518
524
|
*
|
|
519
525
|
* Stored does not always mean visible. A change quarantined for
|
|
520
526
|
* {@link QuarantineReason.TimestampDrift} is stored in
|