@cloudant/couchbackup 2.11.19-SNAPSHOT-438 → 2.11.19-SNAPSHOT-440
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/app.js +13 -17
- package/package.json +2 -2
package/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright © 2017,
|
|
1
|
+
// Copyright © 2017, 2026 IBM Corp. All rights reserved.
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -54,7 +54,7 @@ function isSafePositiveInteger(x) {
|
|
|
54
54
|
* @param {boolean} isIAM - A flag if IAM authentication been used.
|
|
55
55
|
* @returns Boolean true if all checks are passing.
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
function validateURL(url, isIAM) {
|
|
58
58
|
if (typeof url !== 'string') {
|
|
59
59
|
throw new OptionError('Invalid URL, must be type string');
|
|
60
60
|
}
|
|
@@ -83,7 +83,7 @@ async function validateURL(url, isIAM) {
|
|
|
83
83
|
* @param {object} opts - Options.
|
|
84
84
|
* @returns Boolean true if all checks are passing.
|
|
85
85
|
*/
|
|
86
|
-
|
|
86
|
+
function validateOptions(opts) {
|
|
87
87
|
// if we don't have opts then we'll be using defaults
|
|
88
88
|
if (!opts) {
|
|
89
89
|
return true;
|
|
@@ -139,7 +139,7 @@ async function validateOptions(opts) {
|
|
|
139
139
|
*
|
|
140
140
|
* @param {object} opts - Options.
|
|
141
141
|
*/
|
|
142
|
-
|
|
142
|
+
function shallowModeWarnings(opts) {
|
|
143
143
|
if (!opts || opts.mode !== 'shallow') {
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
@@ -161,7 +161,7 @@ async function shallowModeWarnings(opts) {
|
|
|
161
161
|
* @returns Boolean true if all checks are passing.
|
|
162
162
|
*/
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
function validateLogOnResume(opts) {
|
|
165
165
|
const logFileExists = opts && opts.log && fs.existsSync(opts.log);
|
|
166
166
|
if (!opts || opts.mode === 'shallow') {
|
|
167
167
|
// No opts specified, defaults will be populated.
|
|
@@ -190,7 +190,7 @@ async function validateLogOnResume(opts) {
|
|
|
190
190
|
return true;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
function attachmentWarnings(opts) {
|
|
194
194
|
if (opts && opts.attachments) {
|
|
195
195
|
console.warn('WARNING: The "attachments" option is provided as-is and is not supported. ' +
|
|
196
196
|
'This option is for Apache CouchDB only and is experimental. ' +
|
|
@@ -204,22 +204,18 @@ async function attachmentWarnings(opts) {
|
|
|
204
204
|
* @param {string} url - URL of database.
|
|
205
205
|
* @param {object} opts - Options.
|
|
206
206
|
* @param {boolean} backup - true for backup, false for restore
|
|
207
|
-
* @returns
|
|
207
|
+
* @returns {Promise<boolean>} `true` if all checks are passing, otherwise rejected.
|
|
208
208
|
*/
|
|
209
209
|
async function validateArgs(url, opts, isBackup = true) {
|
|
210
210
|
const isIAM = opts && typeof opts.iamApiKey === 'string';
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
attachmentWarnings(opts)
|
|
215
|
-
];
|
|
211
|
+
validateURL(url, isIAM);
|
|
212
|
+
validateOptions(opts);
|
|
213
|
+
attachmentWarnings(opts);
|
|
216
214
|
if (isBackup) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
validateLogOnResume(opts)
|
|
220
|
-
);
|
|
215
|
+
shallowModeWarnings(opts);
|
|
216
|
+
validateLogOnResume(opts);
|
|
221
217
|
}
|
|
222
|
-
return
|
|
218
|
+
return true;
|
|
223
219
|
}
|
|
224
220
|
|
|
225
221
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudant/couchbackup",
|
|
3
|
-
"version": "2.11.19-SNAPSHOT-
|
|
3
|
+
"version": "2.11.19-SNAPSHOT-440",
|
|
4
4
|
"description": "CouchBackup - command-line backup utility for Cloudant/CouchDB",
|
|
5
5
|
"homepage": "https://github.com/IBM/couchbackup",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"neostandard": "0.13.0",
|
|
46
46
|
"nock": "13.5.6",
|
|
47
47
|
"tail": "2.2.6",
|
|
48
|
-
"uuid": "14.0.
|
|
48
|
+
"uuid": "14.0.1"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"lint": "eslint .",
|