@fluidframework/core-utils 2.0.0-internal.7.2.2 → 2.0.0-internal.7.4.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 +8 -0
- package/README.md +7 -3
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- package/api-report/core-utils.api.md +19 -19
- package/dist/assert.d.ts +1 -1
- package/dist/assert.js +1 -1
- package/dist/assert.js.map +1 -1
- package/dist/core-utils-alpha.d.ts +154 -0
- package/dist/core-utils-beta.d.ts +41 -0
- package/dist/core-utils-public.d.ts +41 -0
- package/dist/core-utils-untrimmed.d.ts +414 -0
- package/dist/delay.d.ts +1 -1
- package/dist/delay.js +1 -1
- package/dist/delay.js.map +1 -1
- package/dist/heap.d.ts +4 -4
- package/dist/heap.js +2 -2
- package/dist/heap.js.map +1 -1
- package/dist/lazy.d.ts +2 -2
- package/dist/lazy.js +2 -2
- package/dist/lazy.js.map +1 -1
- package/dist/promiseCache.d.ts +3 -3
- package/dist/promiseCache.js +1 -1
- package/dist/promiseCache.js.map +1 -1
- package/dist/promises.d.ts +1 -1
- package/dist/promises.js +1 -1
- package/dist/promises.js.map +1 -1
- package/dist/timer.d.ts +6 -6
- package/dist/timer.js +3 -3
- package/dist/timer.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/unreachable.d.ts +1 -1
- package/dist/unreachable.js +1 -1
- package/dist/unreachable.js.map +1 -1
- package/lib/assert.d.ts +1 -1
- package/lib/assert.js +6 -2
- package/lib/assert.js.map +1 -1
- package/lib/compare.js +5 -1
- package/lib/compare.js.map +1 -1
- package/lib/core-utils-alpha.d.ts +154 -0
- package/lib/core-utils-beta.d.ts +41 -0
- package/lib/core-utils-public.d.ts +41 -0
- package/lib/core-utils-untrimmed.d.ts +414 -0
- package/lib/delay.d.ts +1 -1
- package/lib/delay.js +6 -2
- package/lib/delay.js.map +1 -1
- package/lib/heap.d.ts +4 -4
- package/lib/heap.js +8 -4
- package/lib/heap.js.map +1 -1
- package/lib/index.js +25 -9
- package/lib/index.js.map +1 -1
- package/lib/lazy.d.ts +2 -2
- package/lib/lazy.js +9 -4
- package/lib/lazy.js.map +1 -1
- package/lib/promiseCache.d.ts +3 -3
- package/lib/promiseCache.js +6 -2
- package/lib/promiseCache.js.map +1 -1
- package/lib/promises.d.ts +1 -1
- package/lib/promises.js +6 -2
- package/lib/promises.js.map +1 -1
- package/lib/timer.d.ts +6 -6
- package/lib/timer.js +17 -11
- package/lib/timer.js.map +1 -1
- package/lib/unreachable.d.ts +1 -1
- package/lib/unreachable.js +6 -2
- package/lib/unreachable.js.map +1 -1
- package/package.json +33 -14
- package/src/assert.ts +1 -1
- package/src/delay.ts +1 -1
- package/src/heap.ts +4 -4
- package/src/lazy.ts +2 -2
- package/src/promiseCache.ts +3 -3
- package/src/promises.ts +1 -1
- package/src/timer.ts +6 -6
- package/src/unreachable.ts +1 -1
- package/tsconfig.esnext.json +1 -2
- package/tsconfig.json +6 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
This package is intended for sharing and promoting best-practice implementations of Fluid-agnostic utility functions
|
|
4
4
|
across packages in the Fluid Framework repo.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_PACKAGE_SCOPE_NOTICE:scopeKind=INTERNAL) -->
|
|
7
|
+
|
|
8
|
+
**IMPORTANT: This package is intended strictly as an implementation detail of the Fluid Framework and is not intended for public consumption.**
|
|
9
|
+
**We make no stability guarantees regarding its APIs.**
|
|
10
|
+
|
|
11
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
7
12
|
|
|
8
13
|
## Adding code to this package
|
|
9
14
|
|
|
@@ -61,8 +66,7 @@ package for more information including tools to convert between version schemes.
|
|
|
61
66
|
|
|
62
67
|
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
63
68
|
|
|
64
|
-
Use of these trademarks or logos must follow Microsoft's [Trademark & Brand
|
|
65
|
-
Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
69
|
+
Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
66
70
|
|
|
67
71
|
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
68
72
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-lint.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: remove once base config has this enabled as an error
|
|
7
|
+
"ae-incompatible-release-tags": {
|
|
8
|
+
"logLevel": "error",
|
|
9
|
+
"addToApiReportFile": false
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
package/api-extractor.json
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: Add missing documentation and remove this rule override
|
|
7
|
+
"ae-undocumented": {
|
|
8
|
+
"logLevel": "none"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
4
12
|
}
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
// @
|
|
7
|
+
// @internal
|
|
8
8
|
export function assert(condition: boolean, message: string | number): asserts condition;
|
|
9
9
|
|
|
10
10
|
// @internal
|
|
11
11
|
export const compareArrays: <T>(left: readonly T[], right: readonly T[], comparator?: (leftItem: T, rightItem: T, index: number) => boolean) => boolean;
|
|
12
12
|
|
|
13
|
-
// @
|
|
13
|
+
// @alpha
|
|
14
14
|
export class Deferred<T> {
|
|
15
15
|
constructor();
|
|
16
16
|
get isCompleted(): boolean;
|
|
@@ -19,10 +19,10 @@ export class Deferred<T> {
|
|
|
19
19
|
resolve(value: T | PromiseLike<T>): void;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
// @
|
|
22
|
+
// @internal
|
|
23
23
|
export const delay: (timeMs: number) => Promise<void>;
|
|
24
24
|
|
|
25
|
-
// @
|
|
25
|
+
// @internal
|
|
26
26
|
export class Heap<T> {
|
|
27
27
|
constructor(comp: IComparer<T>);
|
|
28
28
|
add(x: T): IHeapNode<T>;
|
|
@@ -35,13 +35,13 @@ export class Heap<T> {
|
|
|
35
35
|
update(node: IHeapNode<T>): void;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// @
|
|
38
|
+
// @internal
|
|
39
39
|
export interface IComparer<T> {
|
|
40
40
|
compare(a: T, b: T): number;
|
|
41
41
|
min: T;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
// @
|
|
44
|
+
// @internal
|
|
45
45
|
export interface IHeapNode<T> {
|
|
46
46
|
// (undocumented)
|
|
47
47
|
position: number;
|
|
@@ -49,32 +49,32 @@ export interface IHeapNode<T> {
|
|
|
49
49
|
value: T;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
// @
|
|
52
|
+
// @internal
|
|
53
53
|
export interface IPromiseTimer extends ITimer {
|
|
54
54
|
start(): Promise<IPromiseTimerResult>;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
// @
|
|
57
|
+
// @internal (undocumented)
|
|
58
58
|
export interface IPromiseTimerResult {
|
|
59
59
|
// (undocumented)
|
|
60
60
|
timerResult: "timeout" | "cancel";
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
// @
|
|
63
|
+
// @internal (undocumented)
|
|
64
64
|
export interface ITimer {
|
|
65
65
|
clear(): void;
|
|
66
66
|
readonly hasTimer: boolean;
|
|
67
67
|
start(): void;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
// @
|
|
70
|
+
// @internal
|
|
71
71
|
export class Lazy<T> {
|
|
72
72
|
constructor(valueGenerator: () => T);
|
|
73
73
|
get evaluated(): boolean;
|
|
74
74
|
get value(): T;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
// @
|
|
77
|
+
// @internal
|
|
78
78
|
export class LazyPromise<T> implements Promise<T> {
|
|
79
79
|
// (undocumented)
|
|
80
80
|
get [Symbol.toStringTag](): string;
|
|
@@ -87,10 +87,10 @@ export class LazyPromise<T> implements Promise<T> {
|
|
|
87
87
|
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
// @
|
|
90
|
+
// @internal
|
|
91
91
|
export const NumberComparer: IComparer<number>;
|
|
92
92
|
|
|
93
|
-
// @
|
|
93
|
+
// @alpha
|
|
94
94
|
export class PromiseCache<TKey, TResult> {
|
|
95
95
|
constructor({ expiry, removeOnError, }?: PromiseCacheOptions);
|
|
96
96
|
add(key: TKey, asyncFn: () => Promise<TResult>): boolean;
|
|
@@ -102,7 +102,7 @@ export class PromiseCache<TKey, TResult> {
|
|
|
102
102
|
remove(key: TKey): boolean;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
// @
|
|
105
|
+
// @alpha
|
|
106
106
|
export type PromiseCacheExpiry = {
|
|
107
107
|
policy: "indefinite";
|
|
108
108
|
} | {
|
|
@@ -110,13 +110,13 @@ export type PromiseCacheExpiry = {
|
|
|
110
110
|
durationMs: number;
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
// @
|
|
113
|
+
// @alpha
|
|
114
114
|
export interface PromiseCacheOptions {
|
|
115
115
|
expiry?: PromiseCacheExpiry;
|
|
116
116
|
removeOnError?: (error: any) => boolean;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
// @
|
|
119
|
+
// @internal
|
|
120
120
|
export class PromiseTimer implements IPromiseTimer {
|
|
121
121
|
constructor(defaultTimeout: number, defaultHandler: () => void);
|
|
122
122
|
// (undocumented)
|
|
@@ -127,10 +127,10 @@ export class PromiseTimer implements IPromiseTimer {
|
|
|
127
127
|
protected wrapHandler(handler: () => void): void;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
// @
|
|
130
|
+
// @internal
|
|
131
131
|
export function setLongTimeout(timeoutFn: () => void, timeoutMs: number, setTimeoutIdFn?: (timeoutId: ReturnType<typeof setTimeout>) => void): ReturnType<typeof setTimeout>;
|
|
132
132
|
|
|
133
|
-
// @
|
|
133
|
+
// @internal
|
|
134
134
|
export class Timer implements ITimer {
|
|
135
135
|
constructor(defaultTimeout: number, defaultHandler: () => void, getCurrentTick?: () => number);
|
|
136
136
|
clear(): void;
|
|
@@ -139,7 +139,7 @@ export class Timer implements ITimer {
|
|
|
139
139
|
start(ms?: number, handler?: () => void): void;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
// @
|
|
142
|
+
// @internal
|
|
143
143
|
export function unreachableCase(_: never, message?: string): never;
|
|
144
144
|
|
|
145
145
|
// (No @packageDocumentation comment for this package)
|
package/dist/assert.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* A number should not be specified manually: use a string.
|
|
12
12
|
* Before a release, policy-check should be run, which will convert any asserts still using strings to
|
|
13
13
|
* use numbered error codes instead.
|
|
14
|
-
* @
|
|
14
|
+
* @internal
|
|
15
15
|
*/
|
|
16
16
|
export declare function assert(condition: boolean, message: string | number): asserts condition;
|
|
17
17
|
//# sourceMappingURL=assert.d.ts.map
|
package/dist/assert.js
CHANGED
|
@@ -14,7 +14,7 @@ exports.assert = void 0;
|
|
|
14
14
|
* A number should not be specified manually: use a string.
|
|
15
15
|
* Before a release, policy-check should be run, which will convert any asserts still using strings to
|
|
16
16
|
* use numbered error codes instead.
|
|
17
|
-
* @
|
|
17
|
+
* @internal
|
|
18
18
|
*/
|
|
19
19
|
function assert(condition, message) {
|
|
20
20
|
if (!condition) {
|
package/dist/assert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../src/assert.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CAAC,SAAkB,EAAE,OAAwB;IAClE,IAAI,CAAC,SAAS,EAAE;QACf,MAAM,IAAI,KAAK,CACd,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CACpF,CAAC;KACF;AACF,CAAC;AAND,wBAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A browser friendly assert library.\n * Use this instead of the 'assert' package, which has a big impact on bundle sizes.\n * @param condition - The condition that should be true, if the condition is false an error will be thrown.\n * Only use this API when `false` indicates a logic error in the problem and thus a bug that should be fixed.\n * @param message - The message to include in the error when the condition does not hold.\n * A number should not be specified manually: use a string.\n * Before a release, policy-check should be run, which will convert any asserts still using strings to\n * use numbered error codes instead.\n * @
|
|
1
|
+
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../src/assert.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CAAC,SAAkB,EAAE,OAAwB;IAClE,IAAI,CAAC,SAAS,EAAE;QACf,MAAM,IAAI,KAAK,CACd,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CACpF,CAAC;KACF;AACF,CAAC;AAND,wBAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A browser friendly assert library.\n * Use this instead of the 'assert' package, which has a big impact on bundle sizes.\n * @param condition - The condition that should be true, if the condition is false an error will be thrown.\n * Only use this API when `false` indicates a logic error in the problem and thus a bug that should be fixed.\n * @param message - The message to include in the error when the condition does not hold.\n * A number should not be specified manually: use a string.\n * Before a release, policy-check should be run, which will convert any asserts still using strings to\n * use numbered error codes instead.\n * @internal\n */\nexport function assert(condition: boolean, message: string | number): asserts condition {\n\tif (!condition) {\n\t\tthrow new Error(\n\t\t\ttypeof message === \"number\" ? `0x${message.toString(16).padStart(3, \"0\")}` : message,\n\t\t);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/* Excluded from this release type: assert */
|
|
2
|
+
|
|
3
|
+
/* Excluded from this release type: compareArrays */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A deferred creates a promise and the ability to resolve or reject it
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export declare class Deferred<T> {
|
|
10
|
+
private readonly p;
|
|
11
|
+
private res;
|
|
12
|
+
private rej;
|
|
13
|
+
private completed;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Returns whether the underlying promise has been completed
|
|
17
|
+
*/
|
|
18
|
+
get isCompleted(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the underlying promise for the deferred
|
|
21
|
+
*
|
|
22
|
+
* @returns the underlying promise
|
|
23
|
+
*/
|
|
24
|
+
get promise(): Promise<T>;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves the promise
|
|
27
|
+
*
|
|
28
|
+
* @param value - the value to resolve the promise with
|
|
29
|
+
*/
|
|
30
|
+
resolve(value: T | PromiseLike<T>): void;
|
|
31
|
+
/**
|
|
32
|
+
* Rejects the promise
|
|
33
|
+
*
|
|
34
|
+
* @param value - the value to reject the promise with
|
|
35
|
+
*/
|
|
36
|
+
reject(error: any): void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Excluded from this release type: delay */
|
|
40
|
+
|
|
41
|
+
/* Excluded from this release type: Heap */
|
|
42
|
+
|
|
43
|
+
/* Excluded from this release type: IComparer */
|
|
44
|
+
|
|
45
|
+
/* Excluded from this release type: IHeapNode */
|
|
46
|
+
|
|
47
|
+
/* Excluded from this release type: IPromiseTimer */
|
|
48
|
+
|
|
49
|
+
/* Excluded from this release type: IPromiseTimerResult */
|
|
50
|
+
|
|
51
|
+
/* Excluded from this release type: ITimer */
|
|
52
|
+
|
|
53
|
+
/* Excluded from this release type: Lazy */
|
|
54
|
+
|
|
55
|
+
/* Excluded from this release type: LazyPromise */
|
|
56
|
+
|
|
57
|
+
/* Excluded from this release type: NumberComparer */
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A specialized cache for async work, allowing you to safely cache the promised result of some async work
|
|
61
|
+
* without fear of running it multiple times or losing track of errors.
|
|
62
|
+
* @alpha
|
|
63
|
+
*/
|
|
64
|
+
export declare class PromiseCache<TKey, TResult> {
|
|
65
|
+
private readonly cache;
|
|
66
|
+
private readonly gc;
|
|
67
|
+
private readonly removeOnError;
|
|
68
|
+
/**
|
|
69
|
+
* Create the PromiseCache with the given options, with the following defaults:
|
|
70
|
+
*
|
|
71
|
+
* expiry: indefinite, removeOnError: true for all errors
|
|
72
|
+
*/
|
|
73
|
+
constructor({ expiry, removeOnError, }?: PromiseCacheOptions);
|
|
74
|
+
/**
|
|
75
|
+
* Check if there's anything cached at the given key
|
|
76
|
+
*/
|
|
77
|
+
has(key: TKey): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Get the Promise for the given key, or undefined if it's not found.
|
|
80
|
+
* Extend expiry if applicable.
|
|
81
|
+
*/
|
|
82
|
+
get(key: TKey): Promise<TResult> | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Remove the Promise for the given key, returning true if it was found and removed
|
|
85
|
+
*/
|
|
86
|
+
remove(key: TKey): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Try to add the result of the given asyncFn, without overwriting an existing cache entry at that key.
|
|
89
|
+
* Returns a Promise for the added or existing async work being done at that key.
|
|
90
|
+
* @param key - key name where to store the async work
|
|
91
|
+
* @param asyncFn - the async work to do and store, if not already in progress under the given key
|
|
92
|
+
*/
|
|
93
|
+
addOrGet(key: TKey, asyncFn: () => Promise<TResult>): Promise<TResult>;
|
|
94
|
+
/**
|
|
95
|
+
* Try to add the result of the given asyncFn, without overwriting an existing cache entry at that key.
|
|
96
|
+
* Returns false if the cache already contained an entry at that key, and true otherwise.
|
|
97
|
+
* @param key - key name where to store the async work
|
|
98
|
+
* @param asyncFn - the async work to do and store, if not already in progress under the given key
|
|
99
|
+
*/
|
|
100
|
+
add(key: TKey, asyncFn: () => Promise<TResult>): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Try to add the given value, without overwriting an existing cache entry at that key.
|
|
103
|
+
* Returns a Promise for the added or existing async work being done at that key.
|
|
104
|
+
* @param key - key name where to store the async work
|
|
105
|
+
* @param value - value to store
|
|
106
|
+
*/
|
|
107
|
+
addValueOrGet(key: TKey, value: TResult): Promise<TResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Try to add the given value, without overwriting an existing cache entry at that key.
|
|
110
|
+
* Returns false if the cache already contained an entry at that key, and true otherwise.
|
|
111
|
+
* @param key - key name where to store the value
|
|
112
|
+
* @param value - value to store
|
|
113
|
+
*/
|
|
114
|
+
addValue(key: TKey, value: TResult): boolean;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Three supported expiry policies:
|
|
119
|
+
* - indefinite: entries don't expire and must be explicitly removed
|
|
120
|
+
* - absolute: entries expire after the given duration in MS, even if accessed multiple times in the mean time
|
|
121
|
+
* - sliding: entries expire after the given duration in MS of inactivity (i.e. get resets the clock)
|
|
122
|
+
* @alpha
|
|
123
|
+
*/
|
|
124
|
+
export declare type PromiseCacheExpiry = {
|
|
125
|
+
policy: "indefinite";
|
|
126
|
+
} | {
|
|
127
|
+
policy: "absolute" | "sliding";
|
|
128
|
+
durationMs: number;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Options for configuring the {@link PromiseCache}
|
|
133
|
+
* @alpha
|
|
134
|
+
*/
|
|
135
|
+
export declare interface PromiseCacheOptions {
|
|
136
|
+
/**
|
|
137
|
+
* Common expiration policy for all items added to this cache
|
|
138
|
+
*/
|
|
139
|
+
expiry?: PromiseCacheExpiry;
|
|
140
|
+
/**
|
|
141
|
+
* If the stored Promise is rejected with a particular error, should the given key be removed?
|
|
142
|
+
*/
|
|
143
|
+
removeOnError?: (error: any) => boolean;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* Excluded from this release type: PromiseTimer */
|
|
147
|
+
|
|
148
|
+
/* Excluded from this release type: setLongTimeout */
|
|
149
|
+
|
|
150
|
+
/* Excluded from this release type: Timer */
|
|
151
|
+
|
|
152
|
+
/* Excluded from this release type: unreachableCase */
|
|
153
|
+
|
|
154
|
+
export { }
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* Excluded from this release type: assert */
|
|
2
|
+
|
|
3
|
+
/* Excluded from this release type: compareArrays */
|
|
4
|
+
|
|
5
|
+
/* Excluded from this release type: Deferred */
|
|
6
|
+
|
|
7
|
+
/* Excluded from this release type: delay */
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: Heap */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: IComparer */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: IHeapNode */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: IPromiseTimer */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: IPromiseTimerResult */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: ITimer */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: Lazy */
|
|
22
|
+
|
|
23
|
+
/* Excluded from this release type: LazyPromise */
|
|
24
|
+
|
|
25
|
+
/* Excluded from this release type: NumberComparer */
|
|
26
|
+
|
|
27
|
+
/* Excluded from this release type: PromiseCache */
|
|
28
|
+
|
|
29
|
+
/* Excluded from this release type: PromiseCacheExpiry */
|
|
30
|
+
|
|
31
|
+
/* Excluded from this release type: PromiseCacheOptions */
|
|
32
|
+
|
|
33
|
+
/* Excluded from this release type: PromiseTimer */
|
|
34
|
+
|
|
35
|
+
/* Excluded from this release type: setLongTimeout */
|
|
36
|
+
|
|
37
|
+
/* Excluded from this release type: Timer */
|
|
38
|
+
|
|
39
|
+
/* Excluded from this release type: unreachableCase */
|
|
40
|
+
|
|
41
|
+
export { }
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* Excluded from this release type: assert */
|
|
2
|
+
|
|
3
|
+
/* Excluded from this release type: compareArrays */
|
|
4
|
+
|
|
5
|
+
/* Excluded from this release type: Deferred */
|
|
6
|
+
|
|
7
|
+
/* Excluded from this release type: delay */
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: Heap */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: IComparer */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: IHeapNode */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: IPromiseTimer */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: IPromiseTimerResult */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: ITimer */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: Lazy */
|
|
22
|
+
|
|
23
|
+
/* Excluded from this release type: LazyPromise */
|
|
24
|
+
|
|
25
|
+
/* Excluded from this release type: NumberComparer */
|
|
26
|
+
|
|
27
|
+
/* Excluded from this release type: PromiseCache */
|
|
28
|
+
|
|
29
|
+
/* Excluded from this release type: PromiseCacheExpiry */
|
|
30
|
+
|
|
31
|
+
/* Excluded from this release type: PromiseCacheOptions */
|
|
32
|
+
|
|
33
|
+
/* Excluded from this release type: PromiseTimer */
|
|
34
|
+
|
|
35
|
+
/* Excluded from this release type: setLongTimeout */
|
|
36
|
+
|
|
37
|
+
/* Excluded from this release type: Timer */
|
|
38
|
+
|
|
39
|
+
/* Excluded from this release type: unreachableCase */
|
|
40
|
+
|
|
41
|
+
export { }
|