@fluidframework/presence 2.10.0-307399
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/LICENSE +21 -0
- package/README.md +216 -0
- package/dist/alpha.d.ts +58 -0
- package/dist/baseTypes.d.ts +24 -0
- package/dist/baseTypes.d.ts.map +1 -0
- package/dist/baseTypes.js +7 -0
- package/dist/baseTypes.js.map +1 -0
- package/dist/container-definitions/containerExtensions.d.ts +137 -0
- package/dist/container-definitions/containerExtensions.d.ts.map +1 -0
- package/dist/container-definitions/containerExtensions.js +7 -0
- package/dist/container-definitions/containerExtensions.js.map +1 -0
- package/dist/container-definitions/index.d.ts +7 -0
- package/dist/container-definitions/index.d.ts.map +1 -0
- package/dist/container-definitions/index.js +7 -0
- package/dist/container-definitions/index.js.map +1 -0
- package/dist/container-definitions/runtime.d.ts +12 -0
- package/dist/container-definitions/runtime.d.ts.map +1 -0
- package/dist/container-definitions/runtime.js +7 -0
- package/dist/container-definitions/runtime.js.map +1 -0
- package/dist/core-interfaces/exposedUtilityTypes.d.ts +446 -0
- package/dist/core-interfaces/exposedUtilityTypes.d.ts.map +1 -0
- package/dist/core-interfaces/exposedUtilityTypes.js +11 -0
- package/dist/core-interfaces/exposedUtilityTypes.js.map +1 -0
- package/dist/core-interfaces/index.d.ts +10 -0
- package/dist/core-interfaces/index.d.ts.map +1 -0
- package/dist/core-interfaces/index.js +7 -0
- package/dist/core-interfaces/index.js.map +1 -0
- package/dist/core-interfaces/jsonDeserialized.d.ts +109 -0
- package/dist/core-interfaces/jsonDeserialized.d.ts.map +1 -0
- package/dist/core-interfaces/jsonDeserialized.js +7 -0
- package/dist/core-interfaces/jsonDeserialized.js.map +1 -0
- package/dist/core-interfaces/jsonSerializable.d.ts +120 -0
- package/dist/core-interfaces/jsonSerializable.d.ts.map +1 -0
- package/dist/core-interfaces/jsonSerializable.js +7 -0
- package/dist/core-interfaces/jsonSerializable.js.map +1 -0
- package/dist/core-interfaces/jsonSerializationErrors.d.ts +31 -0
- package/dist/core-interfaces/jsonSerializationErrors.d.ts.map +1 -0
- package/dist/core-interfaces/jsonSerializationErrors.js +7 -0
- package/dist/core-interfaces/jsonSerializationErrors.js.map +1 -0
- package/dist/core-interfaces/jsonType.d.ts +29 -0
- package/dist/core-interfaces/jsonType.d.ts.map +1 -0
- package/dist/core-interfaces/jsonType.js +7 -0
- package/dist/core-interfaces/jsonType.js.map +1 -0
- package/dist/datastorePresenceManagerFactory.d.ts +48 -0
- package/dist/datastorePresenceManagerFactory.d.ts.map +1 -0
- package/dist/datastorePresenceManagerFactory.js +79 -0
- package/dist/datastorePresenceManagerFactory.js.map +1 -0
- package/dist/datastoreSupport.d.ts +31 -0
- package/dist/datastoreSupport.d.ts.map +1 -0
- package/dist/datastoreSupport.js +82 -0
- package/dist/datastoreSupport.js.map +1 -0
- package/dist/events/events.d.ts +198 -0
- package/dist/events/events.d.ts.map +1 -0
- package/dist/events/events.js +157 -0
- package/dist/events/events.js.map +1 -0
- package/dist/experimentalAccess.d.ts +15 -0
- package/dist/experimentalAccess.d.ts.map +1 -0
- package/dist/experimentalAccess.js +46 -0
- package/dist/experimentalAccess.js.map +1 -0
- package/dist/exposedInternalTypes.d.ts +100 -0
- package/dist/exposedInternalTypes.d.ts.map +1 -0
- package/dist/exposedInternalTypes.js +19 -0
- package/dist/exposedInternalTypes.js.map +1 -0
- package/dist/exposedUtilityTypes.d.ts +63 -0
- package/dist/exposedUtilityTypes.d.ts.map +1 -0
- package/dist/exposedUtilityTypes.js +7 -0
- package/dist/exposedUtilityTypes.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/internalTypes.d.ts +39 -0
- package/dist/internalTypes.d.ts.map +1 -0
- package/dist/internalTypes.js +14 -0
- package/dist/internalTypes.js.map +1 -0
- package/dist/latestMapValueManager.d.ts +182 -0
- package/dist/latestMapValueManager.d.ts.map +1 -0
- package/dist/latestMapValueManager.js +206 -0
- package/dist/latestMapValueManager.js.map +1 -0
- package/dist/latestValueControls.d.ts +44 -0
- package/dist/latestValueControls.d.ts.map +1 -0
- package/dist/latestValueControls.js +28 -0
- package/dist/latestValueControls.js.map +1 -0
- package/dist/latestValueManager.d.ts +69 -0
- package/dist/latestValueManager.d.ts.map +1 -0
- package/dist/latestValueManager.js +100 -0
- package/dist/latestValueManager.js.map +1 -0
- package/dist/latestValueTypes.d.ts +44 -0
- package/dist/latestValueTypes.d.ts.map +1 -0
- package/dist/latestValueTypes.js +7 -0
- package/dist/latestValueTypes.js.map +1 -0
- package/dist/notificationsManager.d.ts +101 -0
- package/dist/notificationsManager.d.ts.map +1 -0
- package/dist/notificationsManager.js +82 -0
- package/dist/notificationsManager.js.map +1 -0
- package/dist/package.json +15 -0
- package/dist/presence.d.ts +180 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +23 -0
- package/dist/presence.js.map +1 -0
- package/dist/presenceDatastoreManager.d.ts +91 -0
- package/dist/presenceDatastoreManager.d.ts.map +1 -0
- package/dist/presenceDatastoreManager.js +248 -0
- package/dist/presenceDatastoreManager.js.map +1 -0
- package/dist/presenceManager.d.ts +20 -0
- package/dist/presenceManager.d.ts.map +1 -0
- package/dist/presenceManager.js +104 -0
- package/dist/presenceManager.js.map +1 -0
- package/dist/presenceStates.d.ts +78 -0
- package/dist/presenceStates.d.ts.map +1 -0
- package/dist/presenceStates.js +182 -0
- package/dist/presenceStates.js.map +1 -0
- package/dist/stateDatastore.d.ts +35 -0
- package/dist/stateDatastore.d.ts.map +1 -0
- package/dist/stateDatastore.js +26 -0
- package/dist/stateDatastore.js.map +1 -0
- package/dist/systemWorkspace.d.ts +51 -0
- package/dist/systemWorkspace.d.ts.map +1 -0
- package/dist/systemWorkspace.js +180 -0
- package/dist/systemWorkspace.js.map +1 -0
- package/dist/types.d.ts +92 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/valueManager.d.ts +19 -0
- package/dist/valueManager.d.ts.map +1 -0
- package/dist/valueManager.js +26 -0
- package/dist/valueManager.js.map +1 -0
- package/lib/alpha.d.ts +58 -0
- package/lib/baseTypes.d.ts +24 -0
- package/lib/baseTypes.d.ts.map +1 -0
- package/lib/baseTypes.js +6 -0
- package/lib/baseTypes.js.map +1 -0
- package/lib/container-definitions/containerExtensions.d.ts +137 -0
- package/lib/container-definitions/containerExtensions.d.ts.map +1 -0
- package/lib/container-definitions/containerExtensions.js +6 -0
- package/lib/container-definitions/containerExtensions.js.map +1 -0
- package/lib/container-definitions/index.d.ts +7 -0
- package/lib/container-definitions/index.d.ts.map +1 -0
- package/lib/container-definitions/index.js +6 -0
- package/lib/container-definitions/index.js.map +1 -0
- package/lib/container-definitions/runtime.d.ts +12 -0
- package/lib/container-definitions/runtime.d.ts.map +1 -0
- package/lib/container-definitions/runtime.js +6 -0
- package/lib/container-definitions/runtime.js.map +1 -0
- package/lib/core-interfaces/exposedUtilityTypes.d.ts +446 -0
- package/lib/core-interfaces/exposedUtilityTypes.d.ts.map +1 -0
- package/lib/core-interfaces/exposedUtilityTypes.js +10 -0
- package/lib/core-interfaces/exposedUtilityTypes.js.map +1 -0
- package/lib/core-interfaces/index.d.ts +10 -0
- package/lib/core-interfaces/index.d.ts.map +1 -0
- package/lib/core-interfaces/index.js +6 -0
- package/lib/core-interfaces/index.js.map +1 -0
- package/lib/core-interfaces/jsonDeserialized.d.ts +109 -0
- package/lib/core-interfaces/jsonDeserialized.d.ts.map +1 -0
- package/lib/core-interfaces/jsonDeserialized.js +6 -0
- package/lib/core-interfaces/jsonDeserialized.js.map +1 -0
- package/lib/core-interfaces/jsonSerializable.d.ts +120 -0
- package/lib/core-interfaces/jsonSerializable.d.ts.map +1 -0
- package/lib/core-interfaces/jsonSerializable.js +6 -0
- package/lib/core-interfaces/jsonSerializable.js.map +1 -0
- package/lib/core-interfaces/jsonSerializationErrors.d.ts +31 -0
- package/lib/core-interfaces/jsonSerializationErrors.d.ts.map +1 -0
- package/lib/core-interfaces/jsonSerializationErrors.js +6 -0
- package/lib/core-interfaces/jsonSerializationErrors.js.map +1 -0
- package/lib/core-interfaces/jsonType.d.ts +29 -0
- package/lib/core-interfaces/jsonType.d.ts.map +1 -0
- package/lib/core-interfaces/jsonType.js +6 -0
- package/lib/core-interfaces/jsonType.js.map +1 -0
- package/lib/datastorePresenceManagerFactory.d.ts +48 -0
- package/lib/datastorePresenceManagerFactory.d.ts.map +1 -0
- package/lib/datastorePresenceManagerFactory.js +75 -0
- package/lib/datastorePresenceManagerFactory.js.map +1 -0
- package/lib/datastoreSupport.d.ts +31 -0
- package/lib/datastoreSupport.d.ts.map +1 -0
- package/lib/datastoreSupport.js +77 -0
- package/lib/datastoreSupport.js.map +1 -0
- package/lib/events/events.d.ts +198 -0
- package/lib/events/events.d.ts.map +1 -0
- package/lib/events/events.js +152 -0
- package/lib/events/events.js.map +1 -0
- package/lib/experimentalAccess.d.ts +15 -0
- package/lib/experimentalAccess.d.ts.map +1 -0
- package/lib/experimentalAccess.js +42 -0
- package/lib/experimentalAccess.js.map +1 -0
- package/lib/exposedInternalTypes.d.ts +100 -0
- package/lib/exposedInternalTypes.d.ts.map +1 -0
- package/lib/exposedInternalTypes.js +16 -0
- package/lib/exposedInternalTypes.js.map +1 -0
- package/lib/exposedUtilityTypes.d.ts +63 -0
- package/lib/exposedUtilityTypes.d.ts.map +1 -0
- package/lib/exposedUtilityTypes.js +6 -0
- package/lib/exposedUtilityTypes.js.map +1 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/internalTypes.d.ts +39 -0
- package/lib/internalTypes.d.ts.map +1 -0
- package/lib/internalTypes.js +11 -0
- package/lib/internalTypes.js.map +1 -0
- package/lib/latestMapValueManager.d.ts +182 -0
- package/lib/latestMapValueManager.d.ts.map +1 -0
- package/lib/latestMapValueManager.js +202 -0
- package/lib/latestMapValueManager.js.map +1 -0
- package/lib/latestValueControls.d.ts +44 -0
- package/lib/latestValueControls.d.ts.map +1 -0
- package/lib/latestValueControls.js +24 -0
- package/lib/latestValueControls.js.map +1 -0
- package/lib/latestValueManager.d.ts +69 -0
- package/lib/latestValueManager.d.ts.map +1 -0
- package/lib/latestValueManager.js +96 -0
- package/lib/latestValueManager.js.map +1 -0
- package/lib/latestValueTypes.d.ts +44 -0
- package/lib/latestValueTypes.d.ts.map +1 -0
- package/lib/latestValueTypes.js +6 -0
- package/lib/latestValueTypes.js.map +1 -0
- package/lib/notificationsManager.d.ts +101 -0
- package/lib/notificationsManager.d.ts.map +1 -0
- package/lib/notificationsManager.js +78 -0
- package/lib/notificationsManager.js.map +1 -0
- package/lib/presence.d.ts +180 -0
- package/lib/presence.d.ts.map +1 -0
- package/lib/presence.js +20 -0
- package/lib/presence.js.map +1 -0
- package/lib/presenceDatastoreManager.d.ts +91 -0
- package/lib/presenceDatastoreManager.d.ts.map +1 -0
- package/lib/presenceDatastoreManager.js +244 -0
- package/lib/presenceDatastoreManager.js.map +1 -0
- package/lib/presenceManager.d.ts +20 -0
- package/lib/presenceManager.d.ts.map +1 -0
- package/lib/presenceManager.js +100 -0
- package/lib/presenceManager.js.map +1 -0
- package/lib/presenceStates.d.ts +78 -0
- package/lib/presenceStates.d.ts.map +1 -0
- package/lib/presenceStates.js +177 -0
- package/lib/presenceStates.js.map +1 -0
- package/lib/stateDatastore.d.ts +35 -0
- package/lib/stateDatastore.d.ts.map +1 -0
- package/lib/stateDatastore.js +21 -0
- package/lib/stateDatastore.js.map +1 -0
- package/lib/systemWorkspace.d.ts +51 -0
- package/lib/systemWorkspace.d.ts.map +1 -0
- package/lib/systemWorkspace.js +176 -0
- package/lib/systemWorkspace.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/types.d.ts +92 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +7 -0
- package/lib/types.js.map +1 -0
- package/lib/valueManager.d.ts +19 -0
- package/lib/valueManager.d.ts.map +1 -0
- package/lib/valueManager.js +21 -0
- package/lib/valueManager.js.map +1 -0
- package/package.json +175 -0
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,216 @@
|
|
|
1
|
+
# @fluidframework/presence
|
|
2
|
+
|
|
3
|
+
A set of session-focused utilities for lightweight data sharing and messaging.
|
|
4
|
+
|
|
5
|
+
A session is a period of time when one or more clients are connected to a Fluid service. Session data and messages may be exchanged among clients, but will disappear once the no clients remain. (More specifically once no clients remain that have acquired the session `IPresence` interface.) Once fully implemented, no client will require container write permissions to use Presence features.
|
|
6
|
+
<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_README_HEADER) -->
|
|
7
|
+
|
|
8
|
+
<!-- prettier-ignore-start -->
|
|
9
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
10
|
+
|
|
11
|
+
## Using Fluid Framework libraries
|
|
12
|
+
|
|
13
|
+
When taking a dependency on a Fluid Framework library's public APIs, we recommend using a `^` (caret) version range, such as `^1.3.4`.
|
|
14
|
+
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
15
|
+
library consumers should always prefer `^`.
|
|
16
|
+
|
|
17
|
+
If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
To get started, install the package by running the following command:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm i @fluidframework/presence
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Importing from this package
|
|
28
|
+
|
|
29
|
+
This package leverages [package.json exports](https://nodejs.org/api/packages.html#exports) to separate its APIs by support level.
|
|
30
|
+
For more information on the related support guarantees, see [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
|
|
31
|
+
|
|
32
|
+
To access the `public` ([SemVer](https://semver.org/)) APIs, import via `@fluidframework/presence` like normal.
|
|
33
|
+
|
|
34
|
+
To access the `alpha` APIs, import via `@fluidframework/presence/alpha`.
|
|
35
|
+
|
|
36
|
+
## API Documentation
|
|
37
|
+
|
|
38
|
+
API documentation for **@fluidframework/presence** is available at <https://fluidframework.com/docs/apis/presence>.
|
|
39
|
+
|
|
40
|
+
<!-- prettier-ignore-end -->
|
|
41
|
+
|
|
42
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
43
|
+
## Concepts
|
|
44
|
+
|
|
45
|
+
### Attendees
|
|
46
|
+
|
|
47
|
+
For the lifetime of a session, each client connecting will be established as a unique and stable `ISessionClient`. The representation is stable because it will remain the same `ISessionClient` instance independent of connection drops and reconnections.
|
|
48
|
+
|
|
49
|
+
Client Ids maintained by `ISessionClient` may be used to associate `ISessionClient` with quorum, audience, and service audience members.
|
|
50
|
+
|
|
51
|
+
### Workspaces
|
|
52
|
+
|
|
53
|
+
Within Presence data sharing and messaging is broken into workspaces with custom identifiers (workspace addresses). Clients must use the same address within a session to connect with others. Unique addresses enable logical components within a client runtime to remain isolated or work together (without other piping between those components).
|
|
54
|
+
|
|
55
|
+
There are two types of workspaces: States and Notifications.
|
|
56
|
+
|
|
57
|
+
#### States Workspace
|
|
58
|
+
|
|
59
|
+
A states workspace, `PresenceStates`, allows sharing of simple data across attendees where each attendee maintains their own data values that others may read, but not change. This is distinct from a Fluid DDS where data values might be manipulated by multiple clients and one ultimate value is derived. Shared, independent values are maintained by value managers that specialize in incrementality and history of values.
|
|
60
|
+
|
|
61
|
+
#### Notifications Workspace
|
|
62
|
+
|
|
63
|
+
A notifications workspace, `PresenceNotifications`, is similar to states workspace, but is dedicated to notification use-cases via `NotificationsManager`.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Value Managers
|
|
67
|
+
|
|
68
|
+
#### LatestValueManager
|
|
69
|
+
|
|
70
|
+
Latest value manager retains the most recent atomic value each attendee has shared. Use `Latest` to add one to `PresenceStates` workspace.
|
|
71
|
+
|
|
72
|
+
#### LatestMapValueManager
|
|
73
|
+
|
|
74
|
+
Latest map value manager retains the most recent atomic value each attendee has shared under arbitrary keys. Values associated with a key may be nullified (appears as deleted). Use `LatestMap` to add one to `PresenceStates` workspace.
|
|
75
|
+
|
|
76
|
+
#### NotificationsManager
|
|
77
|
+
|
|
78
|
+
Notifications value managers are special case where no data is retained during a session and all interactions appear as events that are sent and received. Notifications value managers may be mixed into a `PresenceStates` workspace for convenience. They are the only type of value managers permitted in a `PresenceNotifications` workspace. Use `Notifications` to add one to `PresenceNotifications` or `PresenceStates` workspace.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## Onboarding
|
|
82
|
+
|
|
83
|
+
While this package is developing as experimental and other Fluid Framework internals are being updated to accommodate it, a temporary Shared Object must be added within container to gain access.
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { acquirePresenceViaDataObject, ExperimentalPresenceManager } from "@fluidframework/presence/alpha";
|
|
87
|
+
|
|
88
|
+
const containerSchema = {
|
|
89
|
+
initialObjects: {
|
|
90
|
+
presence: ExperimentalPresenceManager
|
|
91
|
+
}
|
|
92
|
+
} satisfies ContainerSchema;
|
|
93
|
+
|
|
94
|
+
const presence = await acquirePresenceViaDataObject(container.initialObjects.presence);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## Limitations
|
|
99
|
+
|
|
100
|
+
### States Reliability
|
|
101
|
+
|
|
102
|
+
The current implementation relies on Fluid Framework's Signal infrastructure instead of Ops. This has advantages, but comes with some risk of unreliable messaging. The most common known case of unreliable signals occurs during reconnection periods and current implementation attempts to account for that. Be aware that all clients are not guaranteed to arrive at eventual consistency. Please [file a new issue](https://github.com/microsoft/FluidFramework/issues/new?assignees=&labels=bug&projects=&template=bug_report.md&title=Presence:%20States:%20) if one is not found under [Presence States issues](https://github.com/microsoft/FluidFramework/issues?q=is%3Aissue+%22Presence%3A+States%3A%22).
|
|
103
|
+
|
|
104
|
+
### Compatibility and Versioning
|
|
105
|
+
|
|
106
|
+
Current API does not provide a mechanism to validate that state and notification data received within session from other clients matches the types declared. The schema of workspace address, states and notifications names, and their types will only be consistent when all clients connected to the session are using the same types for a unique value/notification path (workspace address + name within workspace). In other words, don't mix versions or make sure to change identifiers when changing types in a non-compatible way.
|
|
107
|
+
|
|
108
|
+
Example:
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
presence.getStates("app:v1states", { myState: Latest({x: 0})});
|
|
112
|
+
```
|
|
113
|
+
is incompatible with
|
|
114
|
+
```typescript
|
|
115
|
+
presence.getStates("app:v1states", { myState: Latest({x: "text"})});
|
|
116
|
+
```
|
|
117
|
+
as "app:v1states"+"myState" have different value type expectations: `{x: number}` versus `{x: string}`.
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
presence.getStates("app:v1states", { myState2: Latest({x: true})});
|
|
121
|
+
```
|
|
122
|
+
would be compatible with both of the prior schemas as "myState2" is a different name. Though in this situation none of the different clients would be able to observe each other.
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Notifications
|
|
126
|
+
|
|
127
|
+
Notifications API is mostly unimplemented. All messages are always broadcast even if `unicast` API is used and all are emitted as `unattendedNotification` event rather than the appropriate custom event.
|
|
128
|
+
|
|
129
|
+
Notifications are fundamentally unreliable at this time as there are no built-in acknowledgements nor retained state. To prevent most common loss of notifications, always check for connection before sending.
|
|
130
|
+
|
|
131
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_FOOTER) -->
|
|
132
|
+
|
|
133
|
+
<!-- prettier-ignore-start -->
|
|
134
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
135
|
+
|
|
136
|
+
## Minimum Client Requirements
|
|
137
|
+
|
|
138
|
+
These are the platform requirements for the current version of Fluid Framework Client Packages.
|
|
139
|
+
These requirements err on the side of being too strict since within a major version they can be relaxed over time, but not made stricter.
|
|
140
|
+
For Long Term Support (LTS) versions this can require supporting these platforms for several years.
|
|
141
|
+
|
|
142
|
+
It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
|
|
143
|
+
If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
|
|
144
|
+
When making such a request please include if the configuration already works (and thus the request is just that it becomes officially supported), or if changes are required to get it working.
|
|
145
|
+
|
|
146
|
+
### Supported Runtimes
|
|
147
|
+
|
|
148
|
+
- NodeJs ^20.10.0 except that we will drop support for it [when NodeJs 20 loses its upstream support on 2026-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS (22) at least 1 year before 20 is end-of-life. This same policy applies to NodeJS 22 when it is end of life (2027-04-30).
|
|
149
|
+
- Modern browsers supporting the es2022 standard library: in response to asks we can add explicit support for using babel to polyfill to target specific standards or runtimes (meaning we can avoid/remove use of things that don't polyfill robustly, but otherwise target modern standards).
|
|
150
|
+
|
|
151
|
+
### Supported Tools
|
|
152
|
+
|
|
153
|
+
- TypeScript 5.4:
|
|
154
|
+
- All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
|
|
155
|
+
- [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
|
|
156
|
+
- [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
|
|
157
|
+
- `exactOptionalPropertyTypes` is currently not fully supported.
|
|
158
|
+
If used, narrowing members of Fluid Framework types types using `in`, `Reflect.has`, `Object.hasOwn` or `Object.prototype.hasOwnProperty` should be avoided as they may incorrectly exclude `undefined` from the possible values in some cases.
|
|
159
|
+
- [webpack](https://webpack.js.org/) 5
|
|
160
|
+
- We are not intending to be prescriptive about what bundler to use.
|
|
161
|
+
Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.
|
|
162
|
+
|
|
163
|
+
### Module Resolution
|
|
164
|
+
|
|
165
|
+
[`Node16`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) resolution should be used with TypeScript compilerOptions to follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
|
|
166
|
+
Node10 resolution is not supported as it does not support Fluid Framework's API structuring pattern that is used to distinguish stable APIs from those that are in development.
|
|
167
|
+
|
|
168
|
+
### Module Formats
|
|
169
|
+
|
|
170
|
+
- ES Modules:
|
|
171
|
+
ES Modules are the preferred way to consume our client packages (including in NodeJs) and consuming our client packages from ES Modules is fully supported.
|
|
172
|
+
- CommonJs:
|
|
173
|
+
Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
|
|
174
|
+
This is done to accommodate some workflows without good ES Module support.
|
|
175
|
+
If you have a workflow you would like included in this list, file an issue.
|
|
176
|
+
Once this list of workflows motivating CommonJS support is empty, we may drop support for CommonJS one year after notice of the change is posted here.
|
|
177
|
+
|
|
178
|
+
- Testing with Jest (which lacks [stable ESM support](https://jestjs.io/docs/ecmascript-modules) due to [unstable APIs in NodeJs](https://github.com/nodejs/node/issues/37648))
|
|
179
|
+
|
|
180
|
+
## Contribution Guidelines
|
|
181
|
+
|
|
182
|
+
There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
|
|
183
|
+
|
|
184
|
+
- Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
|
|
185
|
+
- [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in.
|
|
186
|
+
- Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
|
|
187
|
+
- [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
|
|
188
|
+
|
|
189
|
+
Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/wiki).
|
|
190
|
+
|
|
191
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
192
|
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
193
|
+
|
|
194
|
+
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
195
|
+
Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
|
|
196
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
197
|
+
|
|
198
|
+
## Help
|
|
199
|
+
|
|
200
|
+
Not finding what you're looking for in this README? Check out [fluidframework.com](https://fluidframework.com/docs/).
|
|
201
|
+
|
|
202
|
+
Still not finding what you're looking for? Please [file an issue](https://github.com/microsoft/FluidFramework/wiki/Submitting-Bugs-and-Feature-Requests).
|
|
203
|
+
|
|
204
|
+
Thank you!
|
|
205
|
+
|
|
206
|
+
## Trademark
|
|
207
|
+
|
|
208
|
+
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
209
|
+
|
|
210
|
+
Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
211
|
+
|
|
212
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
213
|
+
|
|
214
|
+
<!-- prettier-ignore-end -->
|
|
215
|
+
|
|
216
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
package/dist/alpha.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
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 @fluid-tools/build-cli.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Experimental package for client presence within a connected session.
|
|
13
|
+
*
|
|
14
|
+
* See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.
|
|
15
|
+
*
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
// @alpha APIs
|
|
21
|
+
ClientConnectionId,
|
|
22
|
+
ClientSessionId,
|
|
23
|
+
ExperimentalPresenceDO,
|
|
24
|
+
ExperimentalPresenceManager,
|
|
25
|
+
IPresence,
|
|
26
|
+
ISessionClient,
|
|
27
|
+
Latest,
|
|
28
|
+
LatestMap,
|
|
29
|
+
LatestMapItemRemovedClientData,
|
|
30
|
+
LatestMapItemValueClientData,
|
|
31
|
+
LatestMapValueClientData,
|
|
32
|
+
LatestMapValueManager,
|
|
33
|
+
LatestMapValueManagerEvents,
|
|
34
|
+
LatestValueClientData,
|
|
35
|
+
LatestValueControls,
|
|
36
|
+
LatestValueData,
|
|
37
|
+
LatestValueManager,
|
|
38
|
+
LatestValueManagerEvents,
|
|
39
|
+
LatestValueMetadata,
|
|
40
|
+
NotificationEmitter,
|
|
41
|
+
NotificationSubscribable,
|
|
42
|
+
NotificationSubscriptions,
|
|
43
|
+
Notifications,
|
|
44
|
+
NotificationsManager,
|
|
45
|
+
NotificationsManagerEvents,
|
|
46
|
+
PresenceEvents,
|
|
47
|
+
PresenceNotifications,
|
|
48
|
+
PresenceNotificationsSchema,
|
|
49
|
+
PresenceStates,
|
|
50
|
+
PresenceStatesEntries,
|
|
51
|
+
PresenceStatesEntry,
|
|
52
|
+
PresenceStatesSchema,
|
|
53
|
+
PresenceWorkspaceAddress,
|
|
54
|
+
SessionClientStatus,
|
|
55
|
+
ValueMap,
|
|
56
|
+
acquirePresence,
|
|
57
|
+
acquirePresenceViaDataObject
|
|
58
|
+
} from "./index.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A Fluid client connection identifier.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Each client connection is given a unique identifier for the duration of the
|
|
10
|
+
* connection. If a client disconnects and reconnects, it will be given a new
|
|
11
|
+
* identifier. Prefer use of {@link ISessionClient} as a way to identify clients
|
|
12
|
+
* in a session. {@link ISessionClient.getConnectionId} will provide the current
|
|
13
|
+
* connection identifier for a logical session client.
|
|
14
|
+
*
|
|
15
|
+
* @privateRemarks
|
|
16
|
+
* This represents what is commonly `clientId` in Fluid code. Ideally this is
|
|
17
|
+
* moved somewhere more central and we brand it to avoid confusion with other
|
|
18
|
+
* strings. Branding broadly is likely a breaking change and may take decent
|
|
19
|
+
* effort to manage.
|
|
20
|
+
*
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
export type ClientConnectionId = string;
|
|
24
|
+
//# sourceMappingURL=baseTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseTypes.d.ts","sourceRoot":"","sources":["../src/baseTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseTypes.js","sourceRoot":"","sources":["../src/baseTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A Fluid client connection identifier.\n *\n * @remarks\n * Each client connection is given a unique identifier for the duration of the\n * connection. If a client disconnects and reconnects, it will be given a new\n * identifier. Prefer use of {@link ISessionClient} as a way to identify clients\n * in a session. {@link ISessionClient.getConnectionId} will provide the current\n * connection identifier for a logical session client.\n *\n * @privateRemarks\n * This represents what is commonly `clientId` in Fluid code. Ideally this is\n * moved somewhere more central and we brand it to avoid confusion with other\n * strings. Branding broadly is likely a breaking change and may take decent\n * effort to manage.\n *\n * @alpha\n */\nexport type ClientConnectionId = string;\n"]}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { JsonDeserialized, JsonSerializable } from "@fluidframework/presence/internal/core-interfaces";
|
|
6
|
+
/**
|
|
7
|
+
* While connected, the id of a client within a session.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export type ClientConnectionId = string;
|
|
12
|
+
/**
|
|
13
|
+
* Common interface between incoming and outgoing extension signals.
|
|
14
|
+
*
|
|
15
|
+
* @sealed
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export interface IExtensionMessage<TType extends string = string, TContent = unknown> {
|
|
19
|
+
/**
|
|
20
|
+
* Message type
|
|
21
|
+
*/
|
|
22
|
+
type: TType;
|
|
23
|
+
/**
|
|
24
|
+
* Message content
|
|
25
|
+
*/
|
|
26
|
+
content: JsonDeserialized<TContent>;
|
|
27
|
+
/**
|
|
28
|
+
* The client ID that submitted the message.
|
|
29
|
+
* For server generated messages the clientId will be null.
|
|
30
|
+
*/
|
|
31
|
+
clientId: ClientConnectionId | null;
|
|
32
|
+
/**
|
|
33
|
+
* Client ID of the singular client the message is being (or has been) sent to.
|
|
34
|
+
* May only be specified when IConnect.supportedFeatures['submit_signals_v2'] is true, will throw otherwise.
|
|
35
|
+
*/
|
|
36
|
+
targetClientId?: ClientConnectionId;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Defines requirements for a component to register with container as an extension.
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export interface IContainerExtension<TContext extends unknown[]> {
|
|
44
|
+
/**
|
|
45
|
+
* Notifies the extension of a new use context.
|
|
46
|
+
*
|
|
47
|
+
* @param context - Context new reference to extension is acquired within
|
|
48
|
+
*/
|
|
49
|
+
onNewContext(...context: TContext): void;
|
|
50
|
+
/**
|
|
51
|
+
* Callback for signal sent by this extension.
|
|
52
|
+
*
|
|
53
|
+
* @param address - Address of the signal
|
|
54
|
+
* @param signal - Signal content and metadata
|
|
55
|
+
* @param local - True if signal was sent by this client
|
|
56
|
+
*/
|
|
57
|
+
processSignal?(address: string, signal: IExtensionMessage, local: boolean): void;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Defines the runtime interface an extension may access.
|
|
61
|
+
* In most cases this is a subset of {@link @fluidframework/container-runtime-definitions#IContainerRuntime}.
|
|
62
|
+
*
|
|
63
|
+
* @sealed
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export interface IExtensionRuntime {
|
|
67
|
+
/**
|
|
68
|
+
* {@inheritdoc @fluidframework/container-runtime-definitions#IContainerRuntime.clientId}
|
|
69
|
+
*/
|
|
70
|
+
get clientId(): ClientConnectionId | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Submits a signal to be sent to other clients.
|
|
73
|
+
* @param address - Custom address for the signal.
|
|
74
|
+
* @param type - Custom type of the signal.
|
|
75
|
+
* @param content - Custom content of the signal. Should be a JSON serializable object or primitive via {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}.
|
|
76
|
+
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
77
|
+
*
|
|
78
|
+
* Upon receipt of signal, {@link IContainerExtension.processSignal} will be called with the same
|
|
79
|
+
* address, type, and content (less any non-{@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}-able data).
|
|
80
|
+
*/
|
|
81
|
+
submitAddressedSignal<T>(address: string, type: string, content: JsonSerializable<T>, targetClientId?: ClientConnectionId): void;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Factory method to create an extension instance.
|
|
85
|
+
*
|
|
86
|
+
* Any such method provided to {@link ContainerExtensionStore.acquireExtension}
|
|
87
|
+
* must use the same value for a given {@link ContainerExtensionId} so that an
|
|
88
|
+
* `instanceof` check may be performed at runtime.
|
|
89
|
+
*
|
|
90
|
+
* @typeParam T - Type of extension to create
|
|
91
|
+
* @typeParam TContext - Array of optional custom context
|
|
92
|
+
*
|
|
93
|
+
* @param runtime - Runtime for extension to work against
|
|
94
|
+
* @param context - Custom context for extension.
|
|
95
|
+
* @returns Record providing:
|
|
96
|
+
* `interface` instance (type `T`) that is provided to caller of
|
|
97
|
+
* {@link ContainerExtensionStore.acquireExtension} and
|
|
98
|
+
* `extension` store/runtime uses to interact with extension.
|
|
99
|
+
*
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
export type ContainerExtensionFactory<T, TContext extends unknown[]> = new (runtime: IExtensionRuntime, ...context: TContext) => {
|
|
103
|
+
readonly interface: T;
|
|
104
|
+
readonly extension: IContainerExtension<TContext>;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Unique identifier for extension
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* A string known to all clients working with a certain ContainerExtension and unique
|
|
111
|
+
* among ContainerExtensions. Not `/` may be used in the string. Recommend using
|
|
112
|
+
* concatenation of: type of unique identifier, `:` (required), and unique identifier.
|
|
113
|
+
*
|
|
114
|
+
* @example Examples
|
|
115
|
+
* ```typescript
|
|
116
|
+
* "guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1"
|
|
117
|
+
* "name:@foo-scope_bar:v1"
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
export type ContainerExtensionId = `${string}:${string}`;
|
|
123
|
+
/**
|
|
124
|
+
* @sealed
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
export interface ContainerExtensionStore {
|
|
128
|
+
/**
|
|
129
|
+
* Acquires an extension from store or adds new one.
|
|
130
|
+
*
|
|
131
|
+
* @param id - Identifier for the requested extension
|
|
132
|
+
* @param factory - Factory to create the extension if not found
|
|
133
|
+
* @returns The extension
|
|
134
|
+
*/
|
|
135
|
+
acquireExtension<T, TContext extends unknown[]>(id: ContainerExtensionId, factory: ContainerExtensionFactory<T, TContext>, ...context: TContext): T;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=containerExtensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerExtensions.d.ts","sourceRoot":"","sources":["../../src/container-definitions/containerExtensions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,mDAAmD,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,QAAQ,GAAG,OAAO;IACnF;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IAEZ;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAEpC;;;OAGG;IAEH,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAEpC;;;OAGG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACpC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB,CAAC,QAAQ,SAAS,OAAO,EAAE;IAC9D;;;;OAIG;IACH,YAAY,CAAC,GAAG,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEzC;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACjF;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,IAAI,QAAQ,IAAI,kBAAkB,GAAG,SAAS,CAAC;IAE/C;;;;;;;;;OASG;IACH,qBAAqB,CAAC,CAAC,EACtB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC5B,cAAc,CAAC,EAAE,kBAAkB,GACjC,IAAI,CAAC;CACR;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,EAAE,QAAQ,SAAS,OAAO,EAAE,IAAI,KACtE,OAAO,EAAE,iBAAiB,EAC1B,GAAG,OAAO,EAAE,QAAQ,KAChB;IAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAA;CAAE,CAAC;AAElF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,oBAAoB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;;;OAMG;IACH,gBAAgB,CAAC,CAAC,EAAE,QAAQ,SAAS,OAAO,EAAE,EAC7C,EAAE,EAAE,oBAAoB,EACxB,OAAO,EAAE,yBAAyB,CAAC,CAAC,EAAE,QAAQ,CAAC,EAC/C,GAAG,OAAO,EAAE,QAAQ,GAClB,CAAC,CAAC;CACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerExtensions.js","sourceRoot":"","sources":["../../src/container-definitions/containerExtensions.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 type {\n\tJsonDeserialized,\n\tJsonSerializable,\n} from \"@fluidframework/presence/internal/core-interfaces\";\n\n/**\n * While connected, the id of a client within a session.\n *\n * @internal\n */\nexport type ClientConnectionId = string;\n\n/**\n * Common interface between incoming and outgoing extension signals.\n *\n * @sealed\n * @internal\n */\nexport interface IExtensionMessage<TType extends string = string, TContent = unknown> {\n\t/**\n\t * Message type\n\t */\n\ttype: TType;\n\n\t/**\n\t * Message content\n\t */\n\tcontent: JsonDeserialized<TContent>;\n\n\t/**\n\t * The client ID that submitted the message.\n\t * For server generated messages the clientId will be null.\n\t */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tclientId: ClientConnectionId | null;\n\n\t/**\n\t * Client ID of the singular client the message is being (or has been) sent to.\n\t * May only be specified when IConnect.supportedFeatures['submit_signals_v2'] is true, will throw otherwise.\n\t */\n\ttargetClientId?: ClientConnectionId;\n}\n\n/**\n * Defines requirements for a component to register with container as an extension.\n *\n * @internal\n */\nexport interface IContainerExtension<TContext extends unknown[]> {\n\t/**\n\t * Notifies the extension of a new use context.\n\t *\n\t * @param context - Context new reference to extension is acquired within\n\t */\n\tonNewContext(...context: TContext): void;\n\n\t/**\n\t * Callback for signal sent by this extension.\n\t *\n\t * @param address - Address of the signal\n\t * @param signal - Signal content and metadata\n\t * @param local - True if signal was sent by this client\n\t */\n\tprocessSignal?(address: string, signal: IExtensionMessage, local: boolean): void;\n}\n\n/**\n * Defines the runtime interface an extension may access.\n * In most cases this is a subset of {@link @fluidframework/container-runtime-definitions#IContainerRuntime}.\n *\n * @sealed\n * @internal\n */\nexport interface IExtensionRuntime {\n\t/**\n\t * {@inheritdoc @fluidframework/container-runtime-definitions#IContainerRuntime.clientId}\n\t */\n\tget clientId(): ClientConnectionId | undefined;\n\n\t/**\n\t * Submits a signal to be sent to other clients.\n\t * @param address - Custom address for the signal.\n\t * @param type - Custom type of the signal.\n\t * @param content - Custom content of the signal. Should be a JSON serializable object or primitive via {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}.\n\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t *\n\t * Upon receipt of signal, {@link IContainerExtension.processSignal} will be called with the same\n\t * address, type, and content (less any non-{@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}-able data).\n\t */\n\tsubmitAddressedSignal<T>(\n\t\taddress: string,\n\t\ttype: string,\n\t\tcontent: JsonSerializable<T>,\n\t\ttargetClientId?: ClientConnectionId,\n\t): void;\n}\n\n/**\n * Factory method to create an extension instance.\n *\n * Any such method provided to {@link ContainerExtensionStore.acquireExtension}\n * must use the same value for a given {@link ContainerExtensionId} so that an\n * `instanceof` check may be performed at runtime.\n *\n * @typeParam T - Type of extension to create\n * @typeParam TContext - Array of optional custom context\n *\n * @param runtime - Runtime for extension to work against\n * @param context - Custom context for extension.\n * @returns Record providing:\n * `interface` instance (type `T`) that is provided to caller of\n * {@link ContainerExtensionStore.acquireExtension} and\n * `extension` store/runtime uses to interact with extension.\n *\n * @internal\n */\nexport type ContainerExtensionFactory<T, TContext extends unknown[]> = new (\n\truntime: IExtensionRuntime,\n\t...context: TContext\n) => { readonly interface: T; readonly extension: IContainerExtension<TContext> };\n\n/**\n * Unique identifier for extension\n *\n * @remarks\n * A string known to all clients working with a certain ContainerExtension and unique\n * among ContainerExtensions. Not `/` may be used in the string. Recommend using\n * concatenation of: type of unique identifier, `:` (required), and unique identifier.\n *\n * @example Examples\n * ```typescript\n * \"guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1\"\n * \"name:@foo-scope_bar:v1\"\n * ```\n *\n * @internal\n */\nexport type ContainerExtensionId = `${string}:${string}`;\n\n/**\n * @sealed\n * @internal\n */\nexport interface ContainerExtensionStore {\n\t/**\n\t * Acquires an extension from store or adds new one.\n\t *\n\t * @param id - Identifier for the requested extension\n\t * @param factory - Factory to create the extension if not found\n\t * @returns The extension\n\t */\n\tacquireExtension<T, TContext extends unknown[]>(\n\t\tid: ContainerExtensionId,\n\t\tfactory: ContainerExtensionFactory<T, TContext>,\n\t\t...context: TContext\n\t): T;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/container-definitions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,mBAAmB,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/container-definitions/index.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type { IRuntimeInternal } from \"./runtime.js\";\n\n// eslint-disable-next-line no-restricted-syntax\nexport type * from \"./containerExtensions.js\";\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { IRuntime } from "@fluidframework/container-definitions/internal";
|
|
6
|
+
import type { ContainerExtensionStore } from "./containerExtensions.js";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export interface IRuntimeInternal extends IRuntime, ContainerExtensionStore {
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/container-definitions/runtime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAE/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,QAAQ,EAAE,uBAAuB;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/container-definitions/runtime.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 type { IRuntime } from \"@fluidframework/container-definitions/internal\";\n\nimport type { ContainerExtensionStore } from \"./containerExtensions.js\";\n\n/**\n * @internal\n */\nexport interface IRuntimeInternal extends IRuntime, ContainerExtensionStore {}\n"]}
|