hide-a-bed 5.2.1 → 5.2.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 +12 -6
- package/cjs/impl/crud.cjs +12 -6
- package/cjs/impl/util.cjs +6 -6
- package/impl/bulk.d.mts.map +1 -1
- package/impl/bulk.mjs +12 -7
- package/impl/crud.d.mts.map +1 -1
- package/impl/crud.mjs +12 -7
- package/impl/util.d.mts.map +1 -1
- package/impl/util.mjs +6 -7
- package/package.json +2 -2
- package/schema/util.mjs +1 -1
package/cjs/impl/bulk.cjs
CHANGED
|
@@ -44,12 +44,6 @@ var import_transactionErrors = require("./transactionErrors.cjs");
|
|
|
44
44
|
var import_logger = require("./logger.cjs");
|
|
45
45
|
var import_crud2 = require("../schema/crud.cjs");
|
|
46
46
|
var import_trackedEmitter = require("./trackedEmitter.cjs");
|
|
47
|
-
const opts = {
|
|
48
|
-
json: true,
|
|
49
|
-
headers: {
|
|
50
|
-
"Content-Type": "application/json"
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
47
|
const bulkSave = import_bulk.BulkSave.implement(async (config, docs) => {
|
|
54
48
|
const logger = (0, import_logger.createLogger)(config);
|
|
55
49
|
if (!docs) {
|
|
@@ -63,6 +57,12 @@ const bulkSave = import_bulk.BulkSave.implement(async (config, docs) => {
|
|
|
63
57
|
logger.info(`Starting bulk save of ${docs.length} documents`);
|
|
64
58
|
const url = `${config.couch}/_bulk_docs`;
|
|
65
59
|
const body = { docs };
|
|
60
|
+
const opts = {
|
|
61
|
+
json: true,
|
|
62
|
+
headers: {
|
|
63
|
+
"Content-Type": "application/json"
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
66
|
let resp;
|
|
67
67
|
try {
|
|
68
68
|
resp = await (0, import_needle.default)("post", url, body, opts);
|
|
@@ -91,6 +91,12 @@ const bulkGet = import_bulk.BulkGet.implement(async (config, ids) => {
|
|
|
91
91
|
logger.info(`Starting bulk get for ${keys.length} documents`);
|
|
92
92
|
const url = `${config.couch}/_all_docs?include_docs=true`;
|
|
93
93
|
const payload = { keys };
|
|
94
|
+
const opts = {
|
|
95
|
+
json: true,
|
|
96
|
+
headers: {
|
|
97
|
+
"Content-Type": "application/json"
|
|
98
|
+
}
|
|
99
|
+
};
|
|
94
100
|
let resp;
|
|
95
101
|
try {
|
|
96
102
|
resp = await (0, import_needle.default)("post", url, payload, opts);
|
package/cjs/impl/crud.cjs
CHANGED
|
@@ -37,17 +37,17 @@ var import_needle = __toESM(require("needle"), 1);
|
|
|
37
37
|
var import_crud = require("../schema/crud.cjs");
|
|
38
38
|
var import_errors = require("./errors.cjs");
|
|
39
39
|
var import_logger = require("./logger.cjs");
|
|
40
|
-
const opts = {
|
|
41
|
-
json: true,
|
|
42
|
-
headers: {
|
|
43
|
-
"Content-Type": "application/json"
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
40
|
const _getWithOptions = import_crud.CouchGetWithOptions.implement(async (config, id, getOpts) => {
|
|
47
41
|
const logger = (0, import_logger.createLogger)(config);
|
|
48
42
|
const rev = getOpts?.rev;
|
|
49
43
|
const path = rev ? `${id}?rev=${rev}` : id;
|
|
50
44
|
const url = `${config.couch}/${path}`;
|
|
45
|
+
const opts = {
|
|
46
|
+
json: true,
|
|
47
|
+
headers: {
|
|
48
|
+
"Content-Type": "application/json"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
51
|
logger.info(`Getting document with id: ${id}, rev ${rev || "latest"}`);
|
|
52
52
|
try {
|
|
53
53
|
const resp = await (0, import_needle.default)("get", url, opts);
|
|
@@ -92,6 +92,12 @@ const put = import_crud.CouchPut.implement(async (config, doc) => {
|
|
|
92
92
|
const logger = (0, import_logger.createLogger)(config);
|
|
93
93
|
const url = `${config.couch}/${doc._id}`;
|
|
94
94
|
const body = doc;
|
|
95
|
+
const opts = {
|
|
96
|
+
json: true,
|
|
97
|
+
headers: {
|
|
98
|
+
"Content-Type": "application/json"
|
|
99
|
+
}
|
|
100
|
+
};
|
|
95
101
|
logger.info(`Putting document with id: ${doc._id}`);
|
|
96
102
|
let resp;
|
|
97
103
|
try {
|
package/cjs/impl/util.cjs
CHANGED
|
@@ -35,15 +35,15 @@ var import_needle = __toESM(require("needle"), 1);
|
|
|
35
35
|
var import_errors = require("./errors.cjs");
|
|
36
36
|
var import_logger = require("./logger.cjs");
|
|
37
37
|
var import_util = require("../schema/util.cjs");
|
|
38
|
-
const opts = {
|
|
39
|
-
json: true,
|
|
40
|
-
headers: {
|
|
41
|
-
"Content-Type": "application/json"
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
38
|
const getDBInfo = import_util.GetDBInfo.implement(async (config) => {
|
|
45
39
|
const logger = (0, import_logger.createLogger)(config);
|
|
46
40
|
const url = `${config.couch}`;
|
|
41
|
+
const opts = {
|
|
42
|
+
json: true,
|
|
43
|
+
headers: {
|
|
44
|
+
"Content-Type": "application/json"
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
47
|
let resp;
|
|
48
48
|
try {
|
|
49
49
|
resp = await (0, import_needle.default)("get", url, opts);
|
package/impl/bulk.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.d.mts","sourceRoot":"","sources":["bulk.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bulk.d.mts","sourceRoot":"","sources":["bulk.mjs"],"names":[],"mappings":"AAWA,4DAA4D;AAC5D,uBADY,OAAO,oBAAoB,EAAE,cAAc,CA4CrD;AAEF,2DAA2D;AAC3D,sBADY,OAAO,oBAAoB,EAAE,aAAa,CAoCpD;AAIF,8DAA8D;AAC9D,yBADY,OAAO,oBAAoB,EAAE,gBAAgB,CAkBvD;AAEF,qEAAqE;AACrE,gCADY,OAAO,oBAAoB,EAAE,uBAAuB,CAwB9D;AAEF,2FAA2F;AAC3F,kCADY,OAAO,oBAAoB,EAAE,yBAAyB,CAiJhE"}
|
package/impl/bulk.mjs
CHANGED
|
@@ -9,13 +9,6 @@ import { createLogger } from './logger.mjs'
|
|
|
9
9
|
import { CouchDoc } from '../schema/crud.mjs'
|
|
10
10
|
import { setupEmitter } from './trackedEmitter.mjs'
|
|
11
11
|
|
|
12
|
-
const opts = {
|
|
13
|
-
json: true,
|
|
14
|
-
headers: {
|
|
15
|
-
'Content-Type': 'application/json'
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
12
|
/** @type { import('../schema/bulk.mjs').BulkSaveSchema } */
|
|
20
13
|
export const bulkSave = BulkSave.implement(async (config, docs) => {
|
|
21
14
|
/** @type {import('./logger.mjs').Logger } */
|
|
@@ -33,6 +26,12 @@ export const bulkSave = BulkSave.implement(async (config, docs) => {
|
|
|
33
26
|
logger.info(`Starting bulk save of ${docs.length} documents`)
|
|
34
27
|
const url = `${config.couch}/_bulk_docs`
|
|
35
28
|
const body = { docs }
|
|
29
|
+
const opts = {
|
|
30
|
+
json: true,
|
|
31
|
+
headers: {
|
|
32
|
+
'Content-Type': 'application/json'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
36
35
|
let resp
|
|
37
36
|
try {
|
|
38
37
|
resp = await needle('post', url, body, opts)
|
|
@@ -64,6 +63,12 @@ export const bulkGet = BulkGet.implement(async (config, ids) => {
|
|
|
64
63
|
logger.info(`Starting bulk get for ${keys.length} documents`)
|
|
65
64
|
const url = `${config.couch}/_all_docs?include_docs=true`
|
|
66
65
|
const payload = { keys }
|
|
66
|
+
const opts = {
|
|
67
|
+
json: true,
|
|
68
|
+
headers: {
|
|
69
|
+
'Content-Type': 'application/json'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
67
72
|
let resp
|
|
68
73
|
try {
|
|
69
74
|
resp = await needle('post', url, payload, opts)
|
package/impl/crud.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud.d.mts","sourceRoot":"","sources":["crud.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"crud.d.mts","sourceRoot":"","sources":["crud.mjs"],"names":[],"mappings":"AAoDA,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,CA2CrD"}
|
package/impl/crud.mjs
CHANGED
|
@@ -4,19 +4,18 @@ import { CouchGet, CouchPut, CouchGetWithOptions, CouchGetAtRev } from '../schem
|
|
|
4
4
|
import { RetryableError, NotFoundError } from './errors.mjs'
|
|
5
5
|
import { createLogger } from './logger.mjs'
|
|
6
6
|
|
|
7
|
-
const opts = {
|
|
8
|
-
json: true,
|
|
9
|
-
headers: {
|
|
10
|
-
'Content-Type': 'application/json'
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
7
|
/** @type { import('../schema/crud.mjs').CouchGetWithOptionsSchema } */
|
|
15
8
|
const _getWithOptions = CouchGetWithOptions.implement(async (config, id, getOpts) => {
|
|
16
9
|
const logger = createLogger(config)
|
|
17
10
|
const rev = getOpts?.rev
|
|
18
11
|
const path = rev ? `${id}?rev=${rev}` : id
|
|
19
12
|
const url = `${config.couch}/${path}`
|
|
13
|
+
const opts = {
|
|
14
|
+
json: true,
|
|
15
|
+
headers: {
|
|
16
|
+
'Content-Type': 'application/json'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
20
19
|
logger.info(`Getting document with id: ${id}, rev ${rev || 'latest'}`)
|
|
21
20
|
|
|
22
21
|
try {
|
|
@@ -68,6 +67,12 @@ export const put = CouchPut.implement(async (config, doc) => {
|
|
|
68
67
|
const logger = createLogger(config)
|
|
69
68
|
const url = `${config.couch}/${doc._id}`
|
|
70
69
|
const body = doc
|
|
70
|
+
const opts = {
|
|
71
|
+
json: true,
|
|
72
|
+
headers: {
|
|
73
|
+
'Content-Type': 'application/json'
|
|
74
|
+
}
|
|
75
|
+
}
|
|
71
76
|
|
|
72
77
|
logger.info(`Putting document with id: ${doc._id}`)
|
|
73
78
|
let resp
|
package/impl/util.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.mts","sourceRoot":"","sources":["util.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.mts","sourceRoot":"","sources":["util.mjs"],"names":[],"mappings":"AAMA,4DAA4D;AAC5D,wBADY,OAAO,oBAAoB,EAAE,eAAe,CA4BtD"}
|
package/impl/util.mjs
CHANGED
|
@@ -4,17 +4,16 @@ import { RetryableError, NotFoundError } from './errors.mjs'
|
|
|
4
4
|
import { createLogger } from './logger.mjs'
|
|
5
5
|
import { GetDBInfo } from '../schema/util.mjs'
|
|
6
6
|
|
|
7
|
-
const opts = {
|
|
8
|
-
json: true,
|
|
9
|
-
headers: {
|
|
10
|
-
'Content-Type': 'application/json'
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
7
|
/** @type { import('../schema/util.mjs').GetDBInfoSchema} */
|
|
15
8
|
export const getDBInfo = GetDBInfo.implement(async (config) => {
|
|
16
9
|
const logger = createLogger(config)
|
|
17
10
|
const url = `${config.couch}`
|
|
11
|
+
const opts = {
|
|
12
|
+
json: true,
|
|
13
|
+
headers: {
|
|
14
|
+
'Content-Type': 'application/json'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
18
17
|
let resp
|
|
19
18
|
try {
|
|
20
19
|
resp = await needle('get', url, opts)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hide-a-bed",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2",
|
|
4
4
|
"description": "An abstraction over couchdb calls that includes easy mock/stubs with pouchdb",
|
|
5
5
|
"module": "index.mjs",
|
|
6
6
|
"main": "cjs/index.cjs",
|
|
@@ -58,4 +58,4 @@
|
|
|
58
58
|
"node": "20.17.0",
|
|
59
59
|
"npm": "10.8.2"
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
}
|
package/schema/util.mjs
CHANGED