proxy-facades 1.4.0 → 1.6.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/dist/commonjs/retsync.d.ts +12 -2
- package/dist/commonjs/retsync.d.ts.map +1 -1
- package/dist/commonjs/retsync.js +39 -7
- package/dist/commonjs/retsync.js.map +1 -1
- package/dist/esm/retsync.d.ts +12 -2
- package/dist/esm/retsync.d.ts.map +1 -1
- package/dist/esm/retsync.js +38 -7
- package/dist/esm/retsync.js.map +1 -1
- package/package.json +1 -1
- package/retsync.ts +41 -8
|
@@ -4,17 +4,23 @@ type Retsync2promiseOptions = {
|
|
|
4
4
|
*/
|
|
5
5
|
checkSaved?: boolean;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Internal / used in frameworks.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Retsync2promiseCall {
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
|
-
* Global state.
|
|
13
|
+
* Global state. Internal / shared with frameworks.
|
|
11
14
|
*/
|
|
12
15
|
export declare const _global: {
|
|
13
16
|
resolvedPromiseValues: WeakMap<Promise<any>, unknown>;
|
|
14
17
|
retsync2promiseCall?: Retsync2promiseCall;
|
|
18
|
+
globalObj: {};
|
|
19
|
+
resourcePromises: import("./Util").DefaultMap<unknown, Map<string | number | undefined, Promise<unknown>>>;
|
|
15
20
|
};
|
|
16
21
|
/**
|
|
17
22
|
* Let's you run retsync code and wait, till it is finished.
|
|
23
|
+
* Errors by promises won't be catched. They will fall down, so you can catch them. Error state is not cached, so it will always be tried fresh on every retsync2promise run.
|
|
18
24
|
* @param repeatableFn
|
|
19
25
|
* @param options
|
|
20
26
|
*/
|
|
@@ -32,9 +38,13 @@ export declare function promise2retsync<T>(savedPromise: Promise<T>): T;
|
|
|
32
38
|
* <code>asyncResource2retsync( async() => {...load the avatar...}, myUser, "getAvatar");</code>
|
|
33
39
|
* So the User#getAvatar is, what uniquely identifies the loaderFn here.
|
|
34
40
|
* </p>
|
|
41
|
+
* <p>
|
|
42
|
+
* Error handling: Failed promises (loaderFn fails) are forgotten, so next time the retsync code invokes asyncResource2retsync, it is tried fresh again
|
|
43
|
+
* </p>
|
|
35
44
|
* @param loaderFn
|
|
36
45
|
* @param idObj object to associate this call to. undefined means globally and the idKey primitive value is the only key.
|
|
37
46
|
* @param idKey Additional primitive key under idObj.
|
|
47
|
+
* @see cleanResource
|
|
38
48
|
*/
|
|
39
49
|
export declare function asyncResource2retsync<T>(loaderFn: () => Promise<T>, idObj: object | undefined, idKey?: (string | number)): T;
|
|
40
50
|
export declare class RetsyncWaitsForPromiseException extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retsync.d.ts","sourceRoot":"","sources":["../../retsync.ts"],"names":[],"mappings":"AASA,KAAK,sBAAsB,GAAG;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,
|
|
1
|
+
{"version":3,"file":"retsync.d.ts","sourceRoot":"","sources":["../../retsync.ts"],"names":[],"mappings":"AASA,KAAK,sBAAsB,GAAG;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED;;GAEG;AACH,qBAAa,mBAAmB;CAE/B;AAED;;GAEG;AACH,eAAO,MAAM,OAAO;;0BAEM,mBAAmB;;;CAG5C,CAAA;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,CAAC,CAAC,CA0DhH;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAM9D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAK,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,GAAC,MAAM,CAAC,GAAG,CAAC,CA6BzH;AAqBD,qBAAa,+BAAgC,SAAQ,KAAK;IACtD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;gBAET,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC;CAIpC;AAED,wBAAgB,6BAA6B,SAI5C;;AAID;;GAEG"}
|
package/dist/commonjs/retsync.js
CHANGED
|
@@ -5,24 +5,31 @@
|
|
|
5
5
|
// Semantics: Retsync code must be repeatable. It can change state, as long as that leads to the same result when repeated.
|
|
6
6
|
// It does not mean strictly deterministic (may be for while in the same sync block??) because resources that are fetched, can change over time. Therefore some inner user's retsync code might subscribe to change events and invalidate asyncResource2retsync's cached promises when there are such changes.
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.RetsyncWaitsForPromiseException = exports._global = void 0;
|
|
8
|
+
exports.RetsyncWaitsForPromiseException = exports._global = exports.Retsync2promiseCall = void 0;
|
|
9
9
|
exports.retsync2promise = retsync2promise;
|
|
10
10
|
exports.promise2retsync = promise2retsync;
|
|
11
11
|
exports.asyncResource2retsync = asyncResource2retsync;
|
|
12
12
|
exports.checkThatCallerHandlesRetsync = checkThatCallerHandlesRetsync;
|
|
13
13
|
const Util_1 = require("./Util");
|
|
14
|
+
/**
|
|
15
|
+
* Internal / used in frameworks.
|
|
16
|
+
*/
|
|
14
17
|
class Retsync2promiseCall {
|
|
15
18
|
}
|
|
19
|
+
exports.Retsync2promiseCall = Retsync2promiseCall;
|
|
16
20
|
/**
|
|
17
|
-
* Global state.
|
|
21
|
+
* Global state. Internal / shared with frameworks.
|
|
18
22
|
*/
|
|
19
23
|
exports._global = new class {
|
|
20
24
|
constructor() {
|
|
21
25
|
this.resolvedPromiseValues = new WeakMap();
|
|
26
|
+
this.globalObj = {};
|
|
27
|
+
this.resourcePromises = (0, Util_1.newDefaultWeakMap)((key) => new Map());
|
|
22
28
|
}
|
|
23
29
|
};
|
|
24
30
|
/**
|
|
25
31
|
* Let's you run retsync code and wait, till it is finished.
|
|
32
|
+
* Errors by promises won't be catched. They will fall down, so you can catch them. Error state is not cached, so it will always be tried fresh on every retsync2promise run.
|
|
26
33
|
* @param repeatableFn
|
|
27
34
|
* @param options
|
|
28
35
|
*/
|
|
@@ -45,7 +52,7 @@ async function retsync2promise(repeatableFn, options = {}) {
|
|
|
45
52
|
return runRepeatableFn();
|
|
46
53
|
}
|
|
47
54
|
catch (e) {
|
|
48
|
-
if (e instanceof RetsyncWaitsForPromiseException) {
|
|
55
|
+
if (e != null && e instanceof RetsyncWaitsForPromiseException) {
|
|
49
56
|
if (e.checkSaved || (e.checkSaved === undefined && options.checkSaved !== false)) {
|
|
50
57
|
const optionHint = `Hint: See also: Retsync2promiseOptions#checkSaved`;
|
|
51
58
|
// Check if repeatableFn is behaving in repeatable symantics and saves the promise
|
|
@@ -93,8 +100,6 @@ function promise2retsync(savedPromise) {
|
|
|
93
100
|
}
|
|
94
101
|
throw new RetsyncWaitsForPromiseException(savedPromise);
|
|
95
102
|
}
|
|
96
|
-
const globalObj = {};
|
|
97
|
-
const resourcePromises = (0, Util_1.newDefaultWeakMap)((key) => new Map());
|
|
98
103
|
/**
|
|
99
104
|
* Makes async code usable in retsync code.
|
|
100
105
|
* <p>
|
|
@@ -103,17 +108,29 @@ const resourcePromises = (0, Util_1.newDefaultWeakMap)((key) => new Map());
|
|
|
103
108
|
* <code>asyncResource2retsync( async() => {...load the avatar...}, myUser, "getAvatar");</code>
|
|
104
109
|
* So the User#getAvatar is, what uniquely identifies the loaderFn here.
|
|
105
110
|
* </p>
|
|
111
|
+
* <p>
|
|
112
|
+
* Error handling: Failed promises (loaderFn fails) are forgotten, so next time the retsync code invokes asyncResource2retsync, it is tried fresh again
|
|
113
|
+
* </p>
|
|
106
114
|
* @param loaderFn
|
|
107
115
|
* @param idObj object to associate this call to. undefined means globally and the idKey primitive value is the only key.
|
|
108
116
|
* @param idKey Additional primitive key under idObj.
|
|
117
|
+
* @see cleanResource
|
|
109
118
|
*/
|
|
110
119
|
function asyncResource2retsync(loaderFn, idObj, idKey) {
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
// Validity check:
|
|
121
|
+
if (!idObj && !idKey) {
|
|
122
|
+
throw new Error("Either idObj or idKey must be specified");
|
|
123
|
+
}
|
|
124
|
+
idObj = idObj || exports._global.globalObj;
|
|
125
|
+
const promisesForIdObj = exports._global.resourcePromises.get(idObj);
|
|
113
126
|
let promise = promisesForIdObj.get(idKey);
|
|
114
127
|
if (!promise) {
|
|
115
128
|
promise = loaderFn();
|
|
116
129
|
promisesForIdObj.set(idKey, promise);
|
|
130
|
+
// Forget on error:
|
|
131
|
+
promise.catch(() => {
|
|
132
|
+
promisesForIdObj.delete(idKey);
|
|
133
|
+
});
|
|
117
134
|
}
|
|
118
135
|
try {
|
|
119
136
|
return promise2retsync(promise);
|
|
@@ -126,6 +143,21 @@ function asyncResource2retsync(loaderFn, idObj, idKey) {
|
|
|
126
143
|
throw e;
|
|
127
144
|
}
|
|
128
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Cleans the promise and therefore the result behind the given obj+key like used in {@link asyncResource2retsync}.
|
|
148
|
+
* Call this i.e. on the event that the resource has change and you want to "invalidate the cached value", so it will be fetched fresh next time.
|
|
149
|
+
* @param idObj
|
|
150
|
+
* @param idKey
|
|
151
|
+
*/
|
|
152
|
+
function cleanResource(idObj, idKey) {
|
|
153
|
+
// Validity check:
|
|
154
|
+
if (!idObj && !idKey) {
|
|
155
|
+
throw new Error("Either idObj or idKey must be specified");
|
|
156
|
+
}
|
|
157
|
+
idObj = idObj || exports._global.globalObj;
|
|
158
|
+
const promisesForIdObj = exports._global.resourcePromises.get(idObj);
|
|
159
|
+
promisesForIdObj.delete(idKey);
|
|
160
|
+
}
|
|
129
161
|
class RetsyncWaitsForPromiseException extends Error {
|
|
130
162
|
constructor(promise) {
|
|
131
163
|
super("Some retsync style code (see call stack / caller of promise2retsync) wants to await an async operation. To make this possible, you need to wrapt it at some ancestor caller level with retsync2promise. I.e. 'const result = await retsync2promise(() => {...your **retryable*** - synchronous code...}});");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retsync.js","sourceRoot":"","sources":["../../retsync.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,0JAA0J;AAC1J,2CAA2C;AAC3C,2HAA2H;AAC3H,8SAA8S;;;
|
|
1
|
+
{"version":3,"file":"retsync.js","sourceRoot":"","sources":["../../retsync.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,0JAA0J;AAC1J,2CAA2C;AAC3C,2HAA2H;AAC3H,8SAA8S;;;AAmC9S,0CA0DC;AAMD,0CAMC;AAkBD,sDA6BC;AAkCD,sEAIC;AA3LD,iCAAyC;AASzC;;GAEG;AACH,MAAa,mBAAmB;CAE/B;AAFD,kDAEC;AAED;;GAEG;AACU,QAAA,OAAO,GAAG,IAAI;IAAA;QACvB,0BAAqB,GAAG,IAAI,OAAO,EAAyB,CAAC;QAE7D,cAAS,GAAG,EAAE,CAAC;QACf,qBAAgB,GAAG,IAAA,wBAAiB,EAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,EAAiD,CAAC,CAAA;IAC3G,CAAC;CAAA,CAAA;AAED;;;;;GAKG;AACI,KAAK,UAAU,eAAe,CAAI,YAAqB,EAAE,UAAkC,EAAE;IAChG;;OAEG;IACH,SAAS,eAAe;QACpB,MAAM,wBAAwB,GAAG,eAAO,CAAC,mBAAmB,CAAC;QAC7D,IAAI,CAAC;YACD,eAAO,CAAC,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC;YACxD,OAAO,YAAY,EAAE,CAAC;QAC1B,CAAC;gBACO,CAAC;YACL,eAAO,CAAC,mBAAmB,GAAG,wBAAwB,CAAC;QAC3D,C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AID;;GAEG;AACH,oEAAoE;AACpE,uIAAuI;AACvI,GAAG"}
|
package/dist/esm/retsync.d.ts
CHANGED
|
@@ -4,17 +4,23 @@ type Retsync2promiseOptions = {
|
|
|
4
4
|
*/
|
|
5
5
|
checkSaved?: boolean;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Internal / used in frameworks.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Retsync2promiseCall {
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
|
-
* Global state.
|
|
13
|
+
* Global state. Internal / shared with frameworks.
|
|
11
14
|
*/
|
|
12
15
|
export declare const _global: {
|
|
13
16
|
resolvedPromiseValues: WeakMap<Promise<any>, unknown>;
|
|
14
17
|
retsync2promiseCall?: Retsync2promiseCall;
|
|
18
|
+
globalObj: {};
|
|
19
|
+
resourcePromises: import("./Util").DefaultMap<unknown, Map<string | number | undefined, Promise<unknown>>>;
|
|
15
20
|
};
|
|
16
21
|
/**
|
|
17
22
|
* Let's you run retsync code and wait, till it is finished.
|
|
23
|
+
* Errors by promises won't be catched. They will fall down, so you can catch them. Error state is not cached, so it will always be tried fresh on every retsync2promise run.
|
|
18
24
|
* @param repeatableFn
|
|
19
25
|
* @param options
|
|
20
26
|
*/
|
|
@@ -32,9 +38,13 @@ export declare function promise2retsync<T>(savedPromise: Promise<T>): T;
|
|
|
32
38
|
* <code>asyncResource2retsync( async() => {...load the avatar...}, myUser, "getAvatar");</code>
|
|
33
39
|
* So the User#getAvatar is, what uniquely identifies the loaderFn here.
|
|
34
40
|
* </p>
|
|
41
|
+
* <p>
|
|
42
|
+
* Error handling: Failed promises (loaderFn fails) are forgotten, so next time the retsync code invokes asyncResource2retsync, it is tried fresh again
|
|
43
|
+
* </p>
|
|
35
44
|
* @param loaderFn
|
|
36
45
|
* @param idObj object to associate this call to. undefined means globally and the idKey primitive value is the only key.
|
|
37
46
|
* @param idKey Additional primitive key under idObj.
|
|
47
|
+
* @see cleanResource
|
|
38
48
|
*/
|
|
39
49
|
export declare function asyncResource2retsync<T>(loaderFn: () => Promise<T>, idObj: object | undefined, idKey?: (string | number)): T;
|
|
40
50
|
export declare class RetsyncWaitsForPromiseException extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retsync.d.ts","sourceRoot":"","sources":["../../retsync.ts"],"names":[],"mappings":"AASA,KAAK,sBAAsB,GAAG;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,
|
|
1
|
+
{"version":3,"file":"retsync.d.ts","sourceRoot":"","sources":["../../retsync.ts"],"names":[],"mappings":"AASA,KAAK,sBAAsB,GAAG;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED;;GAEG;AACH,qBAAa,mBAAmB;CAE/B;AAED;;GAEG;AACH,eAAO,MAAM,OAAO;;0BAEM,mBAAmB;;;CAG5C,CAAA;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,CAAC,CAAC,CA0DhH;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAM9D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAK,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,GAAC,MAAM,CAAC,GAAG,CAAC,CA6BzH;AAqBD,qBAAa,+BAAgC,SAAQ,KAAK;IACtD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;gBAET,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC;CAIpC;AAED,wBAAgB,6BAA6B,SAI5C;;AAID;;GAEG"}
|
package/dist/esm/retsync.js
CHANGED
|
@@ -4,18 +4,24 @@
|
|
|
4
4
|
// Semantics: Retsync code must be repeatable. It can change state, as long as that leads to the same result when repeated.
|
|
5
5
|
// It does not mean strictly deterministic (may be for while in the same sync block??) because resources that are fetched, can change over time. Therefore some inner user's retsync code might subscribe to change events and invalidate asyncResource2retsync's cached promises when there are such changes.
|
|
6
6
|
import { newDefaultWeakMap } from "./Util";
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Internal / used in frameworks.
|
|
9
|
+
*/
|
|
10
|
+
export class Retsync2promiseCall {
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
|
-
* Global state.
|
|
13
|
+
* Global state. Internal / shared with frameworks.
|
|
11
14
|
*/
|
|
12
15
|
export const _global = new class {
|
|
13
16
|
constructor() {
|
|
14
17
|
this.resolvedPromiseValues = new WeakMap();
|
|
18
|
+
this.globalObj = {};
|
|
19
|
+
this.resourcePromises = newDefaultWeakMap((key) => new Map());
|
|
15
20
|
}
|
|
16
21
|
};
|
|
17
22
|
/**
|
|
18
23
|
* Let's you run retsync code and wait, till it is finished.
|
|
24
|
+
* Errors by promises won't be catched. They will fall down, so you can catch them. Error state is not cached, so it will always be tried fresh on every retsync2promise run.
|
|
19
25
|
* @param repeatableFn
|
|
20
26
|
* @param options
|
|
21
27
|
*/
|
|
@@ -38,7 +44,7 @@ export async function retsync2promise(repeatableFn, options = {}) {
|
|
|
38
44
|
return runRepeatableFn();
|
|
39
45
|
}
|
|
40
46
|
catch (e) {
|
|
41
|
-
if (e instanceof RetsyncWaitsForPromiseException) {
|
|
47
|
+
if (e != null && e instanceof RetsyncWaitsForPromiseException) {
|
|
42
48
|
if (e.checkSaved || (e.checkSaved === undefined && options.checkSaved !== false)) {
|
|
43
49
|
const optionHint = `Hint: See also: Retsync2promiseOptions#checkSaved`;
|
|
44
50
|
// Check if repeatableFn is behaving in repeatable symantics and saves the promise
|
|
@@ -86,8 +92,6 @@ export function promise2retsync(savedPromise) {
|
|
|
86
92
|
}
|
|
87
93
|
throw new RetsyncWaitsForPromiseException(savedPromise);
|
|
88
94
|
}
|
|
89
|
-
const globalObj = {};
|
|
90
|
-
const resourcePromises = newDefaultWeakMap((key) => new Map());
|
|
91
95
|
/**
|
|
92
96
|
* Makes async code usable in retsync code.
|
|
93
97
|
* <p>
|
|
@@ -96,17 +100,29 @@ const resourcePromises = newDefaultWeakMap((key) => new Map());
|
|
|
96
100
|
* <code>asyncResource2retsync( async() => {...load the avatar...}, myUser, "getAvatar");</code>
|
|
97
101
|
* So the User#getAvatar is, what uniquely identifies the loaderFn here.
|
|
98
102
|
* </p>
|
|
103
|
+
* <p>
|
|
104
|
+
* Error handling: Failed promises (loaderFn fails) are forgotten, so next time the retsync code invokes asyncResource2retsync, it is tried fresh again
|
|
105
|
+
* </p>
|
|
99
106
|
* @param loaderFn
|
|
100
107
|
* @param idObj object to associate this call to. undefined means globally and the idKey primitive value is the only key.
|
|
101
108
|
* @param idKey Additional primitive key under idObj.
|
|
109
|
+
* @see cleanResource
|
|
102
110
|
*/
|
|
103
111
|
export function asyncResource2retsync(loaderFn, idObj, idKey) {
|
|
104
|
-
|
|
105
|
-
|
|
112
|
+
// Validity check:
|
|
113
|
+
if (!idObj && !idKey) {
|
|
114
|
+
throw new Error("Either idObj or idKey must be specified");
|
|
115
|
+
}
|
|
116
|
+
idObj = idObj || _global.globalObj;
|
|
117
|
+
const promisesForIdObj = _global.resourcePromises.get(idObj);
|
|
106
118
|
let promise = promisesForIdObj.get(idKey);
|
|
107
119
|
if (!promise) {
|
|
108
120
|
promise = loaderFn();
|
|
109
121
|
promisesForIdObj.set(idKey, promise);
|
|
122
|
+
// Forget on error:
|
|
123
|
+
promise.catch(() => {
|
|
124
|
+
promisesForIdObj.delete(idKey);
|
|
125
|
+
});
|
|
110
126
|
}
|
|
111
127
|
try {
|
|
112
128
|
return promise2retsync(promise);
|
|
@@ -119,6 +135,21 @@ export function asyncResource2retsync(loaderFn, idObj, idKey) {
|
|
|
119
135
|
throw e;
|
|
120
136
|
}
|
|
121
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Cleans the promise and therefore the result behind the given obj+key like used in {@link asyncResource2retsync}.
|
|
140
|
+
* Call this i.e. on the event that the resource has change and you want to "invalidate the cached value", so it will be fetched fresh next time.
|
|
141
|
+
* @param idObj
|
|
142
|
+
* @param idKey
|
|
143
|
+
*/
|
|
144
|
+
function cleanResource(idObj, idKey) {
|
|
145
|
+
// Validity check:
|
|
146
|
+
if (!idObj && !idKey) {
|
|
147
|
+
throw new Error("Either idObj or idKey must be specified");
|
|
148
|
+
}
|
|
149
|
+
idObj = idObj || _global.globalObj;
|
|
150
|
+
const promisesForIdObj = _global.resourcePromises.get(idObj);
|
|
151
|
+
promisesForIdObj.delete(idKey);
|
|
152
|
+
}
|
|
122
153
|
export class RetsyncWaitsForPromiseException extends Error {
|
|
123
154
|
constructor(promise) {
|
|
124
155
|
super("Some retsync style code (see call stack / caller of promise2retsync) wants to await an async operation. To make this possible, you need to wrapt it at some ancestor caller level with retsync2promise. I.e. 'const result = await retsync2promise(() => {...your **retryable*** - synchronous code...}});");
|
package/dist/esm/retsync.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retsync.js","sourceRoot":"","sources":["../../retsync.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,0JAA0J;AAC1J,2CAA2C;AAC3C,2HAA2H;AAC3H,8SAA8S;AAG9S,OAAO,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AASzC,MAAM,mBAAmB;
|
|
1
|
+
{"version":3,"file":"retsync.js","sourceRoot":"","sources":["../../retsync.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,0JAA0J;AAC1J,2CAA2C;AAC3C,2HAA2H;AAC3H,8SAA8S;AAG9S,OAAO,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;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yB,EAAE,KAAuB;IACrE,kBAAkB;IAClB,IAAG,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,GAAG,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC;IACnC,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7D,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAID,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IAOtD,YAAY,OAAqB;QAC7B,KAAK,CAAC,4SAA4S,CAAC,CAAC;QACpT,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;CACJ;AAED,MAAM,UAAU,6BAA6B;IACzC,IAAG,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,mQAAmQ,CAAC,CAAC;IACzR,CAAC;AACL,CAAC;AAID;;GAEG;AACH,oEAAoE;AACpE,uIAAuI;AACvI,GAAG"}
|
package/package.json
CHANGED
package/retsync.ts
CHANGED
|
@@ -14,20 +14,26 @@ type Retsync2promiseOptions = {
|
|
|
14
14
|
checkSaved?: boolean
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Internal / used in frameworks.
|
|
19
|
+
*/
|
|
20
|
+
export class Retsync2promiseCall {
|
|
18
21
|
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
/**
|
|
22
|
-
* Global state.
|
|
25
|
+
* Global state. Internal / shared with frameworks.
|
|
23
26
|
*/
|
|
24
27
|
export const _global = new class {
|
|
25
28
|
resolvedPromiseValues = new WeakMap<Promise<any>, unknown>();
|
|
26
29
|
retsync2promiseCall?: Retsync2promiseCall;
|
|
30
|
+
globalObj = {};
|
|
31
|
+
resourcePromises = newDefaultWeakMap((key) => new Map<string | number | undefined, Promise<unknown>>())
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
/**
|
|
30
35
|
* Let's you run retsync code and wait, till it is finished.
|
|
36
|
+
* Errors by promises won't be catched. They will fall down, so you can catch them. Error state is not cached, so it will always be tried fresh on every retsync2promise run.
|
|
31
37
|
* @param repeatableFn
|
|
32
38
|
* @param options
|
|
33
39
|
*/
|
|
@@ -50,7 +56,7 @@ export async function retsync2promise<T>(repeatableFn: () => T, options: Retsync
|
|
|
50
56
|
try {
|
|
51
57
|
return runRepeatableFn();
|
|
52
58
|
} catch (e) {
|
|
53
|
-
if (e instanceof RetsyncWaitsForPromiseException) {
|
|
59
|
+
if (e != null && e instanceof RetsyncWaitsForPromiseException) {
|
|
54
60
|
if (e.checkSaved || (e.checkSaved === undefined && options.checkSaved !== false)) {
|
|
55
61
|
const optionHint = `Hint: See also: Retsync2promiseOptions#checkSaved`
|
|
56
62
|
// Check if repeatableFn is behaving in repeatable symantics and saves the promise
|
|
@@ -103,9 +109,6 @@ export function promise2retsync<T>(savedPromise: Promise<T>): T {
|
|
|
103
109
|
throw new RetsyncWaitsForPromiseException(savedPromise)
|
|
104
110
|
}
|
|
105
111
|
|
|
106
|
-
const globalObj = {};
|
|
107
|
-
const resourcePromises = newDefaultWeakMap((key) => new Map<string | number | undefined, Promise<unknown>>())
|
|
108
|
-
|
|
109
112
|
/**
|
|
110
113
|
* Makes async code usable in retsync code.
|
|
111
114
|
* <p>
|
|
@@ -114,19 +117,32 @@ const resourcePromises = newDefaultWeakMap((key) => new Map<string | number | un
|
|
|
114
117
|
* <code>asyncResource2retsync( async() => {...load the avatar...}, myUser, "getAvatar");</code>
|
|
115
118
|
* So the User#getAvatar is, what uniquely identifies the loaderFn here.
|
|
116
119
|
* </p>
|
|
120
|
+
* <p>
|
|
121
|
+
* Error handling: Failed promises (loaderFn fails) are forgotten, so next time the retsync code invokes asyncResource2retsync, it is tried fresh again
|
|
122
|
+
* </p>
|
|
117
123
|
* @param loaderFn
|
|
118
124
|
* @param idObj object to associate this call to. undefined means globally and the idKey primitive value is the only key.
|
|
119
125
|
* @param idKey Additional primitive key under idObj.
|
|
126
|
+
* @see cleanResource
|
|
120
127
|
*/
|
|
121
128
|
export function asyncResource2retsync<T>(loaderFn: ()=> Promise<T>, idObj: object | undefined, idKey?: (string|number)): T {
|
|
122
|
-
|
|
129
|
+
// Validity check:
|
|
130
|
+
if(!idObj && !idKey) {
|
|
131
|
+
throw new Error("Either idObj or idKey must be specified");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
idObj = idObj || _global.globalObj;
|
|
123
135
|
|
|
124
|
-
const promisesForIdObj = resourcePromises.get(idObj);
|
|
136
|
+
const promisesForIdObj = _global.resourcePromises.get(idObj);
|
|
125
137
|
|
|
126
138
|
let promise = promisesForIdObj.get(idKey);
|
|
127
139
|
if(!promise) {
|
|
128
140
|
promise = loaderFn();
|
|
129
141
|
promisesForIdObj.set(idKey, promise);
|
|
142
|
+
// Forget on error:
|
|
143
|
+
promise.catch(() => {
|
|
144
|
+
promisesForIdObj.delete(idKey);
|
|
145
|
+
});
|
|
130
146
|
}
|
|
131
147
|
try {
|
|
132
148
|
return promise2retsync(promise as Promise<T>);
|
|
@@ -140,6 +156,23 @@ export function asyncResource2retsync<T>(loaderFn: ()=> Promise<T>, idObj: objec
|
|
|
140
156
|
}
|
|
141
157
|
}
|
|
142
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Cleans the promise and therefore the result behind the given obj+key like used in {@link asyncResource2retsync}.
|
|
161
|
+
* Call this i.e. on the event that the resource has change and you want to "invalidate the cached value", so it will be fetched fresh next time.
|
|
162
|
+
* @param idObj
|
|
163
|
+
* @param idKey
|
|
164
|
+
*/
|
|
165
|
+
function cleanResource(idObj: object | undefined, idKey?: (string|number)) {
|
|
166
|
+
// Validity check:
|
|
167
|
+
if(!idObj && !idKey) {
|
|
168
|
+
throw new Error("Either idObj or idKey must be specified");
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
idObj = idObj || _global.globalObj;
|
|
172
|
+
const promisesForIdObj = _global.resourcePromises.get(idObj);
|
|
173
|
+
promisesForIdObj.delete(idKey);
|
|
174
|
+
}
|
|
175
|
+
|
|
143
176
|
|
|
144
177
|
|
|
145
178
|
export class RetsyncWaitsForPromiseException extends Error {
|