@rdlabo/ionic-angular-kit 21.5.36 → 21.5.38

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.
@@ -1762,7 +1762,11 @@ class OfflineReplicaPullService {
1762
1762
  async pull(scope) {
1763
1763
  if (this.#options.mode === 'readCacheOnly')
1764
1764
  return;
1765
- const schemaHash = await (this.#schemaHash ??= sha256OfflineReplicaSchema(this.#options.replicaSchema));
1765
+ const storageSchemaHash = await (this.#schemaHash ??= sha256OfflineReplicaSchema(this.#options.replicaSchema));
1766
+ const wireProtocol = this.#options.wireProtocol ?? {
1767
+ version: this.#options.replicaSchema.version,
1768
+ hash: storageSchemaHash,
1769
+ };
1766
1770
  let persistedCursor = (await this.#repository.getReplicaCursor(scope))?.cursor ?? '';
1767
1771
  let requestCursor = persistedCursor;
1768
1772
  let rebaselinePending = false;
@@ -1770,11 +1774,11 @@ class OfflineReplicaPullService {
1770
1774
  const page = await this.#puller.pull({
1771
1775
  scope,
1772
1776
  cursor: requestCursor,
1773
- schemaVersion: this.#options.replicaSchema.version,
1774
- schemaHash,
1777
+ schemaVersion: wireProtocol.version,
1778
+ schemaHash: wireProtocol.hash,
1775
1779
  });
1776
1780
  this.#assertPullPage(page);
1777
- this.#assertHandshake(page.schemaVersion, page.schemaHash, schemaHash);
1781
+ this.#assertHandshake(page.schemaVersion, page.schemaHash, wireProtocol);
1778
1782
  if (page.hasMore && page.nextCursor === requestCursor) {
1779
1783
  throw new Error(`Offline replica pull cursor did not advance for scope ${scope.userId}:${scope.scopeId}.`);
1780
1784
  }
@@ -2112,9 +2116,9 @@ class OfflineReplicaPullService {
2112
2116
  }
2113
2117
  }
2114
2118
  }
2115
- #assertHandshake(version, hash, expectedHash) {
2116
- if (version !== this.#options.replicaSchema.version || hash !== expectedHash) {
2117
- throw new OfflineReplicaSchemaMismatchError(this.#options.replicaSchema.version, expectedHash, version, hash);
2119
+ #assertHandshake(version, hash, expected) {
2120
+ if (version !== expected.version || hash !== expected.hash) {
2121
+ throw new OfflineReplicaSchemaMismatchError(expected.version, expected.hash, version, hash);
2118
2122
  }
2119
2123
  }
2120
2124
  #entitySchema(sourceKey) {
@@ -2478,6 +2482,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
2478
2482
  args: [{ providedIn: 'root' }]
2479
2483
  }] });
2480
2484
 
2485
+ /**
2486
+ * Local offline storage could not be opened or migrated without risking data loss.
2487
+ *
2488
+ * Prefer `instanceof` / {@link OfflineStorageUnavailableError.reason} over message text.
2489
+ * The original failure is preserved on {@link Error.cause}. Kit never deletes Outbox or
2490
+ * replica rows in response to this error; recovery is product-owned and explicit.
2491
+ */
2492
+ class OfflineStorageUnavailableError extends Error {
2493
+ /** Stable machine-readable discriminator for storage initialization failures. */
2494
+ static { this.code = 'OFFLINE_STORAGE_UNAVAILABLE'; }
2495
+ constructor(reason, message, options) {
2496
+ super(message, options);
2497
+ this.reason = reason;
2498
+ this.code = OfflineStorageUnavailableError.code;
2499
+ this.name = 'OfflineStorageUnavailableError';
2500
+ }
2501
+ }
2502
+ /** Narrows an unknown failure to {@link OfflineStorageUnavailableError}. */
2503
+ function isOfflineStorageUnavailableError(error) {
2504
+ return error instanceof OfflineStorageUnavailableError;
2505
+ }
2506
+
2481
2507
  /** Raised before persistence when an outbox payload is not losslessly JSON serializable. */
