@fluid-experimental/attributor 2.0.0-internal.7.2.2 → 2.0.0-internal.7.4.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -2
  3. package/api-extractor-lint.json +13 -0
  4. package/api-extractor.json +9 -1
  5. package/api-report/attributor.api.md +9 -9
  6. package/dist/attributor-alpha.d.ts +27 -0
  7. package/dist/attributor-beta.d.ts +35 -0
  8. package/dist/attributor-public.d.ts +35 -0
  9. package/dist/attributor-untrimmed.d.ts +124 -0
  10. package/dist/{attributor.js → attributor.cjs} +3 -3
  11. package/dist/attributor.cjs.map +1 -0
  12. package/dist/attributor.d.ts +3 -3
  13. package/dist/{encoders.js → encoders.cjs} +2 -2
  14. package/dist/encoders.cjs.map +1 -0
  15. package/dist/{index.js → index.cjs} +3 -3
  16. package/dist/index.cjs.map +1 -0
  17. package/dist/{lz4Encoder.js → lz4Encoder.cjs} +1 -1
  18. package/dist/lz4Encoder.cjs.map +1 -0
  19. package/dist/{mixinAttributor.js → mixinAttributor.cjs} +36 -13
  20. package/dist/mixinAttributor.cjs.map +1 -0
  21. package/dist/mixinAttributor.d.ts +6 -9
  22. package/dist/mixinAttributor.d.ts.map +1 -1
  23. package/dist/{stringInterner.js → stringInterner.cjs} +1 -1
  24. package/dist/stringInterner.cjs.map +1 -0
  25. package/dist/tsdoc-metadata.json +1 -1
  26. package/lib/attributor-alpha.d.ts +27 -0
  27. package/lib/attributor-beta.d.ts +35 -0
  28. package/lib/attributor-public.d.ts +35 -0
  29. package/lib/attributor-untrimmed.d.ts +124 -0
  30. package/lib/attributor.d.ts +3 -3
  31. package/lib/attributor.d.ts.map +1 -1
  32. package/lib/{attributor.js → attributor.mjs} +3 -7
  33. package/lib/attributor.mjs.map +1 -0
  34. package/lib/encoders.d.ts +2 -2
  35. package/lib/encoders.d.ts.map +1 -1
  36. package/lib/{encoders.js → encoders.mjs} +2 -6
  37. package/lib/encoders.mjs.map +1 -0
  38. package/lib/index.d.ts +2 -6
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/index.mjs +3 -0
  41. package/lib/index.mjs.map +1 -0
  42. package/lib/lz4Encoder.d.ts +1 -1
  43. package/lib/lz4Encoder.d.ts.map +1 -1
  44. package/lib/{lz4Encoder.js → lz4Encoder.mjs} +1 -5
  45. package/lib/lz4Encoder.mjs.map +1 -0
  46. package/lib/mixinAttributor.d.ts +6 -9
  47. package/lib/mixinAttributor.d.ts.map +1 -1
  48. package/lib/{mixinAttributor.js → mixinAttributor.mjs} +36 -13
  49. package/lib/mixinAttributor.mjs.map +1 -0
  50. package/lib/{stringInterner.js → stringInterner.mjs} +1 -1
  51. package/lib/stringInterner.mjs.map +1 -0
  52. package/package.json +53 -35
  53. package/src/attributor.ts +3 -3
  54. package/src/mixinAttributor.ts +51 -13
  55. package/tsc-multi.test.json +4 -0
  56. package/tsconfig.json +5 -3
  57. package/dist/attributor.js.map +0 -1
  58. package/dist/encoders.js.map +0 -1
  59. package/dist/index.js.map +0 -1
  60. package/dist/lz4Encoder.js.map +0 -1
  61. package/dist/mixinAttributor.js.map +0 -1
  62. package/dist/stringInterner.js.map +0 -1
  63. package/lib/attributor.js.map +0 -1
  64. package/lib/encoders.js.map +0 -1
  65. package/lib/index.js +0 -7
  66. package/lib/index.js.map +0 -1
  67. package/lib/lz4Encoder.js.map +0 -1
  68. package/lib/mixinAttributor.js.map +0 -1
  69. package/lib/stringInterner.js.map +0 -1
  70. package/tsconfig.esnext.json +0 -7
@@ -1,18 +1,15 @@
1
1
  import { ContainerRuntime } from "@fluidframework/container-runtime";
