@fluidframework/counter 2.53.0 → 2.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/counter
2
2
 
3
+ ## 2.60.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.53.0
4
8
 
5
9
  Dependency updates only.
@@ -1,25 +1,25 @@
1
- ## Alpha API Report File for "@fluidframework/counter"
1
+ ## Beta API Report File for "@fluidframework/counter"
2
2
 
3
3
  > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
4
 
5
5
  ```ts
6
6
 
7
- // @alpha @legacy
7
+ // @beta @legacy
8
8
  export interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {
9
9
  increment(incrementAmount: number): void;
10
10
  value: number;
11
11
  }
12
12
 
13
- // @alpha @legacy
13
+ // @beta @legacy
14
14
  export interface ISharedCounterEvents extends ISharedObjectEvents {
15
15
  // @eventProperty
16
16
  (event: "incremented", listener: (incrementAmount: number, newValue: number) => void): any;
17
17
  }
18
18
 
19
- // @alpha @legacy
19
+ // @beta @legacy
20
20
  export const SharedCounter: ISharedObjectKind<ISharedCounter> & SharedObjectKind<ISharedCounter>;
21
21
 
22
- // @alpha @legacy
22
+ // @beta @legacy
23
23
  export type SharedCounter = ISharedCounter;
24
24
 
25
25
  ```
package/dist/counter.d.ts CHANGED
@@ -10,8 +10,7 @@ import { SharedObject } from "@fluidframework/shared-object-base/internal";
10
10
  import type { ISharedCounter, ISharedCounterEvents } from "./interfaces.js";
11
11
  /**
12
12
  * {@inheritDoc ISharedCounter}
13
- * @legacy
14
- * @alpha
13
+ * @legacy @beta
15
14
  */
