@rdlabo/ionic-angular-kit 21.6.1 → 21.6.2

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
@@ -495,6 +495,43 @@ provideOffline({
495
495
  });
496
496
  ```
497
497
 
498
+ Products may make durable mutation saving device-configurable without disabling replica reads. Supply only the
499
+ durable preference adapter; Kit owns the concurrency-sensitive transition. It starts admission closed while loading,
500
+ gates every `enqueue` / `enqueuePrepared` / `enqueuePreparedBatch`, and routes matched HTTP writes to normal transport
501
+ while disabled. Disabling closes admission synchronously, waits for already accepted commits, flushes pending
502
+ commands, verifies an empty Outbox, and then persists `false`. A failed transition restores the last successfully
503
+ persisted state. Replacement and discard APIs remain available because they resolve existing commands rather than
504
+ create additional pending work.
505
+
506
+ ```ts
507
+ @Injectable({ providedIn: 'root' })
508
+ class ProductMutationPersistenceAdapter implements OfflineMutationPersistenceAdapter {
509
+ readonly #settings = inject(ProductSettingsService);
510
+
511
+ loadEnabled(): Promise<boolean | null> {
512
+ return this.#settings.get('offlineMutationPersistence');
513
+ }
514
+
515
+ saveEnabled(enabled: boolean): Promise<void> {
516
+ return this.#settings.set('offlineMutationPersistence', enabled);
517
+ }
518
+ }
519
+
520
+ provideOffline({
521
+ // repository/schema/executor/puller options omitted
522
+ mutationPersistence: {
523
+ adapter: ProductMutationPersistenceAdapter,
524
+ defaultEnabled: true,
525
+ },
526
+ });
527
+
528
+ const offline = inject(OfflineCoordinatorService);
529
+ await offline.mutationPersistence.setEnabled(false);
530
+ ```
531
+
532
+ The product owns settings UI, labels, confirmation copy, and the storage key. Omitting `mutationPersistence` keeps
533
+ the historical always-enabled behavior. `readCacheOnly` applications do not expose this setting.
534
+
498
535
  The native offline runtime uses `@capacitor-community/sqlite` on iOS and Android. Install the plugin in the app and
499
536
  sync native projects:
500
537
 
@@ -551,6 +588,34 @@ provideOffline({
551
588
  });
552
589
  ```
553
590
 
591
+ An explicit user-requested local reset must run before Angular and Kit initialize SQLite. Use the cold-start helpers
592
+ instead of reproducing the community plugin's encrypted connection lifecycle in every application. Kit never invokes
593
+ reset automatically after a storage error. The product must show destructive confirmation first and owns the marker key.
594
+ Only databases that use Kit's same encrypted secret-mode, connection-version-1, read/write lifecycle belong in
595
+ `kitCompatibleDatabaseNames`; delete differently configured databases and files in `additionalCleanup`. The marker is
596
+ removed only after every database and product cleanup succeeds, so a partial failure is retried on the next cold launch.
597
+
598
+ ```ts
599
+ // Settings action
600
+ await requestOfflineLocalReset({
601
+ markerStore: Preferences,
602
+ markerKey: 'product:offline:reset',
603
+ });
604
+
605
+ // main.ts, before bootstrapApplication(...). Report reset failure but always continue startup.
606
+ await recoverOfflineLocalReset({
607
+ markerStore: Preferences,
608
+ markerKey: 'product:offline:reset',
609
+ sqliteConnection,
610
+ kitCompatibleDatabaseNames: ['product-offline', 'product-offline-media'],
611
+ additionalCleanup: removeOfflineMediaFiles,
612
+ }).catch((error: unknown) => {
613
+ console.error('Offline local reset failed; it will retry on the next launch.', error);
614
+ });
615
+
616
+ await bootstrapApplication(AppComponent, appConfig);
617
+ ```
618
+
554
619
  Replica identity follows the product database:
555
620
 
556
621
  | Identity declaration | SQLite primary key | Row / executor identity |