hide-a-bed 5.2.2 → 5.2.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 +4 -3
- package/cjs/impl/bulk.cjs +3 -1
- package/cjs/impl/queryBuilder.cjs +24 -0
- package/impl/bulk.d.mts.map +1 -1
- package/impl/bulk.mjs +3 -1
- package/impl/query.mjs +1 -1
- package/impl/queryBuilder.d.mts +31 -1
- package/impl/queryBuilder.d.mts.map +1 -1
- package/impl/queryBuilder.mjs +31 -1
- package/package.json +1 -1
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.
|
|
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
|
|
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.
|
|
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
|
package/cjs/impl/bulk.cjs
CHANGED
|
@@ -134,7 +134,9 @@ const bulkRemove = import_bulk.BulkRemove.implement(async (config, ids) => {
|
|
|
134
134
|
logger.warn(`Invalid document structure in bulk remove: ${row.id}`, e);
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
|
-
|
|
137
|
+
if (!toRemove.length) return [];
|
|
138
|
+
const result = await bulkSave(config, toRemove);
|
|
139
|
+
return result;
|
|
138
140
|
});
|
|
139
141
|
const bulkGetDictionary = import_bulk.BulkGetDictionary.implement(async (config, ids) => {
|
|
140
142
|
const resp = await bulkGet(config, ids);
|
|
@@ -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/bulk.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.d.mts","sourceRoot":"","sources":["bulk.mjs"],"names":[],"mappings":"AAWA,4DAA4D;AAC5D,uBADY,OAAO,oBAAoB,EAAE,cAAc,CA4CrD;AAEF,2DAA2D;AAC3D,sBADY,OAAO,oBAAoB,EAAE,aAAa,CAoCpD;AAIF,8DAA8D;AAC9D,yBADY,OAAO,oBAAoB,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"bulk.d.mts","sourceRoot":"","sources":["bulk.mjs"],"names":[],"mappings":"AAWA,4DAA4D;AAC5D,uBADY,OAAO,oBAAoB,EAAE,cAAc,CA4CrD;AAEF,2DAA2D;AAC3D,sBADY,OAAO,oBAAoB,EAAE,aAAa,CAoCpD;AAIF,8DAA8D;AAC9D,yBADY,OAAO,oBAAoB,EAAE,gBAAgB,CAoBvD;AAEF,qEAAqE;AACrE,gCADY,OAAO,oBAAoB,EAAE,uBAAuB,CAwB9D;AAEF,2FAA2F;AAC3F,kCADY,OAAO,oBAAoB,EAAE,yBAAyB,CAiJhE"}
|
package/impl/bulk.mjs
CHANGED
|
@@ -112,7 +112,9 @@ export const bulkRemove = BulkRemove.implement(async (config, ids) => {
|
|
|
112
112
|
logger.warn(`Invalid document structure in bulk remove: ${row.id}`, e)
|
|
113
113
|
}
|
|
114
114
|
})
|
|
115
|
-
|
|
115
|
+
if (!toRemove.length) return []
|
|
116
|
+
const result = await bulkSave(config, toRemove)
|
|
117
|
+
return result
|
|
116
118
|
})
|
|
117
119
|
|
|
118
120
|
/** @type { import('../schema/bulk.mjs').BulkGetDictionarySchema } */
|
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
|
|
package/impl/queryBuilder.d.mts
CHANGED
|
@@ -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
|
|
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"}
|
package/impl/queryBuilder.mjs
CHANGED
|
@@ -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
|
*/
|