Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

couchdb_utilities

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

couchdb_utilities - npm Package Compare versions

Comparing version 1.0.9-prerelease to 1.0.10-prerelease

49

index.js

@@ -69,2 +69,13 @@ exports.printMsg = function() {

exports.deleteDatabase = function ( couchURL, databaseName ) {
var couchDBURL = couchURL + "/" + databaseName;
Obj = this.callURL("DELETE", couchDBURL, null );
if ( JSON.parse( Obj.responseString).ok == true ) {
return true;
} else {
return false;
}
};
exports.getDatabaseDetails = function ( couchURL, databaseName ) {

@@ -88,4 +99,38 @@ var couchDBURL = couchURL + "/" + databaseName;

// Design Document Utilities
exports.getDocumentbyID = function ( couchURL, databaseName, docID ) {
var couchDBURL = couchURL + "/" + databaseName + "/" + docID;
Obj = this.returnObjfromURL(couchDBURL);
return JSON.parse(Obj.responseString);
};
exports.createDocument = function ( couchURL, databaseName, document ) {
var couchDBURL = couchURL + "/" + databaseName;
var jsonPayload = {
json: document
};
Obj = this.callURL("POST", couchDBURL, document );
if ( JSON.parse( Obj.responseString).ok == true ) {
return true;
} else {
return false;
}
};
exports.deleteDocument = function ( couchURL, databaseName, docID ) {
var couchDBURL = couchURL + "/" + databaseName;
// var document = this.getDocumentbyID( couchURL, databaseName, docID );
var rev = this.getDocumentbyID( couchURL, databaseName, docID )._rev;
couchDBURL = couchURL + "/" + databaseName + "/" + docID + "?rev=" + rev;
Obj = this.callURL("DELETE", couchDBURL, null );
if ( JSON.parse( Obj.responseString).ok == true ) {
return true;
} else {
return false;
}
};

@@ -118,3 +163,5 @@ // Internal Methods

var syncRequest = require('sync-request');
var jsonPayload = { json: Payload };
var jsonPayload = {
json: JSON.parse( Payload )
};

@@ -121,0 +168,0 @@ returnObj.startTime = (new Date).getTime();

11

package.json
{
"name": "couchdb_utilities",
"version": "v1.0.9prerelease",
"description": "This package will help you sync the design documents from one couchdb to another",
"version": "v1.0.10prerelease",
"description": "This package contains utilties to use and support couchdb environments.",
"main": "index.js",

@@ -9,3 +9,8 @@ "scripts": {

},
"author": "",
"author": {
"name": "Hari Vetsa"
},
"bugs": {
"url": "https://github.com/hvetsa/couchdb_utilities"
},
"license": "ISC",

@@ -12,0 +17,0 @@ "dependencies": {

@@ -13,11 +13,11 @@ # Module under development.

```
var Boolean = couchUtils.validateConnection ( "http://0.0.0.0:5984" ) );
var Boolean = couchUtils.validateConnection ( couchURL ) );
```
#### Validate the input connection string
```
var String = couchUtils.getServerVersion ( "http://0.0.0.0:5984" ) );
var String = couchUtils.getServerVersion ( couchURL ) );
```
#### Validate the input connection string
```
var String = couchUtils.responseDuration ( "http://0.0.0.0:5984" ) );
var String = couchUtils.responseDuration ( couchURL ) );
```

@@ -28,15 +28,19 @@

```
var Array = couchUtils.listDatabases( "http://0.0.0.0:5984" ) );
var Array = couchUtils.listDatabases( couchURL ) );
```
#### Check if a database exists in the target
```
var Boolean = couchUtils.databaseExists( "http://0.0.0.0:5984", "test" ) );
var Boolean = couchUtils.databaseExists( couchURL, "test" ) );
```
#### Create a database in target
```
var Boolean = couchUtils.createDatabase( "http://0.0.0.0:5984", "test" ) );
var Boolean = couchUtils.createDatabase( couchURL, "test" ) );
```
#### Delete a database in target
```
var Boolean = couchUtils.deleteDatabase( couchURL, "test" ) );
```
#### Obtain details of a database
```
var Object = couchUtils.getDatabaseDetails( "http://0.0.0.0:5984", "test" ) );
var Object = couchUtils.getDatabaseDetails( couchURL, "test" ) );
```

@@ -46,11 +50,26 @@

```
var Array = couchUtils.getDesignDocuments = function ( couchURL, databaseName ) {
var Array = couchUtils.getDesignDocuments ( couchURL, databaseName ) {
```
### Document Utilities
#### get a document by ID
```
var Object = couchUtils.getDocumentbyID ( couchURL, databaseName, docID ) {
```
#### create a Document
```
var Boolean = couchUtils.createDocument( couchURL, databaseName, jsonString ) {
```
#### delete a Document
```
var Boolean = couchUtils.deleteDocument( couchURL, databaseName, docID ) {
```
#### Check if the view exist
### Design Docs
#### Create view
#### Get design Docs in a db
#### Check Views in target
#### Delete design docs in target db
#### Create Design docs in target
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc