@fluid-experimental/oldest-client-observer 2.0.0-dev-rc.3.0.0.254513 → 2.0.0-dev-rc.3.0.0.254866
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/dist/alpha.d.ts +17 -0
- package/dist/beta.d.ts +9 -0
- package/dist/public.d.ts +9 -0
- package/lib/alpha.d.ts +17 -0
- package/lib/beta.d.ts +9 -0
- package/lib/public.d.ts +9 -0
- package/package.json +14 -22
- package/api-extractor-cjs.json +0 -8
- package/dist/oldest-client-observer-alpha.d.ts +0 -111
- package/dist/oldest-client-observer-beta.d.ts +0 -17
- package/dist/oldest-client-observer-public.d.ts +0 -17
- package/dist/oldest-client-observer-untrimmed.d.ts +0 -111
- package/dist/tsdoc-metadata.json +0 -11
- package/lib/oldest-client-observer-alpha.d.ts +0 -111
- package/lib/oldest-client-observer-beta.d.ts +0 -17
- package/lib/oldest-client-observer-public.d.ts +0 -17
- package/lib/oldest-client-observer-untrimmed.d.ts +0 -111
package/dist/alpha.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
|
10
|
+
export {
|
|
11
|
+
// alpha APIs
|
|
12
|
+
IOldestClientObservable,
|
|
13
|
+
IOldestClientObservableEvents,
|
|
14
|
+
IOldestClientObserver,
|
|
15
|
+
IOldestClientObserverEvents,
|
|
16
|
+
OldestClientObserver
|
|
17
|
+
} from "./index.js";
|
package/dist/beta.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
package/dist/public.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
package/lib/alpha.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
|
10
|
+
export {
|
|
11
|
+
// alpha APIs
|
|
12
|
+
IOldestClientObservable,
|
|
13
|
+
IOldestClientObservableEvents,
|
|
14
|
+
IOldestClientObserver,
|
|
15
|
+
IOldestClientObserverEvents,
|
|
16
|
+
OldestClientObserver
|
|
17
|
+
} from "./index.js";
|
package/lib/beta.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
package/lib/public.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/oldest-client-observer",
|
|
3
|
-
"version": "2.0.0-dev-rc.3.0.0.
|
|
3
|
+
"version": "2.0.0-dev-rc.3.0.0.254866",
|
|
4
4
|
"description": "Data object to determine if the local client is the oldest amongst connected clients",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -15,21 +15,21 @@
|
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
17
|
"import": {
|
|
18
|
-
"types": "./lib/
|
|
18
|
+
"types": "./lib/public.d.ts",
|
|
19
19
|
"default": "./lib/index.js"
|
|
20
20
|
},
|
|
21
21
|
"require": {
|
|
22
|
-
"types": "./dist/
|
|
22
|
+
"types": "./dist/public.d.ts",
|
|
23
23
|
"default": "./dist/index.js"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"./alpha": {
|
|
27
27
|
"import": {
|
|
28
|
-
"types": "./lib/
|
|
28
|
+
"types": "./lib/alpha.d.ts",
|
|
29
29
|
"default": "./lib/index.js"
|
|
30
30
|
},
|
|
31
31
|
"require": {
|
|
32
|
-
"types": "./dist/
|
|
32
|
+
"types": "./dist/alpha.d.ts",
|
|
33
33
|
"default": "./dist/index.js"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"main": "dist/index.js",
|
|
48
|
-
"types": "./dist/
|
|
48
|
+
"types": "./dist/public.d.ts",
|
|
49
49
|
"c8": {
|
|
50
50
|
"all": true,
|
|
51
51
|
"cache-dir": "nyc/.cache",
|
|
@@ -67,16 +67,16 @@
|
|
|
67
67
|
"temp-directory": "nyc/.nyc_output"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@fluid-internal/client-utils": "2.0.0-dev-rc.3.0.0.
|
|
71
|
-
"@fluidframework/container-definitions": "2.0.0-dev-rc.3.0.0.
|
|
72
|
-
"@fluidframework/core-interfaces": "2.0.0-dev-rc.3.0.0.
|
|
73
|
-
"@fluidframework/core-utils": "2.0.0-dev-rc.3.0.0.
|
|
70
|
+
"@fluid-internal/client-utils": "2.0.0-dev-rc.3.0.0.254866",
|
|
71
|
+
"@fluidframework/container-definitions": "2.0.0-dev-rc.3.0.0.254866",
|
|
72
|
+
"@fluidframework/core-interfaces": "2.0.0-dev-rc.3.0.0.254866",
|
|
73
|
+
"@fluidframework/core-utils": "2.0.0-dev-rc.3.0.0.254866",
|
|
74
74
|
"@fluidframework/protocol-definitions": "^3.2.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
78
78
|
"@biomejs/biome": "^1.6.2",
|
|
79
|
-
"@fluid-private/test-dds-utils": "2.0.0-dev-rc.3.0.0.
|
|
79
|
+
"@fluid-private/test-dds-utils": "2.0.0-dev-rc.3.0.0.254866",
|
|
80
80
|
"@fluid-tools/build-cli": "^0.35.0",
|
|
81
81
|
"@fluidframework/build-common": "^2.0.3",
|
|
82
82
|
"@fluidframework/build-tools": "^0.35.0",
|
|
@@ -92,14 +92,6 @@
|
|
|
92
92
|
},
|
|
93
93
|
"fluidBuild": {
|
|
94
94
|
"tasks": {
|
|
95
|
-
"build:docs": {
|
|
96
|
-
"dependsOn": [
|
|
97
|
-
"...",
|
|
98
|
-
"api-extractor:commonjs",
|
|
99
|
-
"api-extractor:esnext"
|
|
100
|
-
],
|
|
101
|
-
"script": false
|
|
102
|
-
},
|
|
103
95
|
"tsc": [
|
|
104
96
|
"...",
|
|
105
97
|
"typetests:gen"
|
|
@@ -112,12 +104,12 @@
|
|
|
112
104
|
},
|
|
113
105
|
"scripts": {
|
|
114
106
|
"api": "fluid-build . --task api",
|
|
115
|
-
"api-extractor:commonjs": "
|
|
116
|
-
"api-extractor:esnext": "
|
|
107
|
+
"api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
|
|
108
|
+
"api-extractor:esnext": "flub generate entrypoints --outDir ./lib",
|
|
117
109
|
"build": "fluid-build . --task build",
|
|
118
110
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
119
111
|
"build:compile": "fluid-build . --task compile",
|
|
120
|
-
"build:docs": "
|
|
112
|
+
"build:docs": "api-extractor run --local",
|
|
121
113
|
"build:esnext": "tsc --project ./tsconfig.json",
|
|
122
114
|
"check:are-the-types-wrong": "attw --pack . --entrypoints .",
|
|
123
115
|
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
package/api-extractor-cjs.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
|
|
4
|
-
// CJS is actually secondary; so, no report.
|
|
5
|
-
"apiReport": {
|
|
6
|
-
"enabled": false
|
|
7
|
-
}
|
|
8
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { AttachState } from '@fluidframework/container-definitions';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IQuorumClients } from '@fluidframework/protocol-definitions';
|
|
5
|
-
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This is to make OldestClientObserver work with either a ContainerRuntime or an IFluidDataStoreRuntime
|
|
9
|
-
* (both expose the relevant API surface and eventing). However, really this info probably shouldn't live on either,
|
|
10
|
-
* since neither is really the source of truth (they are just the only currently-available plumbing options).
|
|
11
|
-
* It's information about the connection, so the real source of truth is lower (at the connection layer).
|
|
12
|
-
* @alpha
|
|
13
|
-
*/
|
|
14
|
-
export declare interface IOldestClientObservable extends IEventProvider<IOldestClientObservableEvents> {
|
|
15
|
-
getQuorum(): IQuorumClients;
|
|
16
|
-
attachState: AttachState;
|
|
17
|
-
connected: boolean;
|
|
18
|
-
clientId: string | undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Events emitted by {@link IOldestClientObservable}.
|
|
23
|
-
* @alpha
|
|
24
|
-
*/
|
|
25
|
-
export declare interface IOldestClientObservableEvents extends IEvent {
|
|
26
|
-
(event: "connected", listener: () => void): any;
|
|
27
|
-
(event: "disconnected", listener: () => void): any;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @alpha
|
|
32
|
-
*/
|
|
33
|
-
export declare interface IOldestClientObserver extends IEventProvider<IOldestClientObserverEvents> {
|
|
34
|
-
isOldest(): boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Events emitted by {@link IOldestClientObservable}.
|
|
39
|
-
* @alpha
|
|
40
|
-
*/
|
|
41
|
-
export declare interface IOldestClientObserverEvents extends IEvent {
|
|
42
|
-
(event: "becameOldest" | "lostOldest", listener: () => void): any;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The `OldestClientObserver` is a utility inspect if the local client is the oldest amongst connected clients (in
|
|
47
|
-
* terms of when they connected) and watch for changes.
|
|
48
|
-
*
|
|
49
|
-
* It is still experimental and under development. Please do try it out, but expect breaking changes in the future.
|
|
50
|
-
*
|
|
51
|
-
* @remarks
|
|
52
|
-
* ### Creation
|
|
53
|
-
*
|
|
54
|
-
* The `OldestClientObserver` constructor takes an `IOldestClientObservable`. This is most easily satisfied with
|
|
55
|
-
* either an `IContainerRuntime` or an `IFluidDataStoreRuntime`:
|
|
56
|
-
*
|
|
57
|
-
* ```typescript
|
|
58
|
-
* // E.g. from within a BaseContainerRuntimeFactory:
|
|
59
|
-
* protected async containerHasInitialized(runtime: IContainerRuntime) {
|
|
60
|
-
* const oldestClientObserver = new OldestClientObserver(runtime);
|
|
61
|
-
* // ...
|
|
62
|
-
* }
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* ```typescript
|
|
66
|
-
* // From within a DataObject
|
|
67
|
-
* protected async hasInitialized() {
|
|
68
|
-
* const oldestClientObserver = new OldestClientObserver(this.runtime);
|
|
69
|
-
* // ...
|
|
70
|
-
* }
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* ### Usage
|
|
74
|
-
*
|
|
75
|
-
* To check if the local client is the oldest, use the `isOldest()` method.
|
|
76
|
-
*
|
|
77
|
-
* ```typescript
|
|
78
|
-
* if (oldestClientObserver.isOldest()) {
|
|
79
|
-
* console.log("I'm the oldest");
|
|
80
|
-
* } else {
|
|
81
|
-
* console.log("Someone else is older");
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* ### Eventing
|
|
86
|
-
*
|
|
87
|
-
* `OldestClientObserver` is an `EventEmitter`, and will emit events when the local client becomes the oldest and when
|
|
88
|
-
* it is no longer the oldest.
|
|
89
|
-
*
|
|
90
|
-
* ```typescript
|
|
91
|
-
* oldestClientObserver.on("becameOldest", () => {
|
|
92
|
-
* console.log("I'm the oldest now");
|
|
93
|
-
* });
|
|
94
|
-
*
|
|
95
|
-
* oldestClientObserver.on("lostOldest", () => {
|
|
96
|
-
* console.log("I'm not the oldest anymore");
|
|
97
|
-
* });
|
|
98
|
-
* ```
|
|
99
|
-
* @alpha
|
|
100
|
-
*/
|
|
101
|
-
export declare class OldestClientObserver extends TypedEventEmitter<IOldestClientObserverEvents> implements IOldestClientObserver {
|
|
102
|
-
private readonly observable;
|
|
103
|
-
private readonly quorum;
|
|
104
|
-
private currentIsOldest;
|
|
105
|
-
constructor(observable: IOldestClientObservable);
|
|
106
|
-
isOldest(): boolean;
|
|
107
|
-
private readonly updateOldest;
|
|
108
|
-
private computeIsOldest;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export { }
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AttachState } from '@fluidframework/container-definitions';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IQuorumClients } from '@fluidframework/protocol-definitions';
|
|
5
|
-
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
6
|
-
|
|
7
|
-
/* Excluded from this release type: IOldestClientObservable */
|
|
8
|
-
|
|
9
|
-
/* Excluded from this release type: IOldestClientObservableEvents */
|
|
10
|
-
|
|
11
|
-
/* Excluded from this release type: IOldestClientObserver */
|
|
12
|
-
|
|
13
|
-
/* Excluded from this release type: IOldestClientObserverEvents */
|
|
14
|
-
|
|
15
|
-
/* Excluded from this release type: OldestClientObserver */
|
|
16
|
-
|
|
17
|
-
export { }
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AttachState } from '@fluidframework/container-definitions';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IQuorumClients } from '@fluidframework/protocol-definitions';
|
|
5
|
-
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
6
|
-
|
|
7
|
-
/* Excluded from this release type: IOldestClientObservable */
|
|
8
|
-
|
|
9
|
-
/* Excluded from this release type: IOldestClientObservableEvents */
|
|
10
|
-
|
|
11
|
-
/* Excluded from this release type: IOldestClientObserver */
|
|
12
|
-
|
|
13
|
-
/* Excluded from this release type: IOldestClientObserverEvents */
|
|
14
|
-
|
|
15
|
-
/* Excluded from this release type: OldestClientObserver */
|
|
16
|
-
|
|
17
|
-
export { }
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { AttachState } from '@fluidframework/container-definitions';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IQuorumClients } from '@fluidframework/protocol-definitions';
|
|
5
|
-
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This is to make OldestClientObserver work with either a ContainerRuntime or an IFluidDataStoreRuntime
|
|
9
|
-
* (both expose the relevant API surface and eventing). However, really this info probably shouldn't live on either,
|
|
10
|
-
* since neither is really the source of truth (they are just the only currently-available plumbing options).
|
|
11
|
-
* It's information about the connection, so the real source of truth is lower (at the connection layer).
|
|
12
|
-
* @alpha
|
|
13
|
-
*/
|
|
14
|
-
export declare interface IOldestClientObservable extends IEventProvider<IOldestClientObservableEvents> {
|
|
15
|
-
getQuorum(): IQuorumClients;
|
|
16
|
-
attachState: AttachState;
|
|
17
|
-
connected: boolean;
|
|
18
|
-
clientId: string | undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Events emitted by {@link IOldestClientObservable}.
|
|
23
|
-
* @alpha
|
|
24
|
-
*/
|
|
25
|
-
export declare interface IOldestClientObservableEvents extends IEvent {
|
|
26
|
-
(event: "connected", listener: () => void): any;
|
|
27
|
-
(event: "disconnected", listener: () => void): any;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @alpha
|
|
32
|
-
*/
|
|
33
|
-
export declare interface IOldestClientObserver extends IEventProvider<IOldestClientObserverEvents> {
|
|
34
|
-
isOldest(): boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Events emitted by {@link IOldestClientObservable}.
|
|
39
|
-
* @alpha
|
|
40
|
-
*/
|
|
41
|
-
export declare interface IOldestClientObserverEvents extends IEvent {
|
|
42
|
-
(event: "becameOldest" | "lostOldest", listener: () => void): any;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The `OldestClientObserver` is a utility inspect if the local client is the oldest amongst connected clients (in
|
|
47
|
-
* terms of when they connected) and watch for changes.
|
|
48
|
-
*
|
|
49
|
-
* It is still experimental and under development. Please do try it out, but expect breaking changes in the future.
|
|
50
|
-
*
|
|
51
|
-
* @remarks
|
|
52
|
-
* ### Creation
|
|
53
|
-
*
|
|
54
|
-
* The `OldestClientObserver` constructor takes an `IOldestClientObservable`. This is most easily satisfied with
|
|
55
|
-
* either an `IContainerRuntime` or an `IFluidDataStoreRuntime`:
|
|
56
|
-
*
|
|
57
|
-
* ```typescript
|
|
58
|
-
* // E.g. from within a BaseContainerRuntimeFactory:
|
|
59
|
-
* protected async containerHasInitialized(runtime: IContainerRuntime) {
|
|
60
|
-
* const oldestClientObserver = new OldestClientObserver(runtime);
|
|
61
|
-
* // ...
|
|
62
|
-
* }
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* ```typescript
|
|
66
|
-
* // From within a DataObject
|
|
67
|
-
* protected async hasInitialized() {
|
|
68
|
-
* const oldestClientObserver = new OldestClientObserver(this.runtime);
|
|
69
|
-
* // ...
|
|
70
|
-
* }
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* ### Usage
|
|
74
|
-
*
|
|
75
|
-
* To check if the local client is the oldest, use the `isOldest()` method.
|
|
76
|
-
*
|
|
77
|
-
* ```typescript
|
|
78
|
-
* if (oldestClientObserver.isOldest()) {
|
|
79
|
-
* console.log("I'm the oldest");
|
|
80
|
-
* } else {
|
|
81
|
-
* console.log("Someone else is older");
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* ### Eventing
|
|
86
|
-
*
|
|
87
|
-
* `OldestClientObserver` is an `EventEmitter`, and will emit events when the local client becomes the oldest and when
|
|
88
|
-
* it is no longer the oldest.
|
|
89
|
-
*
|
|
90
|
-
* ```typescript
|
|
91
|
-
* oldestClientObserver.on("becameOldest", () => {
|
|
92
|
-
* console.log("I'm the oldest now");
|
|
93
|
-
* });
|
|
94
|
-
*
|
|
95
|
-
* oldestClientObserver.on("lostOldest", () => {
|
|
96
|
-
* console.log("I'm not the oldest anymore");
|
|
97
|
-
* });
|
|
98
|
-
* ```
|
|
99
|
-
* @alpha
|
|
100
|
-
*/
|
|
101
|
-
export declare class OldestClientObserver extends TypedEventEmitter<IOldestClientObserverEvents> implements IOldestClientObserver {
|
|
102
|
-
private readonly observable;
|
|
103
|
-
private readonly quorum;
|
|
104
|
-
private currentIsOldest;
|
|
105
|
-
constructor(observable: IOldestClientObservable);
|
|
106
|
-
isOldest(): boolean;
|
|
107
|
-
private readonly updateOldest;
|
|
108
|
-
private computeIsOldest;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export { }
|
package/dist/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.42.3"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { AttachState } from '@fluidframework/container-definitions';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IQuorumClients } from '@fluidframework/protocol-definitions';
|
|
5
|
-
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This is to make OldestClientObserver work with either a ContainerRuntime or an IFluidDataStoreRuntime
|
|
9
|
-
* (both expose the relevant API surface and eventing). However, really this info probably shouldn't live on either,
|
|
10
|
-
* since neither is really the source of truth (they are just the only currently-available plumbing options).
|
|
11
|
-
* It's information about the connection, so the real source of truth is lower (at the connection layer).
|
|
12
|
-
* @alpha
|
|
13
|
-
*/
|
|
14
|
-
export declare interface IOldestClientObservable extends IEventProvider<IOldestClientObservableEvents> {
|
|
15
|
-
getQuorum(): IQuorumClients;
|
|
16
|
-
attachState: AttachState;
|
|
17
|
-
connected: boolean;
|
|
18
|
-
clientId: string | undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Events emitted by {@link IOldestClientObservable}.
|
|
23
|
-
* @alpha
|
|
24
|
-
*/
|
|
25
|
-
export declare interface IOldestClientObservableEvents extends IEvent {
|
|
26
|
-
(event: "connected", listener: () => void): any;
|
|
27
|
-
(event: "disconnected", listener: () => void): any;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @alpha
|
|
32
|
-
*/
|
|
33
|
-
export declare interface IOldestClientObserver extends IEventProvider<IOldestClientObserverEvents> {
|
|
34
|
-
isOldest(): boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Events emitted by {@link IOldestClientObservable}.
|
|
39
|
-
* @alpha
|
|
40
|
-
*/
|
|
41
|
-
export declare interface IOldestClientObserverEvents extends IEvent {
|
|
42
|
-
(event: "becameOldest" | "lostOldest", listener: () => void): any;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The `OldestClientObserver` is a utility inspect if the local client is the oldest amongst connected clients (in
|
|
47
|
-
* terms of when they connected) and watch for changes.
|
|
48
|
-
*
|
|
49
|
-
* It is still experimental and under development. Please do try it out, but expect breaking changes in the future.
|
|
50
|
-
*
|
|
51
|
-
* @remarks
|
|
52
|
-
* ### Creation
|
|
53
|
-
*
|
|
54
|
-
* The `OldestClientObserver` constructor takes an `IOldestClientObservable`. This is most easily satisfied with
|
|
55
|
-
* either an `IContainerRuntime` or an `IFluidDataStoreRuntime`:
|
|
56
|
-
*
|
|
57
|
-
* ```typescript
|
|
58
|
-
* // E.g. from within a BaseContainerRuntimeFactory:
|
|
59
|
-
* protected async containerHasInitialized(runtime: IContainerRuntime) {
|
|
60
|
-
* const oldestClientObserver = new OldestClientObserver(runtime);
|
|
61
|
-
* // ...
|
|
62
|
-
* }
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* ```typescript
|
|
66
|
-
* // From within a DataObject
|
|
67
|
-
* protected async hasInitialized() {
|
|
68
|
-
* const oldestClientObserver = new OldestClientObserver(this.runtime);
|
|
69
|
-
* // ...
|
|
70
|
-
* }
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* ### Usage
|
|
74
|
-
*
|
|
75
|
-
* To check if the local client is the oldest, use the `isOldest()` method.
|
|
76
|
-
*
|
|
77
|
-
* ```typescript
|
|
78
|
-
* if (oldestClientObserver.isOldest()) {
|
|
79
|
-
* console.log("I'm the oldest");
|
|
80
|
-
* } else {
|
|
81
|
-
* console.log("Someone else is older");
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* ### Eventing
|
|
86
|
-
*
|
|
87
|
-
* `OldestClientObserver` is an `EventEmitter`, and will emit events when the local client becomes the oldest and when
|
|
88
|
-
* it is no longer the oldest.
|
|
89
|
-
*
|
|
90
|
-
* ```typescript
|
|
91
|
-
* oldestClientObserver.on("becameOldest", () => {
|
|
92
|
-
* console.log("I'm the oldest now");
|
|
93
|
-
* });
|
|
94
|
-
*
|
|
95
|
-
* oldestClientObserver.on("lostOldest", () => {
|
|
96
|
-
* console.log("I'm not the oldest anymore");
|
|
97
|
-
* });
|
|
98
|
-
* ```
|
|
99
|
-
* @alpha
|
|
100
|
-
*/
|
|
101
|
-
export declare class OldestClientObserver extends TypedEventEmitter<IOldestClientObserverEvents> implements IOldestClientObserver {
|
|
102
|
-
private readonly observable;
|
|
103
|
-
private readonly quorum;
|
|
104
|
-
private currentIsOldest;
|
|
105
|
-
constructor(observable: IOldestClientObservable);
|
|
106
|
-
isOldest(): boolean;
|
|
107
|
-
private readonly updateOldest;
|
|
108
|
-
private computeIsOldest;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export { }
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AttachState } from '@fluidframework/container-definitions';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IQuorumClients } from '@fluidframework/protocol-definitions';
|
|
5
|
-
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
6
|
-
|
|
7
|
-
/* Excluded from this release type: IOldestClientObservable */
|
|
8
|
-
|
|
9
|
-
/* Excluded from this release type: IOldestClientObservableEvents */
|
|
10
|
-
|
|
11
|
-
/* Excluded from this release type: IOldestClientObserver */
|
|
12
|
-
|
|
13
|
-
/* Excluded from this release type: IOldestClientObserverEvents */
|
|
14
|
-
|
|
15
|
-
/* Excluded from this release type: OldestClientObserver */
|
|
16
|
-
|
|
17
|
-
export { }
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AttachState } from '@fluidframework/container-definitions';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IQuorumClients } from '@fluidframework/protocol-definitions';
|
|
5
|
-
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
6
|
-
|
|
7
|
-
/* Excluded from this release type: IOldestClientObservable */
|
|
8
|
-
|
|
9
|
-
/* Excluded from this release type: IOldestClientObservableEvents */
|
|
10
|
-
|
|
11
|
-
/* Excluded from this release type: IOldestClientObserver */
|
|
12
|
-
|
|
13
|
-
/* Excluded from this release type: IOldestClientObserverEvents */
|
|
14
|
-
|
|
15
|
-
/* Excluded from this release type: OldestClientObserver */
|
|
16
|
-
|
|
17
|
-
export { }
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { AttachState } from '@fluidframework/container-definitions';
|
|
2
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IQuorumClients } from '@fluidframework/protocol-definitions';
|
|
5
|
-
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This is to make OldestClientObserver work with either a ContainerRuntime or an IFluidDataStoreRuntime
|
|
9
|
-
* (both expose the relevant API surface and eventing). However, really this info probably shouldn't live on either,
|
|
10
|
-
* since neither is really the source of truth (they are just the only currently-available plumbing options).
|
|
11
|
-
* It's information about the connection, so the real source of truth is lower (at the connection layer).
|
|
12
|
-
* @alpha
|
|
13
|
-
*/
|
|
14
|
-
export declare interface IOldestClientObservable extends IEventProvider<IOldestClientObservableEvents> {
|
|
15
|
-
getQuorum(): IQuorumClients;
|
|
16
|
-
attachState: AttachState;
|
|
17
|
-
connected: boolean;
|
|
18
|
-
clientId: string | undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Events emitted by {@link IOldestClientObservable}.
|
|
23
|
-
* @alpha
|
|
24
|
-
*/
|
|
25
|
-
export declare interface IOldestClientObservableEvents extends IEvent {
|
|
26
|
-
(event: "connected", listener: () => void): any;
|
|
27
|
-
(event: "disconnected", listener: () => void): any;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @alpha
|
|
32
|
-
*/
|
|
33
|
-
export declare interface IOldestClientObserver extends IEventProvider<IOldestClientObserverEvents> {
|
|
34
|
-
isOldest(): boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Events emitted by {@link IOldestClientObservable}.
|
|
39
|
-
* @alpha
|
|
40
|
-
*/
|
|
41
|
-
export declare interface IOldestClientObserverEvents extends IEvent {
|
|
42
|
-
(event: "becameOldest" | "lostOldest", listener: () => void): any;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The `OldestClientObserver` is a utility inspect if the local client is the oldest amongst connected clients (in
|
|
47
|
-
* terms of when they connected) and watch for changes.
|
|
48
|
-
*
|
|
49
|
-
* It is still experimental and under development. Please do try it out, but expect breaking changes in the future.
|
|
50
|
-
*
|
|
51
|
-
* @remarks
|
|
52
|
-
* ### Creation
|
|
53
|
-
*
|
|
54
|
-
* The `OldestClientObserver` constructor takes an `IOldestClientObservable`. This is most easily satisfied with
|
|
55
|
-
* either an `IContainerRuntime` or an `IFluidDataStoreRuntime`:
|
|
56
|
-
*
|
|
57
|
-
* ```typescript
|
|
58
|
-
* // E.g. from within a BaseContainerRuntimeFactory:
|
|
59
|
-
* protected async containerHasInitialized(runtime: IContainerRuntime) {
|
|
60
|
-
* const oldestClientObserver = new OldestClientObserver(runtime);
|
|
61
|
-
* // ...
|
|
62
|
-
* }
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* ```typescript
|
|
66
|
-
* // From within a DataObject
|
|
67
|
-
* protected async hasInitialized() {
|
|
68
|
-
* const oldestClientObserver = new OldestClientObserver(this.runtime);
|
|
69
|
-
* // ...
|
|
70
|
-
* }
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* ### Usage
|
|
74
|
-
*
|
|
75
|
-
* To check if the local client is the oldest, use the `isOldest()` method.
|
|
76
|
-
*
|
|
77
|
-
* ```typescript
|
|
78
|
-
* if (oldestClientObserver.isOldest()) {
|
|
79
|
-
* console.log("I'm the oldest");
|
|
80
|
-
* } else {
|
|
81
|
-
* console.log("Someone else is older");
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* ### Eventing
|
|
86
|
-
*
|
|
87
|
-
* `OldestClientObserver` is an `EventEmitter`, and will emit events when the local client becomes the oldest and when
|
|
88
|
-
* it is no longer the oldest.
|
|
89
|
-
*
|
|
90
|
-
* ```typescript
|
|
91
|
-
* oldestClientObserver.on("becameOldest", () => {
|
|
92
|
-
* console.log("I'm the oldest now");
|
|
93
|
-
* });
|
|
94
|
-
*
|
|
95
|
-
* oldestClientObserver.on("lostOldest", () => {
|
|
96
|
-
* console.log("I'm not the oldest anymore");
|
|
97
|
-
* });
|
|
98
|
-
* ```
|
|
99
|
-
* @alpha
|
|
100
|
-
*/
|
|
101
|
-
export declare class OldestClientObserver extends TypedEventEmitter<IOldestClientObserverEvents> implements IOldestClientObserver {
|
|
102
|
-
private readonly observable;
|
|
103
|
-
private readonly quorum;
|
|
104
|
-
private currentIsOldest;
|
|
105
|
-
constructor(observable: IOldestClientObservable);
|
|
106
|
-
isOldest(): boolean;
|
|
107
|
-
private readonly updateOldest;
|
|
108
|
-
private computeIsOldest;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export { }
|