@event-driven-io/emmett-sqlite 0.35.0 → 0.37.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/index.cjs +53 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -16
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -203,22 +203,6 @@ var NotifyAboutNoActiveReadersStream = class extends TransformStream2 {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
var asyncRetry = async (fn, opts) => {
|
|
207
|
-
if (opts === void 0 || opts.retries === 0) return fn();
|
|
208
|
-
return retry(
|
|
209
|
-
async (bail) => {
|
|
210
|
-
try {
|
|
211
|
-
return await fn();
|
|
212
|
-
} catch (error2) {
|
|
213
|
-
if (opts?.shouldRetryError && !opts.shouldRetryError(error2)) {
|
|
214
|
-
bail(error2);
|
|
215
|
-
}
|
|
216
|
-
throw error2;
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
opts ?? { retries: 0 }
|
|
220
|
-
);
|
|
221
|
-
};
|
|
222
206
|
var ParseError = class extends Error {
|
|
223
207
|
constructor(text) {
|
|
224
208
|
super(`Cannot parse! ${text}`);
|
|
@@ -240,6 +224,28 @@ var JSONParser = {
|
|
|
240
224
|
return options?.map ? options.map(parsed) : parsed;
|
|
241
225
|
}
|
|
242
226
|
};
|
|
227
|
+
var asyncRetry = async (fn, opts) => {
|
|
228
|
+
if (opts === void 0 || opts.retries === 0) return fn();
|
|
229
|
+
return retry(
|
|
230
|
+
async (bail) => {
|
|
231
|
+
try {
|
|
232
|
+
const result = await fn();
|
|
233
|
+
if (opts?.shouldRetryResult && opts.shouldRetryResult(result)) {
|
|
234
|
+
throw new EmmettError(
|
|
235
|
+
`Retrying because of result: ${JSONParser.stringify(result)}`
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
return result;
|
|
239
|
+
} catch (error2) {
|
|
240
|
+
if (opts?.shouldRetryError && !opts.shouldRetryError(error2)) {
|
|
241
|
+
bail(error2);
|
|
242
|
+
}
|
|
243
|
+
throw error2;
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
opts ?? { retries: 0 }
|
|
247
|
+
);
|
|
248
|
+
};
|
|
243
249
|
var filter = (filter2) => new TransformStream3({
|
|
244
250
|
transform(chunk, controller) {
|
|
245
251
|
if (filter2(chunk)) {
|