@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/README.md
CHANGED
|
@@ -570,15 +570,22 @@ through unchanged: values that the server considers equal must first be canonica
|
|
|
570
570
|
`OfflineScope.userId` accepts `number | string`. A type-tagged TEXT codec keeps numeric `7` and text `"7"` in
|
|
571
571
|
different metadata, manifest, cursor, Outbox, and entity boundaries.
|
|
572
572
|
|
|
573
|
-
The write lifecycle is:
|
|
574
|
-
|
|
575
|
-
|
|
573
|
+
The write lifecycle is: persist the immutable Outbox command → rematerialize the aggregate from confirmed
|
|
574
|
+
base/localOnly values plus remaining FIFO intents → render that optimistic projection → replay in the background →
|
|
575
|
+
keep the transported command until pull acknowledges `commandId` → rematerialize again from the new confirmed
|
|
576
|
+
baseline. The server remains authoritative; SQLite is the durable local working database, not an HTTP response cache.
|
|
577
|
+
|
|
578
|
+
Synchronized mode requires `aggregateIntentProjector`. Kit calls it inside `OfflineReplicaMutationCoordinator` after
|
|
579
|
+
enqueue, batch enqueue, replacement, discard, transport success, and pull acknowledgement. The adapter must derive
|
|
580
|
+
only from authoritative confirmed values plus the complete remaining intent chain. Do not call it from product code.
|
|
581
|
+
Commands persist payload/metadata and declared `localOnlyFootprint` keys only; optimistic snapshots and companion
|
|
582
|
+
before/after images are not durable truth.
|
|
576
583
|
|
|
577
584
|
When an API response is assembled from a base replica row plus product-owned local-only view rows, use
|
|
578
585
|
`enqueuePrepared()`. Its callback runs inside the shared replica mutation lane, so every read used to derive the
|
|
579
|
-
|
|
580
|
-
Outbox command
|
|
581
|
-
|
|
586
|
+
payload happens after earlier enqueue/ACK/pull applies. Kit then rematerializes the aggregate and commits the
|
|
587
|
+
Outbox command with that projection in one `transactReplica()` call. Preparation failure, invalid footprint keys,
|
|
588
|
+
non-JSON values, or an attempt to mutate commands/cursors leaves durable state unchanged.
|
|
582
589
|
|
|
583
590
|
```ts
|
|
584
591
|
await offlineSync.enqueuePrepared(async (repository) => {
|
|
@@ -590,9 +597,8 @@ await offlineSync.enqueuePrepared(async (repository) => {
|
|
|
590
597
|
identity: { kind: 'generated', localId: row.identity.localId },
|
|
591
598
|
operation: 'items.rename',
|
|
592
599
|
payload: { title },
|
|
593
|
-
|
|
600
|
+
localOnlyFootprint: [viewKey(scope, view)],
|
|
594
601
|
},
|
|
595
|
-
replicaTransaction: { putRows: [buildProductViewRow(scope, { ...view, title })] },
|
|
596
602
|
};
|
|
597
603
|
});
|
|
598
604
|
```
|
|
@@ -624,7 +630,6 @@ await offlineSync.enqueue({
|
|
|
624
630
|
},
|
|
625
631
|
operation: 'favorite.delete',
|
|
626
632
|
payload: { favTo: favorite.values.favTo },
|
|
627
|
-
optimisticValue: favorite.values,
|
|
628
633
|
baseRevision: favorite.serverRevision,
|
|
629
634
|
replicaMutation: 'delete',
|
|
630
635
|
});
|
|
@@ -654,7 +659,6 @@ await offlineSync.enqueue({
|
|
|
654
659
|
identity: { kind: 'generated', localId, remoteId: existingApiItem.id },
|
|
655
660
|
operation: 'items.delete',
|
|
656
661
|
payload: { method: 'DELETE' },
|
|
657
|
-
optimisticValue: existingApiItem,
|
|
658
662
|
});
|
|
659
663
|
```
|
|
660
664
|
|
|
@@ -765,6 +769,7 @@ provideOffline({
|
|
|
765
769
|
replicaSchema,
|
|
766
770
|
replicaPuller: ProductReplicaPuller,
|
|
767
771
|
commandExecutor: ProductCommandExecutor,
|
|
772
|
+
aggregateIntentProjector: ProductAggregateIntentProjector,
|
|
768
773
|
// ...request policies, databaseName, createEncryptionKey
|
|
769
774
|
});
|
|
770
775
|
|