@rdlabo/ionic-angular-kit 21.5.40 → 21.6.1

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.40",
3
+ "version": "21.6.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/rdlabo-team/ionic-angular-library.git"
@@ -330,6 +330,14 @@ declare function commandIdentityMatchesReplicaRow(schema: OfflineReplicaEntitySc
330
330
  /** Remote identity used by pull reconciliation and uniqueness checks. */
331
331
  declare function offlineReplicaRemoteIdentity(schema: OfflineReplicaEntitySchema<Record<string, unknown>>, identity: OfflineReplicaIdentity): OfflineReplicaRemoteIdentity | null;
332
332
 
333
+ /**
334
+ * Internal repository capability used to detect commits made through another
335
+ * native SQLite connection during a local read/derive/write operation.
336
+ *
337
+ * This symbol is intentionally not re-exported from the package entry point.
338
+ */
339
+ declare const OFFLINE_REPOSITORY_ATOMIC_MUTATION: unique symbol;
340
+
333
341
  /** Current durable storage schema used by both web and native repositories. */
334
342
  declare const OFFLINE_SCHEMA_VERSION = 2;
335
343
  /** User and partition scope of all local offline data. */
@@ -431,10 +439,6 @@ interface OfflineReplicaTransaction {
431
439
  putCommands?: readonly OfflineCommand[];
432
440
  removeCommandIds?: readonly string[];
433
441
  putCursors?: readonly OfflineReplicaCursor[];
434
- /** Scopes whose acknowledged server changes still require an authoritative pull. */
435
- putReconciliationScopes?: readonly OfflineScope[];
436
- /** Scopes whose authoritative post-acknowledgement pull completed successfully. */
437
- removeReconciliationScopes?: readonly OfflineScope[];
438
442
  /** Durable fatal-pull attentions to upsert for user+scope. */
439
443
  putPullAttentions?: readonly OfflinePullAttention[];
440
444
  /** Scopes whose fatal-pull attentions should be removed after a successful pull. */
@@ -455,7 +459,6 @@ interface OfflineRepositoryReader {
455
459
  getReplicaRowByRemoteId<TValues = unknown>(scope: OfflineScope, sourceKey: string, remoteId: OfflineGeneratedRemoteId): Promise<OfflineReplicaRow<TValues> | null>;
456
460
  getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
457
461
  getReplicaCursor(scope: OfflineScope): Promise<OfflineReplicaCursor | null>;
458
- getReconciliationScopes?(userId: OfflinePrincipalId): Promise<OfflineScope[]>;
459
462
  getPullAttentions?(userId: OfflinePrincipalId): Promise<OfflinePullAttention[]>;
460
463
  getCommands(scope: OfflineScope): Promise<OfflineCommand[]>;
461
464
  getCommandsForUser?(userId: OfflinePrincipalId): Promise<OfflineCommand[]>;
@@ -474,7 +477,6 @@ interface OfflineRepository {
474
477
  getReplicaRowByRemoteId<TValues = unknown>(scope: OfflineScope, sourceKey: string, remoteId: OfflineGeneratedRemoteId): Promise<OfflineReplicaRow<TValues> | null>;
475
478
  getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
476
479
  getReplicaCursor(scope: OfflineScope): Promise<OfflineReplicaCursor | null>;
477
- getReconciliationScopes?(userId: OfflinePrincipalId): Promise<OfflineScope[]>;
478
480
  /** Durable fatal-pull attentions for the principal, ordered by scope id. */
479
481
  getPullAttentions?(userId: OfflinePrincipalId): Promise<OfflinePullAttention[]>;
480
482
  getCommands(scope: OfflineScope): Promise<OfflineCommand[]>;
@@ -499,6 +501,8 @@ interface OfflineRepository {
499
501
  * must not be called from `read`.
500
502
  */
501
503
  runReadSnapshot<T>(read: (reader: OfflineRepositoryReader) => Promise<T>): Promise<T>;
504
+ /** @internal Runs one optimistic read/derive/write operation with platform-specific concurrency validation. */
505
+ [OFFLINE_REPOSITORY_ATOMIC_MUTATION]?<T>(operation: (repository: OfflineRepository) => Promise<T>): Promise<T>;
502
506
  }
503
507
  /** DI token for the selected platform repository. */
504
508
  declare const OFFLINE_REPOSITORY: InjectionToken<OfflineRepository>;
@@ -520,7 +524,6 @@ declare class IonicOfflineRepository implements OfflineRepository {
520
524
  getReplicaRowByRemoteId<TValues = unknown>(scope: OfflineScope, sourceKey: string, remoteId: OfflineGeneratedRemoteId): Promise<OfflineReplicaRow<TValues> | null>;
521
525
  getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
522
526
  getReplicaCursor(scope: OfflineScope): Promise<OfflineReplicaCursor | null>;
523
- getReconciliationScopes(userId: OfflinePrincipalId): Promise<OfflineScope[]>;
524
527
  getPullAttentions(userId: OfflinePrincipalId): Promise<OfflinePullAttention[]>;
525
528
  getCommands(scope: OfflineScope): Promise<OfflineCommand[]>;
526
529
  getCommandsForUser(userId: OfflinePrincipalId): Promise<OfflineCommand[]>;
@@ -738,7 +741,7 @@ declare class OfflineReplicaPullService {
738
741
  declare class OfflineReplicaMutationCoordinator {
739
742
  #private;
740
743
  /** Enqueues one local replica critical section behind any in-flight mutation. */
741
- run<T>(operation: () => Promise<T>): Promise<T>;
744
+ run<T>(operation: (repository: OfflineRepository) => Promise<T>): Promise<T>;
742
745
  /** Resolves after every currently queued replica mutation has settled. */
743
746
  drain(): Promise<void>;
744
747
  /**
@@ -1326,11 +1329,11 @@ declare class SqliteOfflineRepository implements OfflineRepository {
1326
1329
  getReplicaRowByRemoteId<TValues = unknown>(scope: OfflineScope, sourceKey: string, remoteId: OfflineGeneratedRemoteId): Promise<OfflineReplicaRow<TValues> | null>;
1327
1330
  getReplicaRowByRemoteIdentity<TValues = unknown>(scope: OfflineScope, sourceKey: string, identity: OfflineReplicaRemoteIdentity): Promise<OfflineReplicaRow<TValues> | null>;
1328
1331
  getReplicaCursor(scope: OfflineScope): Promise<OfflineReplicaCursor | null>;
1329
- getReconciliationScopes(userId: OfflinePrincipalId): Promise<OfflineScope[]>;
1330
1332
  getPullAttentions(userId: OfflinePrincipalId): Promise<OfflinePullAttention[]>;
1331
1333
  getCommands(scope: OfflineScope): Promise<OfflineCommand[]>;
1332
1334
  getCommandsForUser(userId: OfflinePrincipalId): Promise<OfflineCommand[]>;
1333
1335
  runReadSnapshot<T>(read: (reader: OfflineRepositoryReader) => Promise<T>): Promise<T>;
1336
+ [OFFLINE_REPOSITORY_ATOMIC_MUTATION]<T>(operation: (repository: OfflineRepository) => Promise<T>): Promise<T>;
1334
1337
  putCommand(command: OfflineCommand): Promise<void>;
1335
1338
  replaceCommand(command: OfflineCommand): Promise<void>;
1336
1339
  removeCommand(commandId: string): Promise<void>;
@@ -143,5 +143,54 @@ interface KitBuildLabelPdfParams extends KitCalculatePrintLayoutParams {
143
143
  /** Build a multi-page label PDF and return its bytes without choosing an output destination. */
144
144
  declare const kitBuildLabelPdf: (params: KitBuildLabelPdfParams) => Promise<Uint8Array>;
145
145
 
146
- export { kitBuildBrotherPrintSettings, kitBuildLabelPdf, kitCalculatePrintLayout, kitDomToPng, kitPrintPaperSizes, kitRotationImage };
147
- export type { KitBrotherPrintSettingsParams, KitBuildLabelPdfParams, KitCalculatePrintLayoutParams, KitDomToPngOptions, KitPrintLayout, KitPrintMeasure, KitPrintPaper, KitPrintPosition };
146
+ /** Browser dependencies used by the PDF output helpers. */
147
+ interface KitBrowserPdfDependencies {
148
+ /** Document used to create download links and preview windows. */
149
+ readonly document: Pick<Document, 'body' | 'createElement' | 'defaultView'>;
150
+ /** Object URL implementation used for generated PDF blobs. */
151
+ readonly url: Pick<typeof URL, 'createObjectURL' | 'revokeObjectURL'>;
152
+ /** Scheduler used to delay DOM and object URL cleanup. */
153
+ readonly schedule: (callback: () => void, delay: number) => unknown;
154
+ }
155
+ /** Options shared by browser PDF output helpers. */
156
+ interface KitBrowserPdfOutputOptions {
157
+ /** Delay before temporary resources are released. Invalid values fall back to 60 seconds. */
158
+ readonly cleanupDelayMs?: number;
159
+ /** Browser dependencies. Override in tests; production callers normally omit this. */
160
+ readonly dependencies?: KitBrowserPdfDependencies;
161
+ }
162
+ /** Options for {@link kitDownloadPdf}. */
163
+ interface KitDownloadPdfOptions extends KitBrowserPdfOutputOptions {
164
+ /** Filename presented by the browser download. */
165
+ readonly filename: string;
166
+ }
167
+ /** Options for {@link kitPreviewGeneratedPdf}. */
168
+ interface KitPreviewGeneratedPdfOptions extends KitBrowserPdfOutputOptions {
169
+ /** Title shown while the PDF is being generated. */
170
+ readonly title: string;
171
+ /** Text shown while the PDF is being generated. */
172
+ readonly pendingText: string;
173
+ /** Filename used when a preview window cannot be opened or has been closed. */
174
+ readonly fallbackFilename: string;
175
+ }
176
+ /**
177
+ * Download generated PDF bytes without navigating the current application page.
178
+ *
179
+ * @remarks Browser-only. Do not call during server-side rendering.
180
+ *
181
+ * The temporary anchor and object URL stay alive long enough for browsers to start the download.
182
+ * Cleanup is registered before clicking so a cleanup scheduling error cannot be mistaken for a PDF
183
+ * generation failure after the download has already started.
184
+ */
185
+ declare const kitDownloadPdf: (pdfBytes: Uint8Array, options: KitDownloadPdfOptions) => void;
186
+ /**
187
+ * Preview an asynchronously generated PDF without risking a popup-blocked result.
188
+ *
189
+ * This function opens its placeholder window synchronously, before invoking `buildPdf`. Call it
190
+ * directly from the user's click handler and pass PDF generation as the callback. Generation errors
191
+ * close the placeholder and are rethrown for the application to present with its own UI.
192
+ */
193
+ declare const kitPreviewGeneratedPdf: (buildPdf: () => Promise<Uint8Array>, options: KitPreviewGeneratedPdfOptions) => Promise<void>;
194
+
195
+ export { kitBuildBrotherPrintSettings, kitBuildLabelPdf, kitCalculatePrintLayout, kitDomToPng, kitDownloadPdf, kitPreviewGeneratedPdf, kitPrintPaperSizes, kitRotationImage };
196
+ export type { KitBrotherPrintSettingsParams, KitBrowserPdfDependencies, KitBrowserPdfOutputOptions, KitBuildLabelPdfParams, KitCalculatePrintLayoutParams, KitDomToPngOptions, KitDownloadPdfOptions, KitPreviewGeneratedPdfOptions, KitPrintLayout, KitPrintMeasure, KitPrintPaper, KitPrintPosition };