@fluidframework/fluid-static 2.0.0-internal.1.1.2 → 2.0.0-internal.1.2.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.
@@ -11,7 +11,7 @@ import { RootDataObject } from "./rootDataObject";
11
11
  /**
12
12
  * Events emitted from {@link IFluidContainer}.
13
13
  *
14
- * @remarks
14
+ * @remarks
15
15
  *
16
16
  * The following is the list of events emitted.
17
17
  *
@@ -1 +1 @@
1
- {"version":3,"file":"fluidContainer.js","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAiE;AAsKjE;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,gCAAwC;IAOxE,YACqB,SAAqB,EACrB,cAA8B;QAE/C,KAAK,EAAE,CAAC;QAHS,cAAS,GAAT,SAAS,CAAY;QACrB,mBAAc,GAAd,cAAc,CAAgB;QARlC,qBAAgB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAChD,wBAAmB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACtD,oBAAe,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9C,iBAAY,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,iBAAY,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAOrD,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACjD,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC7C,SAAS,CAAC,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QACvD,SAAS,CAAC,EAAE,CA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Q,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACnD,CAAC;CACJ;AAnGD,wCAmGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { AttachState, IContainer, ConnectionState } from \"@fluidframework/container-definitions\";\nimport { LoadableObjectClass, LoadableObjectRecord } from \"./types\";\nimport { RootDataObject } from \"./rootDataObject\";\n\n/**\n * Events emitted from {@link IFluidContainer}.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"connected\"\n *\n * The \"connected\" event is emitted when the `IFluidContainer` completes connecting to the Fluid service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"dispose\"\n *\n * The \"dispose\" event is emitted when the `IFluidContainer` is disposed, which permanently disables it.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"disconnected\"\n *\n * The \"disconnected\" event is emitted when the `IFluidContainer` becomes disconnected from the Fluid service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"saved\"\n *\n * The \"saved\" event is emitted when the `IFluidContainer` has local changes acknowledged by the service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void\n * ```\n *\n * ### \"dirty\"\n *\n * The \"dirty\" event is emitted when the `IFluidContainer` has local changes that have not yet\n * been acknowledged by the service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void\n * ```\n */\nexport interface IFluidContainerEvents extends IEvent {\n (event: \"connected\" | \"dispose\" | \"disconnected\" | \"saved\" | \"dirty\", listener: () => void): void;\n}\n\n/**\n * Provides an entrypoint into the client side of collaborative Fluid data.\n * Provides access to the data as well as status on the collaboration session.\n */\nexport interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {\n /**\n * Provides the current connected state of the container\n */\n readonly connectionState: ConnectionState;\n\n /**\n * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.\n * You should always check the `isDirty` flag before closing the container or navigating away from the page.\n * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been\n * acknowledged by the service.\n *\n * A container is considered dirty in the following cases:\n *\n * 1. The container has been created in the detached state, and either it has not been attached yet or it is\n * in the process of being attached (container is in `attaching` state). If container is closed prior to being\n * attached, host may never know if the file was created or not.\n *\n * 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.\n * This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the\n * service. In some cases this can be due to lack of network connection. If the network connection is down,\n * it needs to be restored for the pending changes to be acknowledged.\n */\n readonly isDirty: boolean;\n\n /**\n * Whether the container is disposed, which permanently disables it.\n */\n readonly disposed: boolean;\n\n /**\n * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.\n * These data objects and DDSes exist for the lifetime of the container.\n */\n readonly initialObjects: LoadableObjectRecord;\n\n /**\n * The current attachment state of the container. Once a container has been attached, it remains attached.\n * When loading an existing container, it will already be attached.\n */\n readonly attachState: AttachState;\n\n /**\n * A newly created container starts detached from the collaborative service.\n * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#AttachState.Detatched} state.\n *\n * This can be determined by observing {@link IFluidContainer.attachState}.\n *\n * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n */\n attach(): Promise<string>;\n\n /**\n * Attempts to connect the container to the delta stream and process operations.\n * Will throw an error if unsuccessful.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n connect(): void;\n\n /**\n * Disconnects the container from the delta stream and stops processing operations.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n disconnect(): void;\n\n /**\n * Create a new data object or Distributed Data Store (DDS) of the specified type.\n *\n * @remarks In order to share the data object or DDS with other\n * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your\n * initialObjects.\n *\n * @param objectClass - The class of data object or DDS to create\n */\n create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;\n\n /**\n * Dispose of the container instance, permanently disabling it.\n */\n dispose(): void;\n}\n\n/**\n * Base {@link IFluidContainer} implementation.\n *\n * @remarks Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}\n * will need to utilize or provide a service-specific implementation of this type that implements that method.\n */\nexport class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer {\n private readonly connectedHandler = () => this.emit(\"connected\");\n private readonly disconnectedHandler = () => this.emit(\"disconnected\");\n private readonly disposedHandler = () => this.emit(\"disposed\");\n private readonly savedHandler = () => this.emit(\"saved\");\n private readonly dirtyHandler = () => this.emit(\"dirty\");\n\n public constructor(\n private readonly container: IContainer,\n private readonly rootDataObject: RootDataObject,\n ) {\n super();\n container.on(\"connected\", this.connectedHandler);\n container.on(\"closed\", this.disposedHandler);\n container.on(\"disconnected\", this.disconnectedHandler);\n container.on(\"saved\", this.savedHandler);\n container.on(\"dirty\", this.dirtyHandler);\n }\n\n /**\n * {@inheritDoc IFluidContainer.isDirty}\n */\n public get isDirty(): boolean {\n return this.container.isDirty;\n }\n\n /**\n * {@inheritDoc IFluidContainer.attachState}\n */\n public get attachState(): AttachState {\n return this.container.attachState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.disposed}\n */\n public get disposed() {\n return this.container.closed;\n }\n\n /**\n * {@inheritDoc IFluidContainer.connectionState}\n */\n public get connectionState(): ConnectionState {\n return this.container.connectionState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.initialObjects}\n */\n public get initialObjects() {\n return this.rootDataObject.initialObjects;\n }\n\n /**\n * Incomplete base implementation of {@link IFluidContainer.attach}.\n * @remarks Note: this implementation will unconditionally throw.\n * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type\n * that provides an implementation of this method.\n *\n * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,\n * but internally this separation is not there.\n */\n public async attach(): Promise<string> {\n throw new Error(\"Cannot attach container. Container is not in detached state\");\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async connect(): Promise<void> {\n this.container.connect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async disconnect(): Promise<void> {\n this.container.disconnect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.create}\n */\n public async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n return this.rootDataObject.create(objectClass);\n }\n\n /**\n * {@inheritDoc IFluidContainer.dispose}\n */\n public dispose() {\n this.container.close();\n this.container.off(\"connected\", this.connectedHandler);\n this.container.off(\"closed\", this.disposedHandler);\n this.container.off(\"disconnected\", this.disconnectedHandler);\n this.container.off(\"saved\", this.savedHandler);\n this.container.off(\"dirty\", this.dirtyHandler);\n }\n}\n"]}
1
+ {"version":3,"file":"fluidContainer.js","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAiE;AAsKjE;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,gCAAwC;IAOxE,YACqB,SAAqB,EACrB,cAA8B;QAE/C,KAAK,EAAE,CAAC;QAHS,cAAS,GAAT,SAAS,CAAY;QACrB,mBAAc,GAAd,cAAc,CAAgB;QARlC,qBAAgB,G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;IACI,KAAK,CAAC,MAAM;QACf,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACnF,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO;;QAChB,MAAA,MAAA,IAAI,CAAC,SAAS,EAAC,OAAO,kDAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,UAAU;;QACnB,MAAA,MAAA,IAAI,CAAC,SAAS,EAAC,UAAU,kDAAI,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM,CAA2B,WAAmC;QAC7E,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACnD,CAAC;CACJ;AAnGD,wCAmGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { AttachState, IContainer, ConnectionState } from \"@fluidframework/container-definitions\";\nimport { LoadableObjectClass, LoadableObjectRecord } from \"./types\";\nimport { RootDataObject } from \"./rootDataObject\";\n\n/**\n * Events emitted from {@link IFluidContainer}.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"connected\"\n *\n * The \"connected\" event is emitted when the `IFluidContainer` completes connecting to the Fluid service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"dispose\"\n *\n * The \"dispose\" event is emitted when the `IFluidContainer` is disposed, which permanently disables it.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"disconnected\"\n *\n * The \"disconnected\" event is emitted when the `IFluidContainer` becomes disconnected from the Fluid service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"saved\"\n *\n * The \"saved\" event is emitted when the `IFluidContainer` has local changes acknowledged by the service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void\n * ```\n *\n * ### \"dirty\"\n *\n * The \"dirty\" event is emitted when the `IFluidContainer` has local changes that have not yet\n * been acknowledged by the service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void\n * ```\n */\nexport interface IFluidContainerEvents extends IEvent {\n (event: \"connected\" | \"dispose\" | \"disconnected\" | \"saved\" | \"dirty\", listener: () => void): void;\n}\n\n/**\n * Provides an entrypoint into the client side of collaborative Fluid data.\n * Provides access to the data as well as status on the collaboration session.\n */\nexport interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {\n /**\n * Provides the current connected state of the container\n */\n readonly connectionState: ConnectionState;\n\n /**\n * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.\n * You should always check the `isDirty` flag before closing the container or navigating away from the page.\n * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been\n * acknowledged by the service.\n *\n * A container is considered dirty in the following cases:\n *\n * 1. The container has been created in the detached state, and either it has not been attached yet or it is\n * in the process of being attached (container is in `attaching` state). If container is closed prior to being\n * attached, host may never know if the file was created or not.\n *\n * 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.\n * This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the\n * service. In some cases this can be due to lack of network connection. If the network connection is down,\n * it needs to be restored for the pending changes to be acknowledged.\n */\n readonly isDirty: boolean;\n\n /**\n * Whether the container is disposed, which permanently disables it.\n */\n readonly disposed: boolean;\n\n /**\n * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.\n * These data objects and DDSes exist for the lifetime of the container.\n */\n readonly initialObjects: LoadableObjectRecord;\n\n /**\n * The current attachment state of the container. Once a container has been attached, it remains attached.\n * When loading an existing container, it will already be attached.\n */\n readonly attachState: AttachState;\n\n /**\n * A newly created container starts detached from the collaborative service.\n * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#AttachState.Detatched} state.\n *\n * This can be determined by observing {@link IFluidContainer.attachState}.\n *\n * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n */\n attach(): Promise<string>;\n\n /**\n * Attempts to connect the container to the delta stream and process operations.\n * Will throw an error if unsuccessful.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n connect(): void;\n\n /**\n * Disconnects the container from the delta stream and stops processing operations.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n disconnect(): void;\n\n /**\n * Create a new data object or Distributed Data Store (DDS) of the specified type.\n *\n * @remarks In order to share the data object or DDS with other\n * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your\n * initialObjects.\n *\n * @param objectClass - The class of data object or DDS to create\n */\n create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;\n\n /**\n * Dispose of the container instance, permanently disabling it.\n */\n dispose(): void;\n}\n\n/**\n * Base {@link IFluidContainer} implementation.\n *\n * @remarks Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}\n * will need to utilize or provide a service-specific implementation of this type that implements that method.\n */\nexport class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer {\n private readonly connectedHandler = () => this.emit(\"connected\");\n private readonly disconnectedHandler = () => this.emit(\"disconnected\");\n private readonly disposedHandler = () => this.emit(\"disposed\");\n private readonly savedHandler = () => this.emit(\"saved\");\n private readonly dirtyHandler = () => this.emit(\"dirty\");\n\n public constructor(\n private readonly container: IContainer,\n private readonly rootDataObject: RootDataObject,\n ) {\n super();\n container.on(\"connected\", this.connectedHandler);\n container.on(\"closed\", this.disposedHandler);\n container.on(\"disconnected\", this.disconnectedHandler);\n container.on(\"saved\", this.savedHandler);\n container.on(\"dirty\", this.dirtyHandler);\n }\n\n /**\n * {@inheritDoc IFluidContainer.isDirty}\n */\n public get isDirty(): boolean {\n return this.container.isDirty;\n }\n\n /**\n * {@inheritDoc IFluidContainer.attachState}\n */\n public get attachState(): AttachState {\n return this.container.attachState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.disposed}\n */\n public get disposed() {\n return this.container.closed;\n }\n\n /**\n * {@inheritDoc IFluidContainer.connectionState}\n */\n public get connectionState(): ConnectionState {\n return this.container.connectionState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.initialObjects}\n */\n public get initialObjects() {\n return this.rootDataObject.initialObjects;\n }\n\n /**\n * Incomplete base implementation of {@link IFluidContainer.attach}.\n * @remarks Note: this implementation will unconditionally throw.\n * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type\n * that provides an implementation of this method.\n *\n * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,\n * but internally this separation is not there.\n */\n public async attach(): Promise<string> {\n throw new Error(\"Cannot attach container. Container is not in detached state\");\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async connect(): Promise<void> {\n this.container.connect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async disconnect(): Promise<void> {\n this.container.disconnect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.create}\n */\n public async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n return this.rootDataObject.create(objectClass);\n }\n\n /**\n * {@inheritDoc IFluidContainer.dispose}\n */\n public dispose() {\n this.container.close();\n this.container.off(\"connected\", this.connectedHandler);\n this.container.off(\"closed\", this.disposedHandler);\n this.container.off(\"disconnected\", this.disconnectedHandler);\n this.container.off(\"saved\", this.savedHandler);\n this.container.off(\"dirty\", this.dirtyHandler);\n }\n}\n"]}
@@ -11,7 +11,7 @@ import { RootDataObject } from "./rootDataObject";
11
11
  /**
12
12
  * Events emitted from {@link IFluidContainer}.
13
13
  *
14
- * @remarks
14
+ * @remarks
15
15
  *
16
16
  * The following is the list of events emitted.
17
17
  *
@@ -1 +1 @@
1
- {"version":3,"file":"fluidContainer.js","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAsKjE;;;;;GAKG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAAwC;IAOxE,YACqB,SAAqB,EACrB,cAA8B;QAE/C,KAAK,EAAE,CAAC;QAHS,cAAS,GAAT,SAAS,CAAY;QACrB,mBAAc,GAAd,cAAc,CAAgB;QARlC,qBAAgB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAChD,wBAAmB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACtD,oBAAe,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9C,iBAAY,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,iBAAY,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QA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AAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACnD,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { AttachState, IContainer, ConnectionState } from \"@fluidframework/container-definitions\";\nimport { LoadableObjectClass, LoadableObjectRecord } from \"./types\";\nimport { RootDataObject } from \"./rootDataObject\";\n\n/**\n * Events emitted from {@link IFluidContainer}.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"connected\"\n *\n * The \"connected\" event is emitted when the `IFluidContainer` completes connecting to the Fluid service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"dispose\"\n *\n * The \"dispose\" event is emitted when the `IFluidContainer` is disposed, which permanently disables it.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"disconnected\"\n *\n * The \"disconnected\" event is emitted when the `IFluidContainer` becomes disconnected from the Fluid service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"saved\"\n *\n * The \"saved\" event is emitted when the `IFluidContainer` has local changes acknowledged by the service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void\n * ```\n *\n * ### \"dirty\"\n *\n * The \"dirty\" event is emitted when the `IFluidContainer` has local changes that have not yet\n * been acknowledged by the service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void\n * ```\n */\nexport interface IFluidContainerEvents extends IEvent {\n (event: \"connected\" | \"dispose\" | \"disconnected\" | \"saved\" | \"dirty\", listener: () => void): void;\n}\n\n/**\n * Provides an entrypoint into the client side of collaborative Fluid data.\n * Provides access to the data as well as status on the collaboration session.\n */\nexport interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {\n /**\n * Provides the current connected state of the container\n */\n readonly connectionState: ConnectionState;\n\n /**\n * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.\n * You should always check the `isDirty` flag before closing the container or navigating away from the page.\n * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been\n * acknowledged by the service.\n *\n * A container is considered dirty in the following cases:\n *\n * 1. The container has been created in the detached state, and either it has not been attached yet or it is\n * in the process of being attached (container is in `attaching` state). If container is closed prior to being\n * attached, host may never know if the file was created or not.\n *\n * 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.\n * This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the\n * service. In some cases this can be due to lack of network connection. If the network connection is down,\n * it needs to be restored for the pending changes to be acknowledged.\n */\n readonly isDirty: boolean;\n\n /**\n * Whether the container is disposed, which permanently disables it.\n */\n readonly disposed: boolean;\n\n /**\n * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.\n * These data objects and DDSes exist for the lifetime of the container.\n */\n readonly initialObjects: LoadableObjectRecord;\n\n /**\n * The current attachment state of the container. Once a container has been attached, it remains attached.\n * When loading an existing container, it will already be attached.\n */\n readonly attachState: AttachState;\n\n /**\n * A newly created container starts detached from the collaborative service.\n * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#AttachState.Detatched} state.\n *\n * This can be determined by observing {@link IFluidContainer.attachState}.\n *\n * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n */\n attach(): Promise<string>;\n\n /**\n * Attempts to connect the container to the delta stream and process operations.\n * Will throw an error if unsuccessful.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n connect(): void;\n\n /**\n * Disconnects the container from the delta stream and stops processing operations.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n disconnect(): void;\n\n /**\n * Create a new data object or Distributed Data Store (DDS) of the specified type.\n *\n * @remarks In order to share the data object or DDS with other\n * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your\n * initialObjects.\n *\n * @param objectClass - The class of data object or DDS to create\n */\n create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;\n\n /**\n * Dispose of the container instance, permanently disabling it.\n */\n dispose(): void;\n}\n\n/**\n * Base {@link IFluidContainer} implementation.\n *\n * @remarks Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}\n * will need to utilize or provide a service-specific implementation of this type that implements that method.\n */\nexport class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer {\n private readonly connectedHandler = () => this.emit(\"connected\");\n private readonly disconnectedHandler = () => this.emit(\"disconnected\");\n private readonly disposedHandler = () => this.emit(\"disposed\");\n private readonly savedHandler = () => this.emit(\"saved\");\n private readonly dirtyHandler = () => this.emit(\"dirty\");\n\n public constructor(\n private readonly container: IContainer,\n private readonly rootDataObject: RootDataObject,\n ) {\n super();\n container.on(\"connected\", this.connectedHandler);\n container.on(\"closed\", this.disposedHandler);\n container.on(\"disconnected\", this.disconnectedHandler);\n container.on(\"saved\", this.savedHandler);\n container.on(\"dirty\", this.dirtyHandler);\n }\n\n /**\n * {@inheritDoc IFluidContainer.isDirty}\n */\n public get isDirty(): boolean {\n return this.container.isDirty;\n }\n\n /**\n * {@inheritDoc IFluidContainer.attachState}\n */\n public get attachState(): AttachState {\n return this.container.attachState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.disposed}\n */\n public get disposed() {\n return this.container.closed;\n }\n\n /**\n * {@inheritDoc IFluidContainer.connectionState}\n */\n public get connectionState(): ConnectionState {\n return this.container.connectionState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.initialObjects}\n */\n public get initialObjects() {\n return this.rootDataObject.initialObjects;\n }\n\n /**\n * Incomplete base implementation of {@link IFluidContainer.attach}.\n * @remarks Note: this implementation will unconditionally throw.\n * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type\n * that provides an implementation of this method.\n *\n * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,\n * but internally this separation is not there.\n */\n public async attach(): Promise<string> {\n throw new Error(\"Cannot attach container. Container is not in detached state\");\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async connect(): Promise<void> {\n this.container.connect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async disconnect(): Promise<void> {\n this.container.disconnect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.create}\n */\n public async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n return this.rootDataObject.create(objectClass);\n }\n\n /**\n * {@inheritDoc IFluidContainer.dispose}\n */\n public dispose() {\n this.container.close();\n this.container.off(\"connected\", this.connectedHandler);\n this.container.off(\"closed\", this.disposedHandler);\n this.container.off(\"disconnected\", this.disconnectedHandler);\n this.container.off(\"saved\", this.savedHandler);\n this.container.off(\"dirty\", this.dirtyHandler);\n }\n}\n"]}
1
+ {"version":3,"file":"fluidContainer.js","sourceRoot":"","sources":["../src/fluidContainer.ts"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Content":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { AttachState, IContainer, ConnectionState } from \"@fluidframework/container-definitions\";\nimport { LoadableObjectClass, LoadableObjectRecord } from \"./types\";\nimport { RootDataObject } from \"./rootDataObject\";\n\n/**\n * Events emitted from {@link IFluidContainer}.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"connected\"\n *\n * The \"connected\" event is emitted when the `IFluidContainer` completes connecting to the Fluid service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"dispose\"\n *\n * The \"dispose\" event is emitted when the `IFluidContainer` is disposed, which permanently disables it.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"disconnected\"\n *\n * The \"disconnected\" event is emitted when the `IFluidContainer` becomes disconnected from the Fluid service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"saved\"\n *\n * The \"saved\" event is emitted when the `IFluidContainer` has local changes acknowledged by the service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void\n * ```\n *\n * ### \"dirty\"\n *\n * The \"dirty\" event is emitted when the `IFluidContainer` has local changes that have not yet\n * been acknowledged by the service.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void\n * ```\n */\nexport interface IFluidContainerEvents extends IEvent {\n (event: \"connected\" | \"dispose\" | \"disconnected\" | \"saved\" | \"dirty\", listener: () => void): void;\n}\n\n/**\n * Provides an entrypoint into the client side of collaborative Fluid data.\n * Provides access to the data as well as status on the collaboration session.\n */\nexport interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {\n /**\n * Provides the current connected state of the container\n */\n readonly connectionState: ConnectionState;\n\n /**\n * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.\n * You should always check the `isDirty` flag before closing the container or navigating away from the page.\n * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been\n * acknowledged by the service.\n *\n * A container is considered dirty in the following cases:\n *\n * 1. The container has been created in the detached state, and either it has not been attached yet or it is\n * in the process of being attached (container is in `attaching` state). If container is closed prior to being\n * attached, host may never know if the file was created or not.\n *\n * 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.\n * This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the\n * service. In some cases this can be due to lack of network connection. If the network connection is down,\n * it needs to be restored for the pending changes to be acknowledged.\n */\n readonly isDirty: boolean;\n\n /**\n * Whether the container is disposed, which permanently disables it.\n */\n readonly disposed: boolean;\n\n /**\n * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.\n * These data objects and DDSes exist for the lifetime of the container.\n */\n readonly initialObjects: LoadableObjectRecord;\n\n /**\n * The current attachment state of the container. Once a container has been attached, it remains attached.\n * When loading an existing container, it will already be attached.\n */\n readonly attachState: AttachState;\n\n /**\n * A newly created container starts detached from the collaborative service.\n * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#AttachState.Detatched} state.\n *\n * This can be determined by observing {@link IFluidContainer.attachState}.\n *\n * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n */\n attach(): Promise<string>;\n\n /**\n * Attempts to connect the container to the delta stream and process operations.\n * Will throw an error if unsuccessful.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n connect(): void;\n\n /**\n * Disconnects the container from the delta stream and stops processing operations.\n *\n * @remarks This should only be called when the container is in the\n * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.\n *\n * This can be determined by observing {@link IFluidContainer.connectionState}.\n */\n disconnect(): void;\n\n /**\n * Create a new data object or Distributed Data Store (DDS) of the specified type.\n *\n * @remarks In order to share the data object or DDS with other\n * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your\n * initialObjects.\n *\n * @param objectClass - The class of data object or DDS to create\n */\n create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;\n\n /**\n * Dispose of the container instance, permanently disabling it.\n */\n dispose(): void;\n}\n\n/**\n * Base {@link IFluidContainer} implementation.\n *\n * @remarks Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}\n * will need to utilize or provide a service-specific implementation of this type that implements that method.\n */\nexport class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer {\n private readonly connectedHandler = () => this.emit(\"connected\");\n private readonly disconnectedHandler = () => this.emit(\"disconnected\");\n private readonly disposedHandler = () => this.emit(\"disposed\");\n private readonly savedHandler = () => this.emit(\"saved\");\n private readonly dirtyHandler = () => this.emit(\"dirty\");\n\n public constructor(\n private readonly container: IContainer,\n private readonly rootDataObject: RootDataObject,\n ) {\n super();\n container.on(\"connected\", this.connectedHandler);\n container.on(\"closed\", this.disposedHandler);\n container.on(\"disconnected\", this.disconnectedHandler);\n container.on(\"saved\", this.savedHandler);\n container.on(\"dirty\", this.dirtyHandler);\n }\n\n /**\n * {@inheritDoc IFluidContainer.isDirty}\n */\n public get isDirty(): boolean {\n return this.container.isDirty;\n }\n\n /**\n * {@inheritDoc IFluidContainer.attachState}\n */\n public get attachState(): AttachState {\n return this.container.attachState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.disposed}\n */\n public get disposed() {\n return this.container.closed;\n }\n\n /**\n * {@inheritDoc IFluidContainer.connectionState}\n */\n public get connectionState(): ConnectionState {\n return this.container.connectionState;\n }\n\n /**\n * {@inheritDoc IFluidContainer.initialObjects}\n */\n public get initialObjects() {\n return this.rootDataObject.initialObjects;\n }\n\n /**\n * Incomplete base implementation of {@link IFluidContainer.attach}.\n * @remarks Note: this implementation will unconditionally throw.\n * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type\n * that provides an implementation of this method.\n *\n * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,\n * but internally this separation is not there.\n */\n public async attach(): Promise<string> {\n throw new Error(\"Cannot attach container. Container is not in detached state\");\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async connect(): Promise<void> {\n this.container.connect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.connect}\n */\n public async disconnect(): Promise<void> {\n this.container.disconnect?.();\n }\n\n /**\n * {@inheritDoc IFluidContainer.create}\n */\n public async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n return this.rootDataObject.create(objectClass);\n }\n\n /**\n * {@inheritDoc IFluidContainer.dispose}\n */\n public dispose() {\n this.container.close();\n this.container.off(\"connected\", this.connectedHandler);\n this.container.off(\"closed\", this.disposedHandler);\n this.container.off(\"disconnected\", this.disconnectedHandler);\n this.container.off(\"saved\", this.savedHandler);\n this.container.off(\"dirty\", this.dirtyHandler);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/fluid-static",
3
- "version": "2.0.0-internal.1.1.2",
3
+ "version": "2.0.0-internal.1.2.0",
4
4
  "description": "A tool to enable consumption of Fluid Data Objects without requiring custom container code.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -39,28 +39,28 @@
39
39
  "typetests:gen": "fluid-type-validator -g -d ."
40
40
  },
41
41
  "dependencies": {
42
- "@fluidframework/aqueduct": "^2.0.0-internal.1.1.2",
42
+ "@fluidframework/aqueduct": "^2.0.0-internal.1.2.0",
43
43
  "@fluidframework/common-definitions": "^0.20.1",
44
44
  "@fluidframework/common-utils": "^1.0.0",
45
- "@fluidframework/container-definitions": "^2.0.0-internal.1.1.2",
46
- "@fluidframework/container-loader": "^2.0.0-internal.1.1.2",
47
- "@fluidframework/container-runtime-definitions": "^2.0.0-internal.1.1.2",
48
- "@fluidframework/core-interfaces": "^2.0.0-internal.1.1.2",
49
- "@fluidframework/datastore-definitions": "^2.0.0-internal.1.1.2",
45
+ "@fluidframework/container-definitions": "^2.0.0-internal.1.2.0",
46
+ "@fluidframework/container-loader": "^2.0.0-internal.1.2.0",
47
+ "@fluidframework/container-runtime-definitions": "^2.0.0-internal.1.2.0",
48
+ "@fluidframework/core-interfaces": "^2.0.0-internal.1.2.0",
49
+ "@fluidframework/datastore-definitions": "^2.0.0-internal.1.2.0",
50
50
  "@fluidframework/protocol-definitions": "^1.0.0",
51
- "@fluidframework/request-handler": "^2.0.0-internal.1.1.2",
52
- "@fluidframework/runtime-definitions": "^2.0.0-internal.1.1.2",
53
- "@fluidframework/runtime-utils": "^2.0.0-internal.1.1.2"
51
+ "@fluidframework/request-handler": "^2.0.0-internal.1.2.0",
52
+ "@fluidframework/runtime-definitions": "^2.0.0-internal.1.2.0",
53
+ "@fluidframework/runtime-utils": "^2.0.0-internal.1.2.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@fluid-experimental/get-container": "^2.0.0-internal.1.1.2",
57
- "@fluidframework/build-common": "^0.24.0",
58
- "@fluidframework/build-tools": "^0.3.1000",
59
- "@fluidframework/eslint-config-fluid": "^0.28.2000",
56
+ "@fluid-experimental/get-container": "^2.0.0-internal.1.2.0",
57
+ "@fluidframework/build-common": "^1.0.0",
58
+ "@fluidframework/build-tools": "^0.4.4000",
59
+ "@fluidframework/eslint-config-fluid": "^1.0.0",
60
60
  "@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@^1.0.0",
61
- "@fluidframework/map": "^2.0.0-internal.1.1.2",
62
- "@fluidframework/mocha-test-setup": "^2.0.0-internal.1.1.2",
63
- "@fluidframework/sequence": "^2.0.0-internal.1.1.2",
61
+ "@fluidframework/map": "^2.0.0-internal.1.2.0",
62
+ "@fluidframework/mocha-test-setup": "^2.0.0-internal.1.2.0",
63
+ "@fluidframework/sequence": "^2.0.0-internal.1.2.0",
64
64
  "@microsoft/api-extractor": "^7.22.2",
65
65
  "@rushstack/eslint-config": "^2.5.1",
66
66
  "@types/mocha": "^9.1.1",
@@ -70,6 +70,7 @@
70
70
  "cross-env": "^7.0.2",
71
71
  "eslint": "~8.6.0",
72
72
  "mocha": "^10.0.0",
73
+ "nyc": "^15.0.0",
73
74
  "rimraf": "^2.6.2",
74
75
  "typescript": "~4.5.5",
75
76
  "typescript-formatter": "7.1.0"
@@ -12,7 +12,7 @@ import { RootDataObject } from "./rootDataObject";
12
12
  /**
13
13
  * Events emitted from {@link IFluidContainer}.
14
14
  *
15
- * @remarks
15
+ * @remarks
16
16
  *
17
17
  * The following is the list of events emitted.
18
18
  *