@rdlabo/ionic-angular-kit 21.4.1 → 21.4.3
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
|
@@ -338,30 +338,69 @@ session boundary, cursor-based delta pull, aggregate-ordered replay, optimistic
|
|
|
338
338
|
read-only request-policy interceptor. Applications provide URL/DTO read policies, a replica puller, and a command
|
|
339
339
|
executor through `provideOffline(...)`.
|
|
340
340
|
Mutations are queued explicitly with `OfflineSyncService.enqueue`, not through HTTP interceptor policy.
|
|
341
|
-
Web storage uses Ionic Storage; iOS and Android use encrypted
|
|
342
|
-
primary entry point or `/offline` does not pull the
|
|
341
|
+
Web storage uses Ionic Storage; iOS and Android use encrypted `@capacitor-community/sqlite`. Importing either the
|
|
342
|
+
primary entry point or `/offline` does not pull the optional native SQLite plugin into web-only applications.
|
|
343
343
|
|
|
344
344
|
The offline interceptor observes real transport responses to update API reachability. For matched `GET`
|
|
345
345
|
requests only, a transport failure with `status=0` may return a local replica response tagged
|
|
346
346
|
`X-Offline-Response: local`. `POST` and other write methods always go to transport unchanged; outbox replay
|
|
347
347
|
requests bypass policy with `OFFLINE_BYPASS` while still using the same transport observation.
|
|
348
348
|
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
The native offline runtime uses `@capacitor-community/sqlite` on iOS and Android. Install the plugin in the app and
|
|
350
|
+
sync native projects:
|
|
351
351
|
|
|
352
352
|
```bash
|
|
353
|
-
|
|
353
|
+
# Capacitor 8
|
|
354
|
+
npm install @capacitor-community/sqlite@^8.1.0
|
|
355
|
+
npx cap sync
|
|
354
356
|
```
|
|
355
357
|
|
|
358
|
+
Use the plugin major matching the application's Capacitor major (`^6` for Capacitor 6, `^7` for Capacitor 7,
|
|
359
|
+
`^8.1.0` for Capacitor 8).
|
|
360
|
+
|
|
361
|
+
Add the required `CapacitorSQLite` plugin block to `capacitor.config.ts`. Encryption must be enabled — the kit opens
|
|
362
|
+
databases in encrypted mode and relies on the plugin's built-in secure secret storage (`isSecretStored` /
|
|
363
|
+
`setEncryptionSecret` in the device keychain / Android keystore):
|
|
364
|
+
|
|
365
|
+
```ts
|
|
366
|
+
// capacitor.config.ts
|
|
367
|
+
plugins: {
|
|
368
|
+
CapacitorSQLite: {
|
|
369
|
+
iosDatabaseLocation: 'Library/CapacitorDatabase',
|
|
370
|
+
iosIsEncryption: true,
|
|
371
|
+
iosKeychainPrefix: '<your-app-prefix>',
|
|
372
|
+
androidIsEncryption: true,
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Follow the [@capacitor-community/sqlite installation guide](https://github.com/capacitor-community/sqlite#installation)
|
|
378
|
+
for platform-specific steps and SQLCipher export-compliance notes.
|
|
379
|
+
|
|
380
|
+
Android must not back up or transfer the encrypted database independently from its keystore secret. Set
|
|
381
|
+
`android:allowBackup="false"`, `android:fullBackupContent="false"`, and
|
|
382
|
+
`android:dataExtractionRules="@xml/data_extraction_rules"` on `<application>`. The referenced Android 12+ rules must
|
|
383
|
+
exclude at least the `database`, `sharedpref`, `root`, and `external` domains from both `cloud-backup` and
|
|
384
|
+
`device-transfer`, as shown in the plugin installation guide.
|
|
385
|
+
|
|
386
|
+
Create the community plugin connection in the application, then pass it with a stable `databaseName` and a
|
|
387
|
+
`createEncryptionKey` generator to `provideOffline`. Keeping the runtime object application-supplied prevents the optional
|
|
388
|
+
native plugin from entering web-only `/offline` bundles. The kit invokes the generator only
|
|
389
|
+
when the plugin has no secret yet, then stores the result in the plugin's Keychain / Android keystore. Later opens use
|
|
390
|
+
that stored secret without invoking the generator. Never hard-code or derive the key from a user identifier, device
|
|
391
|
+
identifier, or access token; generate a cryptographically random value for the first installation.
|
|
392
|
+
|
|
356
393
|
```ts
|
|
394
|
+
import { CapacitorSQLite, SQLiteConnection } from '@capacitor-community/sqlite';
|
|
395
|
+
|
|
396
|
+
const createRandomOfflineEncryptionKey = async () =>
|
|
397
|
+
Array.from(crypto.getRandomValues(new Uint8Array(32)), (byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
398
|
+
|
|
357
399
|
provideOffline({
|
|
400
|
+
databaseName: 'product-offline',
|
|
401
|
+
sqliteConnection: new SQLiteConnection(CapacitorSQLite),
|
|
402
|
+
createEncryptionKey: createRandomOfflineEncryptionKey,
|
|
358
403
|
// ...product policies, puller, and executor
|
|
359
|
-
sqlitePlugin: Sqlite,
|
|
360
|
-
encryptionKey: async () => {
|
|
361
|
-
const { value } = await securePreferences.get({ key: 'offline-database-key' });
|
|
362
|
-
if (!value) throw new Error('offline-database-key is missing');
|
|
363
|
-
return value;
|
|
364
|
-
},
|
|
365
404
|
});
|
|
366
405
|
```
|
|
367
406
|
|
|
@@ -371,6 +410,42 @@ Immediately before each send, the executor receives the latest `{ localId, serve
|
|
|
371
410
|
SQLite; a successful create adds `serverId` without replacing `localId`. Entity projection and outbox
|
|
372
411
|
append/removal are committed in one local transaction.
|
|
373
412
|
|
|
413
|
+
| Identity | SQLite column | Before synchronization | After server acknowledgement |
|
|
414
|
+
| ---------- | ------------- | ----------------------- | ----------------------------------- |
|
|
415
|
+
| `localId` | `local_id` | client-generated UUID | unchanged UUID |
|
|
416
|
+
| `serverId` | `server_id` | `NULL` for a new entity | positive server `AUTO_INCREMENT` id |
|
|
417
|
+
|
|
418
|
+
The write lifecycle is: update the replica immediately → append an outbox command in the same transaction → render
|
|
419
|
+
the optimistic value → replay in the background → validate the server revision → store the confirmed value and
|
|
420
|
+
revision. The server remains authoritative; SQLite is the durable local working database, not an HTTP response cache.
|
|
421
|
+
|
|
422
|
+
`serverId()` supports positive safe integers only. Products must expose an internal numeric primary key for a
|
|
423
|
+
replicated entity; a human-facing string such as a public code, slip number, or SKU remains an ordinary replicated
|
|
424
|
+
column. There is intentionally no text-server-id overload.
|
|
425
|
+
|
|
426
|
+
When the application already knows the numeric server id but the first replica pull has not materialized the row,
|
|
427
|
+
pass that identity explicitly while adopting the entity. This is required for updates and especially deletes: an
|
|
428
|
+
omitted id would otherwise make the executor interpret the row as a not-yet-created local entity.
|
|
429
|
+
|
|
430
|
+
```ts
|
|
431
|
+
await offlineSync.enqueue({
|
|
432
|
+
groupId,
|
|
433
|
+
aggregateType: 'items',
|
|
434
|
+
aggregateLocalId: localId,
|
|
435
|
+
serverId: existingApiItem.id,
|
|
436
|
+
operation: 'items.delete',
|
|
437
|
+
payload: { method: 'DELETE' },
|
|
438
|
+
optimisticValue: existingApiItem,
|
|
439
|
+
});
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
The mapping is immutable and unique inside its effective replica scope. Reassigning one `localId` to another
|
|
443
|
+
`serverId`, or assigning the same `serverId` to another `localId`, rejects before persistence. Web storage enforces
|
|
444
|
+
the same rule transactionally as SQLite's unique indexes: group-scoped entities are unique per user/group/source,
|
|
445
|
+
and user-scoped entities are unique per user/source across groups. If an adopted row has no confirmed baseline and
|
|
446
|
+
its final command is discarded, the local row is removed; the next pull may materialize the authoritative server
|
|
447
|
+
row again. A row with a confirmed baseline rolls back to that baseline instead.
|
|
448
|
+
|
|
374
449
|
Each synchronization cycle pulls authoritative server deltas before replaying the outbox. Every page carries the
|
|
375
450
|
replica schema version/hash and advances a durable user/group cursor in the same transaction as its rows. A schema
|
|
376
451
|
mismatch, malformed row, or non-advancing cursor rejects synchronization without advancing that cursor. If a remote
|
|
@@ -393,13 +468,7 @@ shape or `null` to delete a row. Identity and sync metadata (`localId`, `serverI
|
|
|
393
468
|
migration `fromVersion`/`statements` — never function bodies.
|
|
394
469
|
|
|
395
470
|
```typescript
|
|
396
|
-
import {
|
|
397
|
-
defineOfflineReplicaSchema,
|
|
398
|
-
defineReplicaEntity,
|
|
399
|
-
provideOffline,
|
|
400
|
-
serverId,
|
|
401
|
-
text,
|
|
402
|
-
} from '@rdlabo/ionic-angular-kit/offline';
|
|
471
|
+
import { defineOfflineReplicaSchema, defineReplicaEntity, provideOffline, serverId, text } from '@rdlabo/ionic-angular-kit/offline';
|
|
403
472
|
|
|
404
473
|
// This is the Hono package's existing `typeof items.$inferSelect` export.
|
|
405
474
|
import type { Items as ItemSelect } from '@product/hono/db/schema';
|
|
@@ -425,8 +494,7 @@ const replicaSchema = defineOfflineReplicaSchema({
|
|
|
425
494
|
migrateWebRow: (row) => ({
|
|
426
495
|
sourceKey: row.sourceKey,
|
|
427
496
|
values: { ...row.values, subtitle: '' },
|
|
428
|
-
confirmedValues:
|
|
429
|
-
row.confirmedValues === null ? null : { ...row.confirmedValues, subtitle: '' },
|
|
497
|
+
confirmedValues: row.confirmedValues === null ? null : { ...row.confirmedValues, subtitle: '' },
|
|
430
498
|
}),
|
|
431
499
|
},
|
|
432
500
|
],
|
|
@@ -436,23 +504,21 @@ provideOffline({
|
|
|
436
504
|
replicaSchema,
|
|
437
505
|
replicaPuller: ProductReplicaPuller,
|
|
438
506
|
commandExecutor: ProductCommandExecutor,
|
|
439
|
-
// ...request policies,
|
|
507
|
+
// ...request policies, databaseName, createEncryptionKey
|
|
440
508
|
});
|
|
441
509
|
```
|
|
442
510
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
511
|
+
Offline replica schema consumers must compile with TypeScript `strictNullChecks: true`. This is part of the standard,
|
|
512
|
+
not a compatibility option: without strict null checking, TypeScript cannot distinguish a nullable Hono property
|
|
513
|
+
from a required one and the schema lock cannot prove the SQLite mapping.
|
|
514
|
+
|
|
515
|
+
The schema definition must import the Hono package's exported `$inferSelect` type and map every key exactly once as
|
|
516
|
+
a SQLite column, `serverId()`, or `ignored(reason)`, with exactly one numeric `serverId()` per replicated entity.
|
|
517
|
+
Nullable Hono columns require `nullable(...)`; non-null columns reject it. Therefore adding,
|
|
446
518
|
removing, or changing nullability of a Drizzle column breaks the app build until its replica mapping is updated.
|
|
447
519
|
At runtime, `values` contains only the mapped column projection; `localId` and `serverId` remain dedicated replica
|
|
448
520
|
fields and ignored server fields are never persisted.
|
|
449
521
|
|
|
450
|
-
Encrypted native builds also require the plugin's SQLCipher platform setup: enable
|
|
451
|
-
`capawesomeCapacitorSqliteIncludeSqlcipher = true` on Android; select the `SQLCipher` pod when using
|
|
452
|
-
CocoaPods, or enable the `SQLCipher` package trait when using Swift Package Manager on iOS. Follow
|
|
453
|
-
the [Capawesome SQLite installation guide](https://capawesome.io/docs/plugins/sqlite/#installation)
|
|
454
|
-
for the exact native configuration and export-compliance notes.
|
|
455
|
-
|
|
456
522
|
- **Status classification**: `0`→`onNetworkError` (connected only), `429`→`onRateLimited`, `502/503/504`→`onServerBusy`, `400/422/500`+message→`onServerError`, `401`→`onUnauthorized`, `403`→`onForbidden`. Other statuses (e.g. `404`) are left to the caller.
|
|
457
523
|
- **Universal 60s timeout** — every request fails with a synthetic (retryable) `408` if it hangs for 60s. Deliberately generous (catches a dead server without cutting off a large upload / AI generation; `timeout({ each })` resets per emission, so streaming is unaffected). Not configurable — one fleet-wide behavior.
|
|
458
524
|
- **Optional `treatAsError(response)`** — reject a 2xx (e.g. `204`/`206`) as an error when a backend uses it to signal a condition. The one genuinely app-specific bit (some apps receive a normal `204`), kept optional so class interceptors with a 2xx-as-error convention can migrate to `provideKitHttp`.
|
|
@@ -880,13 +880,18 @@ class IonicOfflineRepository {
|
|
|
880
880
|
await this.#assertReplicaSchemaLocked();
|
|
881
881
|
for (const row of transaction.putRows ?? [])
|
|
882
882
|
this.#validateReplicaRow(row);
|
|
883
|
-
if (journal)
|
|
884
|
-
await this.#storage.set(REPLICA_TRANSACTION_KEY, transaction);
|
|
885
883
|
const [rows, commands, cursors] = await Promise.all([
|
|
886
884
|
this.#readRecord(ROWS_KEY),
|
|
887
885
|
this.#readRecord(OUTBOX_KEY),
|
|
888
886
|
this.#readRecord(CURSORS_KEY),
|
|
889
887
|
]);
|
|
888
|
+
const identityCheckRows = { ...rows };
|
|
889
|
+
for (const row of transaction.putRows ?? []) {
|
|
890
|
+
this.#assertUniqueReplicaServerId(identityCheckRows, row);
|
|
891
|
+
identityCheckRows[this.#rowKey(row, row.sourceKey, row.localId)] = row;
|
|
892
|
+
}
|
|
893
|
+
if (journal)
|
|
894
|
+
await this.#storage.set(REPLICA_TRANSACTION_KEY, transaction);
|
|
890
895
|
for (const row of transaction.putRows ?? []) {
|
|
891
896
|
const schema = this.#resolveReplicaEntitySchema(row.sourceKey);
|
|
892
897
|
rows[this.#rowKey(row, row.sourceKey, row.localId)] = {
|
|
@@ -956,6 +961,23 @@ class IonicOfflineRepository {
|
|
|
956
961
|
if (row.confirmedValues !== null)
|
|
957
962
|
encodeOfflineReplicaValues(schema, row.confirmedValues);
|
|
958
963
|
}
|
|
964
|
+
#assertUniqueReplicaServerId(rows, incoming) {
|
|
965
|
+
if (incoming.serverId === null)
|
|
966
|
+
return;
|
|
967
|
+
const schema = this.#resolveReplicaEntitySchema(incoming.sourceKey);
|
|
968
|
+
const incomingKey = this.#rowKey(incoming, incoming.sourceKey, incoming.localId);
|
|
969
|
+
const collision = Object.entries(rows).find(([key, row]) => {
|
|
970
|
+
if (key === incomingKey)
|
|
971
|
+
return false;
|
|
972
|
+
if (row.userId !== incoming.userId || row.sourceKey !== incoming.sourceKey || row.serverId !== incoming.serverId) {
|
|
973
|
+
return false;
|
|
974
|
+
}
|
|
975
|
+
return schema.scope === 'user' || row.groupId === incoming.groupId;
|
|
976
|
+
});
|
|
977
|
+
if (collision) {
|
|
978
|
+
throw new Error(`Offline replica serverId ${String(incoming.serverId)} is already mapped to localId ${collision[1].localId}.`);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
959
981
|
#resolveReplicaEntitySchema(sourceKey) {
|
|
960
982
|
const schema = this.#options.replicaSchema.entities.find((entity) => entity.sourceKey === sourceKey);
|
|
961
983
|
if (!schema)
|
|
@@ -1506,11 +1528,18 @@ class OfflineSyncService {
|
|
|
1506
1528
|
};
|
|
1507
1529
|
const entityType = this.#entityType(command);
|
|
1508
1530
|
const existing = await this.#repository.getReplicaRow(scope, entityType, aggregateLocalId);
|
|
1531
|
+
const initialServerId = this.#initialServerId(existing?.serverId ?? null, request.serverId);
|
|
1532
|
+
if (initialServerId !== null) {
|
|
1533
|
+
const mapped = await this.#repository.getReplicaRowByServerId(scope, entityType, initialServerId);
|
|
1534
|
+
if (mapped !== null && mapped.localId !== aggregateLocalId) {
|
|
1535
|
+
throw new Error(`Offline replica serverId ${String(initialServerId)} is already mapped to localId ${mapped.localId}.`);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1509
1538
|
const optimisticRow = {
|
|
1510
1539
|
...scope,
|
|
1511
1540
|
sourceKey: entityType,
|
|
1512
1541
|
localId: aggregateLocalId,
|
|
1513
|
-
serverId:
|
|
1542
|
+
serverId: initialServerId,
|
|
1514
1543
|
values: optimisticValue,
|
|
1515
1544
|
confirmedValues: existing?.confirmedValues ?? existing?.values ?? null,
|
|
1516
1545
|
serverRevision: existing?.serverRevision ?? normalized.baseRevision,
|
|
@@ -1725,7 +1754,7 @@ class OfflineSyncService {
|
|
|
1725
1754
|
if (!row)
|
|
1726
1755
|
continue;
|
|
1727
1756
|
const remaining = all.filter((item) => !discardedIds.has(item.commandId) && this.#aggregateKey(item) === key);
|
|
1728
|
-
if (remaining.length === 0 && row.confirmedValues === null
|
|
1757
|
+
if (remaining.length === 0 && row.confirmedValues === null) {
|
|
1729
1758
|
removeRows.push(row);
|
|
1730
1759
|
}
|
|
1731
1760
|
else {
|
|
@@ -1790,6 +1819,9 @@ class OfflineSyncService {
|
|
|
1790
1819
|
}
|
|
1791
1820
|
return incoming;
|
|
1792
1821
|
}
|
|
1822
|
+
#initialServerId(current, incoming) {
|
|
1823
|
+
return incoming === null || incoming === undefined ? current : this.#resolvedServerId(current, incoming);
|
|
1824
|
+
}
|
|
1793
1825
|
async #discoverScopes(generation = this.#generation) {
|
|
1794
1826
|
const session = await this.#context.getSession();
|
|
1795
1827
|
if (!this.#isCurrent(generation))
|
|
@@ -1998,10 +2030,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1998
2030
|
args: [{ providedIn: 'root' }]
|
|
1999
2031
|
}] });
|
|
2000
2032
|
|
|
2001
|
-
/** DI token for the
|
|
2002
|
-
const
|
|
2033
|
+
/** DI token for the native community SQLite driver. */
|
|
2034
|
+
const COMMUNITY_SQLITE = new InjectionToken('COMMUNITY_SQLITE', {
|
|
2003
2035
|
factory: () => null,
|
|
2004
2036
|
});
|
|
2037
|
+
/** Create the standard encrypted `@capacitor-community/sqlite` driver. */
|
|
2038
|
+
function createCommunitySqliteDriver(connection) {
|
|
2039
|
+
const databases = new Map();
|
|
2040
|
+
const database = (databaseId) => {
|
|
2041
|
+
const value = databases.get(databaseId);
|
|
2042
|
+
if (!value)
|
|
2043
|
+
throw new Error(`Offline SQLite database "${databaseId}" is not open`);
|
|
2044
|
+
return value;
|
|
2045
|
+
};
|
|
2046
|
+
return {
|
|
2047
|
+
async open({ databaseName, createEncryptionKey }) {
|
|
2048
|
+
const stored = await connection.isSecretStored();
|
|
2049
|
+
if (!stored.result) {
|
|
2050
|
+
const encryptionKey = await createEncryptionKey?.();
|
|
2051
|
+
if (!encryptionKey)
|
|
2052
|
+
throw new Error('Native offline storage requires a non-empty encryption key on first open');
|
|
2053
|
+
await connection.setEncryptionSecret(encryptionKey);
|
|
2054
|
+
}
|
|
2055
|
+
const value = await connection.createConnection(databaseName, true, 'secret', 1, false);
|
|
2056
|
+
await value.open();
|
|
2057
|
+
databases.set(databaseName, value);
|
|
2058
|
+
return { databaseId: databaseName };
|
|
2059
|
+
},
|
|
2060
|
+
async execute({ databaseId, statement, values = [] }) {
|
|
2061
|
+
await database(databaseId).run(statement, values, false);
|
|
2062
|
+
},
|
|
2063
|
+
async query({ databaseId, statement, values = [] }) {
|
|
2064
|
+
const result = await database(databaseId).query(statement, values);
|
|
2065
|
+
return { rows: result.values ?? [] };
|
|
2066
|
+
},
|
|
2067
|
+
async beginTransaction({ databaseId }) {
|
|
2068
|
+
await database(databaseId).beginTransaction();
|
|
2069
|
+
},
|
|
2070
|
+
async commitTransaction({ databaseId }) {
|
|
2071
|
+
await database(databaseId).commitTransaction();
|
|
2072
|
+
},
|
|
2073
|
+
async rollbackTransaction({ databaseId }) {
|
|
2074
|
+
await database(databaseId).rollbackTransaction();
|
|
2075
|
+
},
|
|
2076
|
+
};
|
|
2077
|
+
}
|
|
2005
2078
|
const SCHEMA = [
|
|
2006
2079
|
`CREATE TABLE IF NOT EXISTS offline_metadata (
|
|
2007
2080
|
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
@@ -2043,9 +2116,9 @@ const SCHEMA = [
|
|
|
2043
2116
|
PRIMARY KEY (user_id, group_id)
|
|
2044
2117
|
)`,
|
|
2045
2118
|
];
|
|
2046
|
-
/** Native iOS/Android
|
|
2119
|
+
/** Native iOS/Android repository backed by encrypted `@capacitor-community/sqlite`. */
|
|
2047
2120
|
class SqliteOfflineRepository {
|
|
2048
|
-
#sqlite = inject(
|
|
2121
|
+
#sqlite = inject(COMMUNITY_SQLITE);
|
|
2049
2122
|
#options = inject(OFFLINE_KIT_OPTIONS);
|
|
2050
2123
|
#databaseId = null;
|
|
2051
2124
|
#initialization = null;
|
|
@@ -2181,14 +2254,10 @@ class SqliteOfflineRepository {
|
|
|
2181
2254
|
}
|
|
2182
2255
|
async #open() {
|
|
2183
2256
|
if (!this.#sqlite)
|
|
2184
|
-
throw new Error('Native offline storage requires
|
|
2185
|
-
const encryptionKey = await this.#options.encryptionKey?.();
|
|
2186
|
-
if (!encryptionKey)
|
|
2187
|
-
throw new Error('Native offline storage requires a non-empty encryption key');
|
|
2257
|
+
throw new Error('Native offline storage requires a community SQLite connection');
|
|
2188
2258
|
const { databaseId } = await this.#sqlite.open({
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
readOnly: false,
|
|
2259
|
+
databaseName: this.#options.databaseName,
|
|
2260
|
+
createEncryptionKey: this.#options.createEncryptionKey,
|
|
2192
2261
|
});
|
|
2193
2262
|
this.#databaseId = databaseId;
|
|
2194
2263
|
for (const statement of SCHEMA)
|
|
@@ -2478,7 +2547,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2478
2547
|
* Provide the standard scoped offline runtime.
|
|
2479
2548
|
*
|
|
2480
2549
|
* @remarks
|
|
2481
|
-
* Web uses Ionic Storage. Native iOS/Android uses encrypted
|
|
2550
|
+
* Web uses Ionic Storage. Native iOS/Android uses encrypted `@capacitor-community/sqlite`. The application owns
|
|
2482
2551
|
* URL/DTO policy and command execution; the kit owns persistence, ordering, retries, and session
|
|
2483
2552
|
* isolation.
|
|
2484
2553
|
*/
|
|
@@ -2490,11 +2559,14 @@ function provideOffline(options) {
|
|
|
2490
2559
|
provide: OFFLINE_KIT_OPTIONS,
|
|
2491
2560
|
useValue: {
|
|
2492
2561
|
databaseName: options.databaseName,
|
|
2493
|
-
|
|
2562
|
+
createEncryptionKey: options.createEncryptionKey,
|
|
2494
2563
|
replicaSchema: options.replicaSchema,
|
|
2495
2564
|
},
|
|
2496
2565
|
},
|
|
2497
|
-
{
|
|
2566
|
+
{
|
|
2567
|
+
provide: COMMUNITY_SQLITE,
|
|
2568
|
+
useValue: options.sqliteConnection ? createCommunitySqliteDriver(options.sqliteConnection) : null,
|
|
2569
|
+
},
|
|
2498
2570
|
{
|
|
2499
2571
|
provide: OFFLINE_REPOSITORY,
|
|
2500
2572
|
useFactory: () => selectOfflineRepository(Capacitor.getPlatform(), inject(IonicOfflineRepository), inject(SqliteOfflineRepository)),
|
|
@@ -2565,5 +2637,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2565
2637
|
* Generated bundle index. Do not edit.
|
|
2566
2638
|
*/
|
|
2567
2639
|
|
|
2568
|
-
export {
|
|
2640
|
+
export { COMMUNITY_SQLITE, DEFAULT_OFFLINE_COMMAND_HOOKS, IonicOfflineRepository, OFFLINE_BYPASS, OFFLINE_COMMAND_EXECUTOR, OFFLINE_COMMAND_HOOKS, OFFLINE_KIT_OPTIONS, OFFLINE_REPLICA_PULLER, OFFLINE_REPOSITORY, OFFLINE_REQUEST_POLICIES, OFFLINE_RESPONSE_HEADER, OFFLINE_SCHEMA_VERSION, OFFLINE_SYNC_CONTEXT, OfflineCoordinatorService, OfflineNetworkService, OfflinePayloadValidationError, OfflineReplicaPullService, OfflineRequestFallbackService, OfflineRequestPolicyRegistry, OfflineSessionService, OfflineSyncService, SqliteOfflineRepository, booleanColumn, createCommunitySqliteDriver, datetime, decodeOfflineReplicaValues, defineOfflineReplicaSchema, defineReplicaEntity, encodeOfflineReplicaValues, ignored, integer, isOfflineFallbackError, json, nullable, offlineInterceptor, projectOfflineReplicaValues, provideOffline, provideOfflineRequestPolicy, real, selectOfflineRepository, serverId, sha256OfflineReplicaSchema, text };
|
|
2569
2641
|
//# sourceMappingURL=rdlabo-ionic-angular-kit-offline.mjs.map
|