16
15
  export declare class SharedCounter extends SharedObject<ISharedCounterEvents> implements ISharedCounter {
17
16
  constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
@@ -1 +1 @@
1
- {"version":3,"file":"counter.d.ts","sourceRo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framework/shared-object-base/internal");
12
12
  const snapshotFileName = "header";
13
13
  /**
14
14
  * {@inheritDoc ISharedCounter}
15
- * @legacy
16
- * @alpha
15
+ * @legacy @beta
17
16
  */
18
17
  class SharedCounter extends internal_4.SharedObject {
19
18
  constructor(id, runtime, attributes) {
@@ -1 +1 @@
1
- {"version":3,"file":"counter.js","sourceRoot":"","sources":["../src/counter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAM7D,0EAGqD;AACrD,oEAAqE;AAGrE,0EAGqD;AAsBrD,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAa,aACZ,SAAQ,uBAAkC;IAG1C,YACC,EAAU,EACV,OAA+B,EAC/B,UAA8B;QAE9B,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;QAG1C,WAAM,GAAW,CAAC,CAAC;IAF3B,CAAC;IAID;;OAEG;IACH,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,eAAuB;QACvC,uGAAuG;QACvG,wGAAwG;QACxG,IAAI,eAAe,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACrD,CAAC;QAED,MAAM,EAAE,GAAwB;YAC/B,IAAI,EAAE,WAAW;YACjB,eAAe;SACf,CAAC;QAEF,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QACpC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAEO,aAAa,CAAC,eAAuB;QAC5C,IAAI,CAAC,MAAM,IAAI,eAAe,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACO,aAAa,CAAC,UAA4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AoHC","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 {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type { ISharedCounter, ISharedCounterEvents } from \"./interfaces.js\";\n\n/**\n * Describes the operation (op) format for incrementing the {@link SharedCounter}.\n */\ninterface IIncrementOperation {\n\ttype: \"increment\";\n\tincrementAmount: number;\n}\n\n/**\n * @remarks Used in snapshotting.\n */\ninterface ICounterSnapshotFormat {\n\t/**\n\t * The value of the counter.\n\t */\n\tvalue: number;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc ISharedCounter}\n * @legacy\n * @alpha\n */\nexport class SharedCounter\n\textends SharedObject<ISharedCounterEvents>\n\timplements ISharedCounter\n{\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_counter_\");\n\t}\n\n\tprivate _value: number = 0;\n\n\t/**\n\t * {@inheritDoc ISharedCounter.value}\n\t */\n\tpublic get value(): number {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCounter.increment}\n\t */\n\tpublic increment(incrementAmount: number): void {\n\t\t// Incrementing by floating point numbers will be eventually inconsistent, since the order in which the\n\t\t// increments are applied affects the result. A more-robust solution would be required to support this.\n\t\tif (incrementAmount % 1 !== 0) {\n\t\t\tthrow new Error(\"Must increment by a whole number\");\n\t\t}\n\n\t\tconst op: IIncrementOperation = {\n\t\t\ttype: \"increment\",\n\t\t\tincrementAmount,\n\t\t};\n\n\t\tthis.incrementCore(incrementAmount);\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\tprivate incrementCore(incrementAmount: number): void {\n\t\tthis._value += incrementAmount;\n\t\tthis.emit(\"incremented\", incrementAmount, this._value);\n\t}\n\n\t/**\n\t * Create a summary for the counter.\n\t *\n\t * @returns The summary of the current state of the counter.\n\t */\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\t// Get a serializable form of data\n\t\tconst content: ICounterSnapshotFormat = {\n\t\t\tvalue: this.value,\n\t\t};\n\n\t\t// And then construct the summary for it\n\t\treturn createSingleBlobSummary(snapshotFileName, JSON.stringify(content));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst content = await readAndParse<ICounterSnapshotFormat>(storage, snapshotFileName);\n\n\t\tthis._value = content.value;\n\t}\n\n\t/**\n\t * Called when the object has disconnected from the delta stream.\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * Process a counter operation (op).\n\t *\n\t * @param message - The message to prepare.\n\t * @param local - Whether or not the message was sent by the local client.\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be `undefined`.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (message.type === MessageType.Operation && !local) {\n\t\t\tconst op = message.contents as IIncrementOperation;\n\n\t\t\tswitch (op.type) {\n\t\t\t\tcase \"increment\": {\n\t\t\t\t\tthis.incrementCore(op.incrementAmount);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(\"Unknown operation\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(op: unknown): void {\n\t\tconst counterOp = op as IIncrementOperation;\n\n\t\t// TODO: Clean up error code linter violations repo-wide.\n\n\t\tassert(counterOp.type === \"increment\", 0x3ec /* Op type is not increment */);\n\n\t\tthis.increment(counterOp.incrementAmount);\n\t}\n}\n"]}
1
+ {"version":3,"file":"counter.js","sourceRoot":"","sources":["../src/counter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAM7D,0EAGqD;AACrD,oEAAqE;AAGrE,0EAGqD;AAsBrD,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;GAGG;AACH,MAAa,aACZ,SAAQ,uBAAkC;IAG1C,YACC,EAAU,EACV,OAA+B,EAC/B,UAA8B;QAE9B,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;QAG1C,WAAM,GAAW,CAAC,CAAC;IAF3B,CAAC;IAID;;OAEG;IACH,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,eAAuB;QACvC,uGAAuG;QACvG,wGAAwG;QACxG,IAAI,eAAe,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACrD,CAAC;QAED,MAAM,EAAE,GAAwB;YAC/B,IAAI,EAAE,WAAW;YACjB,eAAe;SACf,CAAC;QAEF,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QACpC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAEO,aAAa,CAAC,e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QAEzD,IAAA,iBAAM,EAAC,SAAS,CAAC,IAAI,KAAK,WAAW,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAE7E,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;CACD;AApHD,sCAoHC","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 {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type { ISharedCounter, ISharedCounterEvents } from \"./interfaces.js\";\n\n/**\n * Describes the operation (op) format for incrementing the {@link SharedCounter}.\n */\ninterface IIncrementOperation {\n\ttype: \"increment\";\n\tincrementAmount: number;\n}\n\n/**\n * @remarks Used in snapshotting.\n */\ninterface ICounterSnapshotFormat {\n\t/**\n\t * The value of the counter.\n\t */\n\tvalue: number;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc ISharedCounter}\n * @legacy @beta\n */\nexport class SharedCounter\n\textends SharedObject<ISharedCounterEvents>\n\timplements ISharedCounter\n{\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_counter_\");\n\t}\n\n\tprivate _value: number = 0;\n\n\t/**\n\t * {@inheritDoc ISharedCounter.value}\n\t */\n\tpublic get value(): number {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCounter.increment}\n\t */\n\tpublic increment(incrementAmount: number): void {\n\t\t// Incrementing by floating point numbers will be eventually inconsistent, since the order in which the\n\t\t// increments are applied affects the result. A more-robust solution would be required to support this.\n\t\tif (incrementAmount % 1 !== 0) {\n\t\t\tthrow new Error(\"Must increment by a whole number\");\n\t\t}\n\n\t\tconst op: IIncrementOperation = {\n\t\t\ttype: \"increment\",\n\t\t\tincrementAmount,\n\t\t};\n\n\t\tthis.incrementCore(incrementAmount);\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\tprivate incrementCore(incrementAmount: number): void {\n\t\tthis._value += incrementAmount;\n\t\tthis.emit(\"incremented\", incrementAmount, this._value);\n\t}\n\n\t/**\n\t * Create a summary for the counter.\n\t *\n\t * @returns The summary of the current state of the counter.\n\t */\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\t// Get a serializable form of data\n\t\tconst content: ICounterSnapshotFormat = {\n\t\t\tvalue: this.value,\n\t\t};\n\n\t\t// And then construct the summary for it\n\t\treturn createSingleBlobSummary(snapshotFileName, JSON.stringify(content));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst content = await readAndParse<ICounterSnapshotFormat>(storage, snapshotFileName);\n\n\t\tthis._value = content.value;\n\t}\n\n\t/**\n\t * Called when the object has disconnected from the delta stream.\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * Process a counter operation (op).\n\t *\n\t * @param message - The message to prepare.\n\t * @param local - Whether or not the message was sent by the local client.\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be `undefined`.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (message.type === MessageType.Operation && !local) {\n\t\t\tconst op = message.contents as IIncrementOperation;\n\n\t\t\tswitch (op.type) {\n\t\t\t\tcase \"increment\": {\n\t\t\t\t\tthis.incrementCore(op.incrementAmount);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(\"Unknown operation\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(op: unknown): void {\n\t\tconst counterOp = op as IIncrementOperation;\n\n\t\t// TODO: Clean up error code linter violations repo-wide.\n\n\t\tassert(counterOp.type === \"increment\", 0x3ec /* Op type is not increment */);\n\n\t\tthis.increment(counterOp.incrementAmount);\n\t}\n}\n"]}
@@ -37,14 +37,12 @@ export declare class CounterFactory implements IChannelFactory<ISharedCounter> {
37
37
  }
38
38
  /**
39
39
  * Entrypoint for {@link ISharedCounter} creation.
40
- * @legacy
41
- * @alpha
40
+ * @legacy @beta
42
41
  */
43
42
  export declare const SharedCounter: import("@fluidframework/shared-object-base/internal").ISharedObjectKind<ISharedCounter> & import("@fluidframework/shared-object-base/internal").SharedObjectKind<ISharedCounter>;
44
43
  /**
45
44
  * Alias for {@link ISharedCounter} for compatibility.
46
- * @legacy
47
- * @alpha
45
+ * @legacy @beta
48
46
  */
49
47
  export type SharedCounter = ISharedCounter;
50
48
  //# sourceMappingURL=counterFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"counterFactory.d.ts","sourceRoot":"","sources":["../src/counterFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD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UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,cAAc,CAAC;IAM1B;;OAEG;IACI,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc;CAK3E;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,kLAAyD,CAAC;AAEpF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC"}
@@ -58,8 +58,7 @@ CounterFactory.Attributes = {
58
58
  };
59
59
  /**
60
60
  * Entrypoint for {@link ISharedCounter} creation.
61
- * @legacy
62
- * @alpha
61
+ * @legacy @beta
63
62
  */
64
63
  exports.SharedCounter = (0, internal_1.createSharedObjectKind)(CounterFactory);
65
64
  //# sourceMappingURL=counterFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"counterFactory.js","sourceRoot":"","sources":["../src/counterFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,0EAAqF;AAErF,6CAAmE;AAEnE,2DAAiD;AAEjD;;;;GAIG;AACH,MAAa,cAAc;IAe1B;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,cAAc,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,cAAc,CAAC,UAAU,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,OAAO,GAAG,IAAI,0BAAkB,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAChE,MAAM,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,OAAO,GAAG,IAAI,0BAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACtE,OAAO,CAAC,eAAe,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IAChB,CAAC;;AAlDF,wCAmDC;AAlDA;;GAEG;AACoB,mBAAI,GAAG,2CAA2C,CAAC;AAE1E;;GAEG;AACoB,yBAAU,GAAuB;IACvD,IAAI,EAAE,cAAc,CAAC,IAAI;IACzB,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,8BAAU;CAC1B,CAAC;AAwCH;;;;GAIG;AACU,QAAA,aAAa,GAAG,IAAA,iCAAsB,EAAiB,cAAc,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { createSharedObjectKind } from \"@fluidframework/shared-object-base/internal\";\n\nimport { SharedCounter as SharedCounterClass } from \"./counter.js\";\nimport type { ISharedCounter } from \"./interfaces.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedCounter}.\n *\n * @sealed\n */\nexport class CounterFactory implements IChannelFactory<ISharedCounter> {\n\t/**\n\t * Static value for {@link CounterFactory.\"type\"}.\n\t */\n\tpublic static readonly Type = \"https://graph.microsoft.com/types/counter\";\n\n\t/**\n\t * Static value for {@link CounterFactory.attributes}.\n\t */\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: CounterFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn CounterFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn CounterFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<ISharedCounter> {\n\t\tconst counter = new SharedCounterClass(id, runtime, attributes);\n\t\tawait counter.load(services);\n\t\treturn counter;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n\t */\n\tpublic create(document: IFluidDataStoreRuntime, id: string): ISharedCounter {\n\t\tconst counter = new SharedCounterClass(id, document, this.attributes);\n\t\tcounter.initializeLocal();\n\t\treturn counter;\n\t}\n}\n\n/**\n * Entrypoint for {@link ISharedCounter} creation.\n * @legacy\n * @alpha\n */\nexport const SharedCounter = createSharedObjectKind<ISharedCounter>(CounterFactory);\n\n/**\n * Alias for {@link ISharedCounter} for compatibility.\n * @legacy\n * @alpha\n */\nexport type SharedCounter = ISharedCounter;\n"]}
1
+ {"version":3,"file":"counterFactory.js","sourceRoot":"","sources":["../src/counterFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,0EAAqF;AAErF,6CAAmE;AAEnE,2DAAiD;AAEjD;;;;GAIG;AACH,MAAa,cAAc;IAe1B;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,cAAc,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,cAAc,CAAC,UAAU,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,OAAO,GAAG,IAAI,0BAAkB,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAChE,MAAM,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,OAAO,GAAG,IAAI,0BAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACtE,OAAO,CAAC,eAAe,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IAChB,CAAC;;AAlDF,wCAmDC;AAlDA;;GAEG;AACoB,mBAAI,GAAG,2CAA2C,CAAC;AAE1E;;GAEG;AACoB,yBAAU,GAAuB;IACvD,IAAI,EAAE,cAAc,CAAC,IAAI;IACzB,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,8BAAU;CAC1B,CAAC;AAwCH;;;GAGG;AACU,QAAA,aAAa,GAAG,IAAA,iCAAsB,EAAiB,cAAc,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { createSharedObjectKind } from \"@fluidframework/shared-object-base/internal\";\n\nimport { SharedCounter as SharedCounterClass } from \"./counter.js\";\nimport type { ISharedCounter } from \"./interfaces.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedCounter}.\n *\n * @sealed\n */\nexport class CounterFactory implements IChannelFactory<ISharedCounter> {\n\t/**\n\t * Static value for {@link CounterFactory.\"type\"}.\n\t */\n\tpublic static readonly Type = \"https://graph.microsoft.com/types/counter\";\n\n\t/**\n\t * Static value for {@link CounterFactory.attributes}.\n\t */\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: CounterFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn CounterFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn CounterFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<ISharedCounter> {\n\t\tconst counter = new SharedCounterClass(id, runtime, attributes);\n\t\tawait counter.load(services);\n\t\treturn counter;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n\t */\n\tpublic create(document: IFluidDataStoreRuntime, id: string): ISharedCounter {\n\t\tconst counter = new SharedCounterClass(id, document, this.attributes);\n\t\tcounter.initializeLocal();\n\t\treturn counter;\n\t}\n}\n\n/**\n * Entrypoint for {@link ISharedCounter} creation.\n * @legacy @beta\n */\nexport const SharedCounter = createSharedObjectKind<ISharedCounter>(CounterFactory);\n\n/**\n * Alias for {@link ISharedCounter} for compatibility.\n * @legacy @beta\n */\nexport type SharedCounter = ISharedCounter;\n"]}
@@ -5,8 +5,7 @@
5
5
  import type { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base/internal";
6
6
  /**
7
7
  * Events sent by {@link ISharedCounter}.
8
- * @legacy
9
- * @alpha
8
+ * @legacy @beta
10
9
  */
11
10
  export interface ISharedCounterEvents extends ISharedObjectEvents {
12
11
  /**
@@ -56,8 +55,7 @@ export interface ISharedCounterEvents extends ISharedObjectEvents {
56
55
  * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);
57
56
  * });
58
57
  * ```
59
- * @legacy
60
- * @alpha
58
+ * @legacy @beta
61
59
  */
62
60
  export interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {
63
61
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,6CAA6C,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAChE;;;;;;;OAOG;IACH,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,OAAE;CACtF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,WAAW,cAAe,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IAC1E;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,SAAS,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,6CAA6C,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAChE;;;;;;;OAOG;IACH,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,OAAE;CACtF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,WAAW,cAAe,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IAC1E;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,SAAS,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tISharedObject,\n\tISharedObjectEvents,\n} from \"@fluidframework/shared-object-base/internal\";\n\n/**\n * Events sent by {@link ISharedCounter}.\n * @legacy\n * @alpha\n */\nexport interface ISharedCounterEvents extends ISharedObjectEvents {\n\t/**\n\t * This event is raised when the counter is incremented or decremented.\n\t *\n\t * @param event - The event name.\n\t * @param listener - An event listener.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"incremented\", listener: (incrementAmount: number, newValue: number) => void);\n}\n\n/**\n * A shared object that holds a number that can be incremented or decremented.\n *\n * @remarks Note that `SharedCounter` only operates on integer values. This is validated at runtime.\n *\n * @example Creating a `SharedCounter`\n *\n * First, get the factory and call {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n * with a runtime and string ID:\n *\n * ```typescript\n * const factory = SharedCounter.getFactory();\n * const counter = factory.create(this.runtime, id);\n * ```\n *\n * The initial value of a new `SharedCounter` is 0.\n * If you wish to initialize the counter to a different value, you may call {@link ISharedCounter.increment} before\n * attaching the Container, or before inserting it into an existing shared object.\n *\n * @example Using the `SharedCounter`\n *\n * Once created, you can call {@link ISharedCounter.increment} to modify the value with either a positive or\n * negative number:\n *\n * ```typescript\n * counter.increment(10); // add 10 to the counter value\n * counter.increment(-5); // subtract 5 from the counter value\n * ```\n *\n * To observe changes to the value (including those from remote clients), register for the\n * {@link ISharedCounterEvents | incremented} event:\n *\n * ```typescript\n * counter.on(\"incremented\", (incrementAmount, newValue) => {\n * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);\n * });\n * ```\n * @legacy\n * @alpha\n */\nexport interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {\n\t/**\n\t * The counter value.\n\t *\n\t * @remarks Must be a whole number.\n\t */\n\tvalue: number;\n\n\t/**\n\t * Increments or decrements the value.\n\t * Must only increment or decrement by a whole number value.\n\t *\n\t * @param incrementAmount - A whole number to increment or decrement by.\n\t */\n\tincrement(incrementAmount: number): void;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tISharedObject,\n\tISharedObjectEvents,\n} from \"@fluidframework/shared-object-base/internal\";\n\n/**\n * Events sent by {@link ISharedCounter}.\n * @legacy @beta\n */\nexport interface ISharedCounterEvents extends ISharedObjectEvents {\n\t/**\n\t * This event is raised when the counter is incremented or decremented.\n\t *\n\t * @param event - The event name.\n\t * @param listener - An event listener.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"incremented\", listener: (incrementAmount: number, newValue: number) => void);\n}\n\n/**\n * A shared object that holds a number that can be incremented or decremented.\n *\n * @remarks Note that `SharedCounter` only operates on integer values. This is validated at runtime.\n *\n * @example Creating a `SharedCounter`\n *\n * First, get the factory and call {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n * with a runtime and string ID:\n *\n * ```typescript\n * const factory = SharedCounter.getFactory();\n * const counter = factory.create(this.runtime, id);\n * ```\n *\n * The initial value of a new `SharedCounter` is 0.\n * If you wish to initialize the counter to a different value, you may call {@link ISharedCounter.increment} before\n * attaching the Container, or before inserting it into an existing shared object.\n *\n * @example Using the `SharedCounter`\n *\n * Once created, you can call {@link ISharedCounter.increment} to modify the value with either a positive or\n * negative number:\n *\n * ```typescript\n * counter.increment(10); // add 10 to the counter value\n * counter.increment(-5); // subtract 5 from the counter value\n * ```\n *\n * To observe changes to the value (including those from remote clients), register for the\n * {@link ISharedCounterEvents | incremented} event:\n *\n * ```typescript\n * counter.on(\"incremented\", (incrementAmount, newValue) => {\n * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);\n * });\n * ```\n * @legacy @beta\n */\nexport interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {\n\t/**\n\t * The counter value.\n\t *\n\t * @remarks Must be a whole number.\n\t */\n\tvalue: number;\n\n\t/**\n\t * Increments or decrements the value.\n\t * Must only increment or decrement by a whole number value.\n\t *\n\t * @param incrementAmount - A whole number to increment or decrement by.\n\t */\n\tincrement(incrementAmount: number): void;\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/counter";
8
- export declare const pkgVersion = "2.53.0";
8
+ export declare const pkgVersion = "2.60.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/counter";
11
- exports.pkgVersion = "2.53.0";
11
+ exports.pkgVersion = "2.60.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,yBAAyB,CAAC;AACpC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/counter\";\nexport const pkgVersion = \"2.53.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,yBAAyB,CAAC;AACpC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/counter\";\nexport const pkgVersion = \"2.60.0\";\n"]}
package/lib/counter.d.ts CHANGED
@@ -10,8 +10,7 @@ import { SharedObject } from "@fluidframework/shared-object-base/internal";
10
10
  import type { ISharedCounter, ISharedCounterEvents } from "./interfaces.js";
11
11
  /**
12
12
  * {@inheritDoc ISharedCounter}
13
- * @legacy
14
- * @alpha
13
+ * @legacy @beta
15
14
  */
16
15
  export declare class SharedCounter extends SharedObject<ISharedCounterEvents> implements ISharedCounter {
17
16
  constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
@@ -1 +1 @@
1
- {"version":3,"file":"counter.d.ts","sourceRoot":"","sources":["../src/counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEN,KAAK,yBAAyB,EAC9B,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EACN,YAAY,EAEZ,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAsB5E;;;;GAIG;AACH,qBAAa,aACZ,SAAQ,YAAY,CAAC,oBAAoB,CACzC,YAAW,cAAc;gBAGxB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,UAAU,EAAE,kBAAkB;IAK/B,OAAO,CAAC,MAAM,CAAa;IAE3B;;OAEG;IACH,IAAW,KAAK,IAAI,MAAM,CAEzB;IAED;;OAEG;IACI,SAAS,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI;IAgB/C,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,aAAa;IAKrB;;;;OAIG;IACH,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;IAU5E;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxE;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;IAE9B;;;;;;;OAOG;IACH,SAAS,CAAC,WAAW,CACpB,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO,GACtB,IAAI;IAkBP;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI;CAS3C"}
package/lib/counter.js CHANGED
@@ -9,8 +9,7 @@ import { SharedObject, createSingleBlobSummary, } from "@fluidframework/shared-o
9
9
  const snapshotFileName = "header";
10
10
  /**
11
11
  * {@inheritDoc ISharedCounter}
12
- * @legacy
13
- * @alpha
12
+ * @legacy @beta
14
13
  */
15
14
  export class SharedCounter extends SharedObject {
16
15
  constructor(id, runtime, attributes) {
@@ -1 +1 @@
1
- {"version":3,"file":"counter.js","sourceRoot":"","sources":["../src/counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAM7D,OAAO,EACN,WAAW,GAEX,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAGrE,OAAO,EACN,YAAY,EACZ,uBAAuB,GACvB,MAAM,6CAA6C,CAAC;AAsBrD,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAM,OAAO,aACZ,SAAQ,YAAkC;IAG1C,YACC,EAAU,EACV,OAA+B,EAC/B,UAA8B;QAE9B,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;QAG1C,WAAM,GAAW,CAAC,CAAC;IAF3B,CAA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KAAK,EAAE,CAAC;YACtD,MAAM,EAAE,GAAG,OAAO,CAAC,QAA+B,CAAC;YAEnD,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;gBACjB,KAAK,WAAW,CAAC,CAAC,CAAC;oBAClB,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC;oBACvC,MAAM;gBACP,CAAC;gBAED,OAAO,CAAC,CAAC,CAAC;oBACT,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;gBACtC,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED;;OAEG;IACO,cAAc,CAAC,EAAW;QACnC,MAAM,SAAS,GAAG,EAAyB,CAAC;QAE5C,yDAAyD;QAEzD,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,WAAW,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAE7E,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;CACD","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 {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type { ISharedCounter, ISharedCounterEvents } from \"./interfaces.js\";\n\n/**\n * Describes the operation (op) format for incrementing the {@link SharedCounter}.\n */\ninterface IIncrementOperation {\n\ttype: \"increment\";\n\tincrementAmount: number;\n}\n\n/**\n * @remarks Used in snapshotting.\n */\ninterface ICounterSnapshotFormat {\n\t/**\n\t * The value of the counter.\n\t */\n\tvalue: number;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc ISharedCounter}\n * @legacy\n * @alpha\n */\nexport class SharedCounter\n\textends SharedObject<ISharedCounterEvents>\n\timplements ISharedCounter\n{\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_counter_\");\n\t}\n\n\tprivate _value: number = 0;\n\n\t/**\n\t * {@inheritDoc ISharedCounter.value}\n\t */\n\tpublic get value(): number {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCounter.increment}\n\t */\n\tpublic increment(incrementAmount: number): void {\n\t\t// Incrementing by floating point numbers will be eventually inconsistent, since the order in which the\n\t\t// increments are applied affects the result. A more-robust solution would be required to support this.\n\t\tif (incrementAmount % 1 !== 0) {\n\t\t\tthrow new Error(\"Must increment by a whole number\");\n\t\t}\n\n\t\tconst op: IIncrementOperation = {\n\t\t\ttype: \"increment\",\n\t\t\tincrementAmount,\n\t\t};\n\n\t\tthis.incrementCore(incrementAmount);\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\tprivate incrementCore(incrementAmount: number): void {\n\t\tthis._value += incrementAmount;\n\t\tthis.emit(\"incremented\", incrementAmount, this._value);\n\t}\n\n\t/**\n\t * Create a summary for the counter.\n\t *\n\t * @returns The summary of the current state of the counter.\n\t */\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\t// Get a serializable form of data\n\t\tconst content: ICounterSnapshotFormat = {\n\t\t\tvalue: this.value,\n\t\t};\n\n\t\t// And then construct the summary for it\n\t\treturn createSingleBlobSummary(snapshotFileName, JSON.stringify(content));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst content = await readAndParse<ICounterSnapshotFormat>(storage, snapshotFileName);\n\n\t\tthis._value = content.value;\n\t}\n\n\t/**\n\t * Called when the object has disconnected from the delta stream.\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * Process a counter operation (op).\n\t *\n\t * @param message - The message to prepare.\n\t * @param local - Whether or not the message was sent by the local client.\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be `undefined`.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (message.type === MessageType.Operation && !local) {\n\t\t\tconst op = message.contents as IIncrementOperation;\n\n\t\t\tswitch (op.type) {\n\t\t\t\tcase \"increment\": {\n\t\t\t\t\tthis.incrementCore(op.incrementAmount);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(\"Unknown operation\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(op: unknown): void {\n\t\tconst counterOp = op as IIncrementOperation;\n\n\t\t// TODO: Clean up error code linter violations repo-wide.\n\n\t\tassert(counterOp.type === \"increment\", 0x3ec /* Op type is not increment */);\n\n\t\tthis.increment(counterOp.incrementAmount);\n\t}\n}\n"]}
1
+ {"version":3,"file":"counter.js","sourceRoot":"","sources":["../src/counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAM7D,OAAO,EACN,WAAW,GAEX,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAGrE,OAAO,EAC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,MAAM,YAAY,CAAyB,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAEtF,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAC7B,CAAC;IAED;;OAEG;IACO,YAAY,KAAU,CAAC;IAEjC;;;;;;;OAOG;IACO,WAAW,CACpB,OAAkC,EAClC,KAAc,EACd,eAAwB;QAExB,wEAAwE;QACxE,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,CAAC;YACtD,MAAM,EAAE,GAAG,OAAO,CAAC,QAA+B,CAAC;YAEnD,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;gBACjB,KAAK,WAAW,CAAC,CAAC,CAAC;oBAClB,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC;oBACvC,MAAM;gBACP,CAAC;gBAED,OAAO,CAAC,CAAC,CAAC;oBACT,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;gBACtC,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED;;OAEG;IACO,cAAc,CAAC,EAAW;QACnC,MAAM,SAAS,GAAG,EAAyB,CAAC;QAE5C,yDAAyD;QAEzD,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,WAAW,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAE7E,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;CACD","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 {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type { ISharedCounter, ISharedCounterEvents } from \"./interfaces.js\";\n\n/**\n * Describes the operation (op) format for incrementing the {@link SharedCounter}.\n */\ninterface IIncrementOperation {\n\ttype: \"increment\";\n\tincrementAmount: number;\n}\n\n/**\n * @remarks Used in snapshotting.\n */\ninterface ICounterSnapshotFormat {\n\t/**\n\t * The value of the counter.\n\t */\n\tvalue: number;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc ISharedCounter}\n * @legacy @beta\n */\nexport class SharedCounter\n\textends SharedObject<ISharedCounterEvents>\n\timplements ISharedCounter\n{\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_counter_\");\n\t}\n\n\tprivate _value: number = 0;\n\n\t/**\n\t * {@inheritDoc ISharedCounter.value}\n\t */\n\tpublic get value(): number {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCounter.increment}\n\t */\n\tpublic increment(incrementAmount: number): void {\n\t\t// Incrementing by floating point numbers will be eventually inconsistent, since the order in which the\n\t\t// increments are applied affects the result. A more-robust solution would be required to support this.\n\t\tif (incrementAmount % 1 !== 0) {\n\t\t\tthrow new Error(\"Must increment by a whole number\");\n\t\t}\n\n\t\tconst op: IIncrementOperation = {\n\t\t\ttype: \"increment\",\n\t\t\tincrementAmount,\n\t\t};\n\n\t\tthis.incrementCore(incrementAmount);\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\tprivate incrementCore(incrementAmount: number): void {\n\t\tthis._value += incrementAmount;\n\t\tthis.emit(\"incremented\", incrementAmount, this._value);\n\t}\n\n\t/**\n\t * Create a summary for the counter.\n\t *\n\t * @returns The summary of the current state of the counter.\n\t */\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\t// Get a serializable form of data\n\t\tconst content: ICounterSnapshotFormat = {\n\t\t\tvalue: this.value,\n\t\t};\n\n\t\t// And then construct the summary for it\n\t\treturn createSingleBlobSummary(snapshotFileName, JSON.stringify(content));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst content = await readAndParse<ICounterSnapshotFormat>(storage, snapshotFileName);\n\n\t\tthis._value = content.value;\n\t}\n\n\t/**\n\t * Called when the object has disconnected from the delta stream.\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * Process a counter operation (op).\n\t *\n\t * @param message - The message to prepare.\n\t * @param local - Whether or not the message was sent by the local client.\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be `undefined`.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (message.type === MessageType.Operation && !local) {\n\t\t\tconst op = message.contents as IIncrementOperation;\n\n\t\t\tswitch (op.type) {\n\t\t\t\tcase \"increment\": {\n\t\t\t\t\tthis.incrementCore(op.incrementAmount);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(\"Unknown operation\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(op: unknown): void {\n\t\tconst counterOp = op as IIncrementOperation;\n\n\t\t// TODO: Clean up error code linter violations repo-wide.\n\n\t\tassert(counterOp.type === \"increment\", 0x3ec /* Op type is not increment */);\n\n\t\tthis.increment(counterOp.incrementAmount);\n\t}\n}\n"]}
@@ -37,14 +37,12 @@ export declare class CounterFactory implements IChannelFactory<ISharedCounter> {
37
37
  }
38
38
  /**
39
39
  * Entrypoint for {@link ISharedCounter} creation.
40
- * @legacy
41
- * @alpha
40
+ * @legacy @beta
42
41
  */
43
42
  export declare const SharedCounter: import("@fluidframework/shared-object-base/internal").ISharedObjectKind<ISharedCounter> & import("@fluidframework/shared-object-base/internal").SharedObjectKind<ISharedCounter>;
44
43
  /**
45
44
  * Alias for {@link ISharedCounter} for compatibility.
46
- * @legacy
47
- * @alpha
45
+ * @legacy @beta
48
46
  */
49
47
  export type SharedCounter = ISharedCounter;
50
48
  //# sourceMappingURL=counterFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"counterFactory.d.ts","sourceRoot":"","sources":["../src/counterFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;GAIG;AACH,qBAAa,cAAe,YAAW,eAAe,CAAC,cAAc,CAAC;IACrE;;OAEG;IACH,gBAAuB,IAAI,+CAA+C;IAE1E;;OAEG;IACH,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED;;OAEG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,cAAc,CAAC;IAM1B;;OAEG;IACI,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc;CAK3E;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,kLAAyD,CAAC;AAEpF;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC"}
1
+ {"version":3,"file":"counterFactory.d.ts","sourceRoot":"","sources":["../src/counterFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;GAIG;AACH,qBAAa,cAAe,YAAW,eAAe,CAAC,cAAc,CAAC;IACrE;;OAEG;IACH,gBAAuB,IAAI,+CAA+C;IAE1E;;OAEG;IACH,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED;;OAEG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,cAAc,CAAC;IAM1B;;OAEG;IACI,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc;CAK3E;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,kLAAyD,CAAC;AAEpF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC"}
@@ -54,8 +54,7 @@ CounterFactory.Attributes = {
54
54
  };
55
55
  /**
56
56
  * Entrypoint for {@link ISharedCounter} creation.
57
- * @legacy
58
- * @alpha
57
+ * @legacy @beta
59
58
  */
60
59
  export const SharedCounter = createSharedObjectKind(CounterFactory);
61
60
  //# sourceMappingURL=counterFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"counterFactory.js","sourceRoot":"","sources":["../src/counterFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,OAAO,cAAc;IAe1B;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,cAAc,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,cAAc,CAAC,UAAU,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAChE,MAAM,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACtE,OAAO,CAAC,eAAe,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IAChB,CAAC;;AAjDD;;GAEG;AACoB,mBAAI,GAAG,2CAA2C,CAAC;AAE1E;;GAEG;AACoB,yBAAU,GAAuB;IACvD,IAAI,EAAE,cAAc,CAAC,IAAI;IACzB,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,UAAU;CAC1B,CAAC;AAwCH;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAiB,cAAc,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { createSharedObjectKind } from \"@fluidframework/shared-object-base/internal\";\n\nimport { SharedCounter as SharedCounterClass } from \"./counter.js\";\nimport type { ISharedCounter } from \"./interfaces.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedCounter}.\n *\n * @sealed\n */\nexport class CounterFactory implements IChannelFactory<ISharedCounter> {\n\t/**\n\t * Static value for {@link CounterFactory.\"type\"}.\n\t */\n\tpublic static readonly Type = \"https://graph.microsoft.com/types/counter\";\n\n\t/**\n\t * Static value for {@link CounterFactory.attributes}.\n\t */\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: CounterFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn CounterFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn CounterFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<ISharedCounter> {\n\t\tconst counter = new SharedCounterClass(id, runtime, attributes);\n\t\tawait counter.load(services);\n\t\treturn counter;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n\t */\n\tpublic create(document: IFluidDataStoreRuntime, id: string): ISharedCounter {\n\t\tconst counter = new SharedCounterClass(id, document, this.attributes);\n\t\tcounter.initializeLocal();\n\t\treturn counter;\n\t}\n}\n\n/**\n * Entrypoint for {@link ISharedCounter} creation.\n * @legacy\n * @alpha\n */\nexport const SharedCounter = createSharedObjectKind<ISharedCounter>(CounterFactory);\n\n/**\n * Alias for {@link ISharedCounter} for compatibility.\n * @legacy\n * @alpha\n */\nexport type SharedCounter = ISharedCounter;\n"]}
1
+ {"version":3,"file":"counterFactory.js","sourceRoot":"","sources":["../src/counterFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,OAAO,cAAc;IAe1B;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,cAAc,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,cAAc,CAAC,UAAU,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAChE,MAAM,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACtE,OAAO,CAAC,eAAe,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IAChB,CAAC;;AAjDD;;GAEG;AACoB,mBAAI,GAAG,2CAA2C,CAAC;AAE1E;;GAEG;AACoB,yBAAU,GAAuB;IACvD,IAAI,EAAE,cAAc,CAAC,IAAI;IACzB,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,UAAU;CAC1B,CAAC;AAwCH;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAiB,cAAc,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { createSharedObjectKind } from \"@fluidframework/shared-object-base/internal\";\n\nimport { SharedCounter as SharedCounterClass } from \"./counter.js\";\nimport type { ISharedCounter } from \"./interfaces.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedCounter}.\n *\n * @sealed\n */\nexport class CounterFactory implements IChannelFactory<ISharedCounter> {\n\t/**\n\t * Static value for {@link CounterFactory.\"type\"}.\n\t */\n\tpublic static readonly Type = \"https://graph.microsoft.com/types/counter\";\n\n\t/**\n\t * Static value for {@link CounterFactory.attributes}.\n\t */\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: CounterFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn CounterFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn CounterFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<ISharedCounter> {\n\t\tconst counter = new SharedCounterClass(id, runtime, attributes);\n\t\tawait counter.load(services);\n\t\treturn counter;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n\t */\n\tpublic create(document: IFluidDataStoreRuntime, id: string): ISharedCounter {\n\t\tconst counter = new SharedCounterClass(id, document, this.attributes);\n\t\tcounter.initializeLocal();\n\t\treturn counter;\n\t}\n}\n\n/**\n * Entrypoint for {@link ISharedCounter} creation.\n * @legacy @beta\n */\nexport const SharedCounter = createSharedObjectKind<ISharedCounter>(CounterFactory);\n\n/**\n * Alias for {@link ISharedCounter} for compatibility.\n * @legacy @beta\n */\nexport type SharedCounter = ISharedCounter;\n"]}
@@ -5,8 +5,7 @@
5
5
  import type { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base/internal";
6
6
  /**
7
7
  * Events sent by {@link ISharedCounter}.
8
- * @legacy
9
- * @alpha
8
+ * @legacy @beta
10
9
  */
11
10
  export interface ISharedCounterEvents extends ISharedObjectEvents {
12
11
  /**
@@ -56,8 +55,7 @@ export interface ISharedCounterEvents extends ISharedObjectEvents {
56
55
  * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);
57
56
  * });
58
57
  * ```
59
- * @legacy
60
- * @alpha
58
+ * @legacy @beta
61
59
  */
62
60
  export interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {
63
61
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,6CAA6C,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAChE;;;;;;;OAOG;IACH,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,OAAE;CACtF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,WAAW,cAAe,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IAC1E;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,SAAS,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,6CAA6C,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAChE;;;;;;;OAOG;IACH,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,OAAE;CACtF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,WAAW,cAAe,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IAC1E;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,SAAS,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tISharedObject,\n\tISharedObjectEvents,\n} from \"@fluidframework/shared-object-base/internal\";\n\n/**\n * Events sent by {@link ISharedCounter}.\n * @legacy\n * @alpha\n */\nexport interface ISharedCounterEvents extends ISharedObjectEvents {\n\t/**\n\t * This event is raised when the counter is incremented or decremented.\n\t *\n\t * @param event - The event name.\n\t * @param listener - An event listener.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"incremented\", listener: (incrementAmount: number, newValue: number) => void);\n}\n\n/**\n * A shared object that holds a number that can be incremented or decremented.\n *\n * @remarks Note that `SharedCounter` only operates on integer values. This is validated at runtime.\n *\n * @example Creating a `SharedCounter`\n *\n * First, get the factory and call {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n * with a runtime and string ID:\n *\n * ```typescript\n * const factory = SharedCounter.getFactory();\n * const counter = factory.create(this.runtime, id);\n * ```\n *\n * The initial value of a new `SharedCounter` is 0.\n * If you wish to initialize the counter to a different value, you may call {@link ISharedCounter.increment} before\n * attaching the Container, or before inserting it into an existing shared object.\n *\n * @example Using the `SharedCounter`\n *\n * Once created, you can call {@link ISharedCounter.increment} to modify the value with either a positive or\n * negative number:\n *\n * ```typescript\n * counter.increment(10); // add 10 to the counter value\n * counter.increment(-5); // subtract 5 from the counter value\n * ```\n *\n * To observe changes to the value (including those from remote clients), register for the\n * {@link ISharedCounterEvents | incremented} event:\n *\n * ```typescript\n * counter.on(\"incremented\", (incrementAmount, newValue) => {\n * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);\n * });\n * ```\n * @legacy\n * @alpha\n */\nexport interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {\n\t/**\n\t * The counter value.\n\t *\n\t * @remarks Must be a whole number.\n\t */\n\tvalue: number;\n\n\t/**\n\t * Increments or decrements the value.\n\t * Must only increment or decrement by a whole number value.\n\t *\n\t * @param incrementAmount - A whole number to increment or decrement by.\n\t */\n\tincrement(incrementAmount: number): void;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tISharedObject,\n\tISharedObjectEvents,\n} from \"@fluidframework/shared-object-base/internal\";\n\n/**\n * Events sent by {@link ISharedCounter}.\n * @legacy @beta\n */\nexport interface ISharedCounterEvents extends ISharedObjectEvents {\n\t/**\n\t * This event is raised when the counter is incremented or decremented.\n\t *\n\t * @param event - The event name.\n\t * @param listener - An event listener.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"incremented\", listener: (incrementAmount: number, newValue: number) => void);\n}\n\n/**\n * A shared object that holds a number that can be incremented or decremented.\n *\n * @remarks Note that `SharedCounter` only operates on integer values. This is validated at runtime.\n *\n * @example Creating a `SharedCounter`\n *\n * First, get the factory and call {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n * with a runtime and string ID:\n *\n * ```typescript\n * const factory = SharedCounter.getFactory();\n * const counter = factory.create(this.runtime, id);\n * ```\n *\n * The initial value of a new `SharedCounter` is 0.\n * If you wish to initialize the counter to a different value, you may call {@link ISharedCounter.increment} before\n * attaching the Container, or before inserting it into an existing shared object.\n *\n * @example Using the `SharedCounter`\n *\n * Once created, you can call {@link ISharedCounter.increment} to modify the value with either a positive or\n * negative number:\n *\n * ```typescript\n * counter.increment(10); // add 10 to the counter value\n * counter.increment(-5); // subtract 5 from the counter value\n * ```\n *\n * To observe changes to the value (including those from remote clients), register for the\n * {@link ISharedCounterEvents | incremented} event:\n *\n * ```typescript\n * counter.on(\"incremented\", (incrementAmount, newValue) => {\n * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);\n * });\n * ```\n * @legacy @beta\n */\nexport interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {\n\t/**\n\t * The counter value.\n\t *\n\t * @remarks Must be a whole number.\n\t */\n\tvalue: number;\n\n\t/**\n\t * Increments or decrements the value.\n\t * Must only increment or decrement by a whole number value.\n\t *\n\t * @param incrementAmount - A whole number to increment or decrement by.\n\t */\n\tincrement(incrementAmount: number): void;\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/counter";
8
- export declare const pkgVersion = "2.53.0";
8
+ export declare const pkgVersion = "2.60.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/counter";
8
- export const pkgVersion = "2.53.0";
8
+ export const pkgVersion = "2.60.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,yBAAyB,CAAC;AACjD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/counter\";\nexport const pkgVersion = \"2.53.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,yBAAyB,CAAC;AACjD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/counter\";\nexport const pkgVersion = \"2.60.0\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/counter",
3
- "version": "2.53.0",
3
+ "version": "2.60.0",
4
4
  "description": "Counter DDS",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,25 +69,25 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluidframework/core-interfaces": "~2.53.0",
73
- "@fluidframework/core-utils": "~2.53.0",
74
- "@fluidframework/datastore-definitions": "~2.53.0",
75
- "@fluidframework/driver-definitions": "~2.53.0",
76
- "@fluidframework/driver-utils": "~2.53.0",
77
- "@fluidframework/runtime-definitions": "~2.53.0",
78
- "@fluidframework/shared-object-base": "~2.53.0"
72
+ "@fluidframework/core-interfaces": "~2.60.0",
73
+ "@fluidframework/core-utils": "~2.60.0",
74
+ "@fluidframework/datastore-definitions": "~2.60.0",
75
+ "@fluidframework/driver-definitions": "~2.60.0",
76
+ "@fluidframework/driver-utils": "~2.60.0",
77
+ "@fluidframework/runtime-definitions": "~2.60.0",
78
+ "@fluidframework/shared-object-base": "~2.60.0"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@arethetypeswrong/cli": "^0.17.1",
82
82
  "@biomejs/biome": "~1.9.3",
83
- "@fluid-internal/mocha-test-setup": "~2.53.0",
83
+ "@fluid-internal/mocha-test-setup": "~2.60.0",
84
84
  "@fluid-tools/build-cli": "^0.57.0",
85
85
  "@fluidframework/build-common": "^2.0.3",
86
86
  "@fluidframework/build-tools": "^0.57.0",
87
- "@fluidframework/container-definitions": "~2.53.0",
88
- "@fluidframework/counter-previous": "npm:@fluidframework/counter@2.52.0",
89
- "@fluidframework/eslint-config-fluid": "^5.7.4",
90
- "@fluidframework/test-runtime-utils": "~2.53.0",
87
+ "@fluidframework/container-definitions": "~2.60.0",
88
+ "@fluidframework/counter-previous": "npm:@fluidframework/counter@2.53.0",
89
+ "@fluidframework/eslint-config-fluid": "^6.0.0",
90
+ "@fluidframework/test-runtime-utils": "~2.60.0",
91
91
  "@microsoft/api-extractor": "7.52.8",
92
92
  "@types/mocha": "^10.0.10",
93
93
  "@types/node": "^18.19.0",
package/src/counter.ts CHANGED
@@ -45,8 +45,7 @@ const snapshotFileName = "header";
45
45
 
46
46
  /**
47
47
  * {@inheritDoc ISharedCounter}
48
- * @legacy
49
- * @alpha
48
+ * @legacy @beta
50
49
  */
51
50
  export class SharedCounter
52
51
  extends SharedObject<ISharedCounterEvents>
@@ -75,14 +75,12 @@ export class CounterFactory implements IChannelFactory<ISharedCounter> {
75
75
 
76
76
  /**
77
77
  * Entrypoint for {@link ISharedCounter} creation.
78
- * @legacy
79
- * @alpha
78
+ * @legacy @beta
80
79
  */
81
80
  export const SharedCounter = createSharedObjectKind<ISharedCounter>(CounterFactory);
82
81
 
83
82
  /**
84
83
  * Alias for {@link ISharedCounter} for compatibility.
85
- * @legacy
86
- * @alpha
84
+ * @legacy @beta
87
85
  */
88
86
  export type SharedCounter = ISharedCounter;
package/src/interfaces.ts CHANGED
@@ -10,8 +10,7 @@ import type {
10
10
 
11
11
  /**
12
12
  * Events sent by {@link ISharedCounter}.
13
- * @legacy
14
- * @alpha
13
+ * @legacy @beta
15
14
  */
16
15
  export interface ISharedCounterEvents extends ISharedObjectEvents {
17
16
  /**
@@ -62,8 +61,7 @@ export interface ISharedCounterEvents extends ISharedObjectEvents {
62
61
  * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);
63
62
  * });
64
63
  * ```
65
- * @legacy
66
- * @alpha
64
+ * @legacy @beta
67
65
  */
68
66
  export interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {
69
67
  /**
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/counter";
9
- export const pkgVersion = "2.53.0";
9
+ export const pkgVersion = "2.60.0";