feat(spi): add native fetcher SPI interface for background content fetching
- Add NativeNotificationContentFetcher interface for host app implementations - Add FetchContext class to pass fetch parameters (trigger, scheduledTime, fetchTime) - Add SchedulingPolicy class for retry backoff configuration - Add TypeScript definitions for content fetcher SPI in src/definitions.ts - Export SPI types from src/index.ts This enables host apps to provide their own content fetching implementation for background workers, following the Integration Point Refactor (PR2).
This commit is contained in:
@@ -8,6 +8,12 @@
|
||||
* @version 2.0.0
|
||||
*/
|
||||
|
||||
// Import SPI types from content-fetcher.ts
|
||||
import type {
|
||||
SchedulingPolicy,
|
||||
JsNotificationContentFetcher
|
||||
} from './types/content-fetcher';
|
||||
|
||||
export interface NotificationResponse {
|
||||
id: string;
|
||||
title: string;
|
||||
@@ -442,6 +448,43 @@ export interface DailyNotificationPlugin {
|
||||
* Update an existing daily reminder
|
||||
*/
|
||||
updateDailyReminder(reminderId: string, options: DailyReminderOptions): Promise<void>;
|
||||
|
||||
// Integration Point Refactor (PR1): SPI Registration Methods
|
||||
|
||||
/**
|
||||
* Set JavaScript content fetcher for foreground operations
|
||||
*
|
||||
* NOTE: This is a stub in PR1. Full implementation coming in PR3.
|
||||
* JS fetchers are ONLY used for foreground/manual refresh.
|
||||
* Background workers must use native fetcher.
|
||||
*
|
||||
* @param fetcher JavaScript fetcher implementation
|
||||
*/
|
||||
setJsContentFetcher(fetcher: JsNotificationContentFetcher): void;
|
||||
|
||||
/**
|
||||
* Enable or disable native fetcher
|
||||
*
|
||||
* Native fetcher is required for background workers. If disabled,
|
||||
* background fetches will fail gracefully.
|
||||
*
|
||||
* @param enable Whether to enable native fetcher
|
||||
* @returns Promise with enabled and registered status
|
||||
*/
|
||||
enableNativeFetcher(enable: boolean): Promise<{
|
||||
enabled: boolean;
|
||||
registered: boolean;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Set scheduling policy configuration
|
||||
*
|
||||
* Updates the scheduling policy used by the plugin for retry backoff,
|
||||
* prefetch timing, deduplication, and cache TTL.
|
||||
*
|
||||
* @param policy Scheduling policy configuration
|
||||
*/
|
||||
setPolicy(policy: SchedulingPolicy): Promise<void>;
|
||||
}
|
||||
|
||||
// Phase 1: TimeSafari Endorser.ch API Interfaces
|
||||
|
||||
Reference in New Issue
Block a user