@fluidframework/core-utils 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.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 +23 -0
- package/dist/legacy.d.ts +20 -0
- package/dist/public.d.ts +12 -0
- package/internal.d.ts +11 -0
- package/legacy.d.ts +11 -0
- package/lib/legacy.d.ts +20 -0
- package/lib/public.d.ts +12 -0
- package/package.json +24 -45
- package/api-extractor-cjs.json +0 -8
- package/dist/core-utils-alpha.d.ts +0 -195
- package/dist/core-utils-beta.d.ts +0 -45
- package/dist/core-utils-public.d.ts +0 -45
- package/dist/core-utils-untrimmed.d.ts +0 -432
- package/lib/core-utils-alpha.d.ts +0 -195
- package/lib/core-utils-beta.d.ts +0 -45
- package/lib/core-utils-public.d.ts +0 -45
- package/lib/core-utils-untrimmed.d.ts +0 -432
- package/lib/test/assert.spec.js +0 -21
- package/lib/test/assert.spec.js.map +0 -1
- package/lib/test/bench/compareArrays.bench.spec.js +0 -105
- package/lib/test/bench/compareArrays.bench.spec.js.map +0 -1
- package/lib/test/compareArrays.spec.js +0 -43
- package/lib/test/compareArrays.spec.js.map +0 -1
- package/lib/test/promiseCache.spec.js +0 -244
- package/lib/test/promiseCache.spec.js.map +0 -1
- package/lib/test/timer.spec.js +0 -274
- package/lib/test/timer.spec.js.map +0 -1
- package/lib/test/types/compareArrays.type.js +0 -21
- package/lib/test/types/compareArrays.type.js.map +0 -1
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @fluidframework/core-utils
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
8
|
+
|
|
9
|
+
Fluid Framework packages have been updated to use the [package.json "exports"
|
|
10
|
+
field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
|
|
11
|
+
TypeScript types and implementation code.
|
|
12
|
+
|
|
13
|
+
This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
|
|
14
|
+
|
|
15
|
+
- `"moduleResolution": "Node16"` with `"module": "Node16"`
|
|
16
|
+
- `"moduleResolution": "Bundler"` with `"module": "ESNext"`
|
|
17
|
+
|
|
18
|
+
We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
|
|
19
|
+
for use with modern versions of Node.js _and_ Bundlers.
|
|
20
|
+
[See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
|
|
21
|
+
regarding the module and moduleResolution options.
|
|
22
|
+
|
|
23
|
+
**Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
|
|
24
|
+
to distinguish stable APIs from those that are in development.**
|
|
25
|
+
|
|
3
26
|
## 2.0.0-rc.2.0.0
|
|
4
27
|
|
|
5
28
|
Dependency updates only.
|
package/dist/legacy.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
// alpha APIs
|
|
13
|
+
Deferred,
|
|
14
|
+
LazyPromise,
|
|
15
|
+
PromiseCache,
|
|
16
|
+
PromiseCacheExpiry,
|
|
17
|
+
PromiseCacheOptions,
|
|
18
|
+
assert,
|
|
19
|
+
compareArrays
|
|
20
|
+
} from "./index.js";
|
package/dist/public.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export {}
|
|
12
|
+
|
package/internal.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export * from "./lib/index.js";
|
package/legacy.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export * from "./lib/legacy.js";
|
package/lib/legacy.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
// alpha APIs
|
|
13
|
+
Deferred,
|
|
14
|
+
LazyPromise,
|
|
15
|
+
PromiseCache,
|
|
16
|
+
PromiseCacheExpiry,
|
|
17
|
+
PromiseCacheOptions,
|
|
18
|
+
assert,
|
|
19
|
+
compareArrays
|
|
20
|
+
} from "./index.js";
|
package/lib/public.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export {}
|
|
12
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/core-utils",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.3.0.0",
|
|
4
4
|
"description": "Not intended for use outside the Fluid client repo.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -15,31 +15,21 @@
|
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
17
|
"import": {
|
|
18
|
-
"types": "./lib/
|
|
19
|
-
"default": "./lib/index.js"
|
|
20
|
-
},
|
|
21
|
-
"require": {
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
|
-
"default": "./dist/index.js"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"./public": {
|
|
27
|
-
"import": {
|
|
28
|
-
"types": "./lib/core-utils-public.d.ts",
|
|
18
|
+
"types": "./lib/public.d.ts",
|
|
29
19
|
"default": "./lib/index.js"
|
|
30
20
|
},
|
|
31
21
|
"require": {
|
|
32
|
-
"types": "./dist/
|
|
22
|
+
"types": "./dist/public.d.ts",
|
|
33
23
|
"default": "./dist/index.js"
|
|
34
24
|
}
|
|
35
25
|
},
|
|
36
|
-
"./
|
|
26
|
+
"./legacy": {
|
|
37
27
|
"import": {
|
|
38
|
-
"types": "./lib/
|
|
28
|
+
"types": "./lib/legacy.d.ts",
|
|
39
29
|
"default": "./lib/index.js"
|
|
40
30
|
},
|
|
41
31
|
"require": {
|
|
42
|
-
"types": "./dist/
|
|
32
|
+
"types": "./dist/legacy.d.ts",
|
|
43
33
|
"default": "./dist/index.js"
|
|
44
34
|
}
|
|
45
35
|
},
|
|
@@ -54,8 +44,8 @@
|
|
|
54
44
|
}
|
|
55
45
|
}
|
|
56
46
|
},
|
|
57
|
-
"main": "
|
|
58
|
-
"types": "
|
|
47
|
+
"main": "lib/index.js",
|
|
48
|
+
"types": "lib/public.d.ts",
|
|
59
49
|
"c8": {
|
|
60
50
|
"all": true,
|
|
61
51
|
"cache-dir": "nyc/.cache",
|
|
@@ -77,13 +67,14 @@
|
|
|
77
67
|
"temp-directory": "nyc/.nyc_output"
|
|
78
68
|
},
|
|
79
69
|
"devDependencies": {
|
|
80
|
-
"@arethetypeswrong/cli": "^0.
|
|
81
|
-
"@
|
|
70
|
+
"@arethetypeswrong/cli": "^0.15.2",
|
|
71
|
+
"@biomejs/biome": "^1.6.2",
|
|
72
|
+
"@fluid-internal/mocha-test-setup": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
|
|
82
73
|
"@fluid-tools/benchmark": "^0.47.0",
|
|
83
|
-
"@fluid-tools/build-cli": "^0.
|
|
74
|
+
"@fluid-tools/build-cli": "^0.37.0",
|
|
84
75
|
"@fluidframework/build-common": "^2.0.3",
|
|
85
|
-
"@fluidframework/build-tools": "^0.
|
|
86
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
76
|
+
"@fluidframework/build-tools": "^0.37.0",
|
|
77
|
+
"@fluidframework/eslint-config-fluid": "^5.1.0",
|
|
87
78
|
"@microsoft/api-extractor": "^7.42.3",
|
|
88
79
|
"@types/mocha": "^9.1.1",
|
|
89
80
|
"@types/node": "^18.19.0",
|
|
@@ -102,47 +93,35 @@
|
|
|
102
93
|
"sinon": "^17.0.1",
|
|
103
94
|
"typescript": "~5.1.6"
|
|
104
95
|
},
|
|
105
|
-
"fluidBuild": {
|
|
106
|
-
"tasks": {
|
|
107
|
-
"build:docs": {
|
|
108
|
-
"dependsOn": [
|
|
109
|
-
"...",
|
|
110
|
-
"api-extractor:commonjs",
|
|
111
|
-
"api-extractor:esnext"
|
|
112
|
-
],
|
|
113
|
-
"script": false
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
96
|
"typeValidation": {
|
|
118
97
|
"disabled": true,
|
|
119
98
|
"broken": {}
|
|
120
99
|
},
|
|
121
100
|
"scripts": {
|
|
122
101
|
"api": "fluid-build . --task api",
|
|
123
|
-
"api-extractor:commonjs": "
|
|
124
|
-
"api-extractor:esnext": "
|
|
102
|
+
"api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
|
|
103
|
+
"api-extractor:esnext": "flub generate entrypoints --outFileAlpha legacy --outDir ./lib --node10TypeCompat",
|
|
125
104
|
"bench": "mocha --recursive \"lib/test/**/*.spec.*js\" --timeout 999999 --perfMode --parentProcess --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js",
|
|
126
105
|
"bench:profile": "mocha --recursive \"lib/test/**/*.spec.*js\" --v8-prof --v8-logfile=profile.log --v8-no-logfile-per-isolate --timeout 999999 --perfMode --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js && node --prof-process profile.log > profile.txt && rimraf profile.log && echo See results in profile.txt",
|
|
127
106
|
"build": "fluid-build . --task build",
|
|
128
107
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
129
108
|
"build:compile": "fluid-build . --task compile",
|
|
130
|
-
"build:docs": "
|
|
109
|
+
"build:docs": "api-extractor run --local",
|
|
131
110
|
"build:esnext": "tsc --project ./tsconfig.json",
|
|
132
111
|
"build:test": "npm run build:test:esm && npm run build:test:cjs",
|
|
133
112
|
"build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
|
|
134
113
|
"build:test:esm": "tsc --project ./src/test/tsconfig.json",
|
|
135
|
-
"check:are-the-types-wrong": "attw --pack .
|
|
114
|
+
"check:are-the-types-wrong": "attw --pack .",
|
|
115
|
+
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
136
116
|
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
137
117
|
"ci:build:docs": "api-extractor run",
|
|
138
|
-
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
118
|
+
"clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
139
119
|
"eslint": "eslint --format stylish src",
|
|
140
120
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
141
|
-
"format": "
|
|
142
|
-
"
|
|
143
|
-
"lint
|
|
144
|
-
"
|
|
145
|
-
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
121
|
+
"format": "fluid-build --task format .",
|
|
122
|
+
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
123
|
+
"lint": "fluid-build . --task lint",
|
|
124
|
+
"lint:fix": "fluid-build . --task eslint:fix --task format",
|
|
146
125
|
"test": "npm run test:mocha",
|
|
147
126
|
"test:benchmark:report": "mocha --recursive \"lib/test/**/*.spec.*js\" --node-option unhandled-rejections=strict,expose-gc --exit --perfMode --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js --timeout 60000",
|
|
148
127
|
"test:coverage": "c8 npm test",
|
package/api-extractor-cjs.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
|
|
4
|
-
// CJS is actually secondary; so, no report.
|
|
5
|
-
"apiReport": {
|
|
6
|
-
"enabled": false
|
|
7
|
-
}
|
|
8
|
-
}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A browser friendly assert library.
|
|
3
|
-
* Use this instead of the 'assert' package, which has a big impact on bundle sizes.
|
|
4
|
-
* @param condition - The condition that should be true, if the condition is false an error will be thrown.
|
|
5
|
-
* Only use this API when `false` indicates a logic error in the problem and thus a bug that should be fixed.
|
|
6
|
-
* @param message - The message to include in the error when the condition does not hold.
|
|
7
|
-
* A number should not be specified manually: use a string.
|
|
8
|
-
* Before a release, policy-check should be run, which will convert any asserts still using strings to
|
|
9
|
-
* use numbered error codes instead.
|
|
10
|
-
* @alpha
|
|
11
|
-
*/
|
|
12
|
-
export declare function assert(condition: boolean, message: string | number): asserts condition;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Compare two arrays. Returns true if their elements are equivalent and in the same order.
|
|
16
|
-
*
|
|
17
|
-
* @alpha
|
|
18
|
-
*
|
|
19
|
-
* @param left - The first array to compare
|
|
20
|
-
* @param right - The second array to compare
|
|
21
|
-
* @param comparator - The function used to check if two `T`s are equivalent.
|
|
22
|
-
* Defaults to `Object.is()` equality (a shallow compare where NaN = NaN and -0 ≠ 0)
|
|
23
|
-
*/
|
|
24
|
-
export declare const compareArrays: <T>(left: readonly T[], right: readonly T[], comparator?: (leftItem: T, rightItem: T, index: number) => boolean) => boolean;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* A deferred creates a promise and the ability to resolve or reject it
|
|
28
|
-
* @alpha
|
|
29
|
-
*/
|
|
30
|
-
export declare class Deferred<T> {
|
|
31
|
-
private readonly p;
|
|
32
|
-
private res;
|
|
33
|
-
private rej;
|
|
34
|
-
private completed;
|
|
35
|
-
constructor();
|
|
36
|
-
/**
|
|
37
|
-
* Returns whether the underlying promise has been completed
|
|
38
|
-
*/
|
|
39
|
-
get isCompleted(): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Retrieves the underlying promise for the deferred
|
|
42
|
-
*
|
|
43
|
-
* @returns the underlying promise
|
|
44
|
-
*/
|
|
45
|
-
get promise(): Promise<T>;
|
|
46
|
-
/**
|
|
47
|
-
* Resolves the promise
|
|
48
|
-
*
|
|
49
|
-
* @param value - the value to resolve the promise with
|
|
50
|
-
*/
|
|
51
|
-
resolve(value: T | PromiseLike<T>): void;
|
|
52
|
-
/**
|
|
53
|
-
* Rejects the promise
|
|
54
|
-
*
|
|
55
|
-
* @param value - the value to reject the promise with
|
|
56
|
-
*/
|
|
57
|
-
reject(error: any): void;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/* Excluded from this release type: delay */
|
|
61
|
-
|
|
62
|
-
/* Excluded from this release type: Heap */
|
|
63
|
-
|
|
64
|
-
/* Excluded from this release type: IComparer */
|
|
65
|
-
|
|
66
|
-
/* Excluded from this release type: IHeapNode */
|
|
67
|
-
|
|
68
|
-
/* Excluded from this release type: IPromiseTimer */
|
|
69
|
-
|
|
70
|
-
/* Excluded from this release type: IPromiseTimerResult */
|
|
71
|
-
|
|
72
|
-
/* Excluded from this release type: isObject */
|
|
73
|
-
|
|
74
|
-
/* Excluded from this release type: isPromiseLike */
|
|
75
|
-
|
|
76
|
-
/* Excluded from this release type: ITimer */
|
|
77
|
-
|
|
78
|
-
/* Excluded from this release type: Lazy */
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* A lazy evaluated promise. The execute function is delayed until
|
|
82
|
-
* the promise is used, e.g. await, then, catch ...
|
|
83
|
-
* The execute function is only called once.
|
|
84
|
-
* All calls are then proxied to the promise returned by the execute method.
|
|
85
|
-
* @alpha
|
|
86
|
-
*/
|
|
87
|
-
export declare class LazyPromise<T> implements Promise<T> {
|
|
88
|
-
private readonly execute;
|
|
89
|
-
get [Symbol.toStringTag](): string;
|
|
90
|
-
private result;
|
|
91
|
-
constructor(execute: () => Promise<T>);
|
|
92
|
-
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
93
|
-
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<T | TResult>;
|
|
94
|
-
finally(onfinally?: (() => void) | null | undefined): Promise<T>;
|
|
95
|
-
private getPromise;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/* Excluded from this release type: NumberComparer */
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* A specialized cache for async work, allowing you to safely cache the promised result of some async work
|
|
102
|
-
* without fear of running it multiple times or losing track of errors.
|
|
103
|
-
* @alpha
|
|
104
|
-
*/
|
|
105
|
-
export declare class PromiseCache<TKey, TResult> {
|
|
106
|
-
private readonly cache;
|
|
107
|
-
private readonly gc;
|
|
108
|
-
private readonly removeOnError;
|
|
109
|
-
/**
|
|
110
|
-
* Create the PromiseCache with the given options, with the following defaults:
|
|
111
|
-
*
|
|
112
|
-
* expiry: indefinite, removeOnError: true for all errors
|
|
113
|
-
*/
|
|
114
|
-
constructor({ expiry, removeOnError, }?: PromiseCacheOptions);
|
|
115
|
-
/**
|
|
116
|
-
* Check if there's anything cached at the given key
|
|
117
|
-
*/
|
|
118
|
-
has(key: TKey): boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Get the Promise for the given key, or undefined if it's not found.
|
|
121
|
-
* Extend expiry if applicable.
|
|
122
|
-
*/
|
|
123
|
-
get(key: TKey): Promise<TResult> | undefined;
|
|
124
|
-
/**
|
|
125
|
-
* Remove the Promise for the given key, returning true if it was found and removed
|
|
126
|
-
*/
|
|
127
|
-
remove(key: TKey): boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Try to add the result of the given asyncFn, without overwriting an existing cache entry at that key.
|
|
130
|
-
* Returns a Promise for the added or existing async work being done at that key.
|
|
131
|
-
* @param key - key name where to store the async work
|
|
132
|
-
* @param asyncFn - the async work to do and store, if not already in progress under the given key
|
|
133
|
-
*/
|
|
134
|
-
addOrGet(key: TKey, asyncFn: () => Promise<TResult>): Promise<TResult>;
|
|
135
|
-
/**
|
|
136
|
-
* Try to add the result of the given asyncFn, without overwriting an existing cache entry at that key.
|
|
137
|
-
* Returns false if the cache already contained an entry at that key, and true otherwise.
|
|
138
|
-
* @param key - key name where to store the async work
|
|
139
|
-
* @param asyncFn - the async work to do and store, if not already in progress under the given key
|
|
140
|
-
*/
|
|
141
|
-
add(key: TKey, asyncFn: () => Promise<TResult>): boolean;
|
|
142
|
-
/**
|
|
143
|
-
* Try to add the given value, without overwriting an existing cache entry at that key.
|
|
144
|
-
* Returns a Promise for the added or existing async work being done at that key.
|
|
145
|
-
* @param key - key name where to store the async work
|
|
146
|
-
* @param value - value to store
|
|
147
|
-
*/
|
|
148
|
-
addValueOrGet(key: TKey, value: TResult): Promise<TResult>;
|
|
149
|
-
/**
|
|
150
|
-
* Try to add the given value, without overwriting an existing cache entry at that key.
|
|
151
|
-
* Returns false if the cache already contained an entry at that key, and true otherwise.
|
|
152
|
-
* @param key - key name where to store the value
|
|
153
|
-
* @param value - value to store
|
|
154
|
-
*/
|
|
155
|
-
addValue(key: TKey, value: TResult): boolean;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Three supported expiry policies:
|
|
160
|
-
* - indefinite: entries don't expire and must be explicitly removed
|
|
161
|
-
* - absolute: entries expire after the given duration in MS, even if accessed multiple times in the mean time
|
|
162
|
-
* - sliding: entries expire after the given duration in MS of inactivity (i.e. get resets the clock)
|
|
163
|
-
* @alpha
|
|
164
|
-
*/
|
|
165
|
-
export declare type PromiseCacheExpiry = {
|
|
166
|
-
policy: "indefinite";
|
|
167
|
-
} | {
|
|
168
|
-
policy: "absolute" | "sliding";
|
|
169
|
-
durationMs: number;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Options for configuring the {@link PromiseCache}
|
|
174
|
-
* @alpha
|
|
175
|
-
*/
|
|
176
|
-
export declare interface PromiseCacheOptions {
|
|
177
|
-
/**
|
|
178
|
-
* Common expiration policy for all items added to this cache
|
|
179
|
-
*/
|
|
180
|
-
expiry?: PromiseCacheExpiry;
|
|
181
|
-
/**
|
|
182
|
-
* If the stored Promise is rejected with a particular error, should the given key be removed?
|
|
183
|
-
*/
|
|
184
|
-
removeOnError?: (error: any) => boolean;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/* Excluded from this release type: PromiseTimer */
|
|
188
|
-
|
|
189
|
-
/* Excluded from this release type: setLongTimeout */
|
|
190
|
-
|
|
191
|
-
/* Excluded from this release type: Timer */
|
|
192
|
-
|
|
193
|
-
/* Excluded from this release type: unreachableCase */
|
|
194
|
-
|
|
195
|
-
export { }
|
|
@@ -1,45 +0,0 @@
|
|
|
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: isObject */
|
|
20
|
-
|
|
21
|
-
/* Excluded from this release type: isPromiseLike */
|
|
22
|
-
|
|
23
|
-
/* Excluded from this release type: ITimer */
|
|
24
|
-
|
|
25
|
-
/* Excluded from this release type: Lazy */
|
|
26
|
-
|
|
27
|
-
/* Excluded from this release type: LazyPromise */
|
|
28
|
-
|
|
29
|
-
/* Excluded from this release type: NumberComparer */
|
|
30
|
-
|
|
31
|
-
/* Excluded from this release type: PromiseCache */
|
|
32
|
-
|
|
33
|
-
/* Excluded from this release type: PromiseCacheExpiry */
|
|
34
|
-
|
|
35
|
-
/* Excluded from this release type: PromiseCacheOptions */
|
|
36
|
-
|
|
37
|
-
/* Excluded from this release type: PromiseTimer */
|
|
38
|
-
|
|
39
|
-
/* Excluded from this release type: setLongTimeout */
|
|
40
|
-
|
|
41
|
-
/* Excluded from this release type: Timer */
|
|
42
|
-
|
|
43
|
-
/* Excluded from this release type: unreachableCase */
|
|
44
|
-
|
|
45
|
-
export { }
|
|
@@ -1,45 +0,0 @@
|
|
|
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: isObject */
|
|
20
|
-
|
|
21
|
-
/* Excluded from this release type: isPromiseLike */
|
|
22
|
-
|
|
23
|
-
/* Excluded from this release type: ITimer */
|
|
24
|
-
|
|
25
|
-
/* Excluded from this release type: Lazy */
|
|
26
|
-
|
|
27
|
-
/* Excluded from this release type: LazyPromise */
|
|
28
|
-
|
|
29
|
-
/* Excluded from this release type: NumberComparer */
|
|
30
|
-
|
|
31
|
-
/* Excluded from this release type: PromiseCache */
|
|
32
|
-
|
|
33
|
-
/* Excluded from this release type: PromiseCacheExpiry */
|
|
34
|
-
|
|
35
|
-
/* Excluded from this release type: PromiseCacheOptions */
|
|
36
|
-
|
|
37
|
-
/* Excluded from this release type: PromiseTimer */
|
|
38
|
-
|
|
39
|
-
/* Excluded from this release type: setLongTimeout */
|
|
40
|
-
|
|
41
|
-
/* Excluded from this release type: Timer */
|
|
42
|
-
|
|
43
|
-
/* Excluded from this release type: unreachableCase */
|
|
44
|
-
|
|
45
|
-
export { }
|