@cloudant/couchbackup 2.10.1-SNAPSHOT-209 → 2.10.1-SNAPSHOT-211

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 CHANGED
@@ -243,11 +243,11 @@ async function validateBackupDb(dbClient) {
243
243
  async function validateRestoreDb(dbClient) {
244
244
  try {
245
245
  const response = await dbClient.service.getDatabaseInformation({ db: dbClient.dbName });
246
- const { doc_count: docCount, doc_del_count: deletedDocCount } = response.result;
246
+ const { docCount, docDelCount } = response.result;
247
247
  // The system databases can have a validation ddoc(s) injected in them on creation.
248
248
  // This sets the doc count off, so we just complitely exclude the system databases from this check.
249
249
  // The assumption here is that users restoring system databases know what they are doing.
250
- if (!dbClient.dbName.startsWith('_') && (docCount !== 0 || deletedDocCount !== 0)) {
250
+ if (!dbClient.dbName.startsWith('_') && (docCount !== 0 || docDelCount !== 0)) {
251
251
  throw new BackupError('DatabaseNotEmpty', `Target database ${dbClient.url}${dbClient.dbName} is not empty. A target database must be a new and empty database.`);
252
252
  }
253
253
  // good to use
@@ -111,19 +111,19 @@ class Restore {
111
111
  return { batch, documents: 0 };
112
112
  }
113
113
  mappingDebug(`Restoring batch ${batch} with ${restoreBatch.docs.length} docs.`);
114
- // if we are restoring known revisions, we need to supply new_edits=false
114
+ // if we are restoring known revisions, we need to supply newEdits=false
115
115
  if (restoreBatch.docs[0] && restoreBatch.docs[0]._rev) {
116
- restoreBatch.new_edits = false;
117
- mappingDebug('Using new_edits false mode.');
116
+ restoreBatch.newEdits = false;
117
+ mappingDebug('Using newEdits false mode.');
118
118
  }
119
119
  try {
120
120
  const response = await this.dbClient.service.postBulkDocs({
121
121
  db: this.dbClient.dbName,
122
122
  bulkDocs: restoreBatch
123
123
  });
124
- if (!response.result || (restoreBatch.new_edits === false && response.result.length > 0)) {
124
+ if (!response.result || (restoreBatch.newEdits === false && response.result.length > 0)) {
125
125
  mappingDebug(`Some errors restoring batch ${batch}.`);
126
- throw new Error(`Error writing batch ${batch} with new_edits:${restoreBatch.new_edits !== false}` +
126
+ throw new Error(`Error writing batch ${batch} with newEdits:${restoreBatch.newEdits !== false}` +
127
127
  ` and ${response.result ? response.result.length : 'unavailable'} items`);
128
128
  }
129
129
  mappingDebug(`Successfully restored batch ${batch}.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudant/couchbackup",
3
- "version": "2.10.1-SNAPSHOT-209",
3
+ "version": "2.10.1-SNAPSHOT-211",
4
4
  "description": "CouchBackup - command-line backup utility for Cloudant/CouchDB",
5
5
  "homepage": "https://github.com/IBM/couchbackup",
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "node": "^18 || ^20"
24
24
  },
25
25
  "dependencies": {
26
- "@ibm-cloud/cloudant": "0.8.3",
26
+ "@ibm-cloud/cloudant": "0.9.0",
27
27
  "commander": "12.0.0",
28
28
  "debug": "4.3.4"
29
29
  },