@rdlabo/ionic-angular-kit 21.5.38 → 21.5.40

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,24 @@ 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: update the replica immediately → append an outbox command in the same transaction → render
574
- the optimistic value → replay in the background → validate the server revision → store the confirmed value and
575
- revision. The server remains authoritative; SQLite is the durable local working database, not an HTTP response cache.
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 an immutable payload plus Kit-owned metadata (`baseRevision`, state, footprint keys). Kit updates
582
+ only `baseRevision` when a newer server revision is known, and sets it to `null` after a generated remote identity is
583
+ released; the product executor always receives the original payload. Optimistic snapshots and companion before/after
584
+ images are not durable truth.
576
585
 
577
586
  When an API response is assembled from a base replica row plus product-owned local-only view rows, use
578
587
  `enqueuePrepared()`. Its callback runs inside the shared replica mutation lane, so every read used to derive the
579
- optimistic projection happens after earlier enqueue/ACK/pull applies. The base optimistic row, companion rows, and
580
- Outbox command are then committed by one `transactReplica()` call. Preparation failure, invalid cross-scope rows,
581
- duplicate row keys, non-JSON values, or an attempt to mutate commands/cursors leaves durable state unchanged.
588
+ payload happens after earlier enqueue/ACK/pull applies. Kit then rematerializes the aggregate and commits the
589
+ Outbox command with that projection in one `transactReplica()` call. Preparation failure, invalid footprint keys,
590
+ non-JSON values, or an attempt to mutate commands/cursors leaves durable state unchanged.
582
591
 
583
592
  ```ts
584
593
  await offlineSync.enqueuePrepared(async (repository) => {
@@ -590,9 +599,8 @@ await offlineSync.enqueuePrepared(async (repository) => {
590
599
  identity: { kind: 'generated', localId: row.identity.localId },
591
600
  operation: 'items.rename',
592
601
  payload: { title },
593
- optimisticValue: { ...row.values, title },
602
+ localOnlyFootprint: [viewKey(scope, view)],
594
603
  },
595
- replicaTransaction: { putRows: [buildProductViewRow(scope, { ...view, title })] },
596
604
  };
597
605
  });
598
606
  ```
@@ -624,7 +632,6 @@ await offlineSync.enqueue({
624
632
  },
625
633
  operation: 'favorite.delete',
626
634
  payload: { favTo: favorite.values.favTo },
627
- optimisticValue: favorite.values,
628
635
  baseRevision: favorite.serverRevision,
629
636
  replicaMutation: 'delete',
630
637
  });
@@ -654,7 +661,6 @@ await offlineSync.enqueue({
654
661
  identity: { kind: 'generated', localId, remoteId: existingApiItem.id },
655
662
  operation: 'items.delete',
656
663
  payload: { method: 'DELETE' },
657
- optimisticValue: existingApiItem,
658
664
  });
659
665
  ```
660
666
 
@@ -765,6 +771,7 @@ provideOffline({
765
771
  replicaSchema,
766
772
  replicaPuller: ProductReplicaPuller,
767
773
  commandExecutor: ProductCommandExecutor,
774
+ aggregateIntentProjector: ProductAggregateIntentProjector,
768
775
  // ...request policies, databaseName, createEncryptionKey
769
776
  });
770
777