2482
2508
  class OfflinePayloadValidationError extends Error {
2483
2509
  constructor(message = 'Offline command payload must contain only JSON values') {
@@ -3567,7 +3593,7 @@ class OfflineSyncService {
3567
3593
  syncState: rebased.length > 0 ? 'pending' : 'confirmed',
3568
3594
  visibility: rebased.at(-1)?.replicaMutation === 'delete' ? 'pending_delete' : 'present',
3569
3595
  };
3570
- const companionTransaction = this.#companionTransactionAfterAcknowledgement(rebased);
3596
+ const companionTransaction = await this.#companionTransactionAfterAcknowledgement(command, rebased, result.confirmedCompanions);
3571
3597
  if (!this.#isCurrent(generation))
3572
3598
  return;
3573
3599
  await this.#repository.transactReplica({
@@ -3685,17 +3711,89 @@ class OfflineSyncService {
3685
3711
  return (this.#repository.getReplicaRowIncludingPendingDelete?.(scope, key.sourceKey, key.identity) ??
3686
3712
  this.#repository.getReplicaRow(scope, key.sourceKey, key.identity));
3687
3713
  }
3688
- #companionTransactionAfterAcknowledgement(following) {
3714
+ async #companionTransactionAfterAcknowledgement(acknowledged, following, confirmed) {
3689
3715
  const latest = new Map();
3690
3716
  for (const command of following) {
3691
3717
  for (const companion of command.optimisticCompanions ?? []) {
3692
3718
  latest.set(this.#replicaRowKey(companion.key), companion);
3693
3719
  }
3694
3720
  }
3695
- return {
3696
- putRows: [...latest.values()].flatMap((companion) => (companion.after ? [companion.after] : [])),
3697
- removeRows: [...latest.values()].flatMap((companion) => (companion.after ? [] : [companion.key])),
3698
- };
3721
+ // Exact legacy path: absent confirmedCompanions only reapplies later overlays as stored.
3722
+ if (confirmed === undefined) {
3723
+ return {
3724
+ putRows: [...latest.values()].flatMap((companion) => (companion.after ? [companion.after] : [])),
3725
+ removeRows: [...latest.values()].flatMap((companion) => (companion.after ? [] : [companion.key])),
3726
+ };
3727
+ }
3728
+ const footprint = new Set((acknowledged.optimisticCompanions ?? []).map((companion) => this.#replicaRowKey(companion.key)));
3729
+ const confirmedRows = new Map();
3730
+ const confirmedRemovals = new Map();
3731
+ const acknowledgedCompanions = new Map((acknowledged.optimisticCompanions ?? []).map((companion) => [this.#replicaRowKey(companion.key), companion]));
3732
+ for (const mutation of confirmed) {
3733
+ const key = this.#replicaRowKey(mutation.key);
3734
+ this.#assertConfirmedCompanionKey(footprint, key);
3735
+ if (confirmedRows.has(key) || confirmedRemovals.has(key)) {
3736
+ throw new Error(`Offline command result contains duplicate companion mutation ${key}.`);
3737
+ }
3738
+ const declared = acknowledgedCompanions.get(key);
3739
+ const current = await this.#getCompanionRow(mutation.key);
3740
+ const row = current ?? declared.before ?? declared.after;
3741
+ if (!row) {
3742
+ throw new Error(`Offline command result cannot resolve companion ${key}.`);
3743
+ }
3744
+ const latestConfirmed = current ? current.confirmedValues : (declared.before?.confirmedValues ?? null);
3745
+ const reduced = mutation.reduce(latestConfirmed);
3746
+ if (reduced === null) {
3747
+ confirmedRemovals.set(key, mutation.key);
3748
+ }
3749
+ else {
3750
+ confirmedRows.set(key, {
3751
+ ...row,
3752
+ values: reduced,
3753
+ confirmedValues: reduced,
3754
+ syncState: 'confirmed',
3755
+ visibility: 'present',
3756
+ });
3757
+ }
3758
+ }
3759
+ if (confirmedRows.size + confirmedRemovals.size !== footprint.size) {
3760
+ throw new Error('Offline command result must cover every optimistic companion exactly once.');
3761
+ }
3762
+ const keys = new Set([...confirmedRows.keys(), ...confirmedRemovals.keys(), ...latest.keys()]);
3763
+ const putRows = [];
3764
+ const removeRows = [];
3765
+ for (const key of keys) {
3766
+ const overlay = latest.get(key);
3767
+ const confirmedRow = confirmedRows.get(key);
3768
+ if (overlay) {
3769
+ if (overlay.after) {
3770
+ if (confirmedRow) {
3771
+ putRows.push({ ...overlay.after, confirmedValues: confirmedRow.confirmedValues });
3772
+ }
3773
+ else if (confirmedRemovals.has(key)) {
3774
+ putRows.push({ ...overlay.after, confirmedValues: null });
3775
+ }
3776
+ else {
3777
+ putRows.push(overlay.after);
3778
+ }
3779
+ }
3780
+ else {
3781
+ removeRows.push(overlay.key);
3782
+ }
3783
+ }
3784
+ else if (confirmedRow) {
3785
+ putRows.push(confirmedRow);
3786
+ }
3787
+ else {
3788
+ removeRows.push(confirmedRemovals.get(key));
3789
+ }
3790
+ }
3791
+ return { putRows, removeRows };
3792
+ }
3793
+ #assertConfirmedCompanionKey(footprint, key) {
3794
+ if (!footprint.has(key)) {
3795
+ throw new Error(`Offline command result changed undeclared companion ${key}.`);
3796
+ }
3699
3797
  }
3700
3798
  #companionsAfterDiscard(all, remaining) {
3701
3799
  const keys = new Map();
@@ -4084,8 +4182,22 @@ class OfflineCoordinatorService {
4084
4182
  this.#network = inject(OfflineNetworkService);
4085
4183
  this.#sync = inject(OfflineSyncService);
4086
4184
  this.#session = inject(OfflineSessionService);
4185
+ this.#options = inject(OFFLINE_KIT_OPTIONS);
4186
+ this.#storageState = signal({ status: 'initializing' }, ...(ngDevMode ? [{ debugName: "#storageState" }] : /* istanbul ignore next */ []));
4087
4187
  this.#transitionRevision = 0;
4088
4188
  this.#transitionTail = Promise.resolve();
4189
+ /**
4190
+ * Local storage readiness after {@link initialize}.
4191
+ *
4192
+ * When `unavailable`, the product opted into online-only startup; replica/outbox APIs must not be used.
4193
+ */
4194
+ this.storageState = this.#storageState.asReadonly();
4195
+ /**
4196
+ * Product-policy guard: `true` only when encrypted local storage finished initialization successfully.
4197
+ *
4198
+ * Use this (or {@link storageState}) to disable offline mutations and replica reads when storage is unavailable.
4199
+ */
4200
+ this.isStorageReady = computed(() => this.#storageState().status === 'ready', ...(ngDevMode ? [{ debugName: "isStorageReady" }] : /* istanbul ignore next */ []));
4089
4201
  this.networkState = this.#network.state;
4090
4202
  this.syncState = this.#sync.syncState;
4091
4203
  this.pendingCount = this.#sync.pendingCount;
@@ -4095,10 +4207,34 @@ class OfflineCoordinatorService {
4095
4207
  #network;
4096
4208
  #sync;
4097
4209
  #session;
4210
+ #options;
4211
+ #storageState;
4098
4212
  #transitionRevision;
4099
4213
  #transitionTail;
4214
+ /**
4215
+ * Opens local storage, then session and sync.
4216
+ *
4217
+ * Repository failure without {@link OfflineKitOptions.onStorageUnavailable} throws
4218
+ * {@link OfflineStorageUnavailableError}. When the callback is present and settles, this method
4219
+ * resolves with {@link storageState} `unavailable` and skips session/sync initialization.
4220
+ */
4100
4221
  async initialize() {
4101
- await Promise.all([this.#repository.initialize(), this.#network.initialize()]);
4222
+ const networkReady = this.#network.initialize();
4223
+ try {
4224
+ await this.#repository.initialize();
4225
+ }
4226
+ catch (error) {
4227
+ await networkReady;
4228
+ const typed = this.#asStorageUnavailable(error);
4229
+ this.#storageState.set({ status: 'unavailable', error: typed });
4230
+ const onUnavailable = this.#options.onStorageUnavailable;
4231
+ if (!onUnavailable)
4232
+ throw typed;
4233
+ await onUnavailable(typed);
4234
+ return;
4235
+ }
4236
+ await networkReady;
4237
+ this.#storageState.set({ status: 'ready' });
4102
4238
  await this.#session.initialize();
4103
4239
  await this.#sync.initialize();
4104
4240
  }
@@ -4109,6 +4245,8 @@ class OfflineCoordinatorService {
4109
4245
  }
4110
4246
  /** Installs a remotely verified identity without starting pull or outbox replay. */
4111
4247
  prepareRemoteSession(userId, scopeIds, authSubject, authLease) {
4248
+ if (this.#storageUnavailable())
4249
+ return Promise.resolve(true);
4112
4250
  const revision = ++this.#transitionRevision;
4113
4251
  const lease = this.#lease(revision, authLease);
4114
4252
  return this.#enqueueTransition(async () => {
@@ -4121,12 +4259,16 @@ class OfflineCoordinatorService {
4121
4259
  }
4122
4260
  /** Starts pull and outbox replay after the caller has published remote access. */
4123
4261
  async resumeRemoteSession(options) {
4262
+ if (this.#storageUnavailable())
4263
+ return;
4124
4264
  await this.#sync.refreshSession(options?.foregroundScopeIds);
4125
4265
  }
4126
4266
  /**
4127
4267
  * Activates a restored identity for local replica/outbox use without enabling transport sync.
4128
4268
  */
4129
4269
  activateOfflineSession(authSubject, authLease) {
4270
+ if (this.#storageUnavailable())
4271
+ return Promise.resolve(null);
4130
4272
  const revision = ++this.#transitionRevision;
4131
4273
  const lease = this.#lease(revision, authLease);
4132
4274
  return this.#enqueueTransition(async () => {
@@ -4140,6 +4282,8 @@ class OfflineCoordinatorService {
4140
4282
  });
4141
4283
  }
4142
4284
  clearActiveSession() {
4285
+ if (this.#storageUnavailable())
4286
+ return Promise.resolve();
4143
4287
  this.#sync.revokeSession();
4144
4288
  this.#session.revokeAccess();
4145
4289
  ++this.#transitionRevision;
@@ -4149,6 +4293,8 @@ class OfflineCoordinatorService {
4149
4293
  });
4150
4294
  }
4151
4295
  async prepareLogout(action) {
4296
+ if (this.#storageUnavailable())
4297
+ return action !== 'cancel';
4152
4298
  if (action === 'cancel')
4153
4299
  return false;
4154
4300
  if (action === 'discard') {
@@ -4159,8 +4305,21 @@ class OfflineCoordinatorService {
4159
4305
  return this.#sync.pendingCount() === 0;
4160
4306
  }
4161
4307
  flush() {
4308
+ if (this.#storageUnavailable())
4309
+ return Promise.resolve();
4162
4310
  return this.#sync.flush();
4163
4311
  }
4312
+ #asStorageUnavailable(error) {
4313
+ if (error instanceof OfflineStorageUnavailableError)
4314
+ return error;
4315
+ const message = error instanceof Error ? error.message : 'Offline storage is unavailable.';
4316
+ return new OfflineStorageUnavailableError('storage_unavailable', message || 'Offline storage is unavailable.', {
4317
+ cause: error,
4318
+ });
4319
+ }
4320
+ #storageUnavailable() {
4321
+ return this.#storageState().status === 'unavailable';
4322
+ }
4164
4323
  #lease(revision, authLease) {
4165
4324
  return { isCurrent: () => revision === this.#transitionRevision && (authLease?.isCurrent() ?? true) };
4166
4325
  }
@@ -4732,39 +4891,45 @@ class SqliteOfflineRepository {
4732
4891
  });
4733
4892
  }
4734
4893
  async #open() {
4735
- if (!this.#sqlite)
4736
- throw new Error('Native offline storage requires a community SQLite connection');
4737
- const { databaseId } = await this.#sqlite.open({
4738
- databaseName: this.#options.databaseName,
4739
- createEncryptionKey: this.#options.createEncryptionKey,
4740
- });
4741
- this.#databaseId = databaseId;
4742
- for (const statement of SCHEMA)
4743
- await this.#execute(databaseId, statement);
4744
- const commandColumns = await this.#queryDatabase(databaseId, 'PRAGMA table_info(offline_sync_commands)');
4745
- if (!commandColumns.some((row) => row['name'] === 'optimistic_companions_json')) {
4746
- await this.#execute(databaseId, 'ALTER TABLE offline_sync_commands ADD COLUMN optimistic_companions_json TEXT');
4747
- }
4748
- if (!commandColumns.some((row) => row['name'] === 'server_commit_unknown')) {
4749
- await this.#execute(databaseId, 'ALTER TABLE offline_sync_commands ADD COLUMN server_commit_unknown INTEGER NOT NULL DEFAULT 0');
4750
- await this.#execute(databaseId, `UPDATE offline_sync_commands SET server_commit_unknown = 1
4894
+ try {
4895
+ if (!this.#sqlite) {
4896
+ throw new OfflineStorageUnavailableError('storage_unavailable', 'Native offline storage requires a community SQLite connection');
4897
+ }
4898
+ const { databaseId } = await this.#sqlite.open({
4899
+ databaseName: this.#options.databaseName,
4900
+ createEncryptionKey: this.#wrapCreateEncryptionKey(this.#options.createEncryptionKey),
4901
+ });
4902
+ this.#databaseId = databaseId;
4903
+ for (const statement of SCHEMA)
4904
+ await this.#execute(databaseId, statement);
4905
+ const commandColumns = await this.#queryDatabase(databaseId, 'PRAGMA table_info(offline_sync_commands)');
4906
+ if (!commandColumns.some((row) => row['name'] === 'optimistic_companions_json')) {
4907
+ await this.#execute(databaseId, 'ALTER TABLE offline_sync_commands ADD COLUMN optimistic_companions_json TEXT');
4908
+ }
4909
+ if (!commandColumns.some((row) => row['name'] === 'server_commit_unknown')) {
4910
+ await this.#execute(databaseId, 'ALTER TABLE offline_sync_commands ADD COLUMN server_commit_unknown INTEGER NOT NULL DEFAULT 0');
4911
+ await this.#execute(databaseId, `UPDATE offline_sync_commands SET server_commit_unknown = 1
4751
4912
  WHERE state IN ('sending', 'retry_wait')
4752
4913
  OR (attempts >= 2 AND state IN ('blocked_auth', 'conflict', 'rejected'))`);
4753
- }
4754
- const metadata = await this.#queryDatabase(databaseId, 'SELECT schema_version FROM offline_metadata WHERE id = 1');
4755
- if (metadata.length === 0) {
4756
- await this.#execute(databaseId, 'INSERT INTO offline_metadata (id, schema_version, last_user_id) VALUES (1, ?, NULL)', [
4757
- OFFLINE_SCHEMA_VERSION,
4758
- ]);
4759
- }
4760
- else {
4761
- const storedVersion = this.#number(metadata[0]['schema_version']);
4762
- if (storedVersion !== OFFLINE_SCHEMA_VERSION) {
4763
- throw new Error(`Unsupported offline storage schema version ${storedVersion}; expected ${OFFLINE_SCHEMA_VERSION}. ` +
4764
- 'A lossless core schema migration is required before this database can be opened.');
4765
4914
  }
4915
+ const metadata = await this.#queryDatabase(databaseId, 'SELECT schema_version FROM offline_metadata WHERE id = 1');
4916
+ if (metadata.length === 0) {
4917
+ await this.#execute(databaseId, 'INSERT INTO offline_metadata (id, schema_version, last_user_id) VALUES (1, ?, NULL)', [
4918
+ OFFLINE_SCHEMA_VERSION,
4919
+ ]);
4920
+ }
4921
+ else {
4922
+ const storedVersion = this.#number(metadata[0]['schema_version']);
4923
+ if (storedVersion !== OFFLINE_SCHEMA_VERSION) {
4924
+ throw new OfflineStorageUnavailableError('core_schema_incompatible', `Unsupported offline storage schema version ${storedVersion}; expected ${OFFLINE_SCHEMA_VERSION}. ` +
4925
+ 'A lossless core schema migration is required before this database can be opened.');
4926
+ }
4927
+ }
4928
+ await this.#initializeReplicaSchema(databaseId);
4929
+ }
4930
+ catch (error) {
4931
+ throw this.#mapInitializationError(error);
4766
4932
  }
4767
- await this.#initializeReplicaSchema(databaseId);
4768
4933
  }
4769
4934
  async #initializeReplicaSchema(databaseId) {
4770
4935
  const bundle = this.#options.replicaSchema;
@@ -4784,16 +4949,16 @@ class SqliteOfflineRepository {
4784
4949
  return;
4785
4950
  }
4786
4951
  if (storedVersion === targetVersion) {
4787
- throw new Error(`Offline replica schema hash mismatch at version ${targetVersion}. Reinstall the application or bump replicaSchema.version after intentional schema changes.`);
4952
+ throw new OfflineStorageUnavailableError('replica_schema_mismatch', `Offline replica schema hash mismatch at version ${targetVersion}. Reinstall the application or bump replicaSchema.version after intentional schema changes.`);
4788
4953
  }
4789
4954
  if (storedVersion > targetVersion) {
4790
- throw new Error(`Offline replica schema version ${storedVersion} is newer than application version ${targetVersion}. Upgrade the application before opening this database.`);
4955
+ throw new OfflineStorageUnavailableError('replica_schema_mismatch', `Offline replica schema version ${storedVersion} is newer than application version ${targetVersion}. Upgrade the application before opening this database.`);
4791
4956
  }
4792
4957
  await this.#nativeTransaction(databaseId, async () => {
4793
4958
  for (let version = storedVersion; version < targetVersion; version++) {
4794
4959
  const migration = bundle.migrations.find((candidate) => candidate.fromVersion === version);
4795
4960
  if (!migration) {
4796
- throw new Error(`Missing offline replica schema migration from version ${version} to ${version + 1}.`);
4961
+ throw new OfflineStorageUnavailableError('migration_missing', `Missing offline replica schema migration from version ${version} to ${version + 1}.`);
4797
4962
  }
4798
4963
  for (const statement of migration.statements) {
4799
4964
  await this.#execute(databaseId, statement);
@@ -4803,6 +4968,35 @@ class SqliteOfflineRepository {
4803
4968
  await this.#upsertReplicaSchemaMetadata(databaseId, targetVersion, targetHash);
4804
4969
  });
4805
4970
  }
4971
+ #wrapCreateEncryptionKey(createEncryptionKey) {
4972
+ if (!createEncryptionKey)
4973
+ return undefined;
4974
+ return async () => {
4975
+ try {
4976
+ const encryptionKey = await createEncryptionKey();
4977
+ if (!encryptionKey) {
4978
+ throw new OfflineStorageUnavailableError('encryption_key_unavailable', 'Native offline storage requires a non-empty encryption key on first open');
4979
+ }
4980
+ return encryptionKey;
4981
+ }
4982
+ catch (error) {
4983
+ if (error instanceof OfflineStorageUnavailableError)
4984
+ throw error;
4985
+ throw new OfflineStorageUnavailableError('encryption_key_unavailable', error instanceof Error ? error.message : 'Offline encryption key is unavailable.', { cause: error });
4986
+ }
4987
+ };
4988
+ }
4989
+ #mapInitializationError(error) {
4990
+ if (error instanceof OfflineStorageUnavailableError)
4991
+ return error;
4992
+ const message = error instanceof Error ? error.message : 'Offline storage is unavailable.';
4993
+ if (message.includes('non-empty encryption key on first open')) {
4994
+ return new OfflineStorageUnavailableError('encryption_key_unavailable', message, { cause: error });
4995
+ }
4996
+ return new OfflineStorageUnavailableError('storage_unavailable', message || 'Offline storage is unavailable.', {
4997
+ cause: error,
4998
+ });
4999
+ }
4806
5000
  async #executeReplicaCreateStatements(databaseId, bundle) {
4807
5001
  for (const entity of bundle.entities) {
4808
5002
  for (const statement of entity.createTableSql) {
@@ -5405,6 +5599,9 @@ const READ_CACHE_ONLY_REPLICA_PULLER = {
5405
5599
  * Web uses Ionic Storage. Native iOS/Android uses encrypted `@capacitor-community/sqlite`. The application owns
5406
5600
  * URL/DTO policy and command execution; the kit owns persistence, ordering, retries, and session
5407
5601
  * isolation.
5602
+ *
5603
+ * Optional {@link OfflineKitOptions.onStorageUnavailable} opts into online-only startup when
5604
+ * local storage cannot be opened; without it, the app initializer still throws.
5408
5605
  */
5409
5606
  function provideOffline(options) {
5410
5607
  const synchronized = options.mode !== 'readCacheOnly';
@@ -5417,7 +5614,9 @@ function provideOffline(options) {
5417
5614
  databaseName: options.databaseName,
5418
5615
  createEncryptionKey: options.createEncryptionKey,
5419
5616
  replicaSchema: options.replicaSchema,
5617
+ wireProtocol: options.wireProtocol,
5420
5618
  outboxLimits: options.outboxLimits,
5619
+ onStorageUnavailable: options.onStorageUnavailable,
5421
5620
  },
5422
5621
  },
5423
5622
  {
@@ -5575,5 +5774,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
5575
5774
  * Generated bundle index. Do not edit.
5576
5775
  */
5577
5776
 
5578
- 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 };
5777
+ 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, OfflineStorageUnavailableError, 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, isOfflineStorageUnavailableError, 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 };
5579
5778
  //# sourceMappingURL=rdlabo-ionic-angular-kit-offline.mjs.map