@fluidframework/sequence 2.0.0-dev.4.1.0.148229 → 2.0.0-dev.4.3.0.157531

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.
@@ -43,7 +43,7 @@ export interface IInterval {
43
43
  modify(label: string, start: number | undefined, end: number | undefined, op?: ISequencedDocumentMessage, localSeq?: number): IInterval | undefined;
44
44
  /**
45
45
  * @returns whether this interval overlaps with `b`.
46
- * Since intervals are inclusive, this includes cases where endpoints are equal.
46
+ * Intervals are considered to overlap if their intersection is non-empty.
47
47
  */
48
48
  overlaps(b: IInterval): boolean;
49
49
  /**
@@ -55,6 +55,13 @@ export interface IInterval {
55
55
  union(b: IInterval): IInterval;
56
56
  }
57
57
  export declare type IntervalNode<T extends IInterval> = RBNode<T, AugmentedIntervalNode>;
58
+ /**
59
+ * @deprecated - This functionality was useful when adding two intervals at the same start/end positions resulted
60
+ * in a conflict. This is no longer the case (as of PR#6407), as interval collections support multiple intervals
61
+ * at the same location and gives each interval a unique id.
62
+ *
63
+ * As such, conflict resolvers are never invoked and unnecessary. They will be removed in an upcoming release.
64
+ */
58
65
  export declare type IntervalConflictResolver<TInterval> = (a: TInterval, b: TInterval) => TInterval;
59
66
  export declare class IntervalTree<T extends IInterval> implements IRBAugmentation<T, AugmentedIntervalNode>, IRBMatcher<T, AugmentedIntervalNode> {
60
67
  intervals: RedBlackTree<T, AugmentedIntervalNode>;
@@ -1 +1 @@
1
- {"version":3,"file":"intervalTree.d.ts","sourceRoot":"","sources":["../src/intervalTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,aAAa,EACb,MAAM,EACN,eAAe,EACf,UAAU,EACV,YAAY,EAGZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,MAAM,WAAW,qBAAqB;IACrC,MAAM,EAAE,SAAS,CAAC;CAClB;AAED,eAAO,MAAM,oBAAoB,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,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;SACvF;aAAM;YACN,IAAI,IAAI,CAAC,IAAI,EAAE;gBACd,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACzD;iBAAM,IAAI,IAAI,CAAC,KAAK,EAAE;gBACtB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aAC1D;iBAAM;gBACN,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;aACpC;SACD;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIIntegerRange,\n\tRBNode,\n\tIRBAugmentation,\n\tIRBMatcher,\n\tRedBlackTree,\n\tConflictAction,\n\tRBNodeActions,\n} from \"@fluidframework/merge-tree\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\nexport interface AugmentedIntervalNode {\n\tminmax: IInterval;\n}\n\nexport const integerRangeToString = (range: IIntegerRange) => `[${range.start},${range.end})`;\n\n/**\n * Basic interval abstraction\n */\nexport interface IInterval {\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): IInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: IInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: IInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: IInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t * @internal\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t): IInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Since intervals are inclusive, this includes cases where endpoints are equal.\n\t */\n\toverlaps(b: IInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t * @internal\n\t */\n\tunion(b: IInterval): IInterval;\n}\n\nconst intervalComparer = (a: IInterval, b: IInterval) => a.compare(b);\n\nexport type IntervalNode<T extends IInterval> = RBNode<T, AugmentedIntervalNode>;\n\nexport type IntervalConflictResolver<TInterval> = (a: TInterval, b: TInterval) => TInterval;\n\nexport class IntervalTree<T extends IInterval>\n\timplements IRBAugmentation<T, AugmentedIntervalNode>, IRBMatcher<T, AugmentedIntervalNode>\n{\n\tpublic intervals = new RedBlackTree<T, AugmentedIntervalNode>(intervalComparer, this);\n\n\tpublic remove(x: T) {\n\t\tthis.intervals.remove(x);\n\t}\n\n\tpublic removeExisting(x: T) {\n\t\tthis.intervals.removeExisting(x);\n\t}\n\n\tpublic put(x: T, conflict?: IntervalConflictResolver<T>) {\n\t\tlet rbConflict: ConflictAction<T, AugmentedIntervalNode> | undefined;\n\t\tif (conflict) {\n\t\t\trbConflict = (key: T, currentKey: T) => {\n\t\t\t\tconst ival = conflict(key, currentKey);\n\t\t\t\treturn {\n\t\t\t\t\tkey: ival,\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\t\tthis.intervals.put(x, { minmax: x.clone() }, rbConflict);\n\t}\n\n\tpublic map(fn: (x: T) => void) {\n\t\tconst actions: RBNodeActions<T, AugmentedIntervalNode> = {\n\t\t\tinfix: (node) => {\n\t\t\t\tfn(node.key);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tshowStructure: true,\n\t\t};\n\t\tthis.intervals.walk(actions);\n\t}\n\n\tpublic mapUntil(fn: (X: T) => boolean) {\n\t\tconst actions: RBNodeActions<T, AugmentedIntervalNode> = {\n\t\t\tinfix: (node) => {\n\t\t\t\treturn fn(node.key);\n\t\t\t},\n\t\t\tshowStructure: true,\n\t\t};\n\t\tthis.intervals.walk(actions);\n\t}\n\n\tpublic mapBackward(fn: (x: T) => void) {\n\t\tconst actions: RBNodeActions<T, AugmentedIntervalNode> = {\n\t\t\tinfix: (node) => {\n\t\t\t\tfn(node.key);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tshowStructure: true,\n\t\t};\n\t\tthis.intervals.walkBackward(actions);\n\t}\n\n\t// TODO: toString()\n\tpublic match(x: T) {\n\t\treturn this.intervals.gather(x, this);\n\t}\n\n\tpublic matchNode(node: IntervalNode<T> | undefined, key: T) {\n\t\treturn !!node && node.key.overlaps(key);\n\t}\n\n\tpublic continueSubtree(node: IntervalNode<T> | undefined, key: T) {\n\t\treturn !!node && node.data.minmax.overlaps(key);\n\t}\n\n\tpublic update(node: IntervalNode<T>) {\n\t\tif (node.left && node.right) {\n\t\t\tnode.data.minmax = node.key.union(node.left.data.minmax.union(node.right.data.minmax));\n\t\t} else {\n\t\t\tif (node.left) {\n\t\t\t\tnode.data.minmax = node.key.union(node.left.data.minmax);\n\t\t\t} else if (node.right) {\n\t\t\t\tnode.data.minmax = node.key.union(node.right.data.minmax);\n\t\t\t} else {\n\t\t\t\tnode.data.minmax = node.key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AAI,IAAI,CAAC,KAAK,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;SACvF;aAAM;YACN,IAAI,IAAI,CAAC,IAAI,EAAE;gBACd,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACzD;iBAAM,IAAI,IAAI,CAAC,KAAK,EAAE;gBACtB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aAC1D;iBAAM;gBACN,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;aACpC;SACD;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIIntegerRange,\n\tRBNode,\n\tIRBAugmentation,\n\tIRBMatcher,\n\tRedBlackTree,\n\tConflictAction,\n\tRBNodeActions,\n} from \"@fluidframework/merge-tree\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\nexport interface AugmentedIntervalNode {\n\tminmax: IInterval;\n}\n\nexport const integerRangeToString = (range: IIntegerRange) => `[${range.start},${range.end})`;\n\n/**\n * Basic interval abstraction\n */\nexport interface IInterval {\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): IInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: IInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: IInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: IInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t * @internal\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t): IInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: IInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t * @internal\n\t */\n\tunion(b: IInterval): IInterval;\n}\n\nconst intervalComparer = (a: IInterval, b: IInterval) => a.compare(b);\n\nexport type IntervalNode<T extends IInterval> = RBNode<T, AugmentedIntervalNode>;\n\n/**\n * @deprecated - This functionality was useful when adding two intervals at the same start/end positions resulted\n * in a conflict. This is no longer the case (as of PR#6407), as interval collections support multiple intervals\n * at the same location and gives each interval a unique id.\n *\n * As such, conflict resolvers are never invoked and unnecessary. They will be removed in an upcoming release.\n */\nexport type IntervalConflictResolver<TInterval> = (a: TInterval, b: TInterval) => TInterval;\n\nexport class IntervalTree<T extends IInterval>\n\timplements IRBAugmentation<T, AugmentedIntervalNode>, IRBMatcher<T, AugmentedIntervalNode>\n{\n\tpublic intervals = new RedBlackTree<T, AugmentedIntervalNode>(intervalComparer, this);\n\n\tpublic remove(x: T) {\n\t\tthis.intervals.remove(x);\n\t}\n\n\tpublic removeExisting(x: T) {\n\t\tthis.intervals.removeExisting(x);\n\t}\n\n\tpublic put(x: T, conflict?: IntervalConflictResolver<T>) {\n\t\tlet rbConflict: ConflictAction<T, AugmentedIntervalNode> | undefined;\n\t\tif (conflict) {\n\t\t\trbConflict = (key: T, currentKey: T) => {\n\t\t\t\tconst ival = conflict(key, currentKey);\n\t\t\t\treturn {\n\t\t\t\t\tkey: ival,\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\t\tthis.intervals.put(x, { minmax: x.clone() }, rbConflict);\n\t}\n\n\tpublic map(fn: (x: T) => void) {\n\t\tconst actions: RBNodeActions<T, AugmentedIntervalNode> = {\n\t\t\tinfix: (node) => {\n\t\t\t\tfn(node.key);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tshowStructure: true,\n\t\t};\n\t\tthis.intervals.walk(actions);\n\t}\n\n\tpublic mapUntil(fn: (X: T) => boolean) {\n\t\tconst actions: RBNodeActions<T, AugmentedIntervalNode> = {\n\t\t\tinfix: (node) => {\n\t\t\t\treturn fn(node.key);\n\t\t\t},\n\t\t\tshowStructure: true,\n\t\t};\n\t\tthis.intervals.walk(actions);\n\t}\n\n\tpublic mapBackward(fn: (x: T) => void) {\n\t\tconst actions: RBNodeActions<T, AugmentedIntervalNode> = {\n\t\t\tinfix: (node) => {\n\t\t\t\tfn(node.key);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tshowStructure: true,\n\t\t};\n\t\tthis.intervals.walkBackward(actions);\n\t}\n\n\t// TODO: toString()\n\tpublic match(x: T) {\n\t\treturn this.intervals.gather(x, this);\n\t}\n\n\tpublic matchNode(node: IntervalNode<T> | undefined, key: T) {\n\t\treturn !!node && node.key.overlaps(key);\n\t}\n\n\tpublic continueSubtree(node: IntervalNode<T> | undefined, key: T) {\n\t\treturn !!node && node.data.minmax.overlaps(key);\n\t}\n\n\tpublic update(node: IntervalNode<T>) {\n\t\tif (node.left && node.right) {\n\t\t\tnode.data.minmax = node.key.union(node.left.data.minmax.union(node.right.data.minmax));\n\t\t} else {\n\t\t\tif (node.left) {\n\t\t\t\tnode.data.minmax = node.key.union(node.left.data.minmax);\n\t\t\t} else if (node.right) {\n\t\t\t\tnode.data.minmax = node.key.union(node.right.data.minmax);\n\t\t\t} else {\n\t\t\t\tnode.data.minmax = node.key.clone();\n\t\t\t}\n\t\t}\n\t}\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/sequence";
8
- export declare const pkgVersion = "2.0.0-dev.4.1.0.148229";
8
+ export declare const pkgVersion = "2.0.0-dev.4.3.0.157531";
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/sequence";
8
- export const pkgVersion = "2.0.0-dev.4.1.0.148229";
8
+ export const pkgVersion = "2.0.0-dev.4.3.0.157531";
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,0BAA0B,CAAC;AAClD,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/sequence\";\nexport const pkgVersion = \"2.0.0-dev.4.1.0.148229\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAClD,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/sequence\";\nexport const pkgVersion = \"2.0.0-dev.4.3.0.157531\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/sequence",
3
- "version": "2.0.0-dev.4.1.0.148229",
3
+ "version": "2.0.0-dev.4.3.0.157531",
4
4
  "description": "Distributed sequence",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -37,30 +37,30 @@
37
37
  "dependencies": {
38
38
  "@fluidframework/common-definitions": "^0.20.1",
39
39
  "@fluidframework/common-utils": "^1.1.1",
40
- "@fluidframework/container-utils": "2.0.0-dev.4.1.0.148229",
41
- "@fluidframework/core-interfaces": "2.0.0-dev.4.1.0.148229",
42
- "@fluidframework/datastore-definitions": "2.0.0-dev.4.1.0.148229",
43
- "@fluidframework/merge-tree": "2.0.0-dev.4.1.0.148229",
40
+ "@fluidframework/container-utils": "2.0.0-dev.4.3.0.157531",
41
+ "@fluidframework/core-interfaces": "2.0.0-dev.4.3.0.157531",
42
+ "@fluidframework/datastore-definitions": "2.0.0-dev.4.3.0.157531",
43
+ "@fluidframework/merge-tree": "2.0.0-dev.4.3.0.157531",
44
44
  "@fluidframework/protocol-definitions": "^1.1.0",
45
- "@fluidframework/runtime-definitions": "2.0.0-dev.4.1.0.148229",
46
- "@fluidframework/runtime-utils": "2.0.0-dev.4.1.0.148229",
47
- "@fluidframework/shared-object-base": "2.0.0-dev.4.1.0.148229",
48
- "@fluidframework/telemetry-utils": "2.0.0-dev.4.1.0.148229",
45
+ "@fluidframework/runtime-definitions": "2.0.0-dev.4.3.0.157531",
46
+ "@fluidframework/runtime-utils": "2.0.0-dev.4.3.0.157531",
47
+ "@fluidframework/shared-object-base": "2.0.0-dev.4.3.0.157531",
48
+ "@fluidframework/telemetry-utils": "2.0.0-dev.4.3.0.157531",
49
49
  "uuid": "^8.3.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@fluid-internal/stochastic-test-utils": "2.0.0-dev.4.1.0.148229",
53
- "@fluid-internal/test-dds-utils": "2.0.0-dev.4.1.0.148229",
54
- "@fluid-tools/benchmark": "0.47.0-140906",
55
- "@fluid-tools/build-cli": "^0.13.1",
52
+ "@fluid-internal/stochastic-test-utils": "2.0.0-dev.4.3.0.157531",
53
+ "@fluid-internal/test-dds-utils": "2.0.0-dev.4.3.0.157531",
54
+ "@fluid-tools/benchmark": "^0.47.0",
55
+ "@fluid-tools/build-cli": "^0.17.0",
56
56
  "@fluidframework/build-common": "^1.1.0",
57
- "@fluidframework/build-tools": "^0.13.1",
57
+ "@fluidframework/build-tools": "^0.17.0",
58
58
  "@fluidframework/eslint-config-fluid": "^2.0.0",
59
59
  "@fluidframework/gitresources": "^0.1039.1000",
60
- "@fluidframework/mocha-test-setup": "2.0.0-dev.4.1.0.148229",
61
- "@fluidframework/sequence-previous": "npm:@fluidframework/sequence@2.0.0-internal.4.0.0",
60
+ "@fluidframework/mocha-test-setup": "2.0.0-dev.4.3.0.157531",
61
+ "@fluidframework/sequence-previous": "npm:@fluidframework/sequence@2.0.0-internal.4.1.0",
62
62
  "@fluidframework/server-services-client": "^0.1039.1000",
63
- "@fluidframework/test-runtime-utils": "2.0.0-dev.4.1.0.148229",
63
+ "@fluidframework/test-runtime-utils": "2.0.0-dev.4.3.0.157531",
64
64
  "@microsoft/api-extractor": "^7.34.4",
65
65
  "@types/diff": "^3.5.1",
66
66
  "@types/mocha": "^9.1.1",
@@ -82,20 +82,7 @@
82
82
  "typescript": "~4.5.5"
83
83
  },
84
84
  "typeValidation": {
85
- "broken": {
86
- "ClassDeclaration_Interval": {
87
- "forwardCompat": false
88
- },
89
- "ClassDeclaration_SequenceInterval": {
90
- "forwardCompat": false
91
- },
92
- "InterfaceDeclaration_ISerializableInterval": {
93
- "forwardCompat": false
94
- },
95
- "InterfaceDeclaration_IntervalLocator": {
96
- "forwardCompat": false
97
- }
98
- }
85
+ "broken": {}
99
86
  },
100
87
  "scripts": {
101
88
  "build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
@@ -114,9 +101,12 @@
114
101
  "format": "npm run prettier:fix",
115
102
  "lint": "npm run prettier && npm run eslint",
116
103
  "lint:fix": "npm run prettier:fix && npm run eslint:fix",
104
+ "perf": "cross-env FLUID_TEST_VERBOSE=1 mocha \"dist/**/*.spec.js\" --node-option unhandled-rejections=strict,expose-gc --exit -r node_modules/@fluidframework/mocha-test-setup --perfMode --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js --timeout 30000",
105
+ "perf:measure": "npm run perf -- --fgrep @Measurement",
117
106
  "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
118
107
  "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
119
108
  "test": "npm run test:mocha",
109
+ "test:benchmark:report": "mocha \"dist/test/*.perf.spec.js\" --node-option unhandled-rejections=strict,expose-gc --exit --perfMode --fgrep @Benchmark -r @fluidframework/mocha-test-setup --reporter @fluid-tools/benchmark/dist/MochaReporter.js --timeout 60000",
120
110
  "test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
121
111
  "test:memory": "mocha --config src/test/memory/.mocharc.js",
122
112
  "test:memory-profiling:report": "mocha --config src/test/memory/.mocharc.js",