@rdlabo/ionic-angular-kit 21.5.6 → 21.5.7
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
|
@@ -19,6 +19,29 @@ type OfflineReplicaStorageKind = 'text' | 'integer' | 'real' | 'booleanColumn' |
|
|
|
19
19
|
type OfflineReplicaEntityScope = 'user' | 'partition';
|
|
20
20
|
/** Field projection policy for a source-model property. */
|
|
21
21
|
type OfflineReplicaFieldPolicy = 'column' | 'serverId' | 'ignored';
|
|
22
|
+
/** Canonical value types accepted in a composite server-side natural key. */
|
|
23
|
+
type OfflineNaturalKeyValue = string | number;
|
|
24
|
+
/** Ordered natural-key values keyed by source-model field name. */
|
|
25
|
+
type OfflineNaturalKey = Readonly<Record<string, OfflineNaturalKeyValue>>;
|
|
26
|
+
/** Remote row identity. Exactly one variant is valid for a replicated entity. */
|
|
27
|
+
type OfflineReplicaRemoteIdentity = {
|
|
28
|
+
readonly serverId: number;
|
|
29
|
+
readonly naturalKey?: never;
|
|
30
|
+
} | {
|
|
31
|
+
readonly serverId?: never;
|
|
32
|
+
readonly naturalKey: OfflineNaturalKey;
|
|
33
|
+
};
|
|
34
|
+
/** Runtime identity policy materialized into an entity schema. */
|
|
35
|
+
type OfflineReplicaIdentityDescriptor = {
|
|
36
|
+
readonly kind: 'localOnly';
|
|
37
|
+
readonly sourceKeys: readonly [];
|
|
38
|
+
} | {
|
|
39
|
+
readonly kind: 'serverId';
|
|
40
|
+
readonly sourceKeys: readonly [string];
|
|
41
|
+
} | {
|
|
42
|
+
readonly kind: 'naturalKey';
|
|
43
|
+
readonly sourceKeys: readonly string[];
|
|
44
|
+
};
|
|
22
45
|
/** Runtime descriptor for one mapped source property. */
|
|
23
46
|
interface OfflineReplicaFieldDescriptor {
|
|
24
47
|
/** Source-model property name from the select shape. */
|
|
@@ -44,6 +67,8 @@ interface OfflineReplicaEntitySchema<TSelect extends Record<string, unknown>> {
|
|
|
44
67
|
readonly sourceKey: string;
|
|
45
68
|
/** Whether rows are partitioned by user only or user plus scope partition. */
|
|
46
69
|
readonly scope: OfflineReplicaEntityScope;
|
|
70
|
+
/** Remote identity policy used by repository and pull reconciliation. */
|
|
71
|
+
readonly identity: OfflineReplicaIdentityDescriptor;
|
|
47
72
|
/** Ordered field descriptors derived from the DSL definition. */
|
|
48
73
|
readonly fields: readonly OfflineReplicaFieldDescriptor[];
|
|
49
74
|
/** Deterministic DDL statements for the replica table and indexes. */
|
|
@@ -84,6 +109,11 @@ interface OfflineReplicaIgnoredDef {
|
|
|
84
109
|
readonly kind: 'ignored';
|
|
85
110
|
readonly reason: string;
|
|
86
111
|
}
|
|
112
|
+
/** Builder selecting non-null source columns as a composite remote identity. */
|
|
113
|
+
interface OfflineReplicaNaturalKeyDef<TKey extends string = string> {
|
|
114
|
+
readonly kind: 'naturalKey';
|
|
115
|
+
readonly sourceKeys: readonly TKey[];
|
|
116
|
+
}
|
|
87
117
|
type StripNullish<T> = Exclude<T, null | undefined>;
|
|
88
118
|
type NormalizeReplicaColumnValue<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends Date ? string | Date : T;
|
|
89
119
|
type StrictNullChecksEnabled = undefined extends null ? false : true;
|
|
@@ -104,6 +134,7 @@ interface OfflineReplicaEntityDefinition<TSelect extends Record<string, unknown>
|
|
|
104
134
|
readonly table: string;
|
|
105
135
|
readonly sourceKey: string;
|
|
106
136
|
readonly scope: OfflineReplicaEntityScope;
|
|
137
|
+
readonly identity?: OfflineReplicaNaturalKeyDef<Extract<keyof TSelect, string>>;
|
|
107
138
|
readonly fields: ExactSelectKeys<TSelect, TFields> & TFields;
|
|
108
139
|
}
|
|
109
140
|
/**
|
|
@@ -134,8 +165,18 @@ declare function nullable<TValue>(column: OfflineReplicaColumnDef<TValue, {
|
|
|
134
165
|
}>;
|
|
135
166
|
/** Maps a source property to the shared nullable `server_id` column. */
|
|
136
167
|
declare function serverId(): OfflineReplicaServerIdDef;
|
|
168
|
+
/** Declares an ordered composite natural key without changing the immutable local UUID. */
|
|
169
|
+
declare function naturalKey<const TKey extends string>(sourceKeys: readonly TKey[]): OfflineReplicaNaturalKeyDef<TKey>;
|
|
137
170
|
/** Rejects a remote identity on a local-only projection before it reaches platform storage. */
|
|
138
171
|
declare function assertOfflineReplicaServerId(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, value: number | null): void;
|
|
172
|
+
/** Extracts and validates an entity's natural key in declared component order. */
|
|
173
|
+
declare function offlineNaturalKeyFromValues(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, values: unknown): OfflineNaturalKey | null;
|
|
174
|
+
/** Validates a supplied natural key and returns it in schema-declared order. */
|
|
175
|
+
declare function normalizeOfflineNaturalKey(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, naturalKey: OfflineNaturalKey): OfflineNaturalKey;
|
|
176
|
+
/** Stable, type-tagged identity key used by web uniqueness and pull collapse. */
|
|
177
|
+
declare function canonicalOfflineRemoteIdentity(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, identity: OfflineReplicaRemoteIdentity): string;
|
|
178
|
+
/** Enforces one immutable natural identity across optimistic and confirmed row values. */
|
|
179
|
+
declare function assertOfflineReplicaNaturalKeyBaseline(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, values: unknown, confirmedValues: unknown | null): void;
|
|
139
180
|
/** Excludes a source property from SQLite while retaining it in the select shape. */
|
|
140
181
|
declare function ignored(reason: string): OfflineReplicaIgnoredDef;
|
|
141
182
|
/**
|
|
@@ -289,6 +330,7 @@ interface OfflineRepository {
|
|
|
289
330
|
getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string, localId: string): Promise<OfflineReplicaRow<TValues> | null>;
|
|
290
331
|
getReplicaRows<TValues = unknown>(scope: OfflineScope, sourceKey: string): Promise<OfflineReplicaRow<TValues>[]>;
|
|
291
332
|
getReplicaRowByServerId<TValues = unknown>(scope: OfflineScope, sourceKey: string, serverId: number): Promise<OfflineReplicaRow<TValues> | null>;
|
|
333
|
+
getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
|
|
292
334
|
getReplicaCursor(scope: OfflineScope): Promise<OfflineReplicaCursor | null>;
|
|
293
335
|
getCommands(scope: OfflineScope): Promise<OfflineCommand[]>;
|
|
294
336
|
getCommandsForUser?(userId: number): Promise<OfflineCommand[]>;
|
|
@@ -314,6 +356,7 @@ declare class IonicOfflineRepository implements OfflineRepository {
|
|
|
314
356
|
getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string, localId: string): Promise<OfflineReplicaRow<TValues> | null>;
|
|
315
357
|
getReplicaRows<TValues = unknown>(scope: OfflineScope, sourceKey: string): Promise<OfflineReplicaRow<TValues>[]>;
|
|
316
358
|
getReplicaRowByServerId<TValues = unknown>(scope: OfflineScope, sourceKey: string, serverId: number): Promise<OfflineReplicaRow<TValues> | null>;
|
|
359
|
+
getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
|
|
317
360
|
getReplicaCursor(scope: OfflineScope): Promise<OfflineReplicaCursor | null>;
|
|
318
361
|
getCommands(scope: OfflineScope): Promise<OfflineCommand[]>;
|
|
319
362
|
getCommandsForUser(userId: number): Promise<OfflineCommand[]>;
|
|
@@ -335,9 +378,8 @@ interface OfflineReplicaPullRequest {
|
|
|
335
378
|
schemaHash: string;
|
|
336
379
|
}
|
|
337
380
|
/** One server-side replica mutation returned by an explicit pull page. */
|
|
338
|
-
interface
|
|
381
|
+
interface OfflineReplicaChangeBase {
|
|
339
382
|
sourceKey: string;
|
|
340
|
-
serverId: number;
|
|
341
383
|
serverRevision: string | number;
|
|
342
384
|
/**
|
|
343
385
|
* Idempotency command ids durably recorded by the server and reflected in this final row state.
|
|
@@ -347,6 +389,8 @@ interface OfflineReplicaChange {
|
|
|
347
389
|
values: unknown | null;
|
|
348
390
|
deleted: boolean;
|
|
349
391
|
}
|
|
392
|
+
/** One server-side mutation with the identity kind declared by its replica schema. */
|
|
393
|
+
type OfflineReplicaChange = OfflineReplicaChangeBase & OfflineReplicaRemoteIdentity;
|
|
350
394
|
/** One explicit replica pull response page from the application backend. */
|
|
351
395
|
interface OfflineReplicaPullPage {
|
|
352
396
|
schemaVersion: number;
|
|
@@ -385,6 +429,8 @@ interface OfflineCommandResult {
|
|
|
385
429
|
interface OfflineCommandTarget {
|
|
386
430
|
localId: string;
|
|
387
431
|
serverId: number | null;
|
|
432
|
+
/** Composite identity derived from current replica values for a natural-key entity. */
|
|
433
|
+
naturalKey?: OfflineNaturalKey;
|
|
388
434
|
}
|
|
389
435
|
/** 不透明なoperationを製品APIへ送信し、local replicaへ投影するadapter。 */
|
|
390
436
|
/** Product adapter that sends commands and projects acknowledgements into entities. */
|
|
@@ -710,6 +756,7 @@ declare class SqliteOfflineRepository implements OfflineRepository {
|
|
|
710
756
|
getReplicaRow<TValues = unknown>(scope: OfflineScope, sourceKey: string, localId: string): Promise<OfflineReplicaRow<TValues> | null>;
|
|
711
757
|
getReplicaRows<TValues = unknown>(scope: OfflineScope, sourceKey: string): Promise<OfflineReplicaRow<TValues>[]>;
|
|
712
758
|
getReplicaRowByServerId<TValues = unknown>(scope: OfflineScope, sourceKey: string, serverId: number): Promise<OfflineReplicaRow<TValues> | null>;
|
|
759
|
+
getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
|
|
713
760
|
getReplicaCursor(scope: OfflineScope): Promise<OfflineReplicaCursor | null>;
|
|
714
761
|
getCommands(scope: OfflineScope): Promise<OfflineCommand[]>;
|
|
715
762
|
getCommandsForUser(userId: number): Promise<OfflineCommand[]>;
|
|
@@ -814,5 +861,5 @@ declare class OfflineRequestFallbackService {
|
|
|
814
861
|
static ɵprov: i0.ɵɵInjectableDeclaration<OfflineRequestFallbackService>;
|
|
815
862
|
}
|
|
816
863
|
|
|
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 };
|
|
864
|
+
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 };
|