@amazon-devices/kepler-epg-sync-scheduler 1.2.94 → 1.2.124
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/README.md +136 -0
- package/SystemBundles/{e5daca3a948d94191e9770d49f9bfd4b7836923f555f25442ae71cf2ae7ca95a.bundle.map → a10abb17551a36a469b370ebb60e75b79984830f9d4092781ff69eaef5bd1e21.bundle.map} +1 -1
- package/SystemBundles/hermes-072/a10abb17551a36a469b370ebb60e75b79984830f9d4092781ff69eaef5bd1e21.bundle.map +1 -0
- package/SystemBundles/hermes-072/index.amzn__kepler-epg-sync-scheduler-1.hermes.bundle +0 -0
- package/SystemBundles/hermes-083/a10abb17551a36a469b370ebb60e75b79984830f9d4092781ff69eaef5bd1e21.bundle.map +1 -0
- package/SystemBundles/hermes-083/index.amzn__kepler-epg-sync-scheduler-1.hermes.bundle +0 -0
- package/SystemBundles/index.amzn__kepler-epg-sync-scheduler-1.hermes.bundle +0 -0
- package/SystemModules/amzn__kepler-epg-sync-scheduler-1.private.modules.txt +14 -14
- package/THIRD_PARTY_NOTICES.txt +8469 -1690
- package/kepler-compatibility.json +32 -2
- package/package.json +1 -1
- package/SystemBundles/e5daca3a948d94191e9770d49f9bfd4b7836923f555f25442ae71cf2ae7ca95a.bundle +0 -1263
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Kepler EPG Sync Scheduler API Documentation
|
|
2
|
+
|
|
3
|
+
The `@amazon-devices/kepler-epg-sync-scheduler` package provides APIs for scheduling Electronic Program Guide (EPG) synchronization tasks in KeplerScript applications. It offers flexible scheduling options with both interval-based and time-window-based execution.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Kepler EPG Sync Scheduler allows you to:
|
|
8
|
+
- Schedule periodic EPG sync tasks at regular intervals
|
|
9
|
+
- Schedule EPG sync tasks within specific time windows (e.g., between 2AM-4AM UTC)
|
|
10
|
+
- Cancel existing scheduled tasks
|
|
11
|
+
|
|
12
|
+
## Public APIs
|
|
13
|
+
|
|
14
|
+
### Main Scheduler
|
|
15
|
+
|
|
16
|
+
#### `EpgSyncTaskScheduler`
|
|
17
|
+
The main scheduler instance that implements the `IEpgSyncTaskScheduler` interface.
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import {EpgSyncTaskScheduler} from '@amazon-devices/kepler-epg-sync-scheduler';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Interfaces
|
|
24
|
+
|
|
25
|
+
#### `IEpgSyncTaskScheduler`
|
|
26
|
+
The main interface exposing EPG sync task scheduling functions.
|
|
27
|
+
|
|
28
|
+
**Methods:**
|
|
29
|
+
|
|
30
|
+
##### `scheduleTask(componentId: string, interval: number): Promise<void>`
|
|
31
|
+
Schedules an EPG sync task to run at regular intervals.
|
|
32
|
+
|
|
33
|
+
- **Parameters:**
|
|
34
|
+
- `componentId`: The component ID for the JS background task to be scheduled
|
|
35
|
+
- `interval`: Time interval in minutes (must be between 5 and 1440 minutes inclusive)
|
|
36
|
+
- **Behavior:**
|
|
37
|
+
- Runs the task immediately upon scheduling
|
|
38
|
+
- Then schedules recurring execution at the specified interval
|
|
39
|
+
- Only one EPG sync task can be scheduled at a time
|
|
40
|
+
- Persists across device reboots
|
|
41
|
+
- **Throws:** `InternalError` if scheduling fails
|
|
42
|
+
- **Returns:** Promise that resolves when scheduling is complete
|
|
43
|
+
|
|
44
|
+
##### `scheduleTaskWithExecutionWindow(componentId: string, timeProperties: ITimeProperties): Promise<void>`
|
|
45
|
+
Schedules an EPG sync task to run daily within a specific time window.
|
|
46
|
+
|
|
47
|
+
- **Parameters:**
|
|
48
|
+
- `componentId`: The component ID for the JS background task to be scheduled
|
|
49
|
+
- `timeProperties`: Time constraints for task execution (created using `UtcTimePropertiesBuilder`)
|
|
50
|
+
- **Behavior:**
|
|
51
|
+
- Runs the task immediately upon scheduling
|
|
52
|
+
- Then schedules daily execution within the specified UTC time window
|
|
53
|
+
- Only one EPG sync task can be scheduled at a time
|
|
54
|
+
- Persists across device reboots
|
|
55
|
+
- **Throws:** `InternalError` if scheduling fails
|
|
56
|
+
- **Returns:** Promise that resolves when scheduling is complete
|
|
57
|
+
|
|
58
|
+
##### `cancelScheduledTasks(): Promise<void>`
|
|
59
|
+
Cancels all existing scheduled EPG sync tasks.
|
|
60
|
+
|
|
61
|
+
- **Behavior:**
|
|
62
|
+
- Cancels tasks scheduled by either `scheduleTask()` or `scheduleTaskWithExecutionWindow()`
|
|
63
|
+
- Succeeds even if no tasks are currently scheduled
|
|
64
|
+
- **Throws:** `InternalError` if cancellation fails
|
|
65
|
+
- **Returns:** Promise that resolves when cancellation is complete
|
|
66
|
+
|
|
67
|
+
### Time Properties
|
|
68
|
+
|
|
69
|
+
#### `ITimeProperties`
|
|
70
|
+
Interface describing time constraints for task execution. Use `UtcTimePropertiesBuilder` to create instances.
|
|
71
|
+
|
|
72
|
+
#### `UtcTimePropertiesBuilder`
|
|
73
|
+
Builder class for creating UTC-based time properties with execution windows.
|
|
74
|
+
|
|
75
|
+
**Methods:**
|
|
76
|
+
|
|
77
|
+
##### `startHour(hour: number): UtcTimePropertiesBuilder`
|
|
78
|
+
Sets the start hour (0-23) for the execution window.
|
|
79
|
+
- **Required field**
|
|
80
|
+
- **Throws:** `InvalidArgumentError` if hour is not between 0-23
|
|
81
|
+
- **Throws:** `IllegalStateError` if builder has already been used
|
|
82
|
+
|
|
83
|
+
##### `startMinute(minute: number): UtcTimePropertiesBuilder`
|
|
84
|
+
Sets the start minute (0-59) for the execution window.
|
|
85
|
+
- **Required field**
|
|
86
|
+
- **Throws:** `InvalidArgumentError` if minute is not between 0-59
|
|
87
|
+
- **Throws:** `IllegalStateError` if builder has already been used
|
|
88
|
+
|
|
89
|
+
##### `startSecond(second: number): UtcTimePropertiesBuilder`
|
|
90
|
+
Sets the start second (0-59) for the execution window.
|
|
91
|
+
- **Required field**
|
|
92
|
+
- **Throws:** `InvalidArgumentError` if second is not between 0-59
|
|
93
|
+
- **Throws:** `IllegalStateError` if builder has already been used
|
|
94
|
+
|
|
95
|
+
##### `executionWindowInMinutes(window: number): UtcTimePropertiesBuilder`
|
|
96
|
+
Sets the length of the execution window in minutes.
|
|
97
|
+
- **Optional field** (defaults to 60 minutes)
|
|
98
|
+
- **Throws:** `InvalidArgumentError` if window is less than 60 minutes
|
|
99
|
+
- **Throws:** `IllegalStateError` if builder has already been used
|
|
100
|
+
|
|
101
|
+
##### `build(): ITimeProperties`
|
|
102
|
+
Builds the final `TimeProperties` object.
|
|
103
|
+
- **Throws:** `InvalidArgumentError` if required fields are missing
|
|
104
|
+
- **Throws:** `IllegalStateError` if builder has already been used
|
|
105
|
+
- **Note:** Builder instances can only be used once
|
|
106
|
+
|
|
107
|
+
### Error Types
|
|
108
|
+
|
|
109
|
+
#### `InternalError`
|
|
110
|
+
Custom error indicating something went wrong when scheduling the EPG sync task.
|
|
111
|
+
|
|
112
|
+
#### `InvalidArgumentError`
|
|
113
|
+
Exception thrown when there is a failure in creating a new object due to invalid arguments.
|
|
114
|
+
|
|
115
|
+
#### `IllegalStateError`
|
|
116
|
+
Exception thrown when builder functions are called after the builder has already been used to build an object.
|
|
117
|
+
|
|
118
|
+
## Important Notes
|
|
119
|
+
|
|
120
|
+
- Only one EPG sync task can be scheduled at any point in time
|
|
121
|
+
- The most recent scheduling call will override any previous scheduling
|
|
122
|
+
- Scheduled tasks persist across device reboots
|
|
123
|
+
- All time-based scheduling uses UTC time
|
|
124
|
+
- Builder instances can only be used once and cannot be reused after calling `build()`
|
|
125
|
+
- Interval scheduling accepts values between 5 and 1440 minutes (1 day)
|
|
126
|
+
- Execution window scheduling requires a minimum window of 60 minutes (1 hour)
|
|
127
|
+
|
|
128
|
+
## Error Handling
|
|
129
|
+
|
|
130
|
+
All scheduling operations are asynchronous and may throw `InternalError` exceptions. Always wrap scheduling calls in try-catch blocks or handle Promise rejections appropriately.
|
|
131
|
+
|
|
132
|
+
The builder pattern used for time properties may throw `InvalidArgumentError` for invalid parameters or `IllegalStateError` if attempting to reuse a builder instance.
|
|
133
|
+
|
|
134
|
+
## Developer Guide
|
|
135
|
+
|
|
136
|
+
For detailed integration steps, see https://developer.amazon.com/docs/kepler-tv/overview-of-epg-integration.html
|