@fluidframework/counter 2.0.0-dev.7.2.0.203917 → 2.0.0-dev.7.2.0.205722

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.
@@ -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.0.0-dev.7.2.0.203917";
8
+ export declare const pkgVersion = "2.0.0-dev.7.2.0.205722";
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.0.0-dev.7.2.0.203917";
11
+ exports.pkgVersion = "2.0.0-dev.7.2.0.205722";
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,wBAAwB,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.0.0-dev.7.2.0.203917\";\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,wBAAwB,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.0.0-dev.7.2.0.205722\";\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.0.0-dev.7.2.0.203917";
8
+ export declare const pkgVersion = "2.0.0-dev.7.2.0.205722";
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.0.0-dev.7.2.0.203917";
8
+ export const pkgVersion = "2.0.0-dev.7.2.0.205722";
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,wBAAwB,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.0.0-dev.7.2.0.203917\";\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,wBAAwB,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.0.0-dev.7.2.0.205722\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/counter",
3
- "version": "2.0.0-dev.7.2.0.203917",
3
+ "version": "2.0.0-dev.7.2.0.205722",
4
4
  "description": "Counter DDS",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -35,22 +35,22 @@
35
35
  "temp-directory": "nyc/.nyc_output"
36
36
  },
37
37
  "dependencies": {
38
- "@fluidframework/core-interfaces": "2.0.0-dev.7.2.0.203917",
39
- "@fluidframework/core-utils": "2.0.0-dev.7.2.0.203917",
40
- "@fluidframework/datastore-definitions": "2.0.0-dev.7.2.0.203917",
41
- "@fluidframework/driver-utils": "2.0.0-dev.7.2.0.203917",
38
+ "@fluidframework/core-interfaces": "2.0.0-dev.7.2.0.205722",
39
+ "@fluidframework/core-utils": "2.0.0-dev.7.2.0.205722",
40
+ "@fluidframework/datastore-definitions": "2.0.0-dev.7.2.0.205722",
41
+ "@fluidframework/driver-utils": "2.0.0-dev.7.2.0.205722",
42
42
  "@fluidframework/protocol-definitions": "^3.0.0",
43
- "@fluidframework/runtime-definitions": "2.0.0-dev.7.2.0.203917",
44
- "@fluidframework/shared-object-base": "2.0.0-dev.7.2.0.203917"
43
+ "@fluidframework/runtime-definitions": "2.0.0-dev.7.2.0.205722",
44
+ "@fluidframework/shared-object-base": "2.0.0-dev.7.2.0.205722"
45
45
  },
