hide-a-bed 7.0.0-beta.1 → 7.0.0-beta.2

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 CHANGED
@@ -779,6 +779,21 @@ const config = {
779
779
  }
780
780
  ```
781
781
 
782
+ `bindConfig()` and `withRetry()` now perform a single built-in retry for transient `401` and `403` responses before surfacing the error.
783
+
784
+ ### withRetry
785
+
786
+ `withRetry(fn, options)` wraps an async function and retries based on the built-in retry rules.
787
+
788
+ ```javascript
789
+ import { withRetry, get } from 'hide-a-bed'
790
+
791
+ const getWithCustomRetry = withRetry(id => get({ couch: 'http://localhost:5984/mydb' }, id), {
792
+ maxRetries: 2,
793
+ initialDelay: 250
794
+ })
795
+ ```
796
+
782
797
  ### Migration Note
783
798
 
784
799
  `needleOpts` has been removed from the main `client` package. If you were passing transport-specific `needle` options through `config.needleOpts`, remove that configuration when upgrading. If you used `needleOpts.username` or `needleOpts.password`, move them to `config.auth.username` and `config.auth.password`. Couch URLs with embedded credentials are no longer supported and will fail validation. The package now uses native `fetch` internally and only supports the documented top-level config fields above.
@@ -279,6 +279,12 @@ const isSuccessStatusCode = (profile, statusCode) => {
279
279
  return SUCCESS_STATUS_CODES[profile].includes(statusCode);
280
280
  };
281
281
 
282
+ //#endregion
283
+ //#region types/types.utils.ts
284
+ function isObject(value) {
285
+ return typeof value === "object" && value !== null;
286
+ }
287
+
282
288
  //#endregion
283
289
  //#region impl/utils/errors.mts
284
290
  const RETRYABLE_STATUS_CODES = new Set([
@@ -310,6 +316,14 @@ const getNestedNetworkError = (value) => {
310
316
  const candidate = value;
311
317
  return isNetworkError(candidate.cause) ? candidate.cause : null;
312
318
  };
319
+ const hasStatusCode = (error) => {
320
+ return isObject(error) && "statusCode" in error && typeof error.statusCode === "number";
321
+ };
322
+ const isTransientAuthError = (error, attempt) => {
323
+ if (!hasStatusCode(error)) return false;
324
+ if (attempt > 0) return false;
325
+ return error.statusCode === 401 || error.statusCode === 403;
326
+ };
313
327
  /**
314
328
  * Shared base class for operational errors thrown by hide-a-bed.
315
329
  *
@@ -520,6 +534,9 @@ function isConflictError(err) {
520
534
 
521
535
  //#endregion
522
536
  //#region impl/retry.mts
537
+ const shouldRetryError = (error, attempt) => {
538
+ return error instanceof RetryableError || isTransientAuthError(error, attempt);
539
+ };
523
540
  /**
524
541
  * Wrap an async-capable function with retry semantics that respect {@link RetryableError}.
525
542
  * @typeParam Fn - The function signature to decorate with retry handling.
@@ -534,7 +551,7 @@ function withRetry(fn, options = {}) {
534
551
  for (let attempt = 0; attempt <= maxRetries; attempt++) try {
535
552
  return await fn(...args);
536
553
  } catch (error) {
537
- if (!(error instanceof RetryableError)) throw error;
554
+ if (!shouldRetryError(error, attempt)) throw error;
538
555
  if (attempt === maxRetries) throw error;
539
556
  await (0, node_timers_promises.setTimeout)(Math.min(delay, maxDelay));
540
557
  delay *= backoffFactor;
@@ -1451,7 +1468,7 @@ const patchDangerously = async (configInput, id, properties) => {
1451
1468
  return result;
1452
1469
  } catch (err) {
1453
1470
  if (!(err instanceof Error)) throw err;
1454
- if (!(err instanceof ConflictError) && !(err instanceof RetryableError)) throw err;
1471
+ if (!(err instanceof ConflictError || shouldRetryError(err, attempts))) throw err;
1455
1472
  lastError = err;
1456
1473
  attempts++;
1457
1474
  if (attempts > maxRetries) {
@@ -247,6 +247,12 @@ const isSuccessStatusCode = (profile, statusCode) => {
247
247
  return SUCCESS_STATUS_CODES[profile].includes(statusCode);
248
248
  };
249
249
 
250
+ //#endregion
251
+ //#region types/types.utils.ts
252
+ function isObject(value) {
253
+ return typeof value === "object" && value !== null;
254
+ }
255
+
250
256
  //#endregion
251
257
  //#region impl/utils/errors.mts
252
258
  const RETRYABLE_STATUS_CODES = new Set([
@@ -278,6 +284,14 @@ const getNestedNetworkError = (value) => {
278
284
  const candidate = value;
279
285
  return isNetworkError(candidate.cause) ? candidate.cause : null;
280
286
  };
287
+ const hasStatusCode = (error) => {
288
+ return isObject(error) && "statusCode" in error && typeof error.statusCode === "number";
289
+ };
290
+ const isTransientAuthError = (error, attempt) => {
291
+ if (!hasStatusCode(error)) return false;
292
+ if (attempt > 0) return false;
293
+ return error.statusCode === 401 || error.statusCode === 403;
294
+ };
281
295
  /**
282
296
  * Shared base class for operational errors thrown by hide-a-bed.
283
297
  *
@@ -488,6 +502,9 @@ function isConflictError(err) {
488
502
 
489
503
  //#endregion
490
504
  //#region impl/retry.mts
505
+ const shouldRetryError = (error, attempt) => {
506
+ return error instanceof RetryableError || isTransientAuthError(error, attempt);
507
+ };
491
508
  /**
492
509
  * Wrap an async-capable function with retry semantics that respect {@link RetryableError}.
493
510
  * @typeParam Fn - The function signature to decorate with retry handling.
@@ -502,7 +519,7 @@ function withRetry(fn, options = {}) {
502
519
  for (let attempt = 0; attempt <= maxRetries; attempt++) try {
503
520
  return await fn(...args);
504
521
  } catch (error) {
505
- if (!(error instanceof RetryableError)) throw error;
522
+ if (!shouldRetryError(error, attempt)) throw error;
506
523
  if (attempt === maxRetries) throw error;
507
524
  await setTimeout$1(Math.min(delay, maxDelay));
508
525
  delay *= backoffFactor;
@@ -1419,7 +1436,7 @@ const patchDangerously = async (configInput, id, properties) => {
1419
1436
  return result;
1420
1437
  } catch (err) {
1421
1438
  if (!(err instanceof Error)) throw err;
1422
- if (!(err instanceof ConflictError) && !(err instanceof RetryableError)) throw err;
1439
+ if (!(err instanceof ConflictError || shouldRetryError(err, attempts))) throw err;
1423
1440
  lastError = err;
1424
1441
  attempts++;
1425
1442
  if (attempts > maxRetries) {
package/impl/patch.mts CHANGED
@@ -4,7 +4,8 @@ import { createLogger } from './utils/logger.mts'
4
4
  import { setTimeout } from 'node:timers/promises'
5
5
  import { CouchConfig, type CouchConfigInput } from '../schema/config.mts'
6
6
  import { z } from 'zod'
7
- import { ConflictError, HideABedError, OperationError, RetryableError } from './utils/errors.mts'
7
+ import { ConflictError, HideABedError, OperationError } from './utils/errors.mts'
8
+ import { shouldRetryError } from './retry.mts'
8
9
 
9
10
  const PatchProperties = z
10
11
  .looseObject({
@@ -106,7 +107,9 @@ export const patchDangerously = async (
106
107
  throw err
107
108
  }
108
109
 
109
- if (!(err instanceof ConflictError) && !(err instanceof RetryableError)) {
110
+ const shouldRetry = err instanceof ConflictError || shouldRetryError(err, attempts)
111
+
112
+ if (!shouldRetry) {
110
113
  throw err
111
114
  }
112
115
 
package/impl/retry.mts CHANGED
@@ -1,5 +1,9 @@
1
1
  import { setTimeout } from 'node:timers/promises'
2
- import { RetryableError } from './utils/errors.mts'
2
+ import { isTransientAuthError, RetryableError } from './utils/errors.mts'
3
+
4
+ export const shouldRetryError = (error: unknown, attempt: number) => {
5
+ return error instanceof RetryableError || isTransientAuthError(error, attempt)
6
+ }
3
7
 
4
8
  /**
5
9
  * Settings that control how retry attempts are scheduled.
@@ -47,7 +51,7 @@ export function withRetry<Fn extends (...args: any[]) => MaybePromise<any>>(
47
51
  const result = await fn(...args)
48
52
  return result
49
53
  } catch (error) {
50
- if (!(error instanceof RetryableError)) {
54
+ if (!shouldRetryError(error, attempt)) {
51
55
  throw error
52
56
  }
53
57
 
@@ -1,5 +1,6 @@
1
1
  import { getCouchError, getReason } from './response.mts'
2
2
  import type { StandardSchemaV1 } from '../../types/standard-schema.ts'
3
+ import { isObject } from '../../types/types.utils.ts'
3
4
 
4
5
  /**
5
6
  * Represents a network-level error emitted by Node.js or HTTP client libraries.
@@ -80,6 +81,17 @@ const getNestedNetworkError = (
80
81
  return isNetworkError(candidate.cause) ? candidate.cause : null
81
82
  }
82
83
 
84
+ export const hasStatusCode = (error: unknown): error is { statusCode: number } => {
85
+ return isObject(error) && 'statusCode' in error && typeof error.statusCode === 'number'
86
+ }
87
+
88
+ export const isTransientAuthError = (error: unknown, attempt: number) => {
89
+ if (!hasStatusCode(error)) return false
90
+ if (attempt > 0) return false
91
+
92
+ return error.statusCode === 401 || error.statusCode === 403
93
+ }
94
+
83
95
  /**
84
96
  * Shared structured fields available on hide-a-bed operational errors.
85
97
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hide-a-bed",
3
- "version": "7.0.0-beta.1",
3
+ "version": "7.0.0-beta.2",
4
4
  "description": "An abstraction over couchdb calls that includes easy mock/stubs with pouchdb",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.cjs",
@@ -1 +1 @@
1
- {"version":3,"file":"patch.d.mts","sourceRoot":"","sources":["../../../impl/patch.mts"],"names":[],"mappings":"AAIA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,QAAA,MAAM,eAAe;;iBAIiB,CAAA;AAEtC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,GAChB,aAAa,gBAAgB,EAC7B,IAAI,MAAM,EACV,aAAa,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC;;;;;EAwB7C,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAC3B,aAAa,gBAAgB,EAC7B,IAAI,MAAM,EACV,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;EA8DpC,CAAA"}
1
+ {"version":3,"file":"patch.d.mts","sourceRoot":"","sources":["../../../impl/patch.mts"],"names":[],"mappings":"AAIA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,QAAA,MAAM,eAAe;;iBAIiB,CAAA;AAEtC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,GAChB,aAAa,gBAAgB,EAC7B,IAAI,MAAM,EACV,aAAa,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC;;;;;EAwB7C,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAC3B,aAAa,gBAAgB,EAC7B,IAAI,MAAM,EACV,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;EAgEpC,CAAA"}
@@ -1,3 +1,4 @@
1
+ export declare const shouldRetryError: (error: unknown, attempt: number) => boolean;
1
2
  /**
2
3
  * Settings that control how retry attempts are scheduled.
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.mts","sourceRoot":"","sources":["../../../impl/retry.mts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,KAAK,YAAY,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAEzC;;;;;;GAMG;AAEH,wBAAgB,SAAS,CAAC,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,GAAG,CAAC,EACxE,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,YAAiB,GACzB,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CA2B/D"}
1
+ {"version":3,"file":"retry.d.mts","sourceRoot":"","sources":["../../../impl/retry.mts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,EAAE,SAAS,MAAM,YAE/D,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,KAAK,YAAY,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAEzC;;;;;;GAMG;AAEH,wBAAgB,SAAS,CAAC,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,GAAG,CAAC,EACxE,EAAE,EAAE,EAAE,EACN,OAAO,GAAE,YAAiB,GACzB,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CA2B/D"}
@@ -16,6 +16,10 @@ export interface NetworkError {
16
16
  }
17
17
  export type ErrorCategory = 'conflict' | 'network' | 'not_found' | 'operation' | 'retryable' | 'validation' | 'transaction';
18
18
  export type ErrorOperation = 'get' | 'getAtRev' | 'getDBInfo' | 'patch' | 'patchDangerously' | 'put' | 'query' | 'queryStream' | 'remove' | 'request' | 'watchDocs';
19
+ export declare const hasStatusCode: (error: unknown) => error is {
20
+ statusCode: number;
21
+ };
22
+ export declare const isTransientAuthError: (error: unknown, attempt: number) => boolean;
19
23
  /**
20
24
  * Shared structured fields available on hide-a-bed operational errors.
21
25
  *
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../../../../impl/utils/errors.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAEtE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAMD,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,SAAS,GACT,WAAW,GACX,WAAW,GACX,WAAW,GACX,YAAY,GACZ,aAAa,CAAA;AAEjB,MAAM,MAAM,cAAc,GACtB,KAAK,GACL,UAAU,GACV,WAAW,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AAS,EAAE,cAAc,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAYD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,cAAc,EACd,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACX,EAAE,oBAAoB,GAAG,aAAa,CAwCtC;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAKrD"}
@@ -0,0 +1,3 @@
1
+ export declare function isObject(value: unknown): value is Record<string, unknown>;
2
+ export declare function isError(value: unknown): value is Error;
3
+ //# sourceMappingURL=types.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.utils.d.ts","sourceRoot":"","sources":["../../types.utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAEtD"}
@@ -0,0 +1,7 @@
1
+ export function isObject(value: unknown): value is Record<string, unknown> {
2
+ return typeof value === 'object' && value !== null
3
+ }
4
+
5
+ export function isError(value: unknown): value is Error {
6
+ return value instanceof Error
7
+ }