@fluidframework/presence 2.41.0 → 2.43.0-343119

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.
Files changed (147) hide show
  1. package/dist/broadcastControls.d.ts +2 -3
  2. package/dist/broadcastControls.d.ts.map +1 -1
  3. package/dist/broadcastControls.js +2 -3
  4. package/dist/broadcastControls.js.map +1 -1
  5. package/dist/datastorePresenceManagerFactory.d.ts.map +1 -1
  6. package/dist/datastorePresenceManagerFactory.js +1 -0
  7. package/dist/datastorePresenceManagerFactory.js.map +1 -1
  8. package/dist/datastoreSupport.d.ts +7 -2
  9. package/dist/datastoreSupport.d.ts.map +1 -1
  10. package/dist/datastoreSupport.js +6 -4
  11. package/dist/datastoreSupport.js.map +1 -1
  12. package/dist/exposedInternalTypes.d.ts +22 -4
  13. package/dist/exposedInternalTypes.d.ts.map +1 -1
  14. package/dist/exposedInternalTypes.js.map +1 -1
  15. package/dist/exposedUtilityTypes.d.ts +6 -5
  16. package/dist/exposedUtilityTypes.d.ts.map +1 -1
  17. package/dist/exposedUtilityTypes.js.map +1 -1
  18. package/dist/internalTypes.d.ts +11 -9
  19. package/dist/internalTypes.d.ts.map +1 -1
  20. package/dist/internalTypes.js.map +1 -1
  21. package/dist/internalUtils.d.ts +26 -8
  22. package/dist/internalUtils.d.ts.map +1 -1
  23. package/dist/internalUtils.js +35 -8
  24. package/dist/internalUtils.js.map +1 -1
  25. package/dist/latestMapValueManager.d.ts +28 -7
  26. package/dist/latestMapValueManager.d.ts.map +1 -1
  27. package/dist/latestMapValueManager.js +10 -9
  28. package/dist/latestMapValueManager.js.map +1 -1
  29. package/dist/latestValueManager.d.ts +17 -3
  30. package/dist/latestValueManager.d.ts.map +1 -1
  31. package/dist/latestValueManager.js +20 -9
  32. package/dist/latestValueManager.js.map +1 -1
  33. package/dist/latestValueTypes.d.ts +11 -1
  34. package/dist/latestValueTypes.d.ts.map +1 -1
  35. package/dist/latestValueTypes.js.map +1 -1
  36. package/dist/notificationsManager.d.ts +2 -2
  37. package/dist/notificationsManager.d.ts.map +1 -1
  38. package/dist/notificationsManager.js +14 -7
  39. package/dist/notificationsManager.js.map +1 -1
  40. package/dist/presence.d.ts +7 -5
  41. package/dist/presence.d.ts.map +1 -1
  42. package/dist/presence.js.map +1 -1
  43. package/dist/presenceDatastoreManager.d.ts +5 -6
  44. package/dist/presenceDatastoreManager.d.ts.map +1 -1
  45. package/dist/presenceDatastoreManager.js +19 -7
  46. package/dist/presenceDatastoreManager.js.map +1 -1
  47. package/dist/presenceManager.d.ts +0 -4
  48. package/dist/presenceManager.d.ts.map +1 -1
  49. package/dist/presenceManager.js +1 -3
  50. package/dist/presenceManager.js.map +1 -1
  51. package/dist/presenceStates.d.ts +9 -14
  52. package/dist/presenceStates.d.ts.map +1 -1
  53. package/dist/presenceStates.js +1 -8
  54. package/dist/presenceStates.js.map +1 -1
  55. package/dist/protocol.d.ts +37 -12
  56. package/dist/protocol.d.ts.map +1 -1
  57. package/dist/protocol.js +7 -3
  58. package/dist/protocol.js.map +1 -1
  59. package/dist/stateDatastore.d.ts +9 -8
  60. package/dist/stateDatastore.d.ts.map +1 -1
  61. package/dist/stateDatastore.js +0 -4
  62. package/dist/stateDatastore.js.map +1 -1
  63. package/dist/systemWorkspace.d.ts +12 -6
  64. package/dist/systemWorkspace.d.ts.map +1 -1
  65. package/dist/systemWorkspace.js +14 -4
  66. package/dist/systemWorkspace.js.map +1 -1
  67. package/dist/types.d.ts +3 -2
  68. package/dist/types.d.ts.map +1 -1
  69. package/dist/types.js.map +1 -1
  70. package/dist/valueManager.d.ts +0 -4
  71. package/dist/valueManager.d.ts.map +1 -1
  72. package/dist/valueManager.js +0 -4
  73. package/dist/valueManager.js.map +1 -1
  74. package/lib/broadcastControls.d.ts +2 -3
  75. package/lib/broadcastControls.d.ts.map +1 -1
  76. package/lib/broadcastControls.js +2 -3
  77. package/lib/broadcastControls.js.map +1 -1
  78. package/lib/datastorePresenceManagerFactory.d.ts.map +1 -1
  79. package/lib/datastorePresenceManagerFactory.js +1 -0
  80. package/lib/datastorePresenceManagerFactory.js.map +1 -1
  81. package/lib/datastoreSupport.d.ts +7 -2
  82. package/lib/datastoreSupport.d.ts.map +1 -1
  83. package/lib/datastoreSupport.js +6 -4
  84. package/lib/datastoreSupport.js.map +1 -1
  85. package/lib/exposedInternalTypes.d.ts +22 -4
  86. package/lib/exposedInternalTypes.d.ts.map +1 -1
  87. package/lib/exposedInternalTypes.js.map +1 -1
  88. package/lib/exposedUtilityTypes.d.ts +6 -5
  89. package/lib/exposedUtilityTypes.d.ts.map +1 -1
  90. package/lib/exposedUtilityTypes.js.map +1 -1
  91. package/lib/internalTypes.d.ts +11 -9
  92. package/lib/internalTypes.d.ts.map +1 -1
  93. package/lib/internalTypes.js.map +1 -1
  94. package/lib/internalUtils.d.ts +26 -8
  95. package/lib/internalUtils.d.ts.map +1 -1
  96. package/lib/internalUtils.js +31 -7
  97. package/lib/internalUtils.js.map +1 -1
  98. package/lib/latestMapValueManager.d.ts +28 -7
  99. package/lib/latestMapValueManager.d.ts.map +1 -1
  100. package/lib/latestMapValueManager.js +11 -10
  101. package/lib/latestMapValueManager.js.map +1 -1
  102. package/lib/latestValueManager.d.ts +17 -3
  103. package/lib/latestValueManager.d.ts.map +1 -1
  104. package/lib/latestValueManager.js +19 -9
  105. package/lib/latestValueManager.js.map +1 -1
  106. package/lib/latestValueTypes.d.ts +11 -1
  107. package/lib/latestValueTypes.d.ts.map +1 -1
  108. package/lib/latestValueTypes.js.map +1 -1
  109. package/lib/notificationsManager.d.ts +2 -2
  110. package/lib/notificationsManager.d.ts.map +1 -1
  111. package/lib/notificationsManager.js +14 -7
  112. package/lib/notificationsManager.js.map +1 -1
  113. package/lib/presence.d.ts +7 -5
  114. package/lib/presence.d.ts.map +1 -1
  115. package/lib/presence.js.map +1 -1
  116. package/lib/presenceDatastoreManager.d.ts +5 -6
  117. package/lib/presenceDatastoreManager.d.ts.map +1 -1
  118. package/lib/presenceDatastoreManager.js +20 -8
  119. package/lib/presenceDatastoreManager.js.map +1 -1
  120. package/lib/presenceManager.d.ts +0 -4
  121. package/lib/presenceManager.d.ts.map +1 -1
  122. package/lib/presenceManager.js +1 -3
  123. package/lib/presenceManager.js.map +1 -1
  124. package/lib/presenceStates.d.ts +9 -14
  125. package/lib/presenceStates.d.ts.map +1 -1
  126. package/lib/presenceStates.js +1 -8
  127. package/lib/presenceStates.js.map +1 -1
  128. package/lib/protocol.d.ts +37 -12
  129. package/lib/protocol.d.ts.map +1 -1
  130. package/lib/protocol.js +6 -2
  131. package/lib/protocol.js.map +1 -1
  132. package/lib/stateDatastore.d.ts +9 -8
  133. package/lib/stateDatastore.d.ts.map +1 -1
  134. package/lib/stateDatastore.js +0 -4
  135. package/lib/stateDatastore.js.map +1 -1
  136. package/lib/systemWorkspace.d.ts +12 -6
  137. package/lib/systemWorkspace.d.ts.map +1 -1
  138. package/lib/systemWorkspace.js +14 -4
  139. package/lib/systemWorkspace.js.map +1 -1
  140. package/lib/types.d.ts +3 -2
  141. package/lib/types.d.ts.map +1 -1
  142. package/lib/types.js.map +1 -1
  143. package/lib/valueManager.d.ts +0 -4
  144. package/lib/valueManager.d.ts.map +1 -1
  145. package/lib/valueManager.js +0 -4
  146. package/lib/valueManager.js.map +1 -1
  147. package/package.json +17 -17
package/dist/protocol.js CHANGED
@@ -4,13 +4,17 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.joinMessageType = exports.datastoreUpdateMessageType = void 0;
7
+ exports.acknowledgementMessageType = exports.joinMessageType = exports.datastoreUpdateMessageType = void 0;
8
8
  /**
9
- * @internal
9
+ * Datastore update message type.
10
10
  */
11
11
  exports.datastoreUpdateMessageType = "Pres:DatastoreUpdate";
12
12
  /**
13
- * @internal
13
+ * Client join message type.
14
14
  */
15
15
  exports.joinMessageType = "Pres:ClientJoin";
16
+ /**
17
+ * Acknowledgement message type.
18
+ */
19
+ exports.acknowledgementMessageType = "Pres:Ack";
16
20
  //# sourceMappingURL=protocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgCH;;GAEG;AACU,QAAA,0BAA0B,GAAG,sBAAsB,CAAC;AAsBjE;;GAEG;AACU,QAAA,eAAe,GAAG,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tOutboundExtensionMessage,\n\tVerifiedInboundExtensionMessage,\n} from \"@fluidframework/container-runtime-definitions/internal\";\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type { AttendeeId } from \"./presence.js\";\nimport type { ClientUpdateEntry } from \"./presenceStates.js\";\nimport type { SystemWorkspaceDatastore } from \"./systemWorkspace.js\";\n\n/**\n * @internal\n */\nexport interface SystemDatastore {\n\t\"system:presence\": SystemWorkspaceDatastore;\n}\n\n/**\n * @internal\n */\nexport interface GeneralDatastoreMessageContent {\n\t[WorkspaceAddress: string]: {\n\t\t[StateValueManagerKey: string]: {\n\t\t\t[AttendeeId: AttendeeId]: ClientUpdateEntry;\n\t\t};\n\t};\n}\n\ntype DatastoreMessageContent = GeneralDatastoreMessageContent & SystemDatastore;\n\n/**\n * @internal\n */\nexport const datastoreUpdateMessageType = \"Pres:DatastoreUpdate\";\ninterface DatastoreUpdateMessage {\n\ttype: typeof datastoreUpdateMessageType;\n\tcontent: {\n\t\tsendTimestamp: number;\n\t\tavgLatency: number;\n\t\tisComplete?: true;\n\t\tdata: DatastoreMessageContent;\n\t};\n}\n\n/**\n * @internal\n */\nexport type OutboundDatastoreUpdateMessage = OutboundExtensionMessage<DatastoreUpdateMessage>;\n\n/**\n * @internal\n */\nexport type InboundDatastoreUpdateMessage =\n\tVerifiedInboundExtensionMessage<DatastoreUpdateMessage>;\n\n/**\n * @internal\n */\nexport const joinMessageType = \"Pres:ClientJoin\";\ninterface ClientJoinMessage {\n\ttype: typeof joinMessageType;\n\tcontent: {\n\t\tupdateProviders: ClientConnectionId[];\n\t\tsendTimestamp: number;\n\t\tavgLatency: number;\n\t\tdata: DatastoreMessageContent;\n\t};\n}\n\n/**\n * @internal\n */\nexport type OutboundClientJoinMessage = OutboundExtensionMessage<ClientJoinMessage>;\n\n/**\n * @internal\n */\nexport type InboundClientJoinMessage = VerifiedInboundExtensionMessage<ClientJoinMessage>;\n\n/**\n * @internal\n */\nexport type SignalMessages = ClientJoinMessage | DatastoreUpdateMessage;\n"]}
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAuCH;;GAEG;AACU,QAAA,0BAA0B,GAAG,sBAAsB,CAAC;AAuBjE;;GAEG;AACU,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAWjD;;GAEG;AACU,QAAA,0BAA0B,GAAG,UAAU,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tOutboundExtensionMessage,\n\tVerifiedInboundExtensionMessage,\n} from \"@fluidframework/container-runtime-definitions/internal\";\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type { AttendeeId } from \"./presence.js\";\nimport type { ClientUpdateEntry } from \"./presenceStates.js\";\nimport type { SystemWorkspaceDatastore } from \"./systemWorkspace.js\";\nimport type { WorkspaceAddress } from \"./types.js\";\n\n/**\n * Datastore that contains system workspace data\n */\nexport interface SystemDatastore {\n\t\"system:presence\": SystemWorkspaceDatastore;\n}\n\n/**\n * Expected address format for general workspaces in the presence protocol.\n */\nexport type InternalWorkspaceAddress = `${\"s\" | \"n\"}:${WorkspaceAddress}`;\n\n/**\n * General datastore (and message) structure.\n */\nexport interface GeneralDatastoreMessageContent {\n\t[WorkspaceAddress: InternalWorkspaceAddress]: {\n\t\t[StateValueManagerKey: string]: {\n\t\t\t[AttendeeId: AttendeeId]: ClientUpdateEntry;\n\t\t};\n\t};\n}\n\ntype DatastoreMessageContent = SystemDatastore & GeneralDatastoreMessageContent;\ntype AcknowledgmentId = string;\n\n/**\n * Datastore update message type.\n */\nexport const datastoreUpdateMessageType = \"Pres:DatastoreUpdate\";\ninterface DatastoreUpdateMessage {\n\ttype: typeof datastoreUpdateMessageType;\n\tcontent: {\n\t\tsendTimestamp: number;\n\t\tavgLatency: number;\n\t\tacknowledgementId?: AcknowledgmentId;\n\t\tisComplete?: true;\n\t\tdata: DatastoreMessageContent;\n\t};\n}\n\n/**\n * Outbound datastore update message\n */\nexport type OutboundDatastoreUpdateMessage = OutboundExtensionMessage<DatastoreUpdateMessage>;\n\n/**\n * Inbound and verified datastore update message\n */\nexport type InboundDatastoreUpdateMessage =\n\tVerifiedInboundExtensionMessage<DatastoreUpdateMessage>;\n\n/**\n * Client join message type.\n */\nexport const joinMessageType = \"Pres:ClientJoin\";\ninterface ClientJoinMessage {\n\ttype: typeof joinMessageType;\n\tcontent: {\n\t\tupdateProviders: ClientConnectionId[];\n\t\tsendTimestamp: number;\n\t\tavgLatency: number;\n\t\tdata: DatastoreMessageContent;\n\t};\n}\n\n/**\n * Acknowledgement message type.\n */\nexport const acknowledgementMessageType = \"Pres:Ack\";\n\ninterface AcknowledgementMessage {\n\ttype: typeof acknowledgementMessageType;\n\tcontent: {\n\t\tid: AcknowledgmentId;\n\t};\n}\n\n/**\n * Outbound acknowledgement message.\n */\nexport type OutboundAcknowledgementMessage = OutboundExtensionMessage<AcknowledgementMessage>;\n\n/**\n * Outbound client join message\n */\nexport type OutboundClientJoinMessage = OutboundExtensionMessage<ClientJoinMessage>;\n\n/**\n * Inbound and verified client join message\n */\nexport type InboundClientJoinMessage = VerifiedInboundExtensionMessage<ClientJoinMessage>;\n\n/**\n * Outbound presence message.\n */\nexport type OutboundPresenceMessage =\n\t| OutboundAcknowledgementMessage\n\t| OutboundClientJoinMessage\n\t| OutboundDatastoreUpdateMessage;\n\n/**\n * Messages structures that can be sent and received as understood in the presence protocol\n */\nexport type SignalMessages =\n\t| AcknowledgementMessage\n\t| ClientJoinMessage\n\t| DatastoreUpdateMessage;\n"]}
@@ -5,11 +5,16 @@
5
5
  import type { ClientConnectionId } from "./baseTypes.js";