46
46
  "devDependencies": {
47
- "@fluid-tools/build-cli": "0.26.0-203096",
48
- "@fluidframework/build-common": "^2.0.2",
49
- "@fluidframework/build-tools": "0.26.0-203096",
47
+ "@fluid-tools/build-cli": "^0.26.1",
48
+ "@fluidframework/build-common": "^2.0.3",
49
+ "@fluidframework/build-tools": "^0.26.1",
50
50
  "@fluidframework/counter-previous": "npm:@fluidframework/counter@2.0.0-internal.7.1.0",
51
51
  "@fluidframework/eslint-config-fluid": "^3.0.0",
52
- "@fluidframework/mocha-test-setup": "2.0.0-dev.7.2.0.203917",
53
- "@fluidframework/test-runtime-utils": "2.0.0-dev.7.2.0.203917",
52
+ "@fluidframework/mocha-test-setup": "2.0.0-dev.7.2.0.205722",
53
+ "@fluidframework/test-runtime-utils": "2.0.0-dev.7.2.0.205722",
54
54
  "@microsoft/api-extractor": "^7.37.0",
55
55
  "@types/mocha": "^9.1.1",
56
56
  "@types/node": "^16.18.38",
@@ -77,7 +77,7 @@
77
77
  "build:genver": "gen-version",
78
78
  "build:test": "tsc --project ./src/test/tsconfig.json",
79
79
  "ci:build:docs": "api-extractor run",
80
- "clean": "rimraf --glob 'dist' 'lib' '*.tsbuildinfo' '*.build.log' '_api-extractor-temp' 'nyc'",
80
+ "clean": "rimraf --glob dist lib \"*.tsbuildinfo\" \"*.build.log\" _api-extractor-temp nyc",
81
81
  "eslint": "eslint --format stylish src",
82
82
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
83
83
  "format": "npm run prettier:fix",
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/counter";
9
- export const pkgVersion = "2.0.0-dev.7.2.0.203917";
9
+ export const pkgVersion = "2.0.0-dev.7.2.0.205722";
@@ -1,131 +0,0 @@
1
- /**
2
- * This library contains the {@link SharedCounter} distributed data structure.
3
- * A `SharedCounter` is a shared object which holds a whole number that can be incremented or decremented.
4
- *
5
- * @packageDocumentation
6
- */
7
-
8
- import { IChannelAttributes } from '@fluidframework/datastore-definitions';
9
- import { IChannelFactory } from '@fluidframework/datastore-definitions';
10
- import { IChannelStorageService } from '@fluidframework/datastore-definitions';
11
- import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
12
- import { IFluidSerializer } from '@fluidframework/shared-object-base';
13
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
14
- import { ISharedObject } from '@fluidframework/shared-object-base';
15
- import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
16
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
17
- import { SharedObject } from '@fluidframework/shared-object-base';
18
-
19
- /**
20
- * {@link SharedCounter} interface.
21
- *
22
- * @public
23
- */
24
- export declare interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {
25
- /**
26
- * The counter value.
27
- *
28
- * @remarks Must be a whole number.
29
- */
30
- value: number;
31
- /**
32
- * Increments or decrements the value.
33
- * Must only increment or decrement by a whole number value.
34
- *
35
- * @param incrementAmount - A whole number to increment or decrement by.
36
- */
37
- increment(incrementAmount: number): void;
38
- }
39
-
40
- /**
41
- * Events sent by {@link SharedCounter}.
42
- *
43
- * @public
44
- */
45
- export declare interface ISharedCounterEvents extends ISharedObjectEvents {
46
- /**
47
- * This event is raised when the counter is incremented or decremented.
48
- *
49
- * @param event - The event name.
50
- * @param listener - An event listener.
51
- *
52
- * @eventProperty
53
- */
54
- (event: "incremented", listener: (incrementAmount: number, newValue: number) => void): any;
55
- }
56
-
57
- /**
58
- * A shared object that holds a number that can be incremented or decremented.
59
- *
60
- * @remarks Note that `SharedCounter` only operates on integer values. This is validated at runtime.
61
- *
62
- * @example Creating a `SharedCounter`
63
- *
64
- * First, get the factory and call {@link @fluidframework/datastore-definitions#IChannelFactory.create}
65
- * with a runtime and string ID:
66
- *
67
- * ```typescript
68
- * const factory = SharedCounter.getFactory();
69
- * const counter = factory.create(this.runtime, id) as SharedCounter;
70
- * ```
71
- *
72
- * The initial value of a new `SharedCounter` is 0.
73
- * If you wish to initialize the counter to a different value, you may call {@link SharedCounter.increment} before
74
- * attaching the Container, or before inserting it into an existing shared object.
75
- *
76
- * @example Using the `SharedCounter`
77
- *
78
- * Once created, you can call {@link SharedCounter.increment} to modify the value with either a positive or
79
- * negative number:
80
- *
81
- * ```typescript
82
- * counter.increment(10); // add 10 to the counter value
83
- * counter.increment(-5); // subtract 5 from the counter value
84
- * ```
85
- *
86
- * To observe changes to the value (including those from remote clients), register for the
87
- * {@link ISharedCounterEvents | incremented} event:
88
- *
89
- * ```typescript
90
- * counter.on("incremented", (incrementAmount, newValue) => {
91
- * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);
92
- * });
93
- * ```
94
- *
95
- * @public
96
- */
97
- export declare class SharedCounter extends SharedObject<ISharedCounterEvents> implements ISharedCounter {
98
- /**
99
- * Create a new {@link SharedCounter}.
100
- *
101
- * @param runtime - The data store runtime to which the new `SharedCounter` will belong.
102
- * @param id - Optional name of the `SharedCounter`. If not provided, one will be generated.
103
- *
104
- * @returns newly create shared counter (but not attached yet)
105
- */
106
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedCounter;
107
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
108
- /**
109
- * Get a factory for {@link SharedCounter} to register with the data store.
110
- *
111
- * @returns a factory that creates and load SharedCounter
112
- */
113
- static getFactory(): IChannelFactory;
114
- private _value;
115
- /**
116
- * {@inheritDoc ISharedCounter.value}
117
- */
118
- get value(): number;
119
- /**
120
- * {@inheritDoc ISharedCounter.increment}
121
- */
122
- increment(incrementAmount: number): void;
123
- private incrementCore;
124
- /* Excluded from this release type: summarizeCore */
125
- /* Excluded from this release type: loadCore */
126
- /* Excluded from this release type: onDisconnect */
127
- /* Excluded from this release type: processCore */
128
- /* Excluded from this release type: applyStashedOp */
129
- }
130
-
131
- export { }
@@ -1,131 +0,0 @@
1
- /**
2
- * This library contains the {@link SharedCounter} distributed data structure.
3
- * A `SharedCounter` is a shared object which holds a whole number that can be incremented or decremented.
4
- *
5
- * @packageDocumentation
6
- */
7
-
8
- import { IChannelAttributes } from '@fluidframework/datastore-definitions';
9
- import { IChannelFactory } from '@fluidframework/datastore-definitions';
10
- import { IChannelStorageService } from '@fluidframework/datastore-definitions';
11
- import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
12
- import { IFluidSerializer } from '@fluidframework/shared-object-base';
13
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
14
- import { ISharedObject } from '@fluidframework/shared-object-base';
15
- import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
16
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
17
- import { SharedObject } from '@fluidframework/shared-object-base';
18
-
19
- /**
20
- * {@link SharedCounter} interface.
21
- *
22
- * @public
23
- */
24
- export declare interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {
25
- /**
26
- * The counter value.
27
- *
28
- * @remarks Must be a whole number.
29
- */
30
- value: number;
31
- /**
32
- * Increments or decrements the value.
33
- * Must only increment or decrement by a whole number value.
34
- *
35
- * @param incrementAmount - A whole number to increment or decrement by.
36
- */
37
- increment(incrementAmount: number): void;
38
- }
39
-
40
- /**
41
- * Events sent by {@link SharedCounter}.
42
- *
43
- * @public
44
- */
45
- export declare interface ISharedCounterEvents extends ISharedObjectEvents {
46
- /**
47
- * This event is raised when the counter is incremented or decremented.
48
- *
49
- * @param event - The event name.
50
- * @param listener - An event listener.
51
- *
52
- * @eventProperty
53
- */
54
- (event: "incremented", listener: (incrementAmount: number, newValue: number) => void): any;
55
- }
56
-
57
- /**
58
- * A shared object that holds a number that can be incremented or decremented.
59
- *
60
- * @remarks Note that `SharedCounter` only operates on integer values. This is validated at runtime.
61
- *
62
- * @example Creating a `SharedCounter`
63
- *
64
- * First, get the factory and call {@link @fluidframework/datastore-definitions#IChannelFactory.create}
65
- * with a runtime and string ID:
66
- *
67
- * ```typescript
68
- * const factory = SharedCounter.getFactory();
69
- * const counter = factory.create(this.runtime, id) as SharedCounter;
70
- * ```
71
- *
72
- * The initial value of a new `SharedCounter` is 0.
73
- * If you wish to initialize the counter to a different value, you may call {@link SharedCounter.increment} before
74
- * attaching the Container, or before inserting it into an existing shared object.
75
- *
76
- * @example Using the `SharedCounter`
77
- *
78
- * Once created, you can call {@link SharedCounter.increment} to modify the value with either a positive or
79
- * negative number:
80
- *
81
- * ```typescript
82
- * counter.increment(10); // add 10 to the counter value
83
- * counter.increment(-5); // subtract 5 from the counter value
84
- * ```
85
- *
86
- * To observe changes to the value (including those from remote clients), register for the
87
- * {@link ISharedCounterEvents | incremented} event:
88
- *
89
- * ```typescript
90
- * counter.on("incremented", (incrementAmount, newValue) => {
91
- * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);
92
- * });
93
- * ```
94
- *
95
- * @public
96
- */
97
- export declare class SharedCounter extends SharedObject<ISharedCounterEvents> implements ISharedCounter {
98
- /**
99
- * Create a new {@link SharedCounter}.
100
- *
101
- * @param runtime - The data store runtime to which the new `SharedCounter` will belong.
102
- * @param id - Optional name of the `SharedCounter`. If not provided, one will be generated.
103
- *
104
- * @returns newly create shared counter (but not attached yet)
105
- */
106
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedCounter;
107
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
108
- /**
109
- * Get a factory for {@link SharedCounter} to register with the data store.
110
- *
111
- * @returns a factory that creates and load SharedCounter
112
- */
113
- static getFactory(): IChannelFactory;
114
- private _value;
115
- /**
116
- * {@inheritDoc ISharedCounter.value}
117
- */
118
- get value(): number;
119
- /**
120
- * {@inheritDoc ISharedCounter.increment}
121
- */
122
- increment(incrementAmount: number): void;
123
- private incrementCore;
124
- /* Excluded from this release type: summarizeCore */
125
- /* Excluded from this release type: loadCore */
126
- /* Excluded from this release type: onDisconnect */
127
- /* Excluded from this release type: processCore */
128
- /* Excluded from this release type: applyStashedOp */
129
- }
130
-
131
- export { }
@@ -1,131 +0,0 @@
1
- /**
2
- * This library contains the {@link SharedCounter} distributed data structure.
3
- * A `SharedCounter` is a shared object which holds a whole number that can be incremented or decremented.
4
- *
5
- * @packageDocumentation
6
- */
7
-
8
- import { IChannelAttributes } from '@fluidframework/datastore-definitions';
9
- import { IChannelFactory } from '@fluidframework/datastore-definitions';
10
- import { IChannelStorageService } from '@fluidframework/datastore-definitions';
11
- import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
12
- import { IFluidSerializer } from '@fluidframework/shared-object-base';
13
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
14
- import { ISharedObject } from '@fluidframework/shared-object-base';
15
- import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
16
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
17
- import { SharedObject } from '@fluidframework/shared-object-base';
18
-
19
- /**
20
- * {@link SharedCounter} interface.
21
- *
22
- * @public
23
- */
24
- export declare interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {
25
- /**
26
- * The counter value.
27
- *
28
- * @remarks Must be a whole number.
29
- */
30
- value: number;
31
- /**
32
- * Increments or decrements the value.
33
- * Must only increment or decrement by a whole number value.
34
- *
35
- * @param incrementAmount - A whole number to increment or decrement by.
36
- */
37
- increment(incrementAmount: number): void;
38
- }
39
-
40
- /**
41
- * Events sent by {@link SharedCounter}.
42
- *
43
- * @public
44
- */
45
- export declare interface ISharedCounterEvents extends ISharedObjectEvents {
46
- /**
47
- * This event is raised when the counter is incremented or decremented.
48
- *
49
- * @param event - The event name.
50
- * @param listener - An event listener.
51
- *
52
- * @eventProperty
53
- */
54
- (event: "incremented", listener: (incrementAmount: number, newValue: number) => void): any;
55
- }
56
-
57
- /**
58
- * A shared object that holds a number that can be incremented or decremented.
59
- *
60
- * @remarks Note that `SharedCounter` only operates on integer values. This is validated at runtime.
61
- *
62
- * @example Creating a `SharedCounter`
63
- *
64
- * First, get the factory and call {@link @fluidframework/datastore-definitions#IChannelFactory.create}
65
- * with a runtime and string ID:
66
- *
67
- * ```typescript
68
- * const factory = SharedCounter.getFactory();
69
- * const counter = factory.create(this.runtime, id) as SharedCounter;
70
- * ```
71
- *
72
- * The initial value of a new `SharedCounter` is 0.
73
- * If you wish to initialize the counter to a different value, you may call {@link SharedCounter.increment} before
74
- * attaching the Container, or before inserting it into an existing shared object.
75
- *
76
- * @example Using the `SharedCounter`
77
- *
78
- * Once created, you can call {@link SharedCounter.increment} to modify the value with either a positive or
79
- * negative number:
80
- *
81
- * ```typescript
82
- * counter.increment(10); // add 10 to the counter value
83
- * counter.increment(-5); // subtract 5 from the counter value
84
- * ```
85
- *
86
- * To observe changes to the value (including those from remote clients), register for the
87
- * {@link ISharedCounterEvents | incremented} event:
88
- *
89
- * ```typescript
90
- * counter.on("incremented", (incrementAmount, newValue) => {
91
- * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);
92
- * });
93
- * ```
94
- *
95
- * @public
96
- */
97
- export declare class SharedCounter extends SharedObject<ISharedCounterEvents> implements ISharedCounter {
98
- /**
99
- * Create a new {@link SharedCounter}.
100
- *
101
- * @param runtime - The data store runtime to which the new `SharedCounter` will belong.
102
- * @param id - Optional name of the `SharedCounter`. If not provided, one will be generated.
103
- *
104
- * @returns newly create shared counter (but not attached yet)
105
- */
106
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedCounter;
107
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
108
- /**
109
- * Get a factory for {@link SharedCounter} to register with the data store.
110
- *
111
- * @returns a factory that creates and load SharedCounter
112
- */
113
- static getFactory(): IChannelFactory;
114
- private _value;
115
- /**
116
- * {@inheritDoc ISharedCounter.value}
117
- */
118
- get value(): number;
119
- /**
120
- * {@inheritDoc ISharedCounter.increment}
121
- */
122
- increment(incrementAmount: number): void;
123
- private incrementCore;
124
- /* Excluded from this release type: summarizeCore */
125
- /* Excluded from this release type: loadCore */
126
- /* Excluded from this release type: onDisconnect */
127
- /* Excluded from this release type: processCore */
128
- /* Excluded from this release type: applyStashedOp */
129
- }
130
-
131
- export { }
@@ -1,162 +0,0 @@
1
- /**
2
- * This library contains the {@link SharedCounter} distributed data structure.
3
- * A `SharedCounter` is a shared object which holds a whole number that can be incremented or decremented.
4
- *
5
- * @packageDocumentation
6
- */
7
-
8
- import { IChannelAttributes } from '@fluidframework/datastore-definitions';
9
- import { IChannelFactory } from '@fluidframework/datastore-definitions';
10
- import { IChannelStorageService } from '@fluidframework/datastore-definitions';
11
- import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
12
- import { IFluidSerializer } from '@fluidframework/shared-object-base';
13
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
14
- import { ISharedObject } from '@fluidframework/shared-object-base';
15
- import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
16
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
17
- import { SharedObject } from '@fluidframework/shared-object-base';
18
-
19
- /**
20
- * {@link SharedCounter} interface.
21
- *
22
- * @public
23
- */
24
- export declare interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {
25
- /**
26
- * The counter value.
27
- *
28
- * @remarks Must be a whole number.
29
- */
30
- value: number;
31
- /**
32
- * Increments or decrements the value.
33
- * Must only increment or decrement by a whole number value.
34
- *
35
- * @param incrementAmount - A whole number to increment or decrement by.
36
- */
37
- increment(incrementAmount: number): void;
38
- }
39
-
40
- /**
41
- * Events sent by {@link SharedCounter}.
42
- *
43
- * @public
44
- */
45
- export declare interface ISharedCounterEvents extends ISharedObjectEvents {
46
- /**
47
- * This event is raised when the counter is incremented or decremented.
48
- *
49
- * @param event - The event name.
50
- * @param listener - An event listener.
51
- *
52
- * @eventProperty
53
- */
54
- (event: "incremented", listener: (incrementAmount: number, newValue: number) => void): any;
55
- }
56
-
57
- /**
58
- * A shared object that holds a number that can be incremented or decremented.
59
- *
60
- * @remarks Note that `SharedCounter` only operates on integer values. This is validated at runtime.
61
- *
62
- * @example Creating a `SharedCounter`
63
- *
64
- * First, get the factory and call {@link @fluidframework/datastore-definitions#IChannelFactory.create}
65
- * with a runtime and string ID:
66
- *
67
- * ```typescript
68
- * const factory = SharedCounter.getFactory();
69
- * const counter = factory.create(this.runtime, id) as SharedCounter;
70
- * ```
71
- *
72
- * The initial value of a new `SharedCounter` is 0.
73
- * If you wish to initialize the counter to a different value, you may call {@link SharedCounter.increment} before
74
- * attaching the Container, or before inserting it into an existing shared object.
75
- *
76
- * @example Using the `SharedCounter`
77
- *
78
- * Once created, you can call {@link SharedCounter.increment} to modify the value with either a positive or
79
- * negative number:
80
- *
81
- * ```typescript
82
- * counter.increment(10); // add 10 to the counter value
83
- * counter.increment(-5); // subtract 5 from the counter value
84
- * ```
85
- *
86
- * To observe changes to the value (including those from remote clients), register for the
87
- * {@link ISharedCounterEvents | incremented} event:
88
- *
89
- * ```typescript
90
- * counter.on("incremented", (incrementAmount, newValue) => {
91
- * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);
92
- * });
93
- * ```
94
- *
95
- * @public
96
- */
97
- export declare class SharedCounter extends SharedObject<ISharedCounterEvents> implements ISharedCounter {
98
- /**
99
- * Create a new {@link SharedCounter}.
100
- *
101
- * @param runtime - The data store runtime to which the new `SharedCounter` will belong.
102
- * @param id - Optional name of the `SharedCounter`. If not provided, one will be generated.
103
- *
104
- * @returns newly create shared counter (but not attached yet)
105
- */
106
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedCounter;
107
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
108
- /**
109
- * Get a factory for {@link SharedCounter} to register with the data store.
110
- *
111
- * @returns a factory that creates and load SharedCounter
112
- */
113
- static getFactory(): IChannelFactory;
114
- private _value;
115
- /**
116
- * {@inheritDoc ISharedCounter.value}
117
- */
118
- get value(): number;
119
- /**
120
- * {@inheritDoc ISharedCounter.increment}
121
- */
122
- increment(incrementAmount: number): void;
123
- private incrementCore;
124
- /**
125
- * Create a summary for the counter.
126
- *
127
- * @returns The summary of the current state of the counter.
128
- *
129
- * @internal
130
- */
131
- protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
132
- /**
133
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
134
- *
135
- * @internal
136
- */
137
- protected loadCore(storage: IChannelStorageService): Promise<void>;
138
- /**
139
- * Called when the object has disconnected from the delta stream.
140
- *
141
- * @internal
142
- */
143
- protected onDisconnect(): void;
144
- /**
145
- * Process a counter operation (op).
146
- *
147
- * @param message - The message to prepare.
148
- * @param local - Whether or not the message was sent by the local client.
149
- * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
150
- * For messages from a remote client, this will be `undefined`.
151
- *
152
- * @internal
153
- */
154
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
155
- /**
156
- * {@inheritdoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
157
- * @internal
158
- */
159
- protected applyStashedOp(op: unknown): void;
160
- }
161
-
162
- export { }