@rdlabo/ionic-angular-kit 21.5.9 → 21.5.11
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.
|
@@ -18,17 +18,19 @@ type OfflineReplicaStorageKind = 'text' | 'integer' | 'real' | 'booleanColumn' |
|
|
|
18
18
|
/** Scope partition persisted on every replica table row. */
|
|
19
19
|
type OfflineReplicaEntityScope = 'user' | 'partition';
|
|
20
20
|
/** Field projection policy for a source-model property. */
|
|
21
|
-
type OfflineReplicaFieldPolicy = 'column' | '
|
|
21
|
+
type OfflineReplicaFieldPolicy = 'column' | 'remoteId' | 'ignored';
|
|
22
22
|
/** Canonical value types accepted in a composite server-side natural key. */
|
|
23
23
|
type OfflineNaturalKeyValue = string | number;
|
|
24
24
|
/** Ordered natural-key values keyed by source-model field name. */
|
|
25
25
|
type OfflineNaturalKey = Readonly<Record<string, OfflineNaturalKeyValue>>;
|
|
26
|
+
/** Server-assigned remote identifier for a generated-identity entity. */
|
|
27
|
+
type OfflineGeneratedRemoteId = number | string;
|
|
26
28
|
/** Remote row identity. Exactly one variant is valid for a replicated entity. */
|
|
27
29
|
type OfflineReplicaRemoteIdentity = {
|
|
28
|
-
readonly
|
|
30
|
+
readonly remoteId: OfflineGeneratedRemoteId;
|
|
29
31
|
readonly naturalKey?: never;
|
|
30
32
|
} | {
|
|
31
|
-
readonly
|
|
33
|
+
readonly remoteId?: never;
|
|
32
34
|
readonly naturalKey: OfflineNaturalKey;
|
|
33
35
|
};
|
|
34
36
|
/** Runtime identity policy materialized into an entity schema. */
|
|
@@ -36,8 +38,9 @@ type OfflineReplicaIdentityDescriptor = {
|
|
|
36
38
|
readonly kind: 'localOnly';
|
|
37
39
|
readonly sourceKeys: readonly [];
|
|
38
40
|
} | {
|
|
39
|
-
readonly kind: '
|
|
41
|
+
readonly kind: 'generated';
|
|
40
42
|
readonly sourceKeys: readonly [string];
|
|
43
|
+
readonly affinity: OfflineReplicaSqliteAffinity;
|
|
41
44
|
} | {
|
|
42
45
|
readonly kind: 'naturalKey';
|
|
43
46
|
readonly sourceKeys: readonly string[];
|
|
@@ -97,11 +100,14 @@ interface OfflineReplicaColumnDef<TValue = unknown, TNullable extends ReplicaNul
|
|
|
97
100
|
readonly nullable: TNullable[typeof replicaNullableBrand];
|
|
98
101
|
};
|
|
99
102
|
}
|
|
100
|
-
/** Builder marking a source property as the server-assigned identifier. */
|
|
101
|
-
interface
|
|
102
|
-
readonly kind: '
|
|
103
|
-
readonly
|
|
103
|
+
/** Builder marking a source property as the server-assigned generated identifier. */
|
|
104
|
+
interface OfflineReplicaRemoteIdDef<TAffinity extends OfflineReplicaSqliteAffinity = OfflineReplicaSqliteAffinity> {
|
|
105
|
+
readonly kind: 'remoteId';
|
|
106
|
+
readonly affinity: TAffinity;
|
|
107
|
+
readonly __types?: TAffinity extends 'INTEGER' ? {
|
|
104
108
|
readonly value: number;
|
|
109
|
+
} : {
|
|
110
|
+
readonly value: string;
|
|
105
111
|
};
|
|
106
112
|
}
|
|
107
113
|
/** Builder excluding a source property from SQLite projection. */
|
|
@@ -114,6 +120,10 @@ interface OfflineReplicaNaturalKeyDef<TKey extends string = string> {
|
|
|
114
120
|
readonly kind: 'naturalKey';
|
|
115
121
|
readonly sourceKeys: readonly TKey[];
|
|
116
122
|
}
|
|
123
|
+
/** Explicit identity for a projection that is never synchronized to a remote row. */
|
|
124
|
+
interface OfflineReplicaLocalOnlyDef {
|
|
125
|
+
readonly kind: 'localOnly';
|
|
126
|
+
}
|
|
117
127
|
type StripNullish<T> = Exclude<T, null | undefined>;
|
|
118
128
|
type NormalizeReplicaColumnValue<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends Date ? string | Date : T;
|
|
119
129
|
type StrictNullChecksEnabled = undefined extends null ? false : true;
|
|
@@ -125,7 +135,8 @@ type ReplicaColumnNullabilityForSelect<T> = StrictNullChecksEnabled extends true
|
|
|
125
135
|
readonly [replicaNullableBrand]: 'required';
|
|
126
136
|
} : ReplicaNullableBrand;
|
|
127
137
|
type OfflineReplicaColumnDefForValue<T> = OfflineReplicaColumnDef<NormalizeReplicaColumnValue<StripNullish<T>>, ReplicaColumnNullabilityForSelect<T>>;
|
|
128
|
-
type
|
|
138
|
+
type OfflineReplicaRemoteIdDefForValue<T> = StripNullish<T> extends number ? OfflineReplicaRemoteIdDef<'INTEGER'> : StripNullish<T> extends string ? OfflineReplicaRemoteIdDef<'TEXT'> : never;
|
|
139
|
+
type OfflineReplicaFieldDefForKey<TSelect extends Record<string, unknown>, K extends keyof TSelect> = OfflineReplicaRemoteIdDefForValue<TSelect[K]> | OfflineReplicaIgnoredDef | OfflineReplicaColumnDefForValue<TSelect[K]>;
|
|
129
140
|
type ExactSelectKeys<TSelect extends Record<string, unknown>, TFields> = Exclude<keyof TFields, keyof TSelect> extends never ? (Exclude<keyof TSelect, keyof TFields> extends never ? TFields : never) : never;
|
|
130
141
|
/** Configuration accepted by {@link defineReplicaEntity}. */
|
|
131
142
|
interface OfflineReplicaEntityDefinition<TSelect extends Record<string, unknown>, TFields extends {
|
|
@@ -134,7 +145,7 @@ interface OfflineReplicaEntityDefinition<TSelect extends Record<string, unknown>
|
|
|
134
145
|
readonly table: string;
|
|
135
146
|
readonly sourceKey: string;
|
|
136
147
|
readonly scope: OfflineReplicaEntityScope;
|
|
137
|
-
readonly identity?: OfflineReplicaNaturalKeyDef<Extract<keyof TSelect, string
|
|
148
|
+
readonly identity?: OfflineReplicaNaturalKeyDef<Extract<keyof TSelect, string>> | OfflineReplicaLocalOnlyDef;
|
|
138
149
|
readonly fields: ExactSelectKeys<TSelect, TFields> & TFields;
|
|
139
150
|
}
|
|
140
151
|
/**
|
|
@@ -142,7 +153,7 @@ interface OfflineReplicaEntityDefinition<TSelect extends Record<string, unknown>
|
|
|
142
153
|
*
|
|
143
154
|
* Every key in `TSelect` must appear exactly once in `fields`, and column nullability
|
|
144
155
|
* must match the select property nullability. An entity may map at most one field with
|
|
145
|
-
* {@link
|
|
156
|
+
* {@link generatedId}; omit it for local-only projections that have no remote row identity.
|
|
146
157
|
*/
|
|
147
158
|
declare function defineReplicaEntity<TSelect extends Record<string, unknown>>(): <const TFields extends { readonly [K in keyof TSelect]: OfflineReplicaFieldDefForKey<TSelect, K>; }>(definition: OfflineReplicaEntityDefinition<TSelect, TFields>) => OfflineReplicaEntitySchema<TSelect>;
|
|
148
159
|
/** Maps a non-null string source property to a TEXT column. */
|
|
@@ -163,12 +174,15 @@ declare function nullable<TValue>(column: OfflineReplicaColumnDef<TValue, {
|
|
|
163
174
|
}>): OfflineReplicaColumnDef<TValue, {
|
|
164
175
|
readonly [replicaNullableBrand]: 'nullable';
|
|
165
176
|
}>;
|
|
166
|
-
/** Maps a source property to the
|
|
167
|
-
declare function
|
|
168
|
-
|
|
177
|
+
/** Maps a source property to the nullable generated remote-id column. */
|
|
178
|
+
declare function generatedId(kind: 'integer'): OfflineReplicaRemoteIdDef<'INTEGER'>;
|
|
179
|
+
declare function generatedId(kind: 'text'): OfflineReplicaRemoteIdDef<'TEXT'>;
|
|
180
|
+
/** Declares an ordered remote natural key used directly as the scoped SQLite primary key. */
|
|
169
181
|
declare function naturalKey<const TKey extends string>(sourceKeys: readonly TKey[]): OfflineReplicaNaturalKeyDef<TKey>;
|
|
170
|
-
/**
|
|
171
|
-
declare function
|
|
182
|
+
/** Declares a projection with a local UUID address and no Outbox identity. */
|
|
183
|
+
declare function localOnly(): OfflineReplicaLocalOnlyDef;
|
|
184
|
+
/** Rejects a generated remote id on a local-only or natural-key projection before it reaches platform storage. */
|
|
185
|
+
declare function assertOfflineReplicaGeneratedRemoteId(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, value: OfflineGeneratedRemoteId | null): void;
|
|
172
186
|
/** Extracts and validates an entity's natural key in declared component order. */
|
|
173
187
|
declare function offlineNaturalKeyFromValues(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, values: unknown): OfflineNaturalKey | null;
|
|
174
188
|
/** Validates a supplied natural key and returns it in schema-declared order. */
|
|
@@ -184,7 +198,7 @@ declare function ignored(reason: string): OfflineReplicaIgnoredDef;
|
|
|
184
198
|
*
|
|
185
199
|
* Only {@link OfflineReplicaFieldPolicy} `column` fields are emitted, keyed by
|
|
186
200
|
* {@link OfflineReplicaFieldDescriptor.sqliteColumnName} in descriptor order.
|
|
187
|
-
* Source properties mapped as `
|
|
201
|
+
* Source properties mapped as `remoteId` or `ignored` may be present but are not encoded.
|
|
188
202
|
*/
|
|
189
203
|
declare function encodeOfflineReplicaValues(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, values: unknown): Readonly<Record<string, string | number | null>>;
|
|
190
204
|
/**
|
|
@@ -199,8 +213,8 @@ declare function decodeOfflineReplicaValues(schema: OfflineReplicaEntitySchema<R
|
|
|
199
213
|
/**
|
|
200
214
|
* Validates a source-model row and returns the canonical domain projection persisted by every repository.
|
|
201
215
|
*
|
|
202
|
-
* Fields mapped as `
|
|
203
|
-
* identical; the server identifier remains available through the replica row's dedicated `
|
|
216
|
+
* Fields mapped as `remoteId` or `ignored` are intentionally omitted. This keeps web and native row shapes
|
|
217
|
+
* identical; the server identifier remains available through the replica row's dedicated `remoteId` field.
|
|
204
218
|
*/
|
|
205
219
|
declare function projectOfflineReplicaValues(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, values: unknown): Readonly<Record<string, unknown>>;
|
|
206
220
|
/** Domain payload transformed during web replica schema migration. Identity and sync metadata stay outside this shape. */
|
|
@@ -222,7 +236,7 @@ interface OfflineReplicaMigration {
|
|
|
222
236
|
/**
|
|
223
237
|
* Transforms one row's domain projection for web storage during this step.
|
|
224
238
|
* The callback receives only {@link OfflineReplicaWebMigrationRow}; it must not read or mutate
|
|
225
|
-
* `localId`, `
|
|
239
|
+
* `localId`, `remoteId`, scope, revision, or `syncState`. Return `null` to delete the row.
|
|
226
240
|
*/
|
|
227
241
|
readonly migrateWebRow: OfflineReplicaWebMigrationCallback;
|
|
228
242
|
}
|
|
@@ -258,11 +272,69 @@ declare function defineOfflineReplicaSchema(definition: OfflineReplicaSchemaDefi
|
|
|
258
272
|
*/
|
|
259
273
|
declare function sha256OfflineReplicaSchema(bundle: OfflineReplicaSchemaBundle): Promise<string>;
|
|
260
274
|
|
|
275
|
+
/** Product-agnostic authenticated principal identifier. */
|
|
276
|
+
type OfflinePrincipalId = string | number;
|
|
277
|
+
/** Narrows a product DB id without duplicating the numeric identity boundary. */
|
|
278
|
+
declare function requirePositiveOfflineInteger(value: unknown, label?: string): number;
|
|
279
|
+
/** Type-tagged SQLite/web key; numeric 7 and text "7" never share a boundary. */
|
|
280
|
+
declare function canonicalOfflinePrincipalId(value: OfflinePrincipalId): string;
|
|
281
|
+
/** Decodes a principal previously persisted by {@link canonicalOfflinePrincipalId}. */
|
|
282
|
+
declare function parseOfflinePrincipalId(value: string): OfflinePrincipalId;
|
|
283
|
+
/** Durable address of a generated or natural-key replica row. */
|
|
284
|
+
type OfflineReplicaIdentity = {
|
|
285
|
+
readonly kind: 'generated';
|
|
286
|
+
readonly localId: string;
|
|
287
|
+
readonly remoteId: OfflineGeneratedRemoteId | null;
|
|
288
|
+
} | {
|
|
289
|
+
readonly kind: 'natural';
|
|
290
|
+
readonly naturalKey: OfflineNaturalKey;
|
|
291
|
+
} | {
|
|
292
|
+
readonly kind: 'local';
|
|
293
|
+
readonly localId: string;
|
|
294
|
+
};
|
|
295
|
+
/** Outbox address. Generated ids are resolved to the latest server id immediately before transport. */
|
|
296
|
+
type OfflineCommandIdentity = {
|
|
297
|
+
readonly kind: 'generated';
|
|
298
|
+
readonly localId: string;
|
|
299
|
+
} | {
|
|
300
|
+
readonly kind: 'natural';
|
|
301
|
+
readonly naturalKey: OfflineNaturalKey;
|
|
302
|
+
};
|
|
303
|
+
/** Stable lookup address for every replica row, including local-only projections. */
|
|
304
|
+
type OfflineReplicaAddress = OfflineCommandIdentity | {
|
|
305
|
+
readonly kind: 'local';
|
|
306
|
+
readonly localId: string;
|
|
307
|
+
};
|
|
308
|
+
/** Stable storage key for one outbox or replica row identity. */
|
|
309
|
+
declare function canonicalOfflineCommandIdentity(identity: OfflineCommandIdentity): string;
|
|
310
|
+
/** Stable storage key for one materialized replica row identity. */
|
|
311
|
+
declare function canonicalOfflineReplicaIdentity(identity: OfflineReplicaIdentity): string;
|
|
312
|
+
/** JSON persisted in SQLite/web outbox rows. */
|
|
313
|
+
declare function serializeOfflineCommandIdentity(identity: OfflineCommandIdentity): string;
|
|
314
|
+
/** Parses durable outbox identity JSON. */
|
|
315
|
+
declare function parseOfflineCommandIdentity(value: unknown): OfflineCommandIdentity;
|
|
316
|
+
/** Builds a generated replica identity. */
|
|
317
|
+
declare function offlineGeneratedReplicaIdentity(localId: string, remoteId: OfflineGeneratedRemoteId | null): OfflineReplicaIdentity;
|
|
318
|
+
/** Validates a durable local row id before it can enter either storage backend. */
|
|
319
|
+
declare function assertOfflineLocalId(value: unknown): asserts value is string;
|
|
320
|
+
/** Builds a natural replica identity from current domain values. */
|
|
321
|
+
declare function offlineNaturalReplicaIdentity(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, values: unknown): OfflineReplicaIdentity;
|
|
322
|
+
/** Converts a materialized replica identity into an outbox address. */
|
|
323
|
+
declare function commandIdentityFromReplicaIdentity(identity: OfflineReplicaIdentity): OfflineCommandIdentity;
|
|
324
|
+
/** Converts a materialized row identity into its immutable repository address. */
|
|
325
|
+
declare function replicaAddressFromIdentity(identity: OfflineReplicaIdentity): OfflineReplicaAddress;
|
|
326
|
+
/** Whether a command identity addresses the given replica row. */
|
|
327
|
+
declare function commandIdentityMatchesReplicaRow(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, row: {
|
|
328
|
+
readonly identity: OfflineReplicaIdentity;
|
|
329
|
+
}, commandIdentity: OfflineCommandIdentity): boolean;
|
|
330
|
+
/** Remote identity used by pull reconciliation and uniqueness checks. */
|
|
331
|
+
declare function offlineReplicaRemoteIdentity(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, identity: OfflineReplicaIdentity): OfflineReplicaRemoteIdentity | null;
|
|
332
|
+
|
|
261
333
|
/** Current durable storage schema used by both web and native repositories. */
|
|
262
|
-
declare const OFFLINE_SCHEMA_VERSION =
|
|
334
|
+
declare const OFFLINE_SCHEMA_VERSION = 1;
|
|
263
335
|
/** User and partition scope of all local offline data. */
|
|
264
336
|
interface OfflineScope {
|
|
265
|
-
userId:
|
|
337
|
+
userId: OfflinePrincipalId;
|
|
266
338
|
scopeId: string;
|
|
267
339
|
}
|
|
268
340
|
/** Synchronization state of a locally materialized product replica row. */
|
|
@@ -271,12 +343,13 @@ type OfflineReplicaVisibility = 'present' | 'pending_delete';
|
|
|
271
343
|
type OfflineReplicaMutation = 'upsert' | 'delete';
|
|
272
344
|
/** Durable processing state of an outbox command. */
|
|
273
345
|
type OfflineCommandState = 'pending' | 'sending' | 'retry_wait' | 'blocked_auth' | 'rejected' | 'conflict';
|
|
274
|
-
|
|
275
|
-
interface OfflineCommand<T = unknown> extends OfflineScope {
|
|
346
|
+
interface OfflineCommandBase<T> extends OfflineScope {
|
|
276
347
|
commandId: string;
|
|
277
348
|
aggregateType: string;
|
|
278
|
-
/**
|
|
279
|
-
|
|
349
|
+
/** Replica schema source key resolved when the command is enqueued. */
|
|
350
|
+
sourceKey: string;
|
|
351
|
+
/** Stable row identity. The Outbox never persists a generated server id. */
|
|
352
|
+
identity: OfflineCommandIdentity;
|
|
280
353
|
operation: string;
|
|
281
354
|
payload: T;
|
|
282
355
|
/** Full optimistic entity value displayed while this command is pending. */
|
|
@@ -291,14 +364,13 @@ interface OfflineCommand<T = unknown> extends OfflineScope {
|
|
|
291
364
|
createdAt: number;
|
|
292
365
|
lastErrorCode: string | null;
|
|
293
366
|
}
|
|
367
|
+
type OfflineCommand<T = unknown> = OfflineCommandBase<T>;
|
|
294
368
|
/** Product replica row materialized from a versioned schema entity. */
|
|
295
|
-
interface
|
|
369
|
+
interface OfflineReplicaRowBase<TValues> extends OfflineScope {
|
|
296
370
|
/** Stable source key matching {@link OfflineReplicaEntitySchema.sourceKey}. */
|
|
297
371
|
sourceKey: string;
|
|
298
|
-
/**
|
|
299
|
-
|
|
300
|
-
/** Server-assigned identifier after a successful create, otherwise null. */
|
|
301
|
-
serverId: number | null;
|
|
372
|
+
/** Row identity matching the entity schema. Natural-key rows have no synthetic ids. */
|
|
373
|
+
identity: OfflineReplicaIdentity;
|
|
302
374
|
/** Current optimistic domain values displayed locally. */
|
|
303
375
|
values: TValues;
|
|
304
376
|
/** Last server-confirmed domain values, or null while pending. */
|
|
@@ -309,15 +381,16 @@ interface OfflineReplicaRow<TValues = unknown> extends OfflineScope {
|
|
|
309
381
|
/** Library-owned visibility; pending deletes remain durable but are hidden from product reads. */
|
|
310
382
|
visibility?: OfflineReplicaVisibility;
|
|
311
383
|
}
|
|
384
|
+
type OfflineReplicaRow<TValues = unknown> = OfflineReplicaRowBase<TValues>;
|
|
312
385
|
/** Stable address of a product replica row inside a user or partition-scoped replica. */
|
|
313
386
|
interface OfflineReplicaRowKey extends OfflineScope {
|
|
314
387
|
sourceKey: string;
|
|
315
|
-
|
|
388
|
+
identity: OfflineReplicaIdentity;
|
|
316
389
|
}
|
|
317
|
-
/** Explicit one-way release of a
|
|
318
|
-
interface
|
|
319
|
-
/** The current
|
|
320
|
-
|
|
390
|
+
/** Explicit one-way release of a generated remote id during a replica delete acknowledgement. */
|
|
391
|
+
interface OfflineReplicaRemoteIdRelease extends OfflineReplicaRowKey {
|
|
392
|
+
/** The current remote id being released; the matching put row must set `remoteId` to null. */
|
|
393
|
+
remoteId: OfflineGeneratedRemoteId;
|
|
321
394
|
}
|
|
322
395
|
/** Scope partition plus the durable replica pull cursor for that partition. */
|
|
323
396
|
interface OfflineReplicaCursor extends OfflineScope {
|
|
@@ -327,10 +400,10 @@ interface OfflineReplicaCursor extends OfflineScope {
|
|
|
327
400
|
interface OfflineReplicaTransaction {
|
|
328
401
|
putRows?: readonly OfflineReplicaRow[];
|
|
329
402
|
/**
|
|
330
|
-
* Allows only the matching `
|
|
331
|
-
* All other
|
|
403
|
+
* Allows only the matching `remoteId: current -> null` transition in `putRows`.
|
|
404
|
+
* All other remote-id changes remain immutable.
|
|
332
405
|
*/
|
|
333
|
-
|
|
406
|
+
releaseRemoteIds?: readonly OfflineReplicaRemoteIdRelease[];
|
|
334
407
|
removeRows?: readonly OfflineReplicaRowKey[];
|
|
335
408
|
putCommands?: readonly OfflineCommand[];
|
|
336
409
|
removeCommandIds?: readonly string[];
|
|
@@ -339,23 +412,23 @@ interface OfflineReplicaTransaction {
|
|
|
339
412
|
/** Durable local replica and outbox persistence contract. */
|
|
340
413
|
interface OfflineRepository {
|
|
341
414
|
initialize(): Promise<void>;
|
|
342
|
-
getLastUserId(): Promise<
|
|
343
|
-
setLastUserId(userId:
|
|
344
|
-
getSessionManifest<T>(userId:
|
|
345
|
-
putSessionManifest<T>(userId:
|
|
346
|
-
getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string,
|
|
415
|
+
getLastUserId(): Promise<OfflinePrincipalId | null>;
|
|
416
|
+
setLastUserId(userId: OfflinePrincipalId): Promise<void>;
|
|
417
|
+
getSessionManifest<T>(userId: OfflinePrincipalId): Promise<T | null>;
|
|
418
|
+
putSessionManifest<T>(userId: OfflinePrincipalId, value: T): Promise<void>;
|
|
419
|
+
getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaAddress): Promise<OfflineReplicaRow<TValues> | null>;
|
|
347
420
|
/** Internal durable lookup used by synchronization; includes pending-delete tombstones. */
|
|
348
|
-
getReplicaRowIncludingPendingDelete?<TValues = unknown>(scope: OfflineScope, sourceKey: string,
|
|
421
|
+
getReplicaRowIncludingPendingDelete?<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaAddress): Promise<OfflineReplicaRow<TValues> | null>;
|
|
349
422
|
getReplicaRows<TValues = unknown>(scope: OfflineScope, sourceKey: string): Promise<OfflineReplicaRow<TValues>[]>;
|
|
350
|
-
|
|
423
|
+
getReplicaRowByRemoteId<TValues = unknown>(scope: OfflineScope, sourceKey: string, remoteId: OfflineGeneratedRemoteId): Promise<OfflineReplicaRow<TValues> | null>;
|
|
351
424
|
getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
|
|
352
425
|
getReplicaCursor(scope: OfflineScope): Promise<OfflineReplicaCursor | null>;
|
|
353
426
|
getCommands(scope: OfflineScope): Promise<OfflineCommand[]>;
|
|
354
|
-
getCommandsForUser?(userId:
|
|
427
|
+
getCommandsForUser?(userId: OfflinePrincipalId): Promise<OfflineCommand[]>;
|
|
355
428
|
putCommand(command: OfflineCommand): Promise<void>;
|
|
356
429
|
replaceCommand(command: OfflineCommand): Promise<void>;
|
|
357
430
|
removeCommand(commandId: string): Promise<void>;
|
|
358
|
-
clearUser(userId:
|
|
431
|
+
clearUser(userId: OfflinePrincipalId): Promise<void>;
|
|
359
432
|
clearScope(scope: OfflineScope): Promise<void>;
|
|
360
433
|
transactReplica(transaction: OfflineReplicaTransaction): Promise<void>;
|
|
361
434
|
}
|
|
@@ -367,22 +440,22 @@ declare function selectOfflineRepository(platform: string, webRepository: Offlin
|
|
|
367
440
|
declare class IonicOfflineRepository implements OfflineRepository {
|
|
368
441
|
#private;
|
|
369
442
|
initialize(): Promise<void>;
|
|
370
|
-
getLastUserId(): Promise<
|
|
371
|
-
setLastUserId(userId:
|
|
372
|
-
getSessionManifest<T>(userId:
|
|
373
|
-
putSessionManifest<T>(userId:
|
|
374
|
-
getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string,
|
|
375
|
-
getReplicaRowIncludingPendingDelete<TValues = unknown>(scope: OfflineScope, sourceKey: string,
|
|
443
|
+
getLastUserId(): Promise<OfflinePrincipalId | null>;
|
|
444
|
+
setLastUserId(userId: OfflinePrincipalId): Promise<void>;
|
|
445
|
+
getSessionManifest<T>(userId: OfflinePrincipalId): Promise<T | null>;
|
|
446
|
+
putSessionManifest<T>(userId: OfflinePrincipalId, value: T): Promise<void>;
|
|
447
|
+
getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaAddress): Promise<OfflineReplicaRow<TValues> | null>;
|
|
448
|
+
getReplicaRowIncludingPendingDelete<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaAddress): Promise<OfflineReplicaRow<TValues> | null>;
|
|
376
449
|
getReplicaRows<TValues = unknown>(scope: OfflineScope, sourceKey: string): Promise<OfflineReplicaRow<TValues>[]>;
|
|
377
|
-
|
|
450
|
+
getReplicaRowByRemoteId<TValues = unknown>(scope: OfflineScope, sourceKey: string, remoteId: OfflineGeneratedRemoteId): Promise<OfflineReplicaRow<TValues> | null>;
|
|
378
451
|
getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
|
|
379
452
|
getReplicaCursor(scope: OfflineScope): Promise<OfflineReplicaCursor | null>;
|
|
380
453
|
getCommands(scope: OfflineScope): Promise<OfflineCommand[]>;
|
|
381
|
-
getCommandsForUser(userId:
|
|
454
|
+
getCommandsForUser(userId: OfflinePrincipalId): Promise<OfflineCommand[]>;
|
|
382
455
|
putCommand(command: OfflineCommand): Promise<void>;
|
|
383
456
|
replaceCommand(command: OfflineCommand): Promise<void>;
|
|
384
457
|
removeCommand(commandId: string): Promise<void>;
|
|
385
|
-
clearUser(userId:
|
|
458
|
+
clearUser(userId: OfflinePrincipalId): Promise<void>;
|
|
386
459
|
clearScope(scope: OfflineScope): Promise<void>;
|
|
387
460
|
transactReplica(transaction: OfflineReplicaTransaction): Promise<void>;
|
|
388
461
|
static ɵfac: i0.ɵɵFactoryDeclaration<IonicOfflineRepository, never>;
|
|
@@ -410,6 +483,23 @@ interface OfflineReplicaChangeBase {
|
|
|
410
483
|
}
|
|
411
484
|
/** One server-side mutation with the identity kind declared by its replica schema. */
|
|
412
485
|
type OfflineReplicaChange = OfflineReplicaChangeBase & OfflineReplicaRemoteIdentity;
|
|
486
|
+
/**
|
|
487
|
+
* Backend wire identity accepted at the HTTP boundary.
|
|
488
|
+
*
|
|
489
|
+
* `serverId` is the database-facing name used by Hono applications. The
|
|
490
|
+
* offline runtime deliberately calls the same value `remoteId`, because the
|
|
491
|
+
* repository is not tied to a particular server database. Normalize exactly
|
|
492
|
+
* once at the transport boundary with {@link normalizeOfflineReplicaPullPage}.
|
|
493
|
+
*/
|
|
494
|
+
type OfflineReplicaWireIdentity = {
|
|
495
|
+
readonly serverId: OfflineGeneratedRemoteId;
|
|
496
|
+
} | {
|
|
497
|
+
readonly remoteId: OfflineGeneratedRemoteId;
|
|
498
|
+
} | {
|
|
499
|
+
readonly naturalKey: OfflineNaturalKey;
|
|
500
|
+
};
|
|
501
|
+
/** One backend pull mutation before its DB-facing identity is normalized. */
|
|
502
|
+
type OfflineReplicaWireChange = OfflineReplicaChangeBase & OfflineReplicaWireIdentity;
|
|
413
503
|
/** One explicit replica pull response page from the application backend. */
|
|
414
504
|
interface OfflineReplicaPullPage {
|
|
415
505
|
schemaVersion: number;
|
|
@@ -418,6 +508,19 @@ interface OfflineReplicaPullPage {
|
|
|
418
508
|
nextCursor: string;
|
|
419
509
|
hasMore: boolean;
|
|
420
510
|
}
|
|
511
|
+
/** Backend response accepted by the shared pull-page normalizer. */
|
|
512
|
+
interface OfflineReplicaWirePullPage {
|
|
513
|
+
schemaVersion: number;
|
|
514
|
+
schemaHash: string;
|
|
515
|
+
changes: readonly OfflineReplicaWireChange[];
|
|
516
|
+
nextCursor: string;
|
|
517
|
+
hasMore: boolean;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Converts a backend DB identity (`serverId`) to the runtime identity
|
|
521
|
+
* (`remoteId`) without allowing product pullers to each reimplement the rule.
|
|
522
|
+
*/
|
|
523
|
+
declare function normalizeOfflineReplicaPullPage(page: OfflineReplicaWirePullPage): OfflineReplicaPullPage;
|
|
421
524
|
/** Application-provided transport that fetches explicit replica pull pages from the server. */
|
|
422
525
|
interface OfflineReplicaPuller {
|
|
423
526
|
pull(request: OfflineReplicaPullRequest): Promise<OfflineReplicaPullPage>;
|
|
@@ -435,27 +538,29 @@ declare class OfflineReplicaPullService {
|
|
|
435
538
|
|
|
436
539
|
/** Server acknowledgement used to reconcile one optimistic local mutation. */
|
|
437
540
|
interface OfflineCommandResult {
|
|
438
|
-
/**
|
|
439
|
-
|
|
541
|
+
/** Remote id returned by a successful generated-identity mutation. */
|
|
542
|
+
remoteId?: OfflineGeneratedRemoteId;
|
|
440
543
|
serverRevision?: string | number;
|
|
441
544
|
/** Full server-confirmed domain values after applying the mutation. */
|
|
442
545
|
confirmedValues?: unknown;
|
|
443
546
|
/** Removes the local replica row after a confirmed server delete. */
|
|
444
547
|
removeReplica?: boolean;
|
|
445
548
|
/**
|
|
446
|
-
* Releases the deleted row's remote
|
|
549
|
+
* Releases the deleted row's remote identity while keeping
|
|
447
550
|
* its immutable local id for a queued recreate of the same logical target.
|
|
448
551
|
*/
|
|
449
|
-
|
|
552
|
+
clearRemoteId?: boolean;
|
|
450
553
|
response?: unknown;
|
|
451
554
|
}
|
|
452
|
-
/** Target
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
555
|
+
/** Target identity resolved from the local replica immediately before transport. */
|
|
556
|
+
type OfflineCommandTarget = {
|
|
557
|
+
readonly kind: 'generated';
|
|
558
|
+
readonly localId: string;
|
|
559
|
+
readonly remoteId: OfflineGeneratedRemoteId | null;
|
|
560
|
+
} | {
|
|
561
|
+
readonly kind: 'natural';
|
|
562
|
+
readonly naturalKey: OfflineNaturalKey;
|
|
563
|
+
};
|
|
459
564
|
/** 不透明なoperationを製品APIへ送信し、local replicaへ投影するadapter。 */
|
|
460
565
|
/** Product adapter that sends commands and projects acknowledgements into entities. */
|
|
461
566
|
interface OfflineCommandExecutor {
|
|
@@ -464,7 +569,7 @@ interface OfflineCommandExecutor {
|
|
|
464
569
|
withServerRevision(command: OfflineCommand, revision: string | number): OfflineCommand;
|
|
465
570
|
/**
|
|
466
571
|
* Removes the deleted remote row's revision from a queued recreate.
|
|
467
|
-
* Required only when `
|
|
572
|
+
* Required only when `clearRemoteId` completes while later commands remain.
|
|
468
573
|
*/
|
|
469
574
|
withoutServerRevision?(command: OfflineCommand): OfflineCommand;
|
|
470
575
|
}
|
|
@@ -472,7 +577,7 @@ interface OfflineCommandExecutor {
|
|
|
472
577
|
declare const OFFLINE_COMMAND_EXECUTOR: InjectionToken<OfflineCommandExecutor>;
|
|
473
578
|
/** Authenticated user and partition scopes currently eligible for synchronization. */
|
|
474
579
|
interface OfflineSyncSession {
|
|
475
|
-
userId:
|
|
580
|
+
userId: OfflinePrincipalId;
|
|
476
581
|
scopes: OfflineScope[];
|
|
477
582
|
}
|
|
478
583
|
/** Product adapter that exposes the currently authenticated synchronization session. */
|
|
@@ -484,6 +589,25 @@ interface OfflineSyncContext {
|
|
|
484
589
|
}
|
|
485
590
|
/** DI token for authenticated synchronization context. */
|
|
486
591
|
declare const OFFLINE_SYNC_CONTEXT: InjectionToken<OfflineSyncContext>;
|
|
592
|
+
/** Resolves the transport target from a replica row. */
|
|
593
|
+
declare function offlineCommandTargetFromReplicaRow(row: {
|
|
594
|
+
readonly identity: OfflineReplicaIdentity;
|
|
595
|
+
}): OfflineCommandTarget;
|
|
596
|
+
/** Resolves a command lookup identity from an enqueue request identity. */
|
|
597
|
+
declare function offlineCommandLookupIdentity(identity: EnqueueOfflineCommandIdentity): OfflineCommandIdentity;
|
|
598
|
+
/** Enqueue identity for generated entities. */
|
|
599
|
+
interface EnqueueOfflineGeneratedIdentity {
|
|
600
|
+
readonly kind: 'generated';
|
|
601
|
+
readonly localId: string;
|
|
602
|
+
readonly remoteId?: OfflineGeneratedRemoteId | null;
|
|
603
|
+
readonly remoteIdHint?: OfflineGeneratedRemoteId | null;
|
|
604
|
+
}
|
|
605
|
+
/** Enqueue identity for natural-key entities. */
|
|
606
|
+
interface EnqueueOfflineNaturalIdentity {
|
|
607
|
+
readonly kind: 'natural';
|
|
608
|
+
readonly naturalKey: OfflineNaturalKey;
|
|
609
|
+
}
|
|
610
|
+
type EnqueueOfflineCommandIdentity = EnqueueOfflineGeneratedIdentity | EnqueueOfflineNaturalIdentity;
|
|
487
611
|
|
|
488
612
|
/** Optional product hooks for entity projection and command cleanup. */
|
|
489
613
|
interface OfflineCommandHooks {
|
|
@@ -496,12 +620,14 @@ declare const OFFLINE_COMMAND_HOOKS: InjectionToken<OfflineCommandHooks>;
|
|
|
496
620
|
|
|
497
621
|
/** Persisted identity and partition boundary for one authenticated local replica. */
|
|
498
622
|
interface OfflineSessionManifest {
|
|
499
|
-
userId:
|
|
623
|
+
userId: OfflinePrincipalId;
|
|
500
624
|
readonly scopeIds: readonly string[];
|
|
501
625
|
/** Authentication-provider subject used to distinguish users on a shared device. */
|
|
502
626
|
authSubject: string | null;
|
|
503
627
|
updatedAt: number;
|
|
504
628
|
}
|
|
629
|
+
/** Checks the authenticated subject and optional scope against one persisted session boundary. */
|
|
630
|
+
declare function offlineSessionManifestAllows(manifest: OfflineSessionManifest | null, authSubject: string | null, scopeId?: string): manifest is OfflineSessionManifest;
|
|
505
631
|
/** Structural lease used to reject stale asynchronous session commits. */
|
|
506
632
|
interface OfflineSessionTransitionLease {
|
|
507
633
|
isCurrent(): boolean;
|
|
@@ -511,8 +637,8 @@ declare class OfflineSessionService {
|
|
|
511
637
|
#private;
|
|
512
638
|
readonly activeManifest: i0.Signal<OfflineSessionManifest | null>;
|
|
513
639
|
initialize(): Promise<void>;
|
|
514
|
-
activateSession(userId:
|
|
515
|
-
activateSession(userId:
|
|
640
|
+
activateSession(userId: OfflinePrincipalId, scopeIds: readonly string[], authSubject: string | null): Promise<void>;
|
|
641
|
+
activateSession(userId: OfflinePrincipalId, scopeIds: readonly string[], authSubject: string | null, lease: OfflineSessionTransitionLease): Promise<boolean>;
|
|
516
642
|
clearActiveSession(): Promise<void>;
|
|
517
643
|
/** Immediately revoke local and remote runtime access while durable cleanup is pending. */
|
|
518
644
|
revokeAccess(): void;
|
|
@@ -543,12 +669,12 @@ declare class OfflineSessionService {
|
|
|
543
669
|
activateOfflineSession(authSubject?: string | null, lease?: OfflineSessionTransitionLease): Promise<OfflineSessionManifest | null>;
|
|
544
670
|
/** Returns the session allowed to use the local replica and append outbox commands. */
|
|
545
671
|
getLocalSession(): Promise<{
|
|
546
|
-
userId:
|
|
672
|
+
userId: OfflinePrincipalId;
|
|
547
673
|
scopes: OfflineScope[];
|
|
548
674
|
} | null>;
|
|
549
675
|
/** Returns the remotely authenticated session eligible for pull and command replay. */
|
|
550
676
|
getSession(): Promise<{
|
|
551
|
-
userId:
|
|
677
|
+
userId: OfflinePrincipalId;
|
|
552
678
|
scopes: OfflineScope[];
|
|
553
679
|
} | null>;
|
|
554
680
|
static ɵfac: i0.ɵɵFactoryDeclaration<OfflineSessionService, never>;
|
|
@@ -563,11 +689,11 @@ declare class OfflineCoordinatorService {
|
|
|
563
689
|
readonly networkState: i0.Signal<_rdlabo_ionic_angular_kit_offline.OfflineNetworkState>;
|
|
564
690
|
readonly syncState: i0.Signal<_rdlabo_ionic_angular_kit_offline.OfflineSyncState>;
|
|
565
691
|
readonly pendingCount: i0.Signal<number>;
|
|
566
|
-
readonly conflicts: i0.Signal<_rdlabo_ionic_angular_kit_offline.OfflineCommand
|
|
692
|
+
readonly conflicts: i0.Signal<_rdlabo_ionic_angular_kit_offline.OfflineCommand[]>;
|
|
567
693
|
initialize(): Promise<void>;
|
|
568
|
-
activateSession(userId:
|
|
694
|
+
activateSession(userId: OfflinePrincipalId, scopeIds: readonly string[], authSubject: string | null): Promise<void>;
|
|
569
695
|
/** Installs a remotely verified identity without starting pull or outbox replay. */
|
|
570
|
-
prepareRemoteSession(userId:
|
|
696
|
+
prepareRemoteSession(userId: OfflinePrincipalId, scopeIds: readonly string[], authSubject: string | null, authLease?: OfflineSessionTransitionLease): Promise<boolean>;
|
|
571
697
|
/** Starts pull and outbox replay after the caller has published remote access. */
|
|
572
698
|
resumeRemoteSession(): Promise<void>;
|
|
573
699
|
/**
|
|
@@ -583,7 +709,7 @@ declare class OfflineCoordinatorService {
|
|
|
583
709
|
|
|
584
710
|
/** Remote identity fields required to activate an offline session boundary. */
|
|
585
711
|
interface OfflineRemoteIdentity {
|
|
586
|
-
readonly userId:
|
|
712
|
+
readonly userId: OfflinePrincipalId;
|
|
587
713
|
readonly scopeIds: readonly string[];
|
|
588
714
|
readonly authSubject: string;
|
|
589
715
|
}
|
|
@@ -663,6 +789,8 @@ interface OfflineOutboxLimits {
|
|
|
663
789
|
}
|
|
664
790
|
/** Product-independent native offline persistence settings. */
|
|
665
791
|
interface OfflineKitOptions {
|
|
792
|
+
/** Runtime transport mode. Defaults to full synchronized replica/outbox behavior. */
|
|
793
|
+
mode?: 'synchronized' | 'readCacheOnly';
|
|
666
794
|
/** Encrypted SQLite database name used on iOS and Android. */
|
|
667
795
|
databaseName: string;
|
|
668
796
|
/** Creates the native database encryption key on first install. Required on iOS and Android. */
|
|
@@ -778,22 +906,22 @@ type SQLiteValue = string | number | null;
|
|
|
778
906
|
declare class SqliteOfflineRepository implements OfflineRepository {
|
|
779
907
|
#private;
|
|
780
908
|
initialize(): Promise<void>;
|
|
781
|
-
getLastUserId(): Promise<
|
|
782
|
-
setLastUserId(userId:
|
|
783
|
-
getSessionManifest<T>(userId:
|
|
784
|
-
putSessionManifest<T>(userId:
|
|
785
|
-
getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string,
|
|
786
|
-
getReplicaRowIncludingPendingDelete<TValues = unknown>(scope: OfflineScope, sourceKey: string,
|
|
909
|
+
getLastUserId(): Promise<OfflinePrincipalId | null>;
|
|
910
|
+
setLastUserId(userId: OfflinePrincipalId): Promise<void>;
|
|
911
|
+
getSessionManifest<T>(userId: OfflinePrincipalId): Promise<T | null>;
|
|
912
|
+
putSessionManifest<T>(userId: OfflinePrincipalId, value: T): Promise<void>;
|
|
913
|
+
getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaAddress): Promise<OfflineReplicaRow<TValues> | null>;
|
|
914
|
+
getReplicaRowIncludingPendingDelete<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaAddress): Promise<OfflineReplicaRow<TValues> | null>;
|
|
787
915
|
getReplicaRows<TValues = unknown>(scope: OfflineScope, sourceKey: string): Promise<OfflineReplicaRow<TValues>[]>;
|
|
788
|
-
|
|
916
|
+
getReplicaRowByRemoteId<TValues = unknown>(scope: OfflineScope, sourceKey: string, remoteId: OfflineGeneratedRemoteId): Promise<OfflineReplicaRow<TValues> | null>;
|
|
789
917
|
getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
|
|
790
918
|
getReplicaCursor(scope: OfflineScope): Promise<OfflineReplicaCursor | null>;
|
|
791
919
|
getCommands(scope: OfflineScope): Promise<OfflineCommand[]>;
|
|
792
|
-
getCommandsForUser(userId:
|
|
920
|
+
getCommandsForUser(userId: OfflinePrincipalId): Promise<OfflineCommand[]>;
|
|
793
921
|
putCommand(command: OfflineCommand): Promise<void>;
|
|
794
922
|
replaceCommand(command: OfflineCommand): Promise<void>;
|
|
795
923
|
removeCommand(commandId: string): Promise<void>;
|
|
796
|
-
clearUser(userId:
|
|
924
|
+
clearUser(userId: OfflinePrincipalId): Promise<void>;
|
|
797
925
|
clearScope(scope: OfflineScope): Promise<void>;
|
|
798
926
|
transactReplica(transaction: OfflineReplicaTransaction): Promise<void>;
|
|
799
927
|
static ɵfac: i0.ɵɵFactoryDeclaration<SqliteOfflineRepository, never>;
|
|
@@ -801,11 +929,7 @@ declare class SqliteOfflineRepository implements OfflineRepository {
|
|
|
801
929
|
}
|
|
802
930
|
|
|
803
931
|
/** Configuration for the standard offline repository, outbox, and request-policy runtime. */
|
|
804
|
-
interface
|
|
805
|
-
/** Product adapter that sends opaque commands to its API. */
|
|
806
|
-
commandExecutor: Type<OfflineCommandExecutor>;
|
|
807
|
-
/** Product transport for explicit cursor-based server delta pulls. */
|
|
808
|
-
replicaPuller: Type<OfflineReplicaPuller>;
|
|
932
|
+
interface ProvideOfflineOptionsBase extends OfflineKitOptions {
|
|
809
933
|
/** Product policies that map URLs and DTOs to generic replica/outbox operations. */
|
|
810
934
|
requestPolicies: readonly Type<OfflineRequestPolicy>[];
|
|
811
935
|
/** Optional product hooks for entity projection and command cleanup. */
|
|
@@ -815,6 +939,21 @@ interface ProvideOfflineOptions extends OfflineKitOptions {
|
|
|
815
939
|
/** Application-installed `@capacitor-community/sqlite` connection. Required only on iOS and Android. */
|
|
816
940
|
sqliteConnection?: CommunitySqliteConnection;
|
|
817
941
|
}
|
|
942
|
+
/** Full replica pull and durable Outbox synchronization. */
|
|
943
|
+
interface ProvideSynchronizedOfflineOptions extends ProvideOfflineOptionsBase {
|
|
944
|
+
mode?: 'synchronized';
|
|
945
|
+
/** Product adapter that sends opaque commands to its API. */
|
|
946
|
+
commandExecutor: Type<OfflineCommandExecutor>;
|
|
947
|
+
/** Product transport for explicit cursor-based server delta pulls. */
|
|
948
|
+
replicaPuller: Type<OfflineReplicaPuller>;
|
|
949
|
+
}
|
|
950
|
+
/** Server- or external-source read cache with no mutation transport or Outbox. */
|
|
951
|
+
interface ProvideReadCacheOfflineOptions extends ProvideOfflineOptionsBase {
|
|
952
|
+
mode: 'readCacheOnly';
|
|
953
|
+
commandExecutor?: never;
|
|
954
|
+
replicaPuller?: never;
|
|
955
|
+
}
|
|
956
|
+
type ProvideOfflineOptions = ProvideSynchronizedOfflineOptions | ProvideReadCacheOfflineOptions;
|
|
818
957
|
/**
|
|
819
958
|
* Provide the standard scoped offline runtime.
|
|
820
959
|
*
|
|
@@ -831,20 +970,7 @@ type OfflineSyncState = 'idle' | 'pending' | 'syncing' | 'attention';
|
|
|
831
970
|
interface EnqueueOfflineCommand<T = unknown> {
|
|
832
971
|
scopeId: string;
|
|
833
972
|
aggregateType: string;
|
|
834
|
-
|
|
835
|
-
aggregateLocalId: string;
|
|
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
|
-
*/
|
|
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;
|
|
973
|
+
identity: EnqueueOfflineCommandIdentity;
|
|
848
974
|
operation: string;
|
|
849
975
|
payload: T;
|
|
850
976
|
/** Full local entity value committed to the replica before the command is exposed to the UI. */
|
|
@@ -870,9 +996,9 @@ declare class OfflineOutboxCapacityError extends Error {
|
|
|
870
996
|
/** Maintains the optimistic local replica and synchronizes its durable outbox. */
|
|
871
997
|
declare class OfflineSyncService {
|
|
872
998
|
#private;
|
|
873
|
-
readonly pendingCommands: i0.Signal<OfflineCommand
|
|
999
|
+
readonly pendingCommands: i0.Signal<OfflineCommand[]>;
|
|
874
1000
|
readonly pendingCount: i0.Signal<number>;
|
|
875
|
-
readonly conflicts: i0.Signal<OfflineCommand
|
|
1001
|
+
readonly conflicts: i0.Signal<OfflineCommand[]>;
|
|
876
1002
|
readonly syncState: i0.Signal<OfflineSyncState>;
|
|
877
1003
|
constructor();
|
|
878
1004
|
initialize(): Promise<void>;
|
|
@@ -918,5 +1044,5 @@ declare class OfflineRequestFallbackService {
|
|
|
918
1044
|
static ɵprov: i0.ɵɵInjectableDeclaration<OfflineRequestFallbackService>;
|
|
919
1045
|
}
|
|
920
1046
|
|
|
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,
|
|
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,
|
|
1047
|
+
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, assertOfflineLocalId, assertOfflineReplicaGeneratedRemoteId, assertOfflineReplicaNaturalKeyBaseline, booleanColumn, canonicalOfflineCommandIdentity, canonicalOfflinePrincipalId, canonicalOfflineRemoteIdentity, canonicalOfflineReplicaIdentity, commandIdentityFromReplicaIdentity, commandIdentityMatchesReplicaRow, createCommunitySqliteDriver, createOfflineAuthBridge, datetime, decodeOfflineReplicaValues, defineOfflineReplicaSchema, defineReplicaEntity, encodeOfflineReplicaValues, generatedId, ignored, integer, isOfflineFallbackError, json, localOnly, naturalKey, normalizeOfflineNaturalKey, normalizeOfflineReplicaPullPage, nullable, offlineCommandLookupIdentity, offlineCommandTargetFromReplicaRow, offlineGeneratedReplicaIdentity, offlineInterceptor, offlineNaturalKeyFromValues, offlineNaturalReplicaIdentity, offlineReplicaRemoteIdentity, offlineSessionManifestAllows, parseOfflineCommandIdentity, parseOfflinePrincipalId, projectOfflineReplicaValues, provideOffline, provideOfflineRequestPolicy, real, replicaAddressFromIdentity, requirePositiveOfflineInteger, selectOfflineRepository, serializeOfflineCommandIdentity, sha256OfflineReplicaSchema, text };
|
|
1048
|
+
export type { CommunitySqliteConnection, CommunitySqliteDatabase, CommunitySqliteDriver, CreateOfflineAuthBridgeOptions, EnqueueOfflineCommand, EnqueueOfflineCommandIdentity, EnqueueOfflineGeneratedIdentity, EnqueueOfflineNaturalIdentity, OfflineAuthBridgeConfig, OfflineAuthExchangeContext, OfflineAuthExchangePhase, OfflineAuthResumeContext, OfflineCommand, OfflineCommandExecutor, OfflineCommandHooks, OfflineCommandIdentity, OfflineCommandResult, OfflineCommandState, OfflineCommandTarget, OfflineGeneratedRemoteId, OfflineKitOptions, OfflineLogoutAction, OfflineNaturalKey, OfflineNaturalKeyValue, OfflineNetworkState, OfflineOutboxLimits, OfflinePrincipalId, OfflineReadRequestPlan, OfflineRemoteIdentity, OfflineReplicaAddress, OfflineReplicaChange, OfflineReplicaChangeBase, OfflineReplicaColumnDef, OfflineReplicaCursor, OfflineReplicaEntityDefinition, OfflineReplicaEntitySchema, OfflineReplicaEntityScope, OfflineReplicaFieldDescriptor, OfflineReplicaFieldPolicy, OfflineReplicaIdentity, OfflineReplicaIdentityDescriptor, OfflineReplicaIgnoredDef, OfflineReplicaLocalOnlyDef, OfflineReplicaMigration, OfflineReplicaMutation, OfflineReplicaNaturalKeyDef, OfflineReplicaPullPage, OfflineReplicaPullRequest, OfflineReplicaPuller, OfflineReplicaRemoteIdDef, OfflineReplicaRemoteIdRelease, OfflineReplicaRemoteIdentity, OfflineReplicaRow, OfflineReplicaRowKey, OfflineReplicaSchemaBundle, OfflineReplicaSchemaDefinition, OfflineReplicaSqliteAffinity, OfflineReplicaStorageKind, OfflineReplicaSyncState, OfflineReplicaTransaction, OfflineReplicaVisibility, OfflineReplicaWebMigrationCallback, OfflineReplicaWebMigrationResult, OfflineReplicaWebMigrationRow, OfflineReplicaWireChange, OfflineReplicaWireIdentity, OfflineReplicaWirePullPage, OfflineRepository, OfflineRequestPlan, OfflineRequestPolicy, OfflineResponseSource, OfflineScope, OfflineSessionManifest, OfflineSessionTransitionLease, OfflineSyncContext, OfflineSyncSession, OfflineSyncState, ProvideOfflineOptions, ProvideReadCacheOfflineOptions, ProvideSynchronizedOfflineOptions };
|