@rdlabo/ionic-angular-kit 21.5.37 → 21.5.39
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/package.json
CHANGED
|
@@ -331,7 +331,7 @@ declare function commandIdentityMatchesReplicaRow(schema: OfflineReplicaEntitySc
|
|
|
331
331
|
declare function offlineReplicaRemoteIdentity(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, identity: OfflineReplicaIdentity): OfflineReplicaRemoteIdentity | null;
|
|
332
332
|
|
|
333
333
|
/** Current durable storage schema used by both web and native repositories. */
|
|
334
|
-
declare const OFFLINE_SCHEMA_VERSION =
|
|
334
|
+
declare const OFFLINE_SCHEMA_VERSION = 2;
|
|
335
335
|
/** User and partition scope of all local offline data. */
|
|
336
336
|
interface OfflineScope {
|
|
337
337
|
userId: OfflinePrincipalId;
|
|
@@ -342,7 +342,7 @@ type OfflineReplicaSyncState = 'confirmed' | 'pending' | 'blocked_auth' | 'rejec
|
|
|
342
342
|
type OfflineReplicaVisibility = 'present' | 'pending_delete';
|
|
343
343
|
type OfflineReplicaMutation = 'upsert' | 'delete';
|
|
344
344
|
/** Durable processing state of an outbox command. */
|
|
345
|
-
type OfflineCommandState = 'pending' | 'sending' | 'retry_wait' | 'blocked_auth' | 'rejected' | 'conflict';
|
|
345
|
+
type OfflineCommandState = 'pending' | 'sending' | 'retry_wait' | 'awaiting_pull' | 'blocked_auth' | 'rejected' | 'conflict';
|
|
346
346
|
interface OfflineCommandBase<T> extends OfflineScope {
|
|
347
347
|
commandId: string;
|
|
348
348
|
aggregateType: string;
|
|
@@ -352,10 +352,11 @@ interface OfflineCommandBase<T> extends OfflineScope {
|
|
|
352
352
|
identity: OfflineCommandIdentity;
|
|
353
353
|
operation: string;
|
|
354
354
|
payload: T;
|
|
355
|
-
/**
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
355
|
+
/**
|
|
356
|
+
* Declared localOnly projection rows this intent may create, update, or remove.
|
|
357
|
+
* Kit persists keys only; before/after images are not durable truth.
|
|
358
|
+
*/
|
|
359
|
+
localOnlyFootprint?: readonly OfflineReplicaRowKey[];
|
|
359
360
|
/** Durable intent used to preserve a hidden tombstone across restart and replay. */
|
|
360
361
|
replicaMutation?: OfflineReplicaMutation;
|
|
361
362
|
payloadHash: string;
|
|
@@ -367,12 +368,8 @@ interface OfflineCommandBase<T> extends OfflineScope {
|
|
|
367
368
|
lastErrorCode: string | null;
|
|
368
369
|
/** True when transport started but the client cannot prove whether the server committed. */
|
|
369
370
|
serverCommitUnknown?: boolean;
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
interface OfflineOptimisticReplicaCompanion {
|
|
373
|
-
key: OfflineReplicaRowKey;
|
|
374
|
-
before: OfflineReplicaRow | null;
|
|
375
|
-
after: OfflineReplicaRow | null;
|
|
371
|
+
/** Remote identity captured after transport for journal-independent authoritative reconciliation. */
|
|
372
|
+
reconciliationIdentity?: OfflineReplicaRemoteIdentity;
|
|
376
373
|
}
|
|
377
374
|
type OfflineCommand<T = unknown> = OfflineCommandBase<T>;
|
|
378
375
|
/** Product replica row materialized from a versioned schema entity. */
|
|
@@ -540,12 +537,94 @@ declare class IonicOfflineRepository implements OfflineRepository {
|
|
|
540
537
|
static ɵprov: i0.ɵɵInjectableDeclaration<IonicOfflineRepository>;
|
|
541
538
|
}
|
|
542
539
|
|
|
540
|
+
/**
|
|
541
|
+
* Authoritative inputs for rematerializing one aggregate from its remaining
|
|
542
|
+
* ordered Outbox chain.
|
|
543
|
+
*
|
|
544
|
+
* `baseRow` is the current replica row for the aggregate, including its latest
|
|
545
|
+
* `confirmedValues`. `localOnlyRows` are the current localOnly projection rows
|
|
546
|
+
* owned by that aggregate. `commands` is the complete remaining FIFO chain
|
|
547
|
+
* after the triggering mutation.
|
|
548
|
+
*/
|
|
549
|
+
interface OfflineAggregateIntentProjectInput {
|
|
550
|
+
/** Current aggregate base replica row, or `null` when the row is absent. */
|
|
551
|
+
readonly baseRow: OfflineReplicaRow | null;
|
|
552
|
+
/** Current authoritative localOnly projection rows for this aggregate. */
|
|
553
|
+
readonly localOnlyRows: readonly OfflineReplicaRow[];
|
|
554
|
+
/** Complete remaining ordered pending command chain for this aggregate. */
|
|
555
|
+
readonly commands: readonly OfflineCommand[];
|
|
556
|
+
/** Boundary that requested rematerialization. Only pull may return a conflict outcome. */
|
|
557
|
+
readonly trigger?: 'local' | 'pull';
|
|
558
|
+
/** Incoming authoritative revision when `trigger` is `pull`. */
|
|
559
|
+
readonly incomingRevision?: string | number;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Fully rematerialized aggregate projection.
|
|
563
|
+
*
|
|
564
|
+
* Kit writes `baseRow` as the sole base mutation (`null` removes the row) and
|
|
565
|
+
* applies only the localOnly put/remove lists. Domain folding belongs here;
|
|
566
|
+
* Kit never interprets command payloads.
|
|
567
|
+
*/
|
|
568
|
+
interface OfflineAggregateIntentProjection {
|
|
569
|
+
/** Rematerialized base replica row, or `null` to remove the aggregate row. */
|
|
570
|
+
readonly baseRow: OfflineReplicaRow | null;
|
|
571
|
+
/** LocalOnly projection rows to upsert for this aggregate. */
|
|
572
|
+
readonly putLocalOnlyRows?: readonly OfflineReplicaRow[];
|
|
573
|
+
/** LocalOnly projection rows to remove for this aggregate. */
|
|
574
|
+
readonly removeLocalOnlyRows?: readonly OfflineReplicaRowKey[];
|
|
575
|
+
}
|
|
576
|
+
/** Product decision that pending intents cannot be replayed onto an incoming authoritative revision. */
|
|
577
|
+
interface OfflineAggregateIntentConflict {
|
|
578
|
+
readonly kind: 'conflict';
|
|
579
|
+
readonly reason: string;
|
|
580
|
+
}
|
|
581
|
+
/** Result of product-owned aggregate rematerialization. */
|
|
582
|
+
type OfflineAggregateIntentProjectResult = OfflineAggregateIntentProjection | OfflineAggregateIntentConflict;
|
|
583
|
+
/**
|
|
584
|
+
* Product-owned pure rematerialization of one aggregate.
|
|
585
|
+
*
|
|
586
|
+
* Given the authoritative base row, current localOnly projection rows, and the
|
|
587
|
+
* remaining ordered {@link OfflineCommand} chain, return one fully materialized
|
|
588
|
+
* base row plus localOnly put/remove mutations. The adapter must derive only
|
|
589
|
+
* from confirmed base/localOnly values plus complete FIFO pending intents. It
|
|
590
|
+
* must not perform I/O; Kit supplies already-read replica state and validates
|
|
591
|
+
* scope, schema, identity, and footprints before writing.
|
|
592
|
+
*/
|
|
593
|
+
interface OfflineAggregateIntentProjector {
|
|
594
|
+
/** Rematerializes one aggregate from authoritative replica state and remaining intents. */
|
|
595
|
+
project(input: OfflineAggregateIntentProjectInput): OfflineAggregateIntentProjectResult;
|
|
596
|
+
}
|
|
597
|
+
/** Returns whether the projector rejected replay onto an authoritative pull revision. */
|
|
598
|
+
declare function isOfflineAggregateIntentConflict(result: OfflineAggregateIntentProjectResult): result is OfflineAggregateIntentConflict;
|
|
599
|
+
/** Required product adapter for aggregate rematerialization from remaining Outbox intents. */
|
|
600
|
+
declare const OFFLINE_AGGREGATE_INTENT_PROJECTOR: InjectionToken<OfflineAggregateIntentProjector>;
|
|
601
|
+
/**
|
|
602
|
+
* Converts a validated aggregate projection into replica put/remove mutations.
|
|
603
|
+
*
|
|
604
|
+
* @param projection - Rematerialized aggregate returned by the product projector.
|
|
605
|
+
* @param baseRow - Current aggregate base row, used when the projection removes it.
|
|
606
|
+
*/
|
|
607
|
+
declare function offlineAggregateIntentMutations(projection: OfflineAggregateIntentProjection, baseRow: OfflineReplicaRow | null): Pick<OfflineReplicaTransaction, 'putRows' | 'removeRows'>;
|
|
608
|
+
|
|
543
609
|
/** Server pull request for one user or partition-scoped replica. */
|
|
544
610
|
interface OfflineReplicaPullRequest {
|
|
545
611
|
scope: OfflineScope;
|
|
546
612
|
cursor: string;
|
|
547
613
|
schemaVersion: number;
|
|
548
614
|
schemaHash: string;
|
|
615
|
+
/**
|
|
616
|
+
* Successfully transported commands that still require an authoritative row acknowledgement.
|
|
617
|
+
* The server must hydrate and authorize each target from primary state and acknowledge it only
|
|
618
|
+
* on the returned reconciliation change; it must never trust this client identity as proof.
|
|
619
|
+
*/
|
|
620
|
+
reconciliationTargets: readonly OfflineReplicaReconciliationTarget[];
|
|
621
|
+
}
|
|
622
|
+
/** One awaiting-pull command whose canonical state must be hydrated independently of journal retention. */
|
|
623
|
+
interface OfflineReplicaReconciliationTarget {
|
|
624
|
+
readonly commandId: string;
|
|
625
|
+
readonly operation: string;
|
|
626
|
+
readonly sourceKey: string;
|
|
627
|
+
readonly identity: OfflineReplicaRemoteIdentity;
|
|
549
628
|
}
|
|
550
629
|
/** One server-side replica mutation returned by an explicit pull page. */
|
|
551
630
|
interface OfflineReplicaChangeBase {
|
|
@@ -653,21 +732,43 @@ declare class OfflineReplicaPullService {
|
|
|
653
732
|
* Serializes only local replica read/derive/write critical sections. Network
|
|
654
733
|
* transport must stay outside this coordinator so synchronization never holds
|
|
655
734
|
* the local mutation lane while waiting on I/O.
|
|
735
|
+
*
|
|
736
|
+
* This coordinator is the sole caller and validator of aggregate rematerialization.
|
|
737
|
+
* Invoke {@link projectAggregateIntent} only from inside {@link run}; this
|
|
738
|
+
* method does not acquire the lane itself.
|
|
656
739
|
*/
|
|
657
740
|
declare class OfflineReplicaMutationCoordinator {
|
|
658
741
|
#private;
|
|
742
|
+
/** Enqueues one local replica critical section behind any in-flight mutation. */
|
|
659
743
|
run<T>(operation: () => Promise<T>): Promise<T>;
|
|
744
|
+
/** Resolves after every currently queued replica mutation has settled. */
|
|
660
745
|
drain(): Promise<void>;
|
|
746
|
+
/**
|
|
747
|
+
* Calls the product aggregate-intent projector and validates scope, schema,
|
|
748
|
+
* identity, and footprints. Throws before returning when the projector is
|
|
749
|
+
* missing or the projection is unsafe to write.
|
|
750
|
+
*
|
|
751
|
+
* @param input - Authoritative base row, current localOnly rows, and remaining commands.
|
|
752
|
+
*/
|
|
753
|
+
projectAggregateIntent(input: OfflineAggregateIntentProjectInput): OfflineAggregateIntentProjectResult;
|
|
661
754
|
static ɵfac: i0.ɵɵFactoryDeclaration<OfflineReplicaMutationCoordinator, never>;
|
|
662
755
|
static ɵprov: i0.ɵɵInjectableDeclaration<OfflineReplicaMutationCoordinator>;
|
|
663
756
|
}
|
|
757
|
+
/** Declared localOnly keys persisted on one Outbox command. */
|
|
758
|
+
declare function commandFootprintKeys(command: Pick<OfflineCommand, 'localOnlyFootprint'>): readonly OfflineReplicaRowKey[];
|
|
664
759
|
|
|
665
760
|
/** Server acknowledgement used to reconcile one optimistic local mutation. */
|
|
666
761
|
interface OfflineCommandResult {
|
|
667
762
|
/** Remote id returned by a successful generated-identity mutation. */
|
|
668
763
|
remoteId?: OfflineGeneratedRemoteId;
|
|
669
764
|
serverRevision?: string | number;
|
|
670
|
-
/**
|
|
765
|
+
/**
|
|
766
|
+
* Full server-confirmed domain values after applying the mutation.
|
|
767
|
+
*
|
|
768
|
+
* Kit does not treat this as the durable confirmed baseline while the
|
|
769
|
+
* command remains in the Outbox. Authoritative confirmed values come from
|
|
770
|
+
* pull acknowledgement of `commandId`.
|
|
771
|
+
*/
|
|
671
772
|
confirmedValues?: unknown;
|
|
672
773
|
/** Removes the local replica row after a confirmed server delete. */
|
|
673
774
|
removeReplica?: boolean;
|
|
@@ -687,20 +788,11 @@ type OfflineCommandTarget = {
|
|
|
687
788
|
readonly kind: 'natural';
|
|
688
789
|
readonly naturalKey: OfflineNaturalKey;
|
|
689
790
|
};
|
|
690
|
-
/** 不透明なoperationを製品APIへ送信し、local replicaへ投影するadapter。 */
|
|
691
791
|
/** Product adapter that sends commands and projects acknowledgements into entities. */
|
|
692
792
|
interface OfflineCommandExecutor {
|
|
693
793
|
/** Sends the command using `command.commandId` as its durable server-side idempotency key. */
|
|
694
794
|
execute(command: OfflineCommand, target: OfflineCommandTarget): Promise<OfflineCommandResult>;
|
|
695
795
|
withServerRevision(command: OfflineCommand, revision: string | number): OfflineCommand;
|
|
696
|
-
/**
|
|
697
|
-
* Reapplies a complete aggregate's pending intents to a newer confirmed
|
|
698
|
-
* value. Return null when any intent is revision-sensitive. The returned
|
|
699
|
-
* values correspond to the original FIFO command order. Kit alone updates
|
|
700
|
-
* command metadata; payload and idempotency identity remain immutable.
|
|
701
|
-
* Without this hook, revision changes conflict by default.
|
|
702
|
-
*/
|
|
703
|
-
rebasePendingCommands?(commands: readonly OfflineCommand[], confirmedValues: unknown, revision: string | number, companionRows: readonly OfflineReplicaRow[]): OfflinePendingRebase | null | Promise<OfflinePendingRebase | null>;
|
|
704
796
|
/**
|
|
705
797
|
* Whether this transport error authoritatively proves that this idempotency
|
|
706
798
|
* key did not commit. Returning true may clear an ambiguity retained from an
|
|
@@ -713,18 +805,6 @@ interface OfflineCommandExecutor {
|
|
|
713
805
|
*/
|
|
714
806
|
withoutServerRevision?(command: OfflineCommand): OfflineCommand;
|
|
715
807
|
}
|
|
716
|
-
/** Product projection result after safely replaying pending intents onto a newer confirmed revision. */
|
|
717
|
-
interface OfflinePendingRebase {
|
|
718
|
-
/** Recomputed projections in the original durable FIFO order. */
|
|
719
|
-
steps: readonly OfflinePendingRebaseStep[];
|
|
720
|
-
}
|
|
721
|
-
/** Projection state produced for one immutable durable command in FIFO order. */
|
|
722
|
-
interface OfflinePendingRebaseStep {
|
|
723
|
-
/** Recomputed full aggregate value after this command's intent is applied. */
|
|
724
|
-
optimisticValue: unknown;
|
|
725
|
-
/** Same footprint as the original command, rematerialized from the new confirmed value. */
|
|
726
|
-
optimisticCompanions?: readonly OfflineOptimisticReplicaCompanion[];
|
|
727
|
-
}
|
|
728
808
|
/** DI token for the product-specific command transport adapter. */
|
|
729
809
|
declare const OFFLINE_COMMAND_EXECUTOR: InjectionToken<OfflineCommandExecutor>;
|
|
730
810
|
/** Authenticated user and partition scopes currently eligible for synchronization. */
|
|
@@ -833,6 +913,43 @@ declare class OfflineSessionService {
|
|
|
833
913
|
static ɵprov: i0.ɵɵInjectableDeclaration<OfflineSessionService>;
|
|
834
914
|
}
|
|
835
915
|
|
|
916
|
+
/**
|
|
917
|
+
* Closed set of reasons local offline storage failed to become ready.
|
|
918
|
+
*
|
|
919
|
+
* Product policy should branch on this discriminant rather than English message text.
|
|
920
|
+
*/
|
|
921
|
+
type OfflineStorageUnavailableReason = 'encryption_key_unavailable' | 'core_schema_incompatible' | 'replica_schema_mismatch' | 'migration_missing' | 'storage_unavailable';
|
|
922
|
+
/**
|
|
923
|
+
* Local offline storage could not be opened or migrated without risking data loss.
|
|
924
|
+
*
|
|
925
|
+
* Prefer `instanceof` / {@link OfflineStorageUnavailableError.reason} over message text.
|
|
926
|
+
* The original failure is preserved on {@link Error.cause}. Kit never deletes Outbox or
|
|
927
|
+
* replica rows in response to this error; recovery is product-owned and explicit.
|
|
928
|
+
*/
|
|
929
|
+
declare class OfflineStorageUnavailableError extends Error {
|
|
930
|
+
readonly reason: OfflineStorageUnavailableReason;
|
|
931
|
+
/** Stable machine-readable discriminator for storage initialization failures. */
|
|
932
|
+
static readonly code: "OFFLINE_STORAGE_UNAVAILABLE";
|
|
933
|
+
readonly code: "OFFLINE_STORAGE_UNAVAILABLE";
|
|
934
|
+
constructor(reason: OfflineStorageUnavailableReason, message: string, options?: ErrorOptions);
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Coordinator view of encrypted local storage after app initialization.
|
|
938
|
+
*
|
|
939
|
+
* `unavailable` is reached only when the product opted into online-only startup via
|
|
940
|
+
* `onStorageUnavailable` (or when inspecting state after a thrown failure).
|
|
941
|
+
*/
|
|
942
|
+
type OfflineStorageState = {
|
|
943
|
+
readonly status: 'initializing';
|
|
944
|
+
} | {
|
|
945
|
+
readonly status: 'ready';
|
|
946
|
+
} | {
|
|
947
|
+
readonly status: 'unavailable';
|
|
948
|
+
readonly error: OfflineStorageUnavailableError;
|
|
949
|
+
};
|
|
950
|
+
/** Narrows an unknown failure to {@link OfflineStorageUnavailableError}. */
|
|
951
|
+
declare function isOfflineStorageUnavailableError(error: unknown): error is OfflineStorageUnavailableError;
|
|
952
|
+
|
|
836
953
|
/** User choice when logout encounters unconfirmed local mutations. */
|
|
837
954
|
type OfflineLogoutAction = 'sync' | 'discard' | 'cancel';
|
|
838
955
|
/** Options for {@link OfflineCoordinatorService.resumeRemoteSession}. */
|
|
@@ -842,10 +959,29 @@ interface OfflineResumeRemoteSessionOptions {
|
|
|
842
959
|
/** Coordinates local persistence, session boundaries, network state, and outbox synchronization. */
|
|
843
960
|
declare class OfflineCoordinatorService {
|
|
844
961
|
#private;
|
|
962
|
+
/**
|
|
963
|
+
* Local storage readiness after {@link initialize}.
|
|
964
|
+
*
|
|
965
|
+
* When `unavailable`, the product opted into online-only startup; replica/outbox APIs must not be used.
|
|
966
|
+
*/
|
|
967
|
+
readonly storageState: i0.Signal<OfflineStorageState>;
|
|
968
|
+
/**
|
|
969
|
+
* Product-policy guard: `true` only when encrypted local storage finished initialization successfully.
|
|
970
|
+
*
|
|
971
|
+
* Use this (or {@link storageState}) to disable offline mutations and replica reads when storage is unavailable.
|
|
972
|
+
*/
|
|
973
|
+
readonly isStorageReady: i0.Signal<boolean>;
|
|
845
974
|
readonly networkState: i0.Signal<_rdlabo_ionic_angular_kit_offline.OfflineNetworkState>;
|
|
846
975
|
readonly syncState: i0.Signal<_rdlabo_ionic_angular_kit_offline.OfflineSyncState>;
|
|
847
976
|
readonly pendingCount: i0.Signal<number>;
|
|
848
977
|
readonly conflicts: i0.Signal<_rdlabo_ionic_angular_kit_offline.OfflineCommand[]>;
|
|
978
|
+
/**
|
|
979
|
+
* Opens local storage, then session and sync.
|
|
980
|
+
*
|
|
981
|
+
* Repository failure without {@link OfflineKitOptions.onStorageUnavailable} throws
|
|
982
|
+
* {@link OfflineStorageUnavailableError}. When the callback is present and settles, this method
|
|
983
|
+
* resolves with {@link storageState} `unavailable` and skips session/sync initialization.
|
|
984
|
+
*/
|
|
849
985
|
initialize(): Promise<void>;
|
|
850
986
|
activateSession(userId: OfflinePrincipalId, scopeIds: readonly string[], authSubject: string | null): Promise<void>;
|
|
851
987
|
/** Installs a remotely verified identity without starting pull or outbox replay. */
|
|
@@ -955,8 +1091,35 @@ interface OfflineKitOptions {
|
|
|
955
1091
|
createEncryptionKey?: () => Promise<string>;
|
|
956
1092
|
/** Versioned product replica schema applied to native SQLite during initialization. */
|
|
957
1093
|
replicaSchema: OfflineReplicaSchemaBundle;
|
|
1094
|
+
/**
|
|
1095
|
+
* Product wire protocol fingerprint exchanged with the synchronization server.
|
|
1096
|
+
*
|
|
1097
|
+
* Keep this independent from {@link replicaSchema}: local-only tables and
|
|
1098
|
+
* storage migrations must not force a server rollout. When omitted, Kit uses
|
|
1099
|
+
* the replica schema fingerprint for backward compatibility.
|
|
1100
|
+
*/
|
|
1101
|
+
wireProtocol?: OfflineWireProtocolFingerprint;
|
|
958
1102
|
/** Optional durable Outbox backpressure policy. */
|
|
959
1103
|
outboxLimits?: OfflineOutboxLimits;
|
|
1104
|
+
/**
|
|
1105
|
+
* Optional product callback invoked when local storage initialization fails.
|
|
1106
|
+
*
|
|
1107
|
+
* Providing this callback opts the application into online-only startup degradation:
|
|
1108
|
+
* after the callback settles successfully, the app initializer completes with
|
|
1109
|
+
* {@link OfflineCoordinatorService.storageState} `unavailable` and session/sync are not started.
|
|
1110
|
+
* When omitted, initialization throws {@link OfflineStorageUnavailableError} as before.
|
|
1111
|
+
* If the callback throws or rejects, initialization still fails.
|
|
1112
|
+
*
|
|
1113
|
+
* Kit never deletes Outbox or replica data in response to storage failure; any reset is product-owned.
|
|
1114
|
+
*/
|
|
1115
|
+
onStorageUnavailable?: (error: OfflineStorageUnavailableError) => void | Promise<void>;
|
|
1116
|
+
}
|
|
1117
|
+
/** Exact versioned wire contract exchanged by pull transport. */
|
|
1118
|
+
interface OfflineWireProtocolFingerprint {
|
|
1119
|
+
/** Monotonic product wire protocol version. */
|
|
1120
|
+
readonly version: number;
|
|
1121
|
+
/** Deterministic fingerprint of the pull/push wire contract. */
|
|
1122
|
+
readonly hash: string;
|
|
960
1123
|
}
|
|
961
1124
|
/** DI token for product-independent offline persistence settings. */
|
|
962
1125
|
declare const OFFLINE_KIT_OPTIONS: InjectionToken<OfflineKitOptions>;
|
|
@@ -1204,6 +1367,15 @@ interface ProvideSynchronizedOfflineOptions extends ProvideOfflineOptionsBase {
|
|
|
1204
1367
|
commandExecutor: Type<OfflineCommandExecutor>;
|
|
1205
1368
|
/** Product transport for explicit cursor-based server delta pulls. */
|
|
1206
1369
|
replicaPuller: Type<OfflineReplicaPuller>;
|
|
1370
|
+
/**
|
|
1371
|
+
* Required pure adapter that rematerializes one aggregate from its
|
|
1372
|
+
* authoritative confirmed base/localOnly values and remaining Outbox intents.
|
|
1373
|
+
*
|
|
1374
|
+
* Kit calls it inside {@link OfflineReplicaMutationCoordinator} after enqueue,
|
|
1375
|
+
* replacement, discard, transport success, and pull acknowledgement. Do not
|
|
1376
|
+
* call the projector from product code.
|
|
1377
|
+
*/
|
|
1378
|
+
aggregateIntentProjector: Type<OfflineAggregateIntentProjector>;
|
|
1207
1379
|
}
|
|
1208
1380
|
/** Server- or external-source read cache with no mutation transport or Outbox. */
|
|
1209
1381
|
interface ProvideReadCacheOfflineOptions extends ProvideOfflineOptionsBase {
|
|
@@ -1222,6 +1394,9 @@ type ProvideOfflineOptions = ProvideSynchronizedOfflineOptions | ProvideReadCach
|
|
|
1222
1394
|
* Web uses Ionic Storage. Native iOS/Android uses encrypted `@capacitor-community/sqlite`. The application owns
|
|
1223
1395
|
* URL/DTO policy and command execution; the kit owns persistence, ordering, retries, and session
|
|
1224
1396
|
* isolation.
|
|
1397
|
+
*
|
|
1398
|
+
* Optional {@link OfflineKitOptions.onStorageUnavailable} opts into online-only startup when
|
|
1399
|
+
* local storage cannot be opened; without it, the app initializer still throws.
|
|
1225
1400
|
*/
|
|
1226
1401
|
declare function provideOffline(options: ProvideOfflineOptions): EnvironmentProviders;
|
|
1227
1402
|
/** Prevents unsupported multi-tab Web writes from silently losing Outbox state. */
|
|
@@ -1229,30 +1404,29 @@ declare function assertSupportedOfflineMode(platform: string, mode: 'synchronize
|
|
|
1229
1404
|
|
|
1230
1405
|
/** Aggregate synchronization state exposed to application UI. */
|
|
1231
1406
|
type OfflineSyncState = 'idle' | 'pending' | 'syncing' | 'attention';
|
|
1232
|
-
/** Mutation
|
|
1407
|
+
/** Mutation appended atomically to the outbox; Kit rematerializes optimistic replica state. */
|
|
1233
1408
|
interface EnqueueOfflineCommand<T = unknown> {
|
|
1234
1409
|
scopeId: string;
|
|
1235
1410
|
aggregateType: string;
|
|
1236
1411
|
identity: EnqueueOfflineCommandIdentity;
|
|
1237
1412
|
operation: string;
|
|
1238
1413
|
payload: T;
|
|
1239
|
-
/** Full local entity value committed to the replica before the command is exposed to the UI. */
|
|
1240
|
-
optimisticValue: unknown;
|
|
1241
1414
|
/**
|
|
1242
1415
|
* Optimistically hides an existing DB row while retaining its identity and
|
|
1243
1416
|
* confirmed baseline for durable replay, conflict handling, and discard.
|
|
1244
1417
|
*/
|
|
1245
1418
|
replicaMutation?: 'upsert' | 'delete';
|
|
1246
1419
|
baseRevision?: string | number | null;
|
|
1420
|
+
/** Declared localOnly projection rows this intent may create, update, or remove. */
|
|
1421
|
+
localOnlyFootprint?: readonly OfflineReplicaRowKey[];
|
|
1247
1422
|
}
|
|
1248
1423
|
/**
|
|
1249
1424
|
* A command prepared from replica reads while enqueue/ACK projection is
|
|
1250
|
-
* serialized.
|
|
1251
|
-
*
|
|
1425
|
+
* serialized. Kit rematerializes the aggregate; the prepare callback must not
|
|
1426
|
+
* supply replica row images as independent truth.
|
|
1252
1427
|
*/
|
|
1253
1428
|
interface PreparedOfflineCommand<T = unknown> {
|
|
1254
1429
|
request: EnqueueOfflineCommand<T>;
|
|
1255
|
-
replicaTransaction?: Pick<OfflineReplicaTransaction, 'putRows' | 'removeRows'>;
|
|
1256
1430
|
}
|
|
1257
1431
|
interface PreparedOfflineBatchOptions {
|
|
1258
1432
|
flush?: boolean;
|
|
@@ -1310,8 +1484,8 @@ declare class OfflineSyncService {
|
|
|
1310
1484
|
flush?: boolean;
|
|
1311
1485
|
}): Promise<string>;
|
|
1312
1486
|
/**
|
|
1313
|
-
* Reads, derives, and commits
|
|
1314
|
-
*
|
|
1487
|
+
* Reads, derives, and commits one Outbox command, then rematerializes its
|
|
1488
|
+
* aggregate from confirmed replica values plus remaining FIFO intents.
|
|
1315
1489
|
*/
|
|
1316
1490
|
enqueuePrepared<T>(prepare: (repository: OfflineRepository) => Promise<PreparedOfflineCommand<T>>, options?: {
|
|
1317
1491
|
flush?: boolean;
|
|
@@ -1376,5 +1550,5 @@ declare class OfflineRequestFallbackService {
|
|
|
1376
1550
|
static ɵprov: i0.ɵɵInjectableDeclaration<OfflineRequestFallbackService>;
|
|
1377
1551
|
}
|
|
1378
1552
|
|
|
1379
|
-
export { COMMUNITY_SQLITE, DEFAULT_OFFLINE_COMMAND_HOOKS, IonicOfflineRepository, OFFLINE_BYPASS, OFFLINE_COMMAND_EXECUTOR, OFFLINE_COMMAND_HOOKS, OFFLINE_KIT_OPTIONS, OFFLINE_MUTATION_REQUEST_POLICIES, OFFLINE_REPLICA_PROJECTOR, OFFLINE_REPLICA_PULLER, OFFLINE_REPOSITORY, OFFLINE_REQUEST_POLICIES, OFFLINE_RESPONSE_HEADER, OFFLINE_RETRY_RANDOM, OFFLINE_SCHEMA_VERSION, OFFLINE_SYNC_CONTEXT, OfflineCommandInFlightError, OfflineCoordinatorService, OfflineMutationPolicyConflictError, OfflineMutationProtocolError, OfflineMutationRequestPolicyRegistry, OfflineNetworkService, OfflineOutboxCapacityError, OfflinePayloadValidationError, OfflineReplicaMutationCoordinator, OfflineReplicaPullService, OfflineReplicaSchemaMismatchError, OfflineRequestFallbackService, OfflineRequestPolicyRegistry, OfflineSessionService, OfflineSyncService, SqliteOfflineRepository, assertOfflineLocalId, assertOfflineReplicaGeneratedRemoteId, assertOfflineReplicaNaturalKeyBaseline, assertSupportedOfflineMode, booleanColumn, canonicalOfflineCommandIdentity, canonicalOfflinePrincipalId, canonicalOfflineRemoteIdentity, canonicalOfflineReplicaIdentity, canonicalOfflineReplicaRowKey, commandIdentityFromReplicaIdentity, commandIdentityMatchesReplicaRow, createCommunitySqliteDriver, createOfflineAuthBridge, createRandomOfflineEncryptionKey, datetime, decodeOfflineReplicaValues, defineOfflineReplicaSchema, defineReplicaEntity, encodeOfflineReplicaValues, generatedId, ignored, integer, isOfflineFallbackError, json, localOnly, naturalKey, normalizeOfflineNaturalKey, normalizeOfflineReplicaPullPage, nullable, offlineCommandLookupIdentity, offlineCommandTargetFromReplicaRow, offlineGeneratedReplicaIdentity, offlineInterceptor, offlineNaturalKeyFromValues, offlineNaturalReplicaIdentity, offlineReplicaRemoteIdentity, offlineRetryDelayMs, offlineSessionManifestAllows, parseOfflineCommandIdentity, parseOfflineMutationEnvelope, parseOfflinePrincipalId, projectOfflineReplicaValues, provideOffline, provideOfflineMutationRequestPolicy, provideOfflineRequestPolicy, real, replicaAddressFromIdentity, requirePositiveOfflineInteger, selectOfflineRepository, serializeOfflineCommandIdentity, sha256OfflineReplicaSchema, supportsSynchronizedOfflineRepository, text };
|
|
1380
|
-
export type { CommunitySqliteConnection, CommunitySqliteDatabase, CommunitySqliteDriver, CreateOfflineAuthBridgeOptions, EnqueueOfflineCommand, EnqueueOfflineCommandIdentity, EnqueueOfflineGeneratedIdentity, EnqueueOfflineNaturalIdentity, OfflineAuthBridgeConfig, OfflineAuthExchangeContext, OfflineAuthExchangePhase, OfflineAuthResumeContext, OfflineCommand, OfflineCommandExecutor, OfflineCommandHooks, OfflineCommandIdentity, OfflineCommandResult, OfflineCommandState, OfflineCommandTarget, OfflineGeneratedRemoteId, OfflineKitOptions, OfflineLogoutAction, OfflineMutationEnvelope, OfflineMutationEnvelopeIdPolicy, OfflineMutationEnvelopeOptions, OfflineMutationEnvelopeValuesPolicy, OfflineMutationRequestPlan, OfflineMutationRequestPolicy, OfflineNaturalKey, OfflineNaturalKeyValue, OfflineNetworkState,
|
|
1553
|
+
export { COMMUNITY_SQLITE, DEFAULT_OFFLINE_COMMAND_HOOKS, IonicOfflineRepository, OFFLINE_AGGREGATE_INTENT_PROJECTOR, OFFLINE_BYPASS, OFFLINE_COMMAND_EXECUTOR, OFFLINE_COMMAND_HOOKS, OFFLINE_KIT_OPTIONS, OFFLINE_MUTATION_REQUEST_POLICIES, OFFLINE_REPLICA_PROJECTOR, OFFLINE_REPLICA_PULLER, OFFLINE_REPOSITORY, OFFLINE_REQUEST_POLICIES, OFFLINE_RESPONSE_HEADER, OFFLINE_RETRY_RANDOM, OFFLINE_SCHEMA_VERSION, OFFLINE_SYNC_CONTEXT, OfflineCommandInFlightError, OfflineCoordinatorService, OfflineMutationPolicyConflictError, OfflineMutationProtocolError, OfflineMutationRequestPolicyRegistry, OfflineNetworkService, OfflineOutboxCapacityError, OfflinePayloadValidationError, OfflineReplicaMutationCoordinator, OfflineReplicaPullService, OfflineReplicaSchemaMismatchError, OfflineRequestFallbackService, OfflineRequestPolicyRegistry, OfflineSessionService, OfflineStorageUnavailableError, OfflineSyncService, SqliteOfflineRepository, assertOfflineLocalId, assertOfflineReplicaGeneratedRemoteId, assertOfflineReplicaNaturalKeyBaseline, assertSupportedOfflineMode, booleanColumn, canonicalOfflineCommandIdentity, canonicalOfflinePrincipalId, canonicalOfflineRemoteIdentity, canonicalOfflineReplicaIdentity, canonicalOfflineReplicaRowKey, commandFootprintKeys, commandIdentityFromReplicaIdentity, commandIdentityMatchesReplicaRow, createCommunitySqliteDriver, createOfflineAuthBridge, createRandomOfflineEncryptionKey, datetime, decodeOfflineReplicaValues, defineOfflineReplicaSchema, defineReplicaEntity, encodeOfflineReplicaValues, generatedId, ignored, integer, isOfflineAggregateIntentConflict, isOfflineFallbackError, isOfflineStorageUnavailableError, json, localOnly, naturalKey, normalizeOfflineNaturalKey, normalizeOfflineReplicaPullPage, nullable, offlineAggregateIntentMutations, offlineCommandLookupIdentity, offlineCommandTargetFromReplicaRow, offlineGeneratedReplicaIdentity, offlineInterceptor, offlineNaturalKeyFromValues, offlineNaturalReplicaIdentity, offlineReplicaRemoteIdentity, offlineRetryDelayMs, offlineSessionManifestAllows, parseOfflineCommandIdentity, parseOfflineMutationEnvelope, parseOfflinePrincipalId, projectOfflineReplicaValues, provideOffline, provideOfflineMutationRequestPolicy, provideOfflineRequestPolicy, real, replicaAddressFromIdentity, requirePositiveOfflineInteger, selectOfflineRepository, serializeOfflineCommandIdentity, sha256OfflineReplicaSchema, supportsSynchronizedOfflineRepository, text };
|
|
1554
|
+
export type { CommunitySqliteConnection, CommunitySqliteDatabase, CommunitySqliteDriver, CreateOfflineAuthBridgeOptions, EnqueueOfflineCommand, EnqueueOfflineCommandIdentity, EnqueueOfflineGeneratedIdentity, EnqueueOfflineNaturalIdentity, OfflineAggregateIntentConflict, OfflineAggregateIntentProjectInput, OfflineAggregateIntentProjectResult, OfflineAggregateIntentProjection, OfflineAggregateIntentProjector, OfflineAuthBridgeConfig, OfflineAuthExchangeContext, OfflineAuthExchangePhase, OfflineAuthResumeContext, OfflineCommand, OfflineCommandExecutor, OfflineCommandHooks, OfflineCommandIdentity, OfflineCommandResult, OfflineCommandState, OfflineCommandTarget, OfflineGeneratedRemoteId, OfflineKitOptions, OfflineLogoutAction, OfflineMutationEnvelope, OfflineMutationEnvelopeIdPolicy, OfflineMutationEnvelopeOptions, OfflineMutationEnvelopeValuesPolicy, OfflineMutationRequestPlan, OfflineMutationRequestPolicy, OfflineNaturalKey, OfflineNaturalKeyValue, OfflineNetworkState, OfflineOutboxLimits, OfflinePrincipalId, OfflinePullAttention, OfflinePullAttentionReason, OfflineReadRequestPlan, OfflineReadResponseSource, OfflineReadStrategy, OfflineRemoteIdentity, OfflineReplicaAddress, OfflineReplicaChange, OfflineReplicaChangeBase, OfflineReplicaColumnDef, OfflineReplicaCursor, OfflineReplicaEntityDefinition, OfflineReplicaEntitySchema, OfflineReplicaEntityScope, OfflineReplicaFieldDescriptor, OfflineReplicaFieldPolicy, OfflineReplicaIdentity, OfflineReplicaIdentityDescriptor, OfflineReplicaIgnoredDef, OfflineReplicaLocalOnlyDef, OfflineReplicaMigration, OfflineReplicaMutation, OfflineReplicaNaturalKeyDef, OfflineReplicaProjector, OfflineReplicaPullPage, OfflineReplicaPullProjection, OfflineReplicaPullRequest, OfflineReplicaPuller, OfflineReplicaReconciliationTarget, OfflineReplicaRemoteIdDef, OfflineReplicaRemoteIdRelease, OfflineReplicaRemoteIdentity, OfflineReplicaRow, OfflineReplicaRowKey, OfflineReplicaSchemaBundle, OfflineReplicaSchemaDefinition, OfflineReplicaSqliteAffinity, OfflineReplicaStorageKind, OfflineReplicaSyncState, OfflineReplicaTransaction, OfflineReplicaVisibility, OfflineReplicaWebMigrationCallback, OfflineReplicaWebMigrationResult, OfflineReplicaWebMigrationRow, OfflineReplicaWireChange, OfflineReplicaWireIdentity, OfflineReplicaWirePullPage, OfflineRepository, OfflineRepositoryReader, OfflineRequestPlan, OfflineRequestPolicy, OfflineResponseSource, OfflineResumeRemoteSessionOptions, OfflineScope, OfflineSessionManifest, OfflineSessionTransitionLease, OfflineStorageState, OfflineStorageUnavailableReason, OfflineSyncContext, OfflineSyncSession, OfflineSyncState, OfflineWireProtocolFingerprint, PreparedOfflineBatchOptions, PreparedOfflineCommand, ProvideOfflineOptions, ProvideReadCacheOfflineOptions, ProvideSynchronizedOfflineOptions };
|