6
6
  import type { InternalTypes } from "./exposedInternalTypes.js";
7
7
  import type { ClientRecord } from "./internalTypes.js";
8
- import type { Attendee, AttendeeId, PresenceWithNotifications as Presence } from "./presence.js";
8
+ import type { AttendeeId, PresenceWithNotifications as Presence } from "./presence.js";
9
9
  /**
10
- * @internal
10
+ * Miscellaneous options for local state updates
11
11
  */
12
12
  export interface LocalStateUpdateOptions {
13
+ /**
14
+ * When defined, this is the maximum time in milliseconds that this
15
+ * update is allowed to be delayed before it must be sent to service.
16
+ * When `undefined`, the callee may determine maximum delay.
17
+ */
13
18
  allowableUpdateLatencyMs: number | undefined;
14
19
  /**
15
20
  * Special option allowed for unicast notifications.
@@ -17,7 +22,8 @@ export interface LocalStateUpdateOptions {
17
22
  targetClientId?: ClientConnectionId;
18
23
  }
19
24
  /**
20
- * @internal
25
+ * Contract for States Workspace to support State Manager access to
26
+ * datastore and general internal presence knowledge.
21
27
  */
22
28
  export interface StateDatastore<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<any>> {
23
29
  readonly presence: Presence;
@@ -29,18 +35,13 @@ export interface StateDatastore<TKey extends string, TValue extends InternalType
29
35
  self: AttendeeId | undefined;
30
36
  states: ClientRecord<TValue>;
31
37
  };
32
- lookupClient(clientId: ClientConnectionId): Attendee;
33
38
  }
34
39
  /**
35
40
  * Helper to get a handle from a datastore.
36
- *
37
- * @internal
38
41
  */
39
42
  export declare function handleFromDatastore<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<unknown>>(datastore: StateDatastore<TKey, TValue>): InternalTypes.StateDatastoreHandle<TKey, Exclude<TValue, undefined>>;
40
43
  /**
41
44
  * Helper to get the datastore back from its handle.
42
- *
43
- * @internal
44
45
  */
45
46
  export declare function datastoreFromHandle<TKey extends string, TValue extends InternalTypes.ValueDirectoryOrState<any>>(handle: InternalTypes.StateDatastoreHandle<TKey, TValue>): StateDatastore<TKey, TValue>;
46
47
  //# sourceMappingURL=stateDatastore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stateDatastore.d.ts","sourceRoot":"","sources":["../src/stateDatastore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EACX,QAAQ,EACR,UAAU,EACV,yBAAyB,IAAI,QAAQ,EACrC,MAAM,eAAe,CAAC;AAiBvB;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,wBAAwB,EAAE,MAAM,GAAG,SAAS,CAAC;IAE7C;;OAEG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAC9B,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,aAAa,CAAC,qBAAqB,CAAC,GAAG,CAAC;IAEvD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,WAAW,CACV,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,MAAM,GAAG;QACf,iBAAiB,CAAC,EAAE,IAAI,CAAC;KACzB,EACD,OAAO,EAAE,uBAAuB,GAC9B,IAAI,CAAC;IACR,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/D,WAAW,CAAC,GAAG,EAAE,IAAI,GAAG;QACvB,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;QAC7B,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;KAC7B,CAA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AAC;IAC5B,WAAW,CACV,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,MAAM,GAAG;QACf,iBAAiB,CAAC,EAAE,IAAI,CAAC;KACzB,EACD,OAAO,EAAE,uBAAuB,GAC9B,IAAI,CAAC;IACR,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/D,WAAW,CAAC,GAAG,EAAE,IAAI,GAAG;QACvB,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;QAC7B,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;KAC7B,CAAC;CACF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAIlC,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,aAAa,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAE3D,SAAS,EAAE,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,GACrC,aAAa,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAKtE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,aAAa,CAAC,qBAAqB,CAAC,GAAG,CAAC,EACtD,MAAM,EAAE,aAAa,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAExF"}
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.datastoreFromHandle = exports.handleFromDatastore = void 0;
8
8
  /**
9
9
  * Helper to get a handle from a datastore.
10
- *
11
- * @internal
12
10
  */
13
11
  function handleFromDatastore(datastore) {
14
12
  return datastore;
@@ -16,8 +14,6 @@ function handleFromDatastore(datastore) {
16
14
  exports.handleFromDatastore = handleFromDatastore;
17
15
  /**
18
16
  * Helper to get the datastore back from its handle.
19
- *
20
- * @internal
21
17
  */
22
18
  function datastoreFromHandle(handle) {
23
19
  return handle;
@@ -1 +1 @@
1
- {"version":3,"file":"stateDatastore.js","sourceRoot":"","sources":["../src/stateDatastore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA6DH;;;;GAIG;AACH,SAAgB,mBAAmB,CAOlC,SAAuC;IAEvC,OAAO,SAGN,CAAC;AACH,CAAC;AAbD,kDAaC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAGjC,MAAwD;IACzD,OAAO,MAAiD,CAAC;AAC1D,CAAC;AALD,kDAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { ClientRecord } from \"./internalTypes.js\";\nimport type {\n\tAttendee,\n\tAttendeeId,\n\tPresenceWithNotifications as Presence,\n} from \"./presence.js\";\n\n// type StateDatastoreSchemaNode<\n// \tTValue extends InternalTypes.ValueDirectoryOrState<any> = InternalTypes.ValueDirectoryOrState<unknown>,\n// > = TValue extends InternalTypes.ValueDirectoryOrState<infer T> ? InternalTypes.ValueDirectoryOrState<T> : never;\n\n// /**\n// * @internal\n// */\n// export interface StateDatastoreSchema {\n// \t// This type is not precise. It may\n// \t// need to be replaced with StatesWorkspace schema pattern\n// \t// similar to what is commented out.\n// \t[key: string]: InternalTypes.ValueDirectoryOrState<unknown>;\n// \t// [key: string]: StateDatastoreSchemaNode;\n// }\n\n/**\n * @internal\n */\nexport interface LocalStateUpdateOptions {\n\tallowableUpdateLatencyMs: number | undefined;\n\n\t/**\n\t * Special option allowed for unicast notifications.\n\t */\n\ttargetClientId?: ClientConnectionId;\n}\n\n/**\n * @internal\n */\nexport interface StateDatastore<\n\tTKey extends string,\n\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n> {\n\treadonly presence: Presence;\n\tlocalUpdate(\n\t\tkey: TKey,\n\t\tvalue: TValue & {\n\t\t\tignoreUnmonitored?: true;\n\t\t},\n\t\toptions: LocalStateUpdateOptions,\n\t): void;\n\tupdate(key: TKey, attendeeId: AttendeeId, value: TValue): void;\n\tknownValues(key: TKey): {\n\t\tself: AttendeeId | undefined;\n\t\tstates: ClientRecord<TValue>;\n\t};\n\tlookupClient(clientId: ClientConnectionId): Attendee;\n}\n\n/**\n * Helper to get a handle from a datastore.\n *\n * @internal\n */\nexport function handleFromDatastore<\n\t// Constraining TSchema would be great, but it seems nested types (at least with undefined) cause trouble.\n\t// TSchema as `unknown` still provides some type safety.\n\t// TSchema extends StateDatastoreSchema,\n\tTKey extends string /* & keyof TSchema */,\n\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n>(\n\tdatastore: StateDatastore<TKey, TValue>,\n): InternalTypes.StateDatastoreHandle<TKey, Exclude<TValue, undefined>> {\n\treturn datastore as unknown as InternalTypes.StateDatastoreHandle<\n\t\tTKey,\n\t\tExclude<TValue, undefined>\n\t>;\n}\n\n/**\n * Helper to get the datastore back from its handle.\n *\n * @internal\n */\nexport function datastoreFromHandle<\n\tTKey extends string,\n\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n>(handle: InternalTypes.StateDatastoreHandle<TKey, TValue>): StateDatastore<TKey, TValue> {\n\treturn handle as unknown as StateDatastore<TKey, TValue>;\n}\n"]}
1
+ {"version":3,"file":"stateDatastore.js","sourceRoot":"","sources":["../src/stateDatastore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA2DH;;GAEG;AACH,SAAgB,mBAAmB,CAOlC,SAAuC;IAEvC,OAAO,SAGN,CAAC;AACH,CAAC;AAbD,kDAaC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAGjC,MAAwD;IACzD,OAAO,MAAiD,CAAC;AAC1D,CAAC;AALD,kDAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { ClientRecord } from \"./internalTypes.js\";\nimport type { AttendeeId, PresenceWithNotifications as Presence } from \"./presence.js\";\n\n// type StateDatastoreSchemaNode<\n// \tTValue extends InternalTypes.ValueDirectoryOrState<any> = InternalTypes.ValueDirectoryOrState<unknown>,\n// > = TValue extends InternalTypes.ValueDirectoryOrState<infer T> ? InternalTypes.ValueDirectoryOrState<T> : never;\n\n// export interface StateDatastoreSchema {\n// \t// This type is not precise. It may\n// \t// need to be replaced with StatesWorkspace schema pattern\n// \t// similar to what is commented out.\n// \t[key: string]: InternalTypes.ValueDirectoryOrState<unknown>;\n// \t// [key: string]: StateDatastoreSchemaNode;\n// }\n\n/**\n * Miscellaneous options for local state updates\n */\nexport interface LocalStateUpdateOptions {\n\t/**\n\t * When defined, this is the maximum time in milliseconds that this\n\t * update is allowed to be delayed before it must be sent to service.\n\t * When `undefined`, the callee may determine maximum delay.\n\t */\n\tallowableUpdateLatencyMs: number | undefined;\n\n\t/**\n\t * Special option allowed for unicast notifications.\n\t */\n\ttargetClientId?: ClientConnectionId;\n}\n\n/**\n * Contract for States Workspace to support State Manager access to\n * datastore and general internal presence knowledge.\n */\nexport interface StateDatastore<\n\tTKey extends string,\n\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n> {\n\treadonly presence: Presence;\n\tlocalUpdate(\n\t\tkey: TKey,\n\t\tvalue: TValue & {\n\t\t\tignoreUnmonitored?: true;\n\t\t},\n\t\toptions: LocalStateUpdateOptions,\n\t): void;\n\tupdate(key: TKey, attendeeId: AttendeeId, value: TValue): void;\n\tknownValues(key: TKey): {\n\t\tself: AttendeeId | undefined;\n\t\tstates: ClientRecord<TValue>;\n\t};\n}\n\n/**\n * Helper to get a handle from a datastore.\n */\nexport function handleFromDatastore<\n\t// Constraining TSchema would be great, but it seems nested types (at least with undefined) cause trouble.\n\t// TSchema as `unknown` still provides some type safety.\n\t// TSchema extends StateDatastoreSchema,\n\tTKey extends string /* & keyof TSchema */,\n\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n>(\n\tdatastore: StateDatastore<TKey, TValue>,\n): InternalTypes.StateDatastoreHandle<TKey, Exclude<TValue, undefined>> {\n\treturn datastore as unknown as InternalTypes.StateDatastoreHandle<\n\t\tTKey,\n\t\tExclude<TValue, undefined>\n\t>;\n}\n\n/**\n * Helper to get the datastore back from its handle.\n */\nexport function datastoreFromHandle<\n\tTKey extends string,\n\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n>(handle: InternalTypes.StateDatastoreHandle<TKey, TValue>): StateDatastore<TKey, TValue> {\n\treturn handle as unknown as StateDatastore<TKey, TValue>;\n}\n"]}
@@ -10,17 +10,24 @@ import type { AttendeesEvents, AttendeeId, Presence } from "./presence.js";
10
10
  import type { PresenceStatesInternal } from "./presenceStates.js";
11
11
  import type { AnyWorkspace, StatesWorkspaceSchema } from "./types.js";
12
12
  /**
13
- * The system workspace's datastore structure.
13
+ * `ConnectionValueState` is known value state for `clientToSessionId` data.
14
14
  *
15
- * @internal
15
+ * @remarks
16
+ * It is {@link InternalTypes.ValueRequiredState} with a known value type.
17
+ */
18
+ interface ConnectionValueState extends InternalTypes.ValueStateMetadata {
19
+ value: AttendeeId;
20
+ }
21
+ /**
22
+ * The system workspace's datastore structure.
16
23
  */
17
24
  export interface SystemWorkspaceDatastore {
18
25
  clientToSessionId: {
19
- [ConnectionId: ClientConnectionId]: InternalTypes.ValueRequiredState<AttendeeId>;
26
+ [ConnectionId: ClientConnectionId]: ConnectionValueState;
20
27
  };
21
28
  }
22
29
  /**
23
- * @internal
30
+ * Internal workspace that manages metadata for session attendees.
24
31
  */
25
32
  export interface SystemWorkspace extends Exclude<Presence["attendees"], never> {
26
33
  /**
@@ -38,8 +45,6 @@ export interface SystemWorkspace extends Exclude<Presence["attendees"], never> {
38
45
  }
39
46
  /**
40
47
  * Instantiates the system workspace.
41
- *
42
- * @internal
43
48
  */
44
49
  export declare function createSystemWorkspace(attendeeId: AttendeeId, datastore: SystemWorkspaceDatastore, events: Listenable<AttendeesEvents> & IEmitter<AttendeesEvents>, audience: IAudience): {
45
50
  workspace: SystemWorkspace;
@@ -48,4 +53,5 @@ export declare function createSystemWorkspace(attendeeId: AttendeeId, datastore:
48
53
  public: AnyWorkspace<StatesWorkspaceSchema>;
49
54
  };
50
55
  };
56
+ export {};
51
57
  //# sourceMappingURL=systemWorkspace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"systemWorkspace.d.ts","sourceRoot":"","sources":["../src/systemWorkspace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAGrF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,KAAK,EAAY,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAErF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACxC,iBAAiB,EAAE;QAClB,CAAC,YAAY,EAAE,kBAAkB,GAAG,aAAa,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;KACjF,CAAC;CACF;AAoCD;;GAEG;AACH,MAAM,WAAW,eAGhB,SAAQ,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IAC7C;;;;OAIG;IACH,iBAAiB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAEhE;;;;OAIG;IACH,wBAAwB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACvE;AA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;;;OAIG;IACH,iBAAiB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAEhE;;;;OAIG;IACH,wBAAwB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACvE;AAqND;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,wBAAwB,EACnC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC,EAC/D,QAAQ,EAAE,SAAS,GACjB;IACF,SAAS,EAAE,eAAe,CAAC;IAC3B,WAAW,EAAE;QACZ,QAAQ,EAAE,sBAAsB,CAAC;QACjC,MAAM,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAC;KAC5C,CAAC;CACF,CASA"}
@@ -6,6 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.createSystemWorkspace = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
+ const internalUtils_js_1 = require("./internalUtils.js");
9
10
  const presence_js_1 = require("./presence.js");
10
11
  const timerManager_js_1 = require("./timerManager.js");
11
12
  class SessionClient {
@@ -58,10 +59,21 @@ class SystemWorkspaceImpl {
58
59
  ensureContent(_content) {
59
60
  throw new Error("Method not implemented.");
60
61
  }
61
- processUpdate(_received, _timeModifier, remoteDatastore, senderConnectionId) {
62
+ processUpdate(_received, _timeModifier,
63
+ /**
64
+ * Remote datastore typed to match {@link PresenceStatesInternal.processUpdate}'s
65
+ * `ValueUpdateRecord` type that uses {@link InternalTypes.ValueRequiredState}
66
+ * and expects an Opaque JSON type. (We get away with a non-`unknown` value type
67
+ * per TypeScript's method parameter bivariance.) Proper type would be
68
+ * {@link ConnectionValueState} directly.
69
+ * {@link ClientConnectionId} use for index is also a deviation, but conveniently
70
+ * the accurate {@link AttendeeId} type is just a branded string, and
71
+ * {@link ClientConnectionId} is just `string`.
72
+ */
73
+ remoteDatastore, senderConnectionId) {
62
74
  const audienceMembers = this.audience.getMembers();
63
75
  const postUpdateActions = [];
64
- for (const [clientConnectionId, value] of Object.entries(remoteDatastore.clientToSessionId)) {
76
+ for (const [clientConnectionId, value] of Object.entries((0, internalUtils_js_1.revealOpaqueJson)(remoteDatastore.clientToSessionId))) {
65
77
  const attendeeId = value.value;
66
78
  const { attendee, isJoining } = this.ensureAttendee(attendeeId, clientConnectionId,
67
79
  /* order */ value.rev,
@@ -186,8 +198,6 @@ class SystemWorkspaceImpl {
186
198
  }
187
199
  /**
188
200
  * Instantiates the system workspace.
189
- *
190
- * @internal
191
201
  */
192
202
  function createSystemWorkspace(attendeeId, datastore, events, audience) {
193
203
  const workspace = new SystemWorkspaceImpl(attendeeId, datastore, events, audience);
@@ -1 +1 @@
1
- {"version":3,"file":"systemWorkspace.js","sourceRoot":"","sources":["../src/systemWorkspace.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,kEAA6D;AAM7D,+CAA+C;AAE/C,uDAAiD;AAcjD,MAAM,aAAa;IASlB,YACiB,UAAsB,EAC/B,eAA+C,SAAS;QAD/C,eAAU,GAAV,UAAU,CAAY;QAC/B,iBAAY,GAAZ,YAAY,CAA4C;QAVhE;;;WAGG;QACI,UAAK,GAAW,CAAC,CAAC;QAEjB,qBAAgB,GAAmB,4BAAc,CAAC,YAAY,CAAC;IAKpE,CAAC;IAEG,eAAe;QACrB,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAEM,mBAAmB;QACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC9B,CAAC;IAEM,YAAY;QAClB,IAAI,CAAC,gBAAgB,GAAG,4BAAc,CAAC,SAAS,CAAC;IAClD,CAAC;IAEM,eAAe;QACrB,IAAI,CAAC,gBAAgB,GAAG,4BAAc,CAAC,YAAY,CA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AAC,KAAK,GAAG,KAAK,CAAC;YACvB,2EAA2E;YAC3E,IAAI,QAAQ,CAAC,mBAAmB,EAAE,KAAK,4BAAc,CAAC,YAAY,IAAI,WAAW,EAAE,CAAC;gBACnF,QAAQ,CAAC,YAAY,EAAE,CAAC;gBACxB,SAAS,GAAG,IAAI,CAAC;YAClB,CAAC;YACD,QAAQ,CAAC,YAAY,GAAG,kBAAkB,CAAC;QAC5C,CAAC;QAED,IAAI,WAAW,EAAE,CAAC;YACjB,0EAA0E;YAC1E,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC9C,CAAC;QAED,oEAAoE;QACpE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;QAEjD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAChC,CAAC;CACD;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CACpC,UAAsB,EACtB,SAAmC,EACnC,MAA+D,EAC/D,QAAmB;IAQnB,MAAM,SAAS,GAAG,IAAI,mBAAmB,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACnF,OAAO;QACN,SAAS;QACT,WAAW,EAAE;YACZ,QAAQ,EAAE,SAAS;YACnB,MAAM,EAAE,SAA2D;SACnE;KACD,CAAC;AACH,CAAC;AApBD,sDAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IAudience } from \"@fluidframework/container-definitions\";\nimport type { IEmitter, Listenable } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { PostUpdateAction } from \"./internalTypes.js\";\nimport type { Attendee, AttendeesEvents, AttendeeId, Presence } from \"./presence.js\";\nimport { AttendeeStatus } from \"./presence.js\";\nimport type { PresenceStatesInternal } from \"./presenceStates.js\";\nimport { TimerManager } from \"./timerManager.js\";\nimport type { AnyWorkspace, StatesWorkspaceSchema } from \"./types.js\";\n\n/**\n * The system workspace's datastore structure.\n *\n * @internal\n */\nexport interface SystemWorkspaceDatastore {\n\tclientToSessionId: {\n\t\t[ConnectionId: ClientConnectionId]: InternalTypes.ValueRequiredState<AttendeeId>;\n\t};\n}\n\nclass SessionClient implements Attendee {\n\t/**\n\t * Order is used to track the most recent client connection\n\t * during a session.\n\t */\n\tpublic order: number = 0;\n\n\tprivate connectionStatus: AttendeeStatus = AttendeeStatus.Disconnected;\n\n\tpublic constructor(\n\t\tpublic readonly attendeeId: AttendeeId,\n\t\tpublic connectionId: ClientConnectionId | undefined = undefined,\n\t) {}\n\n\tpublic getConnectionId(): ClientConnectionId {\n\t\tif (this.connectionId === undefined) {\n\t\t\tthrow new Error(\"Client has never been connected\");\n\t\t}\n\t\treturn this.connectionId;\n\t}\n\n\tpublic getConnectionStatus(): AttendeeStatus {\n\t\treturn this.connectionStatus;\n\t}\n\n\tpublic setConnected(): void {\n\t\tthis.connectionStatus = AttendeeStatus.Connected;\n\t}\n\n\tpublic setDisconnected(): void {\n\t\tthis.connectionStatus = AttendeeStatus.Disconnected;\n\t}\n}\n\n/**\n * @internal\n */\nexport interface SystemWorkspace\n\t// Portion of Presence that is handled by SystemWorkspace along with\n\t// responsibility for emitting \"attendeeConnected\" events.\n\textends Exclude<Presence[\"attendees\"], never> {\n\t/**\n\t * Must be called when the current client acquires a new connection.\n\t *\n\t * @param clientConnectionId - The new client connection ID.\n\t */\n\tonConnectionAdded(clientConnectionId: ClientConnectionId): void;\n\n\t/**\n\t * Removes the client connection ID from the system workspace.\n\t *\n\t * @param clientConnectionId - The client connection ID to remove.\n\t */\n\tremoveClientConnectionId(clientConnectionId: ClientConnectionId): void;\n}\n\nclass SystemWorkspaceImpl implements PresenceStatesInternal, SystemWorkspace {\n\tprivate readonly selfAttendee: SessionClient;\n\t/**\n\t * `attendees` is this client's understanding of the attendees in the\n\t * session. The map covers entries for both session ids and connection\n\t * ids, which are never expected to collide, but if they did for same\n\t * client that would be fine.\n\t * An entry is for session ID if the value's `attendeeId` matches the key.\n\t */\n\tprivate readonly attendees = new Map<ClientConnectionId | AttendeeId, SessionClient>();\n\n\t// When local client disconnects, we lose the connectivity status updates for remote attendees in the session.\n\t// Upon reconnect, we mark all other attendees connections as stale and update their status to disconnected after 30 seconds of inactivity.\n\tprivate readonly staleConnectionClients = new Set<SessionClient>();\n\n\tprivate readonly staleConnectionTimer = new TimerManager();\n\n\tpublic constructor(\n\t\tattendeeId: AttendeeId,\n\t\tprivate readonly datastore: SystemWorkspaceDatastore,\n\t\tpublic readonly events: Listenable<AttendeesEvents> & IEmitter<AttendeesEvents>,\n\t\tprivate readonly audience: IAudience,\n\t) {\n\t\tthis.selfAttendee = new SessionClient(attendeeId);\n\t\tthis.attendees.set(attendeeId, this.selfAttendee);\n\t}\n\n\tpublic ensureContent<TSchemaAdditional extends StatesWorkspaceSchema>(\n\t\t_content: TSchemaAdditional,\n\t): never {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic processUpdate(\n\t\t_received: number,\n\t\t_timeModifier: number,\n\t\tremoteDatastore: {\n\t\t\tclientToSessionId: {\n\t\t\t\t[ConnectionId: ClientConnectionId]: InternalTypes.ValueRequiredState<AttendeeId> & {\n\t\t\t\t\tignoreUnmonitored?: true;\n\t\t\t\t};\n\t\t\t};\n\t\t},\n\t\tsenderConnectionId: ClientConnectionId,\n\t): PostUpdateAction[] {\n\t\tconst audienceMembers = this.audience.getMembers();\n\t\tconst postUpdateActions: PostUpdateAction[] = [];\n\t\tfor (const [clientConnectionId, value] of Object.entries(\n\t\t\tremoteDatastore.clientToSessionId,\n\t\t)) {\n\t\t\tconst attendeeId = value.value;\n\t\t\tconst { attendee, isJoining } = this.ensureAttendee(\n\t\t\t\tattendeeId,\n\t\t\t\tclientConnectionId,\n\t\t\t\t/* order */ value.rev,\n\t\t\t\t// If the attendee is present in audience OR if the attendee update is from the sending remote client itself,\n\t\t\t\t// then the attendee is considered connected.\n\t\t\t\t/* isConnected */ senderConnectionId === clientConnectionId ||\n\t\t\t\t\taudienceMembers.has(clientConnectionId),\n\t\t\t);\n\t\t\t// If the attendee is joining the session, add them to the list of joining attendees to be announced later.\n\t\t\tif (isJoining) {\n\t\t\t\tpostUpdateActions.push(() => this.events.emit(\"attendeeConnected\", attendee));\n\t\t\t}\n\n\t\t\tconst knownSessionId: InternalTypes.ValueRequiredState<AttendeeId> | undefined =\n\t\t\t\tthis.datastore.clientToSessionId[clientConnectionId];\n\t\t\tif (knownSessionId === undefined) {\n\t\t\t\tthis.datastore.clientToSessionId[clientConnectionId] = value;\n\t\t\t} else {\n\t\t\t\tassert(knownSessionId.value === value.value, 0xa5a /* Mismatched SessionId */);\n\t\t\t}\n\t\t}\n\n\t\treturn postUpdateActions;\n\t}\n\n\tpublic onConnectionAdded(clientConnectionId: ClientConnectionId): void {\n\t\tassert(\n\t\t\tthis.selfAttendee.getConnectionStatus() === AttendeeStatus.Disconnected,\n\t\t\t0xaad /* Local client should be 'Disconnected' before adding new connection. */,\n\t\t);\n\n\t\tthis.datastore.clientToSessionId[clientConnectionId] = {\n\t\t\trev: this.selfAttendee.order++,\n\t\t\ttimestamp: Date.now(),\n\t\t\tvalue: this.selfAttendee.attendeeId,\n\t\t};\n\n\t\t// Mark 'Connected' remote attendees connections as stale\n\t\tfor (const staleConnectionClient of this.attendees.values()) {\n\t\t\tif (staleConnectionClient.getConnectionStatus() === AttendeeStatus.Connected) {\n\t\t\t\tthis.staleConnectionClients.add(staleConnectionClient);\n\t\t\t}\n\t\t}\n\n\t\t// Update the self attendee\n\t\tthis.selfAttendee.connectionId = clientConnectionId;\n\t\tthis.selfAttendee.setConnected();\n\t\tthis.attendees.set(clientConnectionId, this.selfAttendee);\n\n\t\tthis.staleConnectionTimer.setTimeout(() => {\n\t\t\tfor (const client of this.staleConnectionClients) {\n\t\t\t\tclient.setDisconnected();\n\t\t\t}\n\t\t\tfor (const client of this.staleConnectionClients) {\n\t\t\t\tthis.events.emit(\"attendeeDisconnected\", client);\n\t\t\t}\n\t\t\tthis.staleConnectionClients.clear();\n\t\t}, 30_000);\n\t}\n\n\tpublic removeClientConnectionId(clientConnectionId: ClientConnectionId): void {\n\t\tconst attendee = this.attendees.get(clientConnectionId);\n\t\tif (!attendee) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If the local connection is being removed, clear the stale connection timer\n\t\tif (attendee === this.selfAttendee) {\n\t\t\tthis.staleConnectionTimer.clearTimeout();\n\t\t}\n\n\t\t// If the last known connectionID is different from the connection ID being removed, the attendee has reconnected,\n\t\t// therefore we should not change the attendee connection status or emit a disconnect event.\n\t\tconst attendeeReconnected = attendee.getConnectionId() !== clientConnectionId;\n\t\tconst connected = attendee.getConnectionStatus() === AttendeeStatus.Connected;\n\t\tif (!attendeeReconnected && connected) {\n\t\t\tattendee.setDisconnected();\n\t\t\tthis.events.emit(\"attendeeDisconnected\", attendee);\n\t\t\tthis.staleConnectionClients.delete(attendee);\n\t\t}\n\t}\n\n\tpublic getAttendees(): ReadonlySet<Attendee> {\n\t\treturn new Set(this.attendees.values());\n\t}\n\n\tpublic getAttendee(clientId: ClientConnectionId | AttendeeId): Attendee {\n\t\tconst attendee = this.attendees.get(clientId);\n\t\tif (attendee) {\n\t\t\treturn attendee;\n\t\t}\n\n\t\t// TODO: Restore option to add attendee on demand to handle internal\n\t\t// lookup cases that must come from internal data.\n\t\t// There aren't any resiliency mechanisms in place to handle a missed\n\t\t// ClientJoin right now.\n\t\tthrow new Error(\"Attendee not found\");\n\t}\n\n\tpublic getMyself(): Attendee {\n\t\treturn this.selfAttendee;\n\t}\n\n\t/**\n\t * Make sure the given client session and connection ID pair are represented\n\t * in the attendee map. If not present, SessionClient is created and added\n\t * to map. If present, make sure the current connection ID is updated.\n\t */\n\tprivate ensureAttendee(\n\t\tattendeeId: AttendeeId,\n\t\tclientConnectionId: ClientConnectionId,\n\t\torder: number,\n\t\tisConnected: boolean,\n\t): { attendee: SessionClient; isJoining: boolean } {\n\t\tlet attendee = this.attendees.get(attendeeId);\n\t\tlet isJoining = false;\n\n\t\tif (attendee === undefined) {\n\t\t\t// New attendee. Create SessionClient and add session ID based\n\t\t\t// entry to map.\n\t\t\tattendee = new SessionClient(attendeeId, clientConnectionId);\n\t\t\tthis.attendees.set(attendeeId, attendee);\n\t\t\tif (isConnected) {\n\t\t\t\tattendee.setConnected();\n\t\t\t\tisJoining = true;\n\t\t\t}\n\t\t} else if (order > attendee.order) {\n\t\t\t// The given association is newer than the one we have.\n\t\t\t// Update the order and current connection ID.\n\t\t\tattendee.order = order;\n\t\t\t// Known attendee is joining the session if they are currently disconnected\n\t\t\tif (attendee.getConnectionStatus() === AttendeeStatus.Disconnected && isConnected) {\n\t\t\t\tattendee.setConnected();\n\t\t\t\tisJoining = true;\n\t\t\t}\n\t\t\tattendee.connectionId = clientConnectionId;\n\t\t}\n\n\t\tif (isConnected) {\n\t\t\t// If the attendee is connected, remove them from the stale connection set\n\t\t\tthis.staleConnectionClients.delete(attendee);\n\t\t}\n\n\t\t// Always update entry for the connection ID. (Okay if already set.)\n\t\tthis.attendees.set(clientConnectionId, attendee);\n\n\t\treturn { attendee, isJoining };\n\t}\n}\n\n/**\n * Instantiates the system workspace.\n *\n * @internal\n */\nexport function createSystemWorkspace(\n\tattendeeId: AttendeeId,\n\tdatastore: SystemWorkspaceDatastore,\n\tevents: Listenable<AttendeesEvents> & IEmitter<AttendeesEvents>,\n\taudience: IAudience,\n): {\n\tworkspace: SystemWorkspace;\n\tstatesEntry: {\n\t\tinternal: PresenceStatesInternal;\n\t\tpublic: AnyWorkspace<StatesWorkspaceSchema>;\n\t};\n} {\n\tconst workspace = new SystemWorkspaceImpl(attendeeId, datastore, events, audience);\n\treturn {\n\t\tworkspace,\n\t\tstatesEntry: {\n\t\t\tinternal: workspace,\n\t\t\tpublic: undefined as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MAAM,CAAC,QAAQ,CAAC,CAAC;QAC9C,CAAC;QAED,oEAAoE;QACpE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;QAEjD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAChC,CAAC;CACD;AAED;;GAEG;AACH,SAAgB,qBAAqB,CACpC,UAAsB,EACtB,SAAmC,EACnC,MAA+D,EAC/D,QAAmB;IAQnB,MAAM,SAAS,GAAG,IAAI,mBAAmB,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACnF,OAAO;QACN,SAAS;QACT,WAAW,EAAE;YACZ,QAAQ,EAAE,SAAS;YACnB,MAAM,EAAE,SAA2D;SACnE;KACD,CAAC;AACH,CAAC;AApBD,sDAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IAudience } from \"@fluidframework/container-definitions\";\nimport type { IEmitter, Listenable } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { ClientConnectionId } from \"./baseTypes.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { PostUpdateAction } from \"./internalTypes.js\";\nimport { revealOpaqueJson } from \"./internalUtils.js\";\nimport type { Attendee, AttendeesEvents, AttendeeId, Presence } from \"./presence.js\";\nimport { AttendeeStatus } from \"./presence.js\";\nimport type { PresenceStatesInternal } from \"./presenceStates.js\";\nimport { TimerManager } from \"./timerManager.js\";\nimport type { AnyWorkspace, StatesWorkspaceSchema } from \"./types.js\";\n\n/**\n * `ConnectionValueState` is known value state for `clientToSessionId` data.\n *\n * @remarks\n * It is {@link InternalTypes.ValueRequiredState} with a known value type.\n */\ninterface ConnectionValueState extends InternalTypes.ValueStateMetadata {\n\tvalue: AttendeeId;\n}\n\n/**\n * The system workspace's datastore structure.\n */\nexport interface SystemWorkspaceDatastore {\n\tclientToSessionId: {\n\t\t[ConnectionId: ClientConnectionId]: ConnectionValueState;\n\t};\n}\n\nclass SessionClient implements Attendee {\n\t/**\n\t * Order is used to track the most recent client connection\n\t * during a session.\n\t */\n\tpublic order: number = 0;\n\n\tprivate connectionStatus: AttendeeStatus = AttendeeStatus.Disconnected;\n\n\tpublic constructor(\n\t\tpublic readonly attendeeId: AttendeeId,\n\t\tpublic connectionId: ClientConnectionId | undefined = undefined,\n\t) {}\n\n\tpublic getConnectionId(): ClientConnectionId {\n\t\tif (this.connectionId === undefined) {\n\t\t\tthrow new Error(\"Client has never been connected\");\n\t\t}\n\t\treturn this.connectionId;\n\t}\n\n\tpublic getConnectionStatus(): AttendeeStatus {\n\t\treturn this.connectionStatus;\n\t}\n\n\tpublic setConnected(): void {\n\t\tthis.connectionStatus = AttendeeStatus.Connected;\n\t}\n\n\tpublic setDisconnected(): void {\n\t\tthis.connectionStatus = AttendeeStatus.Disconnected;\n\t}\n}\n\n/**\n * Internal workspace that manages metadata for session attendees.\n */\nexport interface SystemWorkspace\n\t// Portion of Presence that is handled by SystemWorkspace along with\n\t// responsibility for emitting \"attendeeConnected\" events.\n\textends Exclude<Presence[\"attendees\"], never> {\n\t/**\n\t * Must be called when the current client acquires a new connection.\n\t *\n\t * @param clientConnectionId - The new client connection ID.\n\t */\n\tonConnectionAdded(clientConnectionId: ClientConnectionId): void;\n\n\t/**\n\t * Removes the client connection ID from the system workspace.\n\t *\n\t * @param clientConnectionId - The client connection ID to remove.\n\t */\n\tremoveClientConnectionId(clientConnectionId: ClientConnectionId): void;\n}\n\nclass SystemWorkspaceImpl implements PresenceStatesInternal, SystemWorkspace {\n\tprivate readonly selfAttendee: SessionClient;\n\t/**\n\t * `attendees` is this client's understanding of the attendees in the\n\t * session. The map covers entries for both session ids and connection\n\t * ids, which are never expected to collide, but if they did for same\n\t * client that would be fine.\n\t * An entry is for session ID if the value's `attendeeId` matches the key.\n\t */\n\tprivate readonly attendees = new Map<ClientConnectionId | AttendeeId, SessionClient>();\n\n\t// When local client disconnects, we lose the connectivity status updates for remote attendees in the session.\n\t// Upon reconnect, we mark all other attendees connections as stale and update their status to disconnected after 30 seconds of inactivity.\n\tprivate readonly staleConnectionClients = new Set<SessionClient>();\n\n\tprivate readonly staleConnectionTimer = new TimerManager();\n\n\tpublic constructor(\n\t\tattendeeId: AttendeeId,\n\t\tprivate readonly datastore: SystemWorkspaceDatastore,\n\t\tpublic readonly events: Listenable<AttendeesEvents> & IEmitter<AttendeesEvents>,\n\t\tprivate readonly audience: IAudience,\n\t) {\n\t\tthis.selfAttendee = new SessionClient(attendeeId);\n\t\tthis.attendees.set(attendeeId, this.selfAttendee);\n\t}\n\n\tpublic ensureContent<TSchemaAdditional extends StatesWorkspaceSchema>(\n\t\t_content: TSchemaAdditional,\n\t): never {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic processUpdate(\n\t\t_received: number,\n\t\t_timeModifier: number,\n\t\t/**\n\t\t * Remote datastore typed to match {@link PresenceStatesInternal.processUpdate}'s\n\t\t * `ValueUpdateRecord` type that uses {@link InternalTypes.ValueRequiredState}\n\t\t * and expects an Opaque JSON type. (We get away with a non-`unknown` value type\n\t\t * per TypeScript's method parameter bivariance.) Proper type would be\n\t\t * {@link ConnectionValueState} directly.\n\t\t * {@link ClientConnectionId} use for index is also a deviation, but conveniently\n\t\t * the accurate {@link AttendeeId} type is just a branded string, and\n\t\t * {@link ClientConnectionId} is just `string`.\n\t\t */\n\t\tremoteDatastore: {\n\t\t\tclientToSessionId: {\n\t\t\t\t[ConnectionId: ClientConnectionId]: InternalTypes.ValueRequiredState<\n\t\t\t\t\tConnectionValueState[\"value\"]\n\t\t\t\t>;\n\t\t\t};\n\t\t},\n\t\tsenderConnectionId: ClientConnectionId,\n\t): PostUpdateAction[] {\n\t\tconst audienceMembers = this.audience.getMembers();\n\t\tconst postUpdateActions: PostUpdateAction[] = [];\n\t\tfor (const [clientConnectionId, value] of Object.entries(\n\t\t\trevealOpaqueJson(remoteDatastore.clientToSessionId),\n\t\t)) {\n\t\t\tconst attendeeId = value.value;\n\t\t\tconst { attendee, isJoining } = this.ensureAttendee(\n\t\t\t\tattendeeId,\n\t\t\t\tclientConnectionId,\n\t\t\t\t/* order */ value.rev,\n\t\t\t\t// If the attendee is present in audience OR if the attendee update is from the sending remote client itself,\n\t\t\t\t// then the attendee is considered connected.\n\t\t\t\t/* isConnected */ senderConnectionId === clientConnectionId ||\n\t\t\t\t\taudienceMembers.has(clientConnectionId),\n\t\t\t);\n\t\t\t// If the attendee is joining the session, add them to the list of joining attendees to be announced later.\n\t\t\tif (isJoining) {\n\t\t\t\tpostUpdateActions.push(() => this.events.emit(\"attendeeConnected\", attendee));\n\t\t\t}\n\n\t\t\tconst knownSessionId = this.datastore.clientToSessionId[clientConnectionId];\n\t\t\tif (knownSessionId === undefined) {\n\t\t\t\tthis.datastore.clientToSessionId[clientConnectionId] = value;\n\t\t\t} else {\n\t\t\t\tassert(knownSessionId.value === value.value, 0xa5a /* Mismatched SessionId */);\n\t\t\t}\n\t\t}\n\n\t\treturn postUpdateActions;\n\t}\n\n\tpublic onConnectionAdded(clientConnectionId: ClientConnectionId): void {\n\t\tassert(\n\t\t\tthis.selfAttendee.getConnectionStatus() === AttendeeStatus.Disconnected,\n\t\t\t0xaad /* Local client should be 'Disconnected' before adding new connection. */,\n\t\t);\n\n\t\tthis.datastore.clientToSessionId[clientConnectionId] = {\n\t\t\trev: this.selfAttendee.order++,\n\t\t\ttimestamp: Date.now(),\n\t\t\tvalue: this.selfAttendee.attendeeId,\n\t\t};\n\n\t\t// Mark 'Connected' remote attendees connections as stale\n\t\tfor (const staleConnectionClient of this.attendees.values()) {\n\t\t\tif (staleConnectionClient.getConnectionStatus() === AttendeeStatus.Connected) {\n\t\t\t\tthis.staleConnectionClients.add(staleConnectionClient);\n\t\t\t}\n\t\t}\n\n\t\t// Update the self attendee\n\t\tthis.selfAttendee.connectionId = clientConnectionId;\n\t\tthis.selfAttendee.setConnected();\n\t\tthis.attendees.set(clientConnectionId, this.selfAttendee);\n\n\t\tthis.staleConnectionTimer.setTimeout(() => {\n\t\t\tfor (const client of this.staleConnectionClients) {\n\t\t\t\tclient.setDisconnected();\n\t\t\t}\n\t\t\tfor (const client of this.staleConnectionClients) {\n\t\t\t\tthis.events.emit(\"attendeeDisconnected\", client);\n\t\t\t}\n\t\t\tthis.staleConnectionClients.clear();\n\t\t}, 30_000);\n\t}\n\n\tpublic removeClientConnectionId(clientConnectionId: ClientConnectionId): void {\n\t\tconst attendee = this.attendees.get(clientConnectionId);\n\t\tif (!attendee) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If the local connection is being removed, clear the stale connection timer\n\t\tif (attendee === this.selfAttendee) {\n\t\t\tthis.staleConnectionTimer.clearTimeout();\n\t\t}\n\n\t\t// If the last known connectionID is different from the connection ID being removed, the attendee has reconnected,\n\t\t// therefore we should not change the attendee connection status or emit a disconnect event.\n\t\tconst attendeeReconnected = attendee.getConnectionId() !== clientConnectionId;\n\t\tconst connected = attendee.getConnectionStatus() === AttendeeStatus.Connected;\n\t\tif (!attendeeReconnected && connected) {\n\t\t\tattendee.setDisconnected();\n\t\t\tthis.events.emit(\"attendeeDisconnected\", attendee);\n\t\t\tthis.staleConnectionClients.delete(attendee);\n\t\t}\n\t}\n\n\tpublic getAttendees(): ReadonlySet<Attendee> {\n\t\treturn new Set(this.attendees.values());\n\t}\n\n\tpublic getAttendee(clientId: ClientConnectionId | AttendeeId): Attendee {\n\t\tconst attendee = this.attendees.get(clientId);\n\t\tif (attendee) {\n\t\t\treturn attendee;\n\t\t}\n\n\t\t// TODO: Restore option to add attendee on demand to handle internal\n\t\t// lookup cases that must come from internal data.\n\t\t// There aren't any resiliency mechanisms in place to handle a missed\n\t\t// ClientJoin right now.\n\t\tthrow new Error(\"Attendee not found\");\n\t}\n\n\tpublic getMyself(): Attendee {\n\t\treturn this.selfAttendee;\n\t}\n\n\t/**\n\t * Make sure the given client session and connection ID pair are represented\n\t * in the attendee map. If not present, SessionClient is created and added\n\t * to map. If present, make sure the current connection ID is updated.\n\t */\n\tprivate ensureAttendee(\n\t\tattendeeId: AttendeeId,\n\t\tclientConnectionId: ClientConnectionId,\n\t\torder: number,\n\t\tisConnected: boolean,\n\t): { attendee: SessionClient; isJoining: boolean } {\n\t\tlet attendee = this.attendees.get(attendeeId);\n\t\tlet isJoining = false;\n\n\t\tif (attendee === undefined) {\n\t\t\t// New attendee. Create SessionClient and add session ID based\n\t\t\t// entry to map.\n\t\t\tattendee = new SessionClient(attendeeId, clientConnectionId);\n\t\t\tthis.attendees.set(attendeeId, attendee);\n\t\t\tif (isConnected) {\n\t\t\t\tattendee.setConnected();\n\t\t\t\tisJoining = true;\n\t\t\t}\n\t\t} else if (order > attendee.order) {\n\t\t\t// The given association is newer than the one we have.\n\t\t\t// Update the order and current connection ID.\n\t\t\tattendee.order = order;\n\t\t\t// Known attendee is joining the session if they are currently disconnected\n\t\t\tif (attendee.getConnectionStatus() === AttendeeStatus.Disconnected && isConnected) {\n\t\t\t\tattendee.setConnected();\n\t\t\t\tisJoining = true;\n\t\t\t}\n\t\t\tattendee.connectionId = clientConnectionId;\n\t\t}\n\n\t\tif (isConnected) {\n\t\t\t// If the attendee is connected, remove them from the stale connection set\n\t\t\tthis.staleConnectionClients.delete(attendee);\n\t\t}\n\n\t\t// Always update entry for the connection ID. (Okay if already set.)\n\t\tthis.attendees.set(clientConnectionId, attendee);\n\n\t\treturn { attendee, isJoining };\n\t}\n}\n\n/**\n * Instantiates the system workspace.\n */\nexport function createSystemWorkspace(\n\tattendeeId: AttendeeId,\n\tdatastore: SystemWorkspaceDatastore,\n\tevents: Listenable<AttendeesEvents> & IEmitter<AttendeesEvents>,\n\taudience: IAudience,\n): {\n\tworkspace: SystemWorkspace;\n\tstatesEntry: {\n\t\tinternal: PresenceStatesInternal;\n\t\tpublic: AnyWorkspace<StatesWorkspaceSchema>;\n\t};\n} {\n\tconst workspace = new SystemWorkspaceImpl(attendeeId, datastore, events, audience);\n\treturn {\n\t\tworkspace,\n\t\tstatesEntry: {\n\t\t\tinternal: workspace,\n\t\t\tpublic: undefined as unknown as AnyWorkspace<StatesWorkspaceSchema>,\n\t\t},\n\t};\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -37,6 +37,9 @@ export type StatesWorkspaceEntry<TKey extends string, TValue extends InternalTyp
37
37
  * @beta
38
38
  */
39
39
  export interface StatesWorkspaceSchema {
40
+ /**
41
+ * Key-value pairs of State objects registered with the {@link StatesWorkspace}.
42
+ */
40
43
  [key: string]: StatesWorkspaceEntry<typeof key, InternalTypes.ValueDirectoryOrState<any>>;
41
44
  }
42
45
  /**
@@ -122,8 +125,6 @@ export interface NotificationsWorkspace<TSchema extends NotificationsWorkspaceSc
122
125
  }
123
126
  /**
124
127
  * `AnyWorkspace` is a superset of {@link StatesWorkspace} and {@link NotificationsWorkspace}.
125
- *
126
- * @internal
127
128
  */
128
129
  export interface AnyWorkspace<TSchema extends StatesWorkspaceSchema, TManagerConstraints = unknown> extends StatesWorkspace<TSchema, TManagerConstraints> {
129
130
  readonly notifications: StatesWorkspaceEntries<TSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAEzE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,CAC/B,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS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EAAE,QAAQ,CAAC,CAAC,CAC5E,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAExD;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;CAC7C;AAID;;GAEG;AACH,MAAM,WAAW,YAAY,CAC5B,OAAO,SAAS,qBAAqB,EACrC,mBAAmB,GAAG,OAAO,CAC5B,SAAQ,eAAe,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtD,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAExD,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;CAC7C"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.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 { BroadcastControls } from \"./broadcastControls.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { NotificationsManager } from \"./notificationsManager.js\";\nimport type { Presence, PresenceWithNotifications } from \"./presence.js\";\n\n/**\n * Unique address within a session.\n *\n * @remarks\n * A string known to all clients working with a certain Workspace and unique\n * among Workspaces. Recommend using specifying concatenation of: type of\n * unique identifier, `:` (required), and unique identifier.\n *\n * @example Examples\n * ```typescript\n * \"guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1\"\n * \"address:object0/sub-object2:pointers\"\n * ```\n *\n * @beta\n */\nexport type WorkspaceAddress = `${string}:${string}`;\n\n/**\n * Single entry in {@link StatesWorkspaceSchema} or {@link NotificationsWorkspaceSchema}.\n *\n * @beta\n */\nexport type StatesWorkspaceEntry<\n\tTKey extends string,\n\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n\tTManager = unknown,\n> = InternalTypes.ManagerFactory<TKey, TValue, TManager>;\n\n// #region StatesWorkspace\n\n/**\n * Schema for a {@link StatesWorkspace} workspace.\n *\n * Keys of schema are the keys of the {@link StatesWorkspace} providing access to State objects.\n *\n * @beta\n */\nexport interface StatesWorkspaceSchema {\n\t[key: string]: StatesWorkspaceEntry<typeof key, InternalTypes.ValueDirectoryOrState<any>>;\n}\n\n/**\n * Map of State objects registered with {@link StatesWorkspace}.\n *\n * @sealed\n * @beta\n */\nexport type StatesWorkspaceEntries<TSchema extends StatesWorkspaceSchema> = {\n\t/**\n\t * Registered State objects.\n\t */\n\treadonly [Key in keyof TSchema]: ReturnType<\n\t\tTSchema[Key]\n\t>[\"manager\"] extends InternalTypes.StateValue<infer TManager>\n\t\t? TManager\n\t\t: never;\n};\n\n/**\n * `StatesWorkspace` maintains a registry of State objects that all share and provide access to\n * presence state values across client members in a session.\n *\n * State objects offer variations on how to manage states, but all share same principle that\n * each client's state is independent and may only be updated by originating client.\n *\n * @sealed\n * @beta\n */\nexport interface StatesWorkspace<\n\tTSchema extends StatesWorkspaceSchema,\n\tTManagerConstraints = unknown,\n> {\n\t/**\n\t * Registers a new State object with the {@link StatesWorkspace}.\n\t * @param key - new unique key for the State object within the workspace\n\t * @param manager - factory for creating a State object\n\t */\n\tadd<\n\t\tTKey extends string,\n\t\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n\t\tTManager extends TManagerConstraints,\n\t>(\n\t\tkey: TKey,\n\t\tmanager: InternalTypes.ManagerFactory<TKey, TValue, TManager>,\n\t): asserts this is StatesWorkspace<\n\t\tTSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>,\n\t\tTManagerConstraints\n\t>;\n\n\t/**\n\t * Registry of State objects.\n\t */\n\treadonly states: StatesWorkspaceEntries<TSchema>;\n\n\t/**\n\t * Default controls for management of broadcast updates.\n\t */\n\treadonly controls: BroadcastControls;\n\n\t/**\n\t * Containing {@link Presence}\n\t */\n\treadonly presence: Presence;\n}\n\n// #endregion StatesWorkspace\n\n// #region NotificationsWorkspace\n\n/**\n * Schema for a {@link NotificationsWorkspace} workspace.\n *\n * Keys of schema are the keys of the {@link NotificationsWorkspace} providing access to {@link NotificationsManager}s.\n *\n * @alpha\n */\nexport interface NotificationsWorkspaceSchema {\n\t[key: string]: InternalTypes.ManagerFactory<\n\t\ttypeof key,\n\t\tInternalTypes.ValueRequiredState<InternalTypes.NotificationType>,\n\t\tNotificationsManager<any>\n\t>;\n}\n\n/**\n * `NotificationsWorkspace` maintains a registry of {@link NotificationsManager}s\n * that facilitate messages across client members in a session.\n *\n * @privateRemarks\n * This should be kept mostly in sync with {@link StatesWorkspace}. Notably the\n * return type of `add` is limited here and the `controls` property is omitted.\n * The `PresenceStatesImpl` class implements `AnyWorkspace` and therefore\n * `NotificationsWorkspace`, so long as this is proper subset.\n *\n * @sealed\n * @alpha\n */\nexport interface NotificationsWorkspace<TSchema extends NotificationsWorkspaceSchema> {\n\t/**\n\t * Registers a new `NotificationsManager` with the {@link NotificationsWorkspace}.\n\t * @param key - new unique key for the `NotificationsManager` within the workspace\n\t * @param manager - factory for creating a `NotificationsManager`\n\t */\n\tadd<\n\t\tTKey extends string,\n\t\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n\t\tTManager extends NotificationsManager<any>,\n\t>(\n\t\tkey: TKey,\n\t\tmanager: InternalTypes.ManagerFactory<TKey, TValue, TManager>,\n\t): asserts this is NotificationsWorkspace<\n\t\tTSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>\n\t>;\n\n\t/**\n\t * Registry of `NotificationsManager`s.\n\t */\n\treadonly notifications: StatesWorkspaceEntries<TSchema>;\n\n\t/**\n\t * Containing {@link PresenceWithNotifications}\n\t */\n\treadonly presence: PresenceWithNotifications;\n}\n\n// #endregion NotificationsWorkspace\n\n/**\n * `AnyWorkspace` is a superset of {@link StatesWorkspace} and {@link NotificationsWorkspace}.\n *\n * @internal\n */\nexport interface AnyWorkspace<\n\tTSchema extends StatesWorkspaceSchema,\n\tTManagerConstraints = unknown,\n> extends StatesWorkspace<TSchema, TManagerConstraints> {\n\treadonly notifications: StatesWorkspaceEntries<TSchema>;\n\t// TO be removed if/when notifications are fully supported\n\treadonly presence: PresenceWithNotifications;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.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 { BroadcastControls } from \"./broadcastControls.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { NotificationsManager } from \"./notificationsManager.js\";\nimport type { Presence, PresenceWithNotifications } from \"./presence.js\";\n\n/**\n * Unique address within a session.\n *\n * @remarks\n * A string known to all clients working with a certain Workspace and unique\n * among Workspaces. Recommend using specifying concatenation of: type of\n * unique identifier, `:` (required), and unique identifier.\n *\n * @example Examples\n * ```typescript\n * \"guid:g0fl001d-1415-5000-c00l-g0fa54g0b1g1\"\n * \"address:object0/sub-object2:pointers\"\n * ```\n *\n * @beta\n */\nexport type WorkspaceAddress = `${string}:${string}`;\n\n/**\n * Single entry in {@link StatesWorkspaceSchema} or {@link NotificationsWorkspaceSchema}.\n *\n * @beta\n */\nexport type StatesWorkspaceEntry<\n\tTKey extends string,\n\tTValue extends InternalTypes.ValueDirectoryOrState<unknown>,\n\tTManager = unknown,\n> = InternalTypes.ManagerFactory<TKey, TValue, TManager>;\n\n// #region StatesWorkspace\n\n/**\n * Schema for a {@link StatesWorkspace} workspace.\n *\n * Keys of schema are the keys of the {@link StatesWorkspace} providing access to State objects.\n *\n * @beta\n */\nexport interface StatesWorkspaceSchema {\n\t/**\n\t * Key-value pairs of State objects registered with the {@link StatesWorkspace}.\n\t */\n\t[key: string]: StatesWorkspaceEntry<typeof key, InternalTypes.ValueDirectoryOrState<any>>;\n}\n\n/**\n * Map of State objects registered with {@link StatesWorkspace}.\n *\n * @sealed\n * @beta\n */\nexport type StatesWorkspaceEntries<TSchema extends StatesWorkspaceSchema> = {\n\t/**\n\t * Registered State objects.\n\t */\n\treadonly [Key in keyof TSchema]: ReturnType<\n\t\tTSchema[Key]\n\t>[\"manager\"] extends InternalTypes.StateValue<infer TManager>\n\t\t? TManager\n\t\t: never;\n};\n\n/**\n * `StatesWorkspace` maintains a registry of State objects that all share and provide access to\n * presence state values across client members in a session.\n *\n * State objects offer variations on how to manage states, but all share same principle that\n * each client's state is independent and may only be updated by originating client.\n *\n * @sealed\n * @beta\n */\nexport interface StatesWorkspace<\n\tTSchema extends StatesWorkspaceSchema,\n\tTManagerConstraints = unknown,\n> {\n\t/**\n\t * Registers a new State object with the {@link StatesWorkspace}.\n\t * @param key - new unique key for the State object within the workspace\n\t * @param manager - factory for creating a State object\n\t */\n\tadd<\n\t\tTKey extends string,\n\t\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n\t\tTManager extends TManagerConstraints,\n\t>(\n\t\tkey: TKey,\n\t\tmanager: InternalTypes.ManagerFactory<TKey, TValue, TManager>,\n\t): asserts this is StatesWorkspace<\n\t\tTSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>,\n\t\tTManagerConstraints\n\t>;\n\n\t/**\n\t * Registry of State objects.\n\t */\n\treadonly states: StatesWorkspaceEntries<TSchema>;\n\n\t/**\n\t * Default controls for management of broadcast updates.\n\t */\n\treadonly controls: BroadcastControls;\n\n\t/**\n\t * Containing {@link Presence}\n\t */\n\treadonly presence: Presence;\n}\n\n// #endregion StatesWorkspace\n\n// #region NotificationsWorkspace\n\n/**\n * Schema for a {@link NotificationsWorkspace} workspace.\n *\n * Keys of schema are the keys of the {@link NotificationsWorkspace} providing access to {@link NotificationsManager}s.\n *\n * @alpha\n */\nexport interface NotificationsWorkspaceSchema {\n\t[key: string]: InternalTypes.ManagerFactory<\n\t\ttypeof key,\n\t\tInternalTypes.ValueRequiredState<InternalTypes.NotificationType>,\n\t\tNotificationsManager<any>\n\t>;\n}\n\n/**\n * `NotificationsWorkspace` maintains a registry of {@link NotificationsManager}s\n * that facilitate messages across client members in a session.\n *\n * @privateRemarks\n * This should be kept mostly in sync with {@link StatesWorkspace}. Notably the\n * return type of `add` is limited here and the `controls` property is omitted.\n * The `PresenceStatesImpl` class implements `AnyWorkspace` and therefore\n * `NotificationsWorkspace`, so long as this is proper subset.\n *\n * @sealed\n * @alpha\n */\nexport interface NotificationsWorkspace<TSchema extends NotificationsWorkspaceSchema> {\n\t/**\n\t * Registers a new `NotificationsManager` with the {@link NotificationsWorkspace}.\n\t * @param key - new unique key for the `NotificationsManager` within the workspace\n\t * @param manager - factory for creating a `NotificationsManager`\n\t */\n\tadd<\n\t\tTKey extends string,\n\t\tTValue extends InternalTypes.ValueDirectoryOrState<any>,\n\t\tTManager extends NotificationsManager<any>,\n\t>(\n\t\tkey: TKey,\n\t\tmanager: InternalTypes.ManagerFactory<TKey, TValue, TManager>,\n\t): asserts this is NotificationsWorkspace<\n\t\tTSchema & Record<TKey, InternalTypes.ManagerFactory<TKey, TValue, TManager>>\n\t>;\n\n\t/**\n\t * Registry of `NotificationsManager`s.\n\t */\n\treadonly notifications: StatesWorkspaceEntries<TSchema>;\n\n\t/**\n\t * Containing {@link PresenceWithNotifications}\n\t */\n\treadonly presence: PresenceWithNotifications;\n}\n\n// #endregion NotificationsWorkspace\n\n/**\n * `AnyWorkspace` is a superset of {@link StatesWorkspace} and {@link NotificationsWorkspace}.\n */\nexport interface AnyWorkspace<\n\tTSchema extends StatesWorkspaceSchema,\n\tTManagerConstraints = unknown,\n> extends StatesWorkspace<TSchema, TManagerConstraints> {\n\treadonly notifications: StatesWorkspaceEntries<TSchema>;\n\t// TO be removed if/when notifications are fully supported\n\treadonly presence: PresenceWithNotifications;\n}\n"]}
@@ -6,14 +6,10 @@ import type { InternalTypes } from "./exposedInternalTypes.js";
6
6
  import type { ValueManager } from "./internalTypes.js";
7
7
  /**
8
8
  * Given a value manager, return opaque InternalTypes.StateValue.
9
- *
10
- * @internal
11
9
  */
12
10
  export declare function brandIVM<TManagerInterface, TValue, TValueState extends InternalTypes.ValueDirectoryOrState<TValue>>(manager: TManagerInterface & ValueManager<TValue, TValueState>): InternalTypes.StateValue<TManagerInterface>;
13
11
  /**
14
12
  * Extract the value manager from an opaque InternalTypes.StateValue.
15
- *
16
- * @internal
17
13
  */
18
14
  export declare function unbrandIVM<TManagerInterface, TValue, TValueState extends InternalTypes.ValueDirectoryOrState<TValue>>(branded: InternalTypes.StateValue<TManagerInterface>): ValueManager<TValue, TValueState>;
19
15
  //# sourceMappingURL=valueManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"valueManager.d.ts","sourceRoot":"","sources":["../src/valueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,QAAQ,CACvB,iBAAiB,EACjB,MAAM,EACN,WAAW,SAAS,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAE/D,OAAO,EAAE,iBAAiB,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,GAC5D,aAAa,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACzB,iBAAiB,EACjB,MAAM,EACN,WAAW,SAAS,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAC9D,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAEzF"}
1
+ {"version":3,"file":"valueManager.d.ts","sourceRoot":"","sources":["../src/valueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;GAEG;AACH,wBAAgB,QAAQ,CACvB,iBAAiB,EACjB,MAAM,EACN,WAAW,SAAS,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAE/D,OAAO,EAAE,iBAAiB,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,GAC5D,aAAa,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAE7C;AAED;;GAEG;AACH,wBAAgB,UAAU,CACzB,iBAAiB,EACjB,MAAM,EACN,WAAW,SAAS,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAC9D,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAEzF"}
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.unbrandIVM = exports.brandIVM = void 0;
8
8
  /**
9
9
  * Given a value manager, return opaque InternalTypes.StateValue.
10
- *
11
- * @internal
12
10
  */
13
11
  function brandIVM(manager) {
14
12
  return manager;
@@ -16,8 +14,6 @@ function brandIVM(manager) {
16
14
  exports.brandIVM = brandIVM;
17
15
  /**
18
16
  * Extract the value manager from an opaque InternalTypes.StateValue.
19
- *
20
- * @internal
21
17
  */
22
18
  function unbrandIVM(branded) {
23
19
  return branded;
@@ -1 +1 @@
1
- {"version":3,"file":"valueManager.js","sourceRoot":"","sources":["../src/valueManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;;;GAIG;AACH,SAAgB,QAAQ,CAKvB,OAA8D;IAE9D,OAAO,OAA2E,CAAC;AACpF,CAAC;AARD,4BAQC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAIxB,OAAoD;IACrD,OAAO,OAAuD,CAAC;AAChE,CAAC;AAND,gCAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { ValueManager } from \"./internalTypes.js\";\n\n/**\n * Given a value manager, return opaque InternalTypes.StateValue.\n *\n * @internal\n */\nexport function brandIVM<\n\tTManagerInterface,\n\tTValue,\n\tTValueState extends InternalTypes.ValueDirectoryOrState<TValue>,\n>(\n\tmanager: TManagerInterface & ValueManager<TValue, TValueState>,\n): InternalTypes.StateValue<TManagerInterface> {\n\treturn manager as TManagerInterface as InternalTypes.StateValue<TManagerInterface>;\n}\n\n/**\n * Extract the value manager from an opaque InternalTypes.StateValue.\n *\n * @internal\n */\nexport function unbrandIVM<\n\tTManagerInterface,\n\tTValue,\n\tTValueState extends InternalTypes.ValueDirectoryOrState<TValue>,\n>(branded: InternalTypes.StateValue<TManagerInterface>): ValueManager<TValue, TValueState> {\n\treturn branded as unknown as ValueManager<TValue, TValueState>;\n}\n"]}
1
+ {"version":3,"file":"valueManager.js","sourceRoot":"","sources":["../src/valueManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;GAEG;AACH,SAAgB,QAAQ,CAKvB,OAA8D;IAE9D,OAAO,OAA2E,CAAC;AACpF,CAAC;AARD,4BAQC;AAED;;GAEG;AACH,SAAgB,UAAU,CAIxB,OAAoD;IACrD,OAAO,OAAuD,CAAC;AAChE,CAAC;AAND,gCAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { ValueManager } from \"./internalTypes.js\";\n\n/**\n * Given a value manager, return opaque InternalTypes.StateValue.\n */\nexport function brandIVM<\n\tTManagerInterface,\n\tTValue,\n\tTValueState extends InternalTypes.ValueDirectoryOrState<TValue>,\n>(\n\tmanager: TManagerInterface & ValueManager<TValue, TValueState>,\n): InternalTypes.StateValue<TManagerInterface> {\n\treturn manager as TManagerInterface as InternalTypes.StateValue<TManagerInterface>;\n}\n\n/**\n * Extract the value manager from an opaque InternalTypes.StateValue.\n */\nexport function unbrandIVM<\n\tTManagerInterface,\n\tTValue,\n\tTValueState extends InternalTypes.ValueDirectoryOrState<TValue>,\n>(branded: InternalTypes.StateValue<TManagerInterface>): ValueManager<TValue, TValueState> {\n\treturn branded as unknown as ValueManager<TValue, TValueState>;\n}\n"]}
@@ -44,7 +44,8 @@ declare class ForcedRefreshControl implements Pick<BroadcastControls & {
44
44
  set forcedRefreshIntervalMs(value: number | undefined);
45
45
  }
46
46
  /**
47
- * @internal
47
+ * Implements {@link BroadcastControls} for States Managers
48
+ * where returning `undefined` settings are allowed.
48
49
  */
49
50
  export declare class OptionalBroadcastControl extends ForcedRefreshControl implements BroadcastControls {
50
51
  allowableUpdateLatencyMs: number | undefined;
@@ -56,8 +57,6 @@ export declare class OptionalBroadcastControl extends ForcedRefreshControl imple
56
57
  *
57
58
  * If {@link BroadcastControls.allowableUpdateLatencyMs | allowableUpdateLatencyMs}
58
59
  * is set to `undefined`, the default will be restored.
59
- *
60
- * @internal
61
60
  */
62
61
  export declare class RequiredBroadcastControl extends ForcedRefreshControl implements BroadcastControls {
63
62
  private readonly defaultAllowableUpdateLatencyMs;
@@ -1 +1 @@
1
- {"version":3,"file":"broadcastControls.d.ts","sourceRoot":"","sources":["../src/broadcastControls.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;;;;;;OAUG;IACH,wBAAwB,EAAE,MAAM,GAAG,SAAS,CAAC;CAc7C;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACxC;;;;OAIG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CAS3C;AAED,cAAM,oBACL,YACC,IAAI,CACH,iBAAiB,GAAG;IAAE,uBAAuB,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EACnE,yBAAyB,CACzB;IAEF,OAAO,CAAC,sBAAsB,CAAqB;gBAEhC,QAAQ,CAAC,EAAE,wBAAwB;IAItD,IAAW,uBAAuB,IAAI,MAAM,GAAG,SAAS,CA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jC,QAAQ,CAAC,EAAE,wBAAwB;CAItD;AAED;;;;;;GAMG;AACH,qBAAa,wBACZ,SAAQ,oBACR,YAAW,iBAAiB;IAIT,OAAO,CAAC,QAAQ,CAAC,+BAA+B;IAFnE,OAAO,CAAC,yBAAyB,CAAS;gBAEN,+BAA+B,EAAE,MAAM;IAK3E,IAAW,wBAAwB,IAAI,MAAM,CAE5C;IACD,IAAW,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAE5D;CACD"}
@@ -23,7 +23,8 @@ class ForcedRefreshControl {
23
23
  }
24
24
  }
25
25
  /**
26
- * @internal
26
+ * Implements {@link BroadcastControls} for States Managers
27
+ * where returning `undefined` settings are allowed.
27
28
  */
28
29
  export class OptionalBroadcastControl extends ForcedRefreshControl {
29
30
  constructor(settings) {
@@ -37,8 +38,6 @@ export class OptionalBroadcastControl extends ForcedRefreshControl {
37
38
  *
38
39
  * If {@link BroadcastControls.allowableUpdateLatencyMs | allowableUpdateLatencyMs}
39
40
  * is set to `undefined`, the default will be restored.
40
- *
41
- * @internal
42
41
  */
43
42
  export class RequiredBroadcastControl extends ForcedRefreshControl {
44
43
  constructor(defaultAllowableUpdateLatencyMs) {
@@ -1 +1 @@
1
- {"version":3,"file":"broadcastControls.js","sourceRoot":"","sources":["../src/broadcastControls.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0DH,MAAM,oBAAoB;IASzB,YAAmB,QAAmC;QACrD,mEAAmE;IACpE,CAAC;IAED,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACpC,CAAC;IACD,IAAW,uBAAuB,CAAC,KAAyB;QAC3D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,sBAAsB,GAAG,SAAS,CAAC;QACzC,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,sBAAsB,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;YAC9D,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;gBACjB,uCAAuC;gBACvC,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;YAC9D,CAAC;QACF,CAAC;IACF,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,wBACZ,SAAQ,oBAAoB;IAK5B,YAAmB,QAAmC;QACrD,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,wBAAwB,GAAG,QAAQ,EAAE,wBAAwB,CAAC;IACpE,CAAC;CACD;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,wBACZ,SAAQ,oBAAoB;IAK5B,YAAoC,+BAAuC;QAC1E,KAAK,EAAE,CAAC;QAD2B,oCAA+B,GAA/B,+BAA+B,CAAQ;QAE1E,IAAI,CAAC,yBAAyB,GAAG,+BAA+B,CAAC;IAClE,CAAC;IAED,IAAW,wBAAwB;QAClC,OAAO,IAAI,CAAC,yBAAyB,CAAC;IACvC,CAAC;IACD,IAAW,wBAAwB,CAAC,KAAyB;QAC5D,IAAI,CAAC,yBAAyB,GAAG,KAAK,IAAI,IAAI,CAAC,+BAA+B,CAAC;IAChF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Common controls for States objects.\n *\n * @sealed\n * @beta\n */\nexport interface BroadcastControls {\n\t/**\n\t * Maximum time in milliseconds that a local value update is allowed\n\t * to remain pending before it must be broadcast.\n\t *\n\t * @remarks\n\t * There is no guarantee of broadcast within time allowed\n\t * as other conditions such as disconnect or service throttling may\n\t * cause a delay.\n\t *\n\t * Setting to `undefined` will restore to a system default.\n\t */\n\tallowableUpdateLatencyMs: number | undefined;\n\n\t/**\n\t * Target time in milliseconds between oldest changed local state\n\t * has been broadcast and forced rebroadcast of all local values.\n\t * A value of less than 10 disables forced refresh.\n\t *\n\t * @privateRemarks\n\t * Any time less than 10 milliseconds is likely to generate too\n\t * many signals. Ideally this feature becomes obsolete as\n\t * we understand the system better and account for holes.\n\t */\n\t// forcedRefreshIntervalMs is removed until it is supported.\n\t// forcedRefreshIntervalMs: number | undefined;\n}\n\n/**\n * Value set to configure {@link BroadcastControls}.\n *\n * @beta\n */\nexport interface BroadcastControlSettings {\n\t/**\n\t * {@inheritdoc BroadcastControls.allowableUpdateLatencyMs}\n\t *\n\t * @defaultValue 60 [milliseconds]\n\t */\n\treadonly allowableUpdateLatencyMs?: number;\n\n\t/**\n\t * {@inheritdoc BroadcastControls.forcedRefreshIntervalMs}\n\t *\n\t * @defaultValue 0 (disabled)\n\t */\n\t// forcedRefreshIntervalMs is removed until it is supported.\n\t// readonly forcedRefreshIntervalMs?: number;\n}\n\nclass ForcedRefreshControl\n\timplements\n\t\tPick<\n\t\t\tBroadcastControls & { forcedRefreshIntervalMs: number | undefined },\n\t\t\t\"forcedRefreshIntervalMs\"\n\t\t>\n{\n\tprivate _forcedRefreshInterval: number | undefined;\n\n\tpublic constructor(settings?: BroadcastControlSettings) {\n\t\t// this._forcedRefreshInterval = settings?.forcedRefreshIntervalMs;\n\t}\n\n\tpublic get forcedRefreshIntervalMs(): number | undefined {\n\t\treturn this._forcedRefreshInterval;\n\t}\n\tpublic set forcedRefreshIntervalMs(value: number | undefined) {\n\t\tif (value === undefined) {\n\t\t\tthis._forcedRefreshInterval = undefined;\n\t\t} else {\n\t\t\tthis._forcedRefreshInterval = value >= 10 ? value : undefined;\n\t\t\tif (value >= 10) {\n\t\t\t\t// TODO: enable periodic forced refresh\n\t\t\t\tthrow new Error(\"Forced Refresh feature is not implemented\");\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @internal\n */\nexport class OptionalBroadcastControl\n\textends ForcedRefreshControl\n\timplements BroadcastControls\n{\n\tpublic allowableUpdateLatencyMs: number | undefined;\n\n\tpublic constructor(settings?: BroadcastControlSettings) {\n\t\tsuper(settings);\n\t\tthis.allowableUpdateLatencyMs = settings?.allowableUpdateLatencyMs;\n\t}\n}\n\n/**\n * Implements {@link BroadcastControls} but always provides defined value for\n * {@link BroadcastControls.allowableUpdateLatencyMs | allowableUpdateLatencyMs}.\n *\n * If {@link BroadcastControls.allowableUpdateLatencyMs | allowableUpdateLatencyMs}\n * is set to `undefined`, the default will be restored.\n *\n * @internal\n */\nexport class RequiredBroadcastControl\n\textends ForcedRefreshControl\n\timplements BroadcastControls\n{\n\tprivate _allowableUpdateLatencyMs: number;\n\n\tpublic constructor(private readonly defaultAllowableUpdateLatencyMs: number) {\n\t\tsuper();\n\t\tthis._allowableUpdateLatencyMs = defaultAllowableUpdateLatencyMs;\n\t}\n\n\tpublic get allowableUpdateLatencyMs(): number {\n\t\treturn this._allowableUpdateLatencyMs;\n\t}\n\tpublic set allowableUpdateLatencyMs(value: number | undefined) {\n\t\tthis._allowableUpdateLatencyMs = value ?? this.defaultAllowableUpdateLatencyMs;\n\t}\n}\n"]}
1
+ {"version":3,"file":"broadcastControls.js","sourceRoot":"","sources":["../src/broadcastControls.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0DH,MAAM,oBAAoB;IASzB,YAAmB,QAAmC;QACrD,mEAAmE;IACpE,CAAC;IAED,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACpC,CAAC;IACD,IAAW,uBAAuB,CAAC,KAAyB;QAC3D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,sBAAsB,GAAG,SAAS,CAAC;QACzC,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,sBAAsB,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;YAC9D,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;gBACjB,uCAAuC;gBACvC,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;YAC9D,CAAC;QACF,CAAC;IACF,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,OAAO,wBACZ,SAAQ,oBAAoB;IAK5B,YAAmB,QAAmC;QACrD,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,wBAAwB,GAAG,QAAQ,EAAE,wBAAwB,CAAC;IACpE,CAAC;CACD;AAED;;;;;;GAMG;AACH,MAAM,OAAO,wBACZ,SAAQ,oBAAoB;IAK5B,YAAoC,+BAAuC;QAC1E,KAAK,EAAE,CAAC;QAD2B,oCAA+B,GAA/B,+BAA+B,CAAQ;QAE1E,IAAI,CAAC,yBAAyB,GAAG,+BAA+B,CAAC;IAClE,CAAC;IAED,IAAW,wBAAwB;QAClC,OAAO,IAAI,CAAC,yBAAyB,CAAC;IACvC,CAAC;IACD,IAAW,wBAAwB,CAAC,KAAyB;QAC5D,IAAI,CAAC,yBAAyB,GAAG,KAAK,IAAI,IAAI,CAAC,+BAA+B,CAAC;IAChF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Common controls for States objects.\n *\n * @sealed\n * @beta\n */\nexport interface BroadcastControls {\n\t/**\n\t * Maximum time in milliseconds that a local value update is allowed\n\t * to remain pending before it must be broadcast.\n\t *\n\t * @remarks\n\t * There is no guarantee of broadcast within time allowed\n\t * as other conditions such as disconnect or service throttling may\n\t * cause a delay.\n\t *\n\t * Setting to `undefined` will restore to a system default.\n\t */\n\tallowableUpdateLatencyMs: number | undefined;\n\n\t/**\n\t * Target time in milliseconds between oldest changed local state\n\t * has been broadcast and forced rebroadcast of all local values.\n\t * A value of less than 10 disables forced refresh.\n\t *\n\t * @privateRemarks\n\t * Any time less than 10 milliseconds is likely to generate too\n\t * many signals. Ideally this feature becomes obsolete as\n\t * we understand the system better and account for holes.\n\t */\n\t// forcedRefreshIntervalMs is removed until it is supported.\n\t// forcedRefreshIntervalMs: number | undefined;\n}\n\n/**\n * Value set to configure {@link BroadcastControls}.\n *\n * @beta\n */\nexport interface BroadcastControlSettings {\n\t/**\n\t * {@inheritdoc BroadcastControls.allowableUpdateLatencyMs}\n\t *\n\t * @defaultValue 60 [milliseconds]\n\t */\n\treadonly allowableUpdateLatencyMs?: number;\n\n\t/**\n\t * {@inheritdoc BroadcastControls.forcedRefreshIntervalMs}\n\t *\n\t * @defaultValue 0 (disabled)\n\t */\n\t// forcedRefreshIntervalMs is removed until it is supported.\n\t// readonly forcedRefreshIntervalMs?: number;\n}\n\nclass ForcedRefreshControl\n\timplements\n\t\tPick<\n\t\t\tBroadcastControls & { forcedRefreshIntervalMs: number | undefined },\n\t\t\t\"forcedRefreshIntervalMs\"\n\t\t>\n{\n\tprivate _forcedRefreshInterval: number | undefined;\n\n\tpublic constructor(settings?: BroadcastControlSettings) {\n\t\t// this._forcedRefreshInterval = settings?.forcedRefreshIntervalMs;\n\t}\n\n\tpublic get forcedRefreshIntervalMs(): number | undefined {\n\t\treturn this._forcedRefreshInterval;\n\t}\n\tpublic set forcedRefreshIntervalMs(value: number | undefined) {\n\t\tif (value === undefined) {\n\t\t\tthis._forcedRefreshInterval = undefined;\n\t\t} else {\n\t\t\tthis._forcedRefreshInterval = value >= 10 ? value : undefined;\n\t\t\tif (value >= 10) {\n\t\t\t\t// TODO: enable periodic forced refresh\n\t\t\t\tthrow new Error(\"Forced Refresh feature is not implemented\");\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Implements {@link BroadcastControls} for States Managers\n * where returning `undefined` settings are allowed.\n */\nexport class OptionalBroadcastControl\n\textends ForcedRefreshControl\n\timplements BroadcastControls\n{\n\tpublic allowableUpdateLatencyMs: number | undefined;\n\n\tpublic constructor(settings?: BroadcastControlSettings) {\n\t\tsuper(settings);\n\t\tthis.allowableUpdateLatencyMs = settings?.allowableUpdateLatencyMs;\n\t}\n}\n\n/**\n * Implements {@link BroadcastControls} but always provides defined value for\n * {@link BroadcastControls.allowableUpdateLatencyMs | allowableUpdateLatencyMs}.\n *\n * If {@link BroadcastControls.allowableUpdateLatencyMs | allowableUpdateLatencyMs}\n * is set to `undefined`, the default will be restored.\n */\nexport class RequiredBroadcastControl\n\textends ForcedRefreshControl\n\timplements BroadcastControls\n{\n\tprivate _allowableUpdateLatencyMs: number;\n\n\tpublic constructor(private readonly defaultAllowableUpdateLatencyMs: number) {\n\t\tsuper();\n\t\tthis._allowableUpdateLatencyMs = defaultAllowableUpdateLatencyMs;\n\t}\n\n\tpublic get allowableUpdateLatencyMs(): number {\n\t\treturn this._allowableUpdateLatencyMs;\n\t}\n\tpublic set allowableUpdateLatencyMs(value: number | undefined) {\n\t\tthis._allowableUpdateLatencyMs = value ?? this.defaultAllowableUpdateLatencyMs;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"datastorePresenceManagerFactory.d.ts","sourceRoot":"","sources":["../src/datastorePresenceManagerFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG3E,OAAO,KAAK,EAAE,yBAAyB,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAqE3E;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAsB;IAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;CAC/C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,2DAGtC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,sBAAsB,GAAG,QAAQ,CAMxF"}
1
+ {"version":3,"file":"datastorePresenceManagerFactory.d.ts","sourceRoot":"","sources":["../src/datastorePresenceManagerFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG3E,OAAO,KAAK,EAAE,yBAAyB,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAmE3E;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAsB;IAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;CAC/C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,2DAGtC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,sBAAsB,GAAG,QAAQ,CAMxF"}
@@ -36,6 +36,7 @@ class PresenceManagerDataObject extends LoadableFluidObject {
36
36
  getQuorum: runtime.getQuorum.bind(runtime),
37
37
  getAudience: runtime.getAudience.bind(runtime),
38
38
  submitSignal: (message) => runtime.submitSignal(message.type, message.content, message.targetClientId),
39
+ supportedFeatures: new Set() /* We do not implement feature detection here since this is a deprecated path */,
39
40
  });
40
41
  this.runtime.on("signal", (message, local) => {
41
42
  assertSignalMessageIsValid(message);
@@ -1 +1 @@
1
- {"version":3,"file":"datastorePresenceManagerFactory.js","sourceRoot":"","sources":["../src/datastorePresenceManagerFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAM7D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAO7D;;GAEG;AACH,SAAS,0BAA0B,CAClC,OAA2E;IAE3E,MAAM,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC5E,8DAA8D;IAC9D,gFAAgF;AACjF,CAAC;AAED;;GAEG;AACH,MAAM,yBAA0B,SAAQ,mBAAmB;IAKnD,eAAe;QACrB,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAA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YAAO,GAAG,IAAI,qBAAqB,CAClD,0BAA0B,EAC1B,yBAAyB,CACzB,CAAC;IACH,CAAC;IARO,EAAE,CAAC,KAA8C;QACvD,OAAO,KAAK,YAAY,yBAAyB,CAAC;IACnD,CAAC;CAMD;AAgBD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACvC,IAAI,sBAAsB,EAEzB,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,wBAAwB,CAAC,aAAqC;IAC7E,IAAI,aAAa,YAAY,yBAAyB,EAAE,CAAC;QACxD,OAAO,aAAa,CAAC,eAAe,EAAE,CAAC;IACxC,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;AACxF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/*\n * Hacky support for internal datastore based usages.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type {\n\tExtensionHostEvents,\n\tRawInboundExtensionMessage,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IInboundSignalMessage } from \"@fluidframework/runtime-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\n\nimport { BasicDataStoreFactory, LoadableFluidObject } from \"./datastoreSupport.js\";\nimport type { PresenceWithNotifications as Presence } from \"./presence.js\";\nimport { createPresenceManager } from \"./presenceManager.js\";\nimport type {\n\tOutboundClientJoinMessage,\n\tOutboundDatastoreUpdateMessage,\n\tSignalMessages,\n} from \"./protocol.js\";\n\n/**\n * This provides faux validation of the signal message.\n */\nfunction assertSignalMessageIsValid(\n\tmessage: IInboundSignalMessage | RawInboundExtensionMessage<SignalMessages>,\n): asserts message is RawInboundExtensionMessage<SignalMessages> {\n\tassert(message.clientId !== null, 0xa58 /* Signal must have a client ID */);\n\t// The other difference between messages is that `content` for\n\t// RawInboundExtensionMessage is JsonDeserialized and we are fine assuming that.\n}\n\n/**\n * Simple FluidObject holding Presence Manager.\n */\nclass PresenceManagerDataObject extends LoadableFluidObject {\n\t// Creation of presence manager is deferred until first acquisition to avoid\n\t// instantiations and stand-up by Summarizer that has no actual use.\n\tprivate _presenceManager: Presence | undefined;\n\n\tpublic presenceManager(): Presence {\n\t\tif (!this._presenceManager) {\n\t\t\t// TODO: investigate if ContainerExtensionStore (path-based address routing for\n\t\t\t// Signals) is readily detectable here and use that presence manager directly.\n\t\t\tconst runtime = this.runtime;\n\t\t\tconst events = createEmitter<ExtensionHostEvents>();\n\t\t\truntime.on(\"connected\", (clientId) => events.emit(\"connected\", clientId));\n\t\t\truntime.on(\"disconnected\", () => events.emit(\"disconnected\"));\n\n\t\t\tconst manager = createPresenceManager({\n\t\t\t\tisConnected: () => runtime.connected,\n\t\t\t\tgetClientId: () => runtime.clientId,\n\t\t\t\tevents,\n\t\t\t\tgetQuorum: runtime.getQuorum.bind(runtime),\n\t\t\t\tgetAudience: runtime.getAudience.bind(runtime),\n\t\t\t\tsubmitSignal: (message: OutboundClientJoinMessage | OutboundDatastoreUpdateMessage) =>\n\t\t\t\t\truntime.submitSignal(message.type, message.content, message.targetClientId),\n\t\t\t});\n\t\t\tthis.runtime.on(\"signal\", (message: IInboundSignalMessage, local: boolean) => {\n\t\t\t\tassertSignalMessageIsValid(message);\n\t\t\t\tmanager.processSignal([], message, local);\n\t\t\t});\n\t\t\tthis._presenceManager = manager;\n\t\t}\n\t\treturn this._presenceManager;\n\t}\n}\n\n/**\n * Factory class to create {@link Presence} in own data store.\n */\nclass PresenceManagerFactory {\n\tpublic is(value: IFluidLoadable | ExperimentalPresenceDO): value is ExperimentalPresenceDO {\n\t\treturn value instanceof PresenceManagerDataObject;\n\t}\n\n\tpublic readonly factory = new BasicDataStoreFactory(\n\t\t\"@fluidframework/presence\",\n\t\tPresenceManagerDataObject,\n\t);\n}\n\n/**\n * Brand for Experimental Presence Data Object.\n *\n * @remarks\n * See {@link getPresenceViaDataObject} for example usage.\n *\n * @deprecated Use {@link getPresence} instead.\n * @sealed\n * @alpha\n */\nexport declare class ExperimentalPresenceDO {\n\tprivate readonly _self: ExperimentalPresenceDO;\n}\n\n/**\n * DataStore based Presence Manager that is used as fallback for preferred Container\n * Extension based version requires registration. Export SharedObjectKind for registration.\n *\n * @deprecated Use {@link getPresence} instead.\n * @alpha\n */\nexport const ExperimentalPresenceManager =\n\tnew PresenceManagerFactory() as unknown as SharedObjectKind<\n\t\tIFluidLoadable & ExperimentalPresenceDO\n\t>;\n\n/**\n * Acquire Presence from a DataStore based Presence Manager\n *\n * @example\n * ```typescript\n * const containerSchema = {\n * \tinitialObjects: {\n * \t\texperimentalPresence: ExperimentalPresenceDO,\n * \t},\n * } satisfies ContainerSchema;\n * ```\n * then\n * ```typescript\n * const presence = getPresenceViaDataObject(\n * \tcontainer.initialObjects.experimentalPresence,\n * \t);\n * ```\n *\n * @deprecated Use {@link getPresence} instead.\n * @alpha\n */\nexport function getPresenceViaDataObject(fluidLoadable: ExperimentalPresenceDO): Presence {\n\tif (fluidLoadable instanceof PresenceManagerDataObject) {\n\t\treturn fluidLoadable.presenceManager();\n\t}\n\n\tthrow new Error(\"Incompatible loadable; make sure to use ExperimentalPresenceManager\");\n}\n"]}
1
+ {"version":3,"file":"datastorePresenceManagerFactory.js","sourceRoot":"","sources":["../src/datastorePresenceManagerFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAM7D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG7D;;GAEG;AACH,SAAS,0BAA0B,CAClC,OAA2E;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E,0BAA0B,CAAC,OAAO,CAAC,CAAC;gBACpC,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC9B,CAAC;CACD;AAED;;GAEG;AACH,MAAM,sBAAsB;IAA5B;QAKiB,YAAO,GAAG,IAAI,qBAAqB,CAClD,0BAA0B,EAC1B,yBAAyB,CACzB,CAAC;IACH,CAAC;IARO,EAAE,CAAC,KAA8C;QACvD,OAAO,KAAK,YAAY,yBAAyB,CAAC;IACnD,CAAC;CAMD;AAgBD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACvC,IAAI,sBAAsB,EAEzB,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,wBAAwB,CAAC,aAAqC;IAC7E,IAAI,aAAa,YAAY,yBAAyB,EAAE,CAAC;QACxD,OAAO,aAAa,CAAC,eAAe,EAAE,CAAC;IACxC,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;AACxF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/*\n * Hacky support for internal datastore based usages.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type {\n\tExtensionHostEvents,\n\tRawInboundExtensionMessage,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IInboundSignalMessage } from \"@fluidframework/runtime-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\n\nimport { BasicDataStoreFactory, LoadableFluidObject } from \"./datastoreSupport.js\";\nimport type { PresenceWithNotifications as Presence } from \"./presence.js\";\nimport { createPresenceManager } from \"./presenceManager.js\";\nimport type { OutboundPresenceMessage, SignalMessages } from \"./protocol.js\";\n\n/**\n * This provides faux validation of the signal message.\n */\nfunction assertSignalMessageIsValid(\n\tmessage: IInboundSignalMessage | RawInboundExtensionMessage<SignalMessages>,\n): asserts message is RawInboundExtensionMessage<SignalMessages> {\n\tassert(message.clientId !== null, 0xa58 /* Signal must have a client ID */);\n\t// The other difference between messages is that `content` for\n\t// RawInboundExtensionMessage is JsonDeserialized and we are fine assuming that.\n}\n\n/**\n * Simple FluidObject holding Presence Manager.\n */\nclass PresenceManagerDataObject extends LoadableFluidObject {\n\t// Creation of presence manager is deferred until first acquisition to avoid\n\t// instantiations and stand-up by Summarizer that has no actual use.\n\tprivate _presenceManager: Presence | undefined;\n\n\tpublic presenceManager(): Presence {\n\t\tif (!this._presenceManager) {\n\t\t\t// TODO: investigate if ContainerExtensionStore (path-based address routing for\n\t\t\t// Signals) is readily detectable here and use that presence manager directly.\n\t\t\tconst runtime = this.runtime;\n\t\t\tconst events = createEmitter<ExtensionHostEvents>();\n\t\t\truntime.on(\"connected\", (clientId) => events.emit(\"connected\", clientId));\n\t\t\truntime.on(\"disconnected\", () => events.emit(\"disconnected\"));\n\n\t\t\tconst manager = createPresenceManager({\n\t\t\t\tisConnected: () => runtime.connected,\n\t\t\t\tgetClientId: () => runtime.clientId,\n\t\t\t\tevents,\n\t\t\t\tgetQuorum: runtime.getQuorum.bind(runtime),\n\t\t\t\tgetAudience: runtime.getAudience.bind(runtime),\n\t\t\t\tsubmitSignal: (message: OutboundPresenceMessage) =>\n\t\t\t\t\truntime.submitSignal(message.type, message.content, message.targetClientId),\n\t\t\t\tsupportedFeatures:\n\t\t\t\t\tnew Set() /* We do not implement feature detection here since this is a deprecated path */,\n\t\t\t});\n\t\t\tthis.runtime.on(\"signal\", (message: IInboundSignalMessage, local: boolean) => {\n\t\t\t\tassertSignalMessageIsValid(message);\n\t\t\t\tmanager.processSignal([], message, local);\n\t\t\t});\n\t\t\tthis._presenceManager = manager;\n\t\t}\n\t\treturn this._presenceManager;\n\t}\n}\n\n/**\n * Factory class to create {@link Presence} in own data store.\n */\nclass PresenceManagerFactory {\n\tpublic is(value: IFluidLoadable | ExperimentalPresenceDO): value is ExperimentalPresenceDO {\n\t\treturn value instanceof PresenceManagerDataObject;\n\t}\n\n\tpublic readonly factory = new BasicDataStoreFactory(\n\t\t\"@fluidframework/presence\",\n\t\tPresenceManagerDataObject,\n\t);\n}\n\n/**\n * Brand for Experimental Presence Data Object.\n *\n * @remarks\n * See {@link getPresenceViaDataObject} for example usage.\n *\n * @deprecated Use {@link getPresence} instead.\n * @sealed\n * @alpha\n */\nexport declare class ExperimentalPresenceDO {\n\tprivate readonly _self: ExperimentalPresenceDO;\n}\n\n/**\n * DataStore based Presence Manager that is used as fallback for preferred Container\n * Extension based version requires registration. Export SharedObjectKind for registration.\n *\n * @deprecated Use {@link getPresence} instead.\n * @alpha\n */\nexport const ExperimentalPresenceManager =\n\tnew PresenceManagerFactory() as unknown as SharedObjectKind<\n\t\tIFluidLoadable & ExperimentalPresenceDO\n\t>;\n\n/**\n * Acquire Presence from a DataStore based Presence Manager\n *\n * @example\n * ```typescript\n * const containerSchema = {\n * \tinitialObjects: {\n * \t\texperimentalPresence: ExperimentalPresenceDO,\n * \t},\n * } satisfies ContainerSchema;\n * ```\n * then\n * ```typescript\n * const presence = getPresenceViaDataObject(\n * \tcontainer.initialObjects.experimentalPresence,\n * \t);\n * ```\n *\n * @deprecated Use {@link getPresence} instead.\n * @alpha\n */\nexport function getPresenceViaDataObject(fluidLoadable: ExperimentalPresenceDO): Presence {\n\tif (fluidLoadable instanceof PresenceManagerDataObject) {\n\t\treturn fluidLoadable.presenceManager();\n\t}\n\n\tthrow new Error(\"Incompatible loadable; make sure to use ExperimentalPresenceManager\");\n}\n"]}
@@ -2,12 +2,16 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ /**
6
+ * This module provided collection of minimal (slim) helpers to support
7
+ * DataObject creation for temporary {@link ExperimentalPresenceManager}.
8
+ */
5
9
  import type { FluidObject, IFluidLoadable } from "@fluidframework/core-interfaces";
6
10
  import type { IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
7
11
  import { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
8
12
  import type { IFluidDataStoreContext, IFluidDataStoreFactory } from "@fluidframework/runtime-definitions/internal";
9
13
  /**
10
- * @internal
14
+ * `BasicDataStoreFactory` is the factory for creating a {@link BasicFluidDataStoreRuntime}.
11
15
  */
12
16
  export declare class BasicDataStoreFactory<Type extends string> implements IFluidDataStoreFactory {
13
17
  readonly type: Type;
@@ -17,7 +21,8 @@ export declare class BasicDataStoreFactory<Type extends string> implements IFlui
17
21
  instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
18
22
  }
19
23
  /**
20
- * @internal
24
+ * `LoadableFluidObject` is helper to build a DataObject handling the {@link FluidObject}
25
+ * and {@link IFluidLoadable} requirements.
21
26
  */
22
27
  export declare abstract class LoadableFluidObject implements FluidObject, IFluidLoadable {
23
28
  protected readonly runtime: FluidDataStoreRuntime;
@@ -1 +1 @@
1
- {"version":3,"file":"datastoreSupport.d.ts","sourceRoot":"","sources":["../src/datastoreSupport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,WAAW,EACX,cAAc,EAGd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAErF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EACX,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AA+BtD;;GAEG;AACH,qBAAa,qBAAqB,CAAC,IAAI,SAAS,MAAM,CAAE,YAAW,sBAAsB;aAMvE,IAAI,EAAE,IAAI;IAC1B,OAAO,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