2
2
  import { AttributionInfo, AttributionKey } from "@fluidframework/runtime-definitions";
3
3
  /**
4
- * @alpha
5
- * Feature Gate Key -
6
- * Whether or not a container runtime instantiated using `mixinAttributor`'s load should generate an attributor on
7
- * new files. See package README for more notes on integration.
4
+ * @internal
8
5
  */
9
6
  export declare const enableOnNewFileKey = "Fluid.Attribution.EnableOnNewFile";
10
7
  /**
11
- * @alpha
8
+ * @internal
12
9
  */
13
10
  export declare const IRuntimeAttributor: keyof IProvideRuntimeAttributor;
14
11
  /**
15
- * @alpha
12
+ * @internal
16
13
  */
17
14
  export interface IProvideRuntimeAttributor {
18
15
  readonly IRuntimeAttributor: IRuntimeAttributor;
@@ -22,7 +19,7 @@ export interface IProvideRuntimeAttributor {
22
19
  *
23
20
  * Attributors are only populated after the container runtime they are injected into has initialized.
24
21
  * @sealed
25
- * @alpha
22
+ * @internal
26
23
  */
27
24
  export interface IRuntimeAttributor extends IProvideRuntimeAttributor {
28
25
  /**
@@ -42,7 +39,7 @@ export interface IRuntimeAttributor extends IProvideRuntimeAttributor {
42
39
  /**
43
40
  * @returns an IRuntimeAttributor for usage with `mixinAttributor`. The attributor will only be populated with data
44
41
  * once it's passed via scope to a container runtime load flow. See {@link mixinAttributor}.
45
- * @alpha
42
+ * @internal
46
43
  */
47
44
  export declare function createRuntimeAttributor(): IRuntimeAttributor;
48
45
  /**
@@ -54,7 +51,7 @@ export declare function createRuntimeAttributor(): IRuntimeAttributor;
54
51
  * IRuntimeAttributor is passed via scope to load a document that never previously had attribution information,
55
52
  * that attributor's `has` method will always return `false`.
56
53
  * @param Base - base class, inherits from FluidAttributorRuntime
57
- * @alpha
54
+ * @internal
58
55
  */
59
56
  export declare const mixinAttributor: (Base?: typeof ContainerRuntime) => typeof ContainerRuntime;
60
57
  //# sourceMappingURL=mixinAttributor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EACN,eAAe,EACf,cAAc,EAId,MAAM,qCAAqC,CAAC;AAoB7C;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,sCAAsC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,kBA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AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,UAAU,uBAAuB,4BA0IrB,CAAC"}
@@ -62,4 +62,4 @@ class MutableStringInterner {
62
62
  }
63
63
  }
64
64
  exports.MutableStringInterner = MutableStringInterner;
65
- //# sourceMappingURL=stringInterner.js.map
65
+ //# sourceMappingURL=stringInterner.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringInterner.cjs","sourceRoot":"","sources":["../src/stringInterner.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAA6D;AAoB7D;;;;GAIG;AACH,MAAa,qBAAqB;IAIjC;;;OAGG;IACH,YAAY,eAAkC,EAAE;QAP/B,0BAAqB,GAAG,IAAI,GAAG,EAA4B,CAAC;QAC5D,oBAAe,GAAa,EAAE,CAAC;QAO/C,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;YACjC,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;SAClC;IACF,CAAC;IAED;;;OAGG;IACI,qBAAqB,CAAC,KAAa;QACzC,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC7D,CAAC;IAEM,aAAa,CAAC,KAAa;QACjC,OAAO,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACI,SAAS,CAAC,QAAgB;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,CAAC,MAAM,EAAE;YACZ,MAAM,IAAI,4BAAU,CAAC,6BAA6B,QAAQ,GAAG,CAAC,CAAC;SAC/D;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;OAGG;IACI,eAAe;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC7B,CAAC;IAED,+GAA+G;IACvG,WAAW,CAAC,KAAa;QAChC,MAAM,UAAU,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAwB,CAAC;QACvE,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAClD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,OAAO,UAAU,CAAC;IACnB,CAAC;CACD;AAvDD,sDAuDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\n\n/**\n * The ID of the string that has been interned, which can be used by a {@link StringInterner} to retrieve the\n * original string.\n * @public\n */\nexport type InternedStringId = number & {\n\treadonly InternedStringId: \"e221abc9-9d17-4493-8db0-70c871a1c27c\";\n};\n\n/**\n * Interns strings as integers.\n */\nexport interface StringInterner {\n\tgetInternedId(input: string): InternedStringId | undefined;\n\tgetString(internedId: number): string;\n\tgetSerializable(): readonly string[];\n}\n\n/**\n * Interns strings as integers.\n * Given a string, this class will produce a unique integer associated with that string that can then be used to\n * retrieve the string.\n */\nexport class MutableStringInterner implements StringInterner {\n\tprivate readonly stringToInternedIdMap = new Map<string, InternedStringId>();\n\tprivate readonly internedStrings: string[] = [];\n\n\t/**\n\t * @param inputStrings - A list of strings to intern in the order given. Can be used to rehydrate from a previous\n\t * `StringInterner`'s {@link StringInterner.getSerializable} return value.\n\t */\n\tconstructor(inputStrings: readonly string[] = []) {\n\t\tfor (const value of inputStrings) {\n\t\t\tthis.getOrCreateInternedId(value);\n\t\t}\n\t}\n\n\t/**\n\t * @param input - The string to get the associated intern ID for\n\t * @returns an intern ID that is uniquely associated with the input string\n\t */\n\tpublic getOrCreateInternedId(input: string): InternedStringId {\n\t\treturn this.getInternedId(input) ?? this.createNewId(input);\n\t}\n\n\tpublic getInternedId(input: string): InternedStringId | undefined {\n\t\treturn this.stringToInternedIdMap.get(input);\n\t}\n\n\t/**\n\t *\n\t * @param internId - The intern ID to get the associated string for. Can only retrieve strings that have been\n\t * used as inputs to calls of `getInternId`.\n\t * @returns a string that is uniquely associated with the given intern ID\n\t */\n\tpublic getString(internId: number): string {\n\t\tconst result = this.internedStrings[internId];\n\t\tif (!result) {\n\t\t\tthrow new UsageError(`No string associated with ${internId}.`);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * @returns The list of strings interned where the indices map to the associated {@link InternedStringId} of\n\t * each string.\n\t */\n\tpublic getSerializable(): readonly string[] {\n\t\treturn this.internedStrings;\n\t}\n\n\t/** Create a new interned id. Assumes without validation that the input doesn't already have an interned id. */\n\tprivate createNewId(input: string): InternedStringId {\n\t\tconst internedId = this.stringToInternedIdMap.size as InternedStringId;\n\t\tthis.stringToInternedIdMap.set(input, internedId);\n\t\tthis.internedStrings.push(input);\n\t\treturn internedId;\n\t}\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.38.0"
8
+ "packageVersion": "7.38.3"
9
9
  }
10
10
  ]
