@xylabs/retry 5.0.95 → 5.0.97

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.
Files changed (2) hide show
  1. package/README.md +133 -77
  2. package/package.json +8 -11
package/README.md CHANGED
@@ -1,67 +1,82 @@
1
1
  # @xylabs/retry
2
2
 
3
- [![logo][]](https://xylabs.com)
3
+ [![npm][npm-badge]][npm-link]
4
+ [![license][license-badge]][license-link]
4
5
 
5
- [![main-build][]][main-build-link]
6
- [![npm-badge][]][npm-link]
7
- [![npm-downloads-badge][]][npm-link]
8
- [![jsdelivr-badge][]][jsdelivr-link]
9
- [![npm-license-badge][]](LICENSE)
10
- [![codacy-badge][]][codacy-link]
11
- [![codeclimate-badge][]][codeclimate-link]
12
- [![snyk-badge][]][snyk-link]
13
- [![socket-badge][]][socket-link]
6
+ > Base functionality used throughout XY Labs TypeScript/JavaScript libraries
14
7
 
8
+ ## Install
15
9
 
16
- Base functionality used throughout XY Labs TypeScript/JavaScript libraries
10
+ Using npm:
17
11
 
12
+ ```sh
13
+ npm install {{name}}
14
+ ```
18
15
 
16
+ Using yarn:
19
17
 
20
- ## Reference
18
+ ```sh
19
+ yarn add {{name}}
20
+ ```
21
21
 
22
- **@xylabs/retry**
22
+ Using pnpm:
23
23
 
24
- ***
24
+ ```sh
25
+ pnpm add {{name}}
26
+ ```
25
27
 
26
- ## Interfaces
28
+ Using bun:
29
+
30
+ ```sh
31
+ bun add {{name}}
32
+ ```
27
33
 
28
- | Interface | Description |
29
- | ------ | ------ |
30
- | [RetryConfig](#interfaces/RetryConfig) | Configuration for retry behavior. |
31
- | [RetryConfigWithComplete](#interfaces/RetryConfigWithComplete) | Retry configuration extended with a custom completion check. |
32
34
 
33
- ## Functions
35
+ ## License
34
36
 
35
- | Function | Description |
36
- | ------ | ------ |
37
- | [retry](#functions/retry) | Retries an async function with exponential backoff until it completes or retries are exhausted. |
37
+ See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
38
38
 
39
- ### functions
39
+ ## Reference
40
40
 
41
- ### <a id="retry"></a>retry
41
+ ### packages
42
+
43
+ ### retry
44
+
45
+ ### .temp-typedoc
46
+
47
+ ### functions
48
+
49
+ ### <a id="retry"></a>retry
42
50
 
43
51
  [**@xylabs/retry**](#../README)
44
52
 
45
53
  ***
46
54
 
47
55
  ```ts
48
- function retry<T>(func: () => Promisable<T | undefined>, config?: RetryConfigWithComplete<T>): Promise<T | undefined>;
56
+ function retry<T>(func, config?): Promise<T | undefined>;
49
57
  ```
50
58
 
51
59
  Retries an async function with exponential backoff until it completes or retries are exhausted.
52
60
 
53
61
  ## Type Parameters
54
62
 
55
- | Type Parameter | Default type |
56
- | ------ | ------ |
57
- | `T` | `unknown` |
63
+ ### T
64
+
65
+ `T` = `unknown`
58
66
 
59
67
  ## Parameters
60
68
 
61
- | Parameter | Type | Description |
62
- | ------ | ------ | ------ |
63
- | `func` | () => `Promisable`\<`T` \| `undefined`\> | The function to retry. |
64
- | `config?` | [`RetryConfigWithComplete`](#../interfaces/RetryConfigWithComplete)\<`T`\> | Optional retry configuration including backoff, interval, retries, and completion check. |
69
+ ### func
70
+
71
+ () => `Promisable`\<`T` \| `undefined`\>
72
+
73
+ The function to retry.
74
+
75
+ ### config?
76
+
77
+ [`RetryConfigWithComplete`](#../interfaces/RetryConfigWithComplete)\<`T`\>
78
+
79
+ Optional retry configuration including backoff, interval, retries, and completion check.
65
80
 
66
81
  ## Returns
67
82
 
@@ -69,9 +84,9 @@ Retries an async function with exponential backoff until it completes or retries
69
84
 
70
85
  The result of the function, or undefined if all retries were exhausted.
71
86
 
72
- ### interfaces
87
+ ### interfaces
73
88
 
74
- ### <a id="RetryConfig"></a>RetryConfig
89
+ ### <a id="RetryConfig"></a>RetryConfig
75
90
 
76
91
  [**@xylabs/retry**](#../README)
77
92
 
@@ -85,13 +100,35 @@ Configuration for retry behavior.
85
100
 
86
101
  ## Properties
87
102
 
88
- | Property | Type | Description |
89
- | ------ | ------ | ------ |
90
- | <a id="backoff"></a> `backoff?` | `number` | Multiplier applied to the interval after each retry. Defaults to 2. |
91
- | <a id="interval"></a> `interval?` | `number` | Initial delay in milliseconds between retries. Defaults to 100. |
92
- | <a id="retries"></a> `retries?` | `number` | Maximum number of retry attempts. Defaults to 0 (no retries). |
103
+ ### backoff?
104
+
105
+ ```ts
106
+ optional backoff?: number;
107
+ ```
108
+
109
+ Multiplier applied to the interval after each retry. Defaults to 2.
110
+
111
+ ***
112
+
113
+ ### interval?
114
+
115
+ ```ts
116
+ optional interval?: number;
117
+ ```
118
+
119
+ Initial delay in milliseconds between retries. Defaults to 100.
120
+
121
+ ***
122
+
123
+ ### retries?
124
+
125
+ ```ts
126
+ optional retries?: number;
127
+ ```
128
+
129
+ Maximum number of retry attempts. Defaults to 0 (no retries).
93
130
 
94
- ### <a id="RetryConfigWithComplete"></a>RetryConfigWithComplete
131
+ ### <a id="RetryConfigWithComplete"></a>RetryConfigWithComplete
95
132
 
96
133
  [**@xylabs/retry**](#../README)
97
134
 
@@ -105,55 +142,74 @@ Retry configuration extended with a custom completion check.
105
142
 
106
143
  ## Type Parameters
107
144
 
108
- | Type Parameter | Default type |
109
- | ------ | ------ |
110
- | `T` | `unknown` |
145
+ ### T
146
+
147
+ `T` = `unknown`
111
148
 
112
149
  ## Properties
113
150
 
114
- | Property | Type | Description | Inherited from |
115
- | ------ | ------ | ------ | ------ |
116
- | <a id="backoff"></a> `backoff?` | `number` | Multiplier applied to the interval after each retry. Defaults to 2. | [`RetryConfig`](#RetryConfig).[`backoff`](RetryConfig.md#backoff) |
117
- | <a id="interval"></a> `interval?` | `number` | Initial delay in milliseconds between retries. Defaults to 100. | [`RetryConfig`](#RetryConfig).[`interval`](RetryConfig.md#interval) |
118
- | <a id="retries"></a> `retries?` | `number` | Maximum number of retry attempts. Defaults to 0 (no retries). | [`RetryConfig`](#RetryConfig).[`retries`](RetryConfig.md#retries) |
119
- | <a id="complete"></a> `complete?` | (`result?`: `T`) => `boolean` | Determines whether the result is considered complete. Defaults to checking for a defined value. | - |
151
+ ### backoff?
120
152
 
153
+ ```ts
154
+ optional backoff?: number;
155
+ ```
121
156
 
122
- Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
157
+ Multiplier applied to the interval after each retry. Defaults to 2.
123
158
 
124
- ## Maintainers
159
+ ### Inherited from
125
160
 
126
- - [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
127
- - [Matt Jones](https://github.com/jonesmac)
128
- - [Joel Carter](https://github.com/JoelBCarter)
129
- - [Jordan Trouw](https://github.com/jordantrouw)
161
+ [`RetryConfig`](#RetryConfig).[`backoff`](RetryConfig.md#backoff)
130
162
 
131
- ## License
163
+ ***
132
164
 
133
- > See the [LICENSE](LICENSE) file for license details
165
+ ### interval?
134
166
 
135
- ## Credits
167
+ ```ts
168
+ optional interval?: number;
169
+ ```
136
170
 
137
- [Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
171
+ Initial delay in milliseconds between retries. Defaults to 100.
138
172
 
139
- [logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
173
+ ### Inherited from
140
174
 
141
- [main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
142
- [main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
143
- [npm-badge]: https://img.shields.io/npm/v/@xylabs/retry.svg
144
- [npm-link]: https://www.npmjs.com/package/@xylabs/retry
145
- [codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
146
- [codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
147
- [codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
148
- [codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
149
- [snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
150
- [snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
175
+ [`RetryConfig`](#RetryConfig).[`interval`](RetryConfig.md#interval)
176
+
177
+ ***
178
+
179
+ ### retries?
180
+
181
+ ```ts
182
+ optional retries?: number;
183
+ ```
184
+
185
+ Maximum number of retry attempts. Defaults to 0 (no retries).
186
+
187
+ ### Inherited from
151
188
 
152
- [npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/retry
153
- [npm-license-badge]: https://img.shields.io/npm/l/@xylabs/retry
189
+ [`RetryConfig`](#RetryConfig).[`retries`](RetryConfig.md#retries)
190
+
191
+ ***
192
+
193
+ ### complete?
194
+
195
+ ```ts
196
+ optional complete?: (result?) => boolean;
197
+ ```
154
198
 
155
- [jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/retry/badge
156
- [jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/retry
199
+ Determines whether the result is considered complete. Defaults to checking for a defined value.
157
200
 
158
- [socket-badge]: https://socket.dev/api/badge/npm/package/@xylabs/retry
159
- [socket-link]: https://socket.dev/npm/package/@xylabs/retry
201
+ ### Parameters
202
+
203
+ #### result?
204
+
205
+ `T`
206
+
207
+ ### Returns
208
+
209
+ `boolean`
210
+
211
+
212
+ [npm-badge]: https://img.shields.io/npm/v/@xylabs/retry.svg
213
+ [npm-link]: https://www.npmjs.com/package/@xylabs/retry
214
+ [license-badge]: https://img.shields.io/npm/l/@xylabs/retry.svg
215
+ [license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/retry",
3
- "version": "5.0.95",
3
+ "version": "5.0.97",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "delay",
@@ -29,12 +29,10 @@
29
29
  "exports": {
30
30
  ".": {
31
31
  "types": "./dist/neutral/index.d.ts",
32
- "import": "./dist/neutral/index.mjs",
33
32
  "default": "./dist/neutral/index.mjs"
34
33
  },
35
34
  "./package.json": "./package.json"
36
35
  },
37
- "types": "./dist/neutral/index.d.ts",
38
36
  "files": [
39
37
  "dist",
40
38
  "!**/*.bench.*",
@@ -43,18 +41,17 @@
43
41
  "README.md"
44
42
  ],
45
43
  "dependencies": {
46
- "@xylabs/delay": "~5.0.95",
47
- "@xylabs/promise": "~5.0.95"
44
+ "@xylabs/delay": "~5.0.97",
45
+ "@xylabs/promise": "~5.0.97"
48
46
  },
49
47
  "devDependencies": {
50
- "@types/node": "^25.5.2",
51
- "@xylabs/ts-scripts-common": "~7.8.4",
52
- "@xylabs/ts-scripts-pnpm": "~7.8.4",
53
- "@xylabs/tsconfig": "~7.8.4",
48
+ "@types/node": "^25.6.0",
49
+ "@xylabs/toolchain": "~7.10.4",
50
+ "@xylabs/tsconfig": "~7.10.4",
54
51
  "esbuild": "^0.28.0",
55
52
  "typescript": "^5",
56
- "vite": "^8.0.5",
57
- "vitest": "^4.1.2"
53
+ "vite": "^8.0.8",
54
+ "vitest": "^4.1.4"
58
55
  },
59
56
  "engines": {
60
57
  "node": ">=18"