hide-a-bed 4.1.1 → 4.1.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/cjs/impl/crud.cjs CHANGED
@@ -55,18 +55,14 @@ const _getWithOptions = import_crud.CouchGetWithOptions.implement(async (config,
55
55
  logger.error("No response received from get request");
56
56
  throw new import_errors.RetryableError("no response", 503);
57
57
  }
58
- if (resp.statusCode === 404) {
59
- logger.debug(`Document not found: ${id}`);
60
- return null;
61
- }
62
58
  const result = resp?.body || {};
63
59
  if (resp.statusCode === 404) {
64
60
  if (config.throwOnGetNotFound) {
65
61
  logger.warn(`Document not found (throwing error): ${id}, rev ${rev || "latest"}`);
66
- throw new Error(result.reason || "not_found");
62
+ throw new import_errors.NotFoundError(id, result.reason || "not_found");
67
63
  } else {
68
64
  logger.debug(`Document not found (returning undefined): ${id}, rev ${rev || "latest"}`);
69
- return void 0;
65
+ return null;
70
66
  }
71
67
  }
72
68
  if (import_errors.RetryableError.isRetryableStatusCode(resp.statusCode)) {
@@ -18,9 +18,21 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var errors_exports = {};
20
20
  __export(errors_exports, {
21
+ NotFoundError: () => NotFoundError,
21
22
  RetryableError: () => RetryableError
22
23
  });
23
24
  module.exports = __toCommonJS(errors_exports);
25
+ class NotFoundError extends Error {
26
+ /**
27
+ * @param {string} docId - The ID of the document that wasn't found
28
+ * @param {string} [message] - Optional error message
29
+ */
30
+ constructor(docId, message = "Document not found") {
31
+ super(message);
32
+ this.name = "NotFoundError";
33
+ this.docId = docId;
34
+ }
35
+ }
24
36
  class RetryableError extends Error {
25
37
  /**
26
38
  * @param {string} message - The error message
package/cjs/index.cjs CHANGED
@@ -67,7 +67,8 @@ const schema = {
67
67
  CouchDocResponse: import_crud2.CouchDocResponse,
68
68
  Patch: import_patch2.Patch,
69
69
  PatchDangerously: import_patch2.PatchDangerously,
70
- CouchGetAtRev: import_crud2.CouchGetAtRev
70
+ CouchGetAtRev: import_crud2.CouchGetAtRev,
71
+ Bind: import_bind.Bind
71
72
  };
72
73
  const bindConfig = import_bind.Bind.implement((config) => {
73
74
  const retryOptions = {
@@ -1 +1 @@
1
- {"version":3,"file":"crud.d.mts","sourceRoot":"","sources":["crud.mjs"],"names":[],"mappings":"AAyDA,4DAA4D;AAC5D,kBADY,OAAO,oBAAoB,EAAE,cAAc,CAIrD;AAEF,iEAAiE;AACjE,uBADY,OAAO,oBAAoB,EAAE,mBAAmB,CAI1D;AAEF,4DAA4D;AAC5D,kBADY,OAAO,oBAAoB,EAAE,cAAc,CAqCrD"}
1
+ {"version":3,"file":"crud.d.mts","sourceRoot":"","sources":["crud.mjs"],"names":[],"mappings":"AAqDA,4DAA4D;AAC5D,kBADY,OAAO,oBAAoB,EAAE,cAAc,CAIrD;AAEF,iEAAiE;AACjE,uBADY,OAAO,oBAAoB,EAAE,mBAAmB,CAI1D;AAEF,4DAA4D;AAC5D,kBADY,OAAO,oBAAoB,EAAE,cAAc,CAqCrD"}
package/impl/errors.d.mts CHANGED
@@ -3,6 +3,14 @@
3
3
  * @property {string} code - The error code
4
4
  * @property {string} [message] - Optional error message
5
5
  */
6
+ export class NotFoundError extends Error {
7
+ /**
8
+ * @param {string} docId - The ID of the document that wasn't found
9
+ * @param {string} [message] - Optional error message
10
+ */
11
+ constructor(docId: string, message?: string | undefined);
12
+ docId: string;
13
+ }
6
14
  export class RetryableError extends Error {
7
15
  /**
8
16
  * @param {number|undefined} statusCode - The HTTP status code to check
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["errors.mjs"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;IAWE;;;OAGG;IACH,yCAHW,MAAM,GAAC,SAAS,GACd,OAAO,CAKnB;IAED;;;;OAIG;IACH,+BAJW,YAAY,GAAG,OAAO,QAsBhC;IA1CD;;;OAGG;IACH,qBAHW,MAAM,cACN,MAAM,GAAC,SAAS,EAM1B;IADC,+BAA4B;CAoC/B;;;;;UAhDa,MAAM"}
1
+ {"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["errors.mjs"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;IACE;;;OAGG;IACH,mBAHW,MAAM,gCAOhB;IADC,cAAkB;CAErB;AAED;IAWE;;;OAGG;IACH,yCAHW,MAAM,GAAC,SAAS,GACd,OAAO,CAKnB;IAED;;;;OAIG;IACH,+BAJW,YAAY,GAAG,OAAO,QAsBhC;IA1CD;;;OAGG;IACH,qBAHW,MAAM,cACN,MAAM,GAAC,SAAS,EAM1B;IADC,+BAA4B;CAoC/B;;;;;UA5Da,MAAM"}
package/index.d.mts CHANGED
@@ -23,6 +23,7 @@ export namespace schema {
23
23
  export { Patch };
24
24
  export { PatchDangerously };
25
25
  export { CouchGetAtRev };
26
+ export { Bind };
26
27
  }
27
28
  import { patch } from './impl/patch.mjs';
28
29
  import { patchDangerously } from './impl/patch.mjs';
@@ -50,5 +51,6 @@ import { CouchDocResponse } from './schema/crud.mjs';
50
51
  import { Patch } from './schema/patch.mjs';
51
52
  import { PatchDangerously } from './schema/patch.mjs';
52
53
  import { CouchGetAtRev } from './schema/crud.mjs';
54
+ import { Bind } from './schema/bind.mjs';
53
55
  export { get, getAtRev, put, bulkGet, bulkSave, query, queryStream, patch, patchDangerously, bulkRemove, bulkGetDictionary, bulkSaveTransaction, withRetry, createQuery };
54
56
  //# sourceMappingURL=index.d.mts.map
package/index.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mjs"],"names":[],"mappings":"oBAEmC,iBAAiB;yBAAjB,iBAAiB;oBAAjB,iBAAiB;wBADkC,iBAAiB;yBAAjB,iBAAiB;sBAGjF,kBAAkB;4BACZ,mBAAmB;;;;;;;;;;;;;;;;;;;;sBAFP,kBAAkB;iCAAlB,kBAAkB;2BAF4B,iBAAiB;kCAAjB,iBAAiB;oCAAjB,iBAAiB;AAmCvG,uDAAuD;AACvD,yBADY,OAAO,mBAAmB,EAAE,UAAU,CA2BhD;0BAxDwB,kBAAkB;4BADhB,yBAAyB;4BAGzB,qBAAqB;gCACQ,oBAAoB;wCAApB,oBAAoB;sCAChC,qBAAqB;sBAArB,qBAAqB;yBAHoB,mBAAmB;wBAAnB,mBAAmB;2BAAnB,mBAAmB;kCAAnB,mBAAmB;oCAAnB,mBAAmB;yBAK3B,mBAAmB;yBAAnB,mBAAmB;yBAAnB,mBAAmB;iCAAnB,mBAAmB;sBADzD,oBAAoB;iCAApB,oBAAoB;8BACkB,mBAAmB"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mjs"],"names":[],"mappings":"oBAEmC,iBAAiB;yBAAjB,iBAAiB;oBAAjB,iBAAiB;wBADkC,iBAAiB;yBAAjB,iBAAiB;sBAGjF,kBAAkB;4BACZ,mBAAmB;;;;;;;;;;;;;;;;;;;;;sBAFP,kBAAkB;iCAAlB,kBAAkB;2BAF4B,iBAAiB;kCAAjB,iBAAiB;oCAAjB,iBAAiB;AAoCvG,uDAAuD;AACvD,yBADY,OAAO,mBAAmB,EAAE,UAAU,CA2BhD;0BAzDwB,kBAAkB;4BADhB,yBAAyB;4BAGzB,qBAAqB;gCACQ,oBAAoB;wCAApB,oBAAoB;sCAChC,qBAAqB;sBAArB,qBAAqB;yBAHoB,mBAAmB;wBAAnB,mBAAmB;2BAAnB,mBAAmB;kCAAnB,mBAAmB;oCAAnB,mBAAmB;yBAK3B,mBAAmB;yBAAnB,mBAAmB;yBAAnB,mBAAmB;iCAAnB,mBAAmB;sBADzD,oBAAoB;iCAApB,oBAAoB;8BACkB,mBAAmB;qBAC5E,mBAAmB"}
package/index.mjs CHANGED
@@ -31,7 +31,8 @@ const schema = {
31
31
  CouchDocResponse,
32
32
  Patch,
33
33
  PatchDangerously,
34
- CouchGetAtRev
34
+ CouchGetAtRev,
35
+ Bind
35
36
  }
36
37
 
37
38
  /** @type { import('./schema/bind.mjs').BindSchema } */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hide-a-bed",
3
- "version": "4.1.1",
3
+ "version": "4.1.2",
4
4
  "description": "An abstraction over couchdb calls that includes easy mock/stubs with pouchdb",
5
5
  "module": "index.mjs",
6
6
  "main": "cjs/index.cjs",