spice-couchbase 2.0.38 → 2.0.40
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/build/index.js +8 -8
- package/package.json +1 -1
- package/src/index.js +17 -21
package/build/index.js
CHANGED
|
@@ -88,24 +88,24 @@ module.exports = class Database {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
setGlobalConnectionObject(
|
|
91
|
+
setGlobalConnectionObject(collection) {
|
|
92
92
|
if (spice.checked_collections == undefined) {
|
|
93
93
|
spice.checked_collections = {};
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
_.set(spice.checked_collections,
|
|
96
|
+
_.set(spice.checked_collections, collection, true);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
checkGlobelConnectionObject(
|
|
99
|
+
checkGlobelConnectionObject(collection) {
|
|
100
100
|
if (spice.checked_collections == undefined) {
|
|
101
101
|
spice.checked_collections = {};
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
if (_.get(spice.checked_collections,
|
|
104
|
+
if (_.get(spice.checked_collections, collection)) {
|
|
105
105
|
return true;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
this.setGlobalConnectionObject(
|
|
108
|
+
this.setGlobalConnectionObject(collection);
|
|
109
109
|
return false;
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -177,9 +177,9 @@ module.exports = class Database {
|
|
|
177
177
|
|
|
178
178
|
return _asyncToGenerator(function* () {
|
|
179
179
|
try {
|
|
180
|
-
var collection_exists = yield _this3.collectionExists(_this3.collection_name, _this3.scope_name);
|
|
181
|
-
|
|
182
180
|
if (!_this3.checkGlobelConnectionObject(_this3.collection_name)) {
|
|
181
|
+
var collection_exists = yield _this3.collectionExists(_this3.collection_name, _this3.scope_name);
|
|
182
|
+
|
|
183
183
|
if (!collection_exists) {
|
|
184
184
|
yield _this3.createCollection(_this3.collection_name, _this3.scope_name);
|
|
185
185
|
yield _this3.wait(2000);
|
|
@@ -476,7 +476,7 @@ module.exports = class Database {
|
|
|
476
476
|
var order_by = arguments.length > 5 ? arguments[5] : undefined;
|
|
477
477
|
var do_count = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : "false";
|
|
478
478
|
var query_scope = arguments.length > 7 ? arguments[7] : undefined;
|
|
479
|
-
var join = arguments.length > 8 ? arguments[8] :
|
|
479
|
+
var join = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : "";
|
|
480
480
|
return _asyncToGenerator(function* () {
|
|
481
481
|
var is_legacy = _this15.scope_name !== "_default" && _this15.collection_name !== "_default";
|
|
482
482
|
var bucket = "`".concat(_this15.use_bucket_name ? _this15.bucket : _this15.collection_name, "`");
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -91,21 +91,21 @@ module.exports = class Database {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
setGlobalConnectionObject(
|
|
94
|
+
setGlobalConnectionObject(collection) {
|
|
95
95
|
if (spice.checked_collections == undefined) {
|
|
96
96
|
spice.checked_collections = {};
|
|
97
97
|
}
|
|
98
|
-
_.set(spice.checked_collections,
|
|
98
|
+
_.set(spice.checked_collections, collection, true);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
checkGlobelConnectionObject(
|
|
101
|
+
checkGlobelConnectionObject(collection) {
|
|
102
102
|
if (spice.checked_collections == undefined) {
|
|
103
103
|
spice.checked_collections = {};
|
|
104
104
|
}
|
|
105
|
-
if (_.get(spice.checked_collections,
|
|
105
|
+
if (_.get(spice.checked_collections, collection)) {
|
|
106
106
|
return true;
|
|
107
107
|
}
|
|
108
|
-
this.setGlobalConnectionObject(
|
|
108
|
+
this.setGlobalConnectionObject(collection);
|
|
109
109
|
return false;
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -173,11 +173,11 @@ module.exports = class Database {
|
|
|
173
173
|
|
|
174
174
|
async upsertCollection() {
|
|
175
175
|
try {
|
|
176
|
-
let collection_exists = await this.collectionExists(
|
|
177
|
-
this.collection_name,
|
|
178
|
-
this.scope_name
|
|
179
|
-
);
|
|
180
176
|
if (!this.checkGlobelConnectionObject(this.collection_name)) {
|
|
177
|
+
let collection_exists = await this.collectionExists(
|
|
178
|
+
this.collection_name,
|
|
179
|
+
this.scope_name
|
|
180
|
+
);
|
|
181
181
|
if (!collection_exists) {
|
|
182
182
|
await this.createCollection(this.collection_name, this.scope_name);
|
|
183
183
|
await this.wait(2000);
|
|
@@ -267,9 +267,8 @@ module.exports = class Database {
|
|
|
267
267
|
|
|
268
268
|
async get(doc_id) {
|
|
269
269
|
try {
|
|
270
|
-
let response = await (
|
|
271
|
-
? this.connection
|
|
272
|
-
: this.collection
|
|
270
|
+
let response = await (
|
|
271
|
+
this.use_bucket_name ? this.connection : this.collection
|
|
273
272
|
).get(doc_id);
|
|
274
273
|
|
|
275
274
|
return { id: doc_id, ...response.content };
|
|
@@ -302,9 +301,8 @@ module.exports = class Database {
|
|
|
302
301
|
}
|
|
303
302
|
|
|
304
303
|
async count(doc_id, adjustment, initial_value) {
|
|
305
|
-
let res = await (
|
|
306
|
-
? this.connection
|
|
307
|
-
: this.collection
|
|
304
|
+
let res = await (
|
|
305
|
+
this.use_bucket_name ? this.connection : this.collection
|
|
308
306
|
).counter(doc_id, adjustment, {
|
|
309
307
|
initial: initial_value,
|
|
310
308
|
});
|
|
@@ -312,17 +310,15 @@ module.exports = class Database {
|
|
|
312
310
|
}
|
|
313
311
|
|
|
314
312
|
async update(doc_id, document) {
|
|
315
|
-
let res = await (
|
|
316
|
-
? this.connection
|
|
317
|
-
: this.collection
|
|
313
|
+
let res = await (
|
|
314
|
+
this.use_bucket_name ? this.connection : this.collection
|
|
318
315
|
).replace(doc_id, document);
|
|
319
316
|
return res.value;
|
|
320
317
|
}
|
|
321
318
|
|
|
322
319
|
async delete(doc_id) {
|
|
323
|
-
let res = await (
|
|
324
|
-
? this.connection
|
|
325
|
-
: this.collection
|
|
320
|
+
let res = await (
|
|
321
|
+
this.use_bucket_name ? this.connection : this.collection
|
|
326
322
|
).remove(doc_id);
|
|
327
323
|
return res.value;
|
|
328
324
|
}
|