hide-a-bed 4.0.0 → 4.0.2
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/cjs/impl/bulk.cjs +1 -8
- package/cjs/impl/logger.cjs +19 -10
- package/cjs/impl/patch.cjs +21 -2
- package/cjs/impl/query.cjs +18 -2
- package/cjs/impl/stream.cjs +10 -2
- package/cjs/index.cjs +1 -0
- package/cjs/schema/config.cjs +1 -0
- package/cjs/schema/stream.cjs +1 -1
- package/impl/bulk.d.mts.map +1 -1
- package/impl/bulk.mjs +4 -12
- package/impl/crud.mjs +7 -7
- package/impl/errors.mjs +11 -11
- package/impl/logger.d.mts.map +1 -1
- package/impl/logger.mjs +1 -1
- package/impl/patch.d.mts.map +1 -1
- package/impl/patch.mjs +6 -7
- package/impl/query.d.mts +3 -0
- package/impl/query.d.mts.map +1 -1
- package/impl/query.mjs +1 -5
- package/impl/retry.mjs +3 -3
- package/impl/stream.d.mts +1 -1
- package/impl/stream.d.mts.map +1 -1
- package/impl/stream.mjs +9 -25
- package/index.d.mts +2 -0
- package/index.d.mts.map +1 -1
- package/index.mjs +3 -2
- package/package.json +1 -1
- package/schema/bind.d.mts +6 -3
- package/schema/bind.d.mts.map +1 -1
- package/schema/bulk.d.mts +9 -0
- package/schema/bulk.d.mts.map +1 -1
- package/schema/config.d.mts +3 -0
- package/schema/config.d.mts.map +1 -1
- package/schema/config.mjs +2 -2
- package/schema/crud.d.mts +6 -0
- package/schema/crud.d.mts.map +1 -1
- package/schema/patch.d.mts +3 -0
- package/schema/patch.d.mts.map +1 -1
- package/schema/query.d.mts +3 -0
- package/schema/query.d.mts.map +1 -1
- package/schema/query.mjs +1 -1
- package/schema/stream.d.mts +6 -3
- package/schema/stream.d.mts.map +1 -1
package/cjs/impl/bulk.cjs
CHANGED
|
@@ -104,14 +104,7 @@ const bulkGet = import_bulk.BulkGet.implement(async (config, ids) => {
|
|
|
104
104
|
throw new Error("could not fetch");
|
|
105
105
|
}
|
|
106
106
|
const rows = resp?.body?.rows || [];
|
|
107
|
-
const docs =
|
|
108
|
-
rows.forEach((r) => {
|
|
109
|
-
if (r.error) return;
|
|
110
|
-
if (!r.key) return;
|
|
111
|
-
if (!r.doc) return;
|
|
112
|
-
const doc = r.doc;
|
|
113
|
-
docs.push(doc);
|
|
114
|
-
});
|
|
107
|
+
const docs = rows.map((r) => r.doc);
|
|
115
108
|
logger.info(`Successfully retrieved ${docs.length} documents`);
|
|
116
109
|
return docs;
|
|
117
110
|
});
|
package/cjs/impl/logger.cjs
CHANGED
|
@@ -26,16 +26,25 @@ function createLogger(config) {
|
|
|
26
26
|
return config._normalizedLogger;
|
|
27
27
|
}
|
|
28
28
|
if (!config.logger) {
|
|
29
|
-
config.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
if (config.useConsoleLogger) {
|
|
30
|
+
config._normalizedLogger = {
|
|
31
|
+
error: (...args) => console.error(...args),
|
|
32
|
+
warn: (...args) => console.warn(...args),
|
|
33
|
+
info: (...args) => console.info(...args),
|
|
34
|
+
debug: (...args) => console.debug(...args)
|
|
35
|
+
};
|
|
36
|
+
} else {
|
|
37
|
+
config._normalizedLogger = {
|
|
38
|
+
error: () => {
|
|
39
|
+
},
|
|
40
|
+
warn: () => {
|
|
41
|
+
},
|
|
42
|
+
info: () => {
|
|
43
|
+
},
|
|
44
|
+
debug: () => {
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
39
48
|
return config._normalizedLogger;
|
|
40
49
|
}
|
|
41
50
|
if (typeof config.logger === "function") {
|
package/cjs/impl/patch.cjs
CHANGED
|
@@ -24,34 +24,53 @@ __export(patch_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(patch_exports);
|
|
25
25
|
var import_crud = require("./crud.cjs");
|
|
26
26
|
var import_patch = require("../schema/patch.cjs");
|
|
27
|
+
var import_logger = require("./logger.cjs");
|
|
27
28
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
28
29
|
const patch = import_patch.Patch.implement(async (config, id, properties) => {
|
|
30
|
+
const logger = (0, import_logger.createLogger)(config);
|
|
29
31
|
const maxRetries = config.maxRetries || 5;
|
|
30
32
|
let delay = config.initialDelay || 1e3;
|
|
31
33
|
let attempts = 0;
|
|
34
|
+
logger.info(`Starting patch operation for document ${id}`);
|
|
35
|
+
logger.debug("Patch properties:", properties);
|
|
32
36
|
while (attempts <= maxRetries) {
|
|
37
|
+
logger.debug(`Attempt ${attempts + 1} of ${maxRetries + 1}`);
|
|
33
38
|
try {
|
|
34
39
|
const doc = await (0, import_crud.get)(config, id);
|
|
35
|
-
if (!doc)
|
|
40
|
+
if (!doc) {
|
|
41
|
+
logger.warn(`Document ${id} not found`);
|
|
42
|
+
return { ok: false, statusCode: 404, error: "not_found" };
|
|
43
|
+
}
|
|
36
44
|
const updatedDoc = { ...doc, ...properties };
|
|
45
|
+
logger.debug("Merged document:", updatedDoc);
|
|
37
46
|
const result = await (0, import_crud.put)(config, updatedDoc);
|
|
38
47
|
if (result.ok) {
|
|
48
|
+
logger.info(`Successfully patched document ${id}, rev: ${result.rev}`);
|
|
39
49
|
return result;
|
|
40
50
|
}
|
|
41
51
|
attempts++;
|
|
42
52
|
if (attempts > maxRetries) {
|
|
53
|
+
logger.error(`Failed to patch ${id} after ${maxRetries} attempts`);
|
|
43
54
|
throw new Error(`Failed to patch after ${maxRetries} attempts`);
|
|
44
55
|
}
|
|
56
|
+
logger.warn(`Conflict detected for ${id}, retrying (attempt ${attempts})`);
|
|
45
57
|
await sleep(delay);
|
|
46
58
|
delay *= config.backoffFactor;
|
|
59
|
+
logger.debug(`Next retry delay: ${delay}ms`);
|
|
47
60
|
} catch (err) {
|
|
48
|
-
if (err.message
|
|
61
|
+
if (err.message === "not_found") {
|
|
62
|
+
logger.warn(`Document ${id} not found during patch operation`);
|
|
63
|
+
return { ok: false, statusCode: 404, error: "not_found" };
|
|
64
|
+
}
|
|
49
65
|
attempts++;
|
|
50
66
|
if (attempts > maxRetries) {
|
|
51
67
|
const error = `Failed to patch after ${maxRetries} attempts: ${err.message}`;
|
|
68
|
+
logger.error(error);
|
|
52
69
|
return { ok: false, statusCode: 500, error };
|
|
53
70
|
}
|
|
71
|
+
logger.warn(`Error during patch attempt ${attempts}: ${err.message}`);
|
|
54
72
|
await sleep(delay);
|
|
73
|
+
logger.debug(`Retrying after ${delay}ms`);
|
|
55
74
|
}
|
|
56
75
|
}
|
|
57
76
|
});
|
package/cjs/impl/query.cjs
CHANGED
|
@@ -36,10 +36,15 @@ var import_zod = require("zod");
|
|
|
36
36
|
var import_needle = __toESM(require("needle"), 1);
|
|
37
37
|
var import_query = require("../schema/query.cjs");
|
|
38
38
|
var import_errors = require("./errors.cjs");
|
|
39
|
+
var import_logger = require("./logger.cjs");
|
|
39
40
|
var import_lodash = __toESM(require("lodash"), 1);
|
|
40
41
|
const { includes } = import_lodash.default;
|
|
41
42
|
const query = import_query.SimpleViewQuery.implement(async (config, view, options) => {
|
|
43
|
+
const logger = (0, import_logger.createLogger)(config);
|
|
44
|
+
logger.info(`Starting view query: ${view}`);
|
|
45
|
+
logger.debug("Query options:", options);
|
|
42
46
|
const qs = queryString(options, ["key", "startkey", "endkey", "reduce", "group", "group_level", "stale", "limit"]);
|
|
47
|
+
logger.debug("Generated query string:", qs);
|
|
43
48
|
const opts = {
|
|
44
49
|
json: true,
|
|
45
50
|
headers: {
|
|
@@ -49,16 +54,27 @@ const query = import_query.SimpleViewQuery.implement(async (config, view, option
|
|
|
49
54
|
const url = `${config.couch}/${view}?${qs.toString()}`;
|
|
50
55
|
let results;
|
|
51
56
|
try {
|
|
57
|
+
logger.debug(`Sending GET request to: ${url}`);
|
|
52
58
|
results = await (0, import_needle.default)("get", url, opts);
|
|
53
59
|
} catch (err) {
|
|
60
|
+
logger.error("Network error during query:", err);
|
|
54
61
|
import_errors.RetryableError.handleNetworkError(err);
|
|
55
62
|
}
|
|
56
|
-
if (!results)
|
|
63
|
+
if (!results) {
|
|
64
|
+
logger.error("No response received from query request");
|
|
65
|
+
throw new import_errors.RetryableError("no response", 503);
|
|
66
|
+
}
|
|
57
67
|
const body = results.body;
|
|
58
68
|
if (import_errors.RetryableError.isRetryableStatusCode(results.statusCode)) {
|
|
69
|
+
logger.warn(`Retryable status code received: ${results.statusCode}`);
|
|
59
70
|
throw new import_errors.RetryableError(body.error || "retryable error during query", results.statusCode);
|
|
60
71
|
}
|
|
61
|
-
if (body.error)
|
|
72
|
+
if (body.error) {
|
|
73
|
+
logger.error(`Query error: ${body.error}`);
|
|
74
|
+
throw new Error(body.error);
|
|
75
|
+
}
|
|
76
|
+
logger.info(`Successfully executed view query: ${view}`);
|
|
77
|
+
logger.debug("Query response:", body);
|
|
62
78
|
return body;
|
|
63
79
|
});
|
|
64
80
|
function queryString(options, params) {
|
package/cjs/impl/stream.cjs
CHANGED
|
@@ -34,6 +34,7 @@ module.exports = __toCommonJS(stream_exports);
|
|
|
34
34
|
var import_needle = __toESM(require("needle"), 1);
|
|
35
35
|
var import_query = require("./query.cjs");
|
|
36
36
|
var import_errors = require("./errors.cjs");
|
|
37
|
+
var import_logger = require("./logger.cjs");
|
|
37
38
|
var import_JSONStream = __toESM(require("JSONStream"), 1);
|
|
38
39
|
const queryStream = (config, view, options, onRow) => new Promise((resolve, reject) => {
|
|
39
40
|
if (!options) options = {};
|
|
@@ -48,7 +49,15 @@ const queryStream = (config, view, options, onRow) => new Promise((resolve, reje
|
|
|
48
49
|
// Keep as stream
|
|
49
50
|
};
|
|
50
51
|
const streamer = import_JSONStream.default.parse("rows.*");
|
|
51
|
-
|
|
52
|
+
let rowCount = 0;
|
|
53
|
+
streamer.on(
|
|
54
|
+
"data",
|
|
55
|
+
/** @param {object} row */
|
|
56
|
+
(row) => {
|
|
57
|
+
rowCount++;
|
|
58
|
+
onRow(row);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
52
61
|
streamer.on(
|
|
53
62
|
"error",
|
|
54
63
|
/** @param {Error} err */
|
|
@@ -74,7 +83,6 @@ const queryStream = (config, view, options, onRow) => new Promise((resolve, reje
|
|
|
74
83
|
req.on("response", (response) => {
|
|
75
84
|
if (import_errors.RetryableError.isRetryableStatusCode(response.statusCode)) {
|
|
76
85
|
reject(new import_errors.RetryableError("retryable error during stream query", response.statusCode));
|
|
77
|
-
return;
|
|
78
86
|
}
|
|
79
87
|
});
|
|
80
88
|
req.on("error", (err) => {
|
package/cjs/index.cjs
CHANGED
|
@@ -52,6 +52,7 @@ const schema = {
|
|
|
52
52
|
OnRow: import_stream2.OnRow,
|
|
53
53
|
BulkSave: import_bulk2.BulkSave,
|
|
54
54
|
BulkGet: import_bulk2.BulkGet,
|
|
55
|
+
BulkRemove: import_bulk2.BulkRemove,
|
|
55
56
|
CouchGet: import_crud2.CouchGet,
|
|
56
57
|
CouchPut: import_crud2.CouchPut,
|
|
57
58
|
CouchDoc: import_crud2.CouchDoc,
|
package/cjs/schema/config.cjs
CHANGED
|
@@ -40,6 +40,7 @@ const CouchConfig = import_zod.z.object({
|
|
|
40
40
|
maxRetries: import_zod.z.number().optional().default(3).describe("maximum number of retry attempts"),
|
|
41
41
|
initialDelay: import_zod.z.number().optional().default(1e3).describe("initial retry delay in milliseconds"),
|
|
42
42
|
backoffFactor: import_zod.z.number().optional().default(2).describe("multiplier for exponential backoff"),
|
|
43
|
+
useConsoleLogger: import_zod.z.boolean().optional().default(false).describe("turn on console as a fallback logger"),
|
|
43
44
|
logger: LoggerSchema.optional().describe("logging interface supporting winston-like or simple function interface"),
|
|
44
45
|
_normalizedLogger: import_zod.z.any().optional()
|
|
45
46
|
// Internal property for caching normalized logger
|
package/cjs/schema/stream.cjs
CHANGED
|
@@ -28,7 +28,7 @@ var import_config = require("./config.cjs");
|
|
|
28
28
|
var import_query = require("./query.cjs");
|
|
29
29
|
const OnRow = import_zod.z.function().args(
|
|
30
30
|
import_query.ViewRow
|
|
31
|
-
)
|
|
31
|
+
);
|
|
32
32
|
const SimpleViewQueryStream = import_zod.z.function().args(
|
|
33
33
|
import_config.CouchConfig,
|
|
34
34
|
import_zod.z.string().describe("the view name"),
|
package/impl/bulk.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.d.mts","sourceRoot":"","sources":["bulk.mjs"],"names":[],"mappings":"AAaA,4DAA4D;AAC5D,uBADY,OAAO,oBAAoB,EAAE,cAAc,CAsCrD;AAEF,2DAA2D;AAC3D,sBADY,OAAO,oBAAoB,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"bulk.d.mts","sourceRoot":"","sources":["bulk.mjs"],"names":[],"mappings":"AAaA,4DAA4D;AAC5D,uBADY,OAAO,oBAAoB,EAAE,cAAc,CAsCrD;AAEF,2DAA2D;AAC3D,sBADY,OAAO,oBAAoB,EAAE,aAAa,CAkCpD;AAEF,8DAA8D;AAC9D,yBADY,OAAO,oBAAoB,EAAE,gBAAgB,CAOvD"}
|
package/impl/bulk.mjs
CHANGED
|
@@ -15,7 +15,7 @@ const opts = {
|
|
|
15
15
|
export const bulkSave = BulkSave.implement(async (config, docs) => {
|
|
16
16
|
/** @type {import('./logger.mjs').Logger } */
|
|
17
17
|
const logger = createLogger(config)
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
if (!docs) {
|
|
20
20
|
logger.warn('bulkSave called with no docs')
|
|
21
21
|
return { ok: false, error: 'noDocs', reason: 'no docs provided' }
|
|
@@ -55,7 +55,7 @@ export const bulkSave = BulkSave.implement(async (config, docs) => {
|
|
|
55
55
|
export const bulkGet = BulkGet.implement(async (config, ids) => {
|
|
56
56
|
const logger = createLogger(config)
|
|
57
57
|
const keys = ids
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
logger.info(`Starting bulk get for ${keys.length} documents`)
|
|
60
60
|
const url = `${config.couch}/_all_docs?include_docs=true`
|
|
61
61
|
const body = { keys }
|
|
@@ -80,17 +80,9 @@ export const bulkGet = BulkGet.implement(async (config, ids) => {
|
|
|
80
80
|
}
|
|
81
81
|
const rows = resp?.body?.rows || []
|
|
82
82
|
/** @type {Array<import('../schema/crud.mjs').CouchDocSchema>} */
|
|
83
|
-
const docs =
|
|
84
|
-
rows.forEach((
|
|
83
|
+
const docs = rows.map((
|
|
85
84
|
/** @type {{ error?: any, key?: string, doc?: import('../schema/crud.mjs').CouchDocSchema }} */ r
|
|
86
|
-
) =>
|
|
87
|
-
if (r.error) return
|
|
88
|
-
if (!r.key) return
|
|
89
|
-
if (!r.doc) return
|
|
90
|
-
/** @type { import('../schema/crud.mjs').CouchDocSchema } */
|
|
91
|
-
const doc = r.doc
|
|
92
|
-
docs.push(doc)
|
|
93
|
-
})
|
|
85
|
+
) => r.doc)
|
|
94
86
|
logger.info(`Successfully retrieved ${docs.length} documents`)
|
|
95
87
|
return docs
|
|
96
88
|
})
|
package/impl/crud.mjs
CHANGED
|
@@ -16,7 +16,7 @@ export const get = CouchGet.implement(async (config, id) => {
|
|
|
16
16
|
const logger = createLogger(config)
|
|
17
17
|
const url = `${config.couch}/${id}`
|
|
18
18
|
logger.info(`Getting document with id: ${id}`)
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
try {
|
|
21
21
|
const resp = await needle('get', url, opts)
|
|
22
22
|
if (!resp) {
|
|
@@ -58,7 +58,7 @@ export const put = CouchPut.implement(async (config, doc) => {
|
|
|
58
58
|
const logger = createLogger(config)
|
|
59
59
|
const url = `${config.couch}/${doc._id}`
|
|
60
60
|
const body = doc
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
logger.info(`Putting document with id: ${doc._id}`)
|
|
63
63
|
let resp
|
|
64
64
|
try {
|
|
@@ -67,27 +67,27 @@ export const put = CouchPut.implement(async (config, doc) => {
|
|
|
67
67
|
logger.error('Error during put operation:', err)
|
|
68
68
|
RetryableError.handleNetworkError(err)
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
if (!resp) {
|
|
72
72
|
logger.error('No response received from put request')
|
|
73
73
|
throw new RetryableError('no response', 503)
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
const result = resp?.body || {}
|
|
77
77
|
result.statusCode = resp.statusCode
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
if (resp.statusCode === 409) {
|
|
80
80
|
logger.warn(`Conflict detected for document: ${doc._id}`)
|
|
81
81
|
result.ok = false
|
|
82
82
|
result.error = 'conflict'
|
|
83
83
|
return result
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
|
|
86
86
|
if (RetryableError.isRetryableStatusCode(resp.statusCode)) {
|
|
87
87
|
logger.warn(`Retryable status code received: ${resp.statusCode}`)
|
|
88
88
|
throw new RetryableError(result.reason || 'retryable error', resp.statusCode)
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
logger.info(`Successfully saved document: ${doc._id}`)
|
|
92
92
|
return result
|
|
93
93
|
})
|
package/impl/errors.mjs
CHANGED
|
@@ -11,19 +11,19 @@ export class RetryableError extends Error {
|
|
|
11
11
|
* @param {string} message - The error message
|
|
12
12
|
* @param {number|undefined} statusCode - The HTTP status code
|
|
13
13
|
*/
|
|
14
|
-
constructor(message, statusCode) {
|
|
15
|
-
super(message)
|
|
16
|
-
this.name = 'RetryableError'
|
|
17
|
-
this.statusCode = statusCode
|
|
14
|
+
constructor (message, statusCode) {
|
|
15
|
+
super(message)
|
|
16
|
+
this.name = 'RetryableError'
|
|
17
|
+
this.statusCode = statusCode
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @param {number|undefined} statusCode - The HTTP status code to check
|
|
22
22
|
* @returns {boolean} Whether the status code is retryable
|
|
23
23
|
*/
|
|
24
|
-
static isRetryableStatusCode(statusCode) {
|
|
25
|
-
if (statusCode === undefined) return false
|
|
26
|
-
return [408, 429, 500, 502, 503, 504].includes(statusCode)
|
|
24
|
+
static isRetryableStatusCode (statusCode) {
|
|
25
|
+
if (statusCode === undefined) return false
|
|
26
|
+
return [408, 429, 500, 502, 503, 504].includes(statusCode)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -31,7 +31,7 @@ export class RetryableError extends Error {
|
|
|
31
31
|
* @throws {RetryableError} If the error is retryable
|
|
32
32
|
* @throws {Error} If the error is not retryable
|
|
33
33
|
*/
|
|
34
|
-
static handleNetworkError(err) {
|
|
34
|
+
static handleNetworkError (err) {
|
|
35
35
|
/** @type {Record<string, number>} */
|
|
36
36
|
const networkErrors = {
|
|
37
37
|
ECONNREFUSED: 503,
|
|
@@ -42,12 +42,12 @@ export class RetryableError extends Error {
|
|
|
42
42
|
EPIPE: 503,
|
|
43
43
|
EHOSTUNREACH: 503,
|
|
44
44
|
ESOCKETTIMEDOUT: 503
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
|
|
47
47
|
// Type guard for NetworkError shape
|
|
48
48
|
if (typeof err === 'object' && err !== null && 'code' in err && typeof err.code === 'string' && networkErrors[err.code]) {
|
|
49
|
-
throw new RetryableError(`Network error: ${err.code}`, networkErrors[err.code])
|
|
49
|
+
throw new RetryableError(`Network error: ${err.code}`, networkErrors[err.code])
|
|
50
50
|
}
|
|
51
|
-
throw err
|
|
51
|
+
throw err
|
|
52
52
|
}
|
|
53
53
|
}
|
package/impl/logger.d.mts.map
CHANGED
|
@@ -1 +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,
|
|
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"}
|
package/impl/logger.mjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @param {import('../schema/config.mjs').CouchConfigSchema} config
|
|
12
12
|
* @returns {Logger} Normalized logger interface
|
|
13
13
|
*/
|
|
14
|
-
export function createLogger(config) {
|
|
14
|
+
export function createLogger (config) {
|
|
15
15
|
// Return cached logger if it exists
|
|
16
16
|
if (config._normalizedLogger) {
|
|
17
17
|
return config._normalizedLogger
|
package/impl/patch.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.d.mts","sourceRoot":"","sources":["patch.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"patch.d.mts","sourceRoot":"","sources":["patch.mjs"],"names":[],"mappings":"AAIO,6CAAmE;AAE1E,0DAA0D;AAC1D,oBADY,OAAO,qBAAqB,EAAE,WAAW,CA4DnD"}
|
package/impl/patch.mjs
CHANGED
|
@@ -22,10 +22,10 @@ export const patch = Patch.implement(async (config, id, properties) => {
|
|
|
22
22
|
logger.warn(`Document ${id} not found`)
|
|
23
23
|
return { ok: false, statusCode: 404, error: 'not_found' }
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
const updatedDoc = { ...doc, ...properties }
|
|
27
27
|
logger.debug('Merged document:', updatedDoc)
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
const result = await put(config, updatedDoc)
|
|
30
30
|
|
|
31
31
|
// Check if the response indicates a conflict
|
|
@@ -33,25 +33,24 @@ export const patch = Patch.implement(async (config, id, properties) => {
|
|
|
33
33
|
logger.info(`Successfully patched document ${id}, rev: ${result.rev}`)
|
|
34
34
|
return result
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
// If not ok, treat as conflict and retry
|
|
38
38
|
attempts++
|
|
39
39
|
if (attempts > maxRetries) {
|
|
40
40
|
logger.error(`Failed to patch ${id} after ${maxRetries} attempts`)
|
|
41
41
|
throw new Error(`Failed to patch after ${maxRetries} attempts`)
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
logger.warn(`Conflict detected for ${id}, retrying (attempt ${attempts})`)
|
|
45
45
|
await sleep(delay)
|
|
46
46
|
delay *= config.backoffFactor
|
|
47
47
|
logger.debug(`Next retry delay: ${delay}ms`)
|
|
48
|
-
|
|
49
48
|
} catch (err) {
|
|
50
49
|
if (err.message === 'not_found') {
|
|
51
50
|
logger.warn(`Document ${id} not found during patch operation`)
|
|
52
51
|
return { ok: false, statusCode: 404, error: 'not_found' }
|
|
53
52
|
}
|
|
54
|
-
|
|
53
|
+
|
|
55
54
|
// Handle other errors (network, etc)
|
|
56
55
|
attempts++
|
|
57
56
|
if (attempts > maxRetries) {
|
|
@@ -59,7 +58,7 @@ export const patch = Patch.implement(async (config, id, properties) => {
|
|
|
59
58
|
logger.error(error)
|
|
60
59
|
return { ok: false, statusCode: 500, error }
|
|
61
60
|
}
|
|
62
|
-
|
|
61
|
+
|
|
63
62
|
logger.warn(`Error during patch attempt ${attempts}: ${err.message}`)
|
|
64
63
|
await sleep(delay)
|
|
65
64
|
logger.debug(`Retrying after ${delay}ms`)
|
package/impl/query.d.mts
CHANGED
|
@@ -13,6 +13,7 @@ export const query: z.infer<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
13
13
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
14
14
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
15
15
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
16
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
16
17
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
17
18
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
18
19
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -37,6 +38,7 @@ export const query: z.infer<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
37
38
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
38
39
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
39
40
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
41
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
40
42
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
41
43
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
42
44
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -61,6 +63,7 @@ export const query: z.infer<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
61
63
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
62
64
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
63
65
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
66
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
64
67
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
65
68
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
66
69
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
package/impl/query.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.mts","sourceRoot":"","sources":["query.mjs"],"names":[],"mappings":"
|
|
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"}
|
package/impl/query.mjs
CHANGED
|
@@ -43,7 +43,7 @@ export const query = SimpleViewQuery.implement(async (config, view, options) =>
|
|
|
43
43
|
|
|
44
44
|
/** @type { z.infer<SimpleViewQueryResponse> } body */
|
|
45
45
|
const body = results.body
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
if (RetryableError.isRetryableStatusCode(results.statusCode)) {
|
|
48
48
|
logger.warn(`Retryable status code received: ${results.statusCode}`)
|
|
49
49
|
throw new RetryableError(body.error || 'retryable error during query', results.statusCode)
|
|
@@ -64,10 +64,6 @@ export const query = SimpleViewQuery.implement(async (config, view, options) =>
|
|
|
64
64
|
* @param {string[]} params - The list of parameter names to include in the query string.
|
|
65
65
|
*/
|
|
66
66
|
export function queryString (options, params) {
|
|
67
|
-
const logger = createLogger({ useConsoleLogger: false })
|
|
68
|
-
logger.debug('Building query string with options:', options)
|
|
69
|
-
logger.debug('Allowed params:', params)
|
|
70
|
-
|
|
71
67
|
const parts = Object.keys(options).map(key => {
|
|
72
68
|
let value = options[key]
|
|
73
69
|
if (includes(params, key)) {
|
package/impl/retry.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RetryableError } from './errors.mjs'
|
|
2
2
|
import { sleep } from './patch.mjs'
|
|
3
3
|
|
|
4
|
-
export function withRetry(fn, options = {}) {
|
|
4
|
+
export function withRetry (fn, options = {}) {
|
|
5
5
|
const {
|
|
6
6
|
maxRetries = 3,
|
|
7
7
|
initialDelay = 1000, // 1 second
|
|
8
|
-
backoffFactor = 2
|
|
8
|
+
backoffFactor = 2 // exponential backoff multiplier
|
|
9
9
|
} = options
|
|
10
10
|
|
|
11
11
|
return async (...args) => {
|
|
@@ -17,7 +17,7 @@ export function withRetry(fn, options = {}) {
|
|
|
17
17
|
return await fn(...args)
|
|
18
18
|
} catch (error) {
|
|
19
19
|
lastError = error
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
// Only retry if it's a RetryableError
|
|
22
22
|
if (!(error instanceof RetryableError)) {
|
|
23
23
|
throw error
|
package/impl/stream.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** @type { import('../schema/stream.mjs').SimpleViewQueryStreamSchema } */
|
|
1
|
+
/** @type { import('../schema/stream.mjs').SimpleViewQueryStreamSchema } queryStream */
|
|
2
2
|
export const queryStream: import("../schema/stream.mjs").SimpleViewQueryStreamSchema;
|
|
3
3
|
//# sourceMappingURL=stream.d.mts.map
|
package/impl/stream.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.mts","sourceRoot":"","sources":["stream.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream.d.mts","sourceRoot":"","sources":["stream.mjs"],"names":[],"mappings":"AAQA,uFAAuF;AACvF,0BADY,OAAO,sBAAsB,EAAE,2BAA2B,CA2DpE"}
|
package/impl/stream.mjs
CHANGED
|
@@ -6,16 +6,12 @@ import { createLogger } from './logger.mjs'
|
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
import JSONStream from 'JSONStream'
|
|
8
8
|
|
|
9
|
-
/** @type { import('../schema/stream.mjs').SimpleViewQueryStreamSchema } */
|
|
9
|
+
/** @type { import('../schema/stream.mjs').SimpleViewQueryStreamSchema } queryStream */
|
|
10
10
|
export const queryStream = (config, view, options, onRow) => new Promise((resolve, reject) => {
|
|
11
|
-
|
|
12
|
-
logger.info(`Starting stream query for view: ${view}`)
|
|
13
|
-
|
|
11
|
+
|
|
14
12
|
if (!options) options = {}
|
|
15
|
-
logger.debug('Stream query options:', options)
|
|
16
13
|
|
|
17
14
|
const qs = queryString(options, ['key', 'startkey', 'endkey', 'reduce', 'group', 'group_level', 'stale', 'limit'])
|
|
18
|
-
logger.debug('Generated query string:', qs)
|
|
19
15
|
const url = `${config.couch}/${view}?${qs.toString()}`
|
|
20
16
|
const opts = {
|
|
21
17
|
json: true,
|
|
@@ -26,53 +22,42 @@ export const queryStream = (config, view, options, onRow) => new Promise((resolv
|
|
|
26
22
|
}
|
|
27
23
|
|
|
28
24
|
const streamer = JSONStream.parse('rows.*')
|
|
29
|
-
|
|
25
|
+
|
|
30
26
|
let rowCount = 0
|
|
31
|
-
streamer.on('data', row => {
|
|
27
|
+
streamer.on('data', /** @param {object} row */ row => {
|
|
32
28
|
rowCount++
|
|
33
29
|
onRow(row)
|
|
34
30
|
})
|
|
35
|
-
|
|
31
|
+
|
|
36
32
|
streamer.on('error', /** @param {Error} err */ err => {
|
|
37
|
-
logger.error('Stream parsing error:', err)
|
|
38
33
|
reject(new Error(`Stream parsing error: ${err.message}`))
|
|
39
34
|
})
|
|
40
|
-
|
|
35
|
+
|
|
41
36
|
streamer.on('done', /** @param {Error|null} err */ err => {
|
|
42
|
-
if (err) {
|
|
43
|
-
logger.error('Stream done with error:', err)
|
|
44
|
-
}
|
|
45
37
|
try {
|
|
46
38
|
RetryableError.handleNetworkError(err)
|
|
47
39
|
} catch (e) {
|
|
48
|
-
logger.error('Retryable error in stream:', e)
|
|
49
40
|
reject(e)
|
|
50
41
|
}
|
|
51
42
|
})
|
|
52
|
-
|
|
43
|
+
|
|
53
44
|
streamer.on('end', () => {
|
|
54
|
-
logger.info(`Stream completed successfully, processed ${rowCount} rows`)
|
|
55
45
|
resolve(undefined) // all work should be done in the stream
|
|
56
46
|
})
|
|
57
|
-
|
|
47
|
+
|
|
58
48
|
const req = needle.get(url, opts)
|
|
59
|
-
|
|
49
|
+
|
|
60
50
|
req.on('response', response => {
|
|
61
|
-
logger.debug(`Received response with status code: ${response.statusCode}`)
|
|
62
51
|
if (RetryableError.isRetryableStatusCode(response.statusCode)) {
|
|
63
|
-
logger.warn(`Retryable status code received: ${response.statusCode}`)
|
|
64
52
|
reject(new RetryableError('retryable error during stream query', response.statusCode))
|
|
65
53
|
// req.abort()
|
|
66
|
-
return
|
|
67
54
|
}
|
|
68
55
|
})
|
|
69
56
|
|
|
70
57
|
req.on('error', err => {
|
|
71
|
-
logger.error('Request error:', err)
|
|
72
58
|
try {
|
|
73
59
|
RetryableError.handleNetworkError(err)
|
|
74
60
|
} catch (retryErr) {
|
|
75
|
-
logger.error('Retryable error in request:', retryErr)
|
|
76
61
|
reject(retryErr)
|
|
77
62
|
return
|
|
78
63
|
}
|
|
@@ -80,5 +65,4 @@ export const queryStream = (config, view, options, onRow) => new Promise((resolv
|
|
|
80
65
|
})
|
|
81
66
|
|
|
82
67
|
req.pipe(streamer)
|
|
83
|
-
|
|
84
68
|
})
|
package/index.d.mts
CHANGED
|
@@ -14,6 +14,7 @@ export namespace schema {
|
|
|
14
14
|
export { OnRow };
|
|
15
15
|
export { BulkSave };
|
|
16
16
|
export { BulkGet };
|
|
17
|
+
export { BulkRemove };
|
|
17
18
|
export { CouchGet };
|
|
18
19
|
export { CouchPut };
|
|
19
20
|
export { CouchDoc };
|
|
@@ -30,6 +31,7 @@ import { SimpleViewQueryStream } from './schema/stream.mjs';
|
|
|
30
31
|
import { OnRow } from './schema/stream.mjs';
|
|
31
32
|
import { BulkSave } from './schema/bulk.mjs';
|
|
32
33
|
import { BulkGet } from './schema/bulk.mjs';
|
|
34
|
+
import { BulkRemove } from './schema/bulk.mjs';
|
|
33
35
|
import { CouchGet } from './schema/crud.mjs';
|
|
34
36
|
import { CouchPut } from './schema/crud.mjs';
|
|
35
37
|
import { CouchDoc } from './schema/crud.mjs';
|
package/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mjs"],"names":[],"mappings":"oBAEyB,iBAAiB;oBAAjB,iBAAiB;sBACpB,kBAAkB;wBAFM,iBAAiB;yBAAjB,iBAAiB;2BAAjB,iBAAiB;sBAGzC,kBAAkB;4BACZ,mBAAmB
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["index.mjs"],"names":[],"mappings":"oBAEyB,iBAAiB;oBAAjB,iBAAiB;sBACpB,kBAAkB;wBAFM,iBAAiB;yBAAjB,iBAAiB;2BAAjB,iBAAiB;sBAGzC,kBAAkB;4BACZ,mBAAmB;;;;;;;;;;;;;;;;AA0B/C,uDAAuD;AACvD,yBADY,OAAO,mBAAmB,EAAE,UAAU,CAsBhD;0BA/CwB,kBAAkB;4BAEhB,qBAAqB;gCACQ,oBAAoB;wCAApB,oBAAoB;sCAChC,qBAAqB;sBAArB,qBAAqB;yBAHpB,mBAAmB;wBAAnB,mBAAmB;2BAAnB,mBAAmB;yBAKF,mBAAmB;yBAAnB,mBAAmB;yBAAnB,mBAAmB;iCAAnB,mBAAmB;sBAD5D,oBAAoB"}
|
package/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { patch } from './impl/patch.mjs'
|
|
|
5
5
|
import { query } from './impl/query.mjs'
|
|
6
6
|
import { queryStream } from './impl/stream.mjs'
|
|
7
7
|
import { withRetry } from './impl/retry.mjs'
|
|
8
|
-
import { BulkSave, BulkGet } from './schema/bulk.mjs'
|
|
8
|
+
import { BulkSave, BulkGet, BulkRemove } from './schema/bulk.mjs'
|
|
9
9
|
import { CouchConfig } from './schema/config.mjs'
|
|
10
10
|
import { SimpleViewQuery, SimpleViewQueryResponse } from './schema/query.mjs'
|
|
11
11
|
import { SimpleViewQueryStream, OnRow } from './schema/stream.mjs'
|
|
@@ -21,6 +21,7 @@ const schema = {
|
|
|
21
21
|
OnRow,
|
|
22
22
|
BulkSave,
|
|
23
23
|
BulkGet,
|
|
24
|
+
BulkRemove,
|
|
24
25
|
CouchGet,
|
|
25
26
|
CouchPut,
|
|
26
27
|
CouchDoc,
|
|
@@ -48,7 +49,7 @@ const bindConfig = Bind.implement((
|
|
|
48
49
|
bulkSave: config.bindWithRetry ? withRetry(bulkSave.bind(null, config), retryOptions) : bulkSave.bind(null, config),
|
|
49
50
|
bulkRemove: config.bindWithRetry ? withRetry(bulkRemove.bind(null, config), retryOptions) : bulkRemove.bind(null, config),
|
|
50
51
|
query: config.bindWithRetry ? withRetry(query.bind(null, config), retryOptions) : query.bind(null, config),
|
|
51
|
-
queryStream: config.bindWithRetry? withRetry(queryStream.bind(null, config), retryOptions) : queryStream.bind(null, config)
|
|
52
|
+
queryStream: config.bindWithRetry ? withRetry(queryStream.bind(null, config), retryOptions) : queryStream.bind(null, config)
|
|
52
53
|
}
|
|
53
54
|
})
|
|
54
55
|
|
package/package.json
CHANGED
package/schema/bind.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
5
5
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
6
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
7
7
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
8
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
8
9
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
9
10
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
10
11
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -29,6 +30,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
29
30
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
30
31
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
31
32
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
33
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
32
34
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
33
35
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
34
36
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -53,6 +55,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
53
55
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
54
56
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
55
57
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
58
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
56
59
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
57
60
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
58
61
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -299,7 +302,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
299
302
|
key?: any;
|
|
300
303
|
value?: any;
|
|
301
304
|
doc?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
302
|
-
}>], z.ZodUnknown>, z.
|
|
305
|
+
}>], z.ZodUnknown>, z.ZodUnknown>], z.ZodUnknown>, z.ZodPromise<z.ZodUndefined>>;
|
|
303
306
|
}, "strip", z.ZodTypeAny, {
|
|
304
307
|
query: (args_0: string, args_1: {
|
|
305
308
|
startkey?: any;
|
|
@@ -381,7 +384,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
381
384
|
key?: any;
|
|
382
385
|
value?: any;
|
|
383
386
|
doc?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
384
|
-
}, ...args: unknown[]) =>
|
|
387
|
+
}, ...args: unknown[]) => unknown, ...args: unknown[]) => Promise<undefined>;
|
|
385
388
|
}, {
|
|
386
389
|
query: (args_0: string, args_1: {
|
|
387
390
|
startkey?: any;
|
|
@@ -463,7 +466,7 @@ export const Bind: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
463
466
|
key?: any;
|
|
464
467
|
value?: any;
|
|
465
468
|
doc?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
466
|
-
}, ...args: unknown[]) =>
|
|
469
|
+
}, ...args: unknown[]) => unknown, ...args: unknown[]) => Promise<undefined>;
|
|
467
470
|
}>>;
|
|
468
471
|
export type BindSchema = z.infer<typeof Bind>;
|
|
469
472
|
import { z } from 'zod';
|
package/schema/bind.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bind.d.mts","sourceRoot":"","sources":["bind.mjs"],"names":[],"mappings":"AAmBA
|
|
1
|
+
{"version":3,"file":"bind.d.mts","sourceRoot":"","sources":["bind.mjs"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAuE;yBACxD,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC;kBAnBjB,KAAK"}
|
package/schema/bulk.d.mts
CHANGED
|
@@ -25,6 +25,7 @@ export const BulkSave: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
25
25
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
26
26
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
27
27
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
28
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
28
29
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
29
30
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
30
31
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -49,6 +50,7 @@ export const BulkSave: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
49
50
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
50
51
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
51
52
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
53
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
52
54
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
53
55
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
54
56
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -73,6 +75,7 @@ export const BulkSave: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
73
75
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
74
76
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
75
77
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
78
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
76
79
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
77
80
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
78
81
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -149,6 +152,7 @@ export const BulkGet: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
149
152
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
150
153
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
151
154
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
155
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
152
156
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
153
157
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
154
158
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -173,6 +177,7 @@ export const BulkGet: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
173
177
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
174
178
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
175
179
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
180
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
176
181
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
177
182
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
178
183
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -197,6 +202,7 @@ export const BulkGet: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
197
202
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
198
203
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
199
204
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
205
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
200
206
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
201
207
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
202
208
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -243,6 +249,7 @@ export const BulkRemove: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
243
249
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
244
250
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
245
251
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
252
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
246
253
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
247
254
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
248
255
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -267,6 +274,7 @@ export const BulkRemove: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
267
274
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
268
275
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
269
276
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
277
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
270
278
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
271
279
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
272
280
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -291,6 +299,7 @@ export const BulkRemove: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
291
299
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
292
300
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
293
301
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
302
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
294
303
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
295
304
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
296
305
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
package/schema/bulk.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.d.mts","sourceRoot":"","sources":["bulk.mjs"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;YAMG;AACH,mEAAmE;AAEnE
|
|
1
|
+
{"version":3,"file":"bulk.d.mts","sourceRoot":"","sources":["bulk.mjs"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;YAMG;AACH,mEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAK4C;AAC5C,2DAA2D;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;cAI4C;AAC5C,qEAAqE;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAGuC;AACvC,yDAAyD;AAEzD;;;;;;;;;4CAEuC;AACvC,mEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAG4C;AAC5C,+DAA+D;AAE/D;;;;;;;;;;;;;;;;;;cAE4C;uBApC7B,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC;6BAQtC,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC;kCAOxB,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC;4BAM7B,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC;iCAKvB,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC;+BAM5B,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC;oCAK1B,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC;kBAhD5B,KAAK"}
|
package/schema/config.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ export const CouchConfig: z.ZodObject<{
|
|
|
5
5
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
6
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
7
7
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
8
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
8
9
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
9
10
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
10
11
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -29,6 +30,7 @@ export const CouchConfig: z.ZodObject<{
|
|
|
29
30
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
30
31
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
31
32
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
33
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
32
34
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
33
35
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
34
36
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -53,6 +55,7 @@ export const CouchConfig: z.ZodObject<{
|
|
|
53
55
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
54
56
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
55
57
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
58
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
56
59
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
57
60
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
58
61
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
package/schema/config.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","sourceRoot":"","sources":["config.mjs"],"names":[],"mappings":"AAYA
|
|
1
|
+
{"version":3,"file":"config.d.mts","sourceRoot":"","sources":["config.mjs"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAUkD;gCAEnC,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;kBAxBxB,KAAK"}
|
package/schema/config.mjs
CHANGED
|
@@ -7,7 +7,7 @@ const LoggerSchema = z.object({
|
|
|
7
7
|
debug: z.function().args(z.any()).returns(z.void()).optional()
|
|
8
8
|
}).or(z.function().args(
|
|
9
9
|
z.string(), // level
|
|
10
|
-
z.any()
|
|
10
|
+
z.any() // message/args
|
|
11
11
|
).returns(z.void()))
|
|
12
12
|
|
|
13
13
|
export const CouchConfig = z.object({
|
|
@@ -22,4 +22,4 @@ export const CouchConfig = z.object({
|
|
|
22
22
|
_normalizedLogger: z.any().optional() // Internal property for caching normalized logger
|
|
23
23
|
}).passthrough().describe('The std config object')
|
|
24
24
|
|
|
25
|
-
/** @typedef { z.infer<typeof CouchConfig> } CouchConfigSchema*/
|
|
25
|
+
/** @typedef { z.infer<typeof CouchConfig> } CouchConfigSchema */
|
package/schema/crud.d.mts
CHANGED
|
@@ -35,6 +35,7 @@ export const CouchPut: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
35
35
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
36
36
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
37
37
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
38
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
38
39
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
39
40
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
40
41
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -59,6 +60,7 @@ export const CouchPut: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
59
60
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
60
61
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
61
62
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
63
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
62
64
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
63
65
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
64
66
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -83,6 +85,7 @@ export const CouchPut: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
83
85
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
84
86
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
85
87
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
88
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
86
89
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
87
90
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
88
91
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -165,6 +168,7 @@ export const CouchGet: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
165
168
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
166
169
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
167
170
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
171
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
168
172
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
169
173
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
170
174
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -189,6 +193,7 @@ export const CouchGet: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
189
193
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
190
194
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
191
195
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
196
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
192
197
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
193
198
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
194
199
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -213,6 +218,7 @@ export const CouchGet: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
213
218
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
214
219
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
215
220
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
221
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
216
222
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
217
223
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
218
224
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
package/schema/crud.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud.d.mts","sourceRoot":"","sources":["crud.mjs"],"names":[],"mappings":"AAGA;;;;;;;;;iCAGgB;AAChB,2DAA2D;AAE3D;;;;;;;;;;;;;;;;;;GAME;AAEF
|
|
1
|
+
{"version":3,"file":"crud.d.mts","sourceRoot":"","sources":["crud.mjs"],"names":[],"mappings":"AAGA;;;;;;;;;iCAGgB;AAChB,2DAA2D;AAE3D;;;;;;;;;;;;;;;;;;GAME;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAGsC;AACtC,2DAA2D;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEsC;AACtC,qEAAqE;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAGyC;AACzC,2DAA2D;AAE3D;;;;;;;;;oCAEyC;6BA7B1B,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC;6BAcxB,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC;kCAKxB,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC;6BAM7B,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC;+BAKxB,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC;kBArC1B,KAAK"}
|
package/schema/patch.d.mts
CHANGED
|
@@ -6,6 +6,7 @@ export const Patch: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
6
6
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
7
7
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
8
8
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
9
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
9
10
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
10
11
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
11
12
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -30,6 +31,7 @@ export const Patch: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
30
31
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
31
32
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
32
33
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
34
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
33
35
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
34
36
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
35
37
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -54,6 +56,7 @@ export const Patch: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
54
56
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
55
57
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
56
58
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
59
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
57
60
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
58
61
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
59
62
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
package/schema/patch.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.d.mts","sourceRoot":"","sources":["patch.mjs"],"names":[],"mappings":"AAIA,iEAA4D;AAE5D
|
|
1
|
+
{"version":3,"file":"patch.d.mts","sourceRoot":"","sources":["patch.mjs"],"names":[],"mappings":"AAIA,iEAA4D;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMuC;AACvC,qDAAqD;AAErD;;;;;;;;;;;;;;;;;;KAKuC;0BAPxB,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC;+BAQrB,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC;kBArBvB,KAAK"}
|
package/schema/query.d.mts
CHANGED
|
@@ -112,6 +112,7 @@ export const SimpleViewQuery: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
112
112
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
113
113
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
114
114
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
115
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
115
116
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
116
117
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
117
118
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -136,6 +137,7 @@ export const SimpleViewQuery: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
136
137
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
137
138
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
138
139
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
140
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
139
141
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
140
142
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
141
143
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -160,6 +162,7 @@ export const SimpleViewQuery: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
160
162
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
161
163
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
162
164
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
165
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
163
166
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
164
167
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
165
168
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
package/schema/query.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.mts","sourceRoot":"","sources":["query.mjs"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAKE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAGgB;AAChB,yFAAyF;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWuC;AACvC,6EAA6E;AAE7E
|
|
1
|
+
{"version":3,"file":"query.d.mts","sourceRoot":"","sources":["query.mjs"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAKE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAGgB;AAChB,yFAAyF;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWuC;AACvC,6EAA6E;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAI6C;AAC7C,yEAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAG6C;4CA1B9B,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;kBAxCjC,KAAK"}
|
package/schema/query.mjs
CHANGED
|
@@ -9,7 +9,7 @@ export const ViewRow = z.object({
|
|
|
9
9
|
})
|
|
10
10
|
export const SimpleViewQueryResponse = z.object({
|
|
11
11
|
error: z.string().optional().describe('if something is wrong'),
|
|
12
|
-
rows: z.array(ViewRow)
|
|
12
|
+
rows: z.array(ViewRow)
|
|
13
13
|
}).passthrough()
|
|
14
14
|
/** @typedef { z.infer<typeof SimpleViewQueryResponse> } SimpleViewQueryResponseSchema */
|
|
15
15
|
|
package/schema/stream.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ export const OnRow: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
13
13
|
key?: any;
|
|
14
14
|
value?: any;
|
|
15
15
|
doc?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
16
|
-
}>], z.ZodUnknown>, z.
|
|
16
|
+
}>], z.ZodUnknown>, z.ZodUnknown>;
|
|
17
17
|
/** @typedef { z.infer<typeof OnRow> } OnRowSchema */
|
|
18
18
|
export const SimpleViewQueryStream: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
19
19
|
throwOnGetNotFound: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -22,6 +22,7 @@ export const SimpleViewQueryStream: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
22
22
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
23
23
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
24
24
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
25
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
25
26
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
26
27
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
27
28
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -46,6 +47,7 @@ export const SimpleViewQueryStream: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
46
47
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
47
48
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
48
49
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
50
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
49
51
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
50
52
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
51
53
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -70,6 +72,7 @@ export const SimpleViewQueryStream: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
70
72
|
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
71
73
|
initialDelay: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
72
74
|
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
75
|
+
useConsoleLogger: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
73
76
|
logger: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
74
77
|
error: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
75
78
|
warn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>>;
|
|
@@ -135,7 +138,7 @@ export const SimpleViewQueryStream: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
135
138
|
key?: any;
|
|
136
139
|
value?: any;
|
|
137
140
|
doc?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
138
|
-
}>], z.ZodUnknown>, z.
|
|
141
|
+
}>], z.ZodUnknown>, z.ZodUnknown>], z.ZodUnknown>, z.ZodPromise<z.ZodUndefined>>;
|
|
139
142
|
/** @typedef { z.infer<typeof SimpleViewQueryStream> } SimpleViewQueryStreamSchema */
|
|
140
143
|
export const SimpleViewQueryStreamBound: z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodOptional<z.ZodObject<{
|
|
141
144
|
startkey: z.ZodOptional<z.ZodAny>;
|
|
@@ -185,7 +188,7 @@ export const SimpleViewQueryStreamBound: z.ZodFunction<z.ZodTuple<[z.ZodString,
|
|
|
185
188
|
key?: any;
|
|
186
189
|
value?: any;
|
|
187
190
|
doc?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
188
|
-
}>], z.ZodUnknown>, z.
|
|
191
|
+
}>], z.ZodUnknown>, z.ZodUnknown>], z.ZodUnknown>, z.ZodPromise<z.ZodUndefined>>;
|
|
189
192
|
export type OnRowSchema = z.infer<typeof OnRow>;
|
|
190
193
|
export type SimpleViewQueryStreamSchema = z.infer<typeof SimpleViewQueryStream>;
|
|
191
194
|
export type SimpleViewQueryStreamBoundSchema = z.infer<typeof SimpleViewQueryStreamBound>;
|
package/schema/stream.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.mts","sourceRoot":"","sources":["stream.mjs"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;
|
|
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"}
|