@fluidframework/presence 2.73.0 → 2.74.0-368706

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 (41) hide show
  1. package/dist/alpha.d.ts +1 -4
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1 -4
  5. package/dist/index.js.map +1 -1
  6. package/dist/legacy.alpha.d.ts +1 -4
  7. package/dist/packageVersion.d.ts +1 -1
  8. package/dist/packageVersion.d.ts.map +1 -1
  9. package/dist/packageVersion.js +1 -1
  10. package/dist/packageVersion.js.map +1 -1
  11. package/dist/presenceDatastoreManager.js +1 -1
  12. package/dist/presenceDatastoreManager.js.map +1 -1
  13. package/lib/alpha.d.ts +1 -4
  14. package/lib/index.d.ts +0 -1
  15. package/lib/index.d.ts.map +1 -1
  16. package/lib/index.js +0 -1
  17. package/lib/index.js.map +1 -1
  18. package/lib/legacy.alpha.d.ts +1 -4
  19. package/lib/packageVersion.d.ts +1 -1
  20. package/lib/packageVersion.d.ts.map +1 -1
  21. package/lib/packageVersion.js +1 -1
  22. package/lib/packageVersion.js.map +1 -1
  23. package/lib/presenceDatastoreManager.js +1 -1
  24. package/lib/presenceDatastoreManager.js.map +1 -1
  25. package/package.json +17 -19
  26. package/dist/datastorePresenceManagerFactory.d.ts +0 -51
  27. package/dist/datastorePresenceManagerFactory.d.ts.map +0 -1
  28. package/dist/datastorePresenceManagerFactory.js +0 -100
  29. package/dist/datastorePresenceManagerFactory.js.map +0 -1
  30. package/dist/datastoreSupport.d.ts +0 -36
  31. package/dist/datastoreSupport.d.ts.map +0 -1
  32. package/dist/datastoreSupport.js +0 -84
  33. package/dist/datastoreSupport.js.map +0 -1
  34. package/lib/datastorePresenceManagerFactory.d.ts +0 -51
  35. package/lib/datastorePresenceManagerFactory.d.ts.map +0 -1
  36. package/lib/datastorePresenceManagerFactory.js +0 -96
  37. package/lib/datastorePresenceManagerFactory.js.map +0 -1
  38. package/lib/datastoreSupport.d.ts +0 -36
  39. package/lib/datastoreSupport.d.ts.map +0 -1
  40. package/lib/datastoreSupport.js +0 -79
  41. package/lib/datastoreSupport.js.map +0 -1
@@ -1,84 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.LoadableFluidObject = exports.BasicDataStoreFactory = void 0;
8
- const internal_1 = require("@fluidframework/core-utils/internal");
9
- const internal_2 = require("@fluidframework/datastore/internal");
10
- const internal_3 = require("@fluidframework/runtime-utils/internal");
11
- /**
12
- * `BasicFluidDataStoreRuntime` extends the FluidDataStoreRuntime to provide a request
13
- * method that routes requests to the entrypoint Fluid object that is expected to be a
14
- * {@link LoadableFluidObject}.
15
- */
16
- class BasicFluidDataStoreRuntime extends internal_2.FluidDataStoreRuntime {
17
- async request(request) {
18
- const response = await super.request(request);
19
- if (response.status !== 404) {
20
- return response;
21
- }
22
- // Return entrypoint object if someone requests it directly.
23
- // Direct requests exist from two scenarios:
24
- // 1. the request url is a "/"
25
- // 2. the request url is empty
26
- if (request.url === "" || request.url === "/" || request.url.startsWith("/?")) {
27
- // The provideEntryPoint callback below always returns an instance of
28
- // LoadableFluidObject. Make sure that is the case.
29
- const dataObject = await this.entryPoint.get();
30
- (0, internal_1.assert)(dataObject instanceof LoadableFluidObject, 0xa36 /* Data store runtime entryPoint is not expected type */);
31
- return { mimeType: "fluid/object", status: 200, value: dataObject };
32
- }
33
- return (0, internal_3.create404Response)(request);
34
- }
35
- }
36
- /**
37
- * `BasicDataStoreFactory` is the factory for creating a {@link BasicFluidDataStoreRuntime}.
38
- */
39
- class BasicDataStoreFactory {
40
- get IFluidDataStoreFactory() {
41
- return this;
42
- }
43
- constructor(type, instanceCtor) {
44
- this.type = type;
45
- this.instanceCtor = instanceCtor;
46
- }
47
- async instantiateDataStore(context, existing) {
48
- // Create a new runtime for our data store.
49
- // The runtime is what Fluid uses to route to our data store.
50
- const runtime = new BasicFluidDataStoreRuntime(context,
51
- /* ISharedObjectRegistry */ new Map(), existing,
52
- /* provideEntryPoint */ async () => {
53
- (0, internal_1.assert)(instance !== undefined, 0xa37 /* Intended entryPoint is undefined */);
54
- return instance;
55
- });
56
- const instance = new this.instanceCtor(runtime);
57
- return runtime;
58
- }
59
- }
60
- exports.BasicDataStoreFactory = BasicDataStoreFactory;
61
- /**
62
- * `LoadableFluidObject` is helper to build a DataObject handling the {@link FluidObject}
63
- * and {@link IFluidLoadable} requirements.
64
- */
65
- class LoadableFluidObject {
66
- constructor(runtime) {
67
- this.runtime = runtime;
68
- }
69
- get IFluidLoadable() {
70
- return this;
71
- }
72
- /**
73
- * Handle to the this Fluid object.
74
- */
75
- get handle() {
76
- // BasicDataStoreFactory provides an entryPoint initialization function
77
- // to the data store runtime; so, this object should always have access to a
78
- // non-null entryPoint.
79
- (0, internal_1.assert)(this.runtime.entryPoint !== undefined, 0xa38 /* EntryPoint was undefined */);
80
- return this.runtime.entryPoint;
81
- }
82
- }
83
- exports.LoadableFluidObject = LoadableFluidObject;
84
- //# sourceMappingURL=datastoreSupport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"datastoreSupport.js","sourceRoot":"","sources":["../src/datastoreSupport.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAcH,kEAA6D;AAC7D,iEAA2E;AAK3E,qEAA2E;AAE3E;;;;GAIG;AACH,MAAM,0BAA2B,SAAQ,gCAAqB;IAC7C,KAAK,CAAC,OAAO,CAAC,OAAiB;QAC9C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC7B,OAAO,QAAQ,CAAC;QACjB,CAAC;QACD,4DAA4D;QAC5D,4CAA4C;QAC5C,gCAAgC;QAChC,gCAAgC;QAChC,IAAI,OAAO,CAAC,G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AAP,OAAO,CAAuB;IAAG,CAAC;IAExE,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QAChB,uEAAuE;QACvE,4EAA4E;QAC5E,uBAAuB;QACvB,IAAA,iBAAM,EAAC,IAAI,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IAChC,CAAC;CACD;AAjBD,kDAiBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This module provided collection of minimal (slim) helpers to support\n * DataObject creation for temporary {@link ExperimentalPresenceManager}.\n */\n\nimport type {\n\tFluidObject,\n\tIFluidLoadable,\n\tIRequest,\n\tIResponse,\n} from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { FluidDataStoreRuntime } from \"@fluidframework/datastore/internal\";\nimport type {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { create404Response } from \"@fluidframework/runtime-utils/internal\";\n\n/**\n * `BasicFluidDataStoreRuntime` extends the FluidDataStoreRuntime to provide a request\n * method that routes requests to the entrypoint Fluid object that is expected to be a\n * {@link LoadableFluidObject}.\n */\nclass BasicFluidDataStoreRuntime extends FluidDataStoreRuntime {\n\tpublic override async request(request: IRequest): Promise<IResponse> {\n\t\tconst response = await super.request(request);\n\t\tif (response.status !== 404) {\n\t\t\treturn response;\n\t\t}\n\t\t// Return entrypoint object if someone requests it directly.\n\t\t// Direct requests exist from two scenarios:\n\t\t// 1. the request url is a \"/\"\n\t\t// 2. the request url is empty\n\t\tif (request.url === \"\" || request.url === \"/\" || request.url.startsWith(\"/?\")) {\n\t\t\t// The provideEntryPoint callback below always returns an instance of\n\t\t\t// LoadableFluidObject. Make sure that is the case.\n\t\t\tconst dataObject = await this.entryPoint.get();\n\t\t\tassert(\n\t\t\t\tdataObject instanceof LoadableFluidObject,\n\t\t\t\t0xa36 /* Data store runtime entryPoint is not expected type */,\n\t\t\t);\n\t\t\treturn { mimeType: \"fluid/object\", status: 200, value: dataObject };\n\t\t}\n\t\treturn create404Response(request);\n\t}\n}\n\n/**\n * `BasicDataStoreFactory` is the factory for creating a {@link BasicFluidDataStoreRuntime}.\n */\nexport class BasicDataStoreFactory<Type extends string> implements IFluidDataStoreFactory {\n\tpublic get IFluidDataStoreFactory(): IFluidDataStoreFactory {\n\t\treturn this;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly type: Type,\n\t\tprivate readonly instanceCtor: new (runtime: FluidDataStoreRuntime) => LoadableFluidObject,\n\t) {}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<FluidDataStoreRuntime> {\n\t\t// Create a new runtime for our data store.\n\t\t// The runtime is what Fluid uses to route to our data store.\n\t\tconst runtime: FluidDataStoreRuntime = new BasicFluidDataStoreRuntime(\n\t\t\tcontext,\n\t\t\t/* ISharedObjectRegistry */ new Map(),\n\t\t\texisting,\n\t\t\t/* provideEntryPoint */ async () => {\n\t\t\t\tassert(instance !== undefined, 0xa37 /* Intended entryPoint is undefined */);\n\t\t\t\treturn instance;\n\t\t\t},\n\t\t);\n\n\t\tconst instance = new this.instanceCtor(runtime);\n\n\t\treturn runtime;\n\t}\n}\n\n/**\n * `LoadableFluidObject` is helper to build a DataObject handling the {@link FluidObject}\n * and {@link IFluidLoadable} requirements.\n */\nexport abstract class LoadableFluidObject implements FluidObject, IFluidLoadable {\n\tpublic constructor(protected readonly runtime: FluidDataStoreRuntime) {}\n\n\tpublic get IFluidLoadable(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Handle to the this Fluid object.\n\t */\n\tpublic get handle(): IFluidHandleInternal<FluidObject> {\n\t\t// BasicDataStoreFactory provides an entryPoint initialization function\n\t\t// to the data store runtime; so, this object should always have access to a\n\t\t// non-null entryPoint.\n\t\tassert(this.runtime.entryPoint !== undefined, 0xa38 /* EntryPoint was undefined */);\n\t\treturn this.runtime.entryPoint;\n\t}\n}\n"]}
@@ -1,51 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { IFluidLoadable } from "@fluidframework/core-interfaces";
6
- import type { SharedObjectKind } from "@fluidframework/shared-object-base";
7
- import type { PresenceWithNotifications as Presence } from "./presence.js";
8
- /**
9
- * Brand for Experimental Presence Data Object.
10
- *
11
- * @remarks
12
- * See {@link getPresenceViaDataObject} for example usage.
13
- *
14
- * @deprecated Use {@link getPresence} instead.
15
- * @sealed
16
- * @alpha
17
- */
18
- export declare class ExperimentalPresenceDO {
19
- private readonly _self;
20
- }
21
- /**
22
- * DataStore based Presence Manager that is used as fallback for preferred Container
23
- * Extension based version requires registration. Export SharedObjectKind for registration.
24
- *
25
- * @deprecated Use {@link getPresence} instead.
26
- * @alpha
27
- */
28
- export declare const ExperimentalPresenceManager: SharedObjectKind<IFluidLoadable & ExperimentalPresenceDO>;
29
- /**
30
- * Acquire Presence from a DataStore based Presence Manager
31
- *
32
- * @example
33
- * ```typescript
34
- * const containerSchema = {
35
- * initialObjects: {
36
- * experimentalPresence: ExperimentalPresenceDO,
37
- * },
38
- * } satisfies ContainerSchema;
39
- * ```
40
- * then
41
- * ```typescript
42
- * const presence = getPresenceViaDataObject(
43
- * container.initialObjects.experimentalPresence,
44
- * );
45
- * ```
46
- *
47
- * @deprecated Use {@link getPresence} instead.
48
- * @alpha
49
- */
50
- export declare function getPresenceViaDataObject(fluidLoadable: ExperimentalPresenceDO): Presence;
51
- //# sourceMappingURL=datastorePresenceManagerFactory.d.ts.map
@@ -1 +0,0 @@
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,96 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- /*
6
- * Hacky support for internal datastore based usages.
7
- */
8
- import { createEmitter } from "@fluid-internal/client-utils";
9
- import { assert } from "@fluidframework/core-utils/internal";
10
- import { BasicDataStoreFactory, LoadableFluidObject } from "./datastoreSupport.js";
11
- import { createPresenceManager } from "./presenceManager.js";
12
- /**
13
- * This provides faux validation of the signal message.
14
- */
15
- function assertSignalMessageIsValid(message) {
16
- assert(message.clientId !== null, 0xa58 /* Signal must have a client ID */);
17
- // The other difference between messages is that `content` for
18
- // RawInboundExtensionMessage is JsonDeserialized and we are fine assuming that.
19
- }
20
- /**
21
- * Simple FluidObject holding Presence Manager.
22
- */
23
- class PresenceManagerDataObject extends LoadableFluidObject {
24
- presenceManager() {
25
- if (!this._presenceManager) {
26
- // TODO: investigate if ContainerExtensionStore (path-based address routing for
27
- // Signals) is readily detectable here and use that presence manager directly.
28
- const runtime = this.runtime;
29
- const events = createEmitter();
30
- runtime.on("connected", (clientId) => events.emit("joined", { clientId, canWrite: true }));
31
- runtime.on("disconnected", () => events.emit("disconnected"));
32
- const manager = createPresenceManager({
33
- getJoinedStatus: () => (runtime.connected ? "joinedForWriting" : "disconnected"),
34
- getClientId: () => runtime.clientId,
35
- events,
36
- getQuorum: runtime.getQuorum.bind(runtime),
37
- getAudience: runtime.getAudience.bind(runtime),
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 */,
40
- });
41
- this.runtime.on("signal", (message, local) => {
42
- assertSignalMessageIsValid(message);
43
- manager.processSignal([], message, local);
44
- });
45
- this._presenceManager = manager;
46
- }
47
- return this._presenceManager;
48
- }
49
- }
50
- /**
51
- * Factory class to create {@link Presence} in own data store.
52
- */
53
- class PresenceManagerFactory {
54
- constructor() {
55
- this.factory = new BasicDataStoreFactory("@fluidframework/presence", PresenceManagerDataObject);
56
- }
57
- is(value) {
58
- return value instanceof PresenceManagerDataObject;
59
- }
60
- }
61
- /**
62
- * DataStore based Presence Manager that is used as fallback for preferred Container
63
- * Extension based version requires registration. Export SharedObjectKind for registration.
64
- *
65
- * @deprecated Use {@link getPresence} instead.
66
- * @alpha
67
- */
68
- export const ExperimentalPresenceManager = new PresenceManagerFactory();
69
- /**
70
- * Acquire Presence from a DataStore based Presence Manager
71
- *
72
- * @example
73
- * ```typescript
74
- * const containerSchema = {
75
- * initialObjects: {
76
- * experimentalPresence: ExperimentalPresenceDO,
77
- * },
78
- * } satisfies ContainerSchema;
79
- * ```
80
- * then
81
- * ```typescript
82
- * const presence = getPresenceViaDataObject(
83
- * container.initialObjects.experimentalPresence,
84
- * );
85
- * ```
86
- *
87
- * @deprecated Use {@link getPresence} instead.
88
- * @alpha
89
- */
90
- export function getPresenceViaDataObject(fluidLoadable) {
91
- if (fluidLoadable instanceof PresenceManagerDataObject) {
92
- return fluidLoadable.presenceManager();
93
- }
94
- throw new Error("Incompatible loadable; make sure to use ExperimentalPresenceManager");
95
- }
96
- //# sourceMappingURL=datastorePresenceManagerFactory.js.map
@@ -1 +0,0 @@
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;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,EAAE,CAAC;YAC5B,+EAA+E;YAC/E,8EAA8E;YAC9E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC7B,MAAM,MAAM,GAAG,aAAa,EAAuB,CAAC;YACpD,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE,CACpC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CACnD,CAAC;YACF,OAAO,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;YAE9D,MAAM,OAAO,GAAG,qBAAqB,CAAC;gBACrC,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,cAAc,CAAC;gB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AED,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) =>\n\t\t\t\tevents.emit(\"joined\", { clientId, canWrite: true }),\n\t\t\t);\n\t\t\truntime.on(\"disconnected\", () => events.emit(\"disconnected\"));\n\n\t\t\tconst manager = createPresenceManager({\n\t\t\t\tgetJoinedStatus: () => (runtime.connected ? \"joinedForWriting\" : \"disconnected\"),\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"]}
@@ -1,36 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- /**
6
- * This module provided collection of minimal (slim) helpers to support
7
- * DataObject creation for temporary {@link ExperimentalPresenceManager}.
8
- */
9
- import type { FluidObject, IFluidLoadable } from "@fluidframework/core-interfaces";
10
- import type { IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
11
- import { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
12
- import type { IFluidDataStoreContext, IFluidDataStoreFactory } from "@fluidframework/runtime-definitions/internal";
13
- /**
14
- * `BasicDataStoreFactory` is the factory for creating a {@link BasicFluidDataStoreRuntime}.
15
- */
16
- export declare class BasicDataStoreFactory<Type extends string> implements IFluidDataStoreFactory {
17
- readonly type: Type;
18
- private readonly instanceCtor;
19
- get IFluidDataStoreFactory(): IFluidDataStoreFactory;
20
- constructor(type: Type, instanceCtor: new (runtime: FluidDataStoreRuntime) => LoadableFluidObject);
21
- instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
22
- }
23
- /**
24
- * `LoadableFluidObject` is helper to build a DataObject handling the {@link FluidObject}
25
- * and {@link IFluidLoadable} requirements.
26
- */
27
- export declare abstract class LoadableFluidObject implements FluidObject, IFluidLoadable {
28
- protected readonly runtime: FluidDataStoreRuntime;
29
- constructor(runtime: FluidDataStoreRuntime);
30
- get IFluidLoadable(): this;
31
- /**
32
- * Handle to the this Fluid object.
33
- */
34
- get handle(): IFluidHandleInternal<FluidObject>;
35
- }
36
- //# sourceMappingURL=datastoreSupport.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"datastoreSupport.d.ts","sourceRoot":"","sources":["../src/datastoreSupport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;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;AAgCtD;;GAEG;AACH,qBAAa,qBAAqB,CAAC,IAAI,SAAS,MAAM,CAAE,YAAW,sBAAsB;aAMvE,IAAI,EAAE,IAAI;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAN9B,IAAW,sBAAsB,IAAI,sBAAsB,CAE1D;gBAGgB,IAAI,EAAE,IAAI,EACT,YAAY,EAAE,KAAK,OAAO,EAAE,qBAAqB,KAAK,mBAAmB;IAG9E,oBAAoB,CAChC,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,qBAAqB,CAAC;CAiBjC;AAED;;;GAGG;AACH,8BAAsB,mBAAoB,YAAW,WAAW,EAAE,cAAc;IAC5D,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,qBAAqB;gBAA9B,OAAO,EAAE,qBAAqB;IAEpE,IAAW,cAAc,IAAI,IAAI,CAEhC;IAED;;OAEG;IACH,IAAW,MAAM,IAAI,oBAAoB,CAAC,WAAW,CAAC,CAMrD;CACD"}
@@ -1,79 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { assert } from "@fluidframework/core-utils/internal";
6
- import { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
7
- import { create404Response } from "@fluidframework/runtime-utils/internal";
8
- /**
9
- * `BasicFluidDataStoreRuntime` extends the FluidDataStoreRuntime to provide a request
10
- * method that routes requests to the entrypoint Fluid object that is expected to be a
11
- * {@link LoadableFluidObject}.
12
- */
13
- class BasicFluidDataStoreRuntime extends FluidDataStoreRuntime {
14
- async request(request) {
15
- const response = await super.request(request);
16
- if (response.status !== 404) {
17
- return response;
18
- }
19
- // Return entrypoint object if someone requests it directly.
20
- // Direct requests exist from two scenarios:
21
- // 1. the request url is a "/"
22
- // 2. the request url is empty
23
- if (request.url === "" || request.url === "/" || request.url.startsWith("/?")) {
24
- // The provideEntryPoint callback below always returns an instance of
25
- // LoadableFluidObject. Make sure that is the case.
26
- const dataObject = await this.entryPoint.get();
27
- assert(dataObject instanceof LoadableFluidObject, 0xa36 /* Data store runtime entryPoint is not expected type */);
28
- return { mimeType: "fluid/object", status: 200, value: dataObject };
29
- }
30
- return create404Response(request);
31
- }
32
- }
33
- /**
34
- * `BasicDataStoreFactory` is the factory for creating a {@link BasicFluidDataStoreRuntime}.
35
- */
36
- export class BasicDataStoreFactory {
37
- get IFluidDataStoreFactory() {
38
- return this;
39
- }
40
- constructor(type, instanceCtor) {
41
- this.type = type;
42
- this.instanceCtor = instanceCtor;
43
- }
44
- async instantiateDataStore(context, existing) {
45
- // Create a new runtime for our data store.
46
- // The runtime is what Fluid uses to route to our data store.
47
- const runtime = new BasicFluidDataStoreRuntime(context,
48
- /* ISharedObjectRegistry */ new Map(), existing,
49
- /* provideEntryPoint */ async () => {
50
- assert(instance !== undefined, 0xa37 /* Intended entryPoint is undefined */);
51
- return instance;
52
- });
53
- const instance = new this.instanceCtor(runtime);
54
- return runtime;
55
- }
56
- }
57
- /**
58
- * `LoadableFluidObject` is helper to build a DataObject handling the {@link FluidObject}
59
- * and {@link IFluidLoadable} requirements.
60
- */
61
- export class LoadableFluidObject {
62
- constructor(runtime) {
63
- this.runtime = runtime;
64
- }
65
- get IFluidLoadable() {
66
- return this;
67
- }
68
- /**
69
- * Handle to the this Fluid object.
70
- */
71
- get handle() {
72
- // BasicDataStoreFactory provides an entryPoint initialization function
73
- // to the data store runtime; so, this object should always have access to a
74
- // non-null entryPoint.
75
- assert(this.runtime.entryPoint !== undefined, 0xa38 /* EntryPoint was undefined */);
76
- return this.runtime.entryPoint;
77
- }
78
- }
79
- //# sourceMappingURL=datastoreSupport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"datastoreSupport.js","sourceRoot":"","sources":["../src/datastoreSupport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAK3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,0BAA2B,SAAQ,qBAAqB;IAC7C,KAAK,CAAC,OAAO,CAAC,OAAiB;QAC9C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC7B,OAAO,QAAQ,CAAC;QACjB,CAAC;QACD,4DAA4D;QAC5D,4CAA4C;QAC5C,gCAAgC;QAChC,gCAAgC;QAChC,IAAI,OAAO,CAAC,GAAG,KAAK,EAAE,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/E,qEAAqE;YACrE,mDAAmD;YACnD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I,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IAChC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This module provided collection of minimal (slim) helpers to support\n * DataObject creation for temporary {@link ExperimentalPresenceManager}.\n */\n\nimport type {\n\tFluidObject,\n\tIFluidLoadable,\n\tIRequest,\n\tIResponse,\n} from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { FluidDataStoreRuntime } from \"@fluidframework/datastore/internal\";\nimport type {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { create404Response } from \"@fluidframework/runtime-utils/internal\";\n\n/**\n * `BasicFluidDataStoreRuntime` extends the FluidDataStoreRuntime to provide a request\n * method that routes requests to the entrypoint Fluid object that is expected to be a\n * {@link LoadableFluidObject}.\n */\nclass BasicFluidDataStoreRuntime extends FluidDataStoreRuntime {\n\tpublic override async request(request: IRequest): Promise<IResponse> {\n\t\tconst response = await super.request(request);\n\t\tif (response.status !== 404) {\n\t\t\treturn response;\n\t\t}\n\t\t// Return entrypoint object if someone requests it directly.\n\t\t// Direct requests exist from two scenarios:\n\t\t// 1. the request url is a \"/\"\n\t\t// 2. the request url is empty\n\t\tif (request.url === \"\" || request.url === \"/\" || request.url.startsWith(\"/?\")) {\n\t\t\t// The provideEntryPoint callback below always returns an instance of\n\t\t\t// LoadableFluidObject. Make sure that is the case.\n\t\t\tconst dataObject = await this.entryPoint.get();\n\t\t\tassert(\n\t\t\t\tdataObject instanceof LoadableFluidObject,\n\t\t\t\t0xa36 /* Data store runtime entryPoint is not expected type */,\n\t\t\t);\n\t\t\treturn { mimeType: \"fluid/object\", status: 200, value: dataObject };\n\t\t}\n\t\treturn create404Response(request);\n\t}\n}\n\n/**\n * `BasicDataStoreFactory` is the factory for creating a {@link BasicFluidDataStoreRuntime}.\n */\nexport class BasicDataStoreFactory<Type extends string> implements IFluidDataStoreFactory {\n\tpublic get IFluidDataStoreFactory(): IFluidDataStoreFactory {\n\t\treturn this;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly type: Type,\n\t\tprivate readonly instanceCtor: new (runtime: FluidDataStoreRuntime) => LoadableFluidObject,\n\t) {}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<FluidDataStoreRuntime> {\n\t\t// Create a new runtime for our data store.\n\t\t// The runtime is what Fluid uses to route to our data store.\n\t\tconst runtime: FluidDataStoreRuntime = new BasicFluidDataStoreRuntime(\n\t\t\tcontext,\n\t\t\t/* ISharedObjectRegistry */ new Map(),\n\t\t\texisting,\n\t\t\t/* provideEntryPoint */ async () => {\n\t\t\t\tassert(instance !== undefined, 0xa37 /* Intended entryPoint is undefined */);\n\t\t\t\treturn instance;\n\t\t\t},\n\t\t);\n\n\t\tconst instance = new this.instanceCtor(runtime);\n\n\t\treturn runtime;\n\t}\n}\n\n/**\n * `LoadableFluidObject` is helper to build a DataObject handling the {@link FluidObject}\n * and {@link IFluidLoadable} requirements.\n */\nexport abstract class LoadableFluidObject implements FluidObject, IFluidLoadable {\n\tpublic constructor(protected readonly runtime: FluidDataStoreRuntime) {}\n\n\tpublic get IFluidLoadable(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Handle to the this Fluid object.\n\t */\n\tpublic get handle(): IFluidHandleInternal<FluidObject> {\n\t\t// BasicDataStoreFactory provides an entryPoint initialization function\n\t\t// to the data store runtime; so, this object should always have access to a\n\t\t// non-null entryPoint.\n\t\tassert(this.runtime.entryPoint !== undefined, 0xa38 /* EntryPoint was undefined */);\n\t\treturn this.runtime.entryPoint;\n\t}\n}\n"]}