@dereekb/model 12.1.3 → 12.1.5
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/index.cjs.js +2017 -0
- package/index.esm.js +2015 -2
- package/package.json +2 -3
- package/src/lib/service/index.d.ts +1 -0
- package/src/lib/service/sync/index.d.ts +5 -0
- package/src/lib/service/sync/sync.entity.d.ts +63 -0
- package/src/lib/service/sync/sync.entity.synchronizer.basic.d.ts +117 -0
- package/src/lib/service/sync/sync.entity.synchronizer.d.ts +128 -0
- package/src/lib/service/sync/sync.error.d.ts +31 -0
- package/src/lib/service/sync/sync.service.d.ts +3 -0
- package/src/lib/service/sync/sync.source.d.ts +34 -0
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/model",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.5",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"node": {
|
|
8
|
-
"require": "./index.cjs.js"
|
|
9
|
-
"import": "./index.mjs"
|
|
8
|
+
"require": "./index.cjs.js"
|
|
10
9
|
},
|
|
11
10
|
"browser": {
|
|
12
11
|
"require": "./index.cjs.js",
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { FactoryWithRequiredInput, Maybe, UniqueModel } from '@dereekb/util';
|
|
2
|
+
import { SyncSourceInfo } from './sync.source';
|
|
3
|
+
/**
|
|
4
|
+
* A unique identifier for an entity on a specific server.
|
|
5
|
+
*/
|
|
6
|
+
export type SyncEntityId = string;
|
|
7
|
+
/**
|
|
8
|
+
* A common type for an entity that is shared/used between all systems for an entity that should be synchronized.
|
|
9
|
+
*/
|
|
10
|
+
export type SyncEntityCommonType = string;
|
|
11
|
+
/**
|
|
12
|
+
* A common identifier for an entity that is shared/used between all systems for an entity that should be synchronized.
|
|
13
|
+
*
|
|
14
|
+
* This identifier should be used for retrieving a similar entity from any server.
|
|
15
|
+
*/
|
|
16
|
+
export type SyncEntityCommonId = string;
|
|
17
|
+
/**
|
|
18
|
+
* A pair of common type and common id for an entity.
|
|
19
|
+
*/
|
|
20
|
+
export interface SyncEntityCommonTypeIdPair {
|
|
21
|
+
readonly commonType: SyncEntityCommonType;
|
|
22
|
+
readonly commonId: SyncEntityCommonId;
|
|
23
|
+
}
|
|
24
|
+
export type SyncEntityCommonTypeIdPairFactoryInput = SyncEntityCommonTypeIdPair | SyncEntityCommonId;
|
|
25
|
+
export type SyncEntityCommonTypeIdPairFactory = (input: SyncEntityCommonTypeIdPairFactoryInput) => SyncEntityCommonTypeIdPair;
|
|
26
|
+
export declare function syncEntityCommonTypeIdPairFactory(commonType: SyncEntityCommonType): SyncEntityCommonTypeIdPairFactory;
|
|
27
|
+
/**
|
|
28
|
+
* Represents a single entity that can be synchronized between different servers.
|
|
29
|
+
*/
|
|
30
|
+
export interface SyncEntity extends UniqueModel, SyncEntityCommonTypeIdPair {
|
|
31
|
+
/**
|
|
32
|
+
* The unique identifier for the entity on the server.
|
|
33
|
+
*/
|
|
34
|
+
readonly id: SyncEntityId;
|
|
35
|
+
/**
|
|
36
|
+
* The server information for the entity.
|
|
37
|
+
*/
|
|
38
|
+
readonly sourceInfo: SyncSourceInfo;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Configuration for syncEntityFactory().
|
|
42
|
+
*/
|
|
43
|
+
export interface SyncEntityFactoryConfig {
|
|
44
|
+
/**
|
|
45
|
+
* The source information to attach to the entity.
|
|
46
|
+
*/
|
|
47
|
+
readonly sourceInfo: SyncSourceInfo;
|
|
48
|
+
/**
|
|
49
|
+
* Optional factory for generating the entity's id from the common id.
|
|
50
|
+
*/
|
|
51
|
+
readonly idFactory?: Maybe<(commonId: SyncEntityCommonId) => SyncEntityId>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Factory for creating a SyncEntity.
|
|
55
|
+
*/
|
|
56
|
+
export type SyncEntityFactory = FactoryWithRequiredInput<SyncEntity, SyncEntityCommonTypeIdPair>;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a SyncEntityFactory.
|
|
59
|
+
*
|
|
60
|
+
* @param config
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
export declare function syncEntityFactory(config: SyncEntityFactoryConfig): SyncEntityFactory;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Maybe } from '@dereekb/util';
|
|
2
|
+
import { SyncEntityCommonType, SyncEntityCommonTypeIdPair } from './sync.entity';
|
|
3
|
+
import { SyncEntityCommonTypeSynchronizationEntityResult, SyncEntityCommonTypeSynchronizer, SyncEntityCommonTypeSynchronizerSourceContextType, SyncEntityCommonTypeSynchronizerSourceFlowType } from './sync.entity.synchronizer';
|
|
4
|
+
import { SyncSourceClientContext, SyncSourceId, SyncSourceInfo } from './sync.source';
|
|
5
|
+
/**
|
|
6
|
+
* BasicSyncEntityCommonTypeSynchronizerSourceSyncEntityFunction input
|
|
7
|
+
*/
|
|
8
|
+
export interface BasicSyncEntityCommonTypeSynchronizerSourceSyncEntityFunctionInput {
|
|
9
|
+
/**
|
|
10
|
+
* The entity to synchronize.
|
|
11
|
+
*/
|
|
12
|
+
readonly entityCommonTypeIdPair: SyncEntityCommonTypeIdPair;
|
|
13
|
+
/**
|
|
14
|
+
* The determined flow type of this source.
|
|
15
|
+
*/
|
|
16
|
+
readonly flowType: SyncEntityCommonTypeSynchronizerSourceFlowType;
|
|
17
|
+
/**
|
|
18
|
+
* The source for this entity.
|
|
19
|
+
*/
|
|
20
|
+
readonly source: BasicSyncEntityCommonTypeSynchronizerSource;
|
|
21
|
+
/**
|
|
22
|
+
* Additional context information.
|
|
23
|
+
*/
|
|
24
|
+
readonly context?: Maybe<BasicSyncEntityCommonTypeSynchronizerEntitySourceContext>;
|
|
25
|
+
}
|
|
26
|
+
export interface BasicSyncEntityCommonTypeSynchronizerSourceSyncEntitySynchronizeContext {
|
|
27
|
+
readonly deleted?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new BasicSyncEntityCommonTypeSynchronizerSourceSyncEntityInstance for the input.
|
|
31
|
+
*/
|
|
32
|
+
export type BasicSyncEntityCommonTypeSynchronizerSourceSyncEntityFunction = (input: BasicSyncEntityCommonTypeSynchronizerSourceSyncEntityFunctionInput) => Promise<BasicSyncEntityCommonTypeSynchronizerSourceSyncEntityInstance>;
|
|
33
|
+
export type BasicSyncEntityCommonTypeSynchronizerSourceSyncEntitySynchronizeFunction = () => Promise<SyncEntityCommonTypeSynchronizationEntityResult>;
|
|
34
|
+
export interface BasicSyncEntityCommonTypeSynchronizerSourceSyncEntityInstance {
|
|
35
|
+
/**
|
|
36
|
+
* Performs the create/update synchronization for the entity.
|
|
37
|
+
*
|
|
38
|
+
* The function should typically never throw an error.
|
|
39
|
+
*/
|
|
40
|
+
readonly synchronize: BasicSyncEntityCommonTypeSynchronizerSourceSyncEntitySynchronizeFunction;
|
|
41
|
+
/**
|
|
42
|
+
* Synchronizes the deletion of the entity.
|
|
43
|
+
*
|
|
44
|
+
* For a "primary" source, this is called only when another source suggests a delete.
|
|
45
|
+
*
|
|
46
|
+
* The function should typically never throw an error.
|
|
47
|
+
*/
|
|
48
|
+
readonly synchronizeDelete: BasicSyncEntityCommonTypeSynchronizerSourceSyncEntitySynchronizeFunction;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A declaration of a source for an entity type.
|
|
52
|
+
*
|
|
53
|
+
* A BasicSyncEntityCommonTypeSynchronizerSource is considered to be a target for synchronization between the current system/server and the SyncSource.
|
|
54
|
+
*/
|
|
55
|
+
export interface BasicSyncEntityCommonTypeSynchronizerSource {
|
|
56
|
+
readonly info: SyncSourceInfo;
|
|
57
|
+
/**
|
|
58
|
+
* The context type of the source.
|
|
59
|
+
*/
|
|
60
|
+
readonly contextType: SyncEntityCommonTypeSynchronizerSourceContextType;
|
|
61
|
+
/**
|
|
62
|
+
* The default flow type of the source.
|
|
63
|
+
*/
|
|
64
|
+
readonly defaultFlowType?: Maybe<SyncEntityCommonTypeSynchronizerSourceFlowType>;
|
|
65
|
+
readonly syncEntityInstance: BasicSyncEntityCommonTypeSynchronizerSourceSyncEntityFunction;
|
|
66
|
+
}
|
|
67
|
+
export type BasicSyncEntityCommonTypeSynchronizer = SyncEntityCommonTypeSynchronizer;
|
|
68
|
+
export interface BasicSyncEntityCommonTypeSynchronizerEntitySourceContextLoaderResult {
|
|
69
|
+
/**
|
|
70
|
+
* List of global sources for this entity.
|
|
71
|
+
*/
|
|
72
|
+
readonly globalSources: (SyncSourceId | BasicSyncEntityCommonTypeSynchronizerEntitySourceGlobalContext)[];
|
|
73
|
+
/**
|
|
74
|
+
* List of context sources for this entity.
|
|
75
|
+
*/
|
|
76
|
+
readonly contextSources: BasicSyncEntityCommonTypeSynchronizerEntitySourceContext[];
|
|
77
|
+
}
|
|
78
|
+
export interface BasicSyncEntityCommonTypeSynchronizerEntitySourceGlobalContext {
|
|
79
|
+
/**
|
|
80
|
+
* The source id.
|
|
81
|
+
*/
|
|
82
|
+
readonly sourceId: SyncSourceId;
|
|
83
|
+
/**
|
|
84
|
+
* The flow type of the source. If not defined, will default to the source's default flow type.
|
|
85
|
+
*/
|
|
86
|
+
readonly flowType?: Maybe<SyncEntityCommonTypeSynchronizerSourceFlowType>;
|
|
87
|
+
}
|
|
88
|
+
export interface BasicSyncEntityCommonTypeSynchronizerEntitySourceContext {
|
|
89
|
+
readonly sourceId: SyncSourceId;
|
|
90
|
+
readonly context: SyncSourceClientContext;
|
|
91
|
+
/**
|
|
92
|
+
* The flow type of the source. If not defined, will default to the source's default flow type.
|
|
93
|
+
*/
|
|
94
|
+
readonly flowType?: Maybe<SyncEntityCommonTypeSynchronizerSourceFlowType>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Loads source contextual information for a specific entity.
|
|
98
|
+
*/
|
|
99
|
+
export type BasicSyncEntityCommonTypeSynchronizerEntitySourceContextLoader = (entity: SyncEntityCommonTypeIdPair) => Promise<BasicSyncEntityCommonTypeSynchronizerEntitySourceContextLoaderResult>;
|
|
100
|
+
export interface BasicSyncEntityCommonTypeSynchronizerConfig {
|
|
101
|
+
readonly commonType: SyncEntityCommonType;
|
|
102
|
+
/**
|
|
103
|
+
* If true, the sources are considered to be dynamic and will be reloaded/configured each time the synchronizer is called.
|
|
104
|
+
*
|
|
105
|
+
* Defaults to false.
|
|
106
|
+
*/
|
|
107
|
+
readonly dynamicSources?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* All sources for this entity type for this synchronizer.
|
|
110
|
+
*/
|
|
111
|
+
readonly sources: BasicSyncEntityCommonTypeSynchronizerSource[];
|
|
112
|
+
/**
|
|
113
|
+
* Loads source contextual information for any source that requires context.
|
|
114
|
+
*/
|
|
115
|
+
readonly entitySourceContextLoader: BasicSyncEntityCommonTypeSynchronizerEntitySourceContextLoader;
|
|
116
|
+
}
|
|
117
|
+
export declare function basicSyncEntityCommonTypeSynchronizerInstanceFactory(config: BasicSyncEntityCommonTypeSynchronizerConfig): BasicSyncEntityCommonTypeSynchronizer;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { SyncEntity, SyncEntityCommonType, SyncEntityCommonTypeIdPair, SyncEntityCommonTypeIdPairFactoryInput } from './sync.entity';
|
|
2
|
+
import { Maybe } from '@dereekb/util';
|
|
3
|
+
/**
|
|
4
|
+
* The context type of source for an entity.
|
|
5
|
+
*
|
|
6
|
+
* - Global: The source is available to all contexts. Example: Configured API for the server.
|
|
7
|
+
* - Context: The source is only available to a specific context. Example: Configured per-user OAuth client for a specific user.
|
|
8
|
+
*/
|
|
9
|
+
export type SyncEntityCommonTypeSynchronizerSourceContextType = 'global' | 'context';
|
|
10
|
+
/**
|
|
11
|
+
* The flow type of source for an entity. These are used to determine the order of synchronization.
|
|
12
|
+
*
|
|
13
|
+
* - Primary: The general/primary source of truth for an entity. There should typically only be one primary source.
|
|
14
|
+
* When a primary source returns deleted, then all other sources will be notified for deletion.
|
|
15
|
+
*
|
|
16
|
+
* - Secondary: A secondary source for the entity that information can be pulled from and may be used to update the primary source.
|
|
17
|
+
* When a secondary source returns deleted, then the synchronization will be restarted so the primary source(s) will be synchronized again to confirm the deletion.
|
|
18
|
+
*
|
|
19
|
+
* - Replica: A replica of the primary source for the entity that is never used to update other sources.
|
|
20
|
+
* - Unset: The flow type is not set. This is only used when a source is not configured properly and will be ignored.
|
|
21
|
+
*/
|
|
22
|
+
export type SyncEntityCommonTypeSynchronizerSourceFlowType = 'primary' | 'secondary' | 'replica' | 'unset';
|
|
23
|
+
/**
|
|
24
|
+
* The base synchronizer for entities.
|
|
25
|
+
*/
|
|
26
|
+
export interface SyncEntitySynchronizer {
|
|
27
|
+
/**
|
|
28
|
+
* List of common types that can be synchronized by this synchronizer.
|
|
29
|
+
*/
|
|
30
|
+
readonly commonTypes: SyncEntityCommonType[];
|
|
31
|
+
/**
|
|
32
|
+
* Returns the synchronizer for the given common type.
|
|
33
|
+
*
|
|
34
|
+
* Throws an error if the common type is not registered.
|
|
35
|
+
*
|
|
36
|
+
* @param input The common type to synchronize.
|
|
37
|
+
* @returns The synchronizer for the common type.
|
|
38
|
+
*/
|
|
39
|
+
commonTypeSynchronizer(input: SyncEntityCommonType): SyncEntityCommonTypeSynchronizer;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new synchronizer instance for the input entity.
|
|
42
|
+
*
|
|
43
|
+
* Throws an error if the common type is not registered.
|
|
44
|
+
*
|
|
45
|
+
* @param input The common type and id of the entity to synchronize.
|
|
46
|
+
* @returns The synchronizer instance for the entity.
|
|
47
|
+
*/
|
|
48
|
+
synchronizeInstance(input: SyncEntityCommonTypeSynchronizerInstanceInput): Promise<SyncEntityCommonTypeSynchronizerInstance>;
|
|
49
|
+
}
|
|
50
|
+
export interface SyncEntitySynchronizerConfig {
|
|
51
|
+
readonly commonTypeSynchronizers: SyncEntityCommonTypeSynchronizer[];
|
|
52
|
+
}
|
|
53
|
+
export declare function syncEntitySynchronizer(config: SyncEntitySynchronizerConfig): SyncEntitySynchronizer;
|
|
54
|
+
export type SyncEntityCommonTypeSynchronizerInstanceInput = SyncEntityCommonTypeIdPairFactoryInput;
|
|
55
|
+
export type SyncEntityCommonTypeSynchronizerInstanceFunction = (input: SyncEntityCommonTypeSynchronizerInstanceInput) => Promise<SyncEntityCommonTypeSynchronizerInstance>;
|
|
56
|
+
/**
|
|
57
|
+
* Used for creating a new synchronization strategy for entities of a specific common type.
|
|
58
|
+
*/
|
|
59
|
+
export interface SyncEntityCommonTypeSynchronizer {
|
|
60
|
+
/**
|
|
61
|
+
* The common type for the entity.
|
|
62
|
+
*/
|
|
63
|
+
readonly commonType: SyncEntityCommonType;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a new synchronizer for the entity.
|
|
66
|
+
*
|
|
67
|
+
* @param input The common type and id of the entity to synchronize.
|
|
68
|
+
* @returns The synchronizer for the entity.
|
|
69
|
+
*/
|
|
70
|
+
readonly synchronizeInstance: SyncEntityCommonTypeSynchronizerInstanceFunction;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The result of synchronizing an entity.
|
|
74
|
+
*/
|
|
75
|
+
export interface SyncEntityCommonTypeSynchronizationResult {
|
|
76
|
+
readonly targetPair: SyncEntityCommonTypeIdPair;
|
|
77
|
+
readonly entitiesSynchronized: SyncEntityCommonTypeSynchronizationEntityResult[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The result of a synchronization. This return type/instance has different implications for different sources of different types.
|
|
81
|
+
*
|
|
82
|
+
* - nochange: The entity was unchanged.
|
|
83
|
+
* - synchronized: The entity was synchronized.
|
|
84
|
+
* - deleted: The entity was deleted or is already deleted. If this is a primary source then the entity will be deleted from all other sources. If this
|
|
85
|
+
* is a secondary source then the synchronization will be restarted so the primary source(s) will be resynchronized again.
|
|
86
|
+
* - failed: The entity was not synchronized due to a failure that was controlled. Unless this is a primary source, should not cancel the synchronization of other sources.
|
|
87
|
+
* - error: An unexpected error occurred during synchronization.
|
|
88
|
+
*/
|
|
89
|
+
export type SyncEntityCommonTypeSynchronizationEntityResultType = 'nochange' | 'synchronized' | 'deleted' | 'failed' | 'error';
|
|
90
|
+
/**
|
|
91
|
+
* Specific entity synchronization information within a SyncEntityCommonTypeSynchronizationResult.
|
|
92
|
+
*/
|
|
93
|
+
export interface SyncEntityCommonTypeSynchronizationEntityResult {
|
|
94
|
+
/**
|
|
95
|
+
* The entity that was synchronized.
|
|
96
|
+
*
|
|
97
|
+
* For results with the "error" result type, the actual id may not be provided or accurate.
|
|
98
|
+
*/
|
|
99
|
+
readonly entity: SyncEntity;
|
|
100
|
+
/**
|
|
101
|
+
* The type of result.
|
|
102
|
+
*/
|
|
103
|
+
readonly type: SyncEntityCommonTypeSynchronizationEntityResultType;
|
|
104
|
+
/**
|
|
105
|
+
* The error that occurred during synchronization, if one occured.
|
|
106
|
+
*/
|
|
107
|
+
readonly error?: Maybe<unknown>;
|
|
108
|
+
}
|
|
109
|
+
export interface SyncEntityCommonTypeSynchronizerFunctionContext {
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Performs the synchronization process for the given entity.
|
|
113
|
+
*
|
|
114
|
+
* @returns A promise that resolves when the synchronization is complete.
|
|
115
|
+
*/
|
|
116
|
+
export type SyncEntityCommonTypeSynchronizerFunction = (context?: Maybe<SyncEntityCommonTypeSynchronizerFunctionContext>) => Promise<SyncEntityCommonTypeSynchronizationResult>;
|
|
117
|
+
/**
|
|
118
|
+
* A concrete instance that refernces a specific entity to synchronize.
|
|
119
|
+
*/
|
|
120
|
+
export interface SyncEntityCommonTypeSynchronizerInstance {
|
|
121
|
+
readonly entityPair: SyncEntityCommonTypeIdPair;
|
|
122
|
+
/**
|
|
123
|
+
* Performs the synchronization process for the given entity.
|
|
124
|
+
*
|
|
125
|
+
* @returns A promise that resolves when the synchronization is complete.
|
|
126
|
+
*/
|
|
127
|
+
readonly synchronize: SyncEntityCommonTypeSynchronizerFunction;
|
|
128
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseError } from 'make-error';
|
|
2
|
+
import { SyncEntityCommonType, SyncEntityCommonTypeIdPair } from './sync.entity';
|
|
3
|
+
/**
|
|
4
|
+
* Error thrown when the common type is not known/registered.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UnregisteredSyncEntityCommonTypeError extends BaseError {
|
|
7
|
+
readonly commonType: SyncEntityCommonType;
|
|
8
|
+
constructor(commonType: SyncEntityCommonType);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Error thrown when no primary sync source is found for an entity.
|
|
12
|
+
*/
|
|
13
|
+
export declare class NoPrimarySyncSourceError extends BaseError {
|
|
14
|
+
readonly entity: SyncEntityCommonTypeIdPair;
|
|
15
|
+
constructor(entity: SyncEntityCommonTypeIdPair);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Error thrown when multiple primary sync sources are found for an entity.
|
|
19
|
+
*/
|
|
20
|
+
export declare class MultiplePrimarySyncSourceError extends BaseError {
|
|
21
|
+
readonly entity: SyncEntityCommonTypeIdPair;
|
|
22
|
+
constructor(entity: SyncEntityCommonTypeIdPair);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Error thrown when a synchronization fails for an entity.
|
|
26
|
+
*/
|
|
27
|
+
export declare class SynchronizationFailedError extends BaseError {
|
|
28
|
+
readonly entity: SyncEntityCommonTypeIdPair;
|
|
29
|
+
readonly error: unknown;
|
|
30
|
+
constructor(entity: SyncEntityCommonTypeIdPair, error: unknown);
|
|
31
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* English name for a SyncSource.
|
|
3
|
+
*
|
|
4
|
+
* Is not used as a key.
|
|
5
|
+
*/
|
|
6
|
+
export type SyncSourceName = string;
|
|
7
|
+
/**
|
|
8
|
+
* A unique identifier for a SyncSource.
|
|
9
|
+
*/
|
|
10
|
+
export type SyncSourceId = string;
|
|
11
|
+
/**
|
|
12
|
+
* Information for a SyncSource.
|
|
13
|
+
*/
|
|
14
|
+
export interface SyncSourceInfo {
|
|
15
|
+
readonly id: SyncSourceId;
|
|
16
|
+
readonly name: SyncSourceName;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A generic API/server that contains entities.
|
|
20
|
+
*/
|
|
21
|
+
export interface SyncSource {
|
|
22
|
+
readonly info: SyncSourceInfo;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Contextual information for a SyncSource.
|
|
26
|
+
*/
|
|
27
|
+
export interface SyncSourceClientContext {
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Details for a SyncSource for a specific context, such as an OAuth user/client.
|
|
31
|
+
*/
|
|
32
|
+
export interface SyncSourceClientDetails<T = unknown> {
|
|
33
|
+
readonly details: T;
|
|
34
|
+
}
|