@fluidframework/core-utils
Advanced tools
Comparing version 2.0.0-internal.6.3.3 to 2.0.0-internal.6.4.0
@@ -7,3 +7,3 @@ /*! | ||
module.exports = { | ||
extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"], | ||
extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"], | ||
@@ -16,2 +16,6 @@ parserOptions: { | ||
"import/no-nodejs-modules": ["error", { allow: ["events"] }], | ||
// This has been disabled in the next eslint-config-fluid. | ||
// Once the dependency here has been updated, this override can be removed. | ||
"unicorn/numeric-separators-style": "off", | ||
}, | ||
@@ -21,6 +25,12 @@ overrides: [ | ||
// Rules only for test files | ||
files: ["*.spec.ts", "src/test/**"], | ||
files: ["*.spec.ts", "*.test.ts", "src/test/**"], | ||
rules: { | ||
// Test files are run in node only so additional node libraries can be used. | ||
"import/no-nodejs-modules": ["error", { allow: ["assert", "events", "process"] }], | ||
"import/no-nodejs-modules": [ | ||
"error", | ||
{ allow: ["node:assert", "node:events", "node:process"] }, | ||
], | ||
// Does not work well with describe/it block scoping | ||
"unicorn/consistent-function-scoping": "off", | ||
}, | ||
@@ -27,0 +37,0 @@ }, |
@@ -11,4 +11,4 @@ /*! | ||
const packageDir = __dirname; | ||
const config = getFluidTestMochaConfig(packageDir, ["source-map-support/register"]); | ||
const config = getFluidTestMochaConfig(packageDir); | ||
config.spec = "dist/test"; | ||
module.exports = config; |
# @fluidframework/core-utils | ||
## 2.0.0-internal.6.4.0 | ||
Dependency updates only. | ||
## 2.0.0-internal.6.3.0 | ||
@@ -4,0 +8,0 @@ |
@@ -87,3 +87,3 @@ "use strict"; | ||
this.swap(node.position, this.L.length - 1); | ||
this.L.splice(this.L.length - 1); | ||
this.L.splice(-1); | ||
// Update the swapped node assuming we didn't remove the end of the list | ||
@@ -90,0 +90,0 @@ if (position !== this.L.length) { |
@@ -52,6 +52,8 @@ "use strict"; | ||
} | ||
// eslint-disable-next-line unicorn/no-thenable | ||
async then( | ||
// eslint-disable-next-line @rushstack/no-new-null | ||
onfulfilled, | ||
// eslint-disable-next-line @rushstack/no-new-null | ||
// TODO: Use `unknown` instead (API breaking) | ||
// eslint-disable-next-line @rushstack/no-new-null, @typescript-eslint/no-explicit-any | ||
onrejected) { | ||
@@ -62,3 +64,4 @@ // eslint-disable-next-line prefer-rest-params | ||
async catch( | ||
// eslint-disable-next-line @rushstack/no-new-null | ||
// TODO: Use `unknown` instead (API breaking) | ||
// eslint-disable-next-line @rushstack/no-new-null, @typescript-eslint/no-explicit-any | ||
onrejected) { | ||
@@ -65,0 +68,0 @@ // eslint-disable-next-line prefer-rest-params |
@@ -21,6 +21,10 @@ /*! | ||
export interface PromiseCacheOptions { | ||
/** Common expiration policy for all items added to this cache */ | ||
/** | ||
* Common expiration policy for all items added to this cache | ||
*/ | ||
expiry?: PromiseCacheExpiry; | ||
/** If the stored Promise is rejected with a particular error, should the given key be removed? */ | ||
removeOnError?: (e: any) => boolean; | ||
/** | ||
* If the stored Promise is rejected with a particular error, should the given key be removed? | ||
*/ | ||
removeOnError?: (error: any) => boolean; | ||
} | ||
@@ -27,0 +31,0 @@ /** |
@@ -49,2 +49,4 @@ "use strict"; | ||
*/ | ||
// TODO: Use `unknown` instead (API breaking) | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types | ||
reject(error) { | ||
@@ -51,0 +53,0 @@ if (this.rej !== undefined) { |
@@ -81,7 +81,3 @@ "use strict"; | ||
restart(ms, handler) { | ||
if (!this.runningState) { | ||
// If restart is called first, it behaves as a call to start | ||
this.start(ms, handler); | ||
} | ||
else { | ||
if (this.runningState) { | ||
const duration = ms ?? this.runningState.intendedDuration; | ||
@@ -111,2 +107,6 @@ const handlerToUse = handler ?? this.runningState.restart?.handler ?? this.runningState.handler; | ||
} | ||
else { | ||
// If restart is called first, it behaves as a call to start | ||
this.start(ms, handler); | ||
} | ||
} | ||
@@ -130,8 +130,3 @@ startCore(duration, handler, intendedDuration) { | ||
const restart = this.runningState.restart; | ||
if (restart !== undefined) { | ||
// Restart with remaining time | ||
const remainingTime = this.calculateRemainingTime(restart); | ||
this.startCore(remainingTime, () => restart.handler(), restart.duration); | ||
} | ||
else { | ||
if (restart === undefined) { | ||
// Run clear first, in case the handler decides to start again | ||
@@ -142,2 +137,7 @@ const handler = this.runningState.handler; | ||
} | ||
else { | ||
// Restart with remaining time | ||
const remainingTime = this.calculateRemainingTime(restart); | ||
this.startCore(remainingTime, () => restart.handler(), restart.duration); | ||
} | ||
} | ||
@@ -144,0 +144,0 @@ calculateRemainingTime(runningTimeout) { |
@@ -84,3 +84,3 @@ /*! | ||
this.swap(node.position, this.L.length - 1); | ||
this.L.splice(this.L.length - 1); | ||
this.L.splice(-1); | ||
// Update the swapped node assuming we didn't remove the end of the list | ||
@@ -87,0 +87,0 @@ if (position !== this.L.length) { |
@@ -48,6 +48,8 @@ /*! | ||
} | ||
// eslint-disable-next-line unicorn/no-thenable | ||
async then( | ||
// eslint-disable-next-line @rushstack/no-new-null | ||
onfulfilled, | ||
// eslint-disable-next-line @rushstack/no-new-null | ||
// TODO: Use `unknown` instead (API breaking) | ||
// eslint-disable-next-line @rushstack/no-new-null, @typescript-eslint/no-explicit-any | ||
onrejected) { | ||
@@ -58,3 +60,4 @@ // eslint-disable-next-line prefer-rest-params | ||
async catch( | ||
// eslint-disable-next-line @rushstack/no-new-null | ||
// TODO: Use `unknown` instead (API breaking) | ||
// eslint-disable-next-line @rushstack/no-new-null, @typescript-eslint/no-explicit-any | ||
onrejected) { | ||
@@ -61,0 +64,0 @@ // eslint-disable-next-line prefer-rest-params |
@@ -21,6 +21,10 @@ /*! | ||
export interface PromiseCacheOptions { | ||
/** Common expiration policy for all items added to this cache */ | ||
/** | ||
* Common expiration policy for all items added to this cache | ||
*/ | ||
expiry?: PromiseCacheExpiry; | ||
/** If the stored Promise is rejected with a particular error, should the given key be removed? */ | ||
removeOnError?: (e: any) => boolean; | ||
/** | ||
* If the stored Promise is rejected with a particular error, should the given key be removed? | ||
*/ | ||
removeOnError?: (error: any) => boolean; | ||
} | ||
@@ -27,0 +31,0 @@ /** |
@@ -46,2 +46,4 @@ /*! | ||
*/ | ||
// TODO: Use `unknown` instead (API breaking) | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types | ||
reject(error) { | ||
@@ -48,0 +50,0 @@ if (this.rej !== undefined) { |
@@ -77,7 +77,3 @@ /*! | ||
restart(ms, handler) { | ||
if (!this.runningState) { | ||
// If restart is called first, it behaves as a call to start | ||
this.start(ms, handler); | ||
} | ||
else { | ||
if (this.runningState) { | ||
const duration = ms ?? this.runningState.intendedDuration; | ||
@@ -107,2 +103,6 @@ const handlerToUse = handler ?? this.runningState.restart?.handler ?? this.runningState.handler; | ||
} | ||
else { | ||
// If restart is called first, it behaves as a call to start | ||
this.start(ms, handler); | ||
} | ||
} | ||
@@ -126,8 +126,3 @@ startCore(duration, handler, intendedDuration) { | ||
const restart = this.runningState.restart; | ||
if (restart !== undefined) { | ||
// Restart with remaining time | ||
const remainingTime = this.calculateRemainingTime(restart); | ||
this.startCore(remainingTime, () => restart.handler(), restart.duration); | ||
} | ||
else { | ||
if (restart === undefined) { | ||
// Run clear first, in case the handler decides to start again | ||
@@ -138,2 +133,7 @@ const handler = this.runningState.handler; | ||
} | ||
else { | ||
// Restart with remaining time | ||
const remainingTime = this.calculateRemainingTime(restart); | ||
this.startCore(remainingTime, () => restart.handler(), restart.duration); | ||
} | ||
} | ||
@@ -140,0 +140,0 @@ calculateRemainingTime(runningTimeout) { |
{ | ||
"name": "@fluidframework/core-utils", | ||
"version": "2.0.0-internal.6.3.3", | ||
"version": "2.0.0-internal.6.4.0", | ||
"description": "Not intended for use outside the Fluid client repo.", | ||
@@ -43,3 +43,3 @@ "homepage": "https://fluidframework.com", | ||
"@fluidframework/eslint-config-fluid": "^2.1.0", | ||
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0", | ||
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0", | ||
"@microsoft/api-extractor": "^7.34.4", | ||
@@ -61,3 +61,2 @@ "@types/mocha": "^9.1.1", | ||
"sinon": "^7.4.2", | ||
"source-map-support": "^0.5.16", | ||
"typescript": "~4.5.5" | ||
@@ -64,0 +63,0 @@ }, |
@@ -22,3 +22,3 @@ /*! | ||
rightItem: T, | ||
) => Object.is(leftItem, rightItem), | ||
): boolean => Object.is(leftItem, rightItem), | ||
): boolean => { | ||
@@ -25,0 +25,0 @@ // PERF: 'for-loop' and 'Array.every()' tied. |
@@ -118,3 +118,3 @@ /*! | ||
this.swap(node.position, this.L.length - 1); | ||
this.L.splice(this.L.length - 1); | ||
this.L.splice(-1); | ||
@@ -121,0 +121,0 @@ // Update the swapped node assuming we didn't remove the end of the list |
@@ -16,3 +16,3 @@ /*! | ||
*/ | ||
constructor(private readonly valueGenerator: () => T) {} | ||
public constructor(private readonly valueGenerator: () => T) {} | ||
@@ -52,8 +52,10 @@ /** | ||
constructor(private readonly execute: () => Promise<T>) {} | ||
public constructor(private readonly execute: () => Promise<T>) {} | ||
// eslint-disable-next-line unicorn/no-thenable | ||
public async then<TResult1 = T, TResult2 = never>( | ||
// eslint-disable-next-line @rushstack/no-new-null | ||
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, | ||
// eslint-disable-next-line @rushstack/no-new-null | ||
// TODO: Use `unknown` instead (API breaking) | ||
// eslint-disable-next-line @rushstack/no-new-null, @typescript-eslint/no-explicit-any | ||
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined, | ||
@@ -66,3 +68,4 @@ ): Promise<TResult1 | TResult2> { | ||
public async catch<TResult = never>( | ||
// eslint-disable-next-line @rushstack/no-new-null | ||
// TODO: Use `unknown` instead (API breaking) | ||
// eslint-disable-next-line @rushstack/no-new-null, @typescript-eslint/no-explicit-any | ||
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined, | ||
@@ -69,0 +72,0 @@ ): Promise<T | TResult> { |
@@ -25,6 +25,12 @@ /*! | ||
export interface PromiseCacheOptions { | ||
/** Common expiration policy for all items added to this cache */ | ||
/** | ||
* Common expiration policy for all items added to this cache | ||
*/ | ||
expiry?: PromiseCacheExpiry; | ||
/** If the stored Promise is rejected with a particular error, should the given key be removed? */ | ||
removeOnError?: (e: any) => boolean; | ||
/** | ||
* If the stored Promise is rejected with a particular error, should the given key be removed? | ||
*/ | ||
// TODO: Use `unknown` instead (API breaking) | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
removeOnError?: (error: any) => boolean; | ||
} | ||
@@ -39,3 +45,3 @@ | ||
constructor( | ||
public constructor( | ||
private readonly expiry: PromiseCacheExpiry, | ||
@@ -91,3 +97,3 @@ private readonly cleanup: (key: TKey) => void, | ||
private readonly removeOnError: (error: any) => boolean; | ||
private readonly removeOnError: (error: unknown) => boolean; | ||
@@ -99,3 +105,3 @@ /** | ||
*/ | ||
constructor({ | ||
public constructor({ | ||
expiry = { policy: "indefinite" }, | ||
@@ -102,0 +108,0 @@ removeOnError = (): boolean => true, |
@@ -12,6 +12,6 @@ /*! | ||
private res: ((value: T | PromiseLike<T>) => void) | undefined; | ||
private rej: ((reason?: any) => void) | undefined; | ||
private rej: ((reason?: unknown) => void) | undefined; | ||
private completed: boolean = false; | ||
constructor() { | ||
public constructor() { | ||
this.p = new Promise<T>((resolve, reject) => { | ||
@@ -55,2 +55,4 @@ this.res = resolve; | ||
*/ | ||
// TODO: Use `unknown` instead (API breaking) | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types | ||
public reject(error: any): void { | ||
@@ -57,0 +59,0 @@ if (this.rej !== undefined) { |
@@ -109,3 +109,3 @@ /*! | ||
constructor( | ||
public constructor( | ||
private readonly defaultTimeout: number, | ||
@@ -149,6 +149,3 @@ private readonly defaultHandler: () => void, | ||
public restart(ms?: number, handler?: () => void): void { | ||
if (!this.runningState) { | ||
// If restart is called first, it behaves as a call to start | ||
this.start(ms, handler); | ||
} else { | ||
if (this.runningState) { | ||
const duration = ms ?? this.runningState.intendedDuration; | ||
@@ -177,2 +174,5 @@ const handlerToUse = | ||
} | ||
} else { | ||
// If restart is called first, it behaves as a call to start | ||
this.start(ms, handler); | ||
} | ||
@@ -203,7 +203,3 @@ } | ||
const restart = this.runningState.restart; | ||
if (restart !== undefined) { | ||
// Restart with remaining time | ||
const remainingTime = this.calculateRemainingTime(restart); | ||
this.startCore(remainingTime, () => restart.handler(), restart.duration); | ||
} else { | ||
if (restart === undefined) { | ||
// Run clear first, in case the handler decides to start again | ||
@@ -213,2 +209,6 @@ const handler = this.runningState.handler; | ||
handler(); | ||
} else { | ||
// Restart with remaining time | ||
const remainingTime = this.calculateRemainingTime(restart); | ||
this.startCore(remainingTime, () => restart.handler(), restart.duration); | ||
} | ||
@@ -256,3 +256,3 @@ } | ||
constructor(defaultTimeout: number, defaultHandler: () => void) { | ||
public constructor(defaultTimeout: number, defaultHandler: () => void) { | ||
this.timer = new Timer(defaultTimeout, () => this.wrapHandler(defaultHandler)); | ||
@@ -259,0 +259,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
219731
23
3136