@xylabs/retry 7.0.2 → 7.0.4
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/README.md +6 -4
- package/dist/neutral/index.d.ts +1 -1
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +2 -27
- package/dist/neutral/index.mjs.map +3 -3
- package/dist/neutral/model.d.ts +1 -1
- package/dist/neutral/model.d.ts.map +1 -1
- package/package.json +19 -12
- package/dist/neutral/retry.d.ts +0 -23
- package/dist/neutral/retry.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> **Deprecated.** Use [`@ariestools/sdk`](../../ariestools-sdk/README.md) instead. This package is a backward-compatibility re-export shim.
|
|
2
|
+
|
|
1
3
|
[![logo][]](https://xylabs.com)
|
|
2
4
|
|
|
3
5
|
# @xylabs/retry
|
|
@@ -12,25 +14,25 @@
|
|
|
12
14
|
Using npm:
|
|
13
15
|
|
|
14
16
|
```sh
|
|
15
|
-
npm install
|
|
17
|
+
npm install @xylabs/retry
|
|
16
18
|
```
|
|
17
19
|
|
|
18
20
|
Using yarn:
|
|
19
21
|
|
|
20
22
|
```sh
|
|
21
|
-
yarn add
|
|
23
|
+
yarn add @xylabs/retry
|
|
22
24
|
```
|
|
23
25
|
|
|
24
26
|
Using pnpm:
|
|
25
27
|
|
|
26
28
|
```sh
|
|
27
|
-
pnpm add
|
|
29
|
+
pnpm add @xylabs/retry
|
|
28
30
|
```
|
|
29
31
|
|
|
30
32
|
Using bun:
|
|
31
33
|
|
|
32
34
|
```sh
|
|
33
|
-
bun add
|
|
35
|
+
bun add @xylabs/retry
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from '@ariestools/sdk/retry';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
|
|
3
|
-
var retry = async (func, config) => {
|
|
4
|
-
const {
|
|
5
|
-
complete = (value) => value !== void 0,
|
|
6
|
-
retries = 0,
|
|
7
|
-
interval = 100,
|
|
8
|
-
backoff = 2
|
|
9
|
-
} = config ?? {};
|
|
10
|
-
const result = await func();
|
|
11
|
-
if (complete(result)) {
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
if (retries <= 0) {
|
|
15
|
-
return void 0;
|
|
16
|
-
}
|
|
17
|
-
await delay(interval);
|
|
18
|
-
return retry(func, {
|
|
19
|
-
backoff,
|
|
20
|
-
complete,
|
|
21
|
-
interval: interval * backoff,
|
|
22
|
-
retries: retries - 1
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
retry
|
|
27
|
-
};
|
|
1
|
+
// src/index.ts
|
|
2
|
+
export * from "@ariestools/sdk/retry";
|
|
28
3
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";AAAA,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export * from '@ariestools/sdk/retry'\n"],
|
|
5
|
+
"mappings": ";AAAA,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/neutral/model.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type * from '@ariestools/sdk/retry/model';
|
|
2
2
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model.ts"],"names":[],"mappings":"AAAA,mBAAmB,6BAA6B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/retry",
|
|
3
|
-
"version": "7.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.0.4",
|
|
4
|
+
"description": "DEPRECATED — use @ariestools/sdk/retry. Backward-compatibility re-export shim.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"delay",
|
|
7
6
|
"xylabs",
|
|
8
7
|
"utility",
|
|
9
8
|
"typescript",
|
|
@@ -31,11 +30,11 @@
|
|
|
31
30
|
"types": "./dist/neutral/index.d.ts",
|
|
32
31
|
"default": "./dist/neutral/index.mjs"
|
|
33
32
|
},
|
|
33
|
+
"./package.json": "./package.json",
|
|
34
34
|
"./model": {
|
|
35
35
|
"types": "./dist/neutral/model.d.ts",
|
|
36
36
|
"default": "./dist/neutral/model.mjs"
|
|
37
|
-
}
|
|
38
|
-
"./package.json": "./package.json"
|
|
37
|
+
}
|
|
39
38
|
},
|
|
40
39
|
"files": [
|
|
41
40
|
"dist",
|
|
@@ -45,23 +44,31 @@
|
|
|
45
44
|
"README.md"
|
|
46
45
|
],
|
|
47
46
|
"dependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"@xylabs/promise": "~7.0.2"
|
|
47
|
+
"@ariestools/sdk": "~7.0.4"
|
|
50
48
|
},
|
|
51
49
|
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
50
|
+
"@opentelemetry/api": "^1.9.1",
|
|
51
|
+
"@opentelemetry/sdk-trace-base": "^2.8.0",
|
|
52
|
+
"@xylabs/toolchain": "^8.5.11",
|
|
53
|
+
"@xylabs/tsconfig": "^8.5.11",
|
|
54
|
+
"async-mutex": "^0.5.0",
|
|
54
55
|
"browserslist": "4.28.4",
|
|
55
56
|
"eslint": "^10.6.0",
|
|
56
57
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
57
58
|
"typescript": "^6.0.3",
|
|
58
|
-
"
|
|
59
|
-
|
|
59
|
+
"zod": "^4.4.3"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"@opentelemetry/api": "^1.9",
|
|
63
|
+
"@opentelemetry/sdk-trace-base": "^2.7",
|
|
64
|
+
"async-mutex": "^0.5",
|
|
65
|
+
"zod": "^4.4"
|
|
60
66
|
},
|
|
61
67
|
"engines": {
|
|
62
68
|
"node": ">=18"
|
|
63
69
|
},
|
|
64
70
|
"publishConfig": {
|
|
65
71
|
"access": "public"
|
|
66
|
-
}
|
|
72
|
+
},
|
|
73
|
+
"deprecated": "Use @ariestools/sdk/retry instead. @xylabs/retry is a compatibility shim only and will not receive further updates."
|
|
67
74
|
}
|
package/dist/neutral/retry.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Promisable } from '@xylabs/promise';
|
|
2
|
-
/** Configuration for retry behavior. */
|
|
3
|
-
export interface RetryConfig {
|
|
4
|
-
/** Multiplier applied to the interval after each retry. Defaults to 2. */
|
|
5
|
-
backoff?: number;
|
|
6
|
-
/** Initial delay in milliseconds between retries. Defaults to 100. */
|
|
7
|
-
interval?: number;
|
|
8
|
-
/** Maximum number of retry attempts. Defaults to 0 (no retries). */
|
|
9
|
-
retries?: number;
|
|
10
|
-
}
|
|
11
|
-
/** Retry configuration extended with a custom completion check. */
|
|
12
|
-
export interface RetryConfigWithComplete<T = unknown> extends RetryConfig {
|
|
13
|
-
/** Determines whether the result is considered complete. Defaults to checking for a defined value. */
|
|
14
|
-
complete?: (result?: T) => boolean;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Retries an async function with exponential backoff until it completes or retries are exhausted.
|
|
18
|
-
* @param func - The function to retry.
|
|
19
|
-
* @param config - Optional retry configuration including backoff, interval, retries, and completion check.
|
|
20
|
-
* @returns The result of the function, or undefined if all retries were exhausted.
|
|
21
|
-
*/
|
|
22
|
-
export declare const retry: <T = unknown>(func: () => Promisable<T | undefined>, config?: RetryConfigWithComplete<T>) => Promise<T | undefined>;
|
|
23
|
-
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/retry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,wCAAwC;AACxC,MAAM,WAAW,WAAW;IAC1B,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,mEAAmE;AACnE,MAAM,WAAW,uBAAuB,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,WAAW;IACvE,sGAAsG;IACtG,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,OAAO,CAAA;CACnC;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAU,CAAC,GAAG,OAAO,EAAE,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,SAAS,uBAAuB,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAe1I,CAAA"}
|