feat: add services package
This commit is contained in:
1
packages/services/src/Domain/Event/EventObserver.ts
Normal file
1
packages/services/src/Domain/Event/EventObserver.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type EventObserver<E, D> = (eventName: E, data?: D) => Promise<void> | void
|
||||
25
packages/services/src/Domain/Event/SyncEvent.ts
Normal file
25
packages/services/src/Domain/Event/SyncEvent.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/* istanbul ignore file */
|
||||
export enum SyncEvent {
|
||||
/**
|
||||
* A potentially multi-round trip that keeps syncing until all items have been uploaded.
|
||||
* However, this event will still trigger if there are more items waiting to be downloaded on the
|
||||
* server
|
||||
*/
|
||||
SyncCompletedWithAllItemsUploaded = 'SyncCompletedWithAllItemsUploaded',
|
||||
SyncCompletedWithAllItemsUploadedAndDownloaded = 'SyncCompletedWithAllItemsUploadedAndDownloaded',
|
||||
SingleRoundTripSyncCompleted = 'SingleRoundTripSyncCompleted',
|
||||
SyncWillBegin = 'sync:will-begin',
|
||||
DownloadFirstSyncCompleted = 'sync:download-first-completed',
|
||||
SyncTakingTooLong = 'sync:taking-too-long',
|
||||
SyncError = 'sync:error',
|
||||
InvalidSession = 'sync:invalid-session',
|
||||
MajorDataChange = 'major-data-change',
|
||||
LocalDataIncrementalLoad = 'local-data-incremental-load',
|
||||
LocalDataLoaded = 'local-data-loaded',
|
||||
EnterOutOfSync = 'enter-out-of-sync',
|
||||
ExitOutOfSync = 'exit-out-of-sync',
|
||||
StatusChanged = 'status-changed',
|
||||
DatabaseWriteError = 'database-write-error',
|
||||
DatabaseReadError = 'database-read-error',
|
||||
SyncRequestsIntegrityCheck = 'sync:requests-integrity-check',
|
||||
}
|
||||
3
packages/services/src/Domain/Event/SyncEventReceiver.ts
Normal file
3
packages/services/src/Domain/Event/SyncEventReceiver.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { SyncEvent } from './SyncEvent'
|
||||
|
||||
export type SyncEventReceiver = (event: SyncEvent) => void
|
||||
Reference in New Issue
Block a user