@fluid-experimental/attributor 2.0.0-dev-rc.1.0.0.224419
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/.eslintrc.js +20 -0
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +122 -0
- package/LICENSE +21 -0
- package/README.md +144 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +4 -0
- package/api-report/attributor.api.md +71 -0
- package/dist/attributor-alpha.d.ts +27 -0
- package/dist/attributor-beta.d.ts +31 -0
- package/dist/attributor-public.d.ts +31 -0
- package/dist/attributor-untrimmed.d.ts +124 -0
- package/dist/attributor.cjs +69 -0
- package/dist/attributor.cjs.map +1 -0
- package/dist/attributor.d.ts +56 -0
- package/dist/attributor.d.ts.map +1 -0
- package/dist/encoders.cjs +80 -0
- package/dist/encoders.cjs.map +1 -0
- package/dist/encoders.d.ts +28 -0
- package/dist/encoders.d.ts.map +1 -0
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lz4Encoder.cjs +29 -0
- package/dist/lz4Encoder.cjs.map +1 -0
- package/dist/lz4Encoder.d.ts +7 -0
- package/dist/lz4Encoder.d.ts.map +1 -0
- package/dist/mixinAttributor.cjs +170 -0
- package/dist/mixinAttributor.cjs.map +1 -0
- package/dist/mixinAttributor.d.ts +57 -0
- package/dist/mixinAttributor.d.ts.map +1 -0
- package/dist/stringInterner.cjs +65 -0
- package/dist/stringInterner.cjs.map +1 -0
- package/dist/stringInterner.d.ts +55 -0
- package/dist/stringInterner.d.ts.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/attributor-alpha.d.mts +27 -0
- package/lib/attributor-beta.d.mts +31 -0
- package/lib/attributor-public.d.mts +31 -0
- package/lib/attributor-untrimmed.d.mts +124 -0
- package/lib/attributor.d.mts +56 -0
- package/lib/attributor.d.mts.map +1 -0
- package/lib/attributor.mjs +60 -0
- package/lib/attributor.mjs.map +1 -0
- package/lib/encoders.d.mts +28 -0
- package/lib/encoders.d.mts.map +1 -0
- package/lib/encoders.mjs +71 -0
- package/lib/encoders.mjs.map +1 -0
- package/lib/index.d.mts +3 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +3 -0
- package/lib/index.mjs.map +1 -0
- package/lib/lz4Encoder.d.mts +7 -0
- package/lib/lz4Encoder.d.mts.map +1 -0
- package/lib/lz4Encoder.mjs +21 -0
- package/lib/lz4Encoder.mjs.map +1 -0
- package/lib/mixinAttributor.d.mts +57 -0
- package/lib/mixinAttributor.d.mts.map +1 -0
- package/lib/mixinAttributor.mjs +165 -0
- package/lib/mixinAttributor.mjs.map +1 -0
- package/lib/stringInterner.d.mts +55 -0
- package/lib/stringInterner.d.mts.map +1 -0
- package/lib/stringInterner.mjs +61 -0
- package/lib/stringInterner.mjs.map +1 -0
- package/package.json +138 -0
- package/prettier.config.cjs +8 -0
- package/src/attributor.ts +107 -0
- package/src/encoders.ts +111 -0
- package/src/index.ts +12 -0
- package/src/lz4Encoder.ts +27 -0
- package/src/mixinAttributor.ts +317 -0
- package/src/stringInterner.ts +86 -0
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +12 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"],
|
|
8
|
+
parserOptions: {
|
|
9
|
+
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
10
|
+
},
|
|
11
|
+
overrides: [
|
|
12
|
+
{
|
|
13
|
+
// Rules only for test files
|
|
14
|
+
files: ["*.spec.ts", "src/test/**"],
|
|
15
|
+
rules: {
|
|
16
|
+
"import/no-nodejs-modules": ["error", { allow: ["assert", "fs", "path"] }],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|
package/.mocharc.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common");
|
|
9
|
+
|
|
10
|
+
const packageDir = __dirname;
|
|
11
|
+
const config = getFluidTestMochaConfig(packageDir);
|
|
12
|
+
module.exports = config;
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# @fluid-experimental/attributor
|
|
2
|
+
|
|
3
|
+
## 2.0.0-internal.8.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- container-runtime: Removed `ContainerRuntime.load(...)` [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
|
|
8
|
+
|
|
9
|
+
The static method `ContainerRuntime.load(...)` has been removed. Please migrate all usage of this method to
|
|
10
|
+
`ContainerRuntime.loadRuntime(...)`.
|
|
11
|
+
|
|
12
|
+
## 2.0.0-internal.7.4.0
|
|
13
|
+
|
|
14
|
+
Dependency updates only.
|
|
15
|
+
|
|
16
|
+
## 2.0.0-internal.7.3.0
|
|
17
|
+
|
|
18
|
+
Dependency updates only.
|
|
19
|
+
|
|
20
|
+
## 2.0.0-internal.7.2.0
|
|
21
|
+
|
|
22
|
+
Dependency updates only.
|
|
23
|
+
|
|
24
|
+
## 2.0.0-internal.7.1.0
|
|
25
|
+
|
|
26
|
+
Dependency updates only.
|
|
27
|
+
|
|
28
|
+
## 2.0.0-internal.7.0.0
|
|
29
|
+
|
|
30
|
+
### Major Changes
|
|
31
|
+
|
|
32
|
+
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
33
|
+
|
|
34
|
+
This included the following changes from the protocol-definitions release:
|
|
35
|
+
|
|
36
|
+
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
37
|
+
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
38
|
+
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
39
|
+
been added, which will be the typing for signals sent from the client to the server. Both extend a new
|
|
40
|
+
ISignalMessageBase interface that contains common members.
|
|
41
|
+
- The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
|
|
42
|
+
|
|
43
|
+
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
44
|
+
|
|
45
|
+
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
46
|
+
|
|
47
|
+
- @fluidframework/gitresources: 2.0.1
|
|
48
|
+
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
49
|
+
- @fluidframework/server-lambdas: 2.0.1
|
|
50
|
+
- @fluidframework/server-lambdas-driver: 2.0.1
|
|
51
|
+
- @fluidframework/server-local-server: 2.0.1
|
|
52
|
+
- @fluidframework/server-memory-orderer: 2.0.1
|
|
53
|
+
- @fluidframework/protocol-base: 2.0.1
|
|
54
|
+
- @fluidframework/server-routerlicious: 2.0.1
|
|
55
|
+
- @fluidframework/server-routerlicious-base: 2.0.1
|
|
56
|
+
- @fluidframework/server-services: 2.0.1
|
|
57
|
+
- @fluidframework/server-services-client: 2.0.1
|
|
58
|
+
- @fluidframework/server-services-core: 2.0.1
|
|
59
|
+
- @fluidframework/server-services-ordering-kafkanode: 2.0.1
|
|
60
|
+
- @fluidframework/server-services-ordering-rdkafka: 2.0.1
|
|
61
|
+
- @fluidframework/server-services-ordering-zookeeper: 2.0.1
|
|
62
|
+
- @fluidframework/server-services-shared: 2.0.1
|
|
63
|
+
- @fluidframework/server-services-telemetry: 2.0.1
|
|
64
|
+
- @fluidframework/server-services-utils: 2.0.1
|
|
65
|
+
- @fluidframework/server-test-utils: 2.0.1
|
|
66
|
+
- tinylicious: 2.0.1
|
|
67
|
+
|
|
68
|
+
- Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
69
|
+
|
|
70
|
+
The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
|
|
71
|
+
|
|
72
|
+
## 2.0.0-internal.6.4.0
|
|
73
|
+
|
|
74
|
+
Dependency updates only.
|
|
75
|
+
|
|
76
|
+
## 2.0.0-internal.6.3.0
|
|
77
|
+
|
|
78
|
+
Dependency updates only.
|
|
79
|
+
|
|
80
|
+
## 2.0.0-internal.6.2.0
|
|
81
|
+
|
|
82
|
+
Dependency updates only.
|
|
83
|
+
|
|
84
|
+
## 2.0.0-internal.6.1.0
|
|
85
|
+
|
|
86
|
+
Dependency updates only.
|
|
87
|
+
|
|
88
|
+
## 2.0.0-internal.6.0.0
|
|
89
|
+
|
|
90
|
+
### Major Changes
|
|
91
|
+
|
|
92
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
93
|
+
|
|
94
|
+
Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
|
|
95
|
+
|
|
96
|
+
## 2.0.0-internal.5.4.0
|
|
97
|
+
|
|
98
|
+
Dependency updates only.
|
|
99
|
+
|
|
100
|
+
## 2.0.0-internal.5.3.0
|
|
101
|
+
|
|
102
|
+
Dependency updates only.
|
|
103
|
+
|
|
104
|
+
## 2.0.0-internal.5.2.0
|
|
105
|
+
|
|
106
|
+
Dependency updates only.
|
|
107
|
+
|
|
108
|
+
## 2.0.0-internal.5.1.0
|
|
109
|
+
|
|
110
|
+
Dependency updates only.
|
|
111
|
+
|
|
112
|
+
## 2.0.0-internal.5.0.0
|
|
113
|
+
|
|
114
|
+
Dependency updates only.
|
|
115
|
+
|
|
116
|
+
## 2.0.0-internal.4.4.0
|
|
117
|
+
|
|
118
|
+
Dependency updates only.
|
|
119
|
+
|
|
120
|
+
## 2.0.0-internal.4.1.0
|
|
121
|
+
|
|
122
|
+
Dependency updates only.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# @fluid-experimental/attributor
|
|
2
|
+
|
|
3
|
+
This package contains definitions and implementations for framework-provided attribution functionality.
|
|
4
|
+
|
|
5
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_DEPENDENCY_GUIDELINES_SECTION:includeHeading=TRUE) -->
|
|
6
|
+
|
|
7
|
+
<!-- prettier-ignore-start -->
|
|
8
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
9
|
+
|
|
10
|
+
## Using Fluid Framework libraries
|
|
11
|
+
|
|
12
|
+
When taking a dependency on a Fluid Framework library, we recommend using a `^` (caret) version range, such as `^1.3.4`.
|
|
13
|
+
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
14
|
+
library consumers should always prefer `^`.
|
|
15
|
+
|
|
16
|
+
Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
|
|
17
|
+
you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
|
|
18
|
+
Standard `^` and `~` ranges will not work as expected.
|
|
19
|
+
See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
|
|
20
|
+
package for more information including tools to convert between version schemes.
|
|
21
|
+
|
|
22
|
+
<!-- prettier-ignore-end -->
|
|
23
|
+
|
|
24
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
25
|
+
|
|
26
|
+
## Status
|
|
27
|
+
|
|
28
|
+
All attribution APIs (both in this package and elsewhere in `@fluidframework` packages) are marked as [alpha](https://api-extractor.com/pages/tsdoc/tag_alpha/) to enable fast iteration (as third-party use is not officially supported, breaking API changes can be made in minor versions).
|
|
29
|
+
|
|
30
|
+
Despite this, the APIs are generally ready for early adoption--feel free to play around with them in local setups and provide feedback on their shape, usability, or other factors!
|
|
31
|
+
|
|
32
|
+
## Quickstart
|
|
33
|
+
|
|
34
|
+
To turn on op-stream based attribution in your container, use `mixinAttributor` to create a `ContainerRuntime` class which supports querying for attribution information.
|
|
35
|
+
When you instantiate your container runtime, pass a scope which implements `IProvideRuntimeAttributor`.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { ContainerRuntime } from "@fluidframework/container-runtime";
|
|
39
|
+
import { mixinAttributor, createRuntimeAttributor } from "@fluid-experimental/attributor";
|
|
40
|
+
|
|
41
|
+
const ContainerRuntimeWithAttribution = mixinAttributor(ContainerRuntime);
|
|
42
|
+
|
|
43
|
+
// ...then, in your ContainerRuntime factory use this class:
|
|
44
|
+
class ContainerRuntimeFactory implements IRuntimeFactory {
|
|
45
|
+
public async instantiateRuntime(
|
|
46
|
+
context: IContainerContext,
|
|
47
|
+
existing?: boolean,
|
|
48
|
+
): Promise<IRuntime> {
|
|
49
|
+
const attributor = createRuntimeAttributor();
|
|
50
|
+
// ...make this attributor accessible to your application however you deem fit; e.g. by registering it on a DependencyContainer.
|
|
51
|
+
// To inject loading and storing of attribution data on your runtime, provide a scope implementing IProvideRuntimeAttributor:
|
|
52
|
+
const scope: FluidObject<IProvideRuntimeAttributor> = { IRuntimeAttributor: attributor };
|
|
53
|
+
const runtime = await ContainerRuntimeWithAttribution.load(
|
|
54
|
+
context,
|
|
55
|
+
dataStoreRegistry,
|
|
56
|
+
undefined,
|
|
57
|
+
undefined,
|
|
58
|
+
scope,
|
|
59
|
+
);
|
|
60
|
+
// do whatever setup is necessary with the runtime here
|
|
61
|
+
return runtime;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This will cause your container runtime to load attribution data available on existing containers.
|
|
67
|
+
To additionally start storing attribution data on new documents, enable the config flag `"Fluid.Attribution.EnableOnNewFile"`.
|
|
68
|
+
Be sure to also [enable any necessary options at the DDS level](#dds-support).
|
|
69
|
+
For a more comprehensive list of backwards-compatability concerns which shed more light on these flags, see [integration](#integration).
|
|
70
|
+
|
|
71
|
+
Applications can recover this information using APIs on the DDSes they use. For example, the following code snippet illustrates how that works for `SharedString`:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
function getAttributionInfo(
|
|
75
|
+
attributor: IRuntimeAttributor,
|
|
76
|
+
sharedString: SharedString,
|
|
77
|
+
pos: number,
|
|
78
|
+
): AttributionInfo | undefined {
|
|
79
|
+
const { segment, offset } = sharedString.getContainingSegment(pos);
|
|
80
|
+
if (!segment || !offset) {
|
|
81
|
+
throw new UsageError("Invalid pos");
|
|
82
|
+
}
|
|
83
|
+
const attributionKey: AttributionKey = segment.attribution.getAtOffset(offset);
|
|
84
|
+
// BEWARE: DDSes may track attribution key with type "detached" and "local", which aren't yet
|
|
85
|
+
// supported out-of-the-box in IRuntimeAttributor. The application can recover AttributionInfo
|
|
86
|
+
// from these keys if it wants using user information about the creator of the document and the
|
|
87
|
+
// current active user, respectively.
|
|
88
|
+
if (attributor.has(attributionKey)) {
|
|
89
|
+
return attributor.get(attributionKey);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Get the user who inserted the text at position 0 in `sharedString` and the timestamp for when they did so.
|
|
94
|
+
const { user, timestamp } = getAttributionInfo(attributor, sharedString, 0);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Overview
|
|
98
|
+
|
|
99
|
+
Attribution is inherently a content-based operation--it answers questions about who created or changed a piece of content as well as when they did it.
|
|
100
|
+
Since applications typically want attribution at a relatively fine-grained level, DDSes are the initial entrypoint for attributing content.
|
|
101
|
+
A DDS may define its attribution API as it sees fit, but should somehow expose a way to retrieve attribution keys from its content.
|
|
102
|
+
These attribution keys can be exchanged for user and timestamp information using the container runtime.
|
|
103
|
+
|
|
104
|
+
### DDS Support
|
|
105
|
+
|
|
106
|
+
The following DDSes currently support attribution:
|
|
107
|
+
|
|
108
|
+
- [SharedString](../../dds/sequence/README.md#attribution)
|
|
109
|
+
|
|
110
|
+
### Op Stream Attribution
|
|
111
|
+
|
|
112
|
+
Framework-provided attribution tracks user and timestamp information for each op submitted.
|
|
113
|
+
Any more complex scenarios where attribution doesn't align with the direct submitter (such as attributing copy-pasted content to the original creators) will need to be handled by Fluid consumers using extensibility points.
|
|
114
|
+
The extensibility APIs are a work in progress; check back later for more details.
|
|
115
|
+
|
|
116
|
+
### Integration
|
|
117
|
+
|
|
118
|
+
Backwards-compatability for using this mixin with existing documents is a work in progress.
|
|
119
|
+
When an existing document is loaded that was created using a ContainerRuntimeFactory without a mixed in attributor,
|
|
120
|
+
that document will continue to operate as if no attribution has been mixed in.
|
|
121
|
+
Additionally, if a document that contains attribution is loaded using a container runtime without a mixed-in attributor,
|
|
122
|
+
any attribution information stored in that document may be lost.
|
|
123
|
+
|
|
124
|
+
The current design of the mixin's behavior is therefore motivated by the ability to roll out the feature in Fluid's collaborative environment.
|
|
125
|
+
The behavior of `"Fluid.Attribution.WriteOnNewFile"` supports the standard strategy of rolling out code that reads a new format and waiting for it to saturate before beginning to write that new format.
|
|
126
|
+
"reading the new format" corresponds to using a container runtime initialized with `mixinAttributor`, and "writing the new format" to enabling `"Fluid.Attribution.WriteOnNewFile"` in configuration.
|
|
127
|
+
During the "waiting to saturate" period, developers are free to experiment with turning the feature flag on locally and testing various compatability scenarios.
|
|
128
|
+
|
|
129
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_TRADEMARK_SECTION:includeHeading=TRUE) -->
|
|
130
|
+
|
|
131
|
+
<!-- prettier-ignore-start -->
|
|
132
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
133
|
+
|
|
134
|
+
## Trademark
|
|
135
|
+
|
|
136
|
+
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
137
|
+
|
|
138
|
+
Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
139
|
+
|
|
140
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
141
|
+
|
|
142
|
+
<!-- prettier-ignore-end -->
|
|
143
|
+
|
|
144
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
## API Report File for "@fluid-experimental/attributor"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { AttributionInfo } from '@fluidframework/runtime-definitions';
|
|
8
|
+
import { AttributionKey } from '@fluidframework/runtime-definitions';
|
|
9
|
+
import { ContainerRuntime } from '@fluidframework/container-runtime';
|
|
10
|
+
import { IAudience } from '@fluidframework/container-definitions';
|
|
11
|
+
import { IDeltaManager } from '@fluidframework/container-definitions';
|
|
12
|
+
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
13
|
+
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
14
|
+
|
|
15
|
+
// @internal
|
|
16
|
+
export class Attributor implements IAttributor {
|
|
17
|
+
constructor(initialEntries?: Iterable<[number, AttributionInfo]>);
|
|
18
|
+
// (undocumented)
|
|
19
|
+
entries(): IterableIterator<[number, AttributionInfo]>;
|
|
20
|
+
getAttributionInfo(key: number): AttributionInfo;
|
|
21
|
+
// (undocumented)
|
|
22
|
+
protected readonly keyToInfo: Map<number, AttributionInfo>;
|
|
23
|
+
// (undocumented)
|
|
24
|
+
tryGetAttributionInfo(key: number): AttributionInfo | undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// @internal (undocumented)
|
|
28
|
+
export function createRuntimeAttributor(): IRuntimeAttributor;
|
|
29
|
+
|
|
30
|
+
// @internal (undocumented)
|
|
31
|
+
export const enableOnNewFileKey = "Fluid.Attribution.EnableOnNewFile";
|
|
32
|
+
|
|
33
|
+
// @internal
|
|
34
|
+
export interface IAttributor {
|
|
35
|
+
// (undocumented)
|
|
36
|
+
entries(): IterableIterator<[number, AttributionInfo]>;
|
|
37
|
+
getAttributionInfo(key: number): AttributionInfo;
|
|
38
|
+
// (undocumented)
|
|
39
|
+
tryGetAttributionInfo(key: number): AttributionInfo | undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// @internal (undocumented)
|
|
43
|
+
export interface IProvideRuntimeAttributor {
|
|
44
|
+
// (undocumented)
|
|
45
|
+
readonly IRuntimeAttributor: IRuntimeAttributor;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// @internal (undocumented)
|
|
49
|
+
export const IRuntimeAttributor: keyof IProvideRuntimeAttributor;
|
|
50
|
+
|
|
51
|
+
// @internal @sealed
|
|
52
|
+
export interface IRuntimeAttributor extends IProvideRuntimeAttributor {
|
|
53
|
+
// (undocumented)
|
|
54
|
+
get(key: AttributionKey): AttributionInfo;
|
|
55
|
+
// (undocumented)
|
|
56
|
+
has(key: AttributionKey): boolean;
|
|
57
|
+
// (undocumented)
|
|
58
|
+
readonly isEnabled: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// @internal
|
|
62
|
+
export const mixinAttributor: (Base?: typeof ContainerRuntime) => typeof ContainerRuntime;
|
|
63
|
+
|
|
64
|
+
// @internal
|
|
65
|
+
export class OpStreamAttributor extends Attributor implements IAttributor {
|
|
66
|
+
constructor(deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, audience: IAudience, initialEntries?: Iterable<[number, AttributionInfo]>);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// (No @packageDocumentation comment for this package)
|
|
70
|
+
|
|
71
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AttributionInfo } from '@fluidframework/runtime-definitions';
|
|
2
|
+
import { AttributionKey } from '@fluidframework/runtime-definitions';
|
|
3
|
+
import { ContainerRuntime } from '@fluidframework/container-runtime';
|
|
4
|
+
import { IAudience } from '@fluidframework/container-definitions';
|
|
5
|
+
import { IDeltaManager } from '@fluidframework/container-definitions';
|
|
6
|
+
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
7
|
+
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: AttributionInfo */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: Attributor */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: createRuntimeAttributor */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: enableOnNewFileKey */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: IAttributor */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: IProvideRuntimeAttributor */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: IRuntimeAttributor */
|
|
22
|
+
|
|
23
|
+
/* Excluded from this release type: mixinAttributor */
|
|
24
|
+
|
|
25
|
+
/* Excluded from this release type: OpStreamAttributor */
|
|
26
|
+
|
|
27
|
+
export { }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AttributionInfo } from '@fluidframework/runtime-definitions';
|
|
2
|
+
import { AttributionKey } from '@fluidframework/runtime-definitions';
|
|
3
|
+
import { ContainerRuntime } from '@fluidframework/container-runtime';
|
|
4
|
+
import { IAudience } from '@fluidframework/container-definitions';
|
|
5
|
+
import { IDeltaManager } from '@fluidframework/container-definitions';
|
|
6
|
+
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
7
|
+
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: AttributionInfo */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: AttributionKey */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: Attributor */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: ContainerRuntime */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: createRuntimeAttributor */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: enableOnNewFileKey */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: IAttributor */
|
|
22
|
+
|
|
23
|
+
/* Excluded from this release type: IProvideRuntimeAttributor */
|
|
24
|
+
|
|
25
|
+
/* Excluded from this release type: IRuntimeAttributor */
|
|
26
|
+
|
|
27
|
+
/* Excluded from this release type: mixinAttributor */
|
|
28
|
+
|
|
29
|
+
/* Excluded from this release type: OpStreamAttributor */
|
|
30
|
+
|
|
31
|
+
export { }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AttributionInfo } from '@fluidframework/runtime-definitions';
|
|
2
|
+
import { AttributionKey } from '@fluidframework/runtime-definitions';
|
|
3
|
+
import { ContainerRuntime } from '@fluidframework/container-runtime';
|
|
4
|
+
import { IAudience } from '@fluidframework/container-definitions';
|
|
5
|
+
import { IDeltaManager } from '@fluidframework/container-definitions';
|
|
6
|
+
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
7
|
+
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: AttributionInfo */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: AttributionKey */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: Attributor */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: ContainerRuntime */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: createRuntimeAttributor */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: enableOnNewFileKey */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: IAttributor */
|
|
22
|
+
|
|
23
|
+
/* Excluded from this release type: IProvideRuntimeAttributor */
|
|
24
|
+
|
|
25
|
+
/* Excluded from this release type: IRuntimeAttributor */
|
|
26
|
+
|
|
27
|
+
/* Excluded from this release type: mixinAttributor */
|
|
28
|
+
|
|
29
|
+
/* Excluded from this release type: OpStreamAttributor */
|
|
30
|
+
|
|
31
|
+
export { }
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { AttributionInfo } from '@fluidframework/runtime-definitions';
|
|
2
|
+
import { AttributionKey } from '@fluidframework/runtime-definitions';
|
|
3
|
+
import { ContainerRuntime } from '@fluidframework/container-runtime';
|
|
4
|
+
import { IAudience } from '@fluidframework/container-definitions';
|
|
5
|
+
import { IDeltaManager } from '@fluidframework/container-definitions';
|
|
6
|
+
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
7
|
+
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* {@inheritdoc IAttributor}
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare class Attributor implements IAttributor {
|
|
14
|
+
protected readonly keyToInfo: Map<number, AttributionInfo>;
|
|
15
|
+
/**
|
|
16
|
+
* @param initialEntries - Any entries which should be populated on instantiation.
|
|
17
|
+
*/
|
|
18
|
+
constructor(initialEntries?: Iterable<[number, AttributionInfo]>);
|
|
19
|
+
/**
|
|
20
|
+
* {@inheritdoc IAttributor.getAttributionInfo}
|
|
21
|
+
*/
|
|
22
|
+
getAttributionInfo(key: number): AttributionInfo;
|
|
23
|
+
/**
|
|
24
|
+
* {@inheritdoc IAttributor.tryGetAttributionInfo}
|
|
25
|
+
*/
|
|
26
|
+
tryGetAttributionInfo(key: number): AttributionInfo | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* {@inheritdoc IAttributor.entries}
|
|
29
|
+
*/
|
|
30
|
+
entries(): IterableIterator<[number, AttributionInfo]>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @returns an IRuntimeAttributor for usage with `mixinAttributor`. The attributor will only be populated with data
|
|
35
|
+
* once it's passed via scope to a container runtime load flow. See {@link mixinAttributor}.
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare function createRuntimeAttributor(): IRuntimeAttributor;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export declare const enableOnNewFileKey = "Fluid.Attribution.EnableOnNewFile";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Provides lookup between attribution keys and their associated attribution information.
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export declare interface IAttributor {
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves attribution information associated with a particular key.
|
|
52
|
+
* @param key - Attribution key to look up.
|
|
53
|
+
* @throws If no attribution information is recorded for that key.
|
|
54
|
+
*/
|
|
55
|
+
getAttributionInfo(key: number): AttributionInfo;
|
|
56
|
+
/**
|
|
57
|
+
* @param key - Attribution key to look up.
|
|
58
|
+
* @returns the attribution information associated with the provided key, or undefined if no information exists.
|
|
59
|
+
*/
|
|
60
|
+
tryGetAttributionInfo(key: number): AttributionInfo | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* @returns an iterable of (attribution key, attribution info) pairs for each stored key.
|
|
63
|
+
*/
|
|
64
|
+
entries(): IterableIterator<[number, AttributionInfo]>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
export declare interface IProvideRuntimeAttributor {
|
|
71
|
+
readonly IRuntimeAttributor: IRuntimeAttributor;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export declare const IRuntimeAttributor: keyof IProvideRuntimeAttributor;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Provides access to attribution information stored on the container runtime.
|
|
81
|
+
*
|
|
82
|
+
* Attributors are only populated after the container runtime they are injected into has initialized.
|
|
83
|
+
* @sealed
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
export declare interface IRuntimeAttributor extends IProvideRuntimeAttributor {
|
|
87
|
+
/**
|
|
88
|
+
* @throws - If no AttributionInfo exists for this key.
|
|
89
|
+
*/
|
|
90
|
+
get(key: AttributionKey): AttributionInfo;
|
|
91
|
+
/**
|
|
92
|
+
* @returns Whether any AttributionInfo exists for the provided key.
|
|
93
|
+
*/
|
|
94
|
+
has(key: AttributionKey): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* @returns Whether the runtime is currently tracking attribution information for the loaded container.
|
|
97
|
+
* See {@link mixinAttributor} for more details on when this happens.
|
|
98
|
+
*/
|
|
99
|
+
readonly isEnabled: boolean;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Mixes in logic to load and store runtime-based attribution functionality.
|
|
104
|
+
*
|
|
105
|
+
* The `scope` passed to `load` should implement `IProvideRuntimeAttributor`.
|
|
106
|
+
*
|
|
107
|
+
* Existing documents without stored attributors will not start storing attribution information: if an
|
|
108
|
+
* IRuntimeAttributor is passed via scope to load a document that never previously had attribution information,
|
|
109
|
+
* that attributor's `has` method will always return `false`.
|
|
110
|
+
* @param Base - base class, inherits from FluidAttributorRuntime
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
export declare const mixinAttributor: (Base?: typeof ContainerRuntime) => typeof ContainerRuntime;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Attributor which listens to an op stream and records entries for each op.
|
|
117
|
+
* Sequence numbers are used as attribution keys.
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
export declare class OpStreamAttributor extends Attributor implements IAttributor {
|
|
121
|
+
constructor(deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, audience: IAudience, initialEntries?: Iterable<[number, AttributionInfo]>);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { }
|