@fluid-experimental/last-edited 0.56.7 → 0.57.1
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/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/setup.d.ts +2 -2
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +6 -9
- package/dist/setup.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/setup.d.ts +2 -2
- package/lib/setup.d.ts.map +1 -1
- package/lib/setup.js +6 -9
- package/lib/setup.js.map +1 -1
- package/package.json +8 -8
- package/src/packageVersion.ts +1 -1
- package/src/setup.ts +7 -9
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluid-experimental/last-edited";
|
|
8
|
-
export declare const pkgVersion = "0.
|
|
8
|
+
export declare const pkgVersion = "0.57.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluid-experimental/last-edited";
|
|
11
|
-
exports.pkgVersion = "0.
|
|
11
|
+
exports.pkgVersion = "0.57.1";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,iCAAiC,CAAC;AAC5C,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/last-edited\";\nexport const pkgVersion = \"0.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,iCAAiC,CAAC;AAC5C,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/last-edited\";\nexport const pkgVersion = \"0.57.1\";\n"]}
|
package/dist/setup.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ import { IFluidLastEditedTracker } from "./interfaces";
|
|
|
12
12
|
* if the message should be discarded. It also discards all scheduler message. If a message is not discarded,
|
|
13
13
|
* it passes the last edited information from the message to the last edited tracker.
|
|
14
14
|
* - The last edited information from the last message received before the lastEditedTracker is
|
|
15
|
-
* loaded is stored and passed
|
|
16
|
-
* @param lastEditedTracker - The last
|
|
15
|
+
* loaded is stored and passed to the tracker once it loads.
|
|
16
|
+
* @param lastEditedTracker - The last edited tracker.
|
|
17
17
|
* @param runtime - The container runtime whose messages are to be tracked.
|
|
18
18
|
* @param shouldDiscardMessageFn - Function that tells if a message should not be considered in computing last edited.
|
|
19
19
|
*/
|
package/dist/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAkB,MAAM,sCAAsC,CAAC;AAEjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAoB,uBAAuB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAkB,MAAM,sCAAsC,CAAC;AAEjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAoB,uBAAuB,EAAE,MAAM,cAAc,CAAC;AA2BzE;;;;;;;;;;;GAWG;AACH,wBAAgB,kCAAkC,CAC9C,iBAAiB,EAAE,uBAAuB,EAC1C,OAAO,EAAE,iBAAiB,EAC1B,sBAAsB,GAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAqC,QAmBxG"}
|
package/dist/setup.js
CHANGED
|
@@ -7,13 +7,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.setupLastEditedTrackerForContainer = void 0;
|
|
8
8
|
const container_runtime_1 = require("@fluidframework/container-runtime");
|
|
9
9
|
// Default implementation of the shouldDiscardMessageFn function below that tells that all messages other
|
|
10
|
-
// than "Attach" and "Operation" type messages should be discarded.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
10
|
+
// than "Alias", "Attach" and "Operation" type messages should be discarded.
|
|
11
|
+
const shouldDiscardMessageDefault = (message) => message.type !== container_runtime_1.ContainerMessageType.Attach &&
|
|
12
|
+
message.type !== container_runtime_1.ContainerMessageType.FluidDataStoreOp &&
|
|
13
|
+
message.type !== container_runtime_1.ContainerMessageType.Alias;
|
|
17
14
|
// Extracts the user information and timestamp from a message. Returns undefined if the user information for the
|
|
18
15
|
// client who sent the message doesn't exist in the quorum.
|
|
19
16
|
function getLastEditDetailsFromMessage(message, quorum) {
|
|
@@ -35,8 +32,8 @@ function getLastEditDetailsFromMessage(message, quorum) {
|
|
|
35
32
|
* if the message should be discarded. It also discards all scheduler message. If a message is not discarded,
|
|
36
33
|
* it passes the last edited information from the message to the last edited tracker.
|
|
37
34
|
* - The last edited information from the last message received before the lastEditedTracker is
|
|
38
|
-
* loaded is stored and passed
|
|
39
|
-
* @param lastEditedTracker - The last
|
|
35
|
+
* loaded is stored and passed to the tracker once it loads.
|
|
36
|
+
* @param lastEditedTracker - The last edited tracker.
|
|
40
37
|
* @param runtime - The container runtime whose messages are to be tracked.
|
|
41
38
|
* @param shouldDiscardMessageFn - Function that tells if a message should not be considered in computing last edited.
|
|
42
39
|
*/
|
package/dist/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAAyE;AAIzE,yGAAyG;AACzG,
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAAyE;AAIzE,yGAAyG;AACzG,4EAA4E;AAC5E,MAAM,2BAA2B,GAAG,CAAC,OAAkC,EAAE,EAAE,CACvE,OAAO,CAAC,IAAI,KAAK,wCAAoB,CAAC,MAAM;IAC5C,OAAO,CAAC,IAAI,KAAK,wCAAoB,CAAC,gBAAgB;IACtD,OAAO,CAAC,IAAI,KAAK,wCAAoB,CAAC,KAAK,CAAC;AAEhD,gHAAgH;AAChH,2DAA2D;AAC3D,SAAS,6BAA6B,CAClC,OAAkC,EAClC,MAAsB;IAEtB,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,CAAC,IAAI,CAAC;IAC1C,IAAI,IAAI,KAAK,SAAS,EAAE;QACpB,MAAM,eAAe,GAAqB;YACtC,IAAI;YACJ,SAAS,EAAE,OAAO,CAAC,SAAS;SAC/B,CAAC;QACF,OAAO,eAAe,CAAC;KAC1B;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,kCAAkC,CAC9C,iBAA0C,EAC1C,OAA0B,EAC1B,yBAA0E,2BAA2B;IAErG,+EAA+E;IAC/E,+CAA+C;IAC/C,8GAA8G;IAC9G,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,EAAE;QACpD,6EAA6E;QAC7E,IAAI,sBAAsB,CAAC,OAAO,CAAC,EAAE;YACjC,OAAO;SACV;QAED,6EAA6E;QAC7E,MAAM,eAAe,GAAG,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACpF,IAAI,eAAe,KAAK,SAAS,EAAE;YAC/B,OAAO;SACV;QAED,iBAAiB,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACP,CAAC;AAtBD,gFAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage, IQuorumClients } from \"@fluidframework/protocol-definitions\";\nimport { ContainerMessageType } from \"@fluidframework/container-runtime\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { ILastEditDetails, IFluidLastEditedTracker } from \"./interfaces\";\n\n// Default implementation of the shouldDiscardMessageFn function below that tells that all messages other\n// than \"Alias\", \"Attach\" and \"Operation\" type messages should be discarded.\nconst shouldDiscardMessageDefault = (message: ISequencedDocumentMessage) =>\n message.type !== ContainerMessageType.Attach &&\n message.type !== ContainerMessageType.FluidDataStoreOp &&\n message.type !== ContainerMessageType.Alias;\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.\nfunction getLastEditDetailsFromMessage(\n message: ISequencedDocumentMessage,\n quorum: IQuorumClients,\n): ILastEditDetails | undefined {\n const sequencedClient = quorum.getMember(message.clientId);\n const user = sequencedClient?.client.user;\n if (user !== undefined) {\n const lastEditDetails: ILastEditDetails = {\n user,\n timestamp: message.timestamp,\n };\n return lastEditDetails;\n }\n return undefined;\n}\n\n/**\n * Helper function to set up a data object that provides IFluidLastEditedTracker to track last edited in a Container.\n * It does the following:\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 * - 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 */\nexport function setupLastEditedTrackerForContainer(\n lastEditedTracker: IFluidLastEditedTracker,\n runtime: IContainerRuntime,\n shouldDiscardMessageFn: (message: ISequencedDocumentMessage) => boolean = shouldDiscardMessageDefault,\n) {\n // Register an op listener on the runtime. If the lastEditedTracker has loaded,\n // it passes the last edited information to its\n // last edited tracker. If the lastEditedTracker hasn't loaded, store the last edited information temporarily.\n runtime.on(\"op\", (message: ISequencedDocumentMessage) => {\n // If this message should be discarded as per shouldDiscardMessageFn, return.\n if (shouldDiscardMessageFn(message)) {\n return;\n }\n\n // Get the last edited details from the message. If it doesn't exist, return.\n const lastEditDetails = getLastEditDetailsFromMessage(message, runtime.getQuorum());\n if (lastEditDetails === undefined) {\n return;\n }\n\n lastEditedTracker.updateLastEditDetails(lastEditDetails);\n });\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluid-experimental/last-edited";
|
|
8
|
-
export declare const pkgVersion = "0.
|
|
8
|
+
export declare const pkgVersion = "0.57.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,iCAAiC,CAAC;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/last-edited\";\nexport const pkgVersion = \"0.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,iCAAiC,CAAC;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/last-edited\";\nexport const pkgVersion = \"0.57.1\";\n"]}
|
package/lib/setup.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ import { IFluidLastEditedTracker } from "./interfaces";
|
|
|
12
12
|
* if the message should be discarded. It also discards all scheduler message. If a message is not discarded,
|
|
13
13
|
* it passes the last edited information from the message to the last edited tracker.
|
|
14
14
|
* - The last edited information from the last message received before the lastEditedTracker is
|
|
15
|
-
* loaded is stored and passed
|
|
16
|
-
* @param lastEditedTracker - The last
|
|
15
|
+
* loaded is stored and passed to the tracker once it loads.
|
|
16
|
+
* @param lastEditedTracker - The last edited tracker.
|
|
17
17
|
* @param runtime - The container runtime whose messages are to be tracked.
|
|
18
18
|
* @param shouldDiscardMessageFn - Function that tells if a message should not be considered in computing last edited.
|
|
19
19
|
*/
|
package/lib/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAkB,MAAM,sCAAsC,CAAC;AAEjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAoB,uBAAuB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAkB,MAAM,sCAAsC,CAAC;AAEjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAoB,uBAAuB,EAAE,MAAM,cAAc,CAAC;AA2BzE;;;;;;;;;;;GAWG;AACH,wBAAgB,kCAAkC,CAC9C,iBAAiB,EAAE,uBAAuB,EAC1C,OAAO,EAAE,iBAAiB,EAC1B,sBAAsB,GAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAqC,QAmBxG"}
|
package/lib/setup.js
CHANGED
|
@@ -4,13 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ContainerMessageType } from "@fluidframework/container-runtime";
|
|
6
6
|
// Default implementation of the shouldDiscardMessageFn function below that tells that all messages other
|
|
7
|
-
// than "Attach" and "Operation" type messages should be discarded.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
7
|
+
// than "Alias", "Attach" and "Operation" type messages should be discarded.
|
|
8
|
+
const shouldDiscardMessageDefault = (message) => message.type !== ContainerMessageType.Attach &&
|
|
9
|
+
message.type !== ContainerMessageType.FluidDataStoreOp &&
|
|
10
|
+
message.type !== ContainerMessageType.Alias;
|
|
14
11
|
// Extracts the user information and timestamp from a message. Returns undefined if the user information for the
|
|
15
12
|
// client who sent the message doesn't exist in the quorum.
|
|
16
13
|
function getLastEditDetailsFromMessage(message, quorum) {
|
|
@@ -32,8 +29,8 @@ function getLastEditDetailsFromMessage(message, quorum) {
|
|
|
32
29
|
* if the message should be discarded. It also discards all scheduler message. If a message is not discarded,
|
|
33
30
|
* it passes the last edited information from the message to the last edited tracker.
|
|
34
31
|
* - The last edited information from the last message received before the lastEditedTracker is
|
|
35
|
-
* loaded is stored and passed
|
|
36
|
-
* @param lastEditedTracker - The last
|
|
32
|
+
* loaded is stored and passed to the tracker once it loads.
|
|
33
|
+
* @param lastEditedTracker - The last edited tracker.
|
|
37
34
|
* @param runtime - The container runtime whose messages are to be tracked.
|
|
38
35
|
* @param shouldDiscardMessageFn - Function that tells if a message should not be considered in computing last edited.
|
|
39
36
|
*/
|
package/lib/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAIzE,yGAAyG;AACzG,
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAIzE,yGAAyG;AACzG,4EAA4E;AAC5E,MAAM,2BAA2B,GAAG,CAAC,OAAkC,EAAE,EAAE,CACvE,OAAO,CAAC,IAAI,KAAK,oBAAoB,CAAC,MAAM;IAC5C,OAAO,CAAC,IAAI,KAAK,oBAAoB,CAAC,gBAAgB;IACtD,OAAO,CAAC,IAAI,KAAK,oBAAoB,CAAC,KAAK,CAAC;AAEhD,gHAAgH;AAChH,2DAA2D;AAC3D,SAAS,6BAA6B,CAClC,OAAkC,EAClC,MAAsB;IAEtB,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,CAAC,IAAI,CAAC;IAC1C,IAAI,IAAI,KAAK,SAAS,EAAE;QACpB,MAAM,eAAe,GAAqB;YACtC,IAAI;YACJ,SAAS,EAAE,OAAO,CAAC,SAAS;SAC/B,CAAC;QACF,OAAO,eAAe,CAAC;KAC1B;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kCAAkC,CAC9C,iBAA0C,EAC1C,OAA0B,EAC1B,yBAA0E,2BAA2B;IAErG,+EAA+E;IAC/E,+CAA+C;IAC/C,8GAA8G;IAC9G,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,EAAE;QACpD,6EAA6E;QAC7E,IAAI,sBAAsB,CAAC,OAAO,CAAC,EAAE;YACjC,OAAO;SACV;QAED,6EAA6E;QAC7E,MAAM,eAAe,GAAG,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACpF,IAAI,eAAe,KAAK,SAAS,EAAE;YAC/B,OAAO;SACV;QAED,iBAAiB,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage, IQuorumClients } from \"@fluidframework/protocol-definitions\";\nimport { ContainerMessageType } from \"@fluidframework/container-runtime\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { ILastEditDetails, IFluidLastEditedTracker } from \"./interfaces\";\n\n// Default implementation of the shouldDiscardMessageFn function below that tells that all messages other\n// than \"Alias\", \"Attach\" and \"Operation\" type messages should be discarded.\nconst shouldDiscardMessageDefault = (message: ISequencedDocumentMessage) =>\n message.type !== ContainerMessageType.Attach &&\n message.type !== ContainerMessageType.FluidDataStoreOp &&\n message.type !== ContainerMessageType.Alias;\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.\nfunction getLastEditDetailsFromMessage(\n message: ISequencedDocumentMessage,\n quorum: IQuorumClients,\n): ILastEditDetails | undefined {\n const sequencedClient = quorum.getMember(message.clientId);\n const user = sequencedClient?.client.user;\n if (user !== undefined) {\n const lastEditDetails: ILastEditDetails = {\n user,\n timestamp: message.timestamp,\n };\n return lastEditDetails;\n }\n return undefined;\n}\n\n/**\n * Helper function to set up a data object that provides IFluidLastEditedTracker to track last edited in a Container.\n * It does the following:\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 * - 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 */\nexport function setupLastEditedTrackerForContainer(\n lastEditedTracker: IFluidLastEditedTracker,\n runtime: IContainerRuntime,\n shouldDiscardMessageFn: (message: ISequencedDocumentMessage) => boolean = shouldDiscardMessageDefault,\n) {\n // Register an op listener on the runtime. If the lastEditedTracker has loaded,\n // it passes the last edited information to its\n // last edited tracker. If the lastEditedTracker hasn't loaded, store the last edited information temporarily.\n runtime.on(\"op\", (message: ISequencedDocumentMessage) => {\n // If this message should be discarded as per shouldDiscardMessageFn, return.\n if (shouldDiscardMessageFn(message)) {\n return;\n }\n\n // Get the last edited details from the message. If it doesn't exist, return.\n const lastEditDetails = getLastEditDetailsFromMessage(message, runtime.getQuorum());\n if (lastEditDetails === undefined) {\n return;\n }\n\n lastEditedTracker.updateLastEditDetails(lastEditDetails);\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/last-edited",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.1",
|
|
4
4
|
"description": "Tracks the last edited information in the Container.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": "https://github.com/microsoft/FluidFramework",
|
|
@@ -50,19 +50,19 @@
|
|
|
50
50
|
"temp-directory": "nyc/.nyc_output"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@fluidframework/aqueduct": "^0.
|
|
53
|
+
"@fluidframework/aqueduct": "^0.57.1",
|
|
54
54
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
55
|
-
"@fluidframework/container-runtime": "^0.
|
|
56
|
-
"@fluidframework/container-runtime-definitions": "^0.
|
|
55
|
+
"@fluidframework/container-runtime": "^0.57.1",
|
|
56
|
+
"@fluidframework/container-runtime-definitions": "^0.57.1",
|
|
57
57
|
"@fluidframework/core-interfaces": "^0.42.0",
|
|
58
58
|
"@fluidframework/protocol-definitions": "^0.1026.0",
|
|
59
|
-
"@fluidframework/runtime-utils": "^0.
|
|
60
|
-
"@fluidframework/shared-summary-block": "^0.
|
|
59
|
+
"@fluidframework/runtime-utils": "^0.57.1",
|
|
60
|
+
"@fluidframework/shared-summary-block": "^0.57.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@fluidframework/build-common": "^0.23.0",
|
|
64
|
-
"@fluidframework/eslint-config-fluid": "^0.
|
|
65
|
-
"@fluidframework/mocha-test-setup": "^0.
|
|
64
|
+
"@fluidframework/eslint-config-fluid": "^0.26.0",
|
|
65
|
+
"@fluidframework/mocha-test-setup": "^0.57.1",
|
|
66
66
|
"@microsoft/api-extractor": "^7.16.1",
|
|
67
67
|
"@rushstack/eslint-config": "^2.5.1",
|
|
68
68
|
"@types/mocha": "^8.2.2",
|
package/src/packageVersion.ts
CHANGED
package/src/setup.ts
CHANGED
|
@@ -9,13 +9,11 @@ import { IContainerRuntime } from "@fluidframework/container-runtime-definitions
|
|
|
9
9
|
import { ILastEditDetails, IFluidLastEditedTracker } from "./interfaces";
|
|
10
10
|
|
|
11
11
|
// Default implementation of the shouldDiscardMessageFn function below that tells that all messages other
|
|
12
|
-
// than "Attach" and "Operation" type messages should be discarded.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
12
|
+
// than "Alias", "Attach" and "Operation" type messages should be discarded.
|
|
13
|
+
const shouldDiscardMessageDefault = (message: ISequencedDocumentMessage) =>
|
|
14
|
+
message.type !== ContainerMessageType.Attach &&
|
|
15
|
+
message.type !== ContainerMessageType.FluidDataStoreOp &&
|
|
16
|
+
message.type !== ContainerMessageType.Alias;
|
|
19
17
|
|
|
20
18
|
// Extracts the user information and timestamp from a message. Returns undefined if the user information for the
|
|
21
19
|
// client who sent the message doesn't exist in the quorum.
|
|
@@ -42,8 +40,8 @@ function getLastEditDetailsFromMessage(
|
|
|
42
40
|
* if the message should be discarded. It also discards all scheduler message. If a message is not discarded,
|
|
43
41
|
* it passes the last edited information from the message to the last edited tracker.
|
|
44
42
|
* - The last edited information from the last message received before the lastEditedTracker is
|
|
45
|
-
* loaded is stored and passed
|
|
46
|
-
* @param lastEditedTracker - The last
|
|
43
|
+
* loaded is stored and passed to the tracker once it loads.
|
|
44
|
+
* @param lastEditedTracker - The last edited tracker.
|
|
47
45
|
* @param runtime - The container runtime whose messages are to be tracked.
|
|
48
46
|
* @param shouldDiscardMessageFn - Function that tells if a message should not be considered in computing last edited.
|
|
49
47
|
*/
|