hide-a-bed 4.1.2 → 4.2.0

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
@@ -181,7 +181,7 @@ const docs = [
181
181
  { _id: 'doc2', type: 'user', name: 'Bob' }
182
182
  ]
183
183
  const results = await bulkSave(config, docs)
184
- // results: [
184
+ // [
185
185
  // { ok: true, id: 'doc1', rev: '1-abc123' },
186
186
  // { ok: true, id: 'doc2', rev: '1-def456' }
187
187
  // ]
@@ -202,7 +202,7 @@ Not found documents will still have a row in the results, but the doc will be nu
202
202
  const config = { couch: 'http://localhost:5984/mydb' }
203
203
  const ids = ['doc1', 'doc2', 'doesNotExist']
204
204
  const docs = await bulkGet(config, ids)
205
- // docs: [
205
+ // rows: [
206
206
  // { _id: 'doc1', _rev: '1-abc123', type: 'user', name: 'Alice' },
207
207
  // { _id: 'doc2', _rev: '1-def456', type: 'user', name: 'Bob' },
208
208
  // { key: 'notThereDoc', error: 'not_found' }
@@ -39,23 +39,35 @@ var import_errors = require("./errors.cjs");
39
39
  var import_logger = require("./logger.cjs");
40
40
  var import_lodash = __toESM(require("lodash"), 1);
41
41
  const { includes } = import_lodash.default;
42
- const query = import_query.SimpleViewQuery.implement(async (config, view, options) => {
42
+ const query = import_query.SimpleViewQuery.implement(async (config, view, options = {}) => {
43
43
  const logger = (0, import_logger.createLogger)(config);
44
44
  logger.info(`Starting view query: ${view}`);
45
45
  logger.debug("Query options:", options);
46
- const qs = queryString(options, ["key", "startkey", "endkey", "reduce", "group", "group_level", "stale", "limit"]);
46
+ let qs = queryString(options, ["key", "startkey", "endkey", "reduce", "group", "group_level", "stale", "limit"]);
47
47
  logger.debug("Generated query string:", qs);
48
+ let method = "GET";
49
+ let payload = null;
48
50
  const opts = {
49
51
  json: true,
50
52
  headers: {
51
53
  "Content-Type": "application/json"
52
54
  }
53
55
  };
56
+ if (typeof options.keys !== "undefined") {
57
+ const MAX_URL_LENGTH = 2e3;
58
+ const keysAsString = `keys=${encodeURIComponent(JSON.stringify(options.keys))}`;
59
+ if (keysAsString.length + qs.length + 1 <= MAX_URL_LENGTH) {
60
+ qs += (qs[0] === "?" ? "&" : "?") + keysAsString;
61
+ } else {
62
+ method = "POST";
63
+ payload = { keys: options.keys };
64
+ }
65
+ }
54
66
  const url = `${config.couch}/${view}?${qs.toString()}`;
55
67
  let results;
56
68
  try {
57
- logger.debug(`Sending GET request to: ${url}`);
58
- results = await (0, import_needle.default)("get", url, opts);
69
+ logger.debug(`Sending ${method} request to: ${url}`);
70
+ results = method === "GET" ? await (0, import_needle.default)("get", url, opts) : await (0, import_needle.default)("post", url, payload, opts);
59
71
  } catch (err) {
60
72
  logger.error("Network error during query:", err);
61
73
  import_errors.RetryableError.handleNetworkError(err);
@@ -77,7 +89,7 @@ const query = import_query.SimpleViewQuery.implement(async (config, view, option
77
89
  logger.debug("Query response:", body);
78
90
  return body;
79
91
  });
80
- function queryString(options, params) {
92
+ function queryString(options = {}, params) {
81
93
  const parts = Object.keys(options).map((key) => {
82
94
  let value = options[key];
83
95
  if (includes(params, key)) {
@@ -43,8 +43,20 @@ const queryStream = (rawConfig, view, options, onRow) => new Promise((resolve, r
43
43
  logger.info(`Starting view query stream: ${view}`);
44
44
  logger.debug("Query options:", options);
45
45
  if (!options) options = {};
46
- const qs = (0, import_query.queryString)(options, ["key", "startkey", "endkey", "reduce", "group", "group_level", "stale", "limit"]);
46
+ let method = "GET";
47
+ let payload = null;
48
+ let qs = (0, import_query.queryString)(options, ["key", "startkey", "endkey", "reduce", "group", "group_level", "stale", "limit"]);
47
49
  logger.debug("Generated query string:", qs);
50
+ if (typeof options.keys !== "undefined") {
51
+ const MAX_URL_LENGTH = 2e3;
52
+ const keysAsString = `keys=${encodeURIComponent(JSON.stringify(options.keys))}`;
53
+ if (keysAsString.length + qs.length + 1 <= MAX_URL_LENGTH) {
54
+ qs += (qs[0] === "?" ? "&" : "?") + keysAsString;
55
+ } else {
56
+ method = "POST";
57
+ payload = { keys: options.keys };
58
+ }
59
+ }
48
60
  const url = `${config.couch}/${view}?${qs.toString()}`;
49
61
  const opts = {
50
62
  json: true,
@@ -87,7 +99,7 @@ const queryStream = (rawConfig, view, options, onRow) => new Promise((resolve, r
87
99
  logger.info(`Stream completed, processed ${rowCount} rows`);
88
100
  resolve(void 0);
89
101
  });
90
- const req = import_needle.default.get(url, opts);
102
+ const req = method === "GET" ? import_needle.default.get(url, opts) : import_needle.default.post(url, payload, opts);
91
103
  req.on("response", (response) => {
92
104
  logger.debug(`Received response with status code: ${response.statusCode}`);
93
105
  if (import_errors.RetryableError.isRetryableStatusCode(response.statusCode)) {
@@ -45,6 +45,7 @@ const SimpleViewOptions = import_zod.z.object({
45
45
  skip: import_zod.z.number().positive().optional().describe("skip this many rows"),
46
46
  limit: import_zod.z.number().positive().optional().describe("limit the results to this many rows"),
47
47
  key: import_zod.z.any().optional(),
48
+ keys: import_zod.z.array(import_zod.z.any()).optional(),
48
49
  include_docs: import_zod.z.boolean().optional().describe("join the id to the doc and return it"),
49
50
  reduce: import_zod.z.boolean().optional().describe("reduce the results"),
50
51
  group: import_zod.z.boolean().optional().describe("group the results"),
@@ -0,0 +1,11 @@
1
+ {
2
+ "esbuild": {
3
+ "entryPoints": {
4
+ "ignore": [
5
+ "./node_modules/**/*",
6
+ "./tests/**",
7
+ "./temp/**"
8
+ ]
9
+ }
10
+ }
11
+ }
package/impl/query.d.mts CHANGED
@@ -2,10 +2,20 @@
2
2
  * @param {{ [key: string]: any }} options - The options object containing query parameters.
3
3
  * @param {string[]} params - The list of parameter names to include in the query string.
4
4
  */
5
+ /**
6
+ * @param {{ [key: string]: any }} options
7
+ * @param {string[]} params
8
+ * @returns {string}
9
+ */
5
10
  export function queryString(options: {
6
11
  [key: string]: any;
7
- }, params: string[]): string;
8
- /** @type { z.infer<SimpleViewQuery> } query */
12
+ } | undefined, params: string[]): string;
13
+ /**
14
+ * @type { z.infer<SimpleViewQuery> }
15
+ * @param {import('../schema/config.mjs').CouchConfigSchema} config
16
+ * @param {string} view
17
+ * @param {import('../schema/query.mjs').SimpleViewOptionsSchema} [options]
18
+ */
9
19
  export const query: z.infer<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
10
20
  throwOnGetNotFound: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
11
21
  couch: z.ZodString;
@@ -88,6 +98,7 @@ export const query: z.infer<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
88
98
  skip: z.ZodOptional<z.ZodNumber>;
89
99
  limit: z.ZodOptional<z.ZodNumber>;
90
100
  key: z.ZodOptional<z.ZodAny>;
101
+ keys: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
91
102
  include_docs: z.ZodOptional<z.ZodBoolean>;
92
103
  reduce: z.ZodOptional<z.ZodBoolean>;
93
104
  group: z.ZodOptional<z.ZodBoolean>;
@@ -99,6 +110,7 @@ export const query: z.infer<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
99
110
  skip?: number | undefined;
100
111
  limit?: number | undefined;
101
112
  key?: any;
113
+ keys?: any[] | undefined;
102
114
  include_docs?: boolean | undefined;
103
115
  reduce?: boolean | undefined;
104
116
  group?: boolean | undefined;
@@ -110,6 +122,7 @@ export const query: z.infer<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
110
122
  skip?: number | undefined;
111
123
  limit?: number | undefined;
112
124
  key?: any;
125
+ keys?: any[] | undefined;
113
126
  include_docs?: boolean | undefined;
114
127
  reduce?: boolean | undefined;
115
128
  group?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.mts","sourceRoot":"","sources":["query.mjs"],"names":[],"mappings":"AA6DA;;;GAGG;AACH,qCAHW;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,UACtB,MAAM,EAAE,UAoBlB;AAxED,+CAA+C;AAC/C,oBADY,CAAC,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAAiB,CAgDlC;kBAzDgB,KAAK"}
1
+ {"version":3,"file":"query.d.mts","sourceRoot":"","sources":["query.mjs"],"names":[],"mappings":"AAsFA;;;GAGG;AACH;;;;GAIG;AACH,qCAJW;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,sBACtB,MAAM,EAAE,GACN,MAAM,CAoBlB;AAtGD;;;;;GAKG;AACH,oBALW,CAAC,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAAiB,CAwEjC;kBAlFgB,KAAK"}
package/impl/query.mjs CHANGED
@@ -9,28 +9,53 @@ import { createLogger } from './logger.mjs'
9
9
  import pkg from 'lodash'
10
10
  const { includes } = pkg
11
11
 
12
- /** @type { z.infer<SimpleViewQuery> } query */
13
- export const query = SimpleViewQuery.implement(async (config, view, options) => {
12
+ /**
13
+ * @type { z.infer<SimpleViewQuery> }
14
+ * @param {import('../schema/config.mjs').CouchConfigSchema} config
15
+ * @param {string} view
16
+ * @param {import('../schema/query.mjs').SimpleViewOptionsSchema} [options]
17
+ */
18
+ export const query = SimpleViewQuery.implement(async (config, view, options = {}) => {
14
19
  const logger = createLogger(config)
15
20
  logger.info(`Starting view query: ${view}`)
16
21
  logger.debug('Query options:', options)
17
22
 
18
23
  // @ts-ignore
19
- const qs = queryString(options, ['key', 'startkey', 'endkey', 'reduce', 'group', 'group_level', 'stale', 'limit'])
24
+ let qs = queryString(options, ['key', 'startkey', 'endkey', 'reduce', 'group', 'group_level', 'stale', 'limit'])
20
25
  logger.debug('Generated query string:', qs)
21
-
26
+ let method = 'GET'
27
+ let payload = null
22
28
  const opts = {
23
29
  json: true,
24
30
  headers: {
25
31
  'Content-Type': 'application/json'
26
32
  }
27
33
  }
34
+
35
+ // If keys are supplied, issue a POST to circumvent GET query string limits
36
+ // see http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options
37
+ if (typeof options.keys !== 'undefined') {
38
+ const MAX_URL_LENGTH = 2000;
39
+ // according to http://stackoverflow.com/a/417184/680742,
40
+ // the de facto URL length limit is 2000 characters
41
+
42
+ const keysAsString = `keys=${encodeURIComponent(JSON.stringify(options.keys))}`;
43
+ if (keysAsString.length + qs.length + 1 <= MAX_URL_LENGTH) {
44
+ // If the keys are short enough, do a GET. we do this to work around
45
+ // Safari not understanding 304s on POSTs (see pouchdb/pouchdb#1239)
46
+ qs += (qs[0] === '?' ? '&' : '?') + keysAsString;
47
+ } else {
48
+ method = 'POST';
49
+ payload = {keys: options.keys};
50
+ }
51
+ }
52
+
28
53
  const url = `${config.couch}/${view}?${qs.toString()}`
29
54
  // @ts-ignore
30
55
  let results
31
56
  try {
32
- logger.debug(`Sending GET request to: ${url}`)
33
- results = await needle('get', url, opts)
57
+ logger.debug(`Sending ${method} request to: ${url}`)
58
+ results = (method === 'GET') ? await needle('get', url, opts) : await needle('post', url, payload, opts)
34
59
  } catch (err) {
35
60
  logger.error('Network error during query:', err)
36
61
  RetryableError.handleNetworkError(err)
@@ -63,7 +88,12 @@ export const query = SimpleViewQuery.implement(async (config, view, options) =>
63
88
  * @param {{ [key: string]: any }} options - The options object containing query parameters.
64
89
  * @param {string[]} params - The list of parameter names to include in the query string.
65
90
  */
66
- export function queryString (options, params) {
91
+ /**
92
+ * @param {{ [key: string]: any }} options
93
+ * @param {string[]} params
94
+ * @returns {string}
95
+ */
96
+ export function queryString (options = {}, params) {
67
97
  const parts = Object.keys(options).map(key => {
68
98
  let value = options[key]
69
99
  if (includes(params, key)) {
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.mts","sourceRoot":"","sources":["stream.mjs"],"names":[],"mappings":"AASA,uFAAuF;AACvF,0BADY,OAAO,sBAAsB,EAAE,2BAA2B,CAqEpE"}
1
+ {"version":3,"file":"stream.d.mts","sourceRoot":"","sources":["stream.mjs"],"names":[],"mappings":"AASA,uFAAuF;AACvF,0BADY,OAAO,sBAAsB,EAAE,2BAA2B,CAwFpE"}
package/impl/stream.mjs CHANGED
@@ -16,8 +16,25 @@ export const queryStream = (rawConfig, view, options, onRow) => new Promise((res
16
16
 
17
17
  if (!options) options = {}
18
18
 
19
- const qs = queryString(options, ['key', 'startkey', 'endkey', 'reduce', 'group', 'group_level', 'stale', 'limit'])
19
+ let method = 'GET'
20
+ let payload = null
21
+ let qs = queryString(options, ['key', 'startkey', 'endkey', 'reduce', 'group', 'group_level', 'stale', 'limit'])
20
22
  logger.debug('Generated query string:', qs)
23
+
24
+ // If keys are supplied, issue a POST to circumvent GET query string limits
25
+ if (typeof options.keys !== 'undefined') {
26
+ const MAX_URL_LENGTH = 2000
27
+ const keysAsString = `keys=${encodeURIComponent(JSON.stringify(options.keys))}`
28
+
29
+ if (keysAsString.length + qs.length + 1 <= MAX_URL_LENGTH) {
30
+ // If the keys are short enough, do a GET
31
+ qs += (qs[0] === '?' ? '&' : '?') + keysAsString
32
+ } else {
33
+ method = 'POST'
34
+ payload = { keys: options.keys }
35
+ }
36
+ }
37
+
21
38
  const url = `${config.couch}/${view}?${qs.toString()}`
22
39
  const opts = {
23
40
  json: true,
@@ -53,7 +70,9 @@ export const queryStream = (rawConfig, view, options, onRow) => new Promise((res
53
70
  resolve(undefined) // all work should be done in the stream
54
71
  })
55
72
 
56
- const req = needle.get(url, opts)
73
+ const req = method === 'GET'
74
+ ? needle.get(url, opts)
75
+ : needle.post(url, payload, opts)
57
76
 
58
77
  req.on('response', response => {
59
78
  logger.debug(`Received response with status code: ${response.statusCode}`)
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "hide-a-bed",
3
- "version": "4.1.2",
3
+ "version": "4.2.0",
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
8
  "exports": {
9
- "import": "./index.mjs",
10
9
  "require": "./cjs/index.cjs",
10
+ "import": "./index.mjs",
11
11
  "default": "./cjs/index.cjs"
12
12
  },
13
13
  "scripts": {
14
- "clean": "(find . -name \"*.mts\" -type f -delete || true) && (find . -name \"*.map\" -type f -delete || true) && (find . -name \"log.txt\" -type f -delete || true)",
15
- "build": "npm run clean && tsc && npm run build:cjs",
14
+ "clean": "rm -rf cjs && (find . -name \"*.mts\" -type f -delete || true) && (find . -name \"*.map\" -type f -delete || true) && (find . -name \"log.txt\" -type f -delete || true)",
15
+ "build": "npm run clean && tsc && npx -p dualmode@latest build",
16
16
  "build:cjs": "rm -rf cjs && node build/build.mjs",
17
- "test": "node test/test.mjs",
17
+ "test": "node tests/test.mjs",
18
18
  "lint:fix": "standard --fix",
19
19
  "prepublish": "npm run build",
20
20
  "full": "npm run lint:fix && npm run build && npm run clean"
package/schema/bind.d.mts CHANGED
@@ -368,6 +368,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
368
368
  skip: z.ZodOptional<z.ZodNumber>;
369
369
  limit: z.ZodOptional<z.ZodNumber>;
370
370
  key: z.ZodOptional<z.ZodAny>;
371
+ keys: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
371
372
  include_docs: z.ZodOptional<z.ZodBoolean>;
372
373
  reduce: z.ZodOptional<z.ZodBoolean>;
373
374
  group: z.ZodOptional<z.ZodBoolean>;
@@ -379,6 +380,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
379
380
  skip?: number | undefined;
380
381
  limit?: number | undefined;
381
382
  key?: any;
383
+ keys?: any[] | undefined;
382
384
  include_docs?: boolean | undefined;
383
385
  reduce?: boolean | undefined;
384
386
  group?: boolean | undefined;
@@ -390,6 +392,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
390
392
  skip?: number | undefined;
391
393
  limit?: number | undefined;
392
394
  key?: any;
395
+ keys?: any[] | undefined;
393
396
  include_docs?: boolean | undefined;
394
397
  reduce?: boolean | undefined;
395
398
  group?: boolean | undefined;
@@ -465,6 +468,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
465
468
  skip: z.ZodOptional<z.ZodNumber>;
466
469
  limit: z.ZodOptional<z.ZodNumber>;
467
470
  key: z.ZodOptional<z.ZodAny>;
471
+ keys: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
468
472
  include_docs: z.ZodOptional<z.ZodBoolean>;
469
473
  reduce: z.ZodOptional<z.ZodBoolean>;
470
474
  group: z.ZodOptional<z.ZodBoolean>;
@@ -476,6 +480,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
476
480
  skip?: number | undefined;
477
481
  limit?: number | undefined;
478
482
  key?: any;
483
+ keys?: any[] | undefined;
479
484
  include_docs?: boolean | undefined;
480
485
  reduce?: boolean | undefined;
481
486
  group?: boolean | undefined;
@@ -487,6 +492,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
487
492
  skip?: number | undefined;
488
493
  limit?: number | undefined;
489
494
  key?: any;
495
+ keys?: any[] | undefined;
490
496
  include_docs?: boolean | undefined;
491
497
  reduce?: boolean | undefined;
492
498
  group?: boolean | undefined;
@@ -518,6 +524,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
518
524
  skip?: number | undefined;
519
525
  limit?: number | undefined;
520
526
  key?: any;
527
+ keys?: any[] | undefined;
521
528
  include_docs?: boolean | undefined;
522
529
  reduce?: boolean | undefined;
523
530
  group?: boolean | undefined;
@@ -646,6 +653,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
646
653
  skip?: number | undefined;
647
654
  limit?: number | undefined;
648
655
  key?: any;
656
+ keys?: any[] | undefined;
649
657
  include_docs?: boolean | undefined;
650
658
  reduce?: boolean | undefined;
651
659
  group?: boolean | undefined;
@@ -665,6 +673,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
665
673
  skip?: number | undefined;
666
674
  limit?: number | undefined;
667
675
  key?: any;
676
+ keys?: any[] | undefined;
668
677
  include_docs?: boolean | undefined;
669
678
  reduce?: boolean | undefined;
670
679
  group?: boolean | undefined;
@@ -793,6 +802,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
793
802
  skip?: number | undefined;
794
803
  limit?: number | undefined;
795
804
  key?: any;
805
+ keys?: any[] | undefined;
796
806
  include_docs?: boolean | undefined;
797
807
  reduce?: boolean | undefined;
798
808
  group?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"bind.d.mts","sourceRoot":"","sources":["bind.mjs"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAuE;yBACxD,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC;kBAvBjB,KAAK"}
1
+ {"version":3,"file":"bind.d.mts","sourceRoot":"","sources":["bind.mjs"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAuE;yBACxD,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC;kBAvBjB,KAAK"}
@@ -90,6 +90,7 @@ export const SimpleViewOptions: z.ZodOptional<z.ZodObject<{
90
90
  skip: z.ZodOptional<z.ZodNumber>;
91
91
  limit: z.ZodOptional<z.ZodNumber>;
92
92
  key: z.ZodOptional<z.ZodAny>;
93
+ keys: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
93
94
  include_docs: z.ZodOptional<z.ZodBoolean>;
94
95
  reduce: z.ZodOptional<z.ZodBoolean>;
95
96
  group: z.ZodOptional<z.ZodBoolean>;
@@ -101,6 +102,7 @@ export const SimpleViewOptions: z.ZodOptional<z.ZodObject<{
101
102
  skip?: number | undefined;
102
103
  limit?: number | undefined;
103
104
  key?: any;
105
+ keys?: any[] | undefined;
104
106
  include_docs?: boolean | undefined;
105
107
  reduce?: boolean | undefined;
106
108
  group?: boolean | undefined;
@@ -112,6 +114,7 @@ export const SimpleViewOptions: z.ZodOptional<z.ZodObject<{
112
114
  skip?: number | undefined;
113
115
  limit?: number | undefined;
114
116
  key?: any;
117
+ keys?: any[] | undefined;
115
118
  include_docs?: boolean | undefined;
116
119
  reduce?: boolean | undefined;
117
120
  group?: boolean | undefined;
@@ -200,6 +203,7 @@ export const SimpleViewQuery: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
200
203
  skip: z.ZodOptional<z.ZodNumber>;
201
204
  limit: z.ZodOptional<z.ZodNumber>;
202
205
  key: z.ZodOptional<z.ZodAny>;
206
+ keys: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
203
207
  include_docs: z.ZodOptional<z.ZodBoolean>;
204
208
  reduce: z.ZodOptional<z.ZodBoolean>;
205
209
  group: z.ZodOptional<z.ZodBoolean>;
@@ -211,6 +215,7 @@ export const SimpleViewQuery: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
211
215
  skip?: number | undefined;
212
216
  limit?: number | undefined;
213
217
  key?: any;
218
+ keys?: any[] | undefined;
214
219
  include_docs?: boolean | undefined;
215
220
  reduce?: boolean | undefined;
216
221
  group?: boolean | undefined;
@@ -222,6 +227,7 @@ export const SimpleViewQuery: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
222
227
  skip?: number | undefined;
223
228
  limit?: number | undefined;
224
229
  key?: any;
230
+ keys?: any[] | undefined;
225
231
  include_docs?: boolean | undefined;
226
232
  reduce?: boolean | undefined;
227
233
  group?: boolean | undefined;
@@ -298,6 +304,7 @@ export const SimpleViewQueryBound: z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodO
298
304
  skip: z.ZodOptional<z.ZodNumber>;
299
305
  limit: z.ZodOptional<z.ZodNumber>;
300
306
  key: z.ZodOptional<z.ZodAny>;
307
+ keys: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
301
308
  include_docs: z.ZodOptional<z.ZodBoolean>;
302
309
  reduce: z.ZodOptional<z.ZodBoolean>;
303
310
  group: z.ZodOptional<z.ZodBoolean>;
@@ -309,6 +316,7 @@ export const SimpleViewQueryBound: z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodO
309
316
  skip?: number | undefined;
310
317
  limit?: number | undefined;
311
318
  key?: any;
319
+ keys?: any[] | undefined;
312
320
  include_docs?: boolean | undefined;
313
321
  reduce?: boolean | undefined;
314
322
  group?: boolean | undefined;
@@ -320,6 +328,7 @@ export const SimpleViewQueryBound: z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodO
320
328
  skip?: number | undefined;
321
329
  limit?: number | undefined;
322
330
  key?: any;
331
+ keys?: any[] | undefined;
323
332
  include_docs?: boolean | undefined;
324
333
  reduce?: boolean | undefined;
325
334
  group?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.mts","sourceRoot":"","sources":["query.mjs"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAME;AACF,yDAAyD;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAGgB;AAChB,yFAAyF;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWuC;AACvC,6EAA6E;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAI6C;AAC7C,yEAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAG6C;4BAhC9B,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC;4CAMvB,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC;sCAcvC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC;oCAOjC,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC;yCAM/B,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC;kBA3CjC,KAAK"}
1
+ {"version":3,"file":"query.d.mts","sourceRoot":"","sources":["query.mjs"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAME;AACF,yDAAyD;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAGgB;AAChB,yFAAyF;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAYuC;AACvC,6EAA6E;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAI6C;AAC7C,yEAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAG6C;4BAjC9B,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC;4CAMvB,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC;sCAevC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC;oCAOjC,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC;yCAM/B,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC;kBA5CjC,KAAK"}
package/schema/query.mjs CHANGED
@@ -23,6 +23,7 @@ export const SimpleViewOptions = z.object({
23
23
  skip: z.number().positive().optional().describe('skip this many rows'),
24
24
  limit: z.number().positive().optional().describe('limit the results to this many rows'),
25
25
  key: z.any().optional(),
26
+ keys: z.array(z.any()).optional(),
26
27
  include_docs: z.boolean().optional().describe('join the id to the doc and return it'),
27
28
  reduce: z.boolean().optional().describe('reduce the results'),
28
29
  group: z.boolean().optional().describe('group the results'),
@@ -100,6 +100,7 @@ export const SimpleViewQueryStream: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
100
100
  skip: z.ZodOptional<z.ZodNumber>;
101
101
  limit: z.ZodOptional<z.ZodNumber>;
102
102
  key: z.ZodOptional<z.ZodAny>;
103
+ keys: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
103
104
  include_docs: z.ZodOptional<z.ZodBoolean>;
104
105
  reduce: z.ZodOptional<z.ZodBoolean>;
105
106
  group: z.ZodOptional<z.ZodBoolean>;
@@ -111,6 +112,7 @@ export const SimpleViewQueryStream: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
111
112
  skip?: number | undefined;
112
113
  limit?: number | undefined;
113
114
  key?: any;
115
+ keys?: any[] | undefined;
114
116
  include_docs?: boolean | undefined;
115
117
  reduce?: boolean | undefined;
116
118
  group?: boolean | undefined;
@@ -122,6 +124,7 @@ export const SimpleViewQueryStream: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
122
124
  skip?: number | undefined;
123
125
  limit?: number | undefined;
124
126
  key?: any;
127
+ keys?: any[] | undefined;
125
128
  include_docs?: boolean | undefined;
126
129
  reduce?: boolean | undefined;
127
130
  group?: boolean | undefined;
@@ -153,6 +156,7 @@ export const SimpleViewQueryStreamBound: z.ZodFunction<z.ZodTuple<[z.ZodString,
153
156
  skip: z.ZodOptional<z.ZodNumber>;
154
157
  limit: z.ZodOptional<z.ZodNumber>;
155
158
  key: z.ZodOptional<z.ZodAny>;
159
+ keys: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
156
160
  include_docs: z.ZodOptional<z.ZodBoolean>;
157
161
  reduce: z.ZodOptional<z.ZodBoolean>;
158
162
  group: z.ZodOptional<z.ZodBoolean>;
@@ -164,6 +168,7 @@ export const SimpleViewQueryStreamBound: z.ZodFunction<z.ZodTuple<[z.ZodString,
164
168
  skip?: number | undefined;
165
169
  limit?: number | undefined;
166
170
  key?: any;
171
+ keys?: any[] | undefined;
167
172
  include_docs?: boolean | undefined;
168
173
  reduce?: boolean | undefined;
169
174
  group?: boolean | undefined;
@@ -175,6 +180,7 @@ export const SimpleViewQueryStreamBound: z.ZodFunction<z.ZodTuple<[z.ZodString,
175
180
  skip?: number | undefined;
176
181
  limit?: number | undefined;
177
182
  key?: any;
183
+ keys?: any[] | undefined;
178
184
  include_docs?: boolean | undefined;
179
185
  reduce?: boolean | undefined;
180
186
  group?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.mts","sourceRoot":"","sources":["stream.mjs"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;kCAEC;AACD,qDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFAKmC;AACnC,qFAAqF;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFAImC;0BAdpB,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC;0CAQrB,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC;+CAOrC,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC;kBAtBvC,KAAK"}
1
+ {"version":3,"file":"stream.d.mts","sourceRoot":"","sources":["stream.mjs"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;kCAEC;AACD,qDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFAKmC;AACnC,qFAAqF;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFAImC;0BAdpB,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC;0CAQrB,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC;+CAOrC,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC;kBAtBvC,KAAK"}