@aztec/foundation 0.85.0-alpha-testnet.0 → 0.85.0-nightly.20250416
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/dest/retry/index.d.ts +2 -1
- package/dest/retry/index.d.ts.map +1 -1
- package/dest/retry/index.js +2 -2
- package/package.json +2 -4
- package/src/retry/index.ts +4 -4
package/dest/retry/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Logger } from '../log/index.js';
|
|
1
2
|
/** An error that indicates that the operation should not be retried. */
|
|
2
3
|
export declare class NoRetryError extends Error {
|
|
3
4
|
}
|
|
@@ -28,7 +29,7 @@ export declare function makeBackoff(retries: number[]): Generator<number, void,
|
|
|
28
29
|
* @returns A Promise that resolves with the successful result of the provided function, or rejects if backoff generator ends.
|
|
29
30
|
* @throws If `NoRetryError` is thrown by the `fn`, it is rethrown.
|
|
30
31
|
*/
|
|
31
|
-
export declare function retry<Result>(fn: () => Promise<Result>, name?: string, backoff?: Generator<number, void, unknown>, log?:
|
|
32
|
+
export declare function retry<Result>(fn: () => Promise<Result>, name?: string, backoff?: Generator<number, void, unknown>, log?: Logger, failSilently?: boolean): Promise<Result>;
|
|
32
33
|
/**
|
|
33
34
|
* Retry an asynchronous function until it returns a truthy value or the specified timeout is exceeded.
|
|
34
35
|
* The function is retried periodically with a fixed interval between attempts. The operation can be named for better error messages.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/retry/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/retry/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,iBAAiB,CAAC;AAI5D,wEAAwE;AACxE,qBAAa,YAAa,SAAQ,KAAK;CAAG;AAE1C;;;;;;;GAOG;AACH,wBAAiB,gBAAgB,qCAMhC;AAED;;;;GAIG;AACH,wBAAiB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,oCAI7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,KAAK,CAAC,MAAM,EAChC,EAAE,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACzB,IAAI,SAAc,EAClB,OAAO,mCAAqB,EAC5B,GAAG,GAAE,MAAyC,EAC9C,YAAY,UAAQ,mBAoBrB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,EAAE,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,EAClD,IAAI,SAAK,EACT,OAAO,SAAI,EACX,QAAQ,SAAI,oCAeb"}
|
package/dest/retry/index.js
CHANGED
|
@@ -61,8 +61,8 @@ import { Timer } from '../timer/index.js';
|
|
|
61
61
|
if (s === undefined) {
|
|
62
62
|
throw err;
|
|
63
63
|
}
|
|
64
|
-
log
|
|
65
|
-
!failSilently && log
|
|
64
|
+
log?.debug(`${name} failed. Will retry in ${s}s...`);
|
|
65
|
+
!failSilently && log?.error(`Error while retrying ${name}`, err);
|
|
66
66
|
await sleep(s * 1000);
|
|
67
67
|
continue;
|
|
68
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/foundation",
|
|
3
|
-
"version": "0.85.0-
|
|
3
|
+
"version": "0.85.0-nightly.20250416",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dest/index.js",
|
|
6
6
|
"types": "./dest/index.d.ts",
|
|
@@ -58,8 +58,6 @@
|
|
|
58
58
|
"build:dev": "tsc -b --watch",
|
|
59
59
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
60
60
|
"generate": "true",
|
|
61
|
-
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
|
|
62
|
-
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
63
61
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
64
62
|
},
|
|
65
63
|
"inherits": [
|
|
@@ -102,7 +100,7 @@
|
|
|
102
100
|
]
|
|
103
101
|
},
|
|
104
102
|
"dependencies": {
|
|
105
|
-
"@aztec/bb.js": "0.85.0-
|
|
103
|
+
"@aztec/bb.js": "0.85.0-nightly.20250416",
|
|
106
104
|
"@koa/cors": "^5.0.0",
|
|
107
105
|
"@noble/curves": "^1.2.0",
|
|
108
106
|
"bn.js": "^5.2.1",
|
package/src/retry/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TimeoutError } from '../error/index.js';
|
|
2
|
-
import { createLogger } from '../log/index.js';
|
|
2
|
+
import { type Logger, createLogger } from '../log/index.js';
|
|
3
3
|
import { sleep } from '../sleep/index.js';
|
|
4
4
|
import { Timer } from '../timer/index.js';
|
|
5
5
|
|
|
@@ -49,7 +49,7 @@ export async function retry<Result>(
|
|
|
49
49
|
fn: () => Promise<Result>,
|
|
50
50
|
name = 'Operation',
|
|
51
51
|
backoff = backoffGenerator(),
|
|
52
|
-
log = createLogger('foundation:retry'),
|
|
52
|
+
log: Logger = createLogger('foundation:retry'),
|
|
53
53
|
failSilently = false,
|
|
54
54
|
) {
|
|
55
55
|
while (true) {
|
|
@@ -64,8 +64,8 @@ export async function retry<Result>(
|
|
|
64
64
|
if (s === undefined) {
|
|
65
65
|
throw err;
|
|
66
66
|
}
|
|
67
|
-
log
|
|
68
|
-
!failSilently && log
|
|
67
|
+
log?.debug(`${name} failed. Will retry in ${s}s...`);
|
|
68
|
+
!failSilently && log?.error(`Error while retrying ${name}`, err);
|
|
69
69
|
await sleep(s * 1000);
|
|
70
70
|
continue;
|
|
71
71
|
}
|