@rdlabo/ionic-angular-kit 21.5.4 → 21.5.6
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/package.json
CHANGED
|
@@ -16,7 +16,7 @@ type OfflineReplicaSqliteAffinity = 'TEXT' | 'INTEGER' | 'REAL';
|
|
|
16
16
|
*/
|
|
17
17
|
type OfflineReplicaStorageKind = 'text' | 'integer' | 'real' | 'booleanColumn' | 'json' | 'datetime';
|
|
18
18
|
/** Scope partition persisted on every replica table row. */
|
|
19
|
-
type OfflineReplicaEntityScope = 'user' | '
|
|
19
|
+
type OfflineReplicaEntityScope = 'user' | 'partition';
|
|
20
20
|
/** Field projection policy for a source-model property. */
|
|
21
21
|
type OfflineReplicaFieldPolicy = 'column' | 'serverId' | 'ignored';
|
|
22
22
|
/** Runtime descriptor for one mapped source property. */
|
|
@@ -42,7 +42,7 @@ interface OfflineReplicaEntitySchema<TSelect extends Record<string, unknown>> {
|
|
|
42
42
|
readonly tableName: string;
|
|
43
43
|
/** Stable source key used by sync and repository layers. */
|
|
44
44
|
readonly sourceKey: string;
|
|
45
|
-
/** Whether rows are partitioned by user only or user plus
|
|
45
|
+
/** Whether rows are partitioned by user only or user plus scope partition. */
|
|
46
46
|
readonly scope: OfflineReplicaEntityScope;
|
|
47
47
|
/** Ordered field descriptors derived from the DSL definition. */
|
|
48
48
|
readonly fields: readonly OfflineReplicaFieldDescriptor[];
|
|
@@ -219,10 +219,10 @@ declare function sha256OfflineReplicaSchema(bundle: OfflineReplicaSchemaBundle):
|
|
|
219
219
|
|
|
220
220
|
/** Current durable storage schema used by both web and native repositories. */
|
|
221
221
|
declare const OFFLINE_SCHEMA_VERSION = 4;
|
|
222
|
-
/** User and
|
|
222
|
+
/** User and partition scope of all local offline data. */
|
|
223
223
|
interface OfflineScope {
|
|
224
224
|
userId: number;
|
|
225
|
-
|
|
225
|
+
scopeId: string;
|
|
226
226
|
}
|
|
227
227
|
/** Synchronization state of a locally materialized product replica row. */
|
|
228
228
|
type OfflineReplicaSyncState = 'confirmed' | 'pending' | 'blocked_auth' | 'rejected' | 'conflict';
|
|
@@ -262,7 +262,7 @@ interface OfflineReplicaRow<TValues = unknown> extends OfflineScope {
|
|
|
262
262
|
fetchedAt: number;
|
|
263
263
|
syncState: OfflineReplicaSyncState;
|
|
264
264
|
}
|
|
265
|
-
/** Stable address of a product replica row inside a user
|
|
265
|
+
/** Stable address of a product replica row inside a user or partition-scoped replica. */
|
|
266
266
|
interface OfflineReplicaRowKey extends OfflineScope {
|
|
267
267
|
sourceKey: string;
|
|
268
268
|
localId: string;
|
|
@@ -296,7 +296,7 @@ interface OfflineRepository {
|
|
|
296
296
|
replaceCommand(command: OfflineCommand): Promise<void>;
|
|
297
297
|
removeCommand(commandId: string): Promise<void>;
|
|
298
298
|
clearUser(userId: number): Promise<void>;
|
|
299
|
-
|
|
299
|
+
clearScope(scope: OfflineScope): Promise<void>;
|
|
300
300
|
transactReplica(transaction: OfflineReplicaTransaction): Promise<void>;
|
|
301
301
|
}
|
|
302
302
|
/** DI token for the selected platform repository. */
|
|
@@ -321,13 +321,13 @@ declare class IonicOfflineRepository implements OfflineRepository {
|
|
|
321
321
|
replaceCommand(command: OfflineCommand): Promise<void>;
|
|
322
322
|
removeCommand(commandId: string): Promise<void>;
|
|
323
323
|
clearUser(userId: number): Promise<void>;
|
|
324
|
-
|
|
324
|
+
clearScope(scope: OfflineScope): Promise<void>;
|
|
325
325
|
transactReplica(transaction: OfflineReplicaTransaction): Promise<void>;
|
|
326
326
|
static ɵfac: i0.ɵɵFactoryDeclaration<IonicOfflineRepository, never>;
|
|
327
327
|
static ɵprov: i0.ɵɵInjectableDeclaration<IonicOfflineRepository>;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
/** Server pull request for one user
|
|
330
|
+
/** Server pull request for one user or partition-scoped replica. */
|
|
331
331
|
interface OfflineReplicaPullRequest {
|
|
332
332
|
scope: OfflineScope;
|
|
333
333
|
cursor: string;
|
|
@@ -395,7 +395,7 @@ interface OfflineCommandExecutor {
|
|
|
395
395
|
}
|
|
396
396
|
/** DI token for the product-specific command transport adapter. */
|
|
397
397
|
declare const OFFLINE_COMMAND_EXECUTOR: InjectionToken<OfflineCommandExecutor>;
|
|
398
|
-
/** Authenticated user and
|
|
398
|
+
/** Authenticated user and partition scopes currently eligible for synchronization. */
|
|
399
399
|
interface OfflineSyncSession {
|
|
400
400
|
userId: number;
|
|
401
401
|
scopes: OfflineScope[];
|
|
@@ -419,10 +419,10 @@ declare const DEFAULT_OFFLINE_COMMAND_HOOKS: OfflineCommandHooks;
|
|
|
419
419
|
/** DI token for optional product-specific synchronization hooks. */
|
|
420
420
|
declare const OFFLINE_COMMAND_HOOKS: InjectionToken<OfflineCommandHooks>;
|
|
421
421
|
|
|
422
|
-
/** Persisted identity and
|
|
422
|
+
/** Persisted identity and partition boundary for one authenticated local replica. */
|
|
423
423
|
interface OfflineSessionManifest {
|
|
424
424
|
userId: number;
|
|
425
|
-
scopeIds:
|
|
425
|
+
readonly scopeIds: readonly string[];
|
|
426
426
|
/** Authentication-provider subject used to distinguish users on a shared device. */
|
|
427
427
|
authSubject: string | null;
|
|
428
428
|
updatedAt: number;
|
|
@@ -436,8 +436,8 @@ declare class OfflineSessionService {
|
|
|
436
436
|
#private;
|
|
437
437
|
readonly activeManifest: i0.Signal<OfflineSessionManifest | null>;
|
|
438
438
|
initialize(): Promise<void>;
|
|
439
|
-
activateSession(userId: number, scopeIds: readonly
|
|
440
|
-
activateSession(userId: number, scopeIds: readonly
|
|
439
|
+
activateSession(userId: number, scopeIds: readonly string[], authSubject: string | null): Promise<void>;
|
|
440
|
+
activateSession(userId: number, scopeIds: readonly string[], authSubject: string | null, lease: OfflineSessionTransitionLease): Promise<boolean>;
|
|
441
441
|
clearActiveSession(): Promise<void>;
|
|
442
442
|
/** Immediately revoke local and remote runtime access while durable cleanup is pending. */
|
|
443
443
|
revokeAccess(): void;
|
|
@@ -490,9 +490,9 @@ declare class OfflineCoordinatorService {
|
|
|
490
490
|
readonly pendingCount: i0.Signal<number>;
|
|
491
491
|
readonly conflicts: i0.Signal<_rdlabo_ionic_angular_kit_offline.OfflineCommand<unknown>[]>;
|
|
492
492
|
initialize(): Promise<void>;
|
|
493
|
-
activateSession(userId: number, scopeIds: readonly
|
|
493
|
+
activateSession(userId: number, scopeIds: readonly string[], authSubject: string | null): Promise<void>;
|
|
494
494
|
/** Installs a remotely verified identity without starting pull or outbox replay. */
|
|
495
|
-
prepareRemoteSession(userId: number, scopeIds: readonly
|
|
495
|
+
prepareRemoteSession(userId: number, scopeIds: readonly string[], authSubject: string | null, authLease?: OfflineSessionTransitionLease): Promise<boolean>;
|
|
496
496
|
/** Starts pull and outbox replay after the caller has published remote access. */
|
|
497
497
|
resumeRemoteSession(): Promise<void>;
|
|
498
498
|
/**
|
|
@@ -509,7 +509,7 @@ declare class OfflineCoordinatorService {
|
|
|
509
509
|
/** Remote identity fields required to activate an offline session boundary. */
|
|
510
510
|
interface OfflineRemoteIdentity {
|
|
511
511
|
readonly userId: number;
|
|
512
|
-
readonly scopeIds: readonly
|
|
512
|
+
readonly scopeIds: readonly string[];
|
|
513
513
|
readonly authSubject: string;
|
|
514
514
|
}
|
|
515
515
|
/** Phase that distinguishes route authorization from background remote recovery. */
|
|
@@ -579,6 +579,13 @@ type OfflineAuthBridgeConfig = Pick<KitAuthConfig, 'onAuthorized' | 'onUnavailab
|
|
|
579
579
|
*/
|
|
580
580
|
declare function createOfflineAuthBridge<TIdentity extends OfflineRemoteIdentity>(options: CreateOfflineAuthBridgeOptions<TIdentity>): OfflineAuthBridgeConfig;
|
|
581
581
|
|
|
582
|
+
/** Backpressure limits for durable commands. Pending commands are never evicted automatically. */
|
|
583
|
+
interface OfflineOutboxLimits {
|
|
584
|
+
/** Maximum number of commands retained for one user. Defaults to 1,000. */
|
|
585
|
+
maxCommandsPerUser?: number;
|
|
586
|
+
/** Maximum serialized size retained for one user. Defaults to 10 MiB. */
|
|
587
|
+
maxBytesPerUser?: number;
|
|
588
|
+
}
|
|
582
589
|
/** Product-independent native offline persistence settings. */
|
|
583
590
|
interface OfflineKitOptions {
|
|
584
591
|
/** Encrypted SQLite database name used on iOS and Android. */
|
|
@@ -587,6 +594,8 @@ interface OfflineKitOptions {
|
|
|
587
594
|
createEncryptionKey?: () => Promise<string>;
|
|
588
595
|
/** Versioned product replica schema applied to native SQLite during initialization. */
|
|
589
596
|
replicaSchema: OfflineReplicaSchemaBundle;
|
|
597
|
+
/** Optional durable Outbox backpressure policy. */
|
|
598
|
+
outboxLimits?: OfflineOutboxLimits;
|
|
590
599
|
}
|
|
591
600
|
/** DI token for product-independent offline persistence settings. */
|
|
592
601
|
declare const OFFLINE_KIT_OPTIONS: InjectionToken<OfflineKitOptions>;
|
|
@@ -708,7 +717,7 @@ declare class SqliteOfflineRepository implements OfflineRepository {
|
|
|
708
717
|
replaceCommand(command: OfflineCommand): Promise<void>;
|
|
709
718
|
removeCommand(commandId: string): Promise<void>;
|
|
710
719
|
clearUser(userId: number): Promise<void>;
|
|
711
|
-
|
|
720
|
+
clearScope(scope: OfflineScope): Promise<void>;
|
|
712
721
|
transactReplica(transaction: OfflineReplicaTransaction): Promise<void>;
|
|
713
722
|
static ɵfac: i0.ɵɵFactoryDeclaration<SqliteOfflineRepository, never>;
|
|
714
723
|
static ɵprov: i0.ɵɵInjectableDeclaration<SqliteOfflineRepository>;
|
|
@@ -743,7 +752,7 @@ declare function provideOffline(options: ProvideOfflineOptions): EnvironmentProv
|
|
|
743
752
|
type OfflineSyncState = 'idle' | 'pending' | 'syncing' | 'attention';
|
|
744
753
|
/** Mutation and optimistic entity materialization appended atomically to the outbox. */
|
|
745
754
|
interface EnqueueOfflineCommand<T = unknown> {
|
|
746
|
-
|
|
755
|
+
scopeId: string;
|
|
747
756
|
aggregateType: string;
|
|
748
757
|
/** Stable UUID generated by the client before the entity is first written. */
|
|
749
758
|
aggregateLocalId: string;
|
|
@@ -759,6 +768,13 @@ interface EnqueueOfflineCommand<T = unknown> {
|
|
|
759
768
|
declare class OfflinePayloadValidationError extends Error {
|
|
760
769
|
constructor(message?: string);
|
|
761
770
|
}
|
|
771
|
+
/** Raised before persistence when retaining another command would exceed the configured durable Outbox capacity. */
|
|
772
|
+
declare class OfflineOutboxCapacityError extends Error {
|
|
773
|
+
readonly reason: 'command_count' | 'serialized_bytes';
|
|
774
|
+
readonly currentCommands: number;
|
|
775
|
+
readonly currentBytes: number;
|
|
776
|
+
constructor(reason: 'command_count' | 'serialized_bytes', currentCommands: number, currentBytes: number);
|
|
777
|
+
}
|
|
762
778
|
/** Maintains the optimistic local replica and synchronizes its durable outbox. */
|
|
763
779
|
declare class OfflineSyncService {
|
|
764
780
|
#private;
|
|
@@ -798,5 +814,5 @@ declare class OfflineRequestFallbackService {
|
|
|
798
814
|
static ɵprov: i0.ɵɵInjectableDeclaration<OfflineRequestFallbackService>;
|
|
799
815
|
}
|
|
800
816
|
|
|
801
|
-
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, assertOfflineReplicaServerId, booleanColumn, createCommunitySqliteDriver, createOfflineAuthBridge, datetime, decodeOfflineReplicaValues, defineOfflineReplicaSchema, defineReplicaEntity, encodeOfflineReplicaValues, ignored, integer, isOfflineFallbackError, json, nullable, offlineInterceptor, projectOfflineReplicaValues, provideOffline, provideOfflineRequestPolicy, real, selectOfflineRepository, serverId, sha256OfflineReplicaSchema, text };
|
|
802
|
-
export type { CommunitySqliteConnection, CommunitySqliteDatabase, CommunitySqliteDriver, CreateOfflineAuthBridgeOptions, EnqueueOfflineCommand, OfflineAuthBridgeConfig, OfflineAuthExchangeContext, OfflineAuthExchangePhase, OfflineAuthResumeContext, OfflineCommand, OfflineCommandExecutor, OfflineCommandHooks, OfflineCommandResult, OfflineCommandState, OfflineCommandTarget, OfflineKitOptions, OfflineLogoutAction, OfflineNetworkState, OfflineReadRequestPlan, OfflineRemoteIdentity, OfflineReplicaChange, OfflineReplicaColumnDef, OfflineReplicaCursor, OfflineReplicaEntityDefinition, OfflineReplicaEntitySchema, OfflineReplicaEntityScope, OfflineReplicaFieldDescriptor, OfflineReplicaFieldPolicy, OfflineReplicaIgnoredDef, OfflineReplicaMigration, OfflineReplicaPullPage, OfflineReplicaPullRequest, OfflineReplicaPuller, OfflineReplicaRow, OfflineReplicaRowKey, OfflineReplicaSchemaBundle, OfflineReplicaSchemaDefinition, OfflineReplicaServerIdDef, OfflineReplicaSqliteAffinity, OfflineReplicaStorageKind, OfflineReplicaSyncState, OfflineReplicaTransaction, OfflineReplicaWebMigrationCallback, OfflineReplicaWebMigrationResult, OfflineReplicaWebMigrationRow, OfflineRepository, OfflineRequestPlan, OfflineRequestPolicy, OfflineResponseSource, OfflineScope, OfflineSessionManifest, OfflineSessionTransitionLease, OfflineSyncContext, OfflineSyncSession, OfflineSyncState, ProvideOfflineOptions };
|
|
817
|
+
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, OfflineOutboxCapacityError, OfflinePayloadValidationError, OfflineReplicaPullService, OfflineRequestFallbackService, OfflineRequestPolicyRegistry, OfflineSessionService, OfflineSyncService, SqliteOfflineRepository, assertOfflineReplicaServerId, booleanColumn, createCommunitySqliteDriver, createOfflineAuthBridge, datetime, decodeOfflineReplicaValues, defineOfflineReplicaSchema, defineReplicaEntity, encodeOfflineReplicaValues, ignored, integer, isOfflineFallbackError, json, nullable, offlineInterceptor, projectOfflineReplicaValues, provideOffline, provideOfflineRequestPolicy, real, selectOfflineRepository, serverId, sha256OfflineReplicaSchema, text };
|
|
818
|
+
export type { CommunitySqliteConnection, CommunitySqliteDatabase, CommunitySqliteDriver, CreateOfflineAuthBridgeOptions, EnqueueOfflineCommand, OfflineAuthBridgeConfig, OfflineAuthExchangeContext, OfflineAuthExchangePhase, OfflineAuthResumeContext, OfflineCommand, OfflineCommandExecutor, OfflineCommandHooks, OfflineCommandResult, OfflineCommandState, OfflineCommandTarget, OfflineKitOptions, OfflineLogoutAction, OfflineNetworkState, OfflineOutboxLimits, OfflineReadRequestPlan, OfflineRemoteIdentity, OfflineReplicaChange, OfflineReplicaColumnDef, OfflineReplicaCursor, OfflineReplicaEntityDefinition, OfflineReplicaEntitySchema, OfflineReplicaEntityScope, OfflineReplicaFieldDescriptor, OfflineReplicaFieldPolicy, OfflineReplicaIgnoredDef, OfflineReplicaMigration, OfflineReplicaPullPage, OfflineReplicaPullRequest, OfflineReplicaPuller, OfflineReplicaRow, OfflineReplicaRowKey, OfflineReplicaSchemaBundle, OfflineReplicaSchemaDefinition, OfflineReplicaServerIdDef, OfflineReplicaSqliteAffinity, OfflineReplicaStorageKind, OfflineReplicaSyncState, OfflineReplicaTransaction, OfflineReplicaWebMigrationCallback, OfflineReplicaWebMigrationResult, OfflineReplicaWebMigrationRow, OfflineRepository, OfflineRequestPlan, OfflineRequestPolicy, OfflineResponseSource, OfflineScope, OfflineSessionManifest, OfflineSessionTransitionLease, OfflineSyncContext, OfflineSyncSession, OfflineSyncState, ProvideOfflineOptions };
|