hide-a-bed 5.0.4 → 5.0.5

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
@@ -413,25 +413,26 @@ const result = await query(config, view, options)
413
413
  ```
414
414
 
415
415
  #### createQuery()
416
- Create a query builder to help construct view queries with a fluent interface.
416
+ Create a query builder to help construct view queries with a fluent interface. Note we have stuck to couch naming conventions and not camel case.
417
+
417
418
  - Returns: QueryBuilder instance with methods:
418
419
  - `key(value)`: Set exact key match
419
- - `startKey(value)`: Set range start key
420
- - `endKey(value)`: Set range end key
420
+ - `startkey(value)`: Set range start key
421
+ - `endkey(value)`: Set range end key
421
422
  - `descending(bool)`: Set descending sort order
422
423
  - `skip(number)`: Set number of results to skip
423
424
  - `limit(number)`: Set max number of results
424
- - `includeDocs(bool)`: Include full documents
425
+ - `include_docs(bool)`: Include full documents
425
426
  - `reduce(bool)`: Enable/disable reduce
426
427
  - `group(bool)`: Enable/disable grouping
427
- - `groupLevel(number)`: Set group level
428
+ - `group_level(number)`: Set group level
428
429
  - `build()`: Return the constructed query options object
429
430
 
430
431
  ```javascript
431
432
  const options = createQuery()
432
- .startKey('A')
433
- .endKey('B')
434
- .includeDocs(true)
433
+ .startkey('A')
434
+ .endkey('B')
435
+ .include_docs(true)
435
436
  .limit(10)
436
437
  .build()
437
438
 
@@ -41,6 +41,14 @@ class QueryBuilder {
41
41
  this.#options.startkey = startkey;
42
42
  return this;
43
43
  }
44
+ /**
45
+ * @param {any} startkey
46
+ * @returns {QueryBuilder}
47
+ */
48
+ startkey(startkey) {
49
+ this.#options.startkey = startkey;
50
+ return this;
51
+ }
44
52
  /**
45
53
  * @param {any} endkey
46
54
  * @returns {QueryBuilder}
@@ -49,6 +57,14 @@ class QueryBuilder {
49
57
  this.#options.endkey = endkey;
50
58
  return this;
51
59
  }
60
+ /**
61
+ * @param {any} endkey
62
+ * @returns {QueryBuilder}
63
+ */
64
+ endkey(endkey) {
65
+ this.#options.endkey = endkey;
66
+ return this;
67
+ }
52
68
  /**
53
69
  * @param {boolean} reduce
54
70
  * @returns {QueryBuilder}
@@ -73,6 +89,30 @@ class QueryBuilder {
73
89
  this.#options.group_level = level;
74
90
  return this;
75
91
  }
92
+ /**
93
+ * @param {number} level
94
+ * @returns {QueryBuilder}
95
+ */
96
+ group_level(level) {
97
+ this.#options.group_level = level;
98
+ return this;
99
+ }
100
+ /**
101
+ * @param {boolean} includeDocs
102
+ * @returns {QueryBuilder}
103
+ */
104
+ includeDocs(includeDocs = true) {
105
+ this.#options.include_docs = includeDocs;
106
+ return this;
107
+ }
108
+ /**
109
+ * @param {boolean} includeDocs
110
+ * @returns {QueryBuilder}
111
+ */
112
+ include_docs(includeDocs = true) {
113
+ this.#options.include_docs = includeDocs;
114
+ return this;
115
+ }
76
116
  /**
77
117
  * @param {string} stale
78
118
  * @returns {QueryBuilder}
@@ -6,6 +6,7 @@
6
6
  * @property {boolean} [reduce] - Whether to use reduce function
7
7
  * @property {boolean} [group] - Whether to group results
8
8
  * @property {number} [group_level] - Level at which to group
9
+ * @property {boolean} [include_docs] - Whether to include full couch docs
9
10
  * @property {string} [stale] - Stale parameter value
10
11
  * @property {number} [limit] - Max number of results
11
12
  */
