@fluid-experimental/last-edited 2.117.0 → 3.0.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.
package/CHANGELOG.md CHANGED
@@ -1,8 +1,30 @@
1
1
  # @fluid-experimental/last-edited
2
2
 
3
- ## 2.117.0
3
+ ## 3.0.0
4
4
 
5
- Dependency updates only.
5
+ ### Minor Changes
6
+
7
+ - Removal of direct CommonJS support ([#28124](https://github.com/microsoft/FluidFramework/pull/28124)) [0f84e3b8878](https://github.com/microsoft/FluidFramework/commit/0f84e3b8878a5e75b2253976d98fd963bbd9db88)
8
+
9
+ Direct `require()` import is no longer directly supported.
10
+ Package is transpiled as ECMAScript Module.
11
+
12
+ See [Removal of direct CommonJS support in v3.0](https://github.com/microsoft/FluidFramework/issues/27444) for more information.
13
+
14
+ - Client packages now target ES2022 ([#27846](https://github.com/microsoft/FluidFramework/pull/27846)) [91c78541bdd](https://github.com/microsoft/FluidFramework/commit/91c78541bddcbca5d6c5f357b023eeaee617d885)
15
+
16
+ The TypeScript compilation `target` and `lib` for the Fluid Framework client packages have been raised from ES2021/ES2020 to **ES2022**.
17
+ The published JavaScript now uses ES2022 language features (with correspondingly less down-leveling), so consuming these packages requires a runtime that supports ES2022.
18
+ All actively supported Node.js versions and evergreen browsers already meet this requirement.
19
+
20
+ Note that Fluid Framework has not officially supported targets older than ES2022 since before 2.0: this is documented in [ClientRequirements.md](https://github.com/microsoft/FluidFramework/blob/main/ClientRequirements.md) as well as the README for every client package.
21
+
22
+ It is possible this change could impact users of less up to date JavaScript runtimes.
23
+ Impacted users can use a tool like [babel](https://babeljs.io/) to transpile out unsupported language features.
24
+
25
+ - Build with TypeScript 6 ([#28052](https://github.com/microsoft/FluidFramework/pull/28052)) [7ab015c49de](https://github.com/microsoft/FluidFramework/commit/7ab015c49deec84833cdfe1fb5e1606b901f6e81)
26
+
27
+ FluidFramework Client SDK is now built using TypeScript 6. Consumers should build with TypeScript v6 or v7 or compatible tooling.
6
28
 
7
29
  ## 2.116.0
8
30
 
package/README.md CHANGED
@@ -16,21 +16,22 @@ It uses the SharedSummaryBlock to store the last edit details.
16
16
  <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
17
17
 
18
18
  **IMPORTANT: This package is experimental.**
19
- **Its APIs may change without notice.**
19
+ **The APIs can change without notice.**
20
20
 
21
- **Do not use in production scenarios.**
21
+ **Do not use it as a dependency in production scenarios.**
22
+ **We do not guarantee the stability of this package or its APIs.**
22
23
 
23
24
  ## Using Fluid Framework libraries
24
25
 
25
- When taking a dependency on a Fluid Framework library's public APIs, we recommend using a `^` (caret) version range, such as `^1.3.4`.
26
- While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
27
- library consumers should always prefer `^`.
26
+ For a dependency on a Fluid Framework library's public APIs, we recommend a `^` (caret) version range.
27
+ For example, use `^1.3.4`.
28
28
 
29
- If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
29
+ For a dependency on an unstable API, such as a `beta` API, we recommend a more restrictive version range.
30
+ For example, use a `~` version range.
30
31
 
31
32
  ## Installation
32
33
 
33
- To get started, install the package by running the following command:
34
+ Run this command to install the package:
34
35
 
35
36
  ```bash
36
37
  npm i @fluid-experimental/last-edited
@@ -38,7 +39,7 @@ npm i @fluid-experimental/last-edited
38
39
 
39
40
  ## API Documentation
40
41
 
41
- API documentation for **@fluid-experimental/last-edited** is available at <https://fluidframework.com/docs/apis/last-edited>.
42
+ Read the **@fluid-experimental/last-edited** API documentation at <https://fluidframework.com/docs/apis/last-edited>.
42
43
 
43
44
  <!-- prettier-ignore-end -->
44
45
 
@@ -129,62 +130,69 @@ const lastEditedTracker = root.IFluidLastEditedTracker;
129
130
 
130
131
  ## Minimum Client Requirements
131
132
 
132
- These are the platform requirements for the current version of Fluid Framework Client Packages.
133
- These requirements err on the side of being too strict since within a major version they can be relaxed over time, but not made stricter.
134
- For Long Term Support (LTS) versions this can require supporting these platforms for several years.
133
+ Fluid Framework client libraries support the platforms in this document.
134
+ These requirements are intentionally restrictive.
135
+ Within a major version series, we can relax these requirements, but we cannot make them stricter.
136
+ For a Long Term Support (LTS) version, we might need to support these platforms for several years.
135
137
 
136
- It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
137
- If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
138
- When making such a request please include if the configuration already works (and thus the request is just that it becomes officially supported), or if changes are required to get it working.
138
+ Other configurations can work, but Fluid Framework does not support them.
139
+ If an unsupported configuration stops working, we do not classify this as a bug.
140
+ To request support for a configuration that is not listed, file an issue.
141
+ The product team will evaluate your request.
142
+ In the issue, specify the current status of the configuration:
143
+
144
+ - The configuration works but needs official support.
145
+ - The configuration does not work and requires changes.
139
146
 
140
147
  ### Supported Runtimes
141
148
 
142
- - NodeJs ^22.22.2 except that we will drop support for it [when NodeJs 22 loses its upstream support on 2027-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS at least 1 year before 22 is end-of-life.
143
- - Running Fluid in a Node.js environment with the `--no-experimental-fetch` flag is not supported.
144
- - Modern browsers supporting the es2022 standard library: in response to asks we can add explicit support for using babel to polyfill to target specific standards or runtimes (meaning we can avoid/remove use of things that don't polyfill robustly, but otherwise target modern standards).
149
+ - Fluid Framework supports Node.js versions 22 and 24 while they receive [upstream support](https://nodejs.org/en/about/previous-releases).
150
+ - Fluid Framework will stop support for version 22 [when upstream support ends on 2027-04-30](https://github.com/nodejs/release#release-schedule).
151
+ - Fluid Framework does not support Node.js with the `--no-experimental-fetch` flag.
152
+ - Fluid Framework supports modern browsers that support the ES2022 standard library.
145
153
 
146
154
  ### Supported Tools
147
155
 
148
- - TypeScript 5.4:
149
- - All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
150
- - [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
151
- - [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
152
- - `exactOptionalPropertyTypes` is currently not fully supported.
153
- If used, narrowing members of Fluid Framework types types using `in`, `Reflect.has`, `Object.hasOwn` or `Object.prototype.hasOwnProperty` should be avoided as they may incorrectly exclude `undefined` from the possible values in some cases.
156
+ - [TypeScript 6.0](https://typescriptdocs.com/release-notes/TypeScript%206.0):
157
+ - Fluid Framework supports all [`strict`](https://www.typescriptlang.org/tsconfig) options.
158
+ - Set the build targets (`lib`, `target`) to `ES2022` or later.
159
+ - Enable [`strictNullChecks`](https://www.typescriptlang.org/tsconfig).
160
+ - Fluid Framework does not support [configuration options deprecated in TypeScript 6.0](https://typescriptdocs.com/release-notes/TypeScript%206.0#breaking-changes-and-deprecations-in-typescript-6-0).
161
+ - Fluid Framework does not fully support `exactOptionalPropertyTypes`.
162
+ If you enable this option, do not use `in`, `Reflect.has`, `Object.hasOwn`, or `Object.prototype.hasOwnProperty` to narrow members of Fluid Framework types.
163
+ These methods can incorrectly exclude `undefined` from the possible values.
154
164
  - [webpack](https://webpack.js.org/) 5
155
- - We are not intending to be prescriptive about what bundler to use.
156
- Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.
165
+ - We do not require a specific bundler.
166
+ Other bundlers that handle ES Modules can work, but we actively test only webpack.
157
167
 
158
168
  ### Module Resolution
159
169
 
160
- [`Node16`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) resolution should be used with TypeScript compilerOptions to follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
161
- Node10 resolution is not supported as it does not support Fluid Framework's API structuring pattern that is used to distinguish stable APIs from those that are in development.
170
+ In TypeScript `compilerOptions`, use [`Node16`, `Node20`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) module resolution.
171
+ These settings follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
172
+
173
+ Do not use `Node10` module resolution.
162
174
 
163
175
  ### Module Formats
164
176
 
165
177
  - ES Modules:
166
- ES Modules are the preferred way to consume our client packages (including in NodeJs) and consuming our client packages from ES Modules is fully supported.
167
- - CommonJs:
168
- Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
169
- This is done to accommodate some workflows without good ES Module support.
170
- If you have a workflow you would like included in this list, file an issue.
171
- Once this list of workflows motivating CommonJS support is empty, we may drop support for CommonJS one year after notice of the change is posted here.
172
-
173
- - Testing with Jest (which lacks [stable ESM support](https://jestjs.io/docs/ecmascript-modules) due to [unstable APIs in NodeJs](https://github.com/nodejs/node/issues/37648))
178
+ Use ES Modules to consume Fluid Framework client packages, including in Node.js.
179
+ - CommonJS:
180
+ Fluid Framework does not officially support CommonJS in version 3.0 or later.
174
181
 
175
182
  ## Contribution Guidelines
176
183
 
177
- There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
184
+ You can [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid Framework in these ways:
178
185
 
179
- - Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
180
- - [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in.
181
- - Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
186
+ - Answer questions in [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
187
+ - [Submit bug reports](https://github.com/microsoft/FluidFramework/issues) and help verify fixes.
188
+ - Review [source code changes](https://github.com/microsoft/FluidFramework/pulls).
182
189
  - [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
183
190
 
184
- Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md).
191
+ For detailed instructions, read the [repo documentation](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md).
185
192
 
186
- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
187
- For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
193
+ This project follows the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
194
+ For more information, read the [Code of Conduct frequently asked questions](https://opensource.microsoft.com/codeofconduct/faq/).
195
+ For questions or comments, contact [opencode@microsoft.com](mailto:opencode@microsoft.com).
188
196
 
189
197
  This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
190
198
  Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
@@ -192,13 +200,9 @@ Use of Microsoft trademarks or logos in modified versions of this project must n
192
200
 
193
201
  ## Help
194
202
 
195
- Not finding what you're looking for in this README?
196
- Check out [fluidframework.com](https://fluidframework.com/docs/).
197
-
198
- Still not finding what you're looking for?
199
- Please [file an issue](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md).
203
+ Read the [Fluid Framework documentation](https://fluidframework.com/docs/) for information about Fluid Framework concepts and APIs.
200
204
 
201
- Thank you!
205
+ To request information that the documentation does not contain, [create an issue](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md).
202
206
 
203
207
  ## Trademark
204
208
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base.esm.no-legacy.json"
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-model.esm.json"
4
4
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-report-base.esm.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts"
5
+ }
@@ -12,13 +12,14 @@ exports.LastEditedTracker = void 0;
12
12
  * @internal
13
13
  */
14
14
  class LastEditedTracker {
15
+ sharedSummaryBlock;
16
+ lastEditedDetailsKey = "lastEditDetailsKey";
15
17
  /**
16
18
  * Creates a LastEditedTracker object.
17
19
  * @param sharedSummaryBlock - The shared summary block where the details will be stored.
18
20
  */
19
21
  constructor(sharedSummaryBlock) {
20
22
  this.sharedSummaryBlock = sharedSummaryBlock;
21
- this.lastEditedDetailsKey = "lastEditDetailsKey";
22
23
  }
23
24
  get IFluidLastEditedTracker() {
24
25
  return this;
@@ -1 +1 @@
1
- {"version":3,"file":"lastEditedTracker.js","sourceRoot":"","sources":["../src/lastEditedTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH;;;;;GAKG;AACH,MAAa,iBAAiB;IAG7B;;;OAGG;IACH,YAA6B,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QANlD,yBAAoB,GAAG,oBAAoB,CAAC;IAMS,CAAC;IAEvE,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACI,kBAAkB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAmB,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACjF,CAAC;IAED;;OAEG;IACI,qBAAqB,CAAC,eAAiC;QAC7D,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC;IACzE,CAAC;CACD;AA1BD,8CA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SharedSummaryBlock } from \"@fluidframework/shared-summary-block/internal\";\n\nimport type { IFluidLastEditedTracker, ILastEditDetails } from \"./interfaces.js\";\n\n/**\n * Tracks the last edit details such as the last edited user details and the last edited timestamp. The last edited\n * details should be updated (via updateLastEditDetails) in response to a remote op since it uses shared summary block\n * as storage.\n * @internal\n */\nexport class LastEditedTracker implements IFluidLastEditedTracker {\n\tprivate readonly lastEditedDetailsKey = \"lastEditDetailsKey\";\n\n\t/**\n\t * Creates a LastEditedTracker object.\n\t * @param sharedSummaryBlock - The shared summary block where the details will be stored.\n\t */\n\tconstructor(private readonly sharedSummaryBlock: SharedSummaryBlock) {}\n\n\tpublic get IFluidLastEditedTracker(): LastEditedTracker {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidLastEditedTracker:interface).getLastEditDetails}\n\t */\n\tpublic getLastEditDetails(): ILastEditDetails | undefined {\n\t\treturn this.sharedSummaryBlock.get<ILastEditDetails>(this.lastEditedDetailsKey);\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidLastEditedTracker:interface).updateLastEditDetails}\n\t */\n\tpublic updateLastEditDetails(lastEditDetails: ILastEditDetails): void {\n\t\tthis.sharedSummaryBlock.set(this.lastEditedDetailsKey, lastEditDetails);\n\t}\n}\n"]}
1
+ {"version":3,"file":"lastEditedTracker.js","sourceRoot":"","sources":["../src/lastEditedTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH;;;;;GAKG;AACH,MAAa,iBAAiB;IAOA;IANZ,oBAAoB,GAAG,oBAAoB,CAAC;IAE7D;;;OAGG;IACH,YAA6B,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAAG,CAAC;IAEvE,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACI,kBAAkB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAmB,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACjF,CAAC;IAED;;OAEG;IACI,qBAAqB,CAAC,eAAiC;QAC7D,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC;IACzE,CAAC;CACD;AA1BD,8CA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SharedSummaryBlock } from \"@fluidframework/shared-summary-block/internal\";\n\nimport type { IFluidLastEditedTracker, ILastEditDetails } from \"./interfaces.js\";\n\n/**\n * Tracks the last edit details such as the last edited user details and the last edited timestamp. The last edited\n * details should be updated (via updateLastEditDetails) in response to a remote op since it uses shared summary block\n * as storage.\n * @internal\n */\nexport class LastEditedTracker implements IFluidLastEditedTracker {\n\tprivate readonly lastEditedDetailsKey = \"lastEditDetailsKey\";\n\n\t/**\n\t * Creates a LastEditedTracker object.\n\t * @param sharedSummaryBlock - The shared summary block where the details will be stored.\n\t */\n\tconstructor(private readonly sharedSummaryBlock: SharedSummaryBlock) {}\n\n\tpublic get IFluidLastEditedTracker(): LastEditedTracker {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidLastEditedTracker:interface).getLastEditDetails}\n\t */\n\tpublic getLastEditDetails(): ILastEditDetails | undefined {\n\t\treturn this.sharedSummaryBlock.get<ILastEditDetails>(this.lastEditedDetailsKey);\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidLastEditedTracker:interface).updateLastEditDetails}\n\t */\n\tpublic updateLastEditDetails(lastEditDetails: ILastEditDetails): void {\n\t\tthis.sharedSummaryBlock.set(this.lastEditedDetailsKey, lastEditDetails);\n\t}\n}\n"]}
@@ -13,13 +13,16 @@ const lastEditedTracker_js_1 = require("./lastEditedTracker.js");
13
13
  * @internal
14
14
  */
15
15
  class LastEditedTrackerDataObject extends internal_1.DataObject {
16
- constructor() {
17
- super(...arguments);
18
- this.sharedSummaryBlockId = "shared-summary-block-id";
19
- }
16
+ static factory = new internal_1.DataObjectFactory({
17
+ type: "@fluid-experimental/last-edited",
18
+ ctor: LastEditedTrackerDataObject,
19
+ sharedObjects: [internal_2.SharedSummaryBlock.getFactory()],
20
+ });
20
21
  static getFactory() {
21
22
  return LastEditedTrackerDataObject.factory;
22
23
  }
24
+ sharedSummaryBlockId = "shared-summary-block-id";
25
+ _lastEditedTracker;
23
26
  get lastEditedTracker() {
24
27
  if (this._lastEditedTracker === undefined) {
25
28
  throw new Error("Last Edited tracker was not initialized properly");
@@ -41,9 +44,4 @@ class LastEditedTrackerDataObject extends internal_1.DataObject {
41
44
  }
42
45
  }
43
46
  exports.LastEditedTrackerDataObject = LastEditedTrackerDataObject;
44
- LastEditedTrackerDataObject.factory = new internal_1.DataObjectFactory({
45
- type: "@fluid-experimental/last-edited",
46
- ctor: LastEditedTrackerDataObject,
47
- sharedObjects: [internal_2.SharedSummaryBlock.getFactory()],
48
- });
49
47
  //# sourceMappingURL=lastEditedTrackerDataObject.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lastEditedTrackerDataObject.js","sourceRoot":"","sources":["../src/lastEditedTrackerDataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gEAAkF;AAElF,4EAAmF;AAGnF,iEAA2D;AAE3D;;;GAGG;AACH,MAAa,2BACZ,SAAQ,qBAAU;IADnB;;QAekB,yBAAoB,GAAG,yBAAyB,CAAC;IA0BnE,CAAC;IA9BO,MAAM,CAAC,UAAU;QACvB,OAAO,2BAA2B,CAAC,OAAO,CAAC;IAC5C,CAAC;IAKD,IAAY,iBAAiB;QAC5B,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,IAAI,CAAC,kBAAkB,CAAC;IAChC,CAAC;IAED,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC/B,CAAC;IAES,KAAK,CAAC,qBAAqB;QACpC,MAAM,kBAAkB,GAAG,6BAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACrE,CAAC;IAES,KAAK,CAAC,cAAc;QAC7B,MAAM,kBAAkB;QACvB,oEAAoE;QACpE,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAmC,IAAI,CAAC,oBAAoB,CAAE,CAAC,GAAG,EAAE,CAAC;QACzF,IAAI,CAAC,kBAAkB,GAAG,IAAI,wCAAiB,CAAC,kBAAkB,CAAC,CAAC;IACrE,CAAC;;AAxCF,kEAyCC;AArCwB,mCAAO,GAC9B,IAAI,4BAAiB,CAAC;IACrB,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE,2BAA2B;IACjC,aAAa,EAAE,CAAC,6BAAkB,CAAC,UAAU,EAAE,CAAC;CAChD,CAAC,AAL4B,CAK3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DataObject, DataObjectFactory } from \"@fluidframework/aqueduct/internal\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { SharedSummaryBlock } from \"@fluidframework/shared-summary-block/internal\";\n\nimport type { IProvideFluidLastEditedTracker } from \"./interfaces.js\";\nimport { LastEditedTracker } from \"./lastEditedTracker.js\";\n\n/**\n * LastEditedTrackerDataObject creates a LastEditedTracker that keeps track of the latest edits to the document.\n * @internal\n */\nexport class LastEditedTrackerDataObject\n\textends DataObject\n\timplements IProvideFluidLastEditedTracker\n{\n\tprivate static readonly factory: DataObjectFactory<LastEditedTrackerDataObject> =\n\t\tnew DataObjectFactory({\n\t\t\ttype: \"@fluid-experimental/last-edited\",\n\t\t\tctor: LastEditedTrackerDataObject,\n\t\t\tsharedObjects: [SharedSummaryBlock.getFactory()],\n\t\t});\n\n\tpublic static getFactory(): DataObjectFactory<LastEditedTrackerDataObject> {\n\t\treturn LastEditedTrackerDataObject.factory;\n\t}\n\n\tprivate readonly sharedSummaryBlockId = \"shared-summary-block-id\";\n\tprivate _lastEditedTracker: LastEditedTracker | undefined;\n\n\tprivate get lastEditedTracker(): LastEditedTracker {\n\t\tif (this._lastEditedTracker === undefined) {\n\t\t\tthrow new Error(\"Last Edited tracker was not initialized properly\");\n\t\t}\n\n\t\treturn this._lastEditedTracker;\n\t}\n\n\tpublic get IFluidLastEditedTracker(): LastEditedTracker {\n\t\treturn this.lastEditedTracker;\n\t}\n\n\tprotected async initializingFirstTime(): Promise<void> {\n\t\tconst sharedSummaryBlock = SharedSummaryBlock.create(this.runtime);\n\t\tthis.root.set(this.sharedSummaryBlockId, sharedSummaryBlock.handle);\n\t}\n\n\tprotected async hasInitialized(): Promise<void> {\n\t\tconst sharedSummaryBlock =\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tawait this.root.get<IFluidHandle<SharedSummaryBlock>>(this.sharedSummaryBlockId)!.get();\n\t\tthis._lastEditedTracker = new LastEditedTracker(sharedSummaryBlock);\n\t}\n}\n"]}
1
+ {"version":3,"file":"lastEditedTrackerDataObject.js","sourceRoot":"","sources":["../src/lastEditedTrackerDataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gEAAkF;AAElF,4EAAmF;AAGnF,iEAA2D;AAE3D;;;GAGG;AACH,MAAa,2BACZ,SAAQ,qBAAU;IAGV,MAAM,CAAU,OAAO,GAC9B,IAAI,4BAAiB,CAAC;QACrB,IAAI,EAAE,iCAAiC;QACvC,IAAI,EAAE,2BAA2B;QACjC,aAAa,EAAE,CAAC,6BAAkB,CAAC,UAAU,EAAE,CAAC;KAChD,CAAC,CAAC;IAEG,MAAM,CAAC,UAAU;QACvB,OAAO,2BAA2B,CAAC,OAAO,CAAC;IAC5C,CAAC;IAEgB,oBAAoB,GAAG,yBAAyB,CAAC;IAC1D,kBAAkB,CAAgC;IAE1D,IAAY,iBAAiB;QAC5B,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,IAAI,CAAC,kBAAkB,CAAC;IAChC,CAAC;IAED,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC/B,CAAC;IAES,KAAK,CAAC,qBAAqB;QACpC,MAAM,kBAAkB,GAAG,6BAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACrE,CAAC;IAES,KAAK,CAAC,cAAc;QAC7B,MAAM,kBAAkB;QACvB,oEAAoE;QACpE,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAmC,IAAI,CAAC,oBAAoB,CAAE,CAAC,GAAG,EAAE,CAAC;QACzF,IAAI,CAAC,kBAAkB,GAAG,IAAI,wCAAiB,CAAC,kBAAkB,CAAC,CAAC;IACrE,CAAC;;AAxCF,kEAyCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DataObject, DataObjectFactory } from \"@fluidframework/aqueduct/internal\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { SharedSummaryBlock } from \"@fluidframework/shared-summary-block/internal\";\n\nimport type { IProvideFluidLastEditedTracker } from \"./interfaces.js\";\nimport { LastEditedTracker } from \"./lastEditedTracker.js\";\n\n/**\n * LastEditedTrackerDataObject creates a LastEditedTracker that keeps track of the latest edits to the document.\n * @internal\n */\nexport class LastEditedTrackerDataObject\n\textends DataObject\n\timplements IProvideFluidLastEditedTracker\n{\n\tprivate static readonly factory: DataObjectFactory<LastEditedTrackerDataObject> =\n\t\tnew DataObjectFactory({\n\t\t\ttype: \"@fluid-experimental/last-edited\",\n\t\t\tctor: LastEditedTrackerDataObject,\n\t\t\tsharedObjects: [SharedSummaryBlock.getFactory()],\n\t\t});\n\n\tpublic static getFactory(): DataObjectFactory<LastEditedTrackerDataObject> {\n\t\treturn LastEditedTrackerDataObject.factory;\n\t}\n\n\tprivate readonly sharedSummaryBlockId = \"shared-summary-block-id\";\n\tprivate _lastEditedTracker: LastEditedTracker | undefined;\n\n\tprivate get lastEditedTracker(): LastEditedTracker {\n\t\tif (this._lastEditedTracker === undefined) {\n\t\t\tthrow new Error(\"Last Edited tracker was not initialized properly\");\n\t\t}\n\n\t\treturn this._lastEditedTracker;\n\t}\n\n\tpublic get IFluidLastEditedTracker(): LastEditedTracker {\n\t\treturn this.lastEditedTracker;\n\t}\n\n\tprotected async initializingFirstTime(): Promise<void> {\n\t\tconst sharedSummaryBlock = SharedSummaryBlock.create(this.runtime);\n\t\tthis.root.set(this.sharedSummaryBlockId, sharedSummaryBlock.handle);\n\t}\n\n\tprotected async hasInitialized(): Promise<void> {\n\t\tconst sharedSummaryBlock =\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tawait this.root.get<IFluidHandle<SharedSummaryBlock>>(this.sharedSummaryBlockId)!.get();\n\t\tthis._lastEditedTracker = new LastEditedTracker(sharedSummaryBlock);\n\t}\n}\n"]}
package/dist/setup.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.setupLastEditedTrackerForContainer = void 0;
7
+ exports.setupLastEditedTrackerForContainer = setupLastEditedTrackerForContainer;
8
8
  const internal_1 = require("@fluidframework/container-runtime/internal");
9
9
  /**
10
10
  * Default implementation of {@link setupLastEditedTrackerForContainer}'s `shouldDiscardMessageFn` parameter,
@@ -66,5 +66,4 @@ function setupLastEditedTrackerForContainer(lastEditedTracker, runtime, shouldDi
66
66
  lastEditedTracker.updateLastEditDetails(lastEditDetails);
67
67
  });
68
68
  }
69
- exports.setupLastEditedTrackerForContainer = setupLastEditedTrackerForContainer;
70
69
  //# sourceMappingURL=setup.js.map
package/dist/setup.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yEAAkF;AAOlF;;;;;;GAMG;AACH,MAAM,2BAA2B,GAAG,CAAC,OAAkC,EAAW,EAAE,CACnF,OAAO,CAAC,IAAI,KAAK,+BAAoB,CAAC,MAAM;IAC5C,OAAO,CAAC,IAAI,KAAK,+BAAoB,CAAC,gBAAgB;IACtD,OAAO,CAAC,IAAI,KAAK,+BAAoB,CAAC,KAAK,CAAC;AAE7C;;;GAGG;AACH,SAAS,6BAA6B,CACrC,OAAkC,EAClC,MAAsB;IAEtB,+FAA+F;IAC/F,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,QAAkB,CAAC,CAAC;IACrE,MAAM,IAAI,GAAG,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC;IAC1C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,eAAe,GAAqB;YACzC,IAAI;YACJ,SAAS,EAAE,OAAO,CAAC,SAAS;SAC5B,CAAC;QACF,OAAO,eAAe,CAAC;IACxB,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,kCAAkC,CACjD,iBAA0C,EAC1C,OAA0B,EAC1B,yBAEe,2BAA2B;IAE1C,+EAA+E;IAC/E,+CAA+C;IAC/C,8GAA8G;IAC9G,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,cAAwB,EAAE,EAAE;QACjF,6EAA6E;QAC7E,IAAI,cAAc,KAAK,KAAK,IAAI,sBAAsB,CAAC,OAAO,CAAC,EAAE,CAAC;YACjE,OAAO;QACR,CAAC;QAED,6EAA6E;QAC7E,MAAM,eAAe,GAAG,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACpF,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;YACnC,OAAO;QACR,CAAC;QAED,iBAAiB,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACJ,CAAC;AAxBD,gFAwBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerMessageType } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IQuorumClients } from \"@fluidframework/driver-definitions\";\nimport type { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport type { IFluidLastEditedTracker, ILastEditDetails } from \"./interfaces.js\";\n\n/**\n * Default implementation of {@link setupLastEditedTrackerForContainer}'s `shouldDiscardMessageFn` parameter,\n * which tells that all messages other than {@link @fluidframework/container-runtime#ContainerMessageType.Alias},\n * {@link @fluidframework/container-runtime#ContainerMessageType.Attach}, and\n * {@link @fluidframework/container-runtime#ContainerMessageType.FluidDataStoreOp} type messages should be\n * discarded.\n */\nconst shouldDiscardMessageDefault = (message: ISequencedDocumentMessage): boolean =>\n\tmessage.type !== ContainerMessageType.Attach &&\n\tmessage.type !== ContainerMessageType.FluidDataStoreOp &&\n\tmessage.type !== ContainerMessageType.Alias;\n\n/**\n * Extracts the user information and timestamp from a message. Returns undefined if the user information for the\n * client who sent the message doesn't exist in the quorum.\n */\nfunction getLastEditDetailsFromMessage(\n\tmessage: ISequencedDocumentMessage,\n\tquorum: IQuorumClients,\n): ILastEditDetails | undefined {\n\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\tconst sequencedClient = quorum.getMember(message.clientId as string);\n\tconst user = sequencedClient?.client.user;\n\tif (user !== undefined) {\n\t\tconst lastEditDetails: ILastEditDetails = {\n\t\t\tuser,\n\t\t\ttimestamp: message.timestamp,\n\t\t};\n\t\treturn lastEditDetails;\n\t}\n\treturn undefined;\n}\n\n/**\n * Helper function to set up a data object that provides IFluidLastEditedTracker to track last edited in a Container.\n *\n * It does the following:\n *\n * - Registers an \"op\" listener on the runtime. On each message, it calls the shouldDiscardMessageFn to check\n * if the message should be discarded. It also discards all scheduler message. If a message is not discarded,\n * it passes the last edited information from the message to the last edited tracker.\n *\n * - The last edited information from the last message received before the lastEditedTracker is\n * loaded is stored and passed to the tracker once it loads.\n * @param lastEditedTracker - The last edited tracker.\n * @param runtime - The container runtime whose messages are to be tracked.\n * @param shouldDiscardMessageFn - Function that tells if a message should not be considered in computing last edited.\n * @internal\n */\nexport function setupLastEditedTrackerForContainer(\n\tlastEditedTracker: IFluidLastEditedTracker,\n\truntime: IContainerRuntime,\n\tshouldDiscardMessageFn: (\n\t\tmessage: ISequencedDocumentMessage,\n\t) => boolean = shouldDiscardMessageDefault,\n): void {\n\t// Register an op listener on the runtime. If the lastEditedTracker has loaded,\n\t// it passes the last edited information to its\n\t// last edited tracker. If the lastEditedTracker hasn't loaded, store the last edited information temporarily.\n\truntime.on(\"op\", (message: ISequencedDocumentMessage, runtimeMessage?: boolean) => {\n\t\t// If this message should be discarded as per shouldDiscardMessageFn, return.\n\t\tif (runtimeMessage === false || shouldDiscardMessageFn(message)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Get the last edited details from the message. If it doesn't exist, return.\n\t\tconst lastEditDetails = getLastEditDetailsFromMessage(message, runtime.getQuorum());\n\t\tif (lastEditDetails === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tlastEditedTracker.updateLastEditDetails(lastEditDetails);\n\t});\n}\n"]}
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA0DH,gFAwBC;AAhFD,yEAAkF;AAOlF;;;;;;GAMG;AACH,MAAM,2BAA2B,GAAG,CAAC,OAAkC,EAAW,EAAE,CACnF,OAAO,CAAC,IAAI,KAAK,+BAAoB,CAAC,MAAM;IAC5C,OAAO,CAAC,IAAI,KAAK,+BAAoB,CAAC,gBAAgB;IACtD,OAAO,CAAC,IAAI,KAAK,+BAAoB,CAAC,KAAK,CAAC;AAE7C;;;GAGG;AACH,SAAS,6BAA6B,CACrC,OAAkC,EAClC,MAAsB;IAEtB,+FAA+F;IAC/F,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,QAAkB,CAAC,CAAC;IACrE,MAAM,IAAI,GAAG,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC;IAC1C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,eAAe,GAAqB;YACzC,IAAI;YACJ,SAAS,EAAE,OAAO,CAAC,SAAS;SAC5B,CAAC;QACF,OAAO,eAAe,CAAC;IACxB,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,kCAAkC,CACjD,iBAA0C,EAC1C,OAA0B,EAC1B,yBAEe,2BAA2B;IAE1C,+EAA+E;IAC/E,+CAA+C;IAC/C,8GAA8G;IAC9G,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,cAAwB,EAAE,EAAE;QACjF,6EAA6E;QAC7E,IAAI,cAAc,KAAK,KAAK,IAAI,sBAAsB,CAAC,OAAO,CAAC,EAAE,CAAC;YACjE,OAAO;QACR,CAAC;QAED,6EAA6E;QAC7E,MAAM,eAAe,GAAG,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACpF,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;YACnC,OAAO;QACR,CAAC;QAED,iBAAiB,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerMessageType } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IQuorumClients } from \"@fluidframework/driver-definitions\";\nimport type { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport type { IFluidLastEditedTracker, ILastEditDetails } from \"./interfaces.js\";\n\n/**\n * Default implementation of {@link setupLastEditedTrackerForContainer}'s `shouldDiscardMessageFn` parameter,\n * which tells that all messages other than {@link @fluidframework/container-runtime#ContainerMessageType.Alias},\n * {@link @fluidframework/container-runtime#ContainerMessageType.Attach}, and\n * {@link @fluidframework/container-runtime#ContainerMessageType.FluidDataStoreOp} type messages should be\n * discarded.\n */\nconst shouldDiscardMessageDefault = (message: ISequencedDocumentMessage): boolean =>\n\tmessage.type !== ContainerMessageType.Attach &&\n\tmessage.type !== ContainerMessageType.FluidDataStoreOp &&\n\tmessage.type !== ContainerMessageType.Alias;\n\n/**\n * Extracts the user information and timestamp from a message. Returns undefined if the user information for the\n * client who sent the message doesn't exist in the quorum.\n */\nfunction getLastEditDetailsFromMessage(\n\tmessage: ISequencedDocumentMessage,\n\tquorum: IQuorumClients,\n): ILastEditDetails | undefined {\n\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\tconst sequencedClient = quorum.getMember(message.clientId as string);\n\tconst user = sequencedClient?.client.user;\n\tif (user !== undefined) {\n\t\tconst lastEditDetails: ILastEditDetails = {\n\t\t\tuser,\n\t\t\ttimestamp: message.timestamp,\n\t\t};\n\t\treturn lastEditDetails;\n\t}\n\treturn undefined;\n}\n\n/**\n * Helper function to set up a data object that provides IFluidLastEditedTracker to track last edited in a Container.\n *\n * It does the following:\n *\n * - Registers an \"op\" listener on the runtime. On each message, it calls the shouldDiscardMessageFn to check\n * if the message should be discarded. It also discards all scheduler message. If a message is not discarded,\n * it passes the last edited information from the message to the last edited tracker.\n *\n * - The last edited information from the last message received before the lastEditedTracker is\n * loaded is stored and passed to the tracker once it loads.\n * @param lastEditedTracker - The last edited tracker.\n * @param runtime - The container runtime whose messages are to be tracked.\n * @param shouldDiscardMessageFn - Function that tells if a message should not be considered in computing last edited.\n * @internal\n */\nexport function setupLastEditedTrackerForContainer(\n\tlastEditedTracker: IFluidLastEditedTracker,\n\truntime: IContainerRuntime,\n\tshouldDiscardMessageFn: (\n\t\tmessage: ISequencedDocumentMessage,\n\t) => boolean = shouldDiscardMessageDefault,\n): void {\n\t// Register an op listener on the runtime. If the lastEditedTracker has loaded,\n\t// it passes the last edited information to its\n\t// last edited tracker. If the lastEditedTracker hasn't loaded, store the last edited information temporarily.\n\truntime.on(\"op\", (message: ISequencedDocumentMessage, runtimeMessage?: boolean) => {\n\t\t// If this message should be discarded as per shouldDiscardMessageFn, return.\n\t\tif (runtimeMessage === false || shouldDiscardMessageFn(message)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Get the last edited details from the message. If it doesn't exist, return.\n\t\tconst lastEditDetails = getLastEditDetailsFromMessage(message, runtime.getQuorum());\n\t\tif (lastEditDetails === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tlastEditedTracker.updateLastEditDetails(lastEditDetails);\n\t});\n}\n"]}
@@ -9,13 +9,14 @@
9
9
  * @internal
10
10
  */
11
11
  export class LastEditedTracker {
12
+ sharedSummaryBlock;
13
+ lastEditedDetailsKey = "lastEditDetailsKey";
12
14
  /**
13
15
  * Creates a LastEditedTracker object.
14
16
  * @param sharedSummaryBlock - The shared summary block where the details will be stored.
15
17
  */
16
18
  constructor(sharedSummaryBlock) {
17
19
  this.sharedSummaryBlock = sharedSummaryBlock;
18
- this.lastEditedDetailsKey = "lastEditDetailsKey";
19
20
  }
20
21
  get IFluidLastEditedTracker() {
21
22
  return this;
@@ -1 +1 @@
1
- {"version":3,"file":"lastEditedTracker.js","sourceRoot":"","sources":["../src/lastEditedTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IAG7B;;;OAGG;IACH,YAA6B,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QANlD,yBAAoB,GAAG,oBAAoB,CAAC;IAMS,CAAC;IAEvE,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACI,kBAAkB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAmB,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACjF,CAAC;IAED;;OAEG;IACI,qBAAqB,CAAC,eAAiC;QAC7D,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC;IACzE,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SharedSummaryBlock } from \"@fluidframework/shared-summary-block/internal\";\n\nimport type { IFluidLastEditedTracker, ILastEditDetails } from \"./interfaces.js\";\n\n/**\n * Tracks the last edit details such as the last edited user details and the last edited timestamp. The last edited\n * details should be updated (via updateLastEditDetails) in response to a remote op since it uses shared summary block\n * as storage.\n * @internal\n */\nexport class LastEditedTracker implements IFluidLastEditedTracker {\n\tprivate readonly lastEditedDetailsKey = \"lastEditDetailsKey\";\n\n\t/**\n\t * Creates a LastEditedTracker object.\n\t * @param sharedSummaryBlock - The shared summary block where the details will be stored.\n\t */\n\tconstructor(private readonly sharedSummaryBlock: SharedSummaryBlock) {}\n\n\tpublic get IFluidLastEditedTracker(): LastEditedTracker {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidLastEditedTracker:interface).getLastEditDetails}\n\t */\n\tpublic getLastEditDetails(): ILastEditDetails | undefined {\n\t\treturn this.sharedSummaryBlock.get<ILastEditDetails>(this.lastEditedDetailsKey);\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidLastEditedTracker:interface).updateLastEditDetails}\n\t */\n\tpublic updateLastEditDetails(lastEditDetails: ILastEditDetails): void {\n\t\tthis.sharedSummaryBlock.set(this.lastEditedDetailsKey, lastEditDetails);\n\t}\n}\n"]}
1
+ {"version":3,"file":"lastEditedTracker.js","sourceRoot":"","sources":["../src/lastEditedTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IAOA;IANZ,oBAAoB,GAAG,oBAAoB,CAAC;IAE7D;;;OAGG;IACH,YAA6B,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAAG,CAAC;IAEvE,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACI,kBAAkB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAmB,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACjF,CAAC;IAED;;OAEG;IACI,qBAAqB,CAAC,eAAiC;QAC7D,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC;IACzE,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SharedSummaryBlock } from \"@fluidframework/shared-summary-block/internal\";\n\nimport type { IFluidLastEditedTracker, ILastEditDetails } from \"./interfaces.js\";\n\n/**\n * Tracks the last edit details such as the last edited user details and the last edited timestamp. The last edited\n * details should be updated (via updateLastEditDetails) in response to a remote op since it uses shared summary block\n * as storage.\n * @internal\n */\nexport class LastEditedTracker implements IFluidLastEditedTracker {\n\tprivate readonly lastEditedDetailsKey = \"lastEditDetailsKey\";\n\n\t/**\n\t * Creates a LastEditedTracker object.\n\t * @param sharedSummaryBlock - The shared summary block where the details will be stored.\n\t */\n\tconstructor(private readonly sharedSummaryBlock: SharedSummaryBlock) {}\n\n\tpublic get IFluidLastEditedTracker(): LastEditedTracker {\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidLastEditedTracker:interface).getLastEditDetails}\n\t */\n\tpublic getLastEditDetails(): ILastEditDetails | undefined {\n\t\treturn this.sharedSummaryBlock.get<ILastEditDetails>(this.lastEditedDetailsKey);\n\t}\n\n\t/**\n\t * {@inheritDoc (IFluidLastEditedTracker:interface).updateLastEditDetails}\n\t */\n\tpublic updateLastEditDetails(lastEditDetails: ILastEditDetails): void {\n\t\tthis.sharedSummaryBlock.set(this.lastEditedDetailsKey, lastEditDetails);\n\t}\n}\n"]}
@@ -10,13 +10,16 @@ import { LastEditedTracker } from "./lastEditedTracker.js";
10
10
  * @internal
11
11
  */
12
12
  export class LastEditedTrackerDataObject extends DataObject {
13
- constructor() {
14
- super(...arguments);
15
- this.sharedSummaryBlockId = "shared-summary-block-id";
16
- }
13
+ static factory = new DataObjectFactory({
14
+ type: "@fluid-experimental/last-edited",
15
+ ctor: LastEditedTrackerDataObject,
16
+ sharedObjects: [SharedSummaryBlock.getFactory()],
17
+ });
17
18
  static getFactory() {
18
19
  return LastEditedTrackerDataObject.factory;
19
20
  }
21
+ sharedSummaryBlockId = "shared-summary-block-id";
22
+ _lastEditedTracker;
20
23
  get lastEditedTracker() {
21
24
  if (this._lastEditedTracker === undefined) {
22
25
  throw new Error("Last Edited tracker was not initialized properly");
@@ -37,9 +40,4 @@ export class LastEditedTrackerDataObject extends DataObject {
37
40
  this._lastEditedTracker = new LastEditedTracker(sharedSummaryBlock);
38
41
  }
39
42
  }
40
- LastEditedTrackerDataObject.factory = new DataObjectFactory({
41
- type: "@fluid-experimental/last-edited",
42
- ctor: LastEditedTrackerDataObject,
43
- sharedObjects: [SharedSummaryBlock.getFactory()],
44
- });
45
43
  //# sourceMappingURL=lastEditedTrackerDataObject.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lastEditedTrackerDataObject.js","sourceRoot":"","sources":["../src/lastEditedTrackerDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAElF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAGnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;GAGG;AACH,MAAM,OAAO,2BACZ,SAAQ,UAAU;IADnB;;QAekB,yBAAoB,GAAG,yBAAyB,CAAC;IA0BnE,CAAC;IA9BO,MAAM,CAAC,UAAU;QACvB,OAAO,2BAA2B,CAAC,OAAO,CAAC;IAC5C,CAAC;IAKD,IAAY,iBAAiB;QAC5B,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,IAAI,CAAC,kBAAkB,CAAC;IAChC,CAAC;IAED,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC/B,CAAC;IAES,KAAK,CAAC,qBAAqB;QACpC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACrE,CAAC;IAES,KAAK,CAAC,cAAc;QAC7B,MAAM,kBAAkB;QACvB,oEAAoE;QACpE,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAmC,IAAI,CAAC,oBAAoB,CAAE,CAAC,GAAG,EAAE,CAAC;QACzF,IAAI,CAAC,kBAAkB,GAAG,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IACrE,CAAC;;AApCuB,mCAAO,GAC9B,IAAI,iBAAiB,CAAC;IACrB,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE,2BAA2B;IACjC,aAAa,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,CAAC;CAChD,CAAC,AAL4B,CAK3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DataObject, DataObjectFactory } from \"@fluidframework/aqueduct/internal\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { SharedSummaryBlock } from \"@fluidframework/shared-summary-block/internal\";\n\nimport type { IProvideFluidLastEditedTracker } from \"./interfaces.js\";\nimport { LastEditedTracker } from \"./lastEditedTracker.js\";\n\n/**\n * LastEditedTrackerDataObject creates a LastEditedTracker that keeps track of the latest edits to the document.\n * @internal\n */\nexport class LastEditedTrackerDataObject\n\textends DataObject\n\timplements IProvideFluidLastEditedTracker\n{\n\tprivate static readonly factory: DataObjectFactory<LastEditedTrackerDataObject> =\n\t\tnew DataObjectFactory({\n\t\t\ttype: \"@fluid-experimental/last-edited\",\n\t\t\tctor: LastEditedTrackerDataObject,\n\t\t\tsharedObjects: [SharedSummaryBlock.getFactory()],\n\t\t});\n\n\tpublic static getFactory(): DataObjectFactory<LastEditedTrackerDataObject> {\n\t\treturn LastEditedTrackerDataObject.factory;\n\t}\n\n\tprivate readonly sharedSummaryBlockId = \"shared-summary-block-id\";\n\tprivate _lastEditedTracker: LastEditedTracker | undefined;\n\n\tprivate get lastEditedTracker(): LastEditedTracker {\n\t\tif (this._lastEditedTracker === undefined) {\n\t\t\tthrow new Error(\"Last Edited tracker was not initialized properly\");\n\t\t}\n\n\t\treturn this._lastEditedTracker;\n\t}\n\n\tpublic get IFluidLastEditedTracker(): LastEditedTracker {\n\t\treturn this.lastEditedTracker;\n\t}\n\n\tprotected async initializingFirstTime(): Promise<void> {\n\t\tconst sharedSummaryBlock = SharedSummaryBlock.create(this.runtime);\n\t\tthis.root.set(this.sharedSummaryBlockId, sharedSummaryBlock.handle);\n\t}\n\n\tprotected async hasInitialized(): Promise<void> {\n\t\tconst sharedSummaryBlock =\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tawait this.root.get<IFluidHandle<SharedSummaryBlock>>(this.sharedSummaryBlockId)!.get();\n\t\tthis._lastEditedTracker = new LastEditedTracker(sharedSummaryBlock);\n\t}\n}\n"]}
1
+ {"version":3,"file":"lastEditedTrackerDataObject.js","sourceRoot":"","sources":["../src/lastEditedTrackerDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAElF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAGnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;GAGG;AACH,MAAM,OAAO,2BACZ,SAAQ,UAAU;IAGV,MAAM,CAAU,OAAO,GAC9B,IAAI,iBAAiB,CAAC;QACrB,IAAI,EAAE,iCAAiC;QACvC,IAAI,EAAE,2BAA2B;QACjC,aAAa,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,CAAC;KAChD,CAAC,CAAC;IAEG,MAAM,CAAC,UAAU;QACvB,OAAO,2BAA2B,CAAC,OAAO,CAAC;IAC5C,CAAC;IAEgB,oBAAoB,GAAG,yBAAyB,CAAC;IAC1D,kBAAkB,CAAgC;IAE1D,IAAY,iBAAiB;QAC5B,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,IAAI,CAAC,kBAAkB,CAAC;IAChC,CAAC;IAED,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC/B,CAAC;IAES,KAAK,CAAC,qBAAqB;QACpC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACrE,CAAC;IAES,KAAK,CAAC,cAAc;QAC7B,MAAM,kBAAkB;QACvB,oEAAoE;QACpE,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAmC,IAAI,CAAC,oBAAoB,CAAE,CAAC,GAAG,EAAE,CAAC;QACzF,IAAI,CAAC,kBAAkB,GAAG,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IACrE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DataObject, DataObjectFactory } from \"@fluidframework/aqueduct/internal\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { SharedSummaryBlock } from \"@fluidframework/shared-summary-block/internal\";\n\nimport type { IProvideFluidLastEditedTracker } from \"./interfaces.js\";\nimport { LastEditedTracker } from \"./lastEditedTracker.js\";\n\n/**\n * LastEditedTrackerDataObject creates a LastEditedTracker that keeps track of the latest edits to the document.\n * @internal\n */\nexport class LastEditedTrackerDataObject\n\textends DataObject\n\timplements IProvideFluidLastEditedTracker\n{\n\tprivate static readonly factory: DataObjectFactory<LastEditedTrackerDataObject> =\n\t\tnew DataObjectFactory({\n\t\t\ttype: \"@fluid-experimental/last-edited\",\n\t\t\tctor: LastEditedTrackerDataObject,\n\t\t\tsharedObjects: [SharedSummaryBlock.getFactory()],\n\t\t});\n\n\tpublic static getFactory(): DataObjectFactory<LastEditedTrackerDataObject> {\n\t\treturn LastEditedTrackerDataObject.factory;\n\t}\n\n\tprivate readonly sharedSummaryBlockId = \"shared-summary-block-id\";\n\tprivate _lastEditedTracker: LastEditedTracker | undefined;\n\n\tprivate get lastEditedTracker(): LastEditedTracker {\n\t\tif (this._lastEditedTracker === undefined) {\n\t\t\tthrow new Error(\"Last Edited tracker was not initialized properly\");\n\t\t}\n\n\t\treturn this._lastEditedTracker;\n\t}\n\n\tpublic get IFluidLastEditedTracker(): LastEditedTracker {\n\t\treturn this.lastEditedTracker;\n\t}\n\n\tprotected async initializingFirstTime(): Promise<void> {\n\t\tconst sharedSummaryBlock = SharedSummaryBlock.create(this.runtime);\n\t\tthis.root.set(this.sharedSummaryBlockId, sharedSummaryBlock.handle);\n\t}\n\n\tprotected async hasInitialized(): Promise<void> {\n\t\tconst sharedSummaryBlock =\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tawait this.root.get<IFluidHandle<SharedSummaryBlock>>(this.sharedSummaryBlockId)!.get();\n\t\tthis._lastEditedTracker = new LastEditedTracker(sharedSummaryBlock);\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-experimental/last-edited",
3
- "version": "2.117.0",
3
+ "version": "3.0.0",
4
4
  "description": "Tracks the last edited information in the Container.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -14,26 +14,18 @@
14
14
  "type": "module",
15
15
  "exports": {
16
16
  ".": {
17
- "import": {
18
- "types": "./lib/index.d.ts",
19
- "default": "./lib/index.js"
20
- },
21
- "require": {
22
- "types": "./dist/index.d.ts",
23
- "default": "./dist/index.js"
24
- }
17
+ "types": "./lib/index.d.ts",
18
+ "default": "./lib/index.js"
25
19
  }
26
20
  },
27
- "main": "lib/index.js",
28
- "types": "lib/index.d.ts",
29
21
  "dependencies": {
30
- "@fluidframework/aqueduct": "~2.117.0",
31
- "@fluidframework/container-runtime": "~2.117.0",
32
- "@fluidframework/container-runtime-definitions": "~2.117.0",
33
- "@fluidframework/core-interfaces": "~2.117.0",
34
- "@fluidframework/driver-definitions": "~2.117.0",
35
- "@fluidframework/runtime-utils": "~2.117.0",
36
- "@fluidframework/shared-summary-block": "~2.117.0"
22
+ "@fluidframework/aqueduct": "~3.0.0",
23
+ "@fluidframework/container-runtime": "~3.0.0",
24
+ "@fluidframework/container-runtime-definitions": "~3.0.0",
25
+ "@fluidframework/core-interfaces": "~3.0.0",
26
+ "@fluidframework/driver-definitions": "~3.0.0",
27
+ "@fluidframework/runtime-utils": "~3.0.0",
28
+ "@fluidframework/shared-summary-block": "~3.0.0"
37
29
  },
38
30
  "devDependencies": {
39
31
  "@arethetypeswrong/cli": "^0.18.5",
@@ -49,32 +41,34 @@
49
41
  "eslint": "~9.39.1",
50
42
  "jiti": "^2.6.1",
51
43
  "rimraf": "^6.1.3",
52
- "typescript": "~5.4.5"
44
+ "typescript": "~6.0.3"
53
45
  },
54
46
  "typeValidation": {
55
47
  "disabled": true
56
48
  },
57
49
  "scripts": {
58
50
  "build": "fluid-build . --task build",
51
+ "build:api-reports": "api-extractor run --local --config api-extractor/api-extractor-report.json",
52
+ "build:cjs": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
59
53
  "build:compile": "fluid-build . --task compile",
60
54
  "build:compile:min": "npm run build:compile",
61
- "build:docs": "api-extractor run --local",
62
- "build:esnext": "tsc --project ./tsconfig.json",
63
- "check:are-the-types-wrong": "attw --pack .",
55
+ "build:docs": "api-extractor run --local --config api-extractor/api-extractor-model.json",
56
+ "build:esm": "tsc --project ./tsconfig.json",
57
+ "check:are-the-types-wrong": "attw --pack . --profile esm-only",
64
58
  "check:biome": "biome check .",
65
59
  "check:exports": "concurrently \"npm:check:exports:*\"",
66
60
  "check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
67
61
  "check:exports:cjs:index": "api-extractor run --config api-extractor/api-extractor-lint-index.cjs.json",
68
62
  "check:exports:esm:index": "api-extractor run --config api-extractor/api-extractor-lint-index.esm.json",
69
63
  "check:format": "npm run check:biome",
70
- "ci:build:docs": "api-extractor run",
64
+ "ci:build:api-reports": "api-extractor run --config api-extractor/api-extractor-report.json",
65
+ "ci:build:docs": "api-extractor run --config api-extractor/api-extractor-model.json",
71
66
  "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
72
67
  "eslint": "eslint --quiet --format stylish src",
73
68
  "eslint:fix": "eslint --quiet --format stylish src --fix --fix-type problem,suggestion,layout",
74
69
  "format": "npm run format:biome",
75
70
  "format:biome": "biome check . --write",
76
71
  "lint": "fluid-build . --task lint",
77
- "lint:fix": "fluid-build . --task eslint:fix --task format",
78
- "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist"
72
+ "lint:fix": "fluid-build . --task eslint:fix --task format"
79
73
  }
80
74
  }
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../../common/build/build-common/tsconfig.node16.json",
2
+ "extends": "../../../common/build/build-common/tsconfig.node20.json",
3
3
  "exclude": ["dist", "node_modules"],
4
4
  "compilerOptions": {
5
5
  "rootDir": "./src",