hide-a-bed 5.2.2 → 5.2.3

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
@@ -60,15 +60,16 @@ Here is an example of compiler warnings:
60
60
 
61
61
  ##### Config Overrides
62
62
 
63
- You also can quickly change one (or more) config settings for a particular call with the db.config(options)
63
+ You also can quickly change one (or more) config settings for a particular call with the db.options(optionOverrides)
64
64
 
65
65
  eg
66
66
 
67
67
  ```
68
- const doc = await db.config({ throwOnGetNotFound: true }).get('doc-id')
68
+ const db = bindConfig({ couch: 'http://localhost:5984/db', throwOnGetNotFound: false })
69
+ const doc = await db.options({ throwOnGetNotFound: true }).get('doc-id')
69
70
  ```
70
71
 
71
- You can pass any of [Config Options](#advanced-config-options) to db.config to override the original bindings.
72
+ You can pass any of [Config Options](#advanced-config-options) to db.options to override the original config bindings.
72
73
 
73
74
 
74
75
  ### Document Operations
@@ -129,6 +129,30 @@ class QueryBuilder {
129
129
  this.#options.limit = limit;
130
130
  return this;
131
131
  }
132
+ /**
133
+ * @param {boolean} descending
134
+ * @returns {QueryBuilder}
135
+ */
136
+ descending(descending = true) {
137
+ this.#options.descending = descending;
138
+ return this;
139
+ }
140
+ /**
141
+ * @param {number} skip
142
+ * @returns {QueryBuilder}
143
+ */
144
+ skip(skip) {
145
+ this.#options.skip = skip;
146
+ return this;
147
+ }
148
+ /**
149
+ * @param {any[]} keys
150
+ * @returns {QueryBuilder}
151
+ */
152
+ keys(keys) {
153
+ this.#options.keys = keys;
154
+ return this;
155
+ }
132
156
  /**
133
157
  * @returns {QueryOptions}
134
158
  */
package/impl/query.mjs CHANGED
@@ -40,7 +40,7 @@ export const query = SimpleViewQuery.implement(async (config, view, options = {}
40
40
 
41
41
  const _options = JSON.parse(JSON.stringify(options))
42
42
  delete _options.keys
43
- qs = queryString(_options, ['key', 'startkey', 'endkey', 'reduce', 'group', 'group_level', 'stale', 'limit'])
43
+ qs = queryString(_options, ['key', 'startkey', 'endkey', 'reduce', 'group', 'group_level', 'stale', 'limit']) // dont need descening or skip, those will work
44
44
 
45
45
  const keysAsString = `keys=${JSON.stringify(options.keys)}`
46
46
 
@@ -6,9 +6,12 @@
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
+ * @property {boolean} [include_docs] - Whether to include full couch docs
10
10
  * @property {string} [stale] - Stale parameter value
11
11
  * @property {number} [limit] - Max number of results
12
+ * @property {boolean} [descending] - Whether to return results in descending order
13
+ * @property {number} [skip] - Number of results to skip
14
+ * @property {any[]} [keys] - Array of keys to match
12
15
  */
13
16
  export class QueryBuilder {
14
17
  /**
@@ -76,6 +79,21 @@ export class QueryBuilder {
76
79
  * @returns {QueryBuilder}
77
80
  */
78
81
  limit(limit: number): QueryBuilder;
82
+ /**
83
+ * @param {boolean} descending
84
+ * @returns {QueryBuilder}
85
+ */
86
+ descending(descending?: boolean): QueryBuilder;
87
+ /**
88
+ * @param {number} skip
89
+ * @returns {QueryBuilder}
90
+ */
91
+ skip(skip: number): QueryBuilder;
92
+ /**
93
+ * @param {any[]} keys
94
+ * @returns {QueryBuilder}
95
+ */
96
+ keys(keys: any[]): QueryBuilder;
79
97
  /**
80
98
  * @returns {QueryOptions}
81
99
  */
@@ -120,5 +138,17 @@ export type QueryOptions = {
120
138
  * - Max number of results
121
139
  */
122
140
  limit?: number | undefined;
141
+ /**
142
+ * - Whether to return results in descending order
143
+ */
144
+ descending?: boolean | undefined;
145
+ /**
146
+ * - Number of results to skip
147
+ */
148
+ skip?: number | undefined;
149
+ /**
150
+ * - Array of keys to match
151
+ */
152
+ keys?: any[] | undefined;
123
153
  };
124
154
  //# sourceMappingURL=queryBuilder.d.mts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"queryBuilder.d.mts","sourceRoot":"","sources":["queryBuilder.mjs"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;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;;;OAGG;IACH,wBAHW,OAAO,GACL,YAAY,CAKxB;IAED;;;OAGG;IACH,WAHW,MAAM,GACJ,YAAY,CAKxB;IAED;;;OAGG;IACH,WAHW,GAAG,EAAE,GACH,YAAY,CAKxB;IAED;;OAEG;IACH,SAFa,YAAY,CAIxB;;CACF;AAEM,4CAA4C;;;;;UA1KrC,GAAG;;;;eACH,GAAG;;;;aACH,GAAG"}
@@ -8,9 +8,12 @@
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
+ * @property {boolean} [include_docs] - Whether to include full couch docs
12
12
  * @property {string} [stale] - Stale parameter value
13
13
  * @property {number} [limit] - Max number of results
14
+ * @property {boolean} [descending] - Whether to return results in descending order
15
+ * @property {number} [skip] - Number of results to skip
16
+ * @property {any[]} [keys] - Array of keys to match
14
17
  */
15
18
 
16
19
  export class QueryBuilder {
@@ -134,6 +137,33 @@ export class QueryBuilder {
134
137
  return this
135
138
  }
136
139
 
140
+ /**
141
+ * @param {boolean} descending
142
+ * @returns {QueryBuilder}
143
+ */
144
+ descending (descending = true) {
145
+ this.#options.descending = descending
146
+ return this
147
+ }
148
+
149
+ /**
150
+ * @param {number} skip
151
+ * @returns {QueryBuilder}
152
+ */
153
+ skip (skip) {
154
+ this.#options.skip = skip
155
+ return this
156
+ }
157
+
158
+ /**
159
+ * @param {any[]} keys
160
+ * @returns {QueryBuilder}
161
+ */
162
+ keys (keys) {
163
+ this.#options.keys = keys
164
+ return this
165
+ }
166
+
137
167
  /**
138
168
  * @returns {QueryOptions}
139
169
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hide-a-bed",
3
- "version": "5.2.2",
3
+ "version": "5.2.3",
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",