11
11
  }
@@ -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,35 @@
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: IAudience */
24
+
25
+ /* Excluded from this release type: IDeltaManager */
26
+
27
+ /* Excluded from this release type: IProvideRuntimeAttributor */
28
+
29
+ /* Excluded from this release type: IRuntimeAttributor */
30
+
31
+ /* Excluded from this release type: mixinAttributor */
32
+
33
+ /* Excluded from this release type: OpStreamAttributor */
34
+
35
+ export { }
@@ -0,0 +1,35 @@
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: IAudience */
24
+
25
+ /* Excluded from this release type: IDeltaManager */
26
+
27
+ /* Excluded from this release type: IProvideRuntimeAttributor */
28
+
29
+ /* Excluded from this release type: IRuntimeAttributor */
30
+
31
+ /* Excluded from this release type: mixinAttributor */
32
+
33
+ /* Excluded from this release type: OpStreamAttributor */
34
+
35
+ 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 { }
@@ -3,7 +3,7 @@ import { AttributionInfo } from "@fluidframework/runtime-definitions";
3
3
  import { IAudience, IDeltaManager } from "@fluidframework/container-definitions";
4
4
  /**
5
5
  * Provides lookup between attribution keys and their associated attribution information.
6
- * @alpha
6
+ * @internal
7
7
  */
