hide-a-bed 5.1.2 → 5.1.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 CHANGED
@@ -40,9 +40,23 @@ A convience method to bind the config, so you dont need to pass it in.
40
40
  ```
41
41
  import { bindConfig } from 'hide-a-bed'
42
42
  const db = bindConfig(process.env)
43
+ const services = { db } // see example below
43
44
  const doc = await db.get('doc-123')
44
45
  ```
45
46
 
47
+ If you need to force autocompletion/type-checking, you can add the following jsdoc to help your editor
48
+
49
+ ```
50
+ function doSomething (services)
51
+ /** @type { import('hide-a-bed/index.mjs').DB} db */
52
+ const db = services.db;
53
+ ```
54
+
55
+ Here is an example of compiler warnings:
56
+
57
+ ![jsdoc type def](docs/compiler.png)
58
+
59
+
46
60
  ##### Config Overrides
47
61
 
48
62
  You also can quickly change one (or more) config settings for a particular call with the db.config(options)
package/cjs/index.cjs CHANGED
@@ -38,6 +38,7 @@ __export(index_exports, {
38
38
  withRetry: () => import_retry.withRetry
39
39
  });
40
40
  module.exports = __toCommonJS(index_exports);
41
+ var import_zod = require("zod");
41
42
  var import_bulk = require("./impl/bulk.cjs");
42
43
  var import_crud = require("./impl/crud.cjs");
43
44
  var import_changes = require("./impl/changes.cjs");
Binary file
package/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ export type DB = z.infer<typeof BindReturns>;
1
2
  import { get } from './impl/crud.mjs';
2
3
  import { getAtRev } from './impl/crud.mjs';
3
4
  import { put } from './impl/crud.mjs';
@@ -44,6 +45,8 @@ import { withRetry } from './impl/retry.mjs';
44
45
  import { createQuery } from './impl/queryBuilder.mjs';
45
46
  import { createLock } from './impl/sugar/lock.mjs';
46
47
  import { removeLock } from './impl/sugar/lock.mjs';
48
+ import { z } from 'zod';
49
+ import { BindReturns } from './schema/bind.mjs';
47
50
  import { CouchConfig } from './schema/config.mjs';
48
51
  import { SimpleViewQuery } from './schema/query.mjs';
49
52
  import { SimpleViewQueryResponse } from './schema/query.mjs';
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;sBAMjF,kBAAkB;4BACZ,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAJP,kBAAkB;iCAAlB,kBAAkB;2BAH4B,iBAAiB;kCAAjB,iBAAiB;oCAAjB,iBAAiB;AAoFvG,uDAAuD;AACvD,yBADY,OAAO,mBAAmB,EAAE,UAAU,CAuBhD;0BAlGwB,kBAAkB;4BADhB,yBAAyB;2BAJd,uBAAuB;2BAAvB,uBAAuB;4BAOlC,qBAAqB;gCACQ,oBAAoB;wCAApB,oBAAoB;sCAEhC,qBAAqB;sBAArB,qBAAqB;yBAJoB,mBAAmB;wBAAnB,mBAAmB;2BAAnB,mBAAmB;kCAAnB,mBAAmB;oCAAnB,mBAAmB;yBAQ3B,mBAAmB;yBAAnB,mBAAmB;yBAAnB,mBAAmB;iCAAnB,mBAAmB;sBAHzD,oBAAoB;iCAApB,oBAAoB;8BAGkB,mBAAmB;qBAC5E,mBAAmB;qBAHkB,yBAAyB;0BACzD,0BAA0B;4BADM,yBAAyB;2BAAzB,yBAAyB;2BAAzB,yBAAyB;wBAH1B,sBAAsB;+BAAtB,sBAAsB;gCAAtB,sBAAsB"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mjs"],"names":[],"mappings":"iBA+Ge,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;oBA5GP,iBAAiB;yBAAjB,iBAAiB;oBAAjB,iBAAiB;wBADkC,iBAAiB;yBAAjB,iBAAiB;sBAMjF,kBAAkB;4BACZ,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAJP,kBAAkB;iCAAlB,kBAAkB;2BAH4B,iBAAiB;kCAAjB,iBAAiB;oCAAjB,iBAAiB;AAoFvG,uDAAuD;AACvD,yBADY,OAAO,mBAAmB,EAAE,UAAU,CAuBhD;0BAlGwB,kBAAkB;4BADhB,yBAAyB;2BAJd,uBAAuB;2BAAvB,uBAAuB;kBAL5C,KAAK;4BAoBW,mBAAmB;4BARzB,qBAAqB;gCACQ,oBAAoB;wCAApB,oBAAoB;sCAEhC,qBAAqB;sBAArB,qBAAqB;yBAJoB,mBAAmB;wBAAnB,mBAAmB;2BAAnB,mBAAmB;kCAAnB,mBAAmB;oCAAnB,mBAAmB;yBAQ3B,mBAAmB;yBAAnB,mBAAmB;yBAAnB,mBAAmB;iCAAnB,mBAAmB;sBAHzD,oBAAoB;iCAApB,oBAAoB;8BAGkB,mBAAmB;qBAC/D,mBAAmB;qBAHK,yBAAyB;0BACzD,0BAA0B;4BADM,yBAAyB;2BAAzB,yBAAyB;2BAAzB,yBAAyB;wBAH1B,sBAAsB;+BAAtB,sBAAsB;gCAAtB,sBAAsB"}
package/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  // @ts-check */
2
+ import { z } from 'zod'
2
3
  import { bulkGet, bulkSave, bulkRemove, bulkGetDictionary, bulkSaveTransaction } from './impl/bulk.mjs'
3
4
  import { get, put, getAtRev } from './impl/crud.mjs'
4
5
  import { changes } from './impl/changes.mjs'
@@ -18,7 +19,7 @@ import { Patch, PatchDangerously } from './schema/patch.mjs'
18
19
  import { Lock, LockOptions, CreateLock, RemoveLock } from './schema/sugar/lock.mjs'
19
20
  import { WatchDocs } from './schema/sugar/watch.mjs'
20
21
  import { CouchDoc, CouchDocResponse, CouchPut, CouchGet, CouchGetAtRev } from './schema/crud.mjs'
21
- import { Bind } from './schema/bind.mjs'
22
+ import { Bind, BindReturns } from './schema/bind.mjs'
22
23
 
23
24
  const schema = {
24
25
  CouchConfig,
@@ -108,6 +109,8 @@ const bindConfig = Bind.implement((
108
109
  return all
109
110
  })
110
111
 
112
+ /** @typedef { z.infer<typeof BindReturns> } DB */
113
+
111
114
  export {
112
115
  get,
113
116
  getAtRev,
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "hide-a-bed",
3
- "version": "5.1.2",
3
+ "version": "5.1.4",
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",
7
7
  "type": "module",
8
+ "types": "index.d.mts",
8
9
  "exports": {
9
10
  "require": "./cjs/index.cjs",
10
11
  "import": "./index.mjs",