@rdlabo/ionic-angular-kit 21.5.7 → 21.5.9

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdlabo/ionic-angular-kit",
3
- "version": "21.5.7",
3
+ "version": "21.5.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/rdlabo-team/ionic-angular-library.git"
@@ -259,7 +259,7 @@ declare function defineOfflineReplicaSchema(definition: OfflineReplicaSchemaDefi
259
259
  declare function sha256OfflineReplicaSchema(bundle: OfflineReplicaSchemaBundle): Promise<string>;
260
260
 
261
261
  /** Current durable storage schema used by both web and native repositories. */
262
- declare const OFFLINE_SCHEMA_VERSION = 4;
262
+ declare const OFFLINE_SCHEMA_VERSION = 5;
263
263
  /** User and partition scope of all local offline data. */
264
264
  interface OfflineScope {
265
265
  userId: number;
@@ -267,6 +267,8 @@ interface OfflineScope {
267
267
  }
268
268
  /** Synchronization state of a locally materialized product replica row. */
269
269
  type OfflineReplicaSyncState = 'confirmed' | 'pending' | 'blocked_auth' | 'rejected' | 'conflict';
270
+ type OfflineReplicaVisibility = 'present' | 'pending_delete';
271
+ type OfflineReplicaMutation = 'upsert' | 'delete';
270
272
  /** Durable processing state of an outbox command. */
271
273
  type OfflineCommandState = 'pending' | 'sending' | 'retry_wait' | 'blocked_auth' | 'rejected' | 'conflict';
272
274
  /** Product-agnostic mutation persisted in the outbox by local id. */
@@ -279,6 +281,8 @@ interface OfflineCommand<T = unknown> extends OfflineScope {
279
281
  payload: T;
280
282
  /** Full optimistic entity value displayed while this command is pending. */
281
283
  optimisticValue: unknown;
284
+ /** Durable intent used to preserve a hidden tombstone across restart and replay. */
285
+ replicaMutation?: OfflineReplicaMutation;
282
286
  payloadHash: string;
283
287
  baseRevision: string | number | null;
284
288
  state: OfflineCommandState;
@@ -302,12 +306,19 @@ interface OfflineReplicaRow<TValues = unknown> extends OfflineScope {
302
306
  serverRevision: string | number | null;
303
307
  fetchedAt: number;
304
308
  syncState: OfflineReplicaSyncState;
309
+ /** Library-owned visibility; pending deletes remain durable but are hidden from product reads. */
310
+ visibility?: OfflineReplicaVisibility;
305
311
  }
306
312
  /** Stable address of a product replica row inside a user or partition-scoped replica. */
307
313
  interface OfflineReplicaRowKey extends OfflineScope {
308
314
  sourceKey: string;
309
315
  localId: string;
310
316
  }
317
+ /** Explicit one-way release of a server-generated identity during a replica delete acknowledgement. */
318
+ interface OfflineReplicaServerIdRelease extends OfflineReplicaRowKey {
319
+ /** The current server id being released; the matching put row must set `serverId` to null. */
320
+ serverId: number;
321
+ }
311
322
  /** Scope partition plus the durable replica pull cursor for that partition. */
312
323
  interface OfflineReplicaCursor extends OfflineScope {
313
324
  cursor: string;
@@ -315,6 +326,11 @@ interface OfflineReplicaCursor extends OfflineScope {
315
326
  /** Atomic changes applied to the local replica and durable outbox together. */
316
327
  interface OfflineReplicaTransaction {
317
328
  putRows?: readonly OfflineReplicaRow[];
329
+ /**
330
+ * Allows only the matching `serverId: current -> null` transition in `putRows`.
331
+ * All other server-id changes remain immutable.
332
+ */
333
+ releaseServerIds?: readonly OfflineReplicaServerIdRelease[];
318
334
  removeRows?: readonly OfflineReplicaRowKey[];
319
335
  putCommands?: readonly OfflineCommand[];
320
336
  removeCommandIds?: readonly string[];
@@ -328,6 +344,8 @@ interface OfflineRepository {
328
344
  getSessionManifest<T>(userId: number): Promise<T | null>;
329
345
  putSessionManifest<T>(userId: number, value: T): Promise<void>;
330
346
  getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string, localId: string): Promise<OfflineReplicaRow<TValues> | null>;
347
+ /** Internal durable lookup used by synchronization; includes pending-delete tombstones. */
348
+ getReplicaRowIncludingPendingDelete?<TValues = unknown>(scope: OfflineScope, sourceKey: string, localId: string): Promise<OfflineReplicaRow<TValues> | null>;
331
349
  getReplicaRows<TValues = unknown>(scope: OfflineScope, sourceKey: string): Promise<OfflineReplicaRow<TValues>[]>;
332
350
  getReplicaRowByServerId<TValues = unknown>(scope: OfflineScope, sourceKey: string, serverId: number): Promise<OfflineReplicaRow<TValues> | null>;
333
351
  getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
@@ -354,6 +372,7 @@ declare class IonicOfflineRepository implements OfflineRepository {
354
372
  getSessionManifest<T>(userId: number): Promise<T | null>;
355
373
  putSessionManifest<T>(userId: number, value: T): Promise<void>;
356
374
  getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string, localId: string): Promise<OfflineReplicaRow<TValues> | null>;
375
+ getReplicaRowIncludingPendingDelete<TValues = unknown>(scope: OfflineScope, sourceKey: string, localId: string): Promise<OfflineReplicaRow<TValues> | null>;
357
376
  getReplicaRows<TValues = unknown>(scope: OfflineScope, sourceKey: string): Promise<OfflineReplicaRow<TValues>[]>;
358
377
  getReplicaRowByServerId<TValues = unknown>(scope: OfflineScope, sourceKey: string, serverId: number): Promise<OfflineReplicaRow<TValues> | null>;
359
378
  getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
@@ -423,6 +442,11 @@ interface OfflineCommandResult {
423
442
  confirmedValues?: unknown;
424
443
  /** Removes the local replica row after a confirmed server delete. */
425
444
  removeReplica?: boolean;
445
+ /**
446
+ * Releases the deleted row's remote AUTO_INCREMENT identity while keeping
447
+ * its immutable local id for a queued recreate of the same logical target.
448
+ */
449
+ clearServerId?: boolean;
426
450
  response?: unknown;
427
451
  }
428
452
  /** Target ids resolved from the local replica immediately before transport. */
@@ -438,6 +462,11 @@ interface OfflineCommandExecutor {
438
462
  /** Sends the command using `command.commandId` as its durable server-side idempotency key. */
439
463
  execute(command: OfflineCommand, target: OfflineCommandTarget): Promise<OfflineCommandResult>;
440
464
  withServerRevision(command: OfflineCommand, revision: string | number): OfflineCommand;
465
+ /**
466
+ * Removes the deleted remote row's revision from a queued recreate.
467
+ * Required only when `clearServerId` completes while later commands remain.
468
+ */
469
+ withoutServerRevision?(command: OfflineCommand): OfflineCommand;
441
470
  }
442
471
  /** DI token for the product-specific command transport adapter. */
443
472
  declare const OFFLINE_COMMAND_EXECUTOR: InjectionToken<OfflineCommandExecutor>;
@@ -754,6 +783,7 @@ declare class SqliteOfflineRepository implements OfflineRepository {
754
783
  getSessionManifest<T>(userId: number): Promise<T | null>;
755
784
  putSessionManifest<T>(userId: number, value: T): Promise<void>;
756
785
  getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string, localId: string): Promise<OfflineReplicaRow<TValues> | null>;
786
+ getReplicaRowIncludingPendingDelete<TValues = unknown>(scope: OfflineScope, sourceKey: string, localId: string): Promise<OfflineReplicaRow<TValues> | null>;
757
787
  getReplicaRows<TValues = unknown>(scope: OfflineScope, sourceKey: string): Promise<OfflineReplicaRow<TValues>[]>;
758
788
  getReplicaRowByServerId<TValues = unknown>(scope: OfflineScope, sourceKey: string, serverId: number): Promise<OfflineReplicaRow<TValues> | null>;
759
789
  getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
@@ -803,12 +833,27 @@ interface EnqueueOfflineCommand<T = unknown> {
803
833
  aggregateType: string;
804
834
  /** Stable UUID generated by the client before the entity is first written. */
805
835
  aggregateLocalId: string;
806
- /** Known immutable server identity when adopting an entity before its first replica pull. */
836
+ /**
837
+ * Backward-compatible explicit server-id adoption. When no replica row
838
+ * exists, this initializes its server mapping; use `serverIdHint` for a
839
+ * stale product-side read that must never create such a mapping.
840
+ */
807
841
  serverId?: number | null;
842
+ /**
843
+ * Optional consistency check for an already replicated row. It is ignored
844
+ * when the local row does not exist, so it cannot resurrect an
845
+ * AUTO_INCREMENT id after delete/recreate.
846
+ */
847
+ serverIdHint?: number | null;
808
848
  operation: string;
809
849
  payload: T;
810
850
  /** Full local entity value committed to the replica before the command is exposed to the UI. */
811
851
  optimisticValue: unknown;
852
+ /**
853
+ * Optimistically hides an existing DB row while retaining its identity and
854
+ * confirmed baseline for durable replay, conflict handling, and discard.
855
+ */
856
+ replicaMutation?: 'upsert' | 'delete';
812
857
  baseRevision?: string | number | null;
813
858
  }
814
859
  /** Raised before persistence when an outbox payload is not losslessly JSON serializable. */
@@ -842,6 +887,18 @@ declare class OfflineSyncService {
842
887
  enqueue<T>(request: EnqueueOfflineCommand<T>, options?: {
843
888
  flush?: boolean;
844
889
  }): Promise<string>;
890
+ /**
891
+ * Serializes a product-owned replica projection with enqueue and command ACK
892
+ * reconciliation. For read/derive/write cache updates, prefer
893
+ * `runSerializedReplicaMutation` so the read is serialized as well.
894
+ */
895
+ transactReplica(transaction: OfflineReplicaTransaction): Promise<void>;
896
+ /**
897
+ * Runs a product cache's replica read/derive/write sequence atomically with
898
+ * enqueue and ACK projection. Use this for any repository reads that inform
899
+ * a later transaction; `transactReplica` alone only serializes the write.
900
+ */
901
+ runSerializedReplicaMutation<T>(operation: (repository: OfflineRepository) => Promise<T>): Promise<T>;
845
902
  discard(commandId: string, options?: {
846
903
  flush?: boolean;
847
904
  }): Promise<void>;
@@ -862,4 +919,4 @@ declare class OfflineRequestFallbackService {
862
919
  }
863
920
 
864
921
  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, assertOfflineReplicaNaturalKeyBaseline, assertOfflineReplicaServerId, booleanColumn, canonicalOfflineRemoteIdentity, createCommunitySqliteDriver, createOfflineAuthBridge, datetime, decodeOfflineReplicaValues, defineOfflineReplicaSchema, defineReplicaEntity, encodeOfflineReplicaValues, ignored, integer, isOfflineFallbackError, json, naturalKey, normalizeOfflineNaturalKey, nullable, offlineInterceptor, offlineNaturalKeyFromValues, projectOfflineReplicaValues, provideOffline, provideOfflineRequestPolicy, real, selectOfflineRepository, serverId, sha256OfflineReplicaSchema, text };
865
- export type { CommunitySqliteConnection, CommunitySqliteDatabase, CommunitySqliteDriver, CreateOfflineAuthBridgeOptions, EnqueueOfflineCommand, OfflineAuthBridgeConfig, OfflineAuthExchangeContext, OfflineAuthExchangePhase, OfflineAuthResumeContext, OfflineCommand, OfflineCommandExecutor, OfflineCommandHooks, OfflineCommandResult, OfflineCommandState, OfflineCommandTarget, OfflineKitOptions, OfflineLogoutAction, OfflineNaturalKey, OfflineNaturalKeyValue, OfflineNetworkState, OfflineOutboxLimits, OfflineReadRequestPlan, OfflineRemoteIdentity, OfflineReplicaChange, OfflineReplicaColumnDef, OfflineReplicaCursor, OfflineReplicaEntityDefinition, OfflineReplicaEntitySchema, OfflineReplicaEntityScope, OfflineReplicaFieldDescriptor, OfflineReplicaFieldPolicy, OfflineReplicaIdentityDescriptor, OfflineReplicaIgnoredDef, OfflineReplicaMigration, OfflineReplicaNaturalKeyDef, OfflineReplicaPullPage, OfflineReplicaPullRequest, OfflineReplicaPuller, OfflineReplicaRemoteIdentity, OfflineReplicaRow, OfflineReplicaRowKey, OfflineReplicaSchemaBundle, OfflineReplicaSchemaDefinition, OfflineReplicaServerIdDef, OfflineReplicaSqliteAffinity, OfflineReplicaStorageKind, OfflineReplicaSyncState, OfflineReplicaTransaction, OfflineReplicaWebMigrationCallback, OfflineReplicaWebMigrationResult, OfflineReplicaWebMigrationRow, OfflineRepository, OfflineRequestPlan, OfflineRequestPolicy, OfflineResponseSource, OfflineScope, OfflineSessionManifest, OfflineSessionTransitionLease, OfflineSyncContext, OfflineSyncSession, OfflineSyncState, ProvideOfflineOptions };
922
+ export type { CommunitySqliteConnection, CommunitySqliteDatabase, CommunitySqliteDriver, CreateOfflineAuthBridgeOptions, EnqueueOfflineCommand, OfflineAuthBridgeConfig, OfflineAuthExchangeContext, OfflineAuthExchangePhase, OfflineAuthResumeContext, OfflineCommand, OfflineCommandExecutor, OfflineCommandHooks, OfflineCommandResult, OfflineCommandState, OfflineCommandTarget, OfflineKitOptions, OfflineLogoutAction, OfflineNaturalKey, OfflineNaturalKeyValue, OfflineNetworkState, OfflineOutboxLimits, OfflineReadRequestPlan, OfflineRemoteIdentity, OfflineReplicaChange, OfflineReplicaColumnDef, OfflineReplicaCursor, OfflineReplicaEntityDefinition, OfflineReplicaEntitySchema, OfflineReplicaEntityScope, OfflineReplicaFieldDescriptor, OfflineReplicaFieldPolicy, OfflineReplicaIdentityDescriptor, OfflineReplicaIgnoredDef, OfflineReplicaMigration, OfflineReplicaMutation, OfflineReplicaNaturalKeyDef, OfflineReplicaPullPage, OfflineReplicaPullRequest, OfflineReplicaPuller, OfflineReplicaRemoteIdentity, OfflineReplicaRow, OfflineReplicaRowKey, OfflineReplicaSchemaBundle, OfflineReplicaSchemaDefinition, OfflineReplicaServerIdDef, OfflineReplicaServerIdRelease, OfflineReplicaSqliteAffinity, OfflineReplicaStorageKind, OfflineReplicaSyncState, OfflineReplicaTransaction, OfflineReplicaVisibility, OfflineReplicaWebMigrationCallback, OfflineReplicaWebMigrationResult, OfflineReplicaWebMigrationRow, OfflineRepository, OfflineRequestPlan, OfflineRequestPolicy, OfflineResponseSource, OfflineScope, OfflineSessionManifest, OfflineSessionTransitionLease, OfflineSyncContext, OfflineSyncSession, OfflineSyncState, ProvideOfflineOptions };