Socket
Socket
Sign inDemoInstall

sinopia

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinopia - npm Package Compare versions

Comparing version 1.2.2 to 1.3.0

4

History.md
10 May 2015, version 1.3.0
- add dist-tags endpoints (issue [#211](https://github.com/rlidwka/sinopia/issues/211))
22 Apr 2015, version 1.2.2

@@ -3,0 +7,0 @@

@@ -173,4 +173,3 @@ var async = require('async')

// tagging a package
app.put('/:package/:tag', can('publish'), media('application/json'), function(req, res, next) {
function tag_package_version(req, res, next) {
if (typeof(req.body) !== 'string') return next('route')

@@ -180,3 +179,3 @@

tags[req.params.tag] = req.body
storage.add_tags(req.params.package, tags, function(err) {
storage.merge_tags(req.params.package, tags, function(err) {
if (err) return next(err)

@@ -186,4 +185,65 @@ res.status(201)

})
}
// tagging a package
app.put('/:package/:tag',
can('publish'), media('application/json'), tag_package_version)
app.post('/-/package/:package/dist-tags/:tag',
can('publish'), media('application/json'), tag_package_version)
app.put('/-/package/:package/dist-tags/:tag',
can('publish'), media('application/json'), tag_package_version)
app.delete('/-/package/:package/dist-tags/:tag', can('publish'), function (req, res, next) {
var tags = {}
tags[req.params.tag] = null
storage.merge_tags(req.params.package, tags, function(err) {
if (err) return next(err)
res.status(201)
return next({ ok: 'tag removed' })
})
})
app.get('/-/package/:package/dist-tags', can('access'), function(req, res, next) {
storage.get_package(req.params.package, { req: req }, function(err, info) {
if (err) return next(err)
next(info['dist-tags'])
})
})
app.post('/-/package/:package/dist-tags',
can('publish'), media('application/json'), expect_json,
function(req, res, next) {
storage.merge_tags(req.params.package, req.body, function(err) {
if (err) return next(err)
res.status(201)
return next({ ok: 'tags updated' })
})
})
app.put('/-/package/:package/dist-tags',
can('publish'), media('application/json'), expect_json,
function(req, res, next) {
storage.replace_tags(req.params.package, req.body, function(err) {
if (err) return next(err)
res.status(201)
return next({ ok: 'tags updated' })
})
})
app.delete('/-/package/:package/dist-tags',
can('publish'), media('application/json'),
function(req, res, next) {
storage.replace_tags(req.params.package, {}, function(err) {
if (err) return next(err)
res.status(201)
return next({ ok: 'tags removed' })
})
})
// publishing a package

@@ -277,3 +337,3 @@ app.put('/:package/:_rev?/:revision?', can('publish'), media('application/json'), expect_json, function(req, res, next) {

function add_tags(tags, cb) {
storage.add_tags(name, tags, cb)
storage.merge_tags(name, tags, cb)
}

@@ -280,0 +340,0 @@ })

@@ -254,3 +254,3 @@ var assert = require('assert')

Storage.prototype.add_tags = function(name, tags, callback) {
Storage.prototype.merge_tags = function(name, tags, callback) {
var self = this

@@ -260,2 +260,7 @@

for (var t in tags) {
if (tags[t] === null) {
delete data['dist-tags'][t]
continue
}
if (data.versions[tags[t]] == null) {

@@ -271,2 +276,24 @@ return cb( Error[404]("this version doesn't exist") )

Storage.prototype.replace_tags = function(name, tags, callback) {
var self = this
self.update_package(name, function updater(data, cb) {
data['dist-tags'] = {}
for (var t in tags) {
if (tags[t] === null) {
delete data['dist-tags'][t]
continue
}
if (data.versions[tags[t]] == null) {
return cb( Error[404]("this version doesn't exist") )
}
Utils.tag_version(data, tags[t], t, self.config)
}
cb()
}, callback)
}
// currently supports unpublishing only

@@ -273,0 +300,0 @@ Storage.prototype.change_package = function(name, metadata, revision, callback) {

@@ -113,7 +113,16 @@ var assert = require('assert')

//
Storage.prototype.add_tags = function(name, tag_hash, callback) {
return this.local.add_tags(name, tag_hash, callback)
Storage.prototype.merge_tags = function(name, tag_hash, callback) {
return this.local.merge_tags(name, tag_hash, callback)
}
//
// Tags a package version with a provided tag
//
// Used storages: local (write)
//
Storage.prototype.replace_tags = function(name, tag_hash, callback) {
return this.local.replace_tags(name, tag_hash, callback)
}
//
// Change an existing package (i.e. unpublish one version)

@@ -120,0 +129,0 @@ //

87

npm-shrinkwrap.json
{
"name": "sinopia",
"version": "1.2.2",
"version": "1.3.0",
"dependencies": {

@@ -9,3 +9,3 @@ "async": {

"body-parser": {
"version": "1.12.2",
"version": "1.12.3",
"dependencies": {

@@ -30,6 +30,6 @@ "bytes": {

"iconv-lite": {
"version": "0.4.7"
"version": "0.4.8"
},
"on-finished": {
"version": "2.2.0",
"version": "2.2.1",
"dependencies": {

@@ -45,3 +45,3 @@ "ee-first": {

"raw-body": {
"version": "1.3.3"
"version": "1.3.4"
},

@@ -55,6 +55,6 @@ "type-is": {

"mime-types": {
"version": "2.0.10",
"version": "2.0.11",
"dependencies": {
"mime-db": {
"version": "1.8.0"
"version": "1.9.1"
}

@@ -68,3 +68,3 @@ }

"bunyan": {
"version": "1.3.4",
"version": "1.3.5",
"dependencies": {

@@ -96,3 +96,3 @@ "dtrace-provider": {

"commander": {
"version": "2.7.1",
"version": "2.8.1",
"dependencies": {

@@ -108,9 +108,9 @@ "graceful-readlink": {

"accepts": {
"version": "1.2.5",
"version": "1.2.6",
"dependencies": {
"mime-types": {
"version": "2.0.10",
"version": "2.0.11",
"dependencies": {
"mime-db": {
"version": "1.8.0"
"version": "1.9.1"
}

@@ -120,3 +120,3 @@ }

"negotiator": {
"version": "0.5.1"
"version": "0.5.2"
}

@@ -132,3 +132,3 @@ }

"mime-db": {
"version": "1.8.0"
"version": "1.9.1"
}

@@ -162,6 +162,6 @@ }

"crypt3": {
"version": "0.1.7",
"version": "0.1.8",
"dependencies": {
"nan": {
"version": "1.7.0"
"version": "1.8.4"
}

@@ -180,6 +180,6 @@ }

"mime-types": {
"version": "2.0.10",
"version": "2.0.11",
"dependencies": {
"mime-db": {
"version": "1.8.0"
"version": "1.9.1"
}

@@ -285,6 +285,6 @@ }

"mime-types": {
"version": "2.0.10",
"version": "2.0.11",
"dependencies": {
"mime-db": {
"version": "1.8.0"
"version": "1.9.1"
}

@@ -313,3 +313,3 @@ }

"raw-body": {
"version": "1.3.3",
"version": "1.3.4",
"dependencies": {

@@ -320,3 +320,3 @@ "bytes": {

"iconv-lite": {
"version": "0.4.7"
"version": "0.4.8"
}

@@ -342,3 +342,3 @@ }

"wordwrap": {
"version": "0.0.2"
"version": "0.0.3"
}

@@ -383,3 +383,3 @@ }

"js-yaml": {
"version": "3.2.7",
"version": "3.3.0",
"dependencies": {

@@ -390,3 +390,3 @@ "argparse": {

"lodash": {
"version": "3.6.0"
"version": "3.8.0"
},

@@ -399,3 +399,3 @@ "sprintf-js": {

"esprima": {
"version": "2.0.0"
"version": "2.2.0"
}

@@ -405,3 +405,3 @@ }

"lunr": {
"version": "0.5.8"
"version": "0.5.9"
},

@@ -412,3 +412,3 @@ "minimatch": {

"lru-cache": {
"version": "2.5.2"
"version": "2.6.2"
},

@@ -432,3 +432,3 @@ "sigmund": {

"markdown-it": {
"version": "4.1.0",
"version": "4.2.1",
"dependencies": {

@@ -439,3 +439,3 @@ "argparse": {

"lodash": {
"version": "3.6.0"
"version": "3.8.0"
},

@@ -451,3 +451,3 @@ "sprintf-js": {

"linkify-it": {
"version": "1.0.0"
"version": "1.1.0"
},

@@ -513,3 +513,3 @@ "mdurl": {

"lodash": {
"version": "2.4.1"
"version": "2.4.2"
},

@@ -561,6 +561,6 @@ "regexp-quote": {

"mime-types": {
"version": "2.0.10",
"version": "2.0.11",
"dependencies": {
"mime-db": {
"version": "1.8.0"
"version": "1.9.1"
}

@@ -573,3 +573,3 @@ }

"qs": {
"version": "2.4.1"
"version": "2.4.2"
},

@@ -580,8 +580,3 @@ "tunnel-agent": {

"tough-cookie": {
"version": "0.12.1",
"dependencies": {
"punycode": {
"version": "1.3.2"
}
}
"version": "1.1.0"
},

@@ -609,6 +604,6 @@ "http-signature": {

"hoek": {
"version": "2.12.0"
"version": "2.13.0"
},
"boom": {
"version": "2.7.0"
"version": "2.7.1"
},

@@ -641,6 +636,6 @@ "cryptiles": {

"har-validator": {
"version": "1.6.1",
"version": "1.7.0",
"dependencies": {
"bluebird": {
"version": "2.9.24"
"version": "2.9.25"
},

@@ -707,3 +702,3 @@ "chalk": {

"semver": {
"version": "4.3.3"
"version": "4.3.4"
},

@@ -710,0 +705,0 @@ "sinopia-htpasswd": {

@@ -1,1 +0,1 @@

{"name":"sinopia","version":"1.2.2","description":"Private npm repository server","author":{"name":"Alex Kocharin","email":"alex@kocharin.ru"},"repository":{"type":"git","url":"git://github.com/rlidwka/sinopia"},"main":"index.js","bin":{"sinopia":"./bin/sinopia"},"dependencies":{"express":">=5.0.0-0 <6.0.0-0","express-json5":">=0.1.0 <1.0.0-0","body-parser":">=1.9.2 <2.0.0-0","compression":">=1.2.0 <2.0.0-0","commander":">=2.3.0 <3.0.0-0","js-yaml":">=3.0.1 <4.0.0-0","cookies":">=0.5.0 <1.0.0-0","request":">=2.31.0 <3.0.0-0","async":">=0.9.0 <1.0.0-0","es6-shim":"0.21.x","semver":">=2.2.1 <5.0.0-0","minimatch":">=0.2.14 <2.0.0-0","bunyan":">=0.22.1 <2.0.0-0","handlebars":"2.x","highlight.js":"8.x","lunr":">=0.5.2 <1.0.0-0","render-readme":">=0.2.1","jju":"1.x","mkdirp":">=0.3.5 <1.0.0-0","sinopia-htpasswd":">= 0.4.3","http-errors":">=1.2.0"},"optionalDependencies":{"fs-ext":">=0.4.1 <1.0.0-0","crypt3":">=0.1.6 <1.0.0-0"},"devDependencies":{"rimraf":">=2.2.5 <3.0.0-0","bluebird":"2 >=2.9","mocha":"2 >=2.2.3","eslint":">= 0.18","browserify":"7.x","browserify-handlebars":"1.x","grunt":">=0.4.4 <1.0.0-0","grunt-cli":"*","grunt-browserify":">=2.0.8 <3.0.0-0","grunt-contrib-less":">=0.11.0 <1.0.0-0","grunt-contrib-watch":">=0.6.1 <1.0.0-0","unopinionate":">=0.0.4 <1.0.0-0","onclick":">=0.1.0 <1.0.0-0","transition-complete":">=0.0.2 <1.0.0-0"},"keywords":["private","package","repository","registry","modules","proxy","server"],"scripts":{"test":"eslint --reset . && mocha ./test/functional ./test/unit","test-travis":"eslint --reset . && mocha -R spec ./test/functional ./test/unit","test-only":"mocha ./test/functional ./test/unit","lint":"eslint --reset .","prepublish":"js-yaml package.yaml > package.json","clean-shrinkwrap":"node -e '\n function clean(j) {\n if (!j) return\n for (var k in j) {\n delete j[k].from\n delete j[k].resolved\n if (j[k].dependencies) clean(j[k].dependencies)\n }\n }\n x = JSON.parse(require(\"fs\").readFileSync(\"./npm-shrinkwrap.json\"))\n clean(x.dependencies)\n x = JSON.stringify(x, null, \" \")\n require(\"fs\").writeFileSync(\"./npm-shrinkwrap.json\", x + \"\\n\")\n'\n"},"engines":{"node":">=0.10"},"preferGlobal":true,"publishConfig":{"registry":"https://registry.npmjs.org/"},"license":{"type":"WTFPL","url":"http://www.wtfpl.net/txt/copying/"}}
{"name":"sinopia","version":"1.3.0","description":"Private npm repository server","author":{"name":"Alex Kocharin","email":"alex@kocharin.ru"},"repository":{"type":"git","url":"git://github.com/rlidwka/sinopia"},"main":"index.js","bin":{"sinopia":"./bin/sinopia"},"dependencies":{"express":">=5.0.0-0 <6.0.0-0","express-json5":">=0.1.0 <1.0.0-0","body-parser":">=1.9.2 <2.0.0-0","compression":">=1.2.0 <2.0.0-0","commander":">=2.3.0 <3.0.0-0","js-yaml":">=3.0.1 <4.0.0-0","cookies":">=0.5.0 <1.0.0-0","request":">=2.31.0 <3.0.0-0","async":">=0.9.0 <1.0.0-0","es6-shim":"0.21.x","semver":">=2.2.1 <5.0.0-0","minimatch":">=0.2.14 <2.0.0-0","bunyan":">=0.22.1 <2.0.0-0","handlebars":"2.x","highlight.js":"8.x","lunr":">=0.5.2 <1.0.0-0","render-readme":">=0.2.1","jju":"1.x","mkdirp":">=0.3.5 <1.0.0-0","sinopia-htpasswd":">= 0.4.3","http-errors":">=1.2.0"},"optionalDependencies":{"fs-ext":">=0.4.1 <1.0.0-0","crypt3":">=0.1.6 <1.0.0-0"},"devDependencies":{"rimraf":">=2.2.5 <3.0.0-0","bluebird":"2 >=2.9","mocha":"2 >=2.2.3","eslint":">= 0.18","browserify":"7.x","browserify-handlebars":"1.x","grunt":">=0.4.4 <1.0.0-0","grunt-cli":"*","grunt-browserify":">=2.0.8 <3.0.0-0","grunt-contrib-less":">=0.11.0 <1.0.0-0","grunt-contrib-watch":">=0.6.1 <1.0.0-0","unopinionate":">=0.0.4 <1.0.0-0","onclick":">=0.1.0 <1.0.0-0","transition-complete":">=0.0.2 <1.0.0-0"},"keywords":["private","package","repository","registry","modules","proxy","server"],"scripts":{"test":"eslint --reset . && mocha ./test/functional ./test/unit","test-travis":"eslint --reset . && mocha -R spec ./test/functional ./test/unit","test-only":"mocha ./test/functional ./test/unit","lint":"eslint --reset .","prepublish":"js-yaml package.yaml > package.json","clean-shrinkwrap":"node -e '\n function clean(j) {\n if (!j) return\n for (var k in j) {\n delete j[k].from\n delete j[k].resolved\n if (j[k].dependencies) clean(j[k].dependencies)\n }\n }\n x = JSON.parse(require(\"fs\").readFileSync(\"./npm-shrinkwrap.json\"))\n clean(x.dependencies)\n x = JSON.stringify(x, null, \" \")\n require(\"fs\").writeFileSync(\"./npm-shrinkwrap.json\", x + \"\\n\")\n'\n"},"engines":{"node":">=0.10"},"preferGlobal":true,"publishConfig":{"registry":"https://registry.npmjs.org/"},"license":{"type":"WTFPL","url":"http://www.wtfpl.net/txt/copying/"}}
{
"name": "testexp_tags",
"name": "__NAME__",
"versions": {
"0.1.0": {
"name": "testexp_tags",
"name": "__NAME__",
"version": "0.1.0",
"dist": {
"shasum": "fake",
"tarball": "http://localhost:55551/testexp_tags/-/blahblah"
"tarball": "http://localhost:55551/__NAME__/-/blahblah"
}
},
"0.1.1alpha": {
"name": "testexp_tags",
"name": "__NAME__",
"version": "0.1.1alpha",
"dist": {
"shasum": "fake",
"tarball": "http://localhost:55551/testexp_tags/-/blahblah"
"tarball": "http://localhost:55551/__NAME__/-/blahblah"
}
},
"0.1.2": {
"name": "testexp_tags",
"name": "__NAME__",
"version": "0.1.2",
"dist": {
"shasum": "fake",
"tarball": "http://localhost:55551/testexp_tags/-/blahblah"
"tarball": "http://localhost:55551/__NAME__/-/blahblah"
}
},
"0.1.3alpha": {
"name": "testexp_tags",
"name": "__NAME__",
"version": "0.1.3alpha",
"dist": {
"shasum": "fake",
"tarball": "http://localhost:55551/testexp_tags/-/blahblah"
"tarball": "http://localhost:55551/__NAME__/-/blahblah"
}
},
"1.1": {
"name": "testexp_tags",
"name": "__NAME__",
"version": "1.1",
"dist": {
"shasum": "fake",
"tarball": "http://localhost:55551/testexp_tags/-/blahblah"
"tarball": "http://localhost:55551/__NAME__/-/blahblah"
}

@@ -43,0 +43,0 @@ }

@@ -21,3 +21,4 @@ var assert = require('assert')

express.get('/testexp_tags', function(req, res) {
res.send(JSON.parse(readfile('fixtures/tags.json')))
var f = readfile('fixtures/tags.json').toString().replace(/__NAME__/g, 'testexp_tags')
res.send(JSON.parse(f))
})

@@ -48,2 +49,122 @@ })

})
describe('dist-tags methods', function() {
before(function () {
express.get('/testexp_tags2', function(req, res) {
var f = readfile('fixtures/tags.json').toString().replace(/__NAME__/g, 'testexp_tags2')
res.send(JSON.parse(f))
})
})
// populate cache
before(function () {
return server.get_package('testexp_tags2')
.status(200)
})
beforeEach(function () {
return server.request({
method: 'PUT',
uri: '/-/package/testexp_tags2/dist-tags',
json: {
foo: '0.1.0',
bar: '0.1.1alpha',
baz: '0.1.2',
},
}).status(201).body_ok(/tags updated/)
})
it('fetching tags', function () {
return server.request({
method: 'GET',
uri: '/-/package/testexp_tags2/dist-tags',
}).status(200).then(function (body) {
assert.deepEqual(body,
{ foo: '0.1.0',
bar: '0.1.1alpha',
baz: '0.1.2',
latest: '0.1.3alpha' })
})
})
it('merging tags', function () {
return server.request({
method: 'POST',
uri: '/-/package/testexp_tags2/dist-tags',
json: {
foo: '0.1.2',
quux: '0.1.0',
},
}).status(201).body_ok(/updated/).then(function () {
return server.request({
method: 'GET',
uri: '/-/package/testexp_tags2/dist-tags',
}).status(200).then(function (body) {
assert.deepEqual(body,
{ foo: '0.1.2',
bar: '0.1.1alpha',
baz: '0.1.2',
quux: '0.1.0',
latest: '0.1.3alpha' })
})
})
})
it('replacing tags', function () {
return server.request({
method: 'PUT',
uri: '/-/package/testexp_tags2/dist-tags',
json: {
foo: '0.1.2',
quux: '0.1.0',
},
}).status(201).body_ok(/updated/).then(function () {
return server.request({
method: 'GET',
uri: '/-/package/testexp_tags2/dist-tags',
}).status(200).then(function (body) {
assert.deepEqual(body,
{ foo: '0.1.2',
quux: '0.1.0',
latest: '0.1.3alpha' })
})
})
})
it('adding a tag', function () {
return server.request({
method: 'PUT',
uri: '/-/package/testexp_tags2/dist-tags/foo',
json: '0.1.3alpha',
}).status(201).body_ok(/tagged/).then(function () {
return server.request({
method: 'GET',
uri: '/-/package/testexp_tags2/dist-tags',
}).status(200).then(function (body) {
assert.deepEqual(body,
{ foo: '0.1.3alpha',
bar: '0.1.1alpha',
baz: '0.1.2',
latest: '0.1.3alpha' })
})
})
})
it('removing a tag', function () {
return server.request({
method: 'DELETE',
uri: '/-/package/testexp_tags2/dist-tags/foo',
}).status(201).body_ok(/removed/).then(function () {
return server.request({
method: 'GET',
uri: '/-/package/testexp_tags2/dist-tags',
}).status(200).then(function (body) {
assert.deepEqual(body,
{ bar: '0.1.1alpha',
baz: '0.1.2',
latest: '0.1.3alpha' })
})
})
})
})
}

Sorry, the diff of this file is not supported yet

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