@fluid-experimental/attributor 2.51.0-347100 → 2.52.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 (60) hide show
  1. package/.eslintrc.cjs +13 -0
  2. package/CHANGELOG.md +8 -0
  3. package/dist/attributor.d.ts +3 -3
  4. package/dist/attributor.d.ts.map +1 -1
  5. package/dist/attributor.js.map +1 -1
  6. package/dist/attributorContracts.d.ts +1 -1
  7. package/dist/attributorContracts.d.ts.map +1 -1
  8. package/dist/attributorContracts.js.map +1 -1
  9. package/dist/encoders.d.ts +2 -2
  10. package/dist/encoders.d.ts.map +1 -1
  11. package/dist/encoders.js.map +1 -1
  12. package/dist/lz4Encoder.d.ts +2 -2
  13. package/dist/lz4Encoder.d.ts.map +1 -1
  14. package/dist/lz4Encoder.js.map +1 -1
  15. package/dist/mixinAttributor.d.ts +1 -1
  16. package/dist/mixinAttributor.d.ts.map +1 -1
  17. package/dist/mixinAttributor.js.map +1 -1
  18. package/dist/runtimeAttributor.d.ts +3 -3
  19. package/dist/runtimeAttributor.d.ts.map +1 -1
  20. package/dist/runtimeAttributor.js.map +1 -1
  21. package/dist/runtimeAttributorDataStoreChannel.d.ts +6 -6
  22. package/dist/runtimeAttributorDataStoreChannel.d.ts.map +1 -1
  23. package/dist/runtimeAttributorDataStoreChannel.js.map +1 -1
  24. package/dist/runtimeAttributorDataStoreFactory.d.ts +1 -1
  25. package/dist/runtimeAttributorDataStoreFactory.d.ts.map +1 -1
  26. package/dist/runtimeAttributorDataStoreFactory.js.map +1 -1
  27. package/lib/attributor.d.ts +3 -3
  28. package/lib/attributor.d.ts.map +1 -1
  29. package/lib/attributor.js.map +1 -1
  30. package/lib/attributorContracts.d.ts +1 -1
  31. package/lib/attributorContracts.d.ts.map +1 -1
  32. package/lib/attributorContracts.js.map +1 -1
  33. package/lib/encoders.d.ts +2 -2
  34. package/lib/encoders.d.ts.map +1 -1
  35. package/lib/encoders.js.map +1 -1
  36. package/lib/lz4Encoder.d.ts +2 -2
  37. package/lib/lz4Encoder.d.ts.map +1 -1
  38. package/lib/lz4Encoder.js.map +1 -1
  39. package/lib/mixinAttributor.d.ts +1 -1
  40. package/lib/mixinAttributor.d.ts.map +1 -1
  41. package/lib/mixinAttributor.js.map +1 -1
  42. package/lib/runtimeAttributor.d.ts +3 -3
  43. package/lib/runtimeAttributor.d.ts.map +1 -1
  44. package/lib/runtimeAttributor.js.map +1 -1
  45. package/lib/runtimeAttributorDataStoreChannel.d.ts +6 -6
  46. package/lib/runtimeAttributorDataStoreChannel.d.ts.map +1 -1
  47. package/lib/runtimeAttributorDataStoreChannel.js +1 -1
  48. package/lib/runtimeAttributorDataStoreChannel.js.map +1 -1
  49. package/lib/runtimeAttributorDataStoreFactory.d.ts +1 -1
  50. package/lib/runtimeAttributorDataStoreFactory.d.ts.map +1 -1
  51. package/lib/runtimeAttributorDataStoreFactory.js.map +1 -1
  52. package/package.json +20 -20
  53. package/src/attributor.ts +3 -3
  54. package/src/attributorContracts.ts +3 -3
  55. package/src/encoders.ts +3 -3
  56. package/src/lz4Encoder.ts +2 -2
  57. package/src/mixinAttributor.ts +6 -6
  58. package/src/runtimeAttributor.ts +7 -7
  59. package/src/runtimeAttributorDataStoreChannel.ts +14 -11
  60. package/src/runtimeAttributorDataStoreFactory.ts +1 -1
package/.eslintrc.cjs CHANGED
@@ -8,6 +8,19 @@ module.exports = {
8
8
  parserOptions: {
9
9
  project: ["./tsconfig.json", "./src/test/tsconfig.json"],
10
10
  },
11
+ rules: {
12
+ // #region TODO: remove these once eslint-config-fluid has been updated to 5.8.0
13
+ "@typescript-eslint/consistent-type-exports": [
14
+ "error",
15
+ { fixMixedExportsWithInlineTypeSpecifier: true },
16
+ ],
17
+ "@typescript-eslint/consistent-type-imports": [
18
+ "error",
19
+ { fixStyle: "inline-type-imports" },
20
+ ],
21
+ "@typescript-eslint/no-import-type-side-effects": "error",
22
+ // #endregion
23
+ },
11
24
  overrides: [
12
25
  {
13
26
  // Rules only for test files
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @fluid-experimental/attributor
2
2
 
3
+ ## 2.52.0
4
+
5
+ Dependency updates only.
6
+
7
+ ## 2.51.0
8
+
9
+ Dependency updates only.
10
+
3
11
  ## 2.50.0
4
12
 
5
13
  Dependency updates only.
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type IDeltaManager } from "@fluidframework/container-definitions/internal";
6
- import { type IQuorumClients } from "@fluidframework/driver-definitions";
5
+ import type { IDeltaManager } from "@fluidframework/container-definitions/internal";
6
+ import type { IQuorumClients } from "@fluidframework/driver-definitions";
7
7
  import { type IDocumentMessage, type ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
8
- import { type AttributionInfo } from "@fluidframework/runtime-definitions/internal";
8
+ import type { AttributionInfo } from "@fluidframework/runtime-definitions/internal";
9
9
  /**
10
10
  * Provides lookup between attribution keys and their associated attribution information.
11
11
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"attributor.d.ts","sourceRoot":"","sources":["../src/attributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAEpF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAEN,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAGpF;;;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,IA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MAAM,EAAE,CAAC;YACb,MAAM,IAAI,qBAAU,CAAC,uDAAuD,GAAG,GAAG,CAAC,CAAC;QACrF,CAAC;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;AAlCD,gCAkCC;AAED;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,UAAU;IACjD,YACC,YAAwE,EACxE,aAA6B,EAC7B,cAAoD;QAEpD,KAAK,CAAC,cAAc,CAAC,CAAC;QACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,EAAE;YAC5D,IAAI,OAAO,CAAC,IAAI,KAAK,sBAAW,CAAC,SAAS,EAAE,CAAC;gBAC5C,IAAA,iBAAM,EACL,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EACpC,KAAK,CAAC,8DAA8D,CACpE,CAAC;gBACF,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACzD,IAAA,iBAAM,EACL,MAAM,KAAK,SAAS,EACpB,KAAK,CAAC,yDAAyD,CAC/D,CAAC;gBACF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE;oBAC1C,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;oBACxB,SAAS,EAAE,OAAO,CAAC,SAAS;iBAC5B,CAAC,CAAC;YACJ,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAzBD,gDAyBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { type IQuorumClients } from \"@fluidframework/driver-definitions\";\nimport {\n\tMessageType,\n\ttype IDocumentMessage,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { type AttributionInfo } from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\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 */\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\tpublic constructor(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 */\nexport class OpStreamAttributor extends Attributor implements IAttributor {\n\tpublic constructor(\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorumClients: IQuorumClients,\n\t\tinitialEntries?: Iterable<[number, AttributionInfo]>,\n\t) {\n\t\tsuper(initialEntries);\n\t\tdeltaManager.on(\"op\", (message: ISequencedDocumentMessage) => {\n\t\t\tif (message.type === MessageType.Operation) {\n\t\t\t\tassert(\n\t\t\t\t\ttypeof message.clientId === \"string\",\n\t\t\t\t\t0x966 /* Client id should be present and should be of type string */,\n\t\t\t\t);\n\t\t\t\tconst client = quorumClients.getMember(message.clientId);\n\t\t\t\tassert(\n\t\t\t\t\tclient !== undefined,\n\t\t\t\t\t0x967 /* Received message from user not in the quorumClients */,\n\t\t\t\t);\n\t\t\t\tthis.keyToInfo.set(message.sequenceNumber, {\n\t\t\t\t\tuser: client.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"]}
1
+ {"version":3,"file":"attributor.js","sourceRoot":"","sources":["../src/attributor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAE7D,0EAIqD;AAErD,uEAAsE;AA6BtE;;GAEG;AACH,MAAa,UAAU;IAGtB;;OAEG;IACH,YAAmB,cAAoD;QACtE,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,CAAC;YACb,MAAM,IAAI,qBAAU,CAAC,uDAAuD,GAAG,GAAG,CAAC,CAAC;QACrF,CAAC;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;AAlCD,gCAkCC;AAED;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,UAAU;IACjD,YACC,YAAwE,EACxE,aAA6B,EAC7B,cAAoD;QAEpD,KAAK,CAAC,cAAc,CAAC,CAAC;QACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,EAAE;YAC5D,IAAI,OAAO,CAAC,IAAI,KAAK,sBAAW,CAAC,SAAS,EAAE,CAAC;gBAC5C,IAAA,iBAAM,EACL,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EACpC,KAAK,CAAC,8DAA8D,CACpE,CAAC;gBACF,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACzD,IAAA,iBAAM,EACL,MAAM,KAAK,SAAS,EACpB,KAAK,CAAC,yDAAyD,CAC/D,CAAC;gBACF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE;oBAC1C,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;oBACxB,SAAS,EAAE,OAAO,CAAC,SAAS;iBAC5B,CAAC,CAAC;YACJ,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAzBD,gDAyBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IQuorumClients } from \"@fluidframework/driver-definitions\";\nimport {\n\tMessageType,\n\ttype IDocumentMessage,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type { AttributionInfo } from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\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 */\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\tpublic constructor(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 */\nexport class OpStreamAttributor extends Attributor implements IAttributor {\n\tpublic constructor(\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorumClients: IQuorumClients,\n\t\tinitialEntries?: Iterable<[number, AttributionInfo]>,\n\t) {\n\t\tsuper(initialEntries);\n\t\tdeltaManager.on(\"op\", (message: ISequencedDocumentMessage) => {\n\t\t\tif (message.type === MessageType.Operation) {\n\t\t\t\tassert(\n\t\t\t\t\ttypeof message.clientId === \"string\",\n\t\t\t\t\t0x966 /* Client id should be present and should be of type string */,\n\t\t\t\t);\n\t\t\t\tconst client = quorumClients.getMember(message.clientId);\n\t\t\t\tassert(\n\t\t\t\t\tclient !== undefined,\n\t\t\t\t\t0x967 /* Received message from user not in the quorumClients */,\n\t\t\t\t);\n\t\t\t\tthis.keyToInfo.set(message.sequenceNumber, {\n\t\t\t\t\tuser: client.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"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type AttributionInfo, type AttributionKey } from "@fluidframework/runtime-definitions/internal";
5
+ import type { AttributionInfo, AttributionKey } from "@fluidframework/runtime-definitions/internal";
6
6
  export declare const opBlobName = "opAttributor";
7
7
  /**
8
8
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"attributorContracts.d.ts","sourceRoot":"","sources":["../src/attributorContracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,MAAM,8CAA8C,CAAC;AAGtD,eAAO,MAAM,UAAU,iBAAiB,CAAC;AAEzC;;GAEG;AACH,eAAO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 +1 @@
1
- {"version":3,"file":"attributorContracts.js","sourceRoot":"","sources":["../src/attributorContracts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,oBAAoB;AACP,QAAA,UAAU,GAAG,cAAc,CAAC;AAEzC;;GAEG;AACU,QAAA,kBAAkB,GAAG,mCAAmC,CAAC;AAEtE;;GAEG;AACU,QAAA,kBAAkB,GAAoC,oBAAoB,CAAC;AASxF;;GAEG;AACU,QAAA,wBAAwB,GAAG,iDAAiD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype AttributionInfo,\n\ttype AttributionKey,\n} from \"@fluidframework/runtime-definitions/internal\";\n\n// Summary tree keys\nexport const opBlobName = \"opAttributor\";\n\n/**\n * @internal\n */\nexport const enableOnNewFileKey = \"Fluid.Attribution.EnableOnNewFile\";\n\n/**\n * @internal\n */\nexport const IRuntimeAttributor: keyof IProvideRuntimeAttributor = \"IRuntimeAttributor\";\n\n/**\n * @internal\n */\nexport interface IProvideRuntimeAttributor {\n\treadonly IRuntimeAttributor: IRuntimeAttributor;\n}\n\n/**\n * @internal\n */\nexport const attributorDataStoreAlias = \"attributor-cf9b6fe4-4c50-4a5d-9045-eb73b886f740\";\n\n/**\n * Provides access to attribution information stored on the container runtime.\n *\n * @remarks Attributors are only populated after the container runtime into which they are being injected has initialized.\n *\n * @sealed\n * @internal\n */\nexport interface IRuntimeAttributor extends IProvideRuntimeAttributor {\n\t/**\n\t * @throws - If no AttributionInfo exists for this key.\n\t */\n\tget(key: AttributionKey): AttributionInfo;\n\n\t/**\n\t * @returns Whether any AttributionInfo exists for the provided key.\n\t */\n\thas(key: AttributionKey): boolean;\n\n\t/**\n\t * @returns Whether the runtime is currently tracking attribution information for the loaded container.\n\t * If enabled, the runtime attributor can be asked for the attribution info for different keys.\n\t * See {@link mixinAttributor} for more details on when this happens.\n\t */\n\treadonly isEnabled: boolean;\n}\n"]}
1
+ {"version":3,"file":"attributorContracts.js","sourceRoot":"","sources":["../src/attributorContracts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,oBAAoB;AACP,QAAA,UAAU,GAAG,cAAc,CAAC;AAEzC;;GAEG;AACU,QAAA,kBAAkB,GAAG,mCAAmC,CAAC;AAEtE;;GAEG;AACU,QAAA,kBAAkB,GAAoC,oBAAoB,CAAC;AASxF;;GAEG;AACU,QAAA,wBAAwB,GAAG,iDAAiD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tAttributionInfo,\n\tAttributionKey,\n} from \"@fluidframework/runtime-definitions/internal\";\n\n// Summary tree keys\nexport const opBlobName = \"opAttributor\";\n\n/**\n * @internal\n */\nexport const enableOnNewFileKey = \"Fluid.Attribution.EnableOnNewFile\";\n\n/**\n * @internal\n */\nexport const IRuntimeAttributor: keyof IProvideRuntimeAttributor = \"IRuntimeAttributor\";\n\n/**\n * @internal\n */\nexport interface IProvideRuntimeAttributor {\n\treadonly IRuntimeAttributor: IRuntimeAttributor;\n}\n\n/**\n * @internal\n */\nexport const attributorDataStoreAlias = \"attributor-cf9b6fe4-4c50-4a5d-9045-eb73b886f740\";\n\n/**\n * Provides access to attribution information stored on the container runtime.\n *\n * @remarks Attributors are only populated after the container runtime into which they are being injected has initialized.\n *\n * @sealed\n * @internal\n */\nexport interface IRuntimeAttributor extends IProvideRuntimeAttributor {\n\t/**\n\t * @throws - If no AttributionInfo exists for this key.\n\t */\n\tget(key: AttributionKey): AttributionInfo;\n\n\t/**\n\t * @returns Whether any AttributionInfo exists for the provided key.\n\t */\n\thas(key: AttributionKey): boolean;\n\n\t/**\n\t * @returns Whether the runtime is currently tracking attribution information for the loaded container.\n\t * If enabled, the runtime attributor can be asked for the attribution info for different keys.\n\t * See {@link mixinAttributor} for more details on when this happens.\n\t */\n\treadonly isEnabled: boolean;\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type AttributionInfo } from "@fluidframework/runtime-definitions/internal";
6
- import { type IAttributor } from "./attributor.js";
5
+ import type { AttributionInfo } from "@fluidframework/runtime-definitions/internal";
6
+ import type { IAttributor } from "./attributor.js";
7
7
  import { type InternedStringId } from "./stringInterner.js";
8
8
  export interface Encoder<TDecoded, TEncoded> {
9
9
  encode(decoded: TDecoded): TEncoded;
@@ -1 +1 @@
1
- {"version":3,"file":"encoders.d.ts","sourceRoot":"","sources":["../src/encoders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAEpF,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,KAAK,gBAAgB,EAAyB,MAAM,qBAAqB,CAAC;AAEnF,MAAM,WAAW,OAAO,CAAC,QAAQ,EAAE,QAAQ;IAC1C,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACpC,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,gBAwB1B,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;IACrB,eAAe,EAAE,gBAAgB,EAAE,CAAC;CACpC;AAED,qBAAa,oBAAqB,YAAW,qBAAqB;IAEhE,OAAO,CAAC,QAAQ,CAAC,cAAc;IAG/B,OAAO,CA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AAC,CAAC;IACtB,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;AANU,QAAA,KAAK,SAMf","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { type IUser } from \"@fluidframework/driver-definitions\";\nimport { type AttributionInfo } from \"@fluidframework/runtime-definitions/internal\";\n\nimport { type IAttributor } from \"./attributor.js\";\nimport { type InternedStringId, MutableStringInterner } from \"./stringInterner.js\";\n\nexport interface Encoder<TDecoded, TEncoded> {\n\tencode(decoded: TDecoded): TEncoded;\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[] = Array.from({ length: timestamps.length });\n\t\tlet prev = 0;\n\t\tfor (const [i, timestamp] of timestamps.entries()) {\n\t\t\tdeltaTimestamps[i] = timestamp - prev;\n\t\t\tprev = timestamp;\n\t\t}\n\n\t\treturn deltaTimestamps;\n\t},\n\tdecode: (encoded: unknown) => {\n\t\tassert(\n\t\t\tArray.isArray(encoded),\n\t\t\t0x4b0 /* Encoded timestamps should be an array of numbers */,\n\t\t);\n\t\tconst timestamps: number[] = Array.from({ length: 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\tpublic constructor(\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\t/**\n\t * {@inheritDoc Encoder.encode}\n\t */\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\t/**\n\t * {@inheritDoc Encoder.decode}\n\t */\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: [number, AttributionInfo][] = Array.from({ length: seqs.length });\n\t\tfor (const [i, key] of seqs.entries()) {\n\t\t\tconst timestamp = timestamps[i];\n\t\t\tconst ref = attributionRefs[i];\n\t\t\tconst user = JSON.parse(interner.getString(ref)) as IUser;\n\t\t\tentries[i] = [key, { user, timestamp }];\n\t\t}\n\t\treturn this.makeAttributor(entries);\n\t}\n}\n\n/**\n * Creates an encoder which composes `a` and `b`.\n */\nexport const chain = <T1, T2, T3>(\n\ta: Encoder<T1, T2>,\n\tb: Encoder<T2, T3>,\n): Encoder<T1, T3> => ({\n\tencode: (content) => b.encode(a.encode(content)),\n\tdecode: (content) => a.decode(b.decode(content)),\n});\n"]}
1
+ {"version":3,"file":"encoders.js","sourceRoot":"","sources":["../src/encoders.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAK7D,2DAAmF;AAWtE,QAAA,YAAY,GAAqB;IAC7C,MAAM,EAAE,CAAC,UAAoB,EAAE,EAAE;QAChC,MAAM,eAAe,GAAa,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QAC5E,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,KAAK,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;YACnD,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;YACtC,IAAI,GAAG,SAAS,CAAC;QAClB,CAAC;QAED,OAAO,eAAe,CAAC;IACxB,CAAC;IACD,MAAM,EAAE,CAAC,OAAgB,EAAE,EAAE;QAC5B,IAAA,iBAAM,EACL,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EACtB,KAAK,CAAC,sDAAsD,CAC5D,CAAC;QACF,MAAM,UAAU,GAAa,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACpE,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM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;AANU,QAAA,KAAK,SAMf","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IUser } from \"@fluidframework/driver-definitions\";\nimport type { AttributionInfo } from \"@fluidframework/runtime-definitions/internal\";\n\nimport type { IAttributor } from \"./attributor.js\";\nimport { type InternedStringId, MutableStringInterner } from \"./stringInterner.js\";\n\nexport interface Encoder<TDecoded, TEncoded> {\n\tencode(decoded: TDecoded): TEncoded;\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[] = Array.from({ length: timestamps.length });\n\t\tlet prev = 0;\n\t\tfor (const [i, timestamp] of timestamps.entries()) {\n\t\t\tdeltaTimestamps[i] = timestamp - prev;\n\t\t\tprev = timestamp;\n\t\t}\n\n\t\treturn deltaTimestamps;\n\t},\n\tdecode: (encoded: unknown) => {\n\t\tassert(\n\t\t\tArray.isArray(encoded),\n\t\t\t0x4b0 /* Encoded timestamps should be an array of numbers */,\n\t\t);\n\t\tconst timestamps: number[] = Array.from({ length: 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\tpublic constructor(\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\t/**\n\t * {@inheritDoc Encoder.encode}\n\t */\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\t/**\n\t * {@inheritDoc Encoder.decode}\n\t */\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: [number, AttributionInfo][] = Array.from({ length: seqs.length });\n\t\tfor (const [i, key] of seqs.entries()) {\n\t\t\tconst timestamp = timestamps[i];\n\t\t\tconst ref = attributionRefs[i];\n\t\t\tconst user = JSON.parse(interner.getString(ref)) as IUser;\n\t\t\tentries[i] = [key, { user, timestamp }];\n\t\t}\n\t\treturn this.makeAttributor(entries);\n\t}\n}\n\n/**\n * Creates an encoder which composes `a` and `b`.\n */\nexport const chain = <T1, T2, T3>(\n\ta: Encoder<T1, T2>,\n\tb: Encoder<T2, T3>,\n): Encoder<T1, T3> => ({\n\tencode: (content) => b.encode(a.encode(content)),\n\tdecode: (content) => a.decode(b.decode(content)),\n});\n"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type Jsonable } from "@fluidframework/datastore-definitions/internal";
6
- import { type Encoder } from "./encoders.js";
5
+ import type { Jsonable } from "@fluidframework/datastore-definitions/internal";
6
+ import type { Encoder } from "./encoders.js";
7
7
  /**
8
8
  * @legacy
9
9
  * @alpha
@@ -1 +1 @@
1
- {"version":3,"file":"lz4Encoder.d.ts","sourceRoot":"","sources":["../src/lz4Encoder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAG/E,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAgBhE"}
1
+ {"version":3,"file":"lz4Encoder.d.ts","sourceRoot":"","sources":["../src/lz4Encoder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAG/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAgBhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"lz4Encoder.js","sourceRoot":"","sources":["../src/lz4Encoder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8E;AAE9E,iCAA6C;AAI7C,sBAAsB;AACtB,qDAAqD;AACrD;;;GAGG;AACH,SAAgB,cAAc;IAC7B,OAAO;QACN,MAAM,EAAE,CAAC,OAAoB,EAAU,EAAE;YACxC,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;YACvE,6DAA6D;YAC7D,MAAM,UAAU,GAAG,IAAA,gBAAQ,EAAC,YAAY,CAAoB,CAAC;YAC7D,OAAO,IAAA,6BAAc,EAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,EAAE,CAAC,iBAAyB,EAAe,EAAE;YAClD,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,IAAA,6BAAc,EAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC/E,6DAA6D;YAC7D,MAAM,YAAY,GAAG,IAAA,kBAAU,EAAC,UAAU,CAAiB,CAAC;YAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAgB,CAAC;YAClF,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;AACH,CAAC;AAhBD,wCAgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { type Jsonable } from \"@fluidframework/datastore-definitions/internal\";\nimport { compress, decompress } from \"lz4js\";\n\nimport { type Encoder } from \"./encoders.js\";\n\n// TODO: document this\n// eslint-disable-next-line jsdoc/require-description\n/**\n * @legacy\n * @alpha\n */\nexport function makeLZ4Encoder<T>(): Encoder<Jsonable<T>, string> {\n\treturn {\n\t\tencode: (decoded: Jsonable<T>): string => {\n\t\t\tconst uncompressed = new TextEncoder().encode(JSON.stringify(decoded));\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-call\n\t\t\tconst compressed = compress(uncompressed) as ArrayBufferLike;\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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-call\n\t\t\tconst uncompressed = decompress(compressed) as BufferSource;\n\t\t\tconst decoded = JSON.parse(new TextDecoder().decode(uncompressed)) as Jsonable<T>;\n\t\t\treturn decoded;\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"lz4Encoder.js","sourceRoot":"","sources":["../src/lz4Encoder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8E;AAE9E,iCAA6C;AAI7C,sBAAsB;AACtB,qDAAqD;AACrD;;;GAGG;AACH,SAAgB,cAAc;IAC7B,OAAO;QACN,MAAM,EAAE,CAAC,OAAoB,EAAU,EAAE;YACxC,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;YACvE,6DAA6D;YAC7D,MAAM,UAAU,GAAG,IAAA,gBAAQ,EAAC,YAAY,CAAoB,CAAC;YAC7D,OAAO,IAAA,6BAAc,EAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,EAAE,CAAC,iBAAyB,EAAe,EAAE;YAClD,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,IAAA,6BAAc,EAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC/E,6DAA6D;YAC7D,MAAM,YAAY,GAAG,IAAA,kBAAU,EAAC,UAAU,CAAiB,CAAC;YAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAgB,CAAC;YAClF,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;AACH,CAAC;AAhBD,wCAgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport type { Jsonable } from \"@fluidframework/datastore-definitions/internal\";\nimport { compress, decompress } from \"lz4js\";\n\nimport type { Encoder } from \"./encoders.js\";\n\n// TODO: document this\n// eslint-disable-next-line jsdoc/require-description\n/**\n * @legacy\n * @alpha\n */\nexport function makeLZ4Encoder<T>(): Encoder<Jsonable<T>, string> {\n\treturn {\n\t\tencode: (decoded: Jsonable<T>): string => {\n\t\t\tconst uncompressed = new TextEncoder().encode(JSON.stringify(decoded));\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-call\n\t\t\tconst compressed = compress(uncompressed) as ArrayBufferLike;\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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-call\n\t\t\tconst uncompressed = decompress(compressed) as BufferSource;\n\t\t\tconst decoded = JSON.parse(new TextDecoder().decode(uncompressed)) as Jsonable<T>;\n\t\t\treturn decoded;\n\t\t},\n\t};\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ContainerRuntime } from "@fluidframework/container-runtime/internal";
6
- import { type IContainerRuntimeBase } from "@fluidframework/runtime-definitions/internal";
6
+ import type { IContainerRuntimeBase } from "@fluidframework/runtime-definitions/internal";
7
7
  import { type IRuntimeAttributor } from "./attributorContracts.js";
8
8
  /**
9
9
  * Utility function to get the runtime attributor from the container runtime.
@@ -1 +1 @@
1
- {"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAK9E,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,8CAA8C,CAAC;AAGtD,OAAO,EAIN,KAAK,kBAAkB,EACvB,MAAM,0BAA0B,CAAC;AAGlC;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,qBAAqB,GAC5B,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAMzC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,UACrB,uBAAuB,KAC3B,uBAgEqC,CAAC"}
1
+ {"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAK9E,OAAO,KAAK,EACX,qBAAqB,EAErB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,EAIN,KAAK,kBAAkB,EACvB,MAAM,0BAA0B,CAAC;AAGlC;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,qBAAqB,GAC5B,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAMzC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,UACrB,uBAAuB,KAC3B,uBAgEqC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mixinAttributor.js","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAA8E;AAI9E,kEAA6D;AAK7D,uEAAqF;AAErF,qEAKkC;AAClC,iGAAkF;AAElF;;;;;GAKG;AACI,KAAK,UAAU,oBAAoB,CACzC,OAA8B;IAE9B,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,6BAA6B,CAAC,iDAAwB,CAAC,CAAC;IACzF,MAAM,iBAAiB,GAAG,CAAC,MAAM,UAAU,EAAE,GAAG,EAAE,CAEtC,CAAC;IACb,OAAO,iBAAiB,EAAE,kBAAkB,CAAC;AAC9C,CAAC;AARD,oDAQC;AAED;;;;;;;GAOG;AACI,MAAM,eAAe,GAAG,CAC9B,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e,CAAC,+DAAwB,CAAC,IAAI,CAAC,CAAC;gBAC/E,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,iDAAwB,CAAC,CAAC;gBACrE,IAAA,iBAAM,EACL,MAAM,KAAK,SAAS,EACpB,KAAK,CAAC,mDAAmD,CACzD,CAAC;gBACF,iBAAiB,GAAG,CAAC,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,CAAuB,CAAC;gBAC7E,IAAA,iBAAM,EAAC,iBAAiB,KAAK,SAAS,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACnF,CAAC;QACF,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACqC,CAAC;AAlE5B,QAAA,eAAe,mBAkEa","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type IContainerContext } from \"@fluidframework/container-definitions/internal\";\nimport { ContainerRuntime } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntimeOptions } from \"@fluidframework/container-runtime/internal\";\nimport { type IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport { type FluidObject } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype IContainerRuntimeBase,\n\ttype NamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { loggerToMonitoringContext } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tattributorDataStoreAlias,\n\tenableOnNewFileKey,\n\ttype IProvideRuntimeAttributor,\n\ttype IRuntimeAttributor,\n} from \"./attributorContracts.js\";\nimport { RuntimeAttributorFactory } from \"./runtimeAttributorDataStoreFactory.js\";\n\n/**\n * Utility function to get the runtime attributor from the container runtime.\n * @param runtime - container runtime from which attributor is to be fetched.\n * @returns IRuntimeAttributor if it exists, otherwise undefined.\n * @internal\n */\nexport async function getRuntimeAttributor(\n\truntime: IContainerRuntimeBase,\n): Promise<IRuntimeAttributor | undefined> {\n\tconst entryPoint = await runtime.getAliasedDataStoreEntryPoint(attributorDataStoreAlias);\n\tconst runtimeAttributor = (await entryPoint?.get()) as\n\t\t| FluidObject<IProvideRuntimeAttributor>\n\t\t| undefined;\n\treturn runtimeAttributor?.IRuntimeAttributor;\n}\n\n/**\n * Mixes in logic to load and store runtime-based attribution functionality.\n *\n * Existing documents without stored attributor will not start storing attribution information. We only create the attributor\n * if its tracking is enabled and we are creating a new document.\n * @param Base - base class, inherits from FluidAttributorRuntime\n * @internal\n */\nexport const mixinAttributor = (\n\tBase: typeof ContainerRuntime = ContainerRuntime,\n): typeof ContainerRuntime =>\n\tclass ContainerRuntimeWithAttributor extends Base {\n\t\tpublic static async loadRuntime(params: {\n\t\t\tcontext: IContainerContext;\n\t\t\tregistryEntries: NamedFluidDataStoreRegistryEntries;\n\t\t\texisting: boolean;\n\t\t\truntimeOptions?: IContainerRuntimeOptions;\n\t\t\tcontainerScope?: FluidObject;\n\t\t\tcontainerRuntimeCtor?: typeof ContainerRuntime;\n\t\t\tprovideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>;\n\t\t}): Promise<ContainerRuntime> {\n\t\t\tconst {\n\t\t\t\tcontext,\n\t\t\t\tregistryEntries,\n\t\t\t\texisting,\n\t\t\t\tprovideEntryPoint,\n\t\t\t\truntimeOptions,\n\t\t\t\tcontainerScope,\n\t\t\t\tcontainerRuntimeCtor = ContainerRuntimeWithAttributor as unknown as typeof ContainerRuntime,\n\t\t\t} = params;\n\n\t\t\tconst mc = loggerToMonitoringContext(context.taggedLogger);\n\t\t\tconst factory = new RuntimeAttributorFactory();\n\t\t\tconst registryEntriesCopy: NamedFluidDataStoreRegistryEntries = [\n\t\t\t\t...registryEntries,\n\t\t\t\t[RuntimeAttributorFactory.type, Promise.resolve(factory)],\n\t\t\t];\n\t\t\tconst shouldTrackAttribution = mc.config.getBoolean(enableOnNewFileKey) ?? false;\n\t\t\tif (shouldTrackAttribution) {\n\t\t\t\tconst { options } = context;\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t(options.attribution ??= {}).track = true;\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\tconst runtime = (await Base.loadRuntime({\n\t\t\t\tcontext,\n\t\t\t\tregistryEntries: registryEntriesCopy,\n\t\t\t\tprovideEntryPoint,\n\t\t\t\truntimeOptions,\n\t\t\t\tcontainerScope,\n\t\t\t\texisting,\n\t\t\t\tcontainerRuntimeCtor,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t} as any)) as ContainerRuntimeWithAttributor;\n\n\t\t\tlet runtimeAttributor: IRuntimeAttributor | undefined;\n\t\t\tif (shouldTrackAttribution) {\n\t\t\t\tif (existing) {\n\t\t\t\t\truntimeAttributor = await getRuntimeAttributor(runtime);\n\t\t\t\t} else {\n\t\t\t\t\tconst datastore = await runtime.createDataStore(RuntimeAttributorFactory.type);\n\t\t\t\t\tconst result = await datastore.trySetAlias(attributorDataStoreAlias);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tresult === \"Success\",\n\t\t\t\t\t\t0xa1b /* Failed to set alias for attributor data store */,\n\t\t\t\t\t);\n\t\t\t\t\truntimeAttributor = (await datastore.entryPoint.get()) as IRuntimeAttributor;\n\t\t\t\t\tassert(runtimeAttributor !== undefined, 0xa1c /* Attributor should be defined */);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn runtime;\n\t\t}\n\t} as unknown as typeof ContainerRuntime;\n"]}
1
+ {"version":3,"file":"mixinAttributor.js","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAA8E;AAI9E,kEAA6D;AAK7D,uEAAqF;AAErF,qEAKkC;AAClC,iGAAkF;AAElF;;;;;GAKG;AACI,KAAK,UAAU,oBAAoB,CACzC,OAA8B;IAE9B,MAAM,UAAU,GAAG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,CAAC,CAAmC,CAAC;QAE7C,IAAI,iBAAiD,CAAC;QACtD,IAAI,sBAAsB,EAAE,CAAC;YAC5B,IAAI,QAAQ,EAAE,CAAC;gBACd,iBAAiB,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACzD,CAAC;iBAAM,CAAC;gBACP,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,+DAAwB,CAAC,IAAI,CAAC,CAAC;gBAC/E,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,iDAAwB,CAAC,CAAC;gBACrE,IAAA,iBAAM,EACL,MAAM,KAAK,SAAS,EACpB,KAAK,CAAC,mDAAmD,CACzD,CAAC;gBACF,iBAAiB,GAAG,CAAC,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,CAAuB,CAAC;gBAC7E,IAAA,iBAAM,EAAC,iBAAiB,KAAK,SAAS,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACnF,CAAC;QACF,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACqC,CAAC;AAlE5B,QAAA,eAAe,mBAkEa","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IContainerContext } from \"@fluidframework/container-definitions/internal\";\nimport { ContainerRuntime } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntimeOptions } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { loggerToMonitoringContext } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tattributorDataStoreAlias,\n\tenableOnNewFileKey,\n\ttype IProvideRuntimeAttributor,\n\ttype IRuntimeAttributor,\n} from \"./attributorContracts.js\";\nimport { RuntimeAttributorFactory } from \"./runtimeAttributorDataStoreFactory.js\";\n\n/**\n * Utility function to get the runtime attributor from the container runtime.\n * @param runtime - container runtime from which attributor is to be fetched.\n * @returns IRuntimeAttributor if it exists, otherwise undefined.\n * @internal\n */\nexport async function getRuntimeAttributor(\n\truntime: IContainerRuntimeBase,\n): Promise<IRuntimeAttributor | undefined> {\n\tconst entryPoint = await runtime.getAliasedDataStoreEntryPoint(attributorDataStoreAlias);\n\tconst runtimeAttributor = (await entryPoint?.get()) as\n\t\t| FluidObject<IProvideRuntimeAttributor>\n\t\t| undefined;\n\treturn runtimeAttributor?.IRuntimeAttributor;\n}\n\n/**\n * Mixes in logic to load and store runtime-based attribution functionality.\n *\n * Existing documents without stored attributor will not start storing attribution information. We only create the attributor\n * if its tracking is enabled and we are creating a new document.\n * @param Base - base class, inherits from FluidAttributorRuntime\n * @internal\n */\nexport const mixinAttributor = (\n\tBase: typeof ContainerRuntime = ContainerRuntime,\n): typeof ContainerRuntime =>\n\tclass ContainerRuntimeWithAttributor extends Base {\n\t\tpublic static async loadRuntime(params: {\n\t\t\tcontext: IContainerContext;\n\t\t\tregistryEntries: NamedFluidDataStoreRegistryEntries;\n\t\t\texisting: boolean;\n\t\t\truntimeOptions?: IContainerRuntimeOptions;\n\t\t\tcontainerScope?: FluidObject;\n\t\t\tcontainerRuntimeCtor?: typeof ContainerRuntime;\n\t\t\tprovideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>;\n\t\t}): Promise<ContainerRuntime> {\n\t\t\tconst {\n\t\t\t\tcontext,\n\t\t\t\tregistryEntries,\n\t\t\t\texisting,\n\t\t\t\tprovideEntryPoint,\n\t\t\t\truntimeOptions,\n\t\t\t\tcontainerScope,\n\t\t\t\tcontainerRuntimeCtor = ContainerRuntimeWithAttributor as unknown as typeof ContainerRuntime,\n\t\t\t} = params;\n\n\t\t\tconst mc = loggerToMonitoringContext(context.taggedLogger);\n\t\t\tconst factory = new RuntimeAttributorFactory();\n\t\t\tconst registryEntriesCopy: NamedFluidDataStoreRegistryEntries = [\n\t\t\t\t...registryEntries,\n\t\t\t\t[RuntimeAttributorFactory.type, Promise.resolve(factory)],\n\t\t\t];\n\t\t\tconst shouldTrackAttribution = mc.config.getBoolean(enableOnNewFileKey) ?? false;\n\t\t\tif (shouldTrackAttribution) {\n\t\t\t\tconst { options } = context;\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t(options.attribution ??= {}).track = true;\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\tconst runtime = (await Base.loadRuntime({\n\t\t\t\tcontext,\n\t\t\t\tregistryEntries: registryEntriesCopy,\n\t\t\t\tprovideEntryPoint,\n\t\t\t\truntimeOptions,\n\t\t\t\tcontainerScope,\n\t\t\t\texisting,\n\t\t\t\tcontainerRuntimeCtor,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t} as any)) as ContainerRuntimeWithAttributor;\n\n\t\t\tlet runtimeAttributor: IRuntimeAttributor | undefined;\n\t\t\tif (shouldTrackAttribution) {\n\t\t\t\tif (existing) {\n\t\t\t\t\truntimeAttributor = await getRuntimeAttributor(runtime);\n\t\t\t\t} else {\n\t\t\t\t\tconst datastore = await runtime.createDataStore(RuntimeAttributorFactory.type);\n\t\t\t\t\tconst result = await datastore.trySetAlias(attributorDataStoreAlias);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tresult === \"Success\",\n\t\t\t\t\t\t0xa1b /* Failed to set alias for attributor data store */,\n\t\t\t\t\t);\n\t\t\t\t\truntimeAttributor = (await datastore.entryPoint.get()) as IRuntimeAttributor;\n\t\t\t\t\tassert(runtimeAttributor !== undefined, 0xa1c /* Attributor should be defined */);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn runtime;\n\t\t}\n\t} as unknown as typeof ContainerRuntime;\n"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IDeltaManager } from "@fluidframework/container-definitions/internal";
6
- import { IDocumentMessage, type ISnapshotTree, ISequencedDocumentMessage, IQuorumClients } from "@fluidframework/driver-definitions/internal";
7
- import { type AttributionInfo, type AttributionKey, type ISummaryTreeWithStats } from "@fluidframework/runtime-definitions/internal";
5
+ import type { IDeltaManager } from "@fluidframework/container-definitions/internal";
6
+ import type { IDocumentMessage, ISnapshotTree, ISequencedDocumentMessage, IQuorumClients } from "@fluidframework/driver-definitions/internal";
7
+ import type { AttributionInfo, AttributionKey, ISummaryTreeWithStats } from "@fluidframework/runtime-definitions/internal";
8
8
  import { type IRuntimeAttributor } from "./attributorContracts.js";
9
9
  export declare class RuntimeAttributor implements IRuntimeAttributor {
10
10
  get IRuntimeAttributor(): IRuntimeAttributor;
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeAttributor.d.ts","sourceRoot":"","sources":["../src/runtimeAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAE/E,OAAO,EACN,gBAAgB,EAChB,KAAK,aAAa,EAClB,yBAAyB,EACzB,cAAc,EACd,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,MAAM,8CAA8C,CAAC;AAItD,OAAO,EAAc,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI/E,qBAAa,iBAAkB,YAAW,kBAAkB;IAC3D,IAAW,kBAAkB,IAAI,kBAAkB,CAElD;IAEM,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,eAAe;IAsBzC,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO;IAYxC,OAAO,CAAC,OAAO,CAGb;IAEF,OAAO,CAAC,YAAY,CAA0B;IACvC,SAAS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served.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentMessage,\n\ttype ISnapshotTree,\n\tISequencedDocumentMessage,\n\tIQuorumClients,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\ttype AttributionInfo,\n\ttype AttributionKey,\n\ttype ISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\n\nimport { OpStreamAttributor, type IAttributor } from \"./attributor.js\";\nimport { opBlobName, type IRuntimeAttributor } from \"./attributorContracts.js\";\nimport { AttributorSerializer, chain, deltaEncoder, type Encoder } from \"./encoders.js\";\nimport { makeLZ4Encoder } from \"./lz4Encoder.js\";\n\nexport class RuntimeAttributor implements IRuntimeAttributor {\n\tpublic get IRuntimeAttributor(): IRuntimeAttributor {\n\t\treturn this;\n\t}\n\n\tpublic get(key: AttributionKey): AttributionInfo {\n\t\tassert(\n\t\t\tthis.opAttributor !== undefined,\n\t\t\t0x509 /* RuntimeAttributor must be initialized before getAttributionInfo can be called */,\n\t\t);\n\n\t\tif (key.type === \"detached\") {\n\t\t\tthrow new Error(\"Attribution of detached keys is not yet supported.\");\n\t\t}\n\n\t\tif (key.type === \"local\") {\n\t\t\t// Note: we can *almost* orchestrate this correctly with internal-only changes by looking up the current\n\t\t\t// client id in the audience. However, for read->write client transition, the container might have not yet\n\t\t\t// received a client id. This is left as a TODO as it might be more easily solved once the detached case\n\t\t\t// is settled (e.g. if it's reasonable for the host to know the current user information at container\n\t\t\t// creation time, we could just use that here as well).\n\t\t\tthrow new Error(\"Attribution of local keys is not yet supported.\");\n\t\t}\n\n\t\treturn this.opAttributor.getAttributionInfo(key.seq);\n\t}\n\n\tpublic has(key: AttributionKey): boolean {\n\t\tif (key.type === \"detached\") {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (key.type === \"local\") {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.opAttributor?.tryGetAttributionInfo(key.seq) !== undefined;\n\t}\n\n\tprivate encoder: Encoder<IAttributor, string> = {\n\t\tencode: unreachableCase,\n\t\tdecode: unreachableCase,\n\t};\n\n\tprivate opAttributor: IAttributor | undefined;\n\tpublic isEnabled = true;\n\n\tpublic async initialize(\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorum: IQuorumClients,\n\t\tbaseSnapshotForAttributorTree: ISnapshotTree | undefined,\n\t\treadBlob: (id: string) => Promise<ArrayBufferLike>,\n\t): Promise<void> {\n\t\tthis.encoder = chain(\n\t\t\tnew AttributorSerializer(\n\t\t\t\t(entries) => new OpStreamAttributor(deltaManager, quorum, entries),\n\t\t\t\tdeltaEncoder,\n\t\t\t),\n\t\t\tmakeLZ4Encoder(),\n\t\t);\n\n\t\tif (baseSnapshotForAttributorTree === undefined) {\n\t\t\tthis.opAttributor = new OpStreamAttributor(deltaManager, quorum);\n\t\t} else {\n\t\t\tconst id: string | undefined = baseSnapshotForAttributorTree.blobs[opBlobName];\n\t\t\tassert(\n\t\t\t\tid !== undefined,\n\t\t\t\t0x50a /* Attributor tree should have op attributor summary blob. */,\n\t\t\t);\n\t\t\tconst blobContents = await readBlob(id);\n\t\t\tconst attributorSnapshot = bufferToString(blobContents, \"utf8\");\n\t\t\tthis.opAttributor = this.encoder.decode(attributorSnapshot);\n\t\t}\n\t}\n\n\tpublic summarizeOpAttributor(): ISummaryTreeWithStats {\n\t\tassert(\n\t\t\tthis.opAttributor !== undefined,\n\t\t\t0xa1d /* RuntimeAttributor should be initialized before summarization */,\n\t\t);\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tbuilder.addBlob(opBlobName, this.encoder.encode(this.opAttributor));\n\t\treturn builder.getSummaryTree();\n\t}\n}\n"]}
1
+ {"version":3,"file":"runtimeAttributor.js","sourceRoot":"","sources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YAAwE,EACxE,MAAsB,EACtB,6BAAwD,EACxD,QAAkD;QAElD,IAAI,CAAC,OAAO,GAAG,IAAA,mBAAK,EACnB,IAAI,kCAAoB,CACvB,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,kCAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAClE,0BAAY,CACZ,EACD,IAAA,8BAAc,GAAE,CAChB,CAAC;QAEF,IAAI,6BAA6B,KAAK,SAAS,EAAE,CAAC;YACjD,IAAI,CAAC,YAAY,GAAG,IAAI,kCAAkB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAClE,CAAC;aAAM,CAAC;YACP,MAAM,EAAE,GAAuB,6BAA6B,CAAC,KAAK,CAAC,mCAAU,CAAC,CAAC;YAC/E,IAAA,iBAAM,EACL,EAAE,KAAK,SAAS,EAChB,KAAK,CAAC,6DAA6D,CACnE,CAAC;YACF,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,EAAE,CAAC,CAAC;YACxC,MAAM,kBAAkB,GAAG,IAAA,6BAAc,EAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YAChE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAEM,qBAAqB;QAC3B,IAAA,iBAAM,EACL,IAAI,CAAC,YAAY,KAAK,SAAS,EAC/B,KAAK,CAAC,kEAAkE,CACxE,CAAC;QACF,MAAM,OAAO,GAAG,IAAI,6BAAkB,EAAE,CAAC;QACzC,OAAO,CAAC,OAAO,CAAC,mCAAU,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACpE,OAAO,OAAO,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;CACD;AApFD,8CAoFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport type { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIDocumentMessage,\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n\tIQuorumClients,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tAttributionInfo,\n\tAttributionKey,\n\tISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\n\nimport { OpStreamAttributor, type IAttributor } from \"./attributor.js\";\nimport { opBlobName, type IRuntimeAttributor } from \"./attributorContracts.js\";\nimport { AttributorSerializer, chain, deltaEncoder, type Encoder } from \"./encoders.js\";\nimport { makeLZ4Encoder } from \"./lz4Encoder.js\";\n\nexport class RuntimeAttributor implements IRuntimeAttributor {\n\tpublic get IRuntimeAttributor(): IRuntimeAttributor {\n\t\treturn this;\n\t}\n\n\tpublic get(key: AttributionKey): AttributionInfo {\n\t\tassert(\n\t\t\tthis.opAttributor !== undefined,\n\t\t\t0x509 /* RuntimeAttributor must be initialized before getAttributionInfo can be called */,\n\t\t);\n\n\t\tif (key.type === \"detached\") {\n\t\t\tthrow new Error(\"Attribution of detached keys is not yet supported.\");\n\t\t}\n\n\t\tif (key.type === \"local\") {\n\t\t\t// Note: we can *almost* orchestrate this correctly with internal-only changes by looking up the current\n\t\t\t// client id in the audience. However, for read->write client transition, the container might have not yet\n\t\t\t// received a client id. This is left as a TODO as it might be more easily solved once the detached case\n\t\t\t// is settled (e.g. if it's reasonable for the host to know the current user information at container\n\t\t\t// creation time, we could just use that here as well).\n\t\t\tthrow new Error(\"Attribution of local keys is not yet supported.\");\n\t\t}\n\n\t\treturn this.opAttributor.getAttributionInfo(key.seq);\n\t}\n\n\tpublic has(key: AttributionKey): boolean {\n\t\tif (key.type === \"detached\") {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (key.type === \"local\") {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.opAttributor?.tryGetAttributionInfo(key.seq) !== undefined;\n\t}\n\n\tprivate encoder: Encoder<IAttributor, string> = {\n\t\tencode: unreachableCase,\n\t\tdecode: unreachableCase,\n\t};\n\n\tprivate opAttributor: IAttributor | undefined;\n\tpublic isEnabled = true;\n\n\tpublic async initialize(\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorum: IQuorumClients,\n\t\tbaseSnapshotForAttributorTree: ISnapshotTree | undefined,\n\t\treadBlob: (id: string) => Promise<ArrayBufferLike>,\n\t): Promise<void> {\n\t\tthis.encoder = chain(\n\t\t\tnew AttributorSerializer(\n\t\t\t\t(entries) => new OpStreamAttributor(deltaManager, quorum, entries),\n\t\t\t\tdeltaEncoder,\n\t\t\t),\n\t\t\tmakeLZ4Encoder(),\n\t\t);\n\n\t\tif (baseSnapshotForAttributorTree === undefined) {\n\t\t\tthis.opAttributor = new OpStreamAttributor(deltaManager, quorum);\n\t\t} else {\n\t\t\tconst id: string | undefined = baseSnapshotForAttributorTree.blobs[opBlobName];\n\t\t\tassert(\n\t\t\t\tid !== undefined,\n\t\t\t\t0x50a /* Attributor tree should have op attributor summary blob. */,\n\t\t\t);\n\t\t\tconst blobContents = await readBlob(id);\n\t\t\tconst attributorSnapshot = bufferToString(blobContents, \"utf8\");\n\t\t\tthis.opAttributor = this.encoder.decode(attributorSnapshot);\n\t\t}\n\t}\n\n\tpublic summarizeOpAttributor(): ISummaryTreeWithStats {\n\t\tassert(\n\t\t\tthis.opAttributor !== undefined,\n\t\t\t0xa1d /* RuntimeAttributor should be initialized before summarization */,\n\t\t);\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tbuilder.addBlob(opBlobName, this.encoder.encode(this.opAttributor));\n\t\treturn builder.getSummaryTree();\n\t}\n}\n"]}
@@ -3,13 +3,13 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
6
- import { AttachState, IDeltaManager } from "@fluidframework/container-definitions/internal";
7
- import { FluidObject, IRequest, IResponse } from "@fluidframework/core-interfaces";
6
+ import { AttachState, type IDeltaManager } from "@fluidframework/container-definitions/internal";
7
+ import type { FluidObject, IRequest, IResponse } from "@fluidframework/core-interfaces";
8
8
  import type { IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
9
- import { IFluidDataStoreRuntimeEvents } from "@fluidframework/datastore-definitions/internal";
10
- import { IDocumentMessage, type ISnapshotTree, ISequencedDocumentMessage, IQuorumClients } from "@fluidframework/driver-definitions/internal";
11
- import { IGarbageCollectionData, IFluidDataStoreChannel, IFluidDataStoreContext, IInboundSignalMessage, VisibilityState, type ISummaryTreeWithStats, type ITelemetryContext, type IRuntimeMessageCollection } from "@fluidframework/runtime-definitions/internal";
12
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
9
+ import type { IFluidDataStoreRuntimeEvents } from "@fluidframework/datastore-definitions/internal";
10
+ import type { IDocumentMessage, ISnapshotTree, ISequencedDocumentMessage, IQuorumClients } from "@fluidframework/driver-definitions/internal";
11
+ import { type IGarbageCollectionData, type IFluidDataStoreChannel, type IFluidDataStoreContext, type IInboundSignalMessage, VisibilityState, type ISummaryTreeWithStats, type ITelemetryContext, type IRuntimeMessageCollection } from "@fluidframework/runtime-definitions/internal";
12
+ import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
13
13
  /**
14
14
  * Data store channel for the runtime attributor. This channel is responsible for storing and managing the
15
15
  */
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeAttributorDataStoreChannel.d.ts","sourceRoot":"","sources":["../src/runtimeAttributorDataStoreChannel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,QAAQ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AAzND,8EAyNC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { AttachState, IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { FluidObject, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, Deferred, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore/internal\";\nimport { IFluidDataStoreRuntimeEvents } from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tIDocumentMessage,\n\ttype ISnapshotTree,\n\tISequencedDocumentMessage,\n\tIQuorumClients,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIGarbageCollectionData,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIInboundSignalMessage,\n\tVisibilityState,\n\ttype ISummaryTreeWithStats,\n\ttype ITelemetryContext,\n\ttype IRuntimeMessageCollection,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\traiseConnectedEvent,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { RuntimeAttributor } from \"./runtimeAttributor.js\";\n\n/**\n * Data store channel for the runtime attributor. This channel is responsible for storing and managing the\n */\nexport class RuntimeAttributorDataStoreChannel\n\textends TypedEventEmitter<IFluidDataStoreRuntimeEvents>\n\timplements IFluidDataStoreChannel\n{\n\tpublic constructor(\n\t\tpublic readonly dataStoreContext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t) {\n\t\tsuper();\n\t\tthis.runtimeAttributor = new RuntimeAttributor();\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: dataStoreContext.baseLogger,\n\t\t\tnamespace: \"Attributor\",\n\t\t});\n\t\tthis.attachState = dataStoreContext.attachState;\n\t\tif (existing) {\n\t\t\tthis.visibilityState =\n\t\t\t\tdataStoreContext.attachState === AttachState.Detached\n\t\t\t\t\t? VisibilityState.LocallyVisible\n\t\t\t\t\t: VisibilityState.GloballyVisible;\n\t\t} else {\n\t\t\tthis.visibilityState = VisibilityState.NotVisible;\n\t\t}\n\t\t// If it's existing we know it has been attached.\n\t\tif (existing) {\n\t\t\tthis.deferredAttached.resolve();\n\t\t}\n\t\tthis.entryPoint = new FluidObjectHandle<FluidObject>(\n\t\t\tthis.runtimeAttributor,\n\t\t\t\"\",\n\t\t\tdataStoreContext.IFluidHandleContext,\n\t\t);\n\t}\n\n\tpublic get IFluidDataStoreChannel(): IFluidDataStoreChannel {\n\t\treturn this;\n\t}\n\n\tprivate _disposed = false;\n\tpublic get disposed(): boolean {\n\t\treturn this._disposed;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._disposed = true;\n\t}\n\n\tprivate readonly runtimeAttributor: RuntimeAttributor;\n\tpublic isEnabled = true;\n\tpublic attachState: AttachState;\n\tpublic visibilityState: VisibilityState;\n\tprivate readonly deferredAttached = new Deferred<void>();\n\tprivate readonly mc: MonitoringContext;\n\tpublic get logger(): ITelemetryLoggerExt {\n\t\treturn this.mc.logger;\n\t}\n\n\tpublic async initialize(\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorum: IQuorumClients,\n\t\tbaseSnapshotForAttributorTree: ISnapshotTree | undefined,\n\t\treadBlob: (id: string) => Promise<ArrayBufferLike>,\n\t): Promise<void> {\n\t\tawait this.runtimeAttributor.initialize(\n\t\t\tdeltaManager,\n\t\t\tquorum,\n\t\t\tbaseSnapshotForAttributorTree,\n\t\t\treadBlob,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.makeVisibleAndAttachGraph}\n\t */\n\tpublic makeVisibleAndAttachGraph(): void {\n\t\tif (this.visibilityState !== VisibilityState.NotVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis.visibilityState = VisibilityState.LocallyVisible;\n\n\t\tthis.dataStoreContext.makeLocallyVisible();\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.getAttachSummary}\n\t */\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\treturn this.runtimeAttributor.summarizeOpAttributor();\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.getAttachGCData}\n\t */\n\tpublic getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData {\n\t\treturn { gcNodes: {} };\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.processMessages}\n\t */\n\tpublic processMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tthrow new Error(\"Attributor should not receive messages yet\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.processSignal}\n\t */\n\tpublic processSignal(message: IInboundSignalMessage, local: boolean): void {\n\t\tthrow new Error(\"Attributor should not receive signals\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.summarize}\n\t */\n\tpublic async summarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.runtimeAttributor.summarizeOpAttributor();\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.getGCData}\n\t */\n\tpublic async getGCData(fullGC?: boolean): Promise<IGarbageCollectionData> {\n\t\t// Nothing to be GCed from the attributor.\n\t\tconst garbageCollectionData: IGarbageCollectionData = { gcNodes: {} };\n\t\treturn garbageCollectionData;\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.updateUsedRoutes}\n\t */\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\n\t\treturn;\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.setConnectionState}\n\t */\n\tpublic setConnectionState(connected: boolean, clientId?: string): void {\n\t\traiseConnectedEvent(this.logger, this, connected, clientId);\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.reSubmit}\n\t */\n\tpublic reSubmit(type: string, content: unknown, localOpMetadata: unknown): void {\n\t\t// Should not resubmit anything from the attributor as the attributor does not send ops yet.\n\t\tthrow new Error(\"Should not resubmit anything from the attributor\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.applyStashedOp}\n\t */\n\tpublic async applyStashedOp(content: unknown): Promise<unknown> {\n\t\t// Should not apply stashed ops to the attributor as the attributor does not send ops yet.\n\t\tthrow new Error(\"Should not apply stashed ops to the attributor\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.rollback}\n\t */\n\tpublic rollback?(type: string, content: unknown, localOpMetadata: unknown): void {\n\t\t// Should not rollback anything from the attributor as it does not send ops yet.\n\t\tthrow new Error(\"Should not rollback anything from the attributor\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.entryPoint}\n\t */\n\tpublic readonly entryPoint: IFluidHandleInternal<FluidObject>;\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.request}\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\t// Should not request anything from the attributor as the attributor does not have any channels further.\n\t\tthrow new Error(\"Should not request anything from the attributor\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.setAttachState}\n\t */\n\tpublic setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void {\n\t\tswitch (attachState) {\n\t\t\tcase AttachState.Attaching: {\n\t\t\t\tthis.attachState = AttachState.Attaching;\n\n\t\t\t\tassert(\n\t\t\t\t\tthis.visibilityState === VisibilityState.LocallyVisible,\n\t\t\t\t\t0xa1e /* Data store should be locally visible before it can become globally visible. */,\n\t\t\t\t);\n\n\t\t\t\t// Mark the data store globally visible and make its child channels visible as well.\n\t\t\t\tthis.visibilityState = VisibilityState.GloballyVisible;\n\n\t\t\t\t// This promise resolution will be moved to attached event once we fix the scheduler.\n\t\t\t\tthis.deferredAttached.resolve();\n\t\t\t\tthis.emit(\"attaching\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase AttachState.Attached: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.visibilityState === VisibilityState.GloballyVisible,\n\t\t\t\t\t0xa1f /* Data store should be globally visible when its attached. */,\n\t\t\t\t);\n\t\t\t\tthis.attachState = AttachState.Attached;\n\t\t\t\tthis.emit(\"attached\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(attachState, \"unreached\");\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"runtimeAttributorDataStoreChannel.js","sourceRoot":"","sources":["../src/runtimeAttributorDataStoreChannel.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AACjE,6EAGwD;AAGxD,kEAAwF;AACxF,iEAAuE;AAQvE,2EASsD;AACtD,uEAKkD;AAElD,iEAA2D;AAE3D;;GAEG;AACH,MAAa,iCACZ,SAAQ,gCAA+C;IAGvD,YACiB,gBAAwC,EACxD,QAAiB;QAEjB,KAAK,EAAE,CAAC;QAHQ,qBAAgB,GAAhB,gBAAgB,CAAwB;QAiCjD,cAAS,GAAG,KAAK,CAAC;QAUnB,cAAS,GAAG,IAAI,CAAC;QAGP,qBAAgB,GAAG,IAAI,mBAAQ,EAAQ,CAAC;QA1CxD,IAAI,CAAC,iBAAiB,GAAG,IAAI,wCAAiB,EAAE,CAAC;QACjD,IAAI,CAAC,EAAE,GAAG,IAAA,uCAA4B,EAAC;YACtC,MAAM,EAAE,gBAAgB,CAAC,UAAU;YACnC,SAAS,EAAE,YAAY;SACvB,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC,WAAW,CAAC;QAChD,IAAI,QAAQ,EAAE,CAAC;YACd,IAAI,CAAC,eAAe;gBACnB,gBAAgB,CAAC,WAAW,KAAK,sBAAW,C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kD,CAAC,CAAC;IACrE,CAAC;IAOD;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,wGAAwG;QACxG,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,WAAyD;QAC9E,QAAQ,WAAW,EAAE,CAAC;YACrB,KAAK,sBAAW,CAAC,SAAS,CAAC,CAAC,CAAC;gBAC5B,IAAI,CAAC,WAAW,GAAG,sBAAW,CAAC,SAAS,CAAC;gBAEzC,IAAA,iBAAM,EACL,IAAI,CAAC,eAAe,KAAK,0BAAe,CAAC,cAAc,EACvD,KAAK,CAAC,iFAAiF,CACvF,CAAC;gBAEF,oFAAoF;gBACpF,IAAI,CAAC,eAAe,GAAG,0BAAe,CAAC,eAAe,CAAC;gBAEvD,qFAAqF;gBACrF,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;gBAChC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBACvB,MAAM;YACP,CAAC;YACD,KAAK,sBAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC3B,IAAA,iBAAM,EACL,IAAI,CAAC,eAAe,KAAK,0BAAe,CAAC,eAAe,EACxD,KAAK,CAAC,8DAA8D,CACpE,CAAC;gBACF,IAAI,CAAC,WAAW,GAAG,sBAAW,CAAC,QAAQ,CAAC;gBACxC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBACtB,MAAM;YACP,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACT,IAAA,0BAAe,EAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YAC3C,CAAC;QACF,CAAC;IACF,CAAC;CACD;AAzND,8EAyNC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\tAttachState,\n\ttype IDeltaManager,\n} from \"@fluidframework/container-definitions/internal\";\nimport type { FluidObject, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, Deferred, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore/internal\";\nimport type { IFluidDataStoreRuntimeEvents } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIDocumentMessage,\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n\tIQuorumClients,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\ttype IGarbageCollectionData,\n\ttype IFluidDataStoreChannel,\n\ttype IFluidDataStoreContext,\n\ttype IInboundSignalMessage,\n\tVisibilityState,\n\ttype ISummaryTreeWithStats,\n\ttype ITelemetryContext,\n\ttype IRuntimeMessageCollection,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\ttype MonitoringContext,\n\traiseConnectedEvent,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { RuntimeAttributor } from \"./runtimeAttributor.js\";\n\n/**\n * Data store channel for the runtime attributor. This channel is responsible for storing and managing the\n */\nexport class RuntimeAttributorDataStoreChannel\n\textends TypedEventEmitter<IFluidDataStoreRuntimeEvents>\n\timplements IFluidDataStoreChannel\n{\n\tpublic constructor(\n\t\tpublic readonly dataStoreContext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t) {\n\t\tsuper();\n\t\tthis.runtimeAttributor = new RuntimeAttributor();\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: dataStoreContext.baseLogger,\n\t\t\tnamespace: \"Attributor\",\n\t\t});\n\t\tthis.attachState = dataStoreContext.attachState;\n\t\tif (existing) {\n\t\t\tthis.visibilityState =\n\t\t\t\tdataStoreContext.attachState === AttachState.Detached\n\t\t\t\t\t? VisibilityState.LocallyVisible\n\t\t\t\t\t: VisibilityState.GloballyVisible;\n\t\t} else {\n\t\t\tthis.visibilityState = VisibilityState.NotVisible;\n\t\t}\n\t\t// If it's existing we know it has been attached.\n\t\tif (existing) {\n\t\t\tthis.deferredAttached.resolve();\n\t\t}\n\t\tthis.entryPoint = new FluidObjectHandle<FluidObject>(\n\t\t\tthis.runtimeAttributor,\n\t\t\t\"\",\n\t\t\tdataStoreContext.IFluidHandleContext,\n\t\t);\n\t}\n\n\tpublic get IFluidDataStoreChannel(): IFluidDataStoreChannel {\n\t\treturn this;\n\t}\n\n\tprivate _disposed = false;\n\tpublic get disposed(): boolean {\n\t\treturn this._disposed;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._disposed = true;\n\t}\n\n\tprivate readonly runtimeAttributor: RuntimeAttributor;\n\tpublic isEnabled = true;\n\tpublic attachState: AttachState;\n\tpublic visibilityState: VisibilityState;\n\tprivate readonly deferredAttached = new Deferred<void>();\n\tprivate readonly mc: MonitoringContext;\n\tpublic get logger(): ITelemetryLoggerExt {\n\t\treturn this.mc.logger;\n\t}\n\n\tpublic async initialize(\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorum: IQuorumClients,\n\t\tbaseSnapshotForAttributorTree: ISnapshotTree | undefined,\n\t\treadBlob: (id: string) => Promise<ArrayBufferLike>,\n\t): Promise<void> {\n\t\tawait this.runtimeAttributor.initialize(\n\t\t\tdeltaManager,\n\t\t\tquorum,\n\t\t\tbaseSnapshotForAttributorTree,\n\t\t\treadBlob,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.makeVisibleAndAttachGraph}\n\t */\n\tpublic makeVisibleAndAttachGraph(): void {\n\t\tif (this.visibilityState !== VisibilityState.NotVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis.visibilityState = VisibilityState.LocallyVisible;\n\n\t\tthis.dataStoreContext.makeLocallyVisible();\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.getAttachSummary}\n\t */\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\treturn this.runtimeAttributor.summarizeOpAttributor();\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.getAttachGCData}\n\t */\n\tpublic getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData {\n\t\treturn { gcNodes: {} };\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.processMessages}\n\t */\n\tpublic processMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tthrow new Error(\"Attributor should not receive messages yet\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.processSignal}\n\t */\n\tpublic processSignal(message: IInboundSignalMessage, local: boolean): void {\n\t\tthrow new Error(\"Attributor should not receive signals\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.summarize}\n\t */\n\tpublic async summarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.runtimeAttributor.summarizeOpAttributor();\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.getGCData}\n\t */\n\tpublic async getGCData(fullGC?: boolean): Promise<IGarbageCollectionData> {\n\t\t// Nothing to be GCed from the attributor.\n\t\tconst garbageCollectionData: IGarbageCollectionData = { gcNodes: {} };\n\t\treturn garbageCollectionData;\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.updateUsedRoutes}\n\t */\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\n\t\treturn;\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.setConnectionState}\n\t */\n\tpublic setConnectionState(connected: boolean, clientId?: string): void {\n\t\traiseConnectedEvent(this.logger, this, connected, clientId);\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.reSubmit}\n\t */\n\tpublic reSubmit(type: string, content: unknown, localOpMetadata: unknown): void {\n\t\t// Should not resubmit anything from the attributor as the attributor does not send ops yet.\n\t\tthrow new Error(\"Should not resubmit anything from the attributor\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.applyStashedOp}\n\t */\n\tpublic async applyStashedOp(content: unknown): Promise<unknown> {\n\t\t// Should not apply stashed ops to the attributor as the attributor does not send ops yet.\n\t\tthrow new Error(\"Should not apply stashed ops to the attributor\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.rollback}\n\t */\n\tpublic rollback?(type: string, content: unknown, localOpMetadata: unknown): void {\n\t\t// Should not rollback anything from the attributor as it does not send ops yet.\n\t\tthrow new Error(\"Should not rollback anything from the attributor\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.entryPoint}\n\t */\n\tpublic readonly entryPoint: IFluidHandleInternal<FluidObject>;\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.request}\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\t// Should not request anything from the attributor as the attributor does not have any channels further.\n\t\tthrow new Error(\"Should not request anything from the attributor\");\n\t}\n\n\t/**\n\t * {@inheritdoc IFluidDataStoreChannel.setAttachState}\n\t */\n\tpublic setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void {\n\t\tswitch (attachState) {\n\t\t\tcase AttachState.Attaching: {\n\t\t\t\tthis.attachState = AttachState.Attaching;\n\n\t\t\t\tassert(\n\t\t\t\t\tthis.visibilityState === VisibilityState.LocallyVisible,\n\t\t\t\t\t0xa1e /* Data store should be locally visible before it can become globally visible. */,\n\t\t\t\t);\n\n\t\t\t\t// Mark the data store globally visible and make its child channels visible as well.\n\t\t\t\tthis.visibilityState = VisibilityState.GloballyVisible;\n\n\t\t\t\t// This promise resolution will be moved to attached event once we fix the scheduler.\n\t\t\t\tthis.deferredAttached.resolve();\n\t\t\t\tthis.emit(\"attaching\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase AttachState.Attached: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.visibilityState === VisibilityState.GloballyVisible,\n\t\t\t\t\t0xa1f /* Data store should be globally visible when its attached. */,\n\t\t\t\t);\n\t\t\t\tthis.attachState = AttachState.Attached;\n\t\t\t\tthis.emit(\"attached\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(attachState, \"unreached\");\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IFluidDataStoreFactory, IFluidDataStoreChannel, IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
5
+ import type { IFluidDataStoreFactory, IFluidDataStoreChannel, IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
6
6
  /**
7
7
  * Factory for the runtime attributor data store channel.
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeAttributorDataStoreFactory.d.ts","sourceRoot":"","sources":["../src/runtimeAttributorDataStoreFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AAKtD;;GAEG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IACtE,gBAAuB,IAAI,oCAAoC;IAE/D,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,sBAAsB,IAAI,sBAAsB,CAE1D;IAEY,oBAAoB,CAChC,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,sBAAsB,CAAC;CA2BlC"}
1
+ {"version":3,"file":"runtimeAttributorDataStoreFactory.d.ts","sourceRoot":"","sources":["../src/runtimeAttributorDataStoreFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AAKtD;;GAEG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IACtE,gBAAuB,IAAI,oCAAoC;IAE/D,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,sBAAsB,IAAI,sBAAsB,CAE1D;IAEY,oBAAoB,CAChC,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,sBAAsB,CAAC;CA2BlC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeAttributorDataStoreFactory.js","sourceRoot":"","sources":["../src/runtimeAttributorDataStoreFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,uEAA+F;AAE/F,iGAA2F;AAE3F;;GAEG;AACH,MAAa,wBAAwB;IAGpC,IAAW,IAAI;QACd,OAAO,wBAAwB,CAAC,IAAI,CAAC;IACtC,CAAC;IAED,IAAW,sBAAsB;QAChC,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAChC,OAA+B,EAC/B,QAAiB;QAEjB,MAAM,OAAO,GAAG,IAAI,wEAAiC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEzE,MAAM,MAAM,GAAG,IAAA,4BAAiB,EAAC;YAChC,MAAM,EAAE,OAAO,CAAC,UAAU;YAC1B,SAAS,EAAE,YAAY;SACvB,CAAC,CAAC;QAEH,MAAM,2BAAgB,CAAC,cAAc,CACpC,MAAM,EACN;YACC,SAAS,EAAE,YAAY;SACvB,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;YACf,MAAM,OAAO,CAAC,UAAU,CACvB,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,SAAS,EAAE,EACnB,OAAO,CAAC,YAAY,EACpB,KAAK,EAAE,EAAU,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAClD,CAAC;YACF,KAAK,CAAC,GAAG,CAAC;gBACT,uBAAuB,EAAE,IAAI,EAAE,wDAAwD;aACvF,CAAC,CAAC;QACJ,CAAC,CACD,CAAC;QACF,OAAO,OAAO,CAAC;IAChB,CAAC;;AAxCF,4DAyCC;AAxCuB,6BAAI,GAAG,gCAAgC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { PerformanceEvent, createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { RuntimeAttributorDataStoreChannel } from \"./runtimeAttributorDataStoreChannel.js\";\n\n/**\n * Factory for the runtime attributor data store channel.\n */\nexport class RuntimeAttributorFactory implements IFluidDataStoreFactory {\n\tpublic static readonly type = \"@fluid-experimental/attributor\";\n\n\tpublic get type(): string {\n\t\treturn RuntimeAttributorFactory.type;\n\t}\n\n\tpublic get IFluidDataStoreFactory(): IFluidDataStoreFactory {\n\t\treturn this;\n\t}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\tconst runtime = new RuntimeAttributorDataStoreChannel(context, existing);\n\n\t\tconst logger = createChildLogger({\n\t\t\tlogger: context.baseLogger,\n\t\t\tnamespace: \"Attributor\",\n\t\t});\n\n\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"initialize\",\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tawait runtime.initialize(\n\t\t\t\t\tcontext.deltaManager,\n\t\t\t\t\tcontext.getQuorum(),\n\t\t\t\t\tcontext.baseSnapshot,\n\t\t\t\t\tasync (id: string) => context.storage.readBlob(id),\n\t\t\t\t);\n\t\t\t\tevent.end({\n\t\t\t\t\tattributionEnabledInDoc: true, // If we are instantiating the attributor, it is enabled\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\t\treturn runtime;\n\t}\n}\n"]}
1
+ {"version":3,"file":"runtimeAttributorDataStoreFactory.js","sourceRoot":"","sources":["../src/runtimeAttributorDataStoreFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,uEAA+F;AAE/F,iGAA2F;AAE3F;;GAEG;AACH,MAAa,wBAAwB;IAGpC,IAAW,IAAI;QACd,OAAO,wBAAwB,CAAC,IAAI,CAAC;IACtC,CAAC;IAED,IAAW,sBAAsB;QAChC,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAChC,OAA+B,EAC/B,QAAiB;QAEjB,MAAM,OAAO,GAAG,IAAI,wEAAiC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEzE,MAAM,MAAM,GAAG,IAAA,4BAAiB,EAAC;YAChC,MAAM,EAAE,OAAO,CAAC,UAAU;YAC1B,SAAS,EAAE,YAAY;SACvB,CAAC,CAAC;QAEH,MAAM,2BAAgB,CAAC,cAAc,CACpC,MAAM,EACN;YACC,SAAS,EAAE,YAAY;SACvB,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;YACf,MAAM,OAAO,CAAC,UAAU,CACvB,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,SAAS,EAAE,EACnB,OAAO,CAAC,YAAY,EACpB,KAAK,EAAE,EAAU,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAClD,CAAC;YACF,KAAK,CAAC,GAAG,CAAC;gBACT,uBAAuB,EAAE,IAAI,EAAE,wDAAwD;aACvF,CAAC,CAAC;QACJ,CAAC,CACD,CAAC;QACF,OAAO,OAAO,CAAC;IAChB,CAAC;;AAxCF,4DAyCC;AAxCuB,6BAAI,GAAG,gCAAgC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { PerformanceEvent, createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { RuntimeAttributorDataStoreChannel } from \"./runtimeAttributorDataStoreChannel.js\";\n\n/**\n * Factory for the runtime attributor data store channel.\n */\nexport class RuntimeAttributorFactory implements IFluidDataStoreFactory {\n\tpublic static readonly type = \"@fluid-experimental/attributor\";\n\n\tpublic get type(): string {\n\t\treturn RuntimeAttributorFactory.type;\n\t}\n\n\tpublic get IFluidDataStoreFactory(): IFluidDataStoreFactory {\n\t\treturn this;\n\t}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\tconst runtime = new RuntimeAttributorDataStoreChannel(context, existing);\n\n\t\tconst logger = createChildLogger({\n\t\t\tlogger: context.baseLogger,\n\t\t\tnamespace: \"Attributor\",\n\t\t});\n\n\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"initialize\",\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tawait runtime.initialize(\n\t\t\t\t\tcontext.deltaManager,\n\t\t\t\t\tcontext.getQuorum(),\n\t\t\t\t\tcontext.baseSnapshot,\n\t\t\t\t\tasync (id: string) => context.storage.readBlob(id),\n\t\t\t\t);\n\t\t\t\tevent.end({\n\t\t\t\t\tattributionEnabledInDoc: true, // If we are instantiating the attributor, it is enabled\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\t\treturn runtime;\n\t}\n}\n"]}
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type IDeltaManager } from "@fluidframework/container-definitions/internal";
6
- import { type IQuorumClients } from "@fluidframework/driver-definitions";
5
+ import type { IDeltaManager } from "@fluidframework/container-definitions/internal";
6
+ import type { IQuorumClients } from "@fluidframework/driver-definitions";
7
7
  import { type IDocumentMessage, type ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
8
- import { type AttributionInfo } from "@fluidframework/runtime-definitions/internal";
8
+ import type { AttributionInfo } from "@fluidframework/runtime-definitions/internal";
9
9
  /**
10
10
  * Provides lookup between attribution keys and their associated attribution information.
11
11
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"attributor.d.ts","sourceRoot":"","sources":["../src/attributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAEpF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAEN,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAGpF;;;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;;GAEG;AACH,qBAAa,UAAW,YAAW,WAAW;IAC7C,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAE3D;;OAEG;gBACgB,cAAc,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAIvE;;OAEG;IACI,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe;IAQvD;;OAEG;IACI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAItE;;OAEG;I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CACD;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IACjD,YACC,YAAwE,EACxE,aAA6B,EAC7B,cAAoD;QAEpD,KAAK,CAAC,cAAc,CAAC,CAAC;QACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,EAAE;YAC5D,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,EAAE,CAAC;gBAC5C,MAAM,CACL,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EACpC,KAAK,CAAC,8DAA8D,CACpE,CAAC;gBACF,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACzD,MAAM,CACL,MAAM,KAAK,SAAS,EACpB,KAAK,CAAC,yDAAyD,CAC/D,CAAC;gBACF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE;oBAC1C,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;oBACxB,SAAS,EAAE,OAAO,CAAC,SAAS;iBAC5B,CAAC,CAAC;YACJ,CAAC;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 */\n\nimport { type IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { type IQuorumClients } from \"@fluidframework/driver-definitions\";\nimport {\n\tMessageType,\n\ttype IDocumentMessage,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { type AttributionInfo } from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\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 */\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\tpublic constructor(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 */\nexport class OpStreamAttributor extends Attributor implements IAttributor {\n\tpublic constructor(\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorumClients: IQuorumClients,\n\t\tinitialEntries?: Iterable<[number, AttributionInfo]>,\n\t) {\n\t\tsuper(initialEntries);\n\t\tdeltaManager.on(\"op\", (message: ISequencedDocumentMessage) => {\n\t\t\tif (message.type === MessageType.Operation) {\n\t\t\t\tassert(\n\t\t\t\t\ttypeof message.clientId === \"string\",\n\t\t\t\t\t0x966 /* Client id should be present and should be of type string */,\n\t\t\t\t);\n\t\t\t\tconst client = quorumClients.getMember(message.clientId);\n\t\t\t\tassert(\n\t\t\t\t\tclient !== undefined,\n\t\t\t\t\t0x967 /* Received message from user not in the quorumClients */,\n\t\t\t\t);\n\t\t\t\tthis.keyToInfo.set(message.sequenceNumber, {\n\t\t\t\t\tuser: client.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"]}
1
+ {"version":3,"file":"attributor.js","sourceRoot":"","sources":["../src/attributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EACN,WAAW,GAGX,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AA6BtE;;GAEG;AACH,MAAM,OAAO,UAAU;IAGtB;;OAEG;IACH,YAAmB,cAAoD;QACtE,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,CAAC;YACb,MAAM,IAAI,UAAU,CAAC,uDAAuD,GAAG,GAAG,CAAC,CAAC;QACrF,CAAC;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;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IACjD,YACC,YAAwE,EACxE,aAA6B,EAC7B,cAAoD;QAEpD,KAAK,CAAC,cAAc,CAAC,CAAC;QACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,EAAE;YAC5D,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,EAAE,CAAC;gBAC5C,MAAM,CACL,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EACpC,KAAK,CAAC,8DAA8D,CACpE,CAAC;gBACF,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACzD,MAAM,CACL,MAAM,KAAK,SAAS,EACpB,KAAK,CAAC,yDAAyD,CAC/D,CAAC;gBACF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE;oBAC1C,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;oBACxB,SAAS,EAAE,OAAO,CAAC,SAAS;iBAC5B,CAAC,CAAC;YACJ,CAAC;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 */\n\nimport type { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IQuorumClients } from \"@fluidframework/driver-definitions\";\nimport {\n\tMessageType,\n\ttype IDocumentMessage,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type { AttributionInfo } from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\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 */\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\tpublic constructor(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 */\nexport class OpStreamAttributor extends Attributor implements IAttributor {\n\tpublic constructor(\n\t\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tquorumClients: IQuorumClients,\n\t\tinitialEntries?: Iterable<[number, AttributionInfo]>,\n\t) {\n\t\tsuper(initialEntries);\n\t\tdeltaManager.on(\"op\", (message: ISequencedDocumentMessage) => {\n\t\t\tif (message.type === MessageType.Operation) {\n\t\t\t\tassert(\n\t\t\t\t\ttypeof message.clientId === \"string\",\n\t\t\t\t\t0x966 /* Client id should be present and should be of type string */,\n\t\t\t\t);\n\t\t\t\tconst client = quorumClients.getMember(message.clientId);\n\t\t\t\tassert(\n\t\t\t\t\tclient !== undefined,\n\t\t\t\t\t0x967 /* Received message from user not in the quorumClients */,\n\t\t\t\t);\n\t\t\t\tthis.keyToInfo.set(message.sequenceNumber, {\n\t\t\t\t\tuser: client.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"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type AttributionInfo, type AttributionKey } from "@fluidframework/runtime-definitions/internal";
5
+ import type { AttributionInfo, AttributionKey } from "@fluidframework/runtime-definitions/internal";
6
6
  export declare const opBlobName = "opAttributor";
7
7
  /**
8
8
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"attributorContracts.d.ts","sourceRoot":"","sources":["../src/attributorContracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,MAAM,8CAA8C,CAAC;AAGtD,eAAO,MAAM,UAAU,iBAAiB,CAAC;AAEzC;;GAEG;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;;GAEG;AACH,eAAO,MAAM,wBAAwB,oDAAoD,CAAC;AAE1F;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAmB,SAAQ,yBAAyB;IACpE;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,eAAe,CAAC;IAE1C;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC;IAElC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"attributorContracts.d.ts","sourceRoot":"","sources":["../src/attributorContracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,eAAe,EACf,cAAc,EACd,MAAM,8CAA8C,CAAC;AAGtD,eAAO,MAAM,UAAU,iBAAiB,CAAC;AAEzC;;GAEG;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;;GAEG;AACH,eAAO,MAAM,wBAAwB,oDAAoD,CAAC;AAE1F;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAmB,SAAQ,yBAAyB;IACpE;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,eAAe,CAAC;IAE1C;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC;IAElC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"attributorContracts.js","sourceRoot":"","sources":["../src/attributorContracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,oBAAoB;AACpB,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,mCAAmC,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAoC,oBAAoB,CAAC;AASxF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,iDAAiD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype AttributionInfo,\n\ttype AttributionKey,\n} from \"@fluidframework/runtime-definitions/internal\";\n\n// Summary tree keys\nexport const opBlobName = \"opAttributor\";\n\n/**\n * @internal\n */\nexport const enableOnNewFileKey = \"Fluid.Attribution.EnableOnNewFile\";\n\n/**\n * @internal\n */\nexport const IRuntimeAttributor: keyof IProvideRuntimeAttributor = \"IRuntimeAttributor\";\n\n/**\n * @internal\n */\nexport interface IProvideRuntimeAttributor {\n\treadonly IRuntimeAttributor: IRuntimeAttributor;\n}\n\n/**\n * @internal\n */\nexport const attributorDataStoreAlias = \"attributor-cf9b6fe4-4c50-4a5d-9045-eb73b886f740\";\n\n/**\n * Provides access to attribution information stored on the container runtime.\n *\n * @remarks Attributors are only populated after the container runtime into which they are being injected has initialized.\n *\n * @sealed\n * @internal\n */\nexport interface IRuntimeAttributor extends IProvideRuntimeAttributor {\n\t/**\n\t * @throws - If no AttributionInfo exists for this key.\n\t */\n\tget(key: AttributionKey): AttributionInfo;\n\n\t/**\n\t * @returns Whether any AttributionInfo exists for the provided key.\n\t */\n\thas(key: AttributionKey): boolean;\n\n\t/**\n\t * @returns Whether the runtime is currently tracking attribution information for the loaded container.\n\t * If enabled, the runtime attributor can be asked for the attribution info for different keys.\n\t * See {@link mixinAttributor} for more details on when this happens.\n\t */\n\treadonly isEnabled: boolean;\n}\n"]}
1
+ {"version":3,"file":"attributorContracts.js","sourceRoot":"","sources":["../src/attributorContracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,oBAAoB;AACpB,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,mCAAmC,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAoC,oBAAoB,CAAC;AASxF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,iDAAiD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tAttributionInfo,\n\tAttributionKey,\n} from \"@fluidframework/runtime-definitions/internal\";\n\n// Summary tree keys\nexport const opBlobName = \"opAttributor\";\n\n/**\n * @internal\n */\nexport const enableOnNewFileKey = \"Fluid.Attribution.EnableOnNewFile\";\n\n/**\n * @internal\n */\nexport const IRuntimeAttributor: keyof IProvideRuntimeAttributor = \"IRuntimeAttributor\";\n\n/**\n * @internal\n */\nexport interface IProvideRuntimeAttributor {\n\treadonly IRuntimeAttributor: IRuntimeAttributor;\n}\n\n/**\n * @internal\n */\nexport const attributorDataStoreAlias = \"attributor-cf9b6fe4-4c50-4a5d-9045-eb73b886f740\";\n\n/**\n * Provides access to attribution information stored on the container runtime.\n *\n * @remarks Attributors are only populated after the container runtime into which they are being injected has initialized.\n *\n * @sealed\n * @internal\n */\nexport interface IRuntimeAttributor extends IProvideRuntimeAttributor {\n\t/**\n\t * @throws - If no AttributionInfo exists for this key.\n\t */\n\tget(key: AttributionKey): AttributionInfo;\n\n\t/**\n\t * @returns Whether any AttributionInfo exists for the provided key.\n\t */\n\thas(key: AttributionKey): boolean;\n\n\t/**\n\t * @returns Whether the runtime is currently tracking attribution information for the loaded container.\n\t * If enabled, the runtime attributor can be asked for the attribution info for different keys.\n\t * See {@link mixinAttributor} for more details on when this happens.\n\t */\n\treadonly isEnabled: boolean;\n}\n"]}
package/lib/encoders.d.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type AttributionInfo } from "@fluidframework/runtime-definitions/internal";
6
- import { type IAttributor } from "./attributor.js";
5
+ import type { AttributionInfo } from "@fluidframework/runtime-definitions/internal";
6
+ import type { IAttributor } from "./attributor.js";
7
7
  import { type InternedStringId } from "./stringInterner.js";
8
8
  export interface Encoder<TDecoded, TEncoded> {
9
9
  encode(decoded: TDecoded): TEncoded;
@@ -1 +1 @@
1
- {"version":3,"file":"encoders.d.ts","sourceRoot":"","sources":["../src/encoders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAEpF,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,KAAK,gBAAgB,EAAyB,MAAM,qBAAqB,CAAC;AAEnF,MAAM,WAAW,OAAO,CAAC,QAAQ,EAAE,QAAQ;IAC1C,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACpC,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,gBAwB1B,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;IACrB,eAAe,EAAE,gBAAgB,EAAE,CAAC;CACpC;AAED,qBAAa,oBAAqB,YAAW,qBAAqB;IAEhE,OAAO,CAAC,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;IAGpD;;OAEG;IACI,MAAM,CAAC,U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