@fluidframework/presence 2.70.0-361788 → 2.71.0

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 (49) hide show
  1. package/dist/getPresence.d.ts +7 -0
  2. package/dist/getPresence.d.ts.map +1 -1
  3. package/dist/getPresence.js +66 -3
  4. package/dist/getPresence.js.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/legacy.alpha.d.ts +86 -0
  10. package/dist/package.json +4 -0
  11. package/dist/packageVersion.d.ts +9 -0
  12. package/dist/packageVersion.d.ts.map +1 -0
  13. package/dist/packageVersion.js +12 -0
  14. package/dist/packageVersion.js.map +1 -0
  15. package/dist/presenceDatastoreManager.d.ts +71 -4
  16. package/dist/presenceDatastoreManager.d.ts.map +1 -1
  17. package/dist/presenceDatastoreManager.js +365 -71
  18. package/dist/presenceDatastoreManager.js.map +1 -1
  19. package/dist/presenceManager.d.ts.map +1 -1
  20. package/dist/presenceManager.js +4 -3
  21. package/dist/presenceManager.js.map +1 -1
  22. package/dist/protocol.d.ts +9 -0
  23. package/dist/protocol.d.ts.map +1 -1
  24. package/dist/protocol.js.map +1 -1
  25. package/lib/getPresence.d.ts +7 -0
  26. package/lib/getPresence.d.ts.map +1 -1
  27. package/lib/getPresence.js +65 -3
  28. package/lib/getPresence.js.map +1 -1
  29. package/lib/index.d.ts +1 -1
  30. package/lib/index.d.ts.map +1 -1
  31. package/lib/index.js +1 -1
  32. package/lib/index.js.map +1 -1
  33. package/lib/legacy.alpha.d.ts +86 -0
  34. package/lib/packageVersion.d.ts +9 -0
  35. package/lib/packageVersion.d.ts.map +1 -0
  36. package/lib/packageVersion.js +9 -0
  37. package/lib/packageVersion.js.map +1 -0
  38. package/lib/presenceDatastoreManager.d.ts +71 -4
  39. package/lib/presenceDatastoreManager.d.ts.map +1 -1
  40. package/lib/presenceDatastoreManager.js +364 -70
  41. package/lib/presenceDatastoreManager.js.map +1 -1
  42. package/lib/presenceManager.d.ts.map +1 -1
  43. package/lib/presenceManager.js +4 -3
  44. package/lib/presenceManager.js.map +1 -1
  45. package/lib/protocol.d.ts +9 -0
  46. package/lib/protocol.d.ts.map +1 -1
  47. package/lib/protocol.js.map +1 -1
  48. package/package.json +39 -23
  49. package/lib/tsdoc-metadata.json +0 -11
@@ -3,6 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IFluidContainer } from "@fluidframework/fluid-static";
6
+ import type { IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
6
7
  import type { Presence, PresenceWithNotifications } from "./presence.js";
7
8
  /**
8
9
  * Acquire a {@link Presence} from a Fluid Container
@@ -20,4 +21,10 @@ export declare const getPresence: (fluidContainer: IFluidContainer) => Presence;
20
21
  * @alpha
21
22
  */
22
23
  export declare function getPresenceAlpha(fluidContainer: IFluidContainer): PresenceWithNotifications;
24
+ /**
25
+ * Get {@link Presence} from a Fluid Data Store Context
26
+ *
27
+ * @legacy @alpha
28
+ */
29
+ export declare function getPresenceFromDataStoreContext(context: IFluidDataStoreContext): Presence;
23
30
  //# sourceMappingURL=getPresence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPresence.d.ts","sourceRoot":"","sources":["../src/getPresence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIpE,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AA6CzE;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,CAAC,cAAc,EAAE,eAAe,KAAK,QAA2B,CAAC;AAE3F;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,eAAe,GAAG,yBAAyB,CAW3F"}
1
+ {"version":3,"file":"getPresence.d.ts","sourceRoot":"","sources":["../src/getPresence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,EAGX,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AAItD,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAuIzE;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,CAAC,cAAc,EAAE,eAAe,KAAK,QAA2B,CAAC;AAE3F;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,eAAe,GAAG,yBAAyB,CAO3F;AAWD;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,sBAAsB,GAAG,QAAQ,CAGzF"}
@@ -4,15 +4,33 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.getPresenceAlpha = exports.getPresence = void 0;
7
+ exports.getPresenceFromDataStoreContext = exports.getPresenceAlpha = exports.getPresence = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const internal_2 = require("@fluidframework/fluid-static/internal");
10
+ const packageVersion_js_1 = require("./packageVersion.js");
10
11
  const presenceManager_js_1 = require("./presenceManager.js");
12
+ const presenceCompatibility = {
13
+ generation: 1,
14
+ version: packageVersion_js_1.pkgVersion,
15
+ capabilities: new Set([]),
16
+ };
17
+ // Compatibility infrastructure was added in 2.71.0. Once version is bumped,
18
+ // this can be used to accept instances from 2.71.0 and newer (up to current).
19
+ // const minimalCompatiblePackageVersion = "2.71.0-0";
20
+ function assertCompatibilityInvariants(compatibility) {
21
+ (0, internal_1.assert)(compatibility.generation === presenceCompatibility.generation, 0xc97 /* Presence compatibility generation mismatch. */);
22
+ (0, internal_1.assert)(compatibility.version.startsWith("2."), 0xc98 /* Registered version is not major version 2. */);
23
+ (0, internal_1.assert)(Number.parseFloat(compatibility.version.slice(2)) <
24
+ Number.parseFloat(presenceCompatibility.version.slice(2)), 0xc99 /* Registered version is not less than the current version. */);
25
+ (0, internal_1.assert)(presenceCompatibility.capabilities.size === 0, 0xc9a /* Presence capabilities should be empty. */);
26
+ }
11
27
  /**
12
28
  * Common Presence manager for a container
13
29
  */
14
30
  class ContainerPresenceManager {
15
31
  constructor(host) {
32
+ // ContainerExtensionFactory return elements
33
+ this.compatibility = presenceCompatibility;
16
34
  this.extension = this;
17
35
  this.interface = this.manager = (0, presenceManager_js_1.createPresenceManager)({
18
36
  ...host,
@@ -21,6 +39,13 @@ class ContainerPresenceManager {
21
39
  },
22
40
  });
23
41
  }
42
+ handleVersionOrCapabilitiesMismatch(ourExistingInstantiation, newCompatibilityRequest) {
43
+ (0, internal_1.assert)(ourExistingInstantiation.compatibility === presenceCompatibility, 0xc9b /* Presence extension called without own compatibility details */);
44
+ assertCompatibilityInvariants(newCompatibilityRequest);
45
+ // There have not yet been any changes that would require action to upgrade.
46
+ // But also mixed runtime versions are not yet expected.
47
+ (0, internal_1.fail)("Presence is only expected to be accessed with a single version.");
48
+ }
24
49
  onNewUse() {
25
50
  // No-op
26
51
  }
@@ -28,7 +53,32 @@ class ContainerPresenceManager {
28
53
  this.manager.processSignal(addressChain, message, local);
29
54
  }
30
55
  }
31
- ContainerPresenceManager.extensionId = "dis:bb89f4c0-80fd-4f0c-8469-4f2848ee7f4a";
56
+ const extensionId = "dis:bb89f4c0-80fd-4f0c-8469-4f2848ee7f4a";
57
+ const ContainerPresenceFactory = {
58
+ hostRequirements: {
59
+ minSupportedGeneration: 1,
60
+ requiredFeatures: [],
61
+ },
62
+ instanceExpectations: presenceCompatibility,
63
+ resolvePriorInstantiation(existingInstantiation) {
64
+ // Validate assumptions about existing instance
65
+ assertCompatibilityInvariants(existingInstantiation.compatibility);
66
+ // There have not yet been any changes that would require action to upgrade.
67
+ // But also mixed runtime versions are not yet expected.
68
+ (0, internal_1.fail)("Presence is only expected to be accessed with a single version.");
69
+ },
70
+ instantiateExtension(host) {
71
+ return new ContainerPresenceManager(host);
72
+ },
73
+ [Symbol.hasInstance]: (instance) => {
74
+ return (instance instanceof ContainerPresenceManager
75
+ // typeof instance === "object" &&
76
+ // instance !== null &&
77
+ // "extension" in instance &&
78
+ // instance.extension instanceof ContainerPresenceManager
79
+ );
80
+ },
81
+ };
32
82
  /**
33
83
  * Acquire a {@link Presence} from a Fluid Container
34
84
  * @param fluidContainer - Fluid Container to acquire the map from
@@ -46,8 +96,21 @@ exports.getPresence = getPresenceAlpha;
46
96
  */
47
97
  function getPresenceAlpha(fluidContainer) {
48
98
  (0, internal_1.assert)((0, internal_2.isInternalFluidContainer)(fluidContainer), 0xa2f /* IFluidContainer was not recognized. Only Containers generated by the Fluid Framework are supported. */);
49
- const presence = fluidContainer.acquireExtension(ContainerPresenceManager.extensionId, ContainerPresenceManager);
99
+ const presence = fluidContainer.acquireExtension(extensionId, ContainerPresenceFactory);
50
100
  return presence;
51
101
  }
52
102
  exports.getPresenceAlpha = getPresenceAlpha;
103
+ function assertContextHasExtensionProvider(context) {
104
+ (0, internal_1.assert)("getExtension" in context, 0xc9c /* Data store context does not implement ContainerExtensionProvider */);
105
+ }
106
+ /**
107
+ * Get {@link Presence} from a Fluid Data Store Context
108
+ *
109
+ * @legacy @alpha
110
+ */
111
+ function getPresenceFromDataStoreContext(context) {
112
+ assertContextHasExtensionProvider(context);
113
+ return context.getExtension(extensionId, ContainerPresenceFactory);
114
+ }
115
+ exports.getPresenceFromDataStoreContext = getPresenceFromDataStoreContext;
53
116
  //# sourceMappingURL=getPresence.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPresence.js","sourceRoot":"","sources":["../src/getPresence.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,kEAA6D;AAE7D,oEAAiF;AAKjF,6DAA6D;AAG7D;;GAEG;AACH,MAAM,wBAAwB;IAa7B,YAAmB,IAAmB;QAJtB,cAAS,GAAG,IAAI,CAAC;QAKhC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,GAAG,IAAA,0CAAqB,EAAC;YACrD,GAAG,IAAI;YACP,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE;gBACzB,IAAI,CAAC,qBAAqB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;SACD,CAAC,CAAC;IACJ,CAAC;IAEM,QAAQ;QACd,QAAQ;IACT,CAAC;IAIM,aAAa,CACnB,YAAsB,EACtB,OAAgD,EAChD,KAAc;QAEd,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;;AARsB,oCAAW,GAAG,0CAA0C,AAA7C,CAA8C;AAWjF;;;;;;GAMG;AACU,QAAA,WAAW,GAAkD,gBAAgB,CAAC;AAE3F;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,cAA+B;IAC/D,IAAA,iBAAM,EACL,IAAA,mCAAwB,EAAC,cAAc,CAAC,EACxC,KAAK,CAAC,yGAAyG,CAC/G,CAAC;IAEF,MAAM,QAAQ,GAAG,cAAc,CAAC,gBAAgB,CAC/C,wBAAwB,CAAC,WAAW,EACpC,wBAAwB,CACxB,CAAC;IACF,OAAO,QAAQ,CAAC;AACjB,CAAC;AAXD,4CAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tContainerExtension,\n\tContainerExtensionFactory,\n\tInboundExtensionMessage,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\nimport { isInternalFluidContainer } from \"@fluidframework/fluid-static/internal\";\n\nimport type { ExtensionHost, ExtensionRuntimeProperties } from \"./internalTypes.js\";\nimport type { Presence, PresenceWithNotifications } from \"./presence.js\";\nimport type { PresenceExtensionInterface } from \"./presenceManager.js\";\nimport { createPresenceManager } from \"./presenceManager.js\";\nimport type { SignalMessages } from \"./protocol.js\";\n\n/**\n * Common Presence manager for a container\n */\nclass ContainerPresenceManager\n\timplements\n\t\tContainerExtension<ExtensionRuntimeProperties>,\n\t\tInstanceType<\n\t\t\tContainerExtensionFactory<PresenceWithNotifications, ExtensionRuntimeProperties>\n\t\t>\n{\n\t// ContainerExtensionFactory return elements\n\tpublic readonly interface: PresenceWithNotifications;\n\tpublic readonly extension = this;\n\n\tprivate readonly manager: PresenceExtensionInterface;\n\n\tpublic constructor(host: ExtensionHost) {\n\t\tthis.interface = this.manager = createPresenceManager({\n\t\t\t...host,\n\t\t\tsubmitSignal: (message) => {\n\t\t\t\thost.submitAddressedSignal([], message);\n\t\t\t},\n\t\t});\n\t}\n\n\tpublic onNewUse(): void {\n\t\t// No-op\n\t}\n\n\tpublic static readonly extensionId = \"dis:bb89f4c0-80fd-4f0c-8469-4f2848ee7f4a\";\n\n\tpublic processSignal(\n\t\taddressChain: string[],\n\t\tmessage: InboundExtensionMessage<SignalMessages>,\n\t\tlocal: boolean,\n\t): void {\n\t\tthis.manager.processSignal(addressChain, message, local);\n\t}\n}\n\n/**\n * Acquire a {@link Presence} from a Fluid Container\n * @param fluidContainer - Fluid Container to acquire the map from\n * @returns the {@link Presence}\n *\n * @beta\n */\nexport const getPresence: (fluidContainer: IFluidContainer) => Presence = getPresenceAlpha;\n\n/**\n * Acquire a {@link PresenceWithNotifications} from a Fluid Container\n * @param fluidContainer - Fluid Container to acquire the map from\n * @returns the {@link PresenceWithNotifications}\n *\n * @alpha\n */\nexport function getPresenceAlpha(fluidContainer: IFluidContainer): PresenceWithNotifications {\n\tassert(\n\t\tisInternalFluidContainer(fluidContainer),\n\t\t0xa2f /* IFluidContainer was not recognized. Only Containers generated by the Fluid Framework are supported. */,\n\t);\n\n\tconst presence = fluidContainer.acquireExtension(\n\t\tContainerPresenceManager.extensionId,\n\t\tContainerPresenceManager,\n\t);\n\treturn presence;\n}\n"]}
1
+ {"version":3,"file":"getPresence.js","sourceRoot":"","sources":["../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AC,cAA+B;IAC/D,IAAA,iBAAM,EACL,IAAA,mCAAwB,EAAC,cAAc,CAAC,EACxC,KAAK,CAAC,yGAAyG,CAC/G,CAAC;IACF,MAAM,QAAQ,GAAG,cAAc,CAAC,gBAAgB,CAAC,WAAW,EAAE,wBAAwB,CAAC,CAAC;IACxF,OAAO,QAAQ,CAAC;AACjB,CAAC;AAPD,4CAOC;AAED,SAAS,iCAAiC,CACzC,OAA+B;IAE/B,IAAA,iBAAM,EACL,cAAc,IAAI,OAAO,EACzB,KAAK,CAAC,sEAAsE,CAC5E,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,+BAA+B,CAAC,OAA+B;IAC9E,iCAAiC,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,OAAO,CAAC,YAAY,CAAC,WAAW,EAAE,wBAAwB,CAAC,CAAC;AACpE,CAAC;AAHD,0EAGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ILayerCompatSupportRequirements } from \"@fluid-internal/client-utils\";\nimport type {\n\tContainerExtension,\n\tContainerExtensionFactory,\n\tExtensionInstantiationResult,\n\tExtensionRuntimeProperties as GenericExtensionRuntimeProperties,\n\tInboundExtensionMessage,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\nimport { isInternalFluidContainer } from \"@fluidframework/fluid-static/internal\";\nimport type {\n\tExtensionCompatibilityDetails,\n\tFluidDataStoreContextInternal,\n\tIFluidDataStoreContext,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport type { ExtensionHost, ExtensionRuntimeProperties } from \"./internalTypes.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport type { Presence, PresenceWithNotifications } from \"./presence.js\";\nimport type { PresenceExtensionInterface } from \"./presenceManager.js\";\nimport { createPresenceManager } from \"./presenceManager.js\";\nimport type { SignalMessages } from \"./protocol.js\";\n\nconst presenceCompatibility = {\n\tgeneration: 1,\n\tversion: pkgVersion,\n\tcapabilities: new Set([]),\n} as const satisfies ExtensionCompatibilityDetails;\n\n// Compatibility infrastructure was added in 2.71.0. Once version is bumped,\n// this can be used to accept instances from 2.71.0 and newer (up to current).\n// const minimalCompatiblePackageVersion = \"2.71.0-0\";\n\nfunction assertCompatibilityInvariants(compatibility: ExtensionCompatibilityDetails): void {\n\tassert(\n\t\tcompatibility.generation === presenceCompatibility.generation,\n\t\t0xc97 /* Presence compatibility generation mismatch. */,\n\t);\n\tassert(\n\t\tcompatibility.version.startsWith(\"2.\"),\n\t\t0xc98 /* Registered version is not major version 2. */,\n\t);\n\tassert(\n\t\tNumber.parseFloat(compatibility.version.slice(2)) <\n\t\t\tNumber.parseFloat(presenceCompatibility.version.slice(2)),\n\t\t0xc99 /* Registered version is not less than the current version. */,\n\t);\n\tassert(\n\t\tpresenceCompatibility.capabilities.size === 0,\n\t\t0xc9a /* Presence capabilities should be empty. */,\n\t);\n}\n\n/**\n * Common Presence manager for a container\n */\nclass ContainerPresenceManager\n\timplements\n\t\tContainerExtension<ExtensionRuntimeProperties>,\n\t\tReturnType<\n\t\t\tContainerExtensionFactory<\n\t\t\t\tPresenceWithNotifications,\n\t\t\t\tExtensionRuntimeProperties\n\t\t\t>[\"instantiateExtension\"]\n\t\t>\n{\n\t// ContainerExtensionFactory return elements\n\tpublic readonly compatibility = presenceCompatibility;\n\tpublic readonly interface: PresenceWithNotifications;\n\tpublic readonly extension = this;\n\n\tprivate readonly manager: PresenceExtensionInterface;\n\n\tpublic constructor(host: ExtensionHost) {\n\t\tthis.interface = this.manager = createPresenceManager({\n\t\t\t...host,\n\t\t\tsubmitSignal: (message) => {\n\t\t\t\thost.submitAddressedSignal([], message);\n\t\t\t},\n\t\t});\n\t}\n\n\tpublic handleVersionOrCapabilitiesMismatch<_TRequestedInterface>(\n\t\tourExistingInstantiation: Readonly<\n\t\t\tExtensionInstantiationResult<PresenceWithNotifications, ExtensionRuntimeProperties, []>\n\t\t>,\n\t\tnewCompatibilityRequest: ExtensionCompatibilityDetails,\n\t): never {\n\t\tassert(\n\t\t\tourExistingInstantiation.compatibility === presenceCompatibility,\n\t\t\t0xc9b /* Presence extension called without own compatibility details */,\n\t\t);\n\t\tassertCompatibilityInvariants(newCompatibilityRequest);\n\t\t// There have not yet been any changes that would require action to upgrade.\n\t\t// But also mixed runtime versions are not yet expected.\n\t\tfail(\"Presence is only expected to be accessed with a single version.\");\n\t}\n\n\tpublic onNewUse(): void {\n\t\t// No-op\n\t}\n\n\tpublic processSignal(\n\t\taddressChain: string[],\n\t\tmessage: InboundExtensionMessage<SignalMessages>,\n\t\tlocal: boolean,\n\t): void {\n\t\tthis.manager.processSignal(addressChain, message, local);\n\t}\n}\n\nconst extensionId = \"dis:bb89f4c0-80fd-4f0c-8469-4f2848ee7f4a\";\n\nconst ContainerPresenceFactory = {\n\thostRequirements: {\n\t\tminSupportedGeneration: 1,\n\t\trequiredFeatures: [],\n\t} as const satisfies ILayerCompatSupportRequirements,\n\n\tinstanceExpectations: presenceCompatibility,\n\n\tresolvePriorInstantiation(\n\t\texistingInstantiation: ExtensionInstantiationResult<\n\t\t\tunknown,\n\t\t\tGenericExtensionRuntimeProperties,\n\t\t\tunknown[]\n\t\t>,\n\t): never {\n\t\t// Validate assumptions about existing instance\n\t\tassertCompatibilityInvariants(existingInstantiation.compatibility);\n\t\t// There have not yet been any changes that would require action to upgrade.\n\t\t// But also mixed runtime versions are not yet expected.\n\t\tfail(\"Presence is only expected to be accessed with a single version.\");\n\t},\n\n\tinstantiateExtension(host: ExtensionHost): ContainerPresenceManager {\n\t\treturn new ContainerPresenceManager(host);\n\t},\n\n\t[Symbol.hasInstance]: (instance: unknown): instance is ContainerPresenceManager => {\n\t\treturn (\n\t\t\tinstance instanceof ContainerPresenceManager\n\t\t\t// typeof instance === \"object\" &&\n\t\t\t// instance !== null &&\n\t\t\t// \"extension\" in instance &&\n\t\t\t// instance.extension instanceof ContainerPresenceManager\n\t\t);\n\t},\n} as const satisfies ContainerExtensionFactory<\n\tPresenceWithNotifications,\n\tExtensionRuntimeProperties\n>;\n\n/**\n * Acquire a {@link Presence} from a Fluid Container\n * @param fluidContainer - Fluid Container to acquire the map from\n * @returns the {@link Presence}\n *\n * @beta\n */\nexport const getPresence: (fluidContainer: IFluidContainer) => Presence = getPresenceAlpha;\n\n/**\n * Acquire a {@link PresenceWithNotifications} from a Fluid Container\n * @param fluidContainer - Fluid Container to acquire the map from\n * @returns the {@link PresenceWithNotifications}\n *\n * @alpha\n */\nexport function getPresenceAlpha(fluidContainer: IFluidContainer): PresenceWithNotifications {\n\tassert(\n\t\tisInternalFluidContainer(fluidContainer),\n\t\t0xa2f /* IFluidContainer was not recognized. Only Containers generated by the Fluid Framework are supported. */,\n\t);\n\tconst presence = fluidContainer.acquireExtension(extensionId, ContainerPresenceFactory);\n\treturn presence;\n}\n\nfunction assertContextHasExtensionProvider(\n\tcontext: IFluidDataStoreContext,\n): asserts context is FluidDataStoreContextInternal {\n\tassert(\n\t\t\"getExtension\" in context,\n\t\t0xc9c /* Data store context does not implement ContainerExtensionProvider */,\n\t);\n}\n\n/**\n * Get {@link Presence} from a Fluid Data Store Context\n *\n * @legacy @alpha\n */\nexport function getPresenceFromDataStoreContext(context: IFluidDataStoreContext): Presence {\n\tassertContextHasExtensionProvider(context);\n\treturn context.getExtension(extensionId, ContainerPresenceFactory);\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export type { ClientConnectionId } from "./baseTypes.js";
13
13
  export type { NotificationsWorkspace, NotificationsWorkspaceSchema, StatesWorkspace, StatesWorkspaceEntries, StatesWorkspaceSchema, StatesWorkspaceEntry, WorkspaceAddress, } from "./types.js";
14
14
  export { type Attendee, type AttendeesEvents, type AttendeeId, AttendeeStatus, type Presence, type PresenceEvents, type PresenceWithNotifications, } from "./presence.js";
15
15
  export type { BroadcastControls, BroadcastControlSettings, } from "./broadcastControls.js";
16
- export { getPresence, getPresenceAlpha } from "./getPresence.js";
16
+ export { getPresence, getPresenceAlpha, getPresenceFromDataStoreContext, } from "./getPresence.js";
17
17
  export { getPresenceViaDataObject, type ExperimentalPresenceDO, ExperimentalPresenceManager, } from "./datastorePresenceManagerFactory.js";
18
18
  export type { LatestMap, LatestMapArguments, LatestMapArgumentsRaw, LatestMapClientData, LatestMapEvents, LatestMapFactory, LatestMapItemRemovedClientData, LatestMapItemUpdatedClientData, LatestMapRaw, LatestMapRawEvents, StateMap, } from "./latestMapValueManager.js";
19
19
  export type { Latest, LatestArguments, LatestArgumentsRaw, LatestEvents, LatestFactory, LatestRaw, LatestRawEvents, } from "./latestValueManager.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,YAAY,EACX,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,cAAc,EACd,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,yBAAyB,GAC9B,MAAM,eAAe,CAAC;AAEvB,YAAY,EACX,iBAAiB,EACjB,wBAAwB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EACN,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,2BAA2B,GAC3B,MAAM,sCAAsC,CAAC;AAE9C,YAAY,EACX,SAAS,EACT,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,8BAA8B,EAC9B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CAAC;AAE1B,OAAO,EACN,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,2BAA2B,GAC3B,MAAM,sCAAsC,CAAC;AAE9C,YAAY,EACX,SAAS,EACT,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,8BAA8B,EAC9B,8BAA8B,EAC9B,YAAY,EACZ,kBAAkB,EAClB,QAAQ,GACR,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACX,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,SAAS,EACT,eAAe,GACf,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,GACb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,GAC/B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -4,12 +4,13 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.StateFactory = exports.Notifications = exports.ExperimentalPresenceManager = exports.getPresenceViaDataObject = exports.getPresenceAlpha = exports.getPresence = exports.AttendeeStatus = void 0;
7
+ exports.StateFactory = exports.Notifications = exports.ExperimentalPresenceManager = exports.getPresenceViaDataObject = exports.getPresenceFromDataStoreContext = exports.getPresenceAlpha = exports.getPresence = exports.AttendeeStatus = void 0;
8
8
  var presence_js_1 = require("./presence.js");
9
9
  Object.defineProperty(exports, "AttendeeStatus", { enumerable: true, get: function () { return presence_js_1.AttendeeStatus; } });
10
10
  var getPresence_js_1 = require("./getPresence.js");
11
11
  Object.defineProperty(exports, "getPresence", { enumerable: true, get: function () { return getPresence_js_1.getPresence; } });
12
12
  Object.defineProperty(exports, "getPresenceAlpha", { enumerable: true, get: function () { return getPresence_js_1.getPresenceAlpha; } });
13
+ Object.defineProperty(exports, "getPresenceFromDataStoreContext", { enumerable: true, get: function () { return getPresence_js_1.getPresenceFromDataStoreContext; } });
13
14
  var datastorePresenceManagerFactory_js_1 = require("./datastorePresenceManagerFactory.js");
14
15
  Object.defineProperty(exports, "getPresenceViaDataObject", { enumerable: true, get: function () { return datastorePresenceManagerFactory_js_1.getPresenceViaDataObject; } });
15
16
  Object.defineProperty(exports, "ExperimentalPresenceManager", { enumerable: true, get: function () { return datastorePresenceManagerFactory_js_1.ExperimentalPresenceManager; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,6CAQuB;AAJtB,6GAAA,cAAc,OAAA;AAWf,mDAAiE;AAAxD,6GAAA,WAAW,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAEtC,2FAI8C;AAH7C,8IAAA,wBAAwB,OAAA;AAExB,iJAAA,2BAA2B,OAAA;AAoC5B,qEAOmC;AAHlC,wHAAA,aAAa,OAAA;AAKd,qDAAiD;AAAxC,+GAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Package for client presence within a connected session.\n *\n * See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.\n *\n * @packageDocumentation\n */\n\nexport type { ClientConnectionId } from \"./baseTypes.js\";\n\nexport type {\n\tNotificationsWorkspace,\n\tNotificationsWorkspaceSchema,\n\tStatesWorkspace,\n\tStatesWorkspaceEntries,\n\tStatesWorkspaceSchema,\n\tStatesWorkspaceEntry,\n\tWorkspaceAddress,\n} from \"./types.js\";\n\nexport {\n\ttype Attendee,\n\ttype AttendeesEvents,\n\ttype AttendeeId,\n\tAttendeeStatus,\n\ttype Presence,\n\ttype PresenceEvents,\n\ttype PresenceWithNotifications,\n} from \"./presence.js\";\n\nexport type {\n\tBroadcastControls,\n\tBroadcastControlSettings,\n} from \"./broadcastControls.js\";\n\nexport { getPresence, getPresenceAlpha } from \"./getPresence.js\";\n\nexport {\n\tgetPresenceViaDataObject,\n\ttype ExperimentalPresenceDO,\n\tExperimentalPresenceManager,\n} from \"./datastorePresenceManagerFactory.js\";\n\nexport type {\n\tLatestMap,\n\tLatestMapArguments,\n\tLatestMapArgumentsRaw,\n\tLatestMapClientData,\n\tLatestMapEvents,\n\tLatestMapFactory,\n\tLatestMapItemRemovedClientData,\n\tLatestMapItemUpdatedClientData,\n\tLatestMapRaw,\n\tLatestMapRawEvents,\n\tStateMap,\n} from \"./latestMapValueManager.js\";\nexport type {\n\tLatest,\n\tLatestArguments,\n\tLatestArgumentsRaw,\n\tLatestEvents,\n\tLatestFactory,\n\tLatestRaw,\n\tLatestRawEvents,\n} from \"./latestValueManager.js\";\nexport type {\n\tAccessor,\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n\tProxiedValueAccessor,\n\tRawValueAccessor,\n\tStateSchemaValidator,\n\tValueAccessor,\n} from \"./latestValueTypes.js\";\n\nexport {\n\ttype NotificationEmitter,\n\ttype NotificationListenable,\n\ttype NotificationSubscriptions,\n\tNotifications,\n\ttype NotificationsManager,\n\ttype NotificationsManagerEvents,\n} from \"./notificationsManager.js\";\n\nexport { StateFactory } from \"./stateFactory.js\";\n\nexport type { InternalTypes } from \"./exposedInternalTypes.js\";\nexport type { InternalUtilityTypes } from \"./exposedUtilityTypes.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,6CAQuB;AAJtB,6GAAA,cAAc,OAAA;AAWf,mDAI0B;AAHzB,6GAAA,WAAW,OAAA;AACX,kHAAA,gBAAgB,OAAA;AAChB,iIAAA,+BAA+B,OAAA;AAGhC,2FAI8C;AAH7C,8IAAA,wBAAwB,OAAA;AAExB,iJAAA,2BAA2B,OAAA;AAoC5B,qEAOmC;AAHlC,wHAAA,aAAa,OAAA;AAKd,qDAAiD;AAAxC,+GAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Package for client presence within a connected session.\n *\n * See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.\n *\n * @packageDocumentation\n */\n\nexport type { ClientConnectionId } from \"./baseTypes.js\";\n\nexport type {\n\tNotificationsWorkspace,\n\tNotificationsWorkspaceSchema,\n\tStatesWorkspace,\n\tStatesWorkspaceEntries,\n\tStatesWorkspaceSchema,\n\tStatesWorkspaceEntry,\n\tWorkspaceAddress,\n} from \"./types.js\";\n\nexport {\n\ttype Attendee,\n\ttype AttendeesEvents,\n\ttype AttendeeId,\n\tAttendeeStatus,\n\ttype Presence,\n\ttype PresenceEvents,\n\ttype PresenceWithNotifications,\n} from \"./presence.js\";\n\nexport type {\n\tBroadcastControls,\n\tBroadcastControlSettings,\n} from \"./broadcastControls.js\";\n\nexport {\n\tgetPresence,\n\tgetPresenceAlpha,\n\tgetPresenceFromDataStoreContext,\n} from \"./getPresence.js\";\n\nexport {\n\tgetPresenceViaDataObject,\n\ttype ExperimentalPresenceDO,\n\tExperimentalPresenceManager,\n} from \"./datastorePresenceManagerFactory.js\";\n\nexport type {\n\tLatestMap,\n\tLatestMapArguments,\n\tLatestMapArgumentsRaw,\n\tLatestMapClientData,\n\tLatestMapEvents,\n\tLatestMapFactory,\n\tLatestMapItemRemovedClientData,\n\tLatestMapItemUpdatedClientData,\n\tLatestMapRaw,\n\tLatestMapRawEvents,\n\tStateMap,\n} from \"./latestMapValueManager.js\";\nexport type {\n\tLatest,\n\tLatestArguments,\n\tLatestArgumentsRaw,\n\tLatestEvents,\n\tLatestFactory,\n\tLatestRaw,\n\tLatestRawEvents,\n} from \"./latestValueManager.js\";\nexport type {\n\tAccessor,\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n\tProxiedValueAccessor,\n\tRawValueAccessor,\n\tStateSchemaValidator,\n\tValueAccessor,\n} from \"./latestValueTypes.js\";\n\nexport {\n\ttype NotificationEmitter,\n\ttype NotificationListenable,\n\ttype NotificationSubscriptions,\n\tNotifications,\n\ttype NotificationsManager,\n\ttype NotificationsManagerEvents,\n} from \"./notificationsManager.js\";\n\nexport { StateFactory } from \"./stateFactory.js\";\n\nexport type { InternalTypes } from \"./exposedInternalTypes.js\";\nexport type { InternalUtilityTypes } from \"./exposedUtilityTypes.js\";\n"]}
@@ -0,0 +1,86 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
9
+ */
10
+
11
+ /**
12
+ * Package for client presence within a connected session.
13
+ *
14
+ * See {@link https://github.com/microsoft/FluidFramework/tree/main/packages/framework/presence#readme | README.md } for an overview of the package.
15
+ *
16
+ * @packageDocumentation
17
+ */
18
+
19
+ export {
20
+ // #region @beta APIs
21
+ Accessor,
22
+ Attendee,
23
+ AttendeeId,
24
+ AttendeeStatus,
25
+ AttendeesEvents,
26
+ BroadcastControlSettings,
27
+ BroadcastControls,
28
+ ClientConnectionId,
29
+ InternalTypes,
30
+ Latest,
31
+ LatestArguments,
32
+ LatestArgumentsRaw,
33
+ LatestClientData,
34
+ LatestData,
35
+ LatestEvents,
36
+ LatestFactory,
37
+ LatestMap,
38
+ LatestMapArguments,
39
+ LatestMapArgumentsRaw,
40
+ LatestMapClientData,
41
+ LatestMapEvents,
42
+ LatestMapFactory,
43
+ LatestMapItemRemovedClientData,
44
+ LatestMapItemUpdatedClientData,
45
+ LatestMapRaw,
46
+ LatestMapRawEvents,
47
+ LatestMetadata,
48
+ LatestRaw,
49
+ LatestRawEvents,
50
+ Presence,
51
+ PresenceEvents,
52
+ ProxiedValueAccessor,
53
+ RawValueAccessor,
54
+ StateFactory,
55
+ StateMap,
56
+ StateSchemaValidator,
57
+ StatesWorkspace,
58
+ StatesWorkspaceEntries,
59
+ StatesWorkspaceEntry,
60
+ StatesWorkspaceSchema,
61
+ ValueAccessor,
62
+ WorkspaceAddress,
63
+ getPresence,
64
+ // #endregion
65
+
66
+ // #region @alpha APIs
67
+ ExperimentalPresenceDO,
68
+ ExperimentalPresenceManager,
69
+ InternalUtilityTypes,
70
+ NotificationEmitter,
71
+ NotificationListenable,
72
+ NotificationSubscriptions,
73
+ Notifications,
74
+ NotificationsManager,
75
+ NotificationsManagerEvents,
76
+ NotificationsWorkspace,
77
+ NotificationsWorkspaceSchema,
78
+ PresenceWithNotifications,
79
+ getPresenceAlpha,
80
+ getPresenceViaDataObject,
81
+ // #endregion
82
+
83
+ // #region @legacyAlpha APIs
84
+ getPresenceFromDataStoreContext
85
+ // #endregion
86
+ } from "./index.js";
package/dist/package.json CHANGED
@@ -9,6 +9,10 @@
9
9
  "./alpha": {
10
10
  "types": "./alpha.d.ts",
11
11
  "default": "./index.js"
12
+ },
13
+ "./legacy/alpha": {
14
+ "types": "./legacy.alpha.d.ts",
15
+ "default": "./index.js"
12
16
  }
13
17
  }
14
18
  }
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
+ */
7
+ export declare const pkgName = "@fluidframework/presence";
8
+ export declare const pkgVersion = "2.71.0";
9
+ //# sourceMappingURL=packageVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,UAAU,WAAW,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ *
6
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.pkgVersion = exports.pkgName = void 0;
10
+ exports.pkgName = "@fluidframework/presence";
11
+ exports.pkgVersion = "2.71.0";
12
+ //# sourceMappingURL=packageVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/presence\";\nexport const pkgVersion = \"2.71.0\";\n"]}
@@ -30,10 +30,32 @@ export declare function isValueDirectory<T>(obj: ValidatableValueDirectory<T> |
30
30
  */
31
31
  export interface PresenceDatastoreManager {
32
32
  joinSession(clientId: ClientConnectionId): void;
33
+ onDisconnected(): void;
33
34
  getWorkspace<TSchema extends StatesWorkspaceSchema>(internalWorkspaceAddress: `s:${WorkspaceAddress}`, requestedContent: TSchema, controls?: BroadcastControlSettings): StatesWorkspace<TSchema>;
34
35
  getWorkspace<TSchema extends NotificationsWorkspaceSchema>(internalWorkspaceAddress: `n:${WorkspaceAddress}`, requestedContent: TSchema): NotificationsWorkspace<TSchema>;
35
36
  processSignal(message: InboundExtensionMessage<SignalMessages>, local: boolean, optional: boolean): void;
36
37
  }
38
+ /**
39
+ * Delays used for broadcasting join responses to clients.
40
+ *
41
+ * @remarks
42
+ * Exported for test coordination.
43
+ * These could be made customizable in the future to accommodate different
44
+ * session configurations.
45
+ */
46
+ export declare const broadcastJoinResponseDelaysMs: {
47
+ /**
48
+ * The delay in milliseconds before a join response is sent to any client.
49
+ * This is used to accumulate other join response requests and reduce
50
+ * network traffic.
51
+ */
52
+ readonly namedResponder: 200;
53
+ /**
54
+ * The additional delay in milliseconds a backup responder waits before sending
55
+ * a join response to allow others to respond first.
56
+ */
57
+ readonly backupResponderIncrement: 40;
58
+ };
37
59
  /**
38
60
  * Manages singleton datastore for all Presence.
39
61
  */
@@ -46,15 +68,55 @@ export declare class PresenceDatastoreManagerImpl implements PresenceDatastoreMa
46
68
  private readonly datastore;
47
69
  private averageLatency;
48
70
  private returnedMessages;
49
- private refreshBroadcastRequested;
50
- private readonly timer;
71
+ private readonly sendMessageTimer;
51
72
  private readonly workspaces;
52
73
  private readonly targetedSignalSupport;
74
+ /**
75
+ * When defined, this client is not recognized in the session.
76
+ * Call when no longer caring about that condition. That way listeners are
77
+ * cleaned up.
78
+ */
79
+ private stopWaitingForSelfInAudience;
80
+ /**
81
+ * Tracks whether this client has complete snapshot level knowledge and
82
+ * how that determination was reached.
83
+ * - "alone": no other audience members detected at join
84
+ * - "join response": another client has responded to our join request
85
+ * - "full requests": all others have requested response from us
86
+ *
87
+ * @remarks
88
+ * Only applies when not using targeted join responses.
89
+ *
90
+ * Without a complete snapshot, we cannot fully onboard any other clients.
91
+ * One exception to this is if this client is the only participant in the
92
+ * session. In such a case, there is no one to respond to the join request.
93
+ * Another exception is multiple clients attempting to join at the same
94
+ * time and thus expecting that someone has full knowledge, yet none have
95
+ * received a complete update to think they are qualified to respond.
96
+ * Generically if the number of outstanding requestors meets or exceeds the
97
+ * count of other audience members, then we can consider the snapshot
98
+ * complete (as all will have provided their own complete information in
99
+ * their join responses).
100
+ */
101
+ private reasonForCompleteSnapshot?;
102
+ /**
103
+ * Map of outstanding broadcast (join response) requests.
104
+ */
105
+ private readonly broadcastRequests;
106
+ /**
107
+ * Timer for managing broadcast (join response) request timing.
108
+ */
109
+ private readonly broadcastRequestsTimer;
53
110
  constructor(attendeeId: AttendeeId, runtime: IEphemeralRuntime, logger: ITelemetryLoggerExt | undefined, events: IEmitter<PresenceEvents>, presence: Presence, systemWorkspaceDatastore: SystemWorkspaceDatastore, systemWorkspace: AnyWorkspaceEntry<StatesWorkspaceSchema>);
54
- joinSession(clientId: ClientConnectionId): void;
111
+ private getAudienceInformation;
112
+ joinSession(selfClientId: ClientConnectionId, alternateProvider?: ClientConnectionId | undefined): void;
113
+ private listenForSelfInAudience;
114
+ private stopWaitingAndJoin;
115
+ onDisconnected(): void;
55
116
  getWorkspace<TSchema extends StatesWorkspaceSchema>(internalWorkspaceAddress: InternalWorkspaceAddress, requestedContent: TSchema, controls?: BroadcastControlSettings): AnyWorkspace<TSchema>;
56
117
  /**
57
- * The combined contents of all queued updates. Will be undefined when no messages are queued.
118
+ * The combined contents of all queued updates. Will be `"sendAll"` when a
119
+ * full broadcast is pending or `undefined` when no messages are queued.
58
120
  */
59
121
  private queuedData;
60
122
  /**
@@ -77,6 +139,11 @@ export declare class PresenceDatastoreManagerImpl implements PresenceDatastoreMa
77
139
  private stripValidationFromValueData;
78
140
  private broadcastAllKnownState;
79
141
  processSignal(message: InboundExtensionMessage<SignalMessages>, local: boolean, optional: boolean): void;
142
+ /**
143
+ * Broadcasts a join response (complete datastore update message)
144
+ * if there is an outstanding join response request.
145
+ */
146
+ private readonly sendJoinResponseIfStillNeeded;
80
147
  /**
81
148
  * Handles responding to another client joining the session.
82
149
  *
@@ -1 +1 @@
1
- {"version":3,"file":"presenceDatastoreManager.d.ts","sourceRoot":"","sources":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