8
8
  export interface IAttributor {
9
9
  /**
@@ -24,7 +24,7 @@ export interface IAttributor {
24
24
  }
25
25
  /**
26
26
  * {@inheritdoc IAttributor}
27
- * @alpha
27
+ * @internal
28
28
  */
29
29
  export declare class Attributor implements IAttributor {
30
30
  protected readonly keyToInfo: Map<number, AttributionInfo>;
@@ -48,7 +48,7 @@ export declare class Attributor implements IAttributor {
48
48
  /**
49
49
  * Attributor which listens to an op stream and records entries for each op.
50
50
  * Sequence numbers are used as attribution keys.
51
- * @alpha
51
+ * @internal
52
52
  */
53
53
  export declare class OpStreamAttributor extends Attributor implements IAttributor {
54
54
  constructor(deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, audience: IAudience, initialEntries?: Iterable<[number, AttributionInfo]>);
@@ -1 +1 @@
1
- {"version":3,"file":"attributor.d.ts","sourceRoot":"","sources":["../src/attributor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC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AAE,MAAM,qCAAqC;OAE9D,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,uCAAuC;AAEhF;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B;;;;OAIG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;IAEjD;;;OAGG;IACH,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;IAEhE;;OAEG;IACH,OAAO,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;CAIvD;AAED;;;GAGG;AACH,qBAAa,UAAW,YAAW,WAAW;IAC7C,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAE3D;;OAEG;gBACS,cAAc,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAIhE;;OAEG;IACI,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe;IAQvD;;OAEG;IACI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAItE;;OAEG;IACI,OAAO,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAG7D;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,UAAW,YAAW,WAAW;gBAEvE,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,EACxE,QAAQ,EAAE,SAAS,EACnB,cAAc,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAoBrD"}
@@ -1,12 +1,8 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
1
  import { assert } from "@fluidframework/core-utils";
6
2
  import { UsageError } from "@fluidframework/telemetry-utils";
7
3
  /**
8
4
  * {@inheritdoc IAttributor}
9
- * @alpha
5
+ * @internal
10
6
  */
11
7
  export class Attributor {
12
8
  /**
@@ -41,7 +37,7 @@ export class Attributor {
41
37
  /**
42
38
  * Attributor which listens to an op stream and records entries for each op.
43
39
  * Sequence numbers are used as attribution keys.
44
- * @alpha
40
+ * @internal
45
41
  */
46
42
  export class OpStreamAttributor extends Attributor {
47
43
  constructor(deltaManager, audience, initialEntries) {
@@ -61,4 +57,4 @@ export class OpStreamAttributor extends Attributor {
61
57
  });
62
58
  }
63
59
  }
64
- //# sourceMappingURL=attributor.js.map
60
+ //# sourceMappingURL=attributor.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributor.mjs","sourceRoot":"","sources":["../src/attributor.ts"],"names":[],"mappings":"OAIO,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAG5C,EAAE,UAAU,EAAE,MAAM,iCAAiC;AA8B5D;;;GAGG;AACH,MAAM,OAAO,UAAU;IAGtB;;OAEG;IACH,YAAY,cAAoD;QAC/D,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACI,kBAAkB,CAAC,GAAW;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,EAAE;YACZ,MAAM,IAAI,UAAU,CAAC,uDAAuD,GAAG,GAAG,CAAC,CAAC;SACpF;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;OAEG;IACI,qBAAqB,CAAC,GAAW;QACvC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,OAAO;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IACjD,YACC,YAAwE,EACxE,QAAmB,EACnB,cAAoD;QAEpD,KAAK,CAAC,cAAc,CAAC,CAAC;QACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,EAAE;YAC5D,+FAA+F;YAC/F,4EAA4E;YAC5E,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,QAAkB,CAAC,CAAC;YAC9D,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE;gBAC1B,uFAAuF;gBACvF,MAAM,CACL,MAAM,KAAK,SAAS,EACpB,KAAK,CAAC,oDAAoD,CAC1D,CAAC;gBACF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE;oBAC1C,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,SAAS,EAAE,OAAO,CAAC,SAAS;iBAC5B,CAAC,CAAC;aACH;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentMessage, ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { AttributionInfo } from \"@fluidframework/runtime-definitions\";\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport { IAudience, IDeltaManager } from \"@fluidframework/container-definitions\";\n\n/**\n * Provides lookup between attribution keys and their associated attribution information.\n * @internal\n */\nexport interface IAttributor {\n\t/**\n\t * Retrieves attribution information associated with a particular key.\n\t * @param key - Attribution key to look up.\n\t * @throws If no attribution information is recorded for that key.\n\t */\n\tgetAttributionInfo(key: number): AttributionInfo;\n\n\t/**\n\t * @param key - Attribution key to look up.\n\t * @returns the attribution information associated with the provided key, or undefined if no information exists.\n\t */\n\ttryGetAttributionInfo(key: number): AttributionInfo | undefined;\n\n\t/**\n\t * @returns an iterable of (attribution key, attribution info) pairs for each stored key.\n\t */\n\tentries(): IterableIterator<[number, AttributionInfo]>;\n\n\t// TODO:\n\t// - GC\n}\n\n/**\n * {@inheritdoc IAttributor}\n * @internal\n */\nexport class Attributor implements IAttributor {\n\tprotected readonly keyToInfo: Map<number, AttributionInfo>;\n\n\t/**\n\t * @param initialEntries - Any entries which should be populated on instantiation.\n\t */\n\tconstructor(initialEntries?: Iterable<[number, AttributionInfo]>) {\n\t\tthis.keyToInfo = new Map(initialEntries ?? []);\n\t}\n\n\t/**\n\t * {@inheritdoc IAttributor.getAttributionInfo}\n\t */\n\tpublic getAttributionInfo(key: number): AttributionInfo {\n\t\tconst result = this.tryGetAttributionInfo(key);\n\t\tif (!result) {\n\t\t\tthrow new UsageError(`Requested attribution information for unstored key: ${key}.`);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritdoc IAttributor.tryGetAttributionInfo}\n\t */\n\tpublic tryGetAttributionInfo(key: number): AttributionInfo | undefined {\n\t\treturn this.keyToInfo.get(key);\n\t}\n\n\t/**\n\t * {@inheritdoc IAttributor.entries}\n\t */\n\tpublic entries(): IterableIterator<[number, AttributionInfo]> {\n\t\treturn this.keyToInfo.entries();\n\t}\n}\n\n/**\n * Attributor which listens to an op stream and records entries for each op.\n * Sequence numbers are used as attribution keys.\n * @internal\n */\nexport class OpStreamAttributor extends Attributor implements IAttributor {\n\tconstructor(\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\taudience: IAudience,\n\t\tinitialEntries?: Iterable<[number, AttributionInfo]>,\n\t) {\n\t\tsuper(initialEntries);\n\t\tdeltaManager.on(\"op\", (message: ISequencedDocumentMessage) => {\n\t\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\tconst client = audience.getMember(message.clientId as string);\n\t\t\tif (message.type === \"op\") {\n\t\t\t\t// TODO: This case may be legitimate, and if so we need to figure out how to handle it.\n\t\t\t\tassert(\n\t\t\t\t\tclient !== undefined,\n\t\t\t\t\t0x4af /* Received message from user not in the audience */,\n\t\t\t\t);\n\t\t\t\tthis.keyToInfo.set(message.sequenceNumber, {\n\t\t\t\t\tuser: client.user,\n\t\t\t\t\ttimestamp: message.timestamp,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
package/lib/encoders.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AttributionInfo } from "@fluidframework/runtime-definitions";
2
- import { IAttributor } from "./attributor";
3
- import { InternedStringId } from "./stringInterner";
2
+ import { IAttributor } from "./attributor.mjs";
3
+ import { InternedStringId } from "./stringInterner.mjs";
4
4
  export interface Encoder<TDecoded, TEncoded> {
5
5
  encode(decoded: TDecoded): TEncoded;
6
6
  decode(encoded: TEncoded): TDecoded;
@@ -1 +1 @@
1
- {"version":3,"file":"encoders.d.ts","sourceRoot":"","sources":["../src/encoders.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAyB,MAAM,kBAAkB,CAAC;AAE3E,MAAM,WAAW,OAAO,CAAC,QAAQ,EAAE,QAAQ;IAC1C,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAEpC,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACpC;AAID,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAE3D,eAAO,MAAM,YAAY,EAAE,gBAuB1B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;AAE/E,MAAM,WAAW,oBAAoB;IACpC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAA+D;IAC1F,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;I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C,QAAQ,CAAC,cAAc;IAG/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAHhB,cAAc,EAAE,CAChC,OAAO,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,KACxC,WAAW,EACC,gBAAgB,EAAE,gBAAgB;IAG7C,MAAM,CAAC,UAAU,EAAE,WAAW,GAAG,oBAAoB;IAsBrD,MAAM,CAAC,OAAO,EAAE,oBAAoB,GAAG,WAAW;CAkBzD;AAED;;GAEG;AACH,eAAO,MAAM,KAAK,yEAGhB,CAAC"}
@@ -1,9 +1,5 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
1
  import { assert } from "@fluidframework/core-utils";
6
- import { MutableStringInterner } from "./stringInterner";
2
+ import { MutableStringInterner } from "./stringInterner.mjs";
7
3
  export const deltaEncoder = {
8
4
  encode: (timestamps) => {
9
5
  const deltaTimestamps = new Array(timestamps.length);
@@ -72,4 +68,4 @@ export const chain = (a, b) => ({
72
68
  encode: (content) => b.encode(a.encode(content)),
73
69
  decode: (content) => a.decode(b.decode(content)),
74
70
  });
75
- //# sourceMappingURL=encoders.js.map
71
+ //# sourceMappingURL=encoders.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoders.mjs","sourceRoot":"","sources":["../src/encoders.ts"],"names":[],"mappings":"OAIO,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAK5C,EAAoB,qBAAqB,EAAE;AAYlD,MAAM,CAAC,MAAM,YAAY,GAAqB;IAC7C,MAAM,EAAE,CAAC,UAAoB,EAAE,EAAE;QAChC,MAAM,eAAe,GAAa,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC3C,eAAe,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AAS,EAAE,CAAC,CAAC;SACxC;QACD,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACD;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAa,CAAkB,EAAE,CAAkB,EAAmB,EAAE,CAAC,CAAC;IAC9F,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CAChD,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/core-utils\";\nimport { Jsonable } from \"@fluidframework/datastore-definitions\";\nimport { IUser } from \"@fluidframework/protocol-definitions\";\nimport { AttributionInfo } from \"@fluidframework/runtime-definitions\";\nimport { IAttributor } from \"./attributor\";\nimport { InternedStringId, MutableStringInterner } from \"./stringInterner\";\n\nexport interface Encoder<TDecoded, TEncoded> {\n\tencode(decoded: TDecoded): TEncoded;\n\n\tdecode(encoded: TEncoded): TDecoded;\n}\n\n// Note: the encoded format doesn't matter as long as it's serializable;\n// these types could be weakened.\nexport type TimestampEncoder = Encoder<number[], number[]>;\n\nexport const deltaEncoder: TimestampEncoder = {\n\tencode: (timestamps: number[]) => {\n\t\tconst deltaTimestamps: number[] = new Array(timestamps.length);\n\t\tlet prev = 0;\n\t\tfor (let i = 0; i < timestamps.length; i++) {\n\t\t\tdeltaTimestamps[i] = timestamps[i] - prev;\n\t\t\tprev = timestamps[i];\n\t\t}\n\t\treturn deltaTimestamps;\n\t},\n\tdecode: (encoded: Jsonable) => {\n\t\tassert(\n\t\t\tArray.isArray(encoded),\n\t\t\t0x4b0 /* Encoded timestamps should be an array of nummbers */,\n\t\t);\n\t\tconst timestamps: number[] = new Array(encoded.length);\n\t\tlet cumulativeSum = 0;\n\t\tfor (let i = 0; i < encoded.length; i++) {\n\t\t\tcumulativeSum += encoded[i];\n\t\t\ttimestamps[i] = cumulativeSum;\n\t\t}\n\t\treturn timestamps;\n\t},\n};\n\nexport type IAttributorSerializer = Encoder<IAttributor, SerializedAttributor>;\n\nexport interface SerializedAttributor {\n\tinterner: readonly string[] /* result of calling getSerializable() on a StringInterner */;\n\tseqs: number[];\n\ttimestamps: number[];\n\tattributionRefs: InternedStringId[];\n}\n\nexport class AttributorSerializer implements IAttributorSerializer {\n\tconstructor(\n\t\tprivate readonly makeAttributor: (\n\t\t\tentries: Iterable<[number, AttributionInfo]>,\n\t\t) => IAttributor,\n\t\tprivate readonly timestampEncoder: TimestampEncoder,\n\t) {}\n\n\tpublic encode(attributor: IAttributor): SerializedAttributor {\n\t\tconst interner = new MutableStringInterner();\n\t\tconst seqs: number[] = [];\n\t\tconst timestamps: number[] = [];\n\t\tconst attributionRefs: InternedStringId[] = [];\n\t\tfor (const [seq, { user, timestamp }] of attributor.entries()) {\n\t\t\tseqs.push(seq);\n\t\t\ttimestamps.push(timestamp);\n\t\t\tconst ref = interner.getOrCreateInternedId(JSON.stringify(user));\n\t\t\tattributionRefs.push(ref);\n\t\t}\n\n\t\tconst serialized: SerializedAttributor = {\n\t\t\tinterner: interner.getSerializable(),\n\t\t\tseqs,\n\t\t\ttimestamps: this.timestampEncoder.encode(timestamps),\n\t\t\tattributionRefs,\n\t\t};\n\n\t\treturn serialized;\n\t}\n\n\tpublic decode(encoded: SerializedAttributor): IAttributor {\n\t\tconst interner = new MutableStringInterner(encoded.interner);\n\t\tconst { seqs, timestamps: encodedTimestamps, attributionRefs } = encoded;\n\t\tconst timestamps = this.timestampEncoder.decode(encodedTimestamps);\n\t\tassert(\n\t\t\tseqs.length === timestamps.length && timestamps.length === attributionRefs.length,\n\t\t\t0x4b1 /* serialized attribution columns should have the same length */,\n\t\t);\n\t\tconst entries = new Array(seqs.length);\n\t\tfor (let i = 0; i < seqs.length; i++) {\n\t\t\tconst key = seqs[i];\n\t\t\tconst timestamp = timestamps[i];\n\t\t\tconst ref = attributionRefs[i];\n\t\t\tconst user: IUser = JSON.parse(interner.getString(ref));\n\t\t\tentries[i] = [key, { user, timestamp }];\n\t\t}\n\t\treturn this.makeAttributor(entries);\n\t}\n}\n\n/**\n * @returns an encoder which composes `a` and `b`.\n */\nexport const chain = <T1, T2, T3>(a: Encoder<T1, T2>, b: Encoder<T2, T3>): Encoder<T1, T3> => ({\n\tencode: (content) => b.encode(a.encode(content)),\n\tdecode: (content) => a.decode(b.decode(content)),\n});\n"]}
package/lib/index.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- export { Attributor, OpStreamAttributor, IAttributor } from "./attributor";
6
- export { createRuntimeAttributor, enableOnNewFileKey, IProvideRuntimeAttributor, IRuntimeAttributor, mixinAttributor, } from "./mixinAttributor";
1
+ export { Attributor, OpStreamAttributor, IAttributor } from "./attributor.mjs";
2
+ export { createRuntimeAttributor, enableOnNewFileKey, IProvideRuntimeAttributor, IRuntimeAttributor, mixinAttributor, } from "./mixinAttributor.mjs";
7
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EACN,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,GACf,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"OAIO,EAAE,UAAU,EAAE,kBAAkB,EAAE,WAAW,EAAE;OAC/C,EACN,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,GACf"}
package/lib/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ export { Attributor, OpStreamAttributor } from "./attributor.mjs";
2
+ export { createRuntimeAttributor, enableOnNewFileKey, IRuntimeAttributor, mixinAttributor, } from "./mixinAttributor.mjs";
3
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"OAIO,EAAE,UAAU,EAAE,kBAAkB,EAAe;OAC/C,EACN,uBAAuB,EACvB,kBAAkB,EAElB,kBAAkB,EAClB,eAAe,GACf","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nexport { Attributor, OpStreamAttributor, IAttributor } from \"./attributor\";\nexport {\n\tcreateRuntimeAttributor,\n\tenableOnNewFileKey,\n\tIProvideRuntimeAttributor,\n\tIRuntimeAttributor,\n\tmixinAttributor,\n} from \"./mixinAttributor\";\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Jsonable } from "@fluidframework/datastore-definitions";
2
- import { Encoder } from "./encoders";
2
+ import { Encoder } from "./encoders.mjs";
3
3
  /**
4
4
  * @alpha
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"lz4Encoder.d.ts","sourceRoot":"","sources":["../src/lz4Encoder.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAchE"}
1
+ {"version":3,"file":"lz4Encoder.d.ts","sourceRoot":"","sources":["../src/lz4Encoder.ts"],"names":[],"mappings":"OAMO,EAAE,QAAQ,EAAE,MAAM,uCAAuC;OACzD,EAAE,OAAO,EAAE;AAElB;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAchE"}
@@ -1,7 +1,3 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
1
  import { compress, decompress } from "lz4js";
6
2
  import { bufferToString, stringToBuffer } from "@fluid-internal/client-utils";
7
3
  /**
@@ -22,4 +18,4 @@ export function makeLZ4Encoder() {
22
18
  },
23
19
  };
24
20
  }
25
- //# sourceMappingURL=lz4Encoder.js.map
21
+ //# sourceMappingURL=lz4Encoder.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lz4Encoder.mjs","sourceRoot":"","sources":["../src/lz4Encoder.ts"],"names":[],"mappings":"OAIO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO;OACrC,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B;AAI7E;;GAEG;AACH,MAAM,UAAU,cAAc;IAC7B,OAAO;QACN,MAAM,EAAE,CAAC,OAAoB,EAAE,EAAE;YAChC,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;YACvE,MAAM,UAAU,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;YAC1C,OAAO,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,EAAE,CAAC,iBAAyB,EAAe,EAAE;YAClD,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,cAAc,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC/E,MAAM,YAAY,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;YAC5C,MAAM,OAAO,GAAgB,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;YAChF,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { compress, decompress } from \"lz4js\";\nimport { bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { Jsonable } from \"@fluidframework/datastore-definitions\";\nimport { Encoder } from \"./encoders\";\n\n/**\n * @alpha\n */\nexport function makeLZ4Encoder<T>(): Encoder<Jsonable<T>, string> {\n\treturn {\n\t\tencode: (decoded: Jsonable<T>) => {\n\t\t\tconst uncompressed = new TextEncoder().encode(JSON.stringify(decoded));\n\t\t\tconst compressed = compress(uncompressed);\n\t\t\treturn bufferToString(compressed, \"base64\");\n\t\t},\n\t\tdecode: (serializedSummary: string): Jsonable<T> => {\n\t\t\tconst compressed = new Uint8Array(stringToBuffer(serializedSummary, \"base64\"));\n\t\t\tconst uncompressed = decompress(compressed);\n\t\t\tconst decoded: Jsonable<T> = JSON.parse(new TextDecoder().decode(uncompressed));\n\t\t\treturn decoded;\n\t\t},\n\t};\n}\n"]}
@@ -1,18 +1,15 @@
1
1
  import { ContainerRuntime } from "@fluidframework/container-runtime";
2
2
  import { AttributionInfo, AttributionKey } from "@fluidframework/runtime-definitions";
3
3
  /**
4
- * @alpha
5
- * Feature Gate Key -
6
- * Whether or not a container runtime instantiated using `mixinAttributor`'s load should generate an attributor on
7
- * new files. See package README for more notes on integration.
4
+ * @internal
8
5
  */
9
6
  export declare const enableOnNewFileKey = "Fluid.Attribution.EnableOnNewFile";
10
7
  /**
11
- * @alpha
8
+ * @internal
12
9
  */
13
10
  export declare const IRuntimeAttributor: keyof IProvideRuntimeAttributor;
14
11
  /**
15
- * @alpha
12
+ * @internal
16
13
  */
17
14
  export interface IProvideRuntimeAttributor {
18
15
  readonly IRuntimeAttributor: IRuntimeAttributor;
@@ -22,7 +19,7 @@ export interface IProvideRuntimeAttributor {
22
19
  *
23
20
  * Attributors are only populated after the container runtime they are injected into has initialized.
24
21
  * @sealed
25
- * @alpha
22
+ * @internal
26
23
  */
27
24
  export interface IRuntimeAttributor extends IProvideRuntimeAttributor {
28
25
  /**
@@ -42,7 +39,7 @@ export interface IRuntimeAttributor extends IProvideRuntimeAttributor {
42
39
  /**
43
40
  * @returns an IRuntimeAttributor for usage with `mixinAttributor`. The attributor will only be populated with data
44
41
  * once it's passed via scope to a container runtime load flow. See {@link mixinAttributor}.
45
- * @alpha
42
+ * @internal
46
43
  */
47
44
  export declare function createRuntimeAttributor(): IRuntimeAttributor;
48
45
  /**
@@ -54,7 +51,7 @@ export declare function createRuntimeAttributor(): IRuntimeAttributor;
54
51
  * IRuntimeAttributor is passed via scope to load a document that never previously had attribution information,
55
52
  * that attributor's `has` method will always return `false`.
56
53
  * @param Base - base class, inherits from FluidAttributorRuntime
57
- * @alpha
54
+ * @internal
58
55
  */
59
56
  export declare const mixinAttributor: (Base?: typeof ContainerRuntime) => typeof ContainerRuntime;
60
57
  //# sourceMappingURL=mixinAttributor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EACN,eAAe,EACf,cAAc,EAId,MAAM,qCAAqC,CAAC;AAoB7C;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,sCAAsC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,yBAAgD,CAAC;AAExF;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;CAChD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,yBAAyB;IACpE;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,eAAe,CAAC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