hide-a-bed 5.0.2 → 5.0.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.
Files changed (80) hide show
  1. package/cjs/impl/bulk.cjs +267 -0
  2. package/cjs/impl/changes.cjs +67 -0
  3. package/cjs/impl/crud.cjs +121 -0
  4. package/cjs/impl/errors.cjs +75 -0
  5. package/cjs/impl/logger.cjs +70 -0
  6. package/cjs/impl/patch.cjs +95 -0
  7. package/cjs/impl/query.cjs +116 -0
  8. package/cjs/impl/queryBuilder.cjs +99 -0
  9. package/cjs/impl/retry.cjs +54 -0
  10. package/cjs/impl/stream.cjs +121 -0
  11. package/cjs/impl/sugar/lock.cjs +81 -0
  12. package/cjs/impl/sugar/watch.cjs +159 -0
  13. package/cjs/impl/trackedEmitter.cjs +54 -0
  14. package/cjs/impl/transactionErrors.cjs +70 -0
  15. package/cjs/index.cjs +115 -0
  16. package/cjs/integration/changes.cjs +76 -0
  17. package/cjs/integration/disconnect-watch.cjs +52 -0
  18. package/cjs/integration/watch.cjs +59 -0
  19. package/cjs/schema/bind.cjs +51 -0
  20. package/cjs/schema/bulk.cjs +88 -0
  21. package/cjs/schema/changes.cjs +68 -0
  22. package/cjs/schema/config.cjs +48 -0
  23. package/cjs/schema/crud.cjs +77 -0
  24. package/cjs/schema/patch.cjs +53 -0
  25. package/cjs/schema/query.cjs +62 -0
  26. package/cjs/schema/stream.cjs +42 -0
  27. package/cjs/schema/sugar/lock.cjs +59 -0
  28. package/cjs/schema/sugar/watch.cjs +42 -0
  29. package/impl/bulk.d.mts +11 -0
  30. package/impl/bulk.d.mts.map +1 -0
  31. package/impl/changes.d.mts +12 -0
  32. package/impl/changes.d.mts.map +1 -0
  33. package/impl/crud.d.mts +7 -0
  34. package/impl/crud.d.mts.map +1 -0
  35. package/impl/errors.d.mts +43 -0
  36. package/impl/errors.d.mts.map +1 -0
  37. package/impl/logger.d.mts +32 -0
  38. package/impl/logger.d.mts.map +1 -0
  39. package/impl/patch.d.mts +6 -0
  40. package/impl/patch.d.mts.map +1 -0
  41. package/impl/query.d.mts +195 -0
  42. package/impl/query.d.mts.map +1 -0
  43. package/impl/queryBuilder.d.mts +94 -0
  44. package/impl/queryBuilder.d.mts.map +1 -0
  45. package/impl/retry.d.mts +2 -0
  46. package/impl/retry.d.mts.map +1 -0
  47. package/impl/stream.d.mts +3 -0
  48. package/impl/stream.d.mts.map +1 -0
  49. package/impl/sugar/lock.d.mts +5 -0
  50. package/impl/sugar/lock.d.mts.map +1 -0
  51. package/impl/sugar/watch.d.mts +34 -0
  52. package/impl/sugar/watch.d.mts.map +1 -0
  53. package/impl/trackedEmitter.d.mts +8 -0
  54. package/impl/trackedEmitter.d.mts.map +1 -0
  55. package/impl/transactionErrors.d.mts +57 -0
  56. package/impl/transactionErrors.d.mts.map +1 -0
  57. package/index.d.mts +74 -0
  58. package/index.d.mts.map +1 -0
  59. package/package.json +1 -1
  60. package/schema/bind.d.mts +922 -0
  61. package/schema/bind.d.mts.map +1 -0
  62. package/schema/bulk.d.mts +910 -0
  63. package/schema/bulk.d.mts.map +1 -0
  64. package/schema/changes.d.mts +191 -0
  65. package/schema/changes.d.mts.map +1 -0
  66. package/schema/config.d.mts +79 -0
  67. package/schema/config.d.mts.map +1 -0
  68. package/schema/crud.d.mts +491 -0
  69. package/schema/crud.d.mts.map +1 -0
  70. package/schema/patch.d.mts +255 -0
  71. package/schema/patch.d.mts.map +1 -0
  72. package/schema/query.d.mts +406 -0
  73. package/schema/query.d.mts.map +1 -0
  74. package/schema/stream.d.mts +211 -0
  75. package/schema/stream.d.mts.map +1 -0
  76. package/schema/sugar/lock.d.mts +238 -0
  77. package/schema/sugar/lock.d.mts.map +1 -0
  78. package/schema/sugar/watch.d.mts +127 -0
  79. package/schema/sugar/watch.d.mts.map +1 -0
  80. package/log.txt +0 -84
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @typedef {Object} Logger
3
+ * @property {(...args: any[]) => void} error - Log error messages
4
+ * @property {(...args: any[]) => void} warn - Log warning messages
5
+ * @property {(...args: any[]) => void} info - Log info messages
6
+ * @property {(...args: any[]) => void} debug - Log debug messages
7
+ */
8
+ /**
9
+ * Creates a unified logger interface that works with both function and object-style loggers
10
+ * @param {import('../schema/config.mjs').CouchConfigSchema} config
11
+ * @returns {Logger} Normalized logger interface
12
+ */
13
+ export function createLogger(config: import("../schema/config.mjs").CouchConfigSchema): Logger;
14
+ export type Logger = {
15
+ /**
16
+ * - Log error messages
17
+ */
18
+ error: (...args: any[]) => void;
19
+ /**
20
+ * - Log warning messages
21
+ */
22
+ warn: (...args: any[]) => void;
23
+ /**
24
+ * - Log info messages
25
+ */
26
+ info: (...args: any[]) => void;
27
+ /**
28
+ * - Log debug messages
29
+ */
30
+ debug: (...args: any[]) => void;
31
+ };
32
+ //# sourceMappingURL=logger.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.mts","sourceRoot":"","sources":["logger.mjs"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,qCAHW,OAAO,sBAAsB,EAAE,iBAAiB,GAC9C,MAAM,CA+ClB;;;;;WAxDa,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI;;;;UACxB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI;;;;UACxB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI;;;;WACxB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI"}
@@ -0,0 +1,6 @@
1
+ export function sleep(ms: any): Promise<any>;
2
+ /** @type { import('../schema/patch.mjs').PatchSchema } */
3
+ export const patch: import("../schema/patch.mjs").PatchSchema;
4
+ /** @type { import('../schema/patch.mjs').PatchDangerouslySchema } */
5
+ export const patchDangerously: import("../schema/patch.mjs").PatchDangerouslySchema;
6
+ //# sourceMappingURL=patch.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch.d.mts","sourceRoot":"","sources":["patch.mjs"],"names":[],"mappings":"AAIO,6CAAmE;AAE1E,0DAA0D;AAC1D,oBADY,OAAO,qBAAqB,EAAE,WAAW,CAmBnD;AAEF,qEAAqE;AACrE,+BADY,OAAO,qBAAqB,EAAE,sBAAsB,CA4D9D"}
@@ -0,0 +1,195 @@
1
+ /**
2
+ * @param {{ [key: string]: any }} options - The options object containing query parameters.
3
+ * @param {string[]} params - The list of parameter names to include in the query string.
4
+ */
5
+ /**
6
+ * @param {{ [key: string]: any }} options
7
+ * @param {string[]} params
8
+ * @returns {string}
9
+ */
10
+ export function queryString(options: {
11
+ [key: string]: any;
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
+ */
19
+ export const query: z.infer<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
20
+ throwOnGetNotFound: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
21
+ couch: z.ZodString;
22
+ bindWithRetry: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
23
+ maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
24
+ initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
25
+ backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
26
+ useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
27
+ logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
28
+ error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
29
+ warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
30
+ info: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
31
+ debug: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ error?: ((args_0: any, ...args: unknown[]) => void) | undefined;
34
+ warn?: ((args_0: any, ...args: unknown[]) => void) | undefined;
35
+ info?: ((args_0: any, ...args: unknown[]) => void) | undefined;
36
+ debug?: ((args_0: any, ...args: unknown[]) => void) | undefined;
37
+ }, {
38
+ error?: ((args_0: any, ...args: unknown[]) => void) | undefined;
39
+ warn?: ((args_0: any, ...args: unknown[]) => void) | undefined;
40
+ info?: ((args_0: any, ...args: unknown[]) => void) | undefined;
41
+ debug?: ((args_0: any, ...args: unknown[]) => void) | undefined;
42
+ }>, z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodAny], z.ZodUnknown>, z.ZodVoid>]>>;
43
+ _normalizedLogger: z.ZodOptional<z.ZodAny>;
44
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
45
+ throwOnGetNotFound: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
46
+ couch: z.ZodString;
47
+ bindWithRetry: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
48
+ maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
49
+ initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
50
+ backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
51
+ useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
52
+ logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
53
+ error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
54
+ warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
55
+ info: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
56
+ debug: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ error?: ((args_0: any, ...args: unknown[]) => void) | undefined;
59
+ warn?: ((args_0: any, ...args: unknown[]) => void) | undefined;
60
+ info?: ((args_0: any, ...args: unknown[]) => void) | undefined;
61
+ debug?: ((args_0: any, ...args: unknown[]) => void) | undefined;
62
+ }, {
63
+ error?: ((args_0: any, ...args: unknown[]) => void) | undefined;
64
+ warn?: ((args_0: any, ...args: unknown[]) => void) | undefined;
65
+ info?: ((args_0: any, ...args: unknown[]) => void) | undefined;
66
+ debug?: ((args_0: any, ...args: unknown[]) => void) | undefined;
67
+ }>, z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodAny], z.ZodUnknown>, z.ZodVoid>]>>;
68
+ _normalizedLogger: z.ZodOptional<z.ZodAny>;
69
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
70
+ throwOnGetNotFound: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
71
+ couch: z.ZodString;
72
+ bindWithRetry: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
73
+ maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
74
+ initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
75
+ backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
76
+ useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
77
+ logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
78
+ error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
79
+ warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
80
+ info: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
81
+ debug: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
82
+ }, "strip", z.ZodTypeAny, {
83
+ error?: ((args_0: any, ...args: unknown[]) => void) | undefined;
84
+ warn?: ((args_0: any, ...args: unknown[]) => void) | undefined;
85
+ info?: ((args_0: any, ...args: unknown[]) => void) | undefined;
86
+ debug?: ((args_0: any, ...args: unknown[]) => void) | undefined;
87
+ }, {
88
+ error?: ((args_0: any, ...args: unknown[]) => void) | undefined;
89
+ warn?: ((args_0: any, ...args: unknown[]) => void) | undefined;
90
+ info?: ((args_0: any, ...args: unknown[]) => void) | undefined;
91
+ debug?: ((args_0: any, ...args: unknown[]) => void) | undefined;
92
+ }>, z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodAny], z.ZodUnknown>, z.ZodVoid>]>>;
93
+ _normalizedLogger: z.ZodOptional<z.ZodAny>;
94
+ }, z.ZodTypeAny, "passthrough">>, z.ZodString, z.ZodOptional<z.ZodObject<{
95
+ startkey: z.ZodOptional<z.ZodAny>;
96
+ endkey: z.ZodOptional<z.ZodAny>;
97
+ descending: z.ZodOptional<z.ZodBoolean>;
98
+ skip: z.ZodOptional<z.ZodNumber>;
99
+ limit: z.ZodOptional<z.ZodNumber>;
100
+ key: z.ZodOptional<z.ZodAny>;
101
+ keys: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
102
+ include_docs: z.ZodOptional<z.ZodBoolean>;
103
+ reduce: z.ZodOptional<z.ZodBoolean>;
104
+ group: z.ZodOptional<z.ZodBoolean>;
105
+ group_level: z.ZodOptional<z.ZodNumber>;
106
+ }, "strip", z.ZodTypeAny, {
107
+ startkey?: any;
108
+ endkey?: any;
109
+ descending?: boolean | undefined;
110
+ skip?: number | undefined;
111
+ limit?: number | undefined;
112
+ key?: any;
113
+ keys?: any[] | undefined;
114
+ include_docs?: boolean | undefined;
115
+ reduce?: boolean | undefined;
116
+ group?: boolean | undefined;
117
+ group_level?: number | undefined;
118
+ }, {
119
+ startkey?: any;
120
+ endkey?: any;
121
+ descending?: boolean | undefined;
122
+ skip?: number | undefined;
123
+ limit?: number | undefined;
124
+ key?: any;
125
+ keys?: any[] | undefined;
126
+ include_docs?: boolean | undefined;
127
+ reduce?: boolean | undefined;
128
+ group?: boolean | undefined;
129
+ group_level?: number | undefined;
130
+ }>>], z.ZodUnknown>, z.ZodPromise<z.ZodObject<{
131
+ error: z.ZodOptional<z.ZodString>;
132
+ rows: z.ZodArray<z.ZodObject<{
133
+ id: z.ZodOptional<z.ZodString>;
134
+ key: z.ZodNullable<z.ZodAny>;
135
+ value: z.ZodNullable<z.ZodAny>;
136
+ doc: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>>>;
137
+ error: z.ZodOptional<z.ZodString>;
138
+ }, "strip", z.ZodTypeAny, {
139
+ id?: string | undefined;
140
+ key?: any;
141
+ value?: any;
142
+ doc?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
143
+ error?: string | undefined;
144
+ }, {
145
+ id?: string | undefined;
146
+ key?: any;
147
+ value?: any;
148
+ doc?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
149
+ error?: string | undefined;
150
+ }>, "many">;
151
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
152
+ error: z.ZodOptional<z.ZodString>;
153
+ rows: z.ZodArray<z.ZodObject<{
154
+ id: z.ZodOptional<z.ZodString>;
155
+ key: z.ZodNullable<z.ZodAny>;
156
+ value: z.ZodNullable<z.ZodAny>;
157
+ doc: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>>>;
158
+ error: z.ZodOptional<z.ZodString>;
159
+ }, "strip", z.ZodTypeAny, {
160
+ id?: string | undefined;
161
+ key?: any;
162
+ value?: any;
163
+ doc?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
164
+ error?: string | undefined;
165
+ }, {
166
+ id?: string | undefined;
167
+ key?: any;
168
+ value?: any;
169
+ doc?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
170
+ error?: string | undefined;
171
+ }>, "many">;
172
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
173
+ error: z.ZodOptional<z.ZodString>;
174
+ rows: z.ZodArray<z.ZodObject<{
175
+ id: z.ZodOptional<z.ZodString>;
176
+ key: z.ZodNullable<z.ZodAny>;
177
+ value: z.ZodNullable<z.ZodAny>;
178
+ doc: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>>>;
179
+ error: z.ZodOptional<z.ZodString>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ id?: string | undefined;
182
+ key?: any;
183
+ value?: any;
184
+ doc?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
185
+ error?: string | undefined;
186
+ }, {
187
+ id?: string | undefined;
188
+ key?: any;
189
+ value?: any;
190
+ doc?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
191
+ error?: string | undefined;
192
+ }>, "many">;
193
+ }, z.ZodTypeAny, "passthrough">>>>>;
194
+ import { z } from 'zod';
195
+ //# sourceMappingURL=query.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.mts","sourceRoot":"","sources":["query.mjs"],"names":[],"mappings":"AA8FA;;;GAGG;AACH;;;;GAIG;AACH,qCAJW;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,sBACtB,MAAM,EAAE,GACN,MAAM,CAoBlB;AA9GD;;;;;GAKG;AACH,oBALW,CAAC,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAAiB,CAgFjC;kBA1FgB,KAAK"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @typedef {Object} QueryOptions
3
+ * @property {any} [key] - Exact key to match
4
+ * @property {any} [startkey] - Start of key range
5
+ * @property {any} [endkey] - End of key range
6
+ * @property {boolean} [reduce] - Whether to use reduce function
7
+ * @property {boolean} [group] - Whether to group results
8
+ * @property {number} [group_level] - Level at which to group
9
+ * @property {string} [stale] - Stale parameter value
10
+ * @property {number} [limit] - Max number of results
11
+ */
12
+ export class QueryBuilder {
13
+ /**
14
+ * @param {any} key
15
+ * @returns {QueryBuilder}
16
+ */
17
+ key(key: any): QueryBuilder;
18
+ /**
19
+ * @param {any} startkey
20
+ * @returns {QueryBuilder}
21
+ */
22
+ startKey(startkey: any): QueryBuilder;
23
+ /**
24
+ * @param {any} endkey
25
+ * @returns {QueryBuilder}
26
+ */
27
+ endKey(endkey: any): QueryBuilder;
28
+ /**
29
+ * @param {boolean} reduce
30
+ * @returns {QueryBuilder}
31
+ */
32
+ reduce(reduce?: boolean): QueryBuilder;
33
+ /**
34
+ * @param {boolean} group
35
+ * @returns {QueryBuilder}
36
+ */
37
+ group(group?: boolean): QueryBuilder;
38
+ /**
39
+ * @param {number} level
40
+ * @returns {QueryBuilder}
41
+ */
42
+ groupLevel(level: number): QueryBuilder;
43
+ /**
44
+ * @param {string} stale
45
+ * @returns {QueryBuilder}
46
+ */
47
+ stale(stale: string): QueryBuilder;
48
+ /**
49
+ * @param {number} limit
50
+ * @returns {QueryBuilder}
51
+ */
52
+ limit(limit: number): QueryBuilder;
53
+ /**
54
+ * @returns {QueryOptions}
55
+ */
56
+ build(): QueryOptions;
57
+ #private;
58
+ }
59
+ export function createQuery(): QueryBuilder;
60
+ export type QueryOptions = {
61
+ /**
62
+ * - Exact key to match
63
+ */
64
+ key?: any;
65
+ /**
66
+ * - Start of key range
67
+ */
68
+ startkey?: any;
69
+ /**
70
+ * - End of key range
71
+ */
72
+ endkey?: any;
73
+ /**
74
+ * - Whether to use reduce function
75
+ */
76
+ reduce?: boolean | undefined;
77
+ /**
78
+ * - Whether to group results
79
+ */
80
+ group?: boolean | undefined;
81
+ /**
82
+ * - Level at which to group
83
+ */
84
+ group_level?: number | undefined;
85
+ /**
86
+ * - Stale parameter value
87
+ */
88
+ stale?: string | undefined;
89
+ /**
90
+ * - Max number of results
91
+ */
92
+ limit?: number | undefined;
93
+ };
94
+ //# sourceMappingURL=queryBuilder.d.mts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export function withRetry(fn: any, options?: {}): (...args: any[]) => Promise<any>;
2
+ //# sourceMappingURL=retry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.mts","sourceRoot":"","sources":["retry.mjs"],"names":[],"mappings":"AAGA,mFAmCC"}
@@ -0,0 +1,3 @@
1
+ /** @type { import('../schema/stream.mjs').SimpleViewQueryStreamSchema } queryStream */
2
+ export const queryStream: import("../schema/stream.mjs").SimpleViewQueryStreamSchema;
3
+ //# sourceMappingURL=stream.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.d.mts","sourceRoot":"","sources":["stream.mjs"],"names":[],"mappings":"AASA,uFAAuF;AACvF,0BADY,OAAO,sBAAsB,EAAE,2BAA2B,CAwFpE"}
@@ -0,0 +1,5 @@
1
+ /** @type {import('../../schema/sugar/lock.mjs').CreateLockSchema} */
2
+ export const createLock: import("../../schema/sugar/lock.mjs").CreateLockSchema;
3
+ /** @type {import('../../schema/sugar/lock.mjs').RemoveLockSchema} */
4
+ export const removeLock: import("../../schema/sugar/lock.mjs").RemoveLockSchema;
5
+ //# sourceMappingURL=lock.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock.d.mts","sourceRoot":"","sources":["lock.mjs"],"names":[],"mappings":"AAIA,qEAAqE;AACrE,yBADW,OAAO,6BAA6B,EAAE,gBAAgB,CA8B/D;AAEF,qEAAqE;AACrE,yBADW,OAAO,6BAA6B,EAAE,gBAAgB,CAiC/D"}
@@ -0,0 +1,34 @@
1
+ export const watchDocs: (args_0: import("zod").objectInputType<{
2
+ throwOnGetNotFound: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
3
+ couch: import("zod").ZodString;
4
+ bindWithRetry: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
5
+ maxRetries: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
6
+ initialDelay: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
7
+ backoffFactor: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
8
+ useConsoleLogger: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
9
+ logger: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodObject<{
10
+ error: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<[import("zod").ZodAny], import("zod").ZodUnknown>, import("zod").ZodVoid>>;
11
+ warn: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<[import("zod").ZodAny], import("zod").ZodUnknown>, import("zod").ZodVoid>>;
12
+ info: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<[import("zod").ZodAny], import("zod").ZodUnknown>, import("zod").ZodVoid>>;
13
+ debug: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<[import("zod").ZodAny], import("zod").ZodUnknown>, import("zod").ZodVoid>>;
14
+ }, "strip", import("zod").ZodTypeAny, {
15
+ error?: ((args_0: any, ...args: unknown[]) => void) | undefined;
16
+ warn?: ((args_0: any, ...args: unknown[]) => void) | undefined;
17
+ info?: ((args_0: any, ...args: unknown[]) => void) | undefined;
18
+ debug?: ((args_0: any, ...args: unknown[]) => void) | undefined;
19
+ }, {
20
+ error?: ((args_0: any, ...args: unknown[]) => void) | undefined;
21
+ warn?: ((args_0: any, ...args: unknown[]) => void) | undefined;
22
+ info?: ((args_0: any, ...args: unknown[]) => void) | undefined;
23
+ debug?: ((args_0: any, ...args: unknown[]) => void) | undefined;
24
+ }>, import("zod").ZodFunction<import("zod").ZodTuple<[import("zod").ZodString, import("zod").ZodAny], import("zod").ZodUnknown>, import("zod").ZodVoid>]>>;
25
+ _normalizedLogger: import("zod").ZodOptional<import("zod").ZodAny>;
26
+ }, import("zod").ZodTypeAny, "passthrough">, args_1: string | string[], args_2: (args_0: any, ...args: unknown[]) => void, args_3: {
27
+ include_docs?: boolean | undefined;
28
+ }, ...args: unknown[]) => {
29
+ on: (event: string, listener: (args_0: any, ...args: unknown[]) => void) => EventEmitter<[never]>;
30
+ removeListener: (event: string, listener: (args_0: any, ...args: unknown[]) => void) => EventEmitter<[never]>;
31
+ stop: () => void;
32
+ };
33
+ import { EventEmitter } from 'events';
34
+ //# sourceMappingURL=watch.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.d.mts","sourceRoot":"","sources":["watch.mjs"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiJE;6BAxJ2B,QAAQ"}
@@ -0,0 +1,8 @@
1
+ export class TrackedEmitter extends EventEmitter<[never]> {
2
+ constructor(options: any);
3
+ delay: any;
4
+ emit(event: any, ...args: any[]): Promise<any>;
5
+ }
6
+ export function setupEmitter(config: any): any;
7
+ import { EventEmitter } from 'events';
8
+ //# sourceMappingURL=trackedEmitter.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trackedEmitter.d.mts","sourceRoot":"","sources":["trackedEmitter.mjs"],"names":[],"mappings":"AAEA;IAEE,0BAGC;IADoB,WAA0B;IAG/C,+CAiBC;CACF;AAEM,+CAGN;6BAhC4B,QAAQ"}
@@ -0,0 +1,57 @@
1
+ export class TransactionSetupError extends Error {
2
+ /**
3
+ * @param {string} message
4
+ * @param {Record<string, any>} details
5
+ */
6
+ constructor(message: string, details?: Record<string, any>);
7
+ details: Record<string, any>;
8
+ }
9
+ export class TransactionVersionConflictError extends Error {
10
+ /**
11
+ * @param {string[]} conflictingIds
12
+ */
13
+ constructor(conflictingIds: string[]);
14
+ conflictingIds: string[];
15
+ }
16
+ export class TransactionBulkOperationError extends Error {
17
+ /**
18
+ * @param {Array<{ok?: boolean|null, id?: string|null, rev?: string|null, error?: string|null, reason?: string|null}>} failedDocs
19
+ */
20
+ constructor(failedDocs: Array<{
21
+ ok?: boolean | null;
22
+ id?: string | null;
23
+ rev?: string | null;
24
+ error?: string | null;
25
+ reason?: string | null;
26
+ }>);
27
+ failedDocs: {
28
+ ok?: boolean | null;
29
+ id?: string | null;
30
+ rev?: string | null;
31
+ error?: string | null;
32
+ reason?: string | null;
33
+ }[];
34
+ }
35
+ export class TransactionRollbackError extends Error {
36
+ /**
37
+ * @param {string} message
38
+ * @param {Error} originalError
39
+ * @param {Array<{ok?: boolean|null, id?: string|null, rev?: string|null, error?: string|null, reason?: string|null}>} rollbackResults
40
+ */
41
+ constructor(message: string, originalError: Error, rollbackResults: Array<{
42
+ ok?: boolean | null;
43
+ id?: string | null;
44
+ rev?: string | null;
45
+ error?: string | null;
46
+ reason?: string | null;
47
+ }>);
48
+ originalError: Error;
49
+ rollbackResults: {
50
+ ok?: boolean | null;
51
+ id?: string | null;
52
+ rev?: string | null;
53
+ error?: string | null;
54
+ reason?: string | null;
55
+ }[];
56
+ }
57
+ //# sourceMappingURL=transactionErrors.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionErrors.d.mts","sourceRoot":"","sources":["transactionErrors.mjs"],"names":[],"mappings":"AAAA;IACE;;;OAGG;IACH,qBAHW,MAAM,YACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAM7B;IADC,6BAAsB;CAEzB;AAED;IACE;;OAEG;IACH,4BAFW,MAAM,EAAE,EAMlB;IADC,yBAAoC;CAEvC;AAED;IACE;;OAEG;IACH,wBAFW,KAAK,CAAC;QAAC,EAAE,CAAC,EAAE,OAAO,GAAC,IAAI,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAC,IAAI,CAAA;KAAC,CAAC,EAMpH;IADC;aALqB,OAAO,GAAC,IAAI;aAAO,MAAM,GAAC,IAAI;cAAQ,MAAM,GAAC,IAAI;gBAAU,MAAM,GAAC,IAAI;iBAAW,MAAM,GAAC,IAAI;QAKrF;CAE/B;AAED;IACE;;;;OAIG;IACH,qBAJW,MAAM,iBACN,KAAK,mBACL,KAAK,CAAC;QAAC,EAAE,CAAC,EAAE,OAAO,GAAC,IAAI,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAC,IAAI,CAAA;KAAC,CAAC,EAOpH;IAFC,qBAAkC;IAClC;aANqB,OAAO,GAAC,IAAI;aAAO,MAAM,GAAC,IAAI;cAAQ,MAAM,GAAC,IAAI;gBAAU,MAAM,GAAC,IAAI;iBAAW,MAAM,GAAC,IAAI;QAM3E;CAEzC"}
package/index.d.mts ADDED
@@ -0,0 +1,74 @@
1
+ import { get } from './impl/crud.mjs';
2
+ import { getAtRev } from './impl/crud.mjs';
3
+ import { put } from './impl/crud.mjs';
4
+ import { bulkGet } from './impl/bulk.mjs';
5
+ import { bulkSave } from './impl/bulk.mjs';
6
+ import { query } from './impl/query.mjs';
7
+ import { queryStream } from './impl/stream.mjs';
8
+ export namespace schema {
9
+ export { CouchConfig };
10
+ export { SimpleViewQuery };
11
+ export { SimpleViewQueryResponse };
12
+ export { SimpleViewQueryStream };
13
+ export { OnRow };
14
+ export { BulkSave };
15
+ export { BulkGet };
16
+ export { BulkRemove };
17
+ export { BulkGetDictionary };
18
+ export { BulkSaveTransaction };
19
+ export { CouchGet };
20
+ export { CouchPut };
21
+ export { CouchDoc };
22
+ export { CouchDocResponse };
23
+ export { Patch };
24
+ export { PatchDangerously };
25
+ export { CouchGetAtRev };
26
+ export { Bind };
27
+ export { Lock };
28
+ export { WatchDocs };
29
+ export { LockOptions };
30
+ export { CreateLock };
31
+ export { RemoveLock };
32
+ export { Changes };
33
+ export { ChangesOptions };
34
+ export { ChangesResponse };
35
+ }
36
+ import { patch } from './impl/patch.mjs';
37
+ import { patchDangerously } from './impl/patch.mjs';
38
+ import { bulkRemove } from './impl/bulk.mjs';
39
+ import { bulkGetDictionary } from './impl/bulk.mjs';
40
+ import { bulkSaveTransaction } from './impl/bulk.mjs';
41
+ /** @type { import('./schema/bind.mjs').BindSchema } */
42
+ export const bindConfig: import("./schema/bind.mjs").BindSchema;
43
+ import { withRetry } from './impl/retry.mjs';
44
+ import { createQuery } from './impl/queryBuilder.mjs';
45
+ import { createLock } from './impl/sugar/lock.mjs';
46
+ import { removeLock } from './impl/sugar/lock.mjs';
47
+ import { CouchConfig } from './schema/config.mjs';
48
+ import { SimpleViewQuery } from './schema/query.mjs';
49
+ import { SimpleViewQueryResponse } from './schema/query.mjs';
50
+ import { SimpleViewQueryStream } from './schema/stream.mjs';
51
+ import { OnRow } from './schema/stream.mjs';
52
+ import { BulkSave } from './schema/bulk.mjs';
53
+ import { BulkGet } from './schema/bulk.mjs';
54
+ import { BulkRemove } from './schema/bulk.mjs';
55
+ import { BulkGetDictionary } from './schema/bulk.mjs';
56
+ import { BulkSaveTransaction } from './schema/bulk.mjs';
57
+ import { CouchGet } from './schema/crud.mjs';
58
+ import { CouchPut } from './schema/crud.mjs';
59
+ import { CouchDoc } from './schema/crud.mjs';
60
+ import { CouchDocResponse } from './schema/crud.mjs';
61
+ import { Patch } from './schema/patch.mjs';
62
+ import { PatchDangerously } from './schema/patch.mjs';
63
+ import { CouchGetAtRev } from './schema/crud.mjs';
64
+ import { Bind } from './schema/bind.mjs';
65
+ import { Lock } from './schema/sugar/lock.mjs';
66
+ import { WatchDocs } from './schema/sugar/watch.mjs';
67
+ import { LockOptions } from './schema/sugar/lock.mjs';
68
+ import { CreateLock } from './schema/sugar/lock.mjs';
69
+ import { RemoveLock } from './schema/sugar/lock.mjs';
70
+ import { Changes } from './schema/changes.mjs';
71
+ import { ChangesOptions } from './schema/changes.mjs';
72
+ import { ChangesResponse } from './schema/changes.mjs';
73
+ export { get, getAtRev, put, bulkGet, bulkSave, query, queryStream, patch, patchDangerously, bulkRemove, bulkGetDictionary, bulkSaveTransaction, withRetry, createQuery, createLock, removeLock };
74
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +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;AAkDvG,uDAAuD;AACvD,yBADY,OAAO,mBAAmB,EAAE,UAAU,CA+BhD;0BAxEwB,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hide-a-bed",
3
- "version": "5.0.2",
3
+ "version": "5.0.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",