New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

orchestrate

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orchestrate - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

16

lib/client.js

@@ -104,7 +104,8 @@ // Copyright 2013 Bowery Software, LLC

* @param {string} key
* @param {boolean} purge
* @return {Promise}
*/
Client.prototype.remove = function (collection, key) {
Client.prototype.remove = function (collection, key, purge) {
assert(collection && key, 'Collection and key required.')
return this._del(this.generateApiUrl([collection, key]))
return this._del(this.generateApiUrl([collection, key], {purge: purge}))
}

@@ -218,6 +219,7 @@

* @param {Object} header
* @param {String} query
* @return {Promise}
* @protected
*/
Client.prototype._put = function (url, data, header) {
Client.prototype._put = function (url, data, header, query) {
var defer = Q.defer()

@@ -227,2 +229,4 @@ var self = this

header['Content-Type'] = this.contentType
if (query) url += query

@@ -242,6 +246,7 @@ request.put(url, {

* @param {string} url
* @param {String} query
* @return {Promise}
* @protected
*/
Client.prototype._del = function (url) {
Client.prototype._del = function (url, query) {
var defer = Q.defer()

@@ -252,2 +257,5 @@ var self = this

}
if (query) url += query
request.del(url, {

@@ -254,0 +262,0 @@ auth: {user: self._token},

@@ -22,2 +22,32 @@ // Copyright 2013 Bowery Software, LLC

/**
* Get a relationship.
* @return {GraphBuilder}
*/
GraphBuilder.prototype.get = function () {
this._method = 'get'
return this
}
/**
* Create new relationship.
* @return {GraphBuilder}
*/
GraphBuilder.prototype.create = function () {
this._method = 'put'
return this
}
/**
* Delete a relationship.
* @return {GraphBuilder}
*/
GraphBuilder.prototype.remove = function () {
this._method = 'del'
return this
}
/**
* Set graph origin.

@@ -44,3 +74,3 @@ * @param {string} collection

this.kind = kind
if (!this.write) return this._execute('get')
if (!this.write) return this._execute(this._method)
return this

@@ -60,3 +90,3 @@ }

this.toKey = toKey
return this._execute('put')
return this._execute(this._method)
}

@@ -77,3 +107,5 @@

var url = this.getDelegate() && this.getDelegate().generateApiUrl(pathArgs)
return this.getDelegate()['_' + method](url, {})
var query = ''
if (this._method == 'del') query = '?purge=true'
return this.getDelegate()['_' + this._method](url, query)
}

@@ -80,0 +112,0 @@

{
"name": "orchestrate",
"version": "0.0.4",
"version": "0.0.5",
"main": "index",

@@ -5,0 +5,0 @@ "tags": [

@@ -68,2 +68,10 @@ # orchestrate.js

To remove a value:
```javascript
db.remove('collection', 'key', true)
```
The last parameter is optional. If supplied the ref history will be removed as well.
Orchestrate also supports [conditional put statements](https://docs.orchestrate.io/#put-(create/update)) that determines whether or not the store operation will occur. `db.put` takes a fourth argument `match` which is either the `ref` value or `false`. If a ref value is provided an `update` will occur if there is a valid match, if false is provided, a `create` will occur if there is no match.

@@ -117,2 +125,3 @@

db.newGraphBuilder()
.create()
.from('users', 'Steve')

@@ -126,2 +135,3 @@ .related('likes')

db.newGraphReader()
.get()
.from('users', 'Steve')

@@ -134,2 +144,3 @@ .related('likes')

db.newGraphReader()
.get()
.from('users', 'Steve')

@@ -140,2 +151,11 @@ .related('friends', 'likes')

If we want to delete a graph relationship:
```javascript
db.newGraphBuilder()
.remove()
.from('users', 'Steve')
.related('likes')
.to('movies', 'Superbad')
```
## Events

@@ -142,0 +162,0 @@ Events are time-ordered objects that exist with the context of a Key-Value object. Consider comments on a post or messages in a thread.

@@ -41,2 +41,4 @@ // Copyright 2013 Bowery Software, LLC

.reply(204)
.delete('/v0/users/sjkaliski%40gmail.com/relation/likes/movies/Superbad?purge=true')
.reply(204)

@@ -46,2 +48,3 @@ suite('Graph', function () {

db.newGraphReader()
.get()
.from('users', 'sjkaliski@gmail.com')

@@ -57,2 +60,3 @@ .related('likes')

db.newGraphBuilder()
.create()
.from('users', 'sjkaliski@gmail.com')

@@ -66,2 +70,14 @@ .related('likes')

})
test('Delete a graph relationship', function (done) {
db.newGraphBuilder()
.remove()
.from('users', 'sjkaliski@gmail.com')
.related('likes')
.to('movies', 'Superbad')
.then(function (res) {
assert.equal(res.statusCode, 204)
done()
})
})
})

@@ -48,2 +48,4 @@ // Copyright 2013 Bowery Software, LLC

.reply(204)
.delete('/v0/users/byrd%40bowery.io?purge=true')
.reply(204)

@@ -92,2 +94,10 @@ suite('Key-Value', function () {

})
test('Remove value by key and purge', function (done) {
db.remove('users', 'byrd@bowery.io', true)
.then(function (res) {
assert.equal(204, res.statusCode)
done()
})
})
})
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