@@ -20,11 +21,21 @@ export class QueryBuilder {
20
21
  * @returns {QueryBuilder}
21
22
  */
22
23
  startKey(startkey: any): QueryBuilder;
24
+ /**
25
+ * @param {any} startkey
26
+ * @returns {QueryBuilder}
27
+ */
28
+ startkey(startkey: any): QueryBuilder;
23
29
  /**
24
30
  * @param {any} endkey
25
31
  * @returns {QueryBuilder}
26
32
  */
27
33
  endKey(endkey: any): QueryBuilder;
34
+ /**
35
+ * @param {any} endkey
36
+ * @returns {QueryBuilder}
37
+ */
38
+ endkey(endkey: any): QueryBuilder;
28
39
  /**
29
40
  * @param {boolean} reduce
30
41
  * @returns {QueryBuilder}
@@ -40,6 +51,21 @@ export class QueryBuilder {
40
51
  * @returns {QueryBuilder}
41
52
  */
42
53
  groupLevel(level: number): QueryBuilder;
54
+ /**
55
+ * @param {number} level
56
+ * @returns {QueryBuilder}
57
+ */
58
+ group_level(level: number): QueryBuilder;
59
+ /**
60
+ * @param {boolean} includeDocs
61
+ * @returns {QueryBuilder}
62
+ */
63
+ includeDocs(includeDocs?: boolean): QueryBuilder;
64
+ /**
65
+ * @param {boolean} includeDocs
66
+ * @returns {QueryBuilder}
67
+ */
68
+ include_docs(includeDocs?: boolean): QueryBuilder;
43
69
  /**
44
70
  * @param {string} stale
45
71
  * @returns {QueryBuilder}
@@ -82,6 +108,10 @@ export type QueryOptions = {
82
108
  * - Level at which to group
83
109
  */
84
110
  group_level?: number | undefined;
111
+ /**
112
+ * - Whether to include full couch docs
113
+ */
114
+ include_docs?: boolean | undefined;
85
115
  /**
86
116
  * - Stale parameter value
87
117
  */
@@ -1 +1 @@
1
- {"version":3,"file":"queryBuilder.d.mts","sourceRoot":"","sources":["queryBuilder.mjs"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH;IAIE;;;OAGG;IACH,SAHW,GAAG,GACD,YAAY,CAKxB;IAED;;;OAGG;IACH,mBAHW,GAAG,GACD,YAAY,CAKxB;IAED;;;OAGG;IACH,eAHW,GAAG,GACD,YAAY,CAKxB;IAED;;;OAGG;IACH,gBAHW,OAAO,GACL,YAAY,CAKxB;IAED;;;OAGG;IACH,cAHW,OAAO,GACL,YAAY,CAKxB;IAED;;;OAGG;IACH,kBAHW,MAAM,GACJ,YAAY,CAKxB;IAED;;;OAGG;IACH,aAHW,MAAM,GACJ,YAAY,CAKxB;IAED;;;OAGG;IACH,aAHW,MAAM,GACJ,YAAY,CAKxB;IAED;;OAEG;IACH,SAFa,YAAY,CAIxB;;CACF;AAEM,4CAA4C;;;;;UA9FrC,GAAG;;;;eACH,GAAG;;;;aACH,GAAG"}
1
+ {"version":3,"file":"queryBuilder.d.mts","sourceRoot":"","sources":["queryBuilder.mjs"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH;IAIE;;;OAGG;IACH,SAHW,GAAG,GACD,YAAY,CAKxB;IAED;;;OAGG;IACH,mBAHW,GAAG,GACD,YAAY,CAKxB;IAED;;;OAGG;IACH,mBAHW,GAAG,GACD,YAAY,CAKxB;IAED;;;OAGG;IACH,eAHW,GAAG,GACD,YAAY,CAKxB;IAED;;;OAGG;IACH,eAHW,GAAG,GACD,YAAY,CAKxB;IAED;;;OAGG;IACH,gBAHW,OAAO,GACL,YAAY,CAKxB;IAED;;;OAGG;IACH,cAHW,OAAO,GACL,YAAY,CAKxB;IAED;;;OAGG;IACH,kBAHW,MAAM,GACJ,YAAY,CAKxB;IAED;;;OAGG;IACH,mBAHW,MAAM,GACJ,YAAY,CAKxB;IAED;;;OAGG;IACH,0BAHW,OAAO,GACL,YAAY,CAKxB;IAED;;;OAGG;IACH,2BAHW,OAAO,GACL,YAAY,CAKxB;IAED;;;OAGG;IACH,aAHW,MAAM,GACJ,YAAY,CAKxB;IAED;;;OAGG;IACH,aAHW,MAAM,GACJ,YAAY,CAKxB;IAED;;OAEG;IACH,SAFa,YAAY,CAIxB;;CACF;AAEM,4CAA4C;;;;;UA5IrC,GAAG;;;;eACH,GAAG;;;;aACH,GAAG"}
@@ -8,6 +8,7 @@
8
8
  * @property {boolean} [reduce] - Whether to use reduce function
9
9
  * @property {boolean} [group] - Whether to group results
10
10
  * @property {number} [group_level] - Level at which to group
11
+ * @property {boolean} [include_docs] - Whether to include full couch docs
11
12
  * @property {string} [stale] - Stale parameter value
12
13
  * @property {number} [limit] - Max number of results
13
14
  */
@@ -34,6 +35,15 @@ export class QueryBuilder {
34
35
  return this
35
36
  }
36
37
 
38
+ /**
39
+ * @param {any} startkey
40
+ * @returns {QueryBuilder}
41
+ */
42
+ startkey (startkey) {
43
+ this.#options.startkey = startkey
44
+ return this
45
+ }
46
+
37
47
  /**
38
48
  * @param {any} endkey
39
49
  * @returns {QueryBuilder}
@@ -43,6 +53,15 @@ export class QueryBuilder {
43
53
  return this
44
54
  }
45
55
 
56
+ /**
57
+ * @param {any} endkey
58
+ * @returns {QueryBuilder}
59
+ */
60
+ endkey (endkey) {
61
+ this.#options.endkey = endkey
62
+ return this
63
+ }
64
+
46
65
  /**
47
66
  * @param {boolean} reduce
48
67
  * @returns {QueryBuilder}
@@ -70,6 +89,33 @@ export class QueryBuilder {
70
89
  return this
71
90
  }
72
91
 
92
+ /**
93
+ * @param {number} level
94
+ * @returns {QueryBuilder}
95
+ */
96
+ group_level (level) {
97
+ this.#options.group_level = level
98
+ return this
99
+ }
100
+
101
+ /**
102
+ * @param {boolean} includeDocs
103
+ * @returns {QueryBuilder}
104
+ */
105
+ includeDocs (includeDocs = true) {
106
+ this.#options.include_docs = includeDocs
107
+ return this
108
+ }
109
+
110
+ /**
111
+ * @param {boolean} includeDocs
112
+ * @returns {QueryBuilder}
113
+ */
114
+ include_docs (includeDocs = true) {
115
+ this.#options.include_docs = includeDocs
116
+ return this
117
+ }
118
+
73
119
  /**
74
120
  * @param {string} stale
75
121
  * @returns {QueryBuilder}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hide-a-bed",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
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",