hide-a-bed 5.0.2 → 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/impl/bulk.cjs +267 -0
- package/cjs/impl/changes.cjs +67 -0
- package/cjs/impl/crud.cjs +121 -0
- package/cjs/impl/errors.cjs +75 -0
- package/cjs/impl/logger.cjs +70 -0
- package/cjs/impl/patch.cjs +95 -0
- package/cjs/impl/query.cjs +116 -0
- package/cjs/impl/queryBuilder.cjs +99 -0
- package/cjs/impl/retry.cjs +54 -0
- package/cjs/impl/stream.cjs +121 -0
- package/cjs/impl/sugar/lock.cjs +81 -0
- package/cjs/impl/sugar/watch.cjs +159 -0
- package/cjs/impl/trackedEmitter.cjs +54 -0
- package/cjs/impl/transactionErrors.cjs +70 -0
- package/cjs/index.cjs +115 -0
- package/cjs/integration/changes.cjs +76 -0
- package/cjs/integration/disconnect-watch.cjs +52 -0
- package/cjs/integration/watch.cjs +59 -0
- package/cjs/schema/bind.cjs +51 -0
- package/cjs/schema/bulk.cjs +88 -0
- package/cjs/schema/changes.cjs +68 -0
- package/cjs/schema/config.cjs +48 -0
- package/cjs/schema/crud.cjs +77 -0
- package/cjs/schema/patch.cjs +53 -0
- package/cjs/schema/query.cjs +62 -0
- package/cjs/schema/stream.cjs +42 -0
- package/cjs/schema/sugar/lock.cjs +59 -0
- package/cjs/schema/sugar/watch.cjs +42 -0
- package/impl/bulk.d.mts +11 -0
- package/impl/bulk.d.mts.map +1 -0
- package/impl/bulk.mjs +1 -1
- package/impl/changes.d.mts +12 -0
- package/impl/changes.d.mts.map +1 -0
- package/impl/crud.d.mts +7 -0
- package/impl/crud.d.mts.map +1 -0
- package/impl/errors.d.mts +43 -0
- package/impl/errors.d.mts.map +1 -0
- package/impl/logger.d.mts +32 -0
- package/impl/logger.d.mts.map +1 -0
- package/impl/patch.d.mts +6 -0
- package/impl/patch.d.mts.map +1 -0
- package/impl/query.d.mts +195 -0
- package/impl/query.d.mts.map +1 -0
- package/impl/query.mjs +1 -1
- package/impl/queryBuilder.d.mts +94 -0
- package/impl/queryBuilder.d.mts.map +1 -0
- package/impl/retry.d.mts +2 -0
- package/impl/retry.d.mts.map +1 -0
- package/impl/stream.d.mts +3 -0
- package/impl/stream.d.mts.map +1 -0
- package/impl/sugar/lock.d.mts +5 -0
- package/impl/sugar/lock.d.mts.map +1 -0
- package/impl/sugar/watch.d.mts +34 -0
- package/impl/sugar/watch.d.mts.map +1 -0
- package/impl/trackedEmitter.d.mts +8 -0
- package/impl/trackedEmitter.d.mts.map +1 -0
- package/impl/transactionErrors.d.mts +57 -0
- package/impl/transactionErrors.d.mts.map +1 -0
- package/index.d.mts +74 -0
- package/index.d.mts.map +1 -0
- package/package.json +2 -2
- package/schema/bind.d.mts +922 -0
- package/schema/bind.d.mts.map +1 -0
- package/schema/bulk.d.mts +910 -0
- package/schema/bulk.d.mts.map +1 -0
- package/schema/changes.d.mts +191 -0
- package/schema/changes.d.mts.map +1 -0
- package/schema/config.d.mts +79 -0
- package/schema/config.d.mts.map +1 -0
- package/schema/crud.d.mts +491 -0
- package/schema/crud.d.mts.map +1 -0
- package/schema/patch.d.mts +255 -0
- package/schema/patch.d.mts.map +1 -0
- package/schema/query.d.mts +406 -0
- package/schema/query.d.mts.map +1 -0
- package/schema/stream.d.mts +211 -0
- package/schema/stream.d.mts.map +1 -0
- package/schema/sugar/lock.d.mts +238 -0
- package/schema/sugar/lock.d.mts.map +1 -0
- package/schema/sugar/watch.d.mts +127 -0
- package/schema/sugar/watch.d.mts.map +1 -0
- package/log.txt +0 -84
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var bulk_exports = {};
|
|
20
|
+
__export(bulk_exports, {
|
|
21
|
+
BulkGet: () => BulkGet,
|
|
22
|
+
BulkGetBound: () => BulkGetBound,
|
|
23
|
+
BulkGetDictionary: () => BulkGetDictionary,
|
|
24
|
+
BulkGetDictionaryBound: () => BulkGetDictionaryBound,
|
|
25
|
+
BulkGetDictionaryResponse: () => BulkGetDictionaryResponse,
|
|
26
|
+
BulkRemove: () => BulkRemove,
|
|
27
|
+
BulkRemoveBound: () => BulkRemoveBound,
|
|
28
|
+
BulkSave: () => BulkSave,
|
|
29
|
+
BulkSaveBound: () => BulkSaveBound,
|
|
30
|
+
BulkSaveResponseSchema: () => BulkSaveResponseSchema,
|
|
31
|
+
BulkSaveRow: () => BulkSaveRow,
|
|
32
|
+
BulkSaveTransaction: () => BulkSaveTransaction,
|
|
33
|
+
BulkSaveTransactionBound: () => BulkSaveTransactionBound
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(bulk_exports);
|
|
36
|
+
var import_zod = require("zod");
|
|
37
|
+
var import_config = require("./config.cjs");
|
|
38
|
+
var import_query = require("./query.cjs");
|
|
39
|
+
var import_crud = require("./crud.cjs");
|
|
40
|
+
const BulkSaveRow = import_zod.z.object({
|
|
41
|
+
ok: import_zod.z.boolean().nullish(),
|
|
42
|
+
id: import_zod.z.string().nullish(),
|
|
43
|
+
rev: import_zod.z.string().nullish(),
|
|
44
|
+
error: import_zod.z.string().nullish().describe("if an error occured, one word reason, eg conflict"),
|
|
45
|
+
reason: import_zod.z.string().nullish().describe("a full error message")
|
|
46
|
+
});
|
|
47
|
+
const BulkSaveResponseSchema = import_zod.z.array(BulkSaveRow);
|
|
48
|
+
const BulkSave = import_zod.z.function().args(
|
|
49
|
+
import_config.CouchConfig,
|
|
50
|
+
import_zod.z.array(import_crud.CouchDoc)
|
|
51
|
+
).returns(import_zod.z.promise(BulkSaveResponseSchema));
|
|
52
|
+
const BulkSaveBound = import_zod.z.function().args(
|
|
53
|
+
import_zod.z.array(import_crud.CouchDoc)
|
|
54
|
+
).returns(import_zod.z.promise(BulkSaveResponseSchema));
|
|
55
|
+
const BulkGet = import_zod.z.function().args(
|
|
56
|
+
import_config.CouchConfig,
|
|
57
|
+
import_zod.z.array(import_zod.z.string().describe("the ids to get"))
|
|
58
|
+
).returns(import_zod.z.promise(import_query.SimpleViewQueryResponse));
|
|
59
|
+
const BulkGetBound = import_zod.z.function().args(
|
|
60
|
+
import_zod.z.array(import_zod.z.string().describe("the ids to get"))
|
|
61
|
+
).returns(import_zod.z.promise(import_query.SimpleViewQueryResponse));
|
|
62
|
+
const BulkRemove = import_zod.z.function().args(
|
|
63
|
+
import_config.CouchConfig,
|
|
64
|
+
import_zod.z.array(import_zod.z.string().describe("the ids to delete"))
|
|
65
|
+
).returns(import_zod.z.promise(BulkSaveResponseSchema));
|
|
66
|
+
const BulkRemoveBound = import_zod.z.function().args(
|
|
67
|
+
import_zod.z.array(import_zod.z.string().describe("the ids to delete"))
|
|
68
|
+
).returns(import_zod.z.promise(BulkSaveResponseSchema));
|
|
69
|
+
const BulkGetDictionaryResponse = import_zod.z.object({
|
|
70
|
+
found: import_zod.z.record(import_zod.z.string(), import_crud.CouchDoc),
|
|
71
|
+
notFound: import_zod.z.record(import_zod.z.string(), import_query.ViewRow)
|
|
72
|
+
});
|
|
73
|
+
const BulkGetDictionary = import_zod.z.function().args(
|
|
74
|
+
import_config.CouchConfig,
|
|
75
|
+
import_zod.z.array(import_zod.z.string().describe("the ids to get"))
|
|
76
|
+
).returns(import_zod.z.promise(BulkGetDictionaryResponse));
|
|
77
|
+
const BulkGetDictionaryBound = import_zod.z.function().args(
|
|
78
|
+
import_zod.z.array(import_zod.z.string().describe("the ids to get"))
|
|
79
|
+
).returns(import_zod.z.promise(BulkGetDictionaryResponse));
|
|
80
|
+
const BulkSaveTransaction = import_zod.z.function().args(
|
|
81
|
+
import_config.CouchConfig,
|
|
82
|
+
import_zod.z.string().describe("transaction id"),
|
|
83
|
+
import_zod.z.array(import_crud.CouchDoc)
|
|
84
|
+
).returns(import_zod.z.promise(BulkSaveResponseSchema));
|
|
85
|
+
const BulkSaveTransactionBound = import_zod.z.function().args(
|
|
86
|
+
import_zod.z.string().describe("transaction id"),
|
|
87
|
+
import_zod.z.array(import_crud.CouchDoc)
|
|
88
|
+
).returns(import_zod.z.promise(BulkSaveResponseSchema));
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var changes_exports = {};
|
|
20
|
+
__export(changes_exports, {
|
|
21
|
+
Changes: () => Changes,
|
|
22
|
+
ChangesBound: () => ChangesBound,
|
|
23
|
+
ChangesEmitter: () => ChangesEmitter,
|
|
24
|
+
ChangesOptions: () => ChangesOptions,
|
|
25
|
+
ChangesResponse: () => ChangesResponse
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(changes_exports);
|
|
28
|
+
var import_zod = require("zod");
|
|
29
|
+
var import_config = require("./config.cjs");
|
|
30
|
+
var import_crud = require("./crud.cjs");
|
|
31
|
+
const ChangesOptions = import_zod.z.object({
|
|
32
|
+
feed: import_zod.z.enum(["continuous", "longpoll"]).default("continuous"),
|
|
33
|
+
filter: import_zod.z.any(),
|
|
34
|
+
// z.union([z.string(), z.array()]).optional(),
|
|
35
|
+
inactivity_ms: import_zod.z.number().default(60 * 60 * 1e3),
|
|
36
|
+
/** @type {number} */
|
|
37
|
+
timeout: import_zod.z.number().optional(),
|
|
38
|
+
requestTimeout: import_zod.z.number().default(2 * 60 * 1e3),
|
|
39
|
+
since: import_zod.z.union([import_zod.z.number(), import_zod.z.literal("now")]).default(0),
|
|
40
|
+
heartbeat: import_zod.z.number().default(30 * 1e3),
|
|
41
|
+
style: import_zod.z.enum(["main_only", "all_docs"]).default("main_only"),
|
|
42
|
+
include_docs: import_zod.z.boolean().default(false),
|
|
43
|
+
query_params: import_zod.z.record(import_zod.z.any()).default({}),
|
|
44
|
+
use_post: import_zod.z.boolean().default(false)
|
|
45
|
+
}).partial();
|
|
46
|
+
const ChangesResponse = import_zod.z.object({
|
|
47
|
+
id: import_zod.z.string(),
|
|
48
|
+
seq: import_zod.z.number(),
|
|
49
|
+
changes: import_zod.z.array(import_zod.z.object({
|
|
50
|
+
rev: import_zod.z.string()
|
|
51
|
+
})),
|
|
52
|
+
doc: import_crud.CouchDoc.nullish().optional(),
|
|
53
|
+
deleted: import_zod.z.boolean().optional()
|
|
54
|
+
});
|
|
55
|
+
const ChangesEmitter = import_zod.z.object({
|
|
56
|
+
on: import_zod.z.function().args(import_zod.z.string(), import_zod.z.function().args(import_zod.z.any()).returns(import_zod.z.void())).returns(import_zod.z.any()),
|
|
57
|
+
removeListener: import_zod.z.function().args(import_zod.z.string(), import_zod.z.function().args(import_zod.z.any()).returns(import_zod.z.void())).returns(import_zod.z.any()),
|
|
58
|
+
stop: import_zod.z.function().returns(import_zod.z.void())
|
|
59
|
+
});
|
|
60
|
+
const Changes = import_zod.z.function().args(
|
|
61
|
+
import_config.CouchConfig,
|
|
62
|
+
import_zod.z.function().args(import_zod.z.any()).returns(import_zod.z.void()),
|
|
63
|
+
ChangesOptions
|
|
64
|
+
).returns(import_zod.z.promise(ChangesEmitter));
|
|
65
|
+
const ChangesBound = import_zod.z.function().args(
|
|
66
|
+
import_zod.z.function().args(import_zod.z.any()).returns(import_zod.z.void()),
|
|
67
|
+
ChangesOptions
|
|
68
|
+
).returns(import_zod.z.promise(ChangesEmitter));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var config_exports = {};
|
|
20
|
+
__export(config_exports, {
|
|
21
|
+
CouchConfig: () => CouchConfig
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(config_exports);
|
|
24
|
+
var import_zod = require("zod");
|
|
25
|
+
const LoggerSchema = import_zod.z.object({
|
|
26
|
+
error: import_zod.z.function().args(import_zod.z.any()).returns(import_zod.z.void()).optional(),
|
|
27
|
+
warn: import_zod.z.function().args(import_zod.z.any()).returns(import_zod.z.void()).optional(),
|
|
28
|
+
info: import_zod.z.function().args(import_zod.z.any()).returns(import_zod.z.void()).optional(),
|
|
29
|
+
debug: import_zod.z.function().args(import_zod.z.any()).returns(import_zod.z.void()).optional()
|
|
30
|
+
}).or(import_zod.z.function().args(
|
|
31
|
+
import_zod.z.string(),
|
|
32
|
+
// level
|
|
33
|
+
import_zod.z.any()
|
|
34
|
+
// message/args
|
|
35
|
+
).returns(import_zod.z.void()));
|
|
36
|
+
const CouchConfig = import_zod.z.object({
|
|
37
|
+
throwOnGetNotFound: import_zod.z.boolean().optional().default(false).describe("if a get is 404 should we throw or return undefined"),
|
|
38
|
+
couch: import_zod.z.string().describe("the url of the couch db"),
|
|
39
|
+
bindWithRetry: import_zod.z.boolean().optional().default(true).describe("should we bind with retry"),
|
|
40
|
+
maxRetries: import_zod.z.number().optional().default(3).describe("maximum number of retry attempts"),
|
|
41
|
+
initialDelay: import_zod.z.number().optional().default(1e3).describe("initial retry delay in milliseconds"),
|
|
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"),
|
|
44
|
+
logger: LoggerSchema.optional().describe("logging interface supporting winston-like or simple function interface"),
|
|
45
|
+
// _emitter: z.any().optional().describe('emitter for events'),
|
|
46
|
+
_normalizedLogger: import_zod.z.any().optional()
|
|
47
|
+
// Internal property for caching normalized logger
|
|
48
|
+
}).passthrough().describe("The std config object");
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var crud_exports = {};
|
|
20
|
+
__export(crud_exports, {
|
|
21
|
+
CouchDoc: () => CouchDoc,
|
|
22
|
+
CouchDocResponse: () => CouchDocResponse,
|
|
23
|
+
CouchGet: () => CouchGet,
|
|
24
|
+
CouchGetAtRev: () => CouchGetAtRev,
|
|
25
|
+
CouchGetAtRevBound: () => CouchGetAtRevBound,
|
|
26
|
+
CouchGetBound: () => CouchGetBound,
|
|
27
|
+
CouchGetOptions: () => CouchGetOptions,
|
|
28
|
+
CouchGetWithOptions: () => CouchGetWithOptions,
|
|
29
|
+
CouchPut: () => CouchPut,
|
|
30
|
+
CouchPutBound: () => CouchPutBound
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(crud_exports);
|
|
33
|
+
var import_zod = require("zod");
|
|
34
|
+
var import_config = require("./config.cjs");
|
|
35
|
+
const CouchDoc = import_zod.z.object({
|
|
36
|
+
_id: import_zod.z.string().describe("the couch doc id"),
|
|
37
|
+
_rev: import_zod.z.string().optional().nullish().describe("the doc revision"),
|
|
38
|
+
_deleted: import_zod.z.boolean().optional().describe("is the doc deleted")
|
|
39
|
+
}).passthrough();
|
|
40
|
+
const CouchDocResponse = import_zod.z.object({
|
|
41
|
+
ok: import_zod.z.boolean().optional().describe("did the request succeed"),
|
|
42
|
+
error: import_zod.z.string().optional().describe("the error message, if did not succed"),
|
|
43
|
+
statusCode: import_zod.z.number(),
|
|
44
|
+
id: import_zod.z.string().optional().describe("the couch doc id"),
|
|
45
|
+
rev: import_zod.z.string().optional().describe("the new rev of the doc")
|
|
46
|
+
});
|
|
47
|
+
const CouchPut = import_zod.z.function().args(
|
|
48
|
+
import_config.CouchConfig,
|
|
49
|
+
CouchDoc
|
|
50
|
+
).returns(import_zod.z.promise(CouchDocResponse));
|
|
51
|
+
const CouchPutBound = import_zod.z.function().args(
|
|
52
|
+
CouchDoc
|
|
53
|
+
).returns(import_zod.z.promise(CouchDocResponse));
|
|
54
|
+
const CouchGet = import_zod.z.function().args(
|
|
55
|
+
import_config.CouchConfig,
|
|
56
|
+
import_zod.z.string().describe("the couch doc id")
|
|
57
|
+
).returns(import_zod.z.promise(CouchDoc.nullable()));
|
|
58
|
+
const CouchGetBound = import_zod.z.function().args(
|
|
59
|
+
import_zod.z.string().describe("the couch doc id")
|
|
60
|
+
).returns(import_zod.z.promise(CouchDoc.nullable()));
|
|
61
|
+
const CouchGetAtRev = import_zod.z.function().args(
|
|
62
|
+
import_config.CouchConfig,
|
|
63
|
+
import_zod.z.string().describe("the couch doc id"),
|
|
64
|
+
import_zod.z.string().describe("the rev")
|
|
65
|
+
).returns(import_zod.z.promise(CouchDoc.nullable()));
|
|
66
|
+
const CouchGetAtRevBound = import_zod.z.function().args(
|
|
67
|
+
import_zod.z.string().describe("the couch doc id"),
|
|
68
|
+
import_zod.z.string().describe("the rev")
|
|
69
|
+
).returns(import_zod.z.promise(CouchDoc.nullable()));
|
|
70
|
+
const CouchGetOptions = import_zod.z.object({
|
|
71
|
+
rev: import_zod.z.string().optional().describe("the couch doc revision")
|
|
72
|
+
});
|
|
73
|
+
const CouchGetWithOptions = import_zod.z.function().args(
|
|
74
|
+
import_config.CouchConfig,
|
|
75
|
+
import_zod.z.string().describe("the couch doc id"),
|
|
76
|
+
CouchGetOptions
|
|
77
|
+
).returns(import_zod.z.promise(CouchDoc.nullable()));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var patch_exports = {};
|
|
20
|
+
__export(patch_exports, {
|
|
21
|
+
Patch: () => Patch,
|
|
22
|
+
PatchBound: () => PatchBound,
|
|
23
|
+
PatchDangerously: () => PatchDangerously,
|
|
24
|
+
PatchDangerouslyBound: () => PatchDangerouslyBound,
|
|
25
|
+
PatchProperties: () => PatchProperties,
|
|
26
|
+
StrictPatchProperties: () => StrictPatchProperties
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(patch_exports);
|
|
29
|
+
var import_zod = require("zod");
|
|
30
|
+
var import_config = require("./config.cjs");
|
|
31
|
+
var import_crud = require("./crud.cjs");
|
|
32
|
+
const PatchProperties = import_zod.z.record(import_zod.z.string(), import_zod.z.any());
|
|
33
|
+
const StrictPatchProperties = import_zod.z.object({
|
|
34
|
+
_rev: import_zod.z.string()
|
|
35
|
+
}).and(PatchProperties);
|
|
36
|
+
const Patch = import_zod.z.function().args(
|
|
37
|
+
import_config.CouchConfig,
|
|
38
|
+
import_zod.z.string().describe("the couch doc id"),
|
|
39
|
+
StrictPatchProperties
|
|
40
|
+
).returns(import_zod.z.promise(import_crud.CouchDocResponse));
|
|
41
|
+
const PatchBound = import_zod.z.function().args(
|
|
42
|
+
import_zod.z.string().describe("the couch doc id"),
|
|
43
|
+
StrictPatchProperties
|
|
44
|
+
).returns(import_zod.z.promise(import_crud.CouchDocResponse));
|
|
45
|
+
const PatchDangerously = import_zod.z.function().args(
|
|
46
|
+
import_config.CouchConfig,
|
|
47
|
+
import_zod.z.string().describe("the couch doc id"),
|
|
48
|
+
PatchProperties
|
|
49
|
+
).returns(import_zod.z.promise(import_crud.CouchDocResponse));
|
|
50
|
+
const PatchDangerouslyBound = import_zod.z.function().args(
|
|
51
|
+
import_zod.z.string().describe("the couch doc id"),
|
|
52
|
+
PatchProperties
|
|
53
|
+
).returns(import_zod.z.promise(import_crud.CouchDocResponse));
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var query_exports = {};
|
|
20
|
+
__export(query_exports, {
|
|
21
|
+
SimpleViewOptions: () => SimpleViewOptions,
|
|
22
|
+
SimpleViewQuery: () => SimpleViewQuery,
|
|
23
|
+
SimpleViewQueryBound: () => SimpleViewQueryBound,
|
|
24
|
+
SimpleViewQueryResponse: () => SimpleViewQueryResponse,
|
|
25
|
+
ViewRow: () => ViewRow
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(query_exports);
|
|
28
|
+
var import_zod = require("zod");
|
|
29
|
+
var import_config = require("./config.cjs");
|
|
30
|
+
const ViewRow = import_zod.z.object({
|
|
31
|
+
id: import_zod.z.string().optional(),
|
|
32
|
+
key: import_zod.z.any().nullable(),
|
|
33
|
+
value: import_zod.z.any().nullable(),
|
|
34
|
+
doc: import_zod.z.object({}).passthrough().optional().nullish(),
|
|
35
|
+
error: import_zod.z.string().optional().describe("usually not_found, if something is wrong with this doc")
|
|
36
|
+
});
|
|
37
|
+
const SimpleViewQueryResponse = import_zod.z.object({
|
|
38
|
+
error: import_zod.z.string().optional().describe("if something is wrong"),
|
|
39
|
+
rows: import_zod.z.array(ViewRow)
|
|
40
|
+
}).passthrough();
|
|
41
|
+
const SimpleViewOptions = import_zod.z.object({
|
|
42
|
+
startkey: import_zod.z.any().optional(),
|
|
43
|
+
endkey: import_zod.z.any().optional(),
|
|
44
|
+
descending: import_zod.z.boolean().optional().describe("sort results descending"),
|
|
45
|
+
skip: import_zod.z.number().positive().optional().describe("skip this many rows"),
|
|
46
|
+
limit: import_zod.z.number().positive().optional().describe("limit the results to this many rows"),
|
|
47
|
+
key: import_zod.z.any().optional(),
|
|
48
|
+
keys: import_zod.z.array(import_zod.z.any()).optional(),
|
|
49
|
+
include_docs: import_zod.z.boolean().optional().describe("join the id to the doc and return it"),
|
|
50
|
+
reduce: import_zod.z.boolean().optional().describe("reduce the results"),
|
|
51
|
+
group: import_zod.z.boolean().optional().describe("group the results"),
|
|
52
|
+
group_level: import_zod.z.number().positive().optional().describe("group the results at this level")
|
|
53
|
+
}).optional().describe("query options");
|
|
54
|
+
const SimpleViewQuery = import_zod.z.function().args(
|
|
55
|
+
import_config.CouchConfig,
|
|
56
|
+
import_zod.z.string().describe("the view name"),
|
|
57
|
+
SimpleViewOptions
|
|
58
|
+
).returns(import_zod.z.promise(SimpleViewQueryResponse));
|
|
59
|
+
const SimpleViewQueryBound = import_zod.z.function().args(
|
|
60
|
+
import_zod.z.string().describe("the view name"),
|
|
61
|
+
SimpleViewOptions
|
|
62
|
+
).returns(import_zod.z.promise(SimpleViewQueryResponse));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var stream_exports = {};
|
|
20
|
+
__export(stream_exports, {
|
|
21
|
+
OnRow: () => OnRow,
|
|
22
|
+
SimpleViewQueryStream: () => SimpleViewQueryStream,
|
|
23
|
+
SimpleViewQueryStreamBound: () => SimpleViewQueryStreamBound
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(stream_exports);
|
|
26
|
+
var import_zod = require("zod");
|
|
27
|
+
var import_config = require("./config.cjs");
|
|
28
|
+
var import_query = require("./query.cjs");
|
|
29
|
+
const OnRow = import_zod.z.function().args(
|
|
30
|
+
import_query.ViewRow
|
|
31
|
+
);
|
|
32
|
+
const SimpleViewQueryStream = import_zod.z.function().args(
|
|
33
|
+
import_config.CouchConfig,
|
|
34
|
+
import_zod.z.string().describe("the view name"),
|
|
35
|
+
import_query.SimpleViewOptions,
|
|
36
|
+
OnRow
|
|
37
|
+
).returns(import_zod.z.promise(import_zod.z.undefined()));
|
|
38
|
+
const SimpleViewQueryStreamBound = import_zod.z.function().args(
|
|
39
|
+
import_zod.z.string().describe("the view name"),
|
|
40
|
+
import_query.SimpleViewOptions,
|
|
41
|
+
OnRow
|
|
42
|
+
).returns(import_zod.z.promise(import_zod.z.undefined()));
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var lock_exports = {};
|
|
20
|
+
__export(lock_exports, {
|
|
21
|
+
CreateLock: () => CreateLock,
|
|
22
|
+
CreateLockBound: () => CreateLockBound,
|
|
23
|
+
Lock: () => Lock,
|
|
24
|
+
LockOptions: () => LockOptions,
|
|
25
|
+
RemoveLock: () => RemoveLock,
|
|
26
|
+
RemoveLockBound: () => RemoveLockBound
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(lock_exports);
|
|
29
|
+
var import_zod = require("zod");
|
|
30
|
+
var import_config = require("../config.cjs");
|
|
31
|
+
var import_crud = require("../crud.cjs");
|
|
32
|
+
const Lock = import_crud.CouchDoc.extend({
|
|
33
|
+
type: import_zod.z.literal("lock"),
|
|
34
|
+
locks: import_zod.z.string().describe("the document ID being locked"),
|
|
35
|
+
lockedAt: import_zod.z.string().describe("ISO timestamp when lock was created"),
|
|
36
|
+
lockedBy: import_zod.z.string().describe("username of who created the lock")
|
|
37
|
+
});
|
|
38
|
+
const LockOptions = import_zod.z.object({
|
|
39
|
+
enableLocking: import_zod.z.boolean().default(true).describe("whether locking is enabled"),
|
|
40
|
+
username: import_zod.z.string().describe("username to attribute locks to")
|
|
41
|
+
});
|
|
42
|
+
const CreateLock = import_zod.z.function().args(
|
|
43
|
+
import_config.CouchConfig,
|
|
44
|
+
import_zod.z.string().describe("document ID to lock"),
|
|
45
|
+
LockOptions
|
|
46
|
+
).returns(import_zod.z.promise(import_zod.z.boolean()));
|
|
47
|
+
const CreateLockBound = import_zod.z.function().args(
|
|
48
|
+
import_zod.z.string().describe("document ID to lock"),
|
|
49
|
+
LockOptions
|
|
50
|
+
).returns(import_zod.z.promise(import_zod.z.boolean()));
|
|
51
|
+
const RemoveLock = import_zod.z.function().args(
|
|
52
|
+
import_config.CouchConfig,
|
|
53
|
+
import_zod.z.string().describe("document ID to unlock"),
|
|
54
|
+
LockOptions
|
|
55
|
+
).returns(import_zod.z.promise(import_zod.z.void()));
|
|
56
|
+
const RemoveLockBound = import_zod.z.function().args(
|
|
57
|
+
import_zod.z.string().describe("document ID to unlock"),
|
|
58
|
+
LockOptions
|
|
59
|
+
).returns(import_zod.z.promise(import_zod.z.void()));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var watch_exports = {};
|
|
20
|
+
__export(watch_exports, {
|
|
21
|
+
WatchDocs: () => WatchDocs,
|
|
22
|
+
WatchDocsBound: () => WatchDocsBound,
|
|
23
|
+
WatchOptions: () => WatchOptions
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(watch_exports);
|
|
26
|
+
var import_zod = require("zod");
|
|
27
|
+
var import_config = require("../config.cjs");
|
|
28
|
+
var import_changes = require("../changes.cjs");
|
|
29
|
+
const WatchOptions = import_zod.z.object({
|
|
30
|
+
include_docs: import_zod.z.boolean().default(false)
|
|
31
|
+
}).partial();
|
|
32
|
+
const WatchDocs = import_zod.z.function().args(
|
|
33
|
+
import_config.CouchConfig,
|
|
34
|
+
import_zod.z.union([import_zod.z.string(), import_zod.z.array(import_zod.z.string())]),
|
|
35
|
+
import_zod.z.function().args(import_zod.z.any()).returns(import_zod.z.void()),
|
|
36
|
+
WatchOptions
|
|
37
|
+
).returns(import_changes.ChangesEmitter);
|
|
38
|
+
const WatchDocsBound = import_zod.z.function().args(
|
|
39
|
+
import_zod.z.union([import_zod.z.string(), import_zod.z.array(import_zod.z.string())]),
|
|
40
|
+
import_zod.z.function().args(import_zod.z.any()).returns(import_zod.z.void()),
|
|
41
|
+
WatchOptions
|
|
42
|
+
).returns(import_changes.ChangesEmitter);
|
package/impl/bulk.d.mts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @type { import('../schema/bulk.mjs').BulkSaveSchema } */
|
|
2
|
+
export const bulkSave: import("../schema/bulk.mjs").BulkSaveSchema;
|
|
3
|
+
/** @type { import('../schema/bulk.mjs').BulkGetSchema } */
|
|
4
|
+
export const bulkGet: import("../schema/bulk.mjs").BulkGetSchema;
|
|
5
|
+
/** @type { import('../schema/bulk.mjs').BulkRemoveSchema } */
|
|
6
|
+
export const bulkRemove: import("../schema/bulk.mjs").BulkRemoveSchema;
|
|
7
|
+
/** @type { import('../schema/bulk.mjs').BulkGetDictionarySchema } */
|
|
8
|
+
export const bulkGetDictionary: import("../schema/bulk.mjs").BulkGetDictionarySchema;
|
|
9
|
+
/** @type { import('../schema/bulk.mjs').BulkSaveTransactionSchema } bulkSaveTransaction */
|
|
10
|
+
export const bulkSaveTransaction: import("../schema/bulk.mjs").BulkSaveTransactionSchema;
|
|
11
|
+
//# sourceMappingURL=bulk.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk.d.mts","sourceRoot":"","sources":["bulk.mjs"],"names":[],"mappings":"AAkBA,4DAA4D;AAC5D,uBADY,OAAO,oBAAoB,EAAE,cAAc,CAsCrD;AAEF,2DAA2D;AAC3D,sBADY,OAAO,oBAAoB,EAAE,aAAa,CA8BpD;AAIF,8DAA8D;AAC9D,yBADY,OAAO,oBAAoB,EAAE,gBAAgB,CAkBvD;AAEF,qEAAqE;AACrE,gCADY,OAAO,oBAAoB,EAAE,uBAAuB,CAwB9D;AAEF,2FAA2F;AAC3F,kCADY,OAAO,oBAAoB,EAAE,yBAAyB,CAiJhE"}
|
package/impl/bulk.mjs
CHANGED
|
@@ -251,7 +251,7 @@ export const bulkSaveTransaction = BulkSaveTransaction.implement(async (config,
|
|
|
251
251
|
})
|
|
252
252
|
newDocsToRollback.forEach(d => {
|
|
253
253
|
if (!d.id || !d.rev) return
|
|
254
|
-
const before =
|
|
254
|
+
const before = JSON.parse(JSON.stringify(providedDocsById[d.id]))
|
|
255
255
|
before._rev = d.rev
|
|
256
256
|
before._deleted = true
|
|
257
257
|
toRollback.push(before)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @type { import('../schema/changes.mjs').ChangesSchema } */
|
|
2
|
+
export const changes: import("../schema/changes.mjs").ChangesSchema;
|
|
3
|
+
export type ChangeInfo = {
|
|
4
|
+
seq: string | number;
|
|
5
|
+
id: string;
|
|
6
|
+
changes: Array<{
|
|
7
|
+
rev: string;
|
|
8
|
+
}>;
|
|
9
|
+
deleted?: boolean;
|
|
10
|
+
doc?: any;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=changes.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changes.d.mts","sourceRoot":"","sources":["changes.mjs"],"names":[],"mappings":"AAeA,8DAA8D;AAC9D,sBADY,OAAO,uBAAuB,EAAE,aAAa,CAqCvD;yBA/CY;IACT,GAAG,EAAE,MAAM,GAAC,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,GAAG,CAAA;CACV"}
|
package/impl/crud.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** @type { import('../schema/crud.mjs').CouchGetSchema } */
|
|
2
|
+
export const get: import("../schema/crud.mjs").CouchGetSchema;
|
|
3
|
+
/** @type { import('../schema/crud.mjs').CouchGetAtRevSchema } */
|
|
4
|
+
export const getAtRev: import("../schema/crud.mjs").CouchGetAtRevSchema;
|
|
5
|
+
/** @type { import('../schema/crud.mjs').CouchPutSchema } */
|
|
6
|
+
export const put: import("../schema/crud.mjs").CouchPutSchema;
|
|
7
|
+
//# sourceMappingURL=crud.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crud.d.mts","sourceRoot":"","sources":["crud.mjs"],"names":[],"mappings":"AAqDA,4DAA4D;AAC5D,kBADY,OAAO,oBAAoB,EAAE,cAAc,CAIrD;AAEF,iEAAiE;AACjE,uBADY,OAAO,oBAAoB,EAAE,mBAAmB,CAI1D;AAEF,4DAA4D;AAC5D,kBADY,OAAO,oBAAoB,EAAE,cAAc,CAqCrD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} NetworkError
|
|
3
|
+
* @property {string} code - The error code
|
|
4
|
+
* @property {string} [message] - Optional error message
|
|
5
|
+
*/
|
|
6
|
+
export class NotFoundError extends Error {
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} docId - The ID of the document that wasn't found
|
|
9
|
+
* @param {string} [message] - Optional error message
|
|
10
|
+
*/
|
|
11
|
+
constructor(docId: string, message?: string | undefined);
|
|
12
|
+
docId: string;
|
|
13
|
+
}
|
|
14
|
+
export class RetryableError extends Error {
|
|
15
|
+
/**
|
|
16
|
+
* @param {number|undefined} statusCode - The HTTP status code to check
|
|
17
|
+
* @returns {boolean} Whether the status code is retryable
|
|
18
|
+
*/
|
|
19
|
+
static isRetryableStatusCode(statusCode: number | undefined): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @param {NetworkError | unknown} err - The network error to handle
|
|
22
|
+
* @throws {RetryableError} If the error is retryable
|
|
23
|
+
* @throws {Error} If the error is not retryable
|
|
24
|
+
*/
|
|
25
|
+
static handleNetworkError(err: NetworkError | unknown): void;
|
|
26
|
+
/**
|
|
27
|
+
* @param {string} message - The error message
|
|
28
|
+
* @param {number|undefined} statusCode - The HTTP status code
|
|
29
|
+
*/
|
|
30
|
+
constructor(message: string, statusCode: number | undefined);
|
|
31
|
+
statusCode: number | undefined;
|
|
32
|
+
}
|
|
33
|
+
export type NetworkError = {
|
|
34
|
+
/**
|
|
35
|
+
* - The error code
|
|
36
|
+
*/
|
|
37
|
+
code: string;
|
|
38
|
+
/**
|
|
39
|
+
* - Optional error message
|
|
40
|
+
*/
|
|
41
|
+
message?: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=errors.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["errors.mjs"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;IACE;;;OAGG;IACH,mBAHW,MAAM,gCAOhB;IADC,cAAkB;CAErB;AAED;IAWE;;;OAGG;IACH,yCAHW,MAAM,GAAC,SAAS,GACd,OAAO,CAKnB;IAED;;;;OAIG;IACH,+BAJW,YAAY,GAAG,OAAO,QAsBhC;IA1CD;;;OAGG;IACH,qBAHW,MAAM,cACN,MAAM,GAAC,SAAS,EAM1B;IADC,+BAA4B;CAoC/B;;;;;UA5Da,MAAM"}
|