@rdlabo/ionic-angular-kit 21.6.10 → 21.7.0
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 +31 -1321
- package/docs/auth-http.md +36 -0
- package/docs/offline-realtime.md +36 -0
- package/docs/optional-features.md +31 -0
- package/docs/storage-overlays.md +52 -0
- package/fesm2022/rdlabo-ionic-angular-kit-offline.mjs +121 -36
- package/fesm2022/rdlabo-ionic-angular-kit-offline.mjs.map +1 -1
- package/fesm2022/rdlabo-ionic-angular-kit-printer.mjs +43 -82
- package/fesm2022/rdlabo-ionic-angular-kit-printer.mjs.map +1 -1
- package/package.json +1 -1
- package/types/rdlabo-ionic-angular-kit-offline.d.ts +85 -28
- package/types/rdlabo-ionic-angular-kit-printer.d.ts +23 -9
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## Access capability
|
|
2
|
+
|
|
3
|
+
`provideKitAuth()` configures functional route guards for `user`, `confirm`, `required`, `anonymous`, and `unavailable` authentication states. Redirect routes and application side effects remain in the app.
|
|
4
|
+
|
|
5
|
+
`KitAuthAccessService` publishes what the current session may do:
|
|
6
|
+
|
|
7
|
+
| Mode | Local replica and outbox | Authenticated HTTP, realtime, and sync |
|
|
8
|
+
| -------- | ------------------------ | -------------------------------------- |
|
|
9
|
+
| `none` | Blocked | Blocked |
|
|
10
|
+
| `local` | Allowed | Blocked |
|
|
11
|
+
| `remote` | Allowed | Allowed |
|
|
12
|
+
|
|
13
|
+
An authoritative `required` result is signed out and must not become offline access. Only an `unavailable` transport result may activate a previously verified local session.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
provideKitAuth(() => ({
|
|
17
|
+
authState: () => inject(AuthService).state$,
|
|
18
|
+
redirects: {
|
|
19
|
+
whenAuthorized: '/home',
|
|
20
|
+
whenConfirming: '/auth/confirm',
|
|
21
|
+
whenNotConfirming: '/auth/signin',
|
|
22
|
+
whenUnauthorized: '/auth',
|
|
23
|
+
},
|
|
24
|
+
isUnavailableError: (error) => isOfflineFallbackError(error),
|
|
25
|
+
}));
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Use `kitRequiredUnauthorizedGuard`, `kitRequireConfirmingGuard`, and `kitRequireAuthorizedGuard` in route definitions. A protected asynchronous decision suspends previously published remote capability until the current authorization lease succeeds.
|
|
29
|
+
|
|
30
|
+
## HTTP policy
|
|
31
|
+
|
|
32
|
+
`provideKitHttp()` configures `kitAuthInterceptor` for credential injection, bypass rules, transient failure handling, and application error hooks.
|
|
33
|
+
|
|
34
|
+
Automatic retry is limited to `GET`, `HEAD`, `OPTIONS`, or requests carrying an `Idempotency-Key`. Ordinary writes are never retried automatically. Retries cover transient statuses `0`, `408`, `429`, `502`, `503`, and `504`, and honor `Retry-After`.
|
|
35
|
+
|
|
36
|
+
When offline support is enabled, register `offlineInterceptor` before `kitAuthInterceptor`. Local mode then prevents credential generation and network transport while allowing a matched read policy to serve the scoped replica.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## Scoped offline runtime
|
|
2
|
+
|
|
3
|
+
The `/offline` entry point provides a user- and partition-scoped local replica, durable outbox, cursor-based delta pull, aggregate-ordered replay, optimistic mutation policies, and request-policy interception.
|
|
4
|
+
|
|
5
|
+
Use `mode: 'readCacheOnly'` for external-source or HTTP caches. Synchronized mode uses encrypted `@capacitor-community/sqlite` on iOS and Android; it fails fast on the web because the current runtime has no cross-tab synchronization lock.
|
|
6
|
+
|
|
7
|
+
Cold-start offline access restores only a manifest bound to a non-null authentication-provider subject. Remote work follows this order:
|
|
8
|
+
|
|
9
|
+
1. Prepare the verified remote session.
|
|
10
|
+
2. Publish `remote` access.
|
|
11
|
+
3. Resume pull, outbox replay, and realtime work.
|
|
12
|
+
|
|
13
|
+
`createOfflineAuthBridge()` connects this ordering to `provideKitAuth()` while leaving consent, error UI, and credential exchange in the app.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createOfflineAuthBridge, isOfflineFallbackError } from '@rdlabo/ionic-angular-kit/offline';
|
|
17
|
+
|
|
18
|
+
provideKitAuth(() => ({
|
|
19
|
+
authState: () => auth.state$,
|
|
20
|
+
...createOfflineAuthBridge({
|
|
21
|
+
exchange: async (context) => exchangeCredential(context),
|
|
22
|
+
currentAuthSubject: () => auth.currentSubject(),
|
|
23
|
+
isUnavailableError,
|
|
24
|
+
availability: () => auth.authorityAvailable$,
|
|
25
|
+
}),
|
|
26
|
+
redirects,
|
|
27
|
+
}));
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
On explicit sign-out, clear `KitAuthAccessService` first, then await offline session cleanup so in-flight leases are invalidated before persisted user data is removed.
|
|
31
|
+
|
|
32
|
+
## Realtime connection
|
|
33
|
+
|
|
34
|
+
Subclass `KitRealtimeConnection` to supply connection intent and `{ url, protocols }` targets. The kit owns foreground and network suspension, target-scoped reconnect, exponential backoff, ping/pong detection, self-echo annotation, and `reconnected$` resync signaling.
|
|
35
|
+
|
|
36
|
+
Use `kitRealtimeProtocols()` to carry authentication and the stable `KIT_REALTIME_CLIENT_ID` in WebSocket subprotocols instead of URL parameters. Offline-capable authenticated clients set `requireRemoteAccess: true`; sockets then remain closed in `none` and `local` modes.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Optional features use secondary entry points so their native plugins and SDKs do not enter applications that do not use them.
|
|
2
|
+
|
|
3
|
+
## Theme and review
|
|
4
|
+
|
|
5
|
+
`provideKitTheme()` and `KitThemeController` persist a user preference, follow `prefers-color-scheme` until overridden, toggle app-provided palette classes, and synchronize the Android status bar.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
provideKitTheme({
|
|
9
|
+
storageKey: 'theme',
|
|
10
|
+
darkClasses: ['ion-palette-dark'],
|
|
11
|
+
lightClasses: ['ion-palette-light'],
|
|
12
|
+
});
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Import `kitRequestReview()` from `/review` to request the native review dialog at most once per application-defined window. It is a no-op on the web.
|
|
16
|
+
|
|
17
|
+
## Printer
|
|
18
|
+
|
|
19
|
+
The `/printer` entry point contains pure helpers for DOM-to-PNG rendering, image rotation, Brother print settings, multi-page label layout, and PDF generation. The consuming app owns paper-selection UI, loading overlays, storage, transport, and copy policy.
|
|
20
|
+
|
|
21
|
+
## Firebase authentication
|
|
22
|
+
|
|
23
|
+
The `/auth-firebase` entry point initializes `firebase/auth` through `provideKitFirebase()` and exposes `KIT_FIREBASE_AUTH` plus flow helpers such as `kitSignIn`, `kitSignUp`, `kitSignOut`, `kitResolveAuthStatus`, and `kitReauthWithRetry`.
|
|
24
|
+
|
|
25
|
+
The kit performs no UI. Hooks carry loading, navigation, and error presentation back to the application. Social providers are isolated further under `/auth-firebase/social`.
|
|
26
|
+
|
|
27
|
+
## Live Update
|
|
28
|
+
|
|
29
|
+
`provideLiveUpdateReadiness()` from `/live-update` waits for Angular stability, the first completed route, and one animation frame before calling Capawesome `LiveUpdate.ready()`. It is a no-op on the web.
|
|
30
|
+
|
|
31
|
+
A Live Update replaces only the web layer of an existing native binary. Native code, Capacitor configuration, or plugin version changes require a store build and a new build-number-specific channel.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
## Typed storage
|
|
2
|
+
|
|
3
|
+
Provide Ionic Storage once. `KitStorageService` initializes it lazily and every public operation waits for that initialization, so writes made immediately after service creation are not dropped.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { importProvidersFrom } from '@angular/core';
|
|
7
|
+
import { IonicStorageModule } from '@ionic/storage-angular';
|
|
8
|
+
|
|
9
|
+
export const appConfig: ApplicationConfig = {
|
|
10
|
+
providers: [importProvidersFrom(IonicStorageModule.withConfig({ name: '__mydb' }))],
|
|
11
|
+
};
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
const storage = inject(KitStorageService);
|
|
16
|
+
|
|
17
|
+
await storage.set('token', token);
|
|
18
|
+
const saved = await storage.get<string>('token');
|
|
19
|
+
await storage.remove('token');
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`get<T>()` returns `null` for a missing key. `kitClearStoragePreservingKeys()` clears application data while restoring selected values such as the last authentication email or theme.
|
|
23
|
+
|
|
24
|
+
## Typed overlays
|
|
25
|
+
|
|
26
|
+
Configure application-owned labels with `provideKitOverlay()` and inject `KitOverlayController`. The kit does not hard-code localized copy.
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
provideKitOverlay({
|
|
30
|
+
labels: {
|
|
31
|
+
close: $localize`Close`,
|
|
32
|
+
cancel: $localize`Cancel`,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
export class DetailPage {
|
|
39
|
+
declare static readonly modalReturn: DetailResult;
|
|
40
|
+
readonly item = input.required<Item>();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const launchDetailPage = (
|
|
44
|
+
overlay: KitOverlayController,
|
|
45
|
+
props: { item: Item },
|
|
46
|
+
): Promise<DetailResult | undefined> =>
|
|
47
|
+
overlay.presentModal(DetailPage, props, { backdropDismiss: false });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Component props are inferred from Angular `input()` fields and dismiss data from the component's static `modalReturn` declaration. Keep a typed launcher beside each modal or popover instead of calling an Ionic controller inline.
|
|
51
|
+
|
|
52
|
+
The same controller provides `presentPopover()`, `presentToast()`, `alertClose()`, and `alertConfirm()`. Modal option `watchKeyboard: true` expands a bottom sheet while the native keyboard is visible.
|
|
@@ -5116,17 +5116,63 @@ async function recoverOfflineLocalReset(options) {
|
|
|
5116
5116
|
const marker = await options.markerStore.get({ key: options.markerKey });
|
|
5117
5117
|
if (marker.value !== OFFLINE_LOCAL_RESET_REQUESTED)
|
|
5118
5118
|
return false;
|
|
5119
|
+
await resetOfflineDatabases({
|
|
5120
|
+
sqliteConnection: options.sqliteConnection,
|
|
5121
|
+
databaseNames: options.kitCompatibleDatabaseNames,
|
|
5122
|
+
databaseEncryption: options.databaseEncryption ?? COMMUNITY_SQLITE_ENCRYPTED,
|
|
5123
|
+
additionalCleanup: options.additionalCleanup,
|
|
5124
|
+
});
|
|
5125
|
+
await options.markerStore.remove({ key: options.markerKey });
|
|
5126
|
+
return true;
|
|
5127
|
+
}
|
|
5128
|
+
/**
|
|
5129
|
+
* Deletes native databases once when changing their encryption mode.
|
|
5130
|
+
*
|
|
5131
|
+
* Products with a remote source of truth can use this before Angular bootstrap instead of
|
|
5132
|
+
* decrypting local replicas. The completion marker is written only after every deletion and
|
|
5133
|
+
* product cleanup succeeds, so interruption retries safely on the next cold start.
|
|
5134
|
+
*/
|
|
5135
|
+
async function migrateOfflineDatabaseEncryption(options) {
|
|
5136
|
+
if (!(options.nativePlatform ?? Capacitor.isNativePlatform()))
|
|
5137
|
+
return false;
|
|
5138
|
+
const marker = await options.markerStore.get({ key: options.markerKey });
|
|
5139
|
+
if (marker.value === options.migrationVersion)
|
|
5140
|
+
return false;
|
|
5141
|
+
await resetOfflineDatabases({
|
|
5142
|
+
sqliteConnection: options.sqliteConnection,
|
|
5143
|
+
databaseNames: options.kitCompatibleDatabaseNames,
|
|
5144
|
+
databaseEncryption: options.sourceDatabaseEncryption,
|
|
5145
|
+
additionalCleanup: options.additionalCleanup,
|
|
5146
|
+
});
|
|
5147
|
+
if (options.clearEncryptionSecret) {
|
|
5148
|
+
if (!options.sqliteConnection.clearEncryptionSecret) {
|
|
5149
|
+
throw new Error('SQLite connection does not support clearing the obsolete encryption secret.');
|
|
5150
|
+
}
|
|
5151
|
+
await options.sqliteConnection.clearEncryptionSecret();
|
|
5152
|
+
}
|
|
5153
|
+
await options.markerStore.set({ key: options.markerKey, value: options.migrationVersion });
|
|
5154
|
+
return true;
|
|
5155
|
+
}
|
|
5156
|
+
async function resetOfflineDatabases(options) {
|
|
5119
5157
|
await options.sqliteConnection.checkConnectionsConsistency();
|
|
5120
|
-
for (const databaseName of new Set(options.
|
|
5158
|
+
for (const databaseName of new Set(options.databaseNames)) {
|
|
5121
5159
|
const exists = await options.sqliteConnection.isDatabase(databaseName);
|
|
5122
|
-
if (exists.result)
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5160
|
+
if (!exists.result)
|
|
5161
|
+
continue;
|
|
5162
|
+
const databaseEncryption = await resolveOfflineDatabaseEncryption(options.sqliteConnection, databaseName, options.databaseEncryption);
|
|
5163
|
+
const connection = await options.sqliteConnection.createConnection(databaseName, databaseEncryption, databaseEncryption ? COMMUNITY_SQLITE_MODE : 'no-encryption', COMMUNITY_SQLITE_VERSION, COMMUNITY_SQLITE_READONLY);
|
|
5164
|
+
await deleteAndCloseOfflineDatabase(options.sqliteConnection, databaseName, connection);
|
|
5126
5165
|
}
|
|
5127
5166
|
await options.additionalCleanup?.();
|
|
5128
|
-
|
|
5129
|
-
|
|
5167
|
+
}
|
|
5168
|
+
async function resolveOfflineDatabaseEncryption(sqliteConnection, databaseName, configured) {
|
|
5169
|
+
if (configured !== 'detect')
|
|
5170
|
+
return configured;
|
|
5171
|
+
if (!sqliteConnection.isDatabaseEncrypted) {
|
|
5172
|
+
throw new Error('SQLite connection does not support detecting the existing database encryption mode.');
|
|
5173
|
+
}
|
|
5174
|
+
const result = await sqliteConnection.isDatabaseEncrypted(databaseName);
|
|
5175
|
+
return result.result === true;
|
|
5130
5176
|
}
|
|
5131
5177
|
async function settleOfflineResetOperation(operation) {
|
|
5132
5178
|
return new Promise((resolve) => resolve(operation())).then(() => ({ ok: true }), (error) => ({ ok: false, error }));
|
|
@@ -5337,8 +5383,8 @@ function isExistingCommunitySqliteConnectionError(error, database) {
|
|
|
5337
5383
|
function settleCommunitySqliteCreation(creation) {
|
|
5338
5384
|
return creation.then((database) => ({ ok: true, database }), (error) => ({ ok: false, error }));
|
|
5339
5385
|
}
|
|
5340
|
-
async function createReloadSafeCommunitySqliteDatabase(connection, databaseName) {
|
|
5341
|
-
const create = () => connection.createConnection(databaseName,
|
|
5386
|
+
async function createReloadSafeCommunitySqliteDatabase(connection, databaseName, encrypted) {
|
|
5387
|
+
const create = () => connection.createConnection(databaseName, encrypted, encrypted ? COMMUNITY_SQLITE_MODE : 'no-encryption', COMMUNITY_SQLITE_VERSION, COMMUNITY_SQLITE_READONLY);
|
|
5342
5388
|
const creation = await settleCommunitySqliteCreation(create());
|
|
5343
5389
|
if (creation.ok)
|
|
5344
5390
|
return creation.database;
|
|
@@ -5349,18 +5395,25 @@ async function createReloadSafeCommunitySqliteDatabase(connection, databaseName)
|
|
|
5349
5395
|
return create();
|
|
5350
5396
|
}
|
|
5351
5397
|
/**
|
|
5352
|
-
* Create the canonical
|
|
5398
|
+
* Create the canonical `@capacitor-community/sqlite` driver for a connection owner.
|
|
5353
5399
|
*
|
|
5354
|
-
*
|
|
5355
|
-
*
|
|
5356
|
-
*
|
|
5357
|
-
*
|
|
5358
|
-
*
|
|
5400
|
+
* Native databases are encrypted by default. Pass `encrypted: false` for plaintext. The supplied
|
|
5401
|
+
* connection is the identity and exclusive owner of its native plugin connections. Repeated calls
|
|
5402
|
+
* with the same object and the same encryption mode return the same driver so normal concurrent
|
|
5403
|
+
* access cannot be mistaken for a WebView-reload orphan. A later call with a different encryption
|
|
5404
|
+
* mode throws instead of silently reusing the cached driver. Consumers must route database access
|
|
5405
|
+
* through this driver and must not close or replace the connection while the driver is active. A
|
|
5406
|
+
* real WebView reload creates a new JavaScript owner, allowing the driver to close the native
|
|
5407
|
+
* connection orphaned by the previous owner and recreate it.
|
|
5359
5408
|
*/
|
|
5360
|
-
function createCommunitySqliteDriver(connection) {
|
|
5361
|
-
const
|
|
5362
|
-
if (
|
|
5363
|
-
|
|
5409
|
+
function createCommunitySqliteDriver(connection, encrypted = COMMUNITY_SQLITE_ENCRYPTED) {
|
|
5410
|
+
const cached = communitySqliteDrivers.get(connection);
|
|
5411
|
+
if (cached) {
|
|
5412
|
+
if (cached.encrypted !== encrypted) {
|
|
5413
|
+
throw new Error(`Cannot reuse a Community SQLite connection with a different encryption mode (cached encrypted=${String(cached.encrypted)}, requested encrypted=${String(encrypted)})`);
|
|
5414
|
+
}
|
|
5415
|
+
return cached.driver;
|
|
5416
|
+
}
|
|
5364
5417
|
const databases = new Map();
|
|
5365
5418
|
const openings = new Map();
|
|
5366
5419
|
let secretInitialization = null;
|
|
@@ -5371,6 +5424,8 @@ function createCommunitySqliteDriver(connection) {
|
|
|
5371
5424
|
return value;
|
|
5372
5425
|
};
|
|
5373
5426
|
const ensureSecret = (createEncryptionKey) => {
|
|
5427
|
+
if (!encrypted)
|
|
5428
|
+
return settledSqliteOperation();
|
|
5374
5429
|
if (secretInitialization)
|
|
5375
5430
|
return secretInitialization;
|
|
5376
5431
|
const initialization = (async () => {
|
|
@@ -5399,7 +5454,7 @@ function createCommunitySqliteDriver(connection) {
|
|
|
5399
5454
|
return currentOpening;
|
|
5400
5455
|
const opening = (async () => {
|
|
5401
5456
|
await ensureSecret(createEncryptionKey);
|
|
5402
|
-
const value = await createReloadSafeCommunitySqliteDatabase(connection, databaseName);
|
|
5457
|
+
const value = await createReloadSafeCommunitySqliteDatabase(connection, databaseName, encrypted);
|
|
5403
5458
|
await value.open();
|
|
5404
5459
|
databases.set(databaseKey, value);
|
|
5405
5460
|
return value;
|
|
@@ -5420,6 +5475,17 @@ function createCommunitySqliteDriver(connection) {
|
|
|
5420
5475
|
await openDatabase(databaseName, createEncryptionKey);
|
|
5421
5476
|
return { databaseId: databaseName };
|
|
5422
5477
|
},
|
|
5478
|
+
async executeBatch({ databaseId, statements }) {
|
|
5479
|
+
const target = database(databaseId);
|
|
5480
|
+
if (statements.length === 0)
|
|
5481
|
+
return;
|
|
5482
|
+
if (target.execute) {
|
|
5483
|
+
await target.execute(statements.join(';\n'), false);
|
|
5484
|
+
return;
|
|
5485
|
+
}
|
|
5486
|
+
for (const statement of statements)
|
|
5487
|
+
await target.run(statement, [], false);
|
|
5488
|
+
},
|
|
5423
5489
|
async execute({ databaseId, statement, values = [] }) {
|
|
5424
5490
|
await database(databaseId).run(statement, values, false);
|
|
5425
5491
|
},
|
|
@@ -5437,7 +5503,7 @@ function createCommunitySqliteDriver(connection) {
|
|
|
5437
5503
|
await database(databaseId).rollbackTransaction();
|
|
5438
5504
|
},
|
|
5439
5505
|
};
|
|
5440
|
-
communitySqliteDrivers.set(connection, driver);
|
|
5506
|
+
communitySqliteDrivers.set(connection, { driver, encrypted });
|
|
5441
5507
|
return driver;
|
|
5442
5508
|
}
|
|
5443
5509
|
const SCHEMA = [
|
|
@@ -5754,8 +5820,13 @@ class SqliteOfflineRepository {
|
|
|
5754
5820
|
createEncryptionKey: this.#wrapCreateEncryptionKey(this.#options.createEncryptionKey),
|
|
5755
5821
|
});
|
|
5756
5822
|
this.#databaseId = databaseId;
|
|
5757
|
-
|
|
5758
|
-
await this.#
|
|
5823
|
+
if (this.#sqlite.executeBatch) {
|
|
5824
|
+
await this.#sqlite.executeBatch({ databaseId, statements: SCHEMA });
|
|
5825
|
+
}
|
|
5826
|
+
else {
|
|
5827
|
+
for (const statement of SCHEMA)
|
|
5828
|
+
await this.#execute(databaseId, statement);
|
|
5829
|
+
}
|
|
5759
5830
|
const metadata = await this.#queryDatabase(databaseId, 'SELECT schema_version FROM offline_metadata WHERE id = 1');
|
|
5760
5831
|
if (metadata.length === 0) {
|
|
5761
5832
|
await this.#execute(databaseId, 'INSERT INTO offline_metadata (id, schema_version, last_user_id) VALUES (1, ?, NULL)', [
|
|
@@ -6531,7 +6602,7 @@ const READ_CACHE_ONLY_REPLICA_PULLER = {
|
|
|
6531
6602
|
* Provide the standard scoped offline runtime.
|
|
6532
6603
|
*
|
|
6533
6604
|
* @remarks
|
|
6534
|
-
* Web uses Ionic Storage. Native iOS/Android uses
|
|
6605
|
+
* Web uses Ionic Storage. Native iOS/Android uses `@capacitor-community/sqlite`, encrypted by default. The application owns
|
|
6535
6606
|
* URL/DTO policy and command execution; the kit owns persistence, ordering, retries, and session
|
|
6536
6607
|
* isolation.
|
|
6537
6608
|
*
|
|
@@ -6540,24 +6611,38 @@ const READ_CACHE_ONLY_REPLICA_PULLER = {
|
|
|
6540
6611
|
*/
|
|
6541
6612
|
function provideOffline(options) {
|
|
6542
6613
|
const synchronized = options.mode !== 'readCacheOnly';
|
|
6614
|
+
const kitOptions = options.databaseEncryption === false
|
|
6615
|
+
? {
|
|
6616
|
+
mode: options.mode ?? 'synchronized',
|
|
6617
|
+
databaseName: options.databaseName,
|
|
6618
|
+
databaseEncryption: false,
|
|
6619
|
+
createEncryptionKey: options.createEncryptionKey,
|
|
6620
|
+
replicaSchema: options.replicaSchema,
|
|
6621
|
+
wireProtocol: options.wireProtocol,
|
|
6622
|
+
outboxLimits: options.outboxLimits,
|
|
6623
|
+
mutationPersistence: options.mutationPersistence,
|
|
6624
|
+
onStorageUnavailable: options.onStorageUnavailable,
|
|
6625
|
+
}
|
|
6626
|
+
: {
|
|
6627
|
+
mode: options.mode ?? 'synchronized',
|
|
6628
|
+
databaseName: options.databaseName,
|
|
6629
|
+
databaseEncryption: options.databaseEncryption ?? true,
|
|
6630
|
+
createEncryptionKey: options.createEncryptionKey,
|
|
6631
|
+
replicaSchema: options.replicaSchema,
|
|
6632
|
+
wireProtocol: options.wireProtocol,
|
|
6633
|
+
outboxLimits: options.outboxLimits,
|
|
6634
|
+
mutationPersistence: options.mutationPersistence,
|
|
6635
|
+
onStorageUnavailable: options.onStorageUnavailable,
|
|
6636
|
+
};
|
|
6543
6637
|
return makeEnvironmentProviders([
|
|
6544
6638
|
...(synchronized ? [options.commandExecutor, options.replicaPuller] : []),
|
|
6545
6639
|
{
|
|
6546
6640
|
provide: OFFLINE_KIT_OPTIONS,
|
|
6547
|
-
useValue:
|
|
6548
|
-
mode: options.mode ?? 'synchronized',
|
|
6549
|
-
databaseName: options.databaseName,
|
|
6550
|
-
createEncryptionKey: options.createEncryptionKey,
|
|
6551
|
-
replicaSchema: options.replicaSchema,
|
|
6552
|
-
wireProtocol: options.wireProtocol,
|
|
6553
|
-
outboxLimits: options.outboxLimits,
|
|
6554
|
-
mutationPersistence: options.mutationPersistence,
|
|
6555
|
-
onStorageUnavailable: options.onStorageUnavailable,
|
|
6556
|
-
},
|
|
6641
|
+
useValue: kitOptions,
|
|
6557
6642
|
},
|
|
6558
6643
|
{
|
|
6559
6644
|
provide: COMMUNITY_SQLITE,
|
|
6560
|
-
useValue: options.sqliteConnection ? createCommunitySqliteDriver(options.sqliteConnection) : null,
|
|
6645
|
+
useValue: options.sqliteConnection ? createCommunitySqliteDriver(options.sqliteConnection, options.databaseEncryption ?? true) : null,
|
|
6561
6646
|
},
|
|
6562
6647
|
{
|
|
6563
6648
|
provide: OFFLINE_REPOSITORY,
|
|
@@ -6760,5 +6845,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
6760
6845
|
* Generated bundle index. Do not edit.
|
|
6761
6846
|
*/
|
|
6762
6847
|
|
|
6763
|
-
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_COMPLETE_HEADER, OFFLINE_RESPONSE_HEADER, OFFLINE_RETRY_RANDOM, OFFLINE_SCHEMA_VERSION, OFFLINE_SYNC_CONTEXT, OfflineCommandInFlightError, OfflineCoordinatorService, OfflineMutationPersistenceDisabledError, OfflineMutationPersistencePendingError, OfflineMutationPersistenceRequiresOnlineError, OfflineMutationPersistenceService, 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, offlineCommandWithBaseRevision, offlineGeneratedReplicaIdentity, offlineInterceptor, offlineNaturalKeyFromValues, offlineNaturalReplicaIdentity, offlineReadEmission, offlineReadSource, offlineReplicaRemoteIdentity, offlineRetryDelayMs, offlineSessionManifestAllows, parseOfflineCommandIdentity, parseOfflineMutationEnvelope, parseOfflinePrincipalId, projectOfflineReplicaValues, provideOffline, provideOfflineMutationRequestPolicy, provideOfflineRequestPolicy, real, recoverOfflineLocalReset, replicaAddressFromIdentity, requestOfflineLocalReset, requirePositiveOfflineInteger, selectOfflineRepository, serializeOfflineCommandIdentity, sha256OfflineReplicaSchema, shouldCommitOfflineCollection, supportsSynchronizedOfflineRepository, text };
|
|
6848
|
+
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_COMPLETE_HEADER, OFFLINE_RESPONSE_HEADER, OFFLINE_RETRY_RANDOM, OFFLINE_SCHEMA_VERSION, OFFLINE_SYNC_CONTEXT, OfflineCommandInFlightError, OfflineCoordinatorService, OfflineMutationPersistenceDisabledError, OfflineMutationPersistencePendingError, OfflineMutationPersistenceRequiresOnlineError, OfflineMutationPersistenceService, 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, migrateOfflineDatabaseEncryption, naturalKey, normalizeOfflineNaturalKey, normalizeOfflineReplicaPullPage, nullable, offlineAggregateIntentMutations, offlineCommandLookupIdentity, offlineCommandTargetFromReplicaRow, offlineCommandWithBaseRevision, offlineGeneratedReplicaIdentity, offlineInterceptor, offlineNaturalKeyFromValues, offlineNaturalReplicaIdentity, offlineReadEmission, offlineReadSource, offlineReplicaRemoteIdentity, offlineRetryDelayMs, offlineSessionManifestAllows, parseOfflineCommandIdentity, parseOfflineMutationEnvelope, parseOfflinePrincipalId, projectOfflineReplicaValues, provideOffline, provideOfflineMutationRequestPolicy, provideOfflineRequestPolicy, real, recoverOfflineLocalReset, replicaAddressFromIdentity, requestOfflineLocalReset, requirePositiveOfflineInteger, selectOfflineRepository, serializeOfflineCommandIdentity, sha256OfflineReplicaSchema, shouldCommitOfflineCollection, supportsSynchronizedOfflineRepository, text };
|
|
6764
6849
|
//# sourceMappingURL=rdlabo-ionic-angular-kit-offline.mjs.map
|