@fluid-experimental/oldest-client-observer 2.0.0-dev-rc.1.0.0.224419
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/.eslintrc.js +11 -0
- package/CHANGELOG.md +144 -0
- package/LICENSE +21 -0
- package/README.md +39 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +4 -0
- package/api-report/oldest-client-observer.api.md +54 -0
- package/dist/index.cjs +10 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/interfaces.cjs +7 -0
- package/dist/interfaces.cjs.map +1 -0
- package/dist/interfaces.d.ts +42 -0
- package/dist/interfaces.d.ts.map +1 -0
- package/dist/oldest-client-observer-alpha.d.ts +111 -0
- package/dist/oldest-client-observer-beta.d.ts +17 -0
- package/dist/oldest-client-observer-public.d.ts +17 -0
- package/dist/oldest-client-observer-untrimmed.d.ts +111 -0
- package/dist/oldestClientObserver.cjs +123 -0
- package/dist/oldestClientObserver.cjs.map +1 -0
- package/dist/oldestClientObserver.d.ts +72 -0
- package/dist/oldestClientObserver.d.ts.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/index.d.mts +7 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +6 -0
- package/lib/index.mjs.map +1 -0
- package/lib/interfaces.d.mts +42 -0
- package/lib/interfaces.d.mts.map +1 -0
- package/lib/interfaces.mjs +6 -0
- package/lib/interfaces.mjs.map +1 -0
- package/lib/oldest-client-observer-alpha.d.mts +111 -0
- package/lib/oldest-client-observer-beta.d.mts +17 -0
- package/lib/oldest-client-observer-public.d.mts +17 -0
- package/lib/oldest-client-observer-untrimmed.d.mts +111 -0
- package/lib/oldestClientObserver.d.mts +72 -0
- package/lib/oldestClientObserver.d.mts.map +1 -0
- package/lib/oldestClientObserver.mjs +119 -0
- package/lib/oldestClientObserver.mjs.map +1 -0
- package/package.json +120 -0
- package/prettier.config.cjs +8 -0
- package/src/index.ts +12 -0
- package/src/interfaces.ts +51 -0
- package/src/oldestClientObserver.ts +138 -0
- package/tsconfig.json +12 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"],
|
|
8
|
+
parserOptions: {
|
|
9
|
+
project: "./tsconfig.json",
|
|
10
|
+
},
|
|
11
|
+
};
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# @fluid-experimental/oldest-client-observer
|
|
2
|
+
|
|
3
|
+
## 2.0.0-internal.8.0.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
7
|
+
## 2.0.0-internal.7.4.0
|
|
8
|
+
|
|
9
|
+
Dependency updates only.
|
|
10
|
+
|
|
11
|
+
## 2.0.0-internal.7.3.0
|
|
12
|
+
|
|
13
|
+
Dependency updates only.
|
|
14
|
+
|
|
15
|
+
## 2.0.0-internal.7.2.0
|
|
16
|
+
|
|
17
|
+
Dependency updates only.
|
|
18
|
+
|
|
19
|
+
## 2.0.0-internal.7.1.0
|
|
20
|
+
|
|
21
|
+
Dependency updates only.
|
|
22
|
+
|
|
23
|
+
## 2.0.0-internal.7.0.0
|
|
24
|
+
|
|
25
|
+
### Major Changes
|
|
26
|
+
|
|
27
|
+
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
28
|
+
|
|
29
|
+
This included the following changes from the protocol-definitions release:
|
|
30
|
+
|
|
31
|
+
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
32
|
+
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
33
|
+
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
34
|
+
been added, which will be the typing for signals sent from the client to the server. Both extend a new
|
|
35
|
+
ISignalMessageBase interface that contains common members.
|
|
36
|
+
- The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
|
|
37
|
+
|
|
38
|
+
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
39
|
+
|
|
40
|
+
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
41
|
+
|
|
42
|
+
- @fluidframework/gitresources: 2.0.1
|
|
43
|
+
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
44
|
+
- @fluidframework/server-lambdas: 2.0.1
|
|
45
|
+
- @fluidframework/server-lambdas-driver: 2.0.1
|
|
46
|
+
- @fluidframework/server-local-server: 2.0.1
|
|
47
|
+
- @fluidframework/server-memory-orderer: 2.0.1
|
|
48
|
+
- @fluidframework/protocol-base: 2.0.1
|
|
49
|
+
- @fluidframework/server-routerlicious: 2.0.1
|
|
50
|
+
- @fluidframework/server-routerlicious-base: 2.0.1
|
|
51
|
+
- @fluidframework/server-services: 2.0.1
|
|
52
|
+
- @fluidframework/server-services-client: 2.0.1
|
|
53
|
+
- @fluidframework/server-services-core: 2.0.1
|
|
54
|
+
- @fluidframework/server-services-ordering-kafkanode: 2.0.1
|
|
55
|
+
- @fluidframework/server-services-ordering-rdkafka: 2.0.1
|
|
56
|
+
- @fluidframework/server-services-ordering-zookeeper: 2.0.1
|
|
57
|
+
- @fluidframework/server-services-shared: 2.0.1
|
|
58
|
+
- @fluidframework/server-services-telemetry: 2.0.1
|
|
59
|
+
- @fluidframework/server-services-utils: 2.0.1
|
|
60
|
+
- @fluidframework/server-test-utils: 2.0.1
|
|
61
|
+
- tinylicious: 2.0.1
|
|
62
|
+
|
|
63
|
+
- Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
64
|
+
|
|
65
|
+
The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
|
|
66
|
+
|
|
67
|
+
## 2.0.0-internal.6.4.0
|
|
68
|
+
|
|
69
|
+
Dependency updates only.
|
|
70
|
+
|
|
71
|
+
## 2.0.0-internal.6.3.0
|
|
72
|
+
|
|
73
|
+
Dependency updates only.
|
|
74
|
+
|
|
75
|
+
## 2.0.0-internal.6.2.0
|
|
76
|
+
|
|
77
|
+
### Minor Changes
|
|
78
|
+
|
|
79
|
+
- Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
|
|
80
|
+
|
|
81
|
+
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
82
|
+
imported from the **@fluidframework/core-interfaces** package:
|
|
83
|
+
|
|
84
|
+
- interface IDisposable
|
|
85
|
+
- interface IErrorEvent
|
|
86
|
+
- interface IErrorEvent
|
|
87
|
+
- interface IEvent
|
|
88
|
+
- interface IEventProvider
|
|
89
|
+
- interface ILoggingError
|
|
90
|
+
- interface ITaggedTelemetryPropertyType
|
|
91
|
+
- interface ITelemetryBaseEvent
|
|
92
|
+
- interface ITelemetryBaseLogger
|
|
93
|
+
- interface ITelemetryErrorEvent
|
|
94
|
+
- interface ITelemetryGenericEvent
|
|
95
|
+
- interface ITelemetryLogger
|
|
96
|
+
- interface ITelemetryPerformanceEvent
|
|
97
|
+
- interface ITelemetryProperties
|
|
98
|
+
- type ExtendEventProvider
|
|
99
|
+
- type IEventThisPlaceHolder
|
|
100
|
+
- type IEventTransformer
|
|
101
|
+
- type ReplaceIEventThisPlaceHolder
|
|
102
|
+
- type ReplaceIEventThisPlaceHolder
|
|
103
|
+
- type TelemetryEventCategory
|
|
104
|
+
- type TelemetryEventPropertyType
|
|
105
|
+
|
|
106
|
+
## 2.0.0-internal.6.1.0
|
|
107
|
+
|
|
108
|
+
Dependency updates only.
|
|
109
|
+
|
|
110
|
+
## 2.0.0-internal.6.0.0
|
|
111
|
+
|
|
112
|
+
### Major Changes
|
|
113
|
+
|
|
114
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
115
|
+
|
|
116
|
+
Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
|
|
117
|
+
|
|
118
|
+
## 2.0.0-internal.5.4.0
|
|
119
|
+
|
|
120
|
+
Dependency updates only.
|
|
121
|
+
|
|
122
|
+
## 2.0.0-internal.5.3.0
|
|
123
|
+
|
|
124
|
+
Dependency updates only.
|
|
125
|
+
|
|
126
|
+
## 2.0.0-internal.5.2.0
|
|
127
|
+
|
|
128
|
+
Dependency updates only.
|
|
129
|
+
|
|
130
|
+
## 2.0.0-internal.5.1.0
|
|
131
|
+
|
|
132
|
+
Dependency updates only.
|
|
133
|
+
|
|
134
|
+
## 2.0.0-internal.5.0.0
|
|
135
|
+
|
|
136
|
+
Dependency updates only.
|
|
137
|
+
|
|
138
|
+
## 2.0.0-internal.4.4.0
|
|
139
|
+
|
|
140
|
+
Dependency updates only.
|
|
141
|
+
|
|
142
|
+
## 2.0.0-internal.4.1.0
|
|
143
|
+
|
|
144
|
+
Dependency updates only.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @fluid-experimental/oldest-client-observer
|
|
2
|
+
|
|
3
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_DEPENDENCY_GUIDELINES_SECTION:includeHeading=TRUE) -->
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore-start -->
|
|
6
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
7
|
+
|
|
8
|
+
## Using Fluid Framework libraries
|
|
9
|
+
|
|
10
|
+
When taking a dependency on a Fluid Framework library, we recommend using a `^` (caret) version range, such as `^1.3.4`.
|
|
11
|
+
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
12
|
+
library consumers should always prefer `^`.
|
|
13
|
+
|
|
14
|
+
Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
|
|
15
|
+
you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
|
|
16
|
+
Standard `^` and `~` ranges will not work as expected.
|
|
17
|
+
See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
|
|
18
|
+
package for more information including tools to convert between version schemes.
|
|
19
|
+
|
|
20
|
+
<!-- prettier-ignore-end -->
|
|
21
|
+
|
|
22
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
23
|
+
|
|
24
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_TRADEMARK_SECTION:includeHeading=TRUE) -->
|
|
25
|
+
|
|
26
|
+
<!-- prettier-ignore-start -->
|
|
27
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
28
|
+
|
|
29
|
+
## Trademark
|
|
30
|
+
|
|
31
|
+
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
32
|
+
|
|
33
|
+
Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
34
|
+
|
|
35
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
36
|
+
|
|
37
|
+
<!-- prettier-ignore-end -->
|
|
38
|
+
|
|
39
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
## API Report File for "@fluid-experimental/oldest-client-observer"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { AttachState } from '@fluidframework/container-definitions';
|
|
8
|
+
import { IEvent } from '@fluidframework/core-interfaces';
|
|
9
|
+
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
10
|
+
import { IQuorumClients } from '@fluidframework/protocol-definitions';
|
|
11
|
+
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
12
|
+
|
|
13
|
+
// @alpha
|
|
14
|
+
export interface IOldestClientObservable extends IEventProvider<IOldestClientObservableEvents> {
|
|
15
|
+
// (undocumented)
|
|
16
|
+
attachState: AttachState;
|
|
17
|
+
// (undocumented)
|
|
18
|
+
clientId: string | undefined;
|
|
19
|
+
// (undocumented)
|
|
20
|
+
connected: boolean;
|
|
21
|
+
// (undocumented)
|
|
22
|
+
getQuorum(): IQuorumClients;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// @alpha
|
|
26
|
+
export interface IOldestClientObservableEvents extends IEvent {
|
|
27
|
+
// (undocumented)
|
|
28
|
+
(event: "connected", listener: () => void): any;
|
|
29
|
+
// (undocumented)
|
|
30
|
+
(event: "disconnected", listener: () => void): any;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// @alpha (undocumented)
|
|
34
|
+
export interface IOldestClientObserver extends IEventProvider<IOldestClientObserverEvents> {
|
|
35
|
+
// (undocumented)
|
|
36
|
+
isOldest(): boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// @alpha
|
|
40
|
+
export interface IOldestClientObserverEvents extends IEvent {
|
|
41
|
+
// (undocumented)
|
|
42
|
+
(event: "becameOldest" | "lostOldest", listener: () => void): any;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// @alpha
|
|
46
|
+
export class OldestClientObserver extends TypedEventEmitter<IOldestClientObserverEvents> implements IOldestClientObserver {
|
|
47
|
+
constructor(observable: IOldestClientObservable);
|
|
48
|
+
// (undocumented)
|
|
49
|
+
isOldest(): boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// (No @packageDocumentation comment for this package)
|
|
53
|
+
|
|
54
|
+
```
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.OldestClientObserver = void 0;
|
|
8
|
+
var oldestClientObserver_1 = require("./oldestClientObserver.cjs");
|
|
9
|
+
Object.defineProperty(exports, "OldestClientObserver", { enumerable: true, get: function () { return oldestClientObserver_1.OldestClientObserver; } });
|
|
10
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,mEAA8D;AAArD,4HAAA,oBAAoB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIOldestClientObservable,\n\tIOldestClientObservableEvents,\n\tIOldestClientObserver,\n\tIOldestClientObserverEvents,\n} from \"./interfaces\";\nexport { OldestClientObserver } from \"./oldestClientObserver\";\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export { IOldestClientObservable, IOldestClientObservableEvents, IOldestClientObserver, IOldestClientObserverEvents, } from "./interfaces";
|
|
6
|
+
export { OldestClientObserver } from "./oldestClientObserver";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,uBAAuB,EACvB,6BAA6B,EAC7B,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.cjs","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, IEventProvider } from \"@fluidframework/core-interfaces\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { IQuorumClients } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Events emitted by {@link IOldestClientObservable}.\n * @alpha\n */\nexport interface IOldestClientObservableEvents extends IEvent {\n\t(event: \"connected\", listener: () => void);\n\t(event: \"disconnected\", listener: () => void);\n}\n\n/**\n * This is to make OldestClientObserver work with either a ContainerRuntime or an IFluidDataStoreRuntime\n * (both expose the relevant API surface and eventing). However, really this info probably shouldn't live on either,\n * since neither is really the source of truth (they are just the only currently-available plumbing options).\n * It's information about the connection, so the real source of truth is lower (at the connection layer).\n * @alpha\n */\nexport interface IOldestClientObservable extends IEventProvider<IOldestClientObservableEvents> {\n\tgetQuorum(): IQuorumClients;\n\t// Generic usage of attachState is a little unusual here. We will treat ourselves as \"the oldest client that\n\t// has information about this [container | data store]\", which in the case of detached data store may disagree\n\t// with whether we're the oldest client on the connected container. So in the data store case, it's only\n\t// safe use this as an indicator about rights to tasks performed against this specific data store, and not\n\t// more broadly.\n\tattachState: AttachState;\n\tconnected: boolean;\n\tclientId: string | undefined;\n}\n\n/**\n * Events emitted by {@link IOldestClientObservable}.\n * @alpha\n */\nexport interface IOldestClientObserverEvents extends IEvent {\n\t(event: \"becameOldest\" | \"lostOldest\", listener: () => void);\n}\n\n/**\n * @alpha\n */\nexport interface IOldestClientObserver extends IEventProvider<IOldestClientObserverEvents> {\n\tisOldest(): boolean;\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IEvent, IEventProvider } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { AttachState } from "@fluidframework/container-definitions";
|
|
7
|
+
import { IQuorumClients } from "@fluidframework/protocol-definitions";
|
|
8
|
+
/**
|
|
9
|
+
* Events emitted by {@link IOldestClientObservable}.
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export interface IOldestClientObservableEvents extends IEvent {
|
|
13
|
+
(event: "connected", listener: () => void): any;
|
|
14
|
+
(event: "disconnected", listener: () => void): any;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* This is to make OldestClientObserver work with either a ContainerRuntime or an IFluidDataStoreRuntime
|
|
18
|
+
* (both expose the relevant API surface and eventing). However, really this info probably shouldn't live on either,
|
|
19
|
+
* since neither is really the source of truth (they are just the only currently-available plumbing options).
|
|
20
|
+
* It's information about the connection, so the real source of truth is lower (at the connection layer).
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
export interface IOldestClientObservable extends IEventProvider<IOldestClientObservableEvents> {
|
|
24
|
+
getQuorum(): IQuorumClients;
|
|
25
|
+
attachState: AttachState;
|
|
26
|
+
connected: boolean;
|
|
27
|
+
clientId: string | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Events emitted by {@link IOldestClientObservable}.
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
33
|
+
export interface IOldestClientObserverEvents extends IEvent {
|
|
34
|
+
(event: "becameOldest" | "lostOldest", listener: () => void): any;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @alpha
|
|
38
|
+
*/
|
|
39
|
+
export interface IOldestClientObserver extends IEventProvider<IOldestClientObserverEvents> {
|
|
40
|
+
isOldest(): boolean;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE;;;GAGG;AACH,MAAM,WAAW,6BAA8B,SAAQ,MAAM;IAC5D,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,OAAE;IAC3C,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,IAAI,OAAE;CAC9C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,uBAAwB,SAAQ,cAAc,CAAC,6BAA6B,CAAC;IAC7F,SAAS,IAAI,cAAc,CAAC;IAM5B,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA4B,SAAQ,MAAM;IAC1D,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,OAAE;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,2BAA2B,CAAC;IACzF,QAAQ,IAAI,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1,111 @@
|
|
|
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 { }
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { }
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { }
|
|
@@ -0,0 +1,111 @@
|
|
|
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 { }
|