contentful-extension-cli
Advanced tools
Comparing version 1.3.0 to 2.0.0
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
## v2.0.0 - 2016-07-06 | ||
### Changed | ||
- Mention "extension.json" file in error messages | ||
- Adopt the new payload and endpoints | ||
## v1.3.0 - 2016-06-24 | ||
@@ -5,0 +10,0 @@ ### Added |
@@ -31,3 +31,3 @@ 'use strict'; | ||
'Successfully created extension, ' + | ||
`id: ${extension.sys.id} name: ${extension.widget.name}` | ||
`id: ${extension.sys.id} name: ${extension.extension.name}` | ||
); | ||
@@ -34,0 +34,0 @@ }) |
@@ -44,3 +44,3 @@ 'use strict'; | ||
'Successfully updated extension, ' + | ||
`id: ${extension.sys.id} name: ${extension.widget.name}` | ||
`id: ${extension.sys.id} name: ${extension.extension.name}` | ||
); | ||
@@ -47,0 +47,0 @@ }); |
@@ -47,5 +47,9 @@ 'use strict'; | ||
throw new Error(`no value given for: ${keys}`); | ||
throw new Error( | ||
`you're missing the following parameters: ${keys}. ` + | ||
`Please provide either a valid extension.json descriptor file ` + | ||
`or use the according command line arguments.` | ||
); | ||
} | ||
}); | ||
}; |
@@ -47,4 +47,3 @@ 'use strict'; | ||
// @todo API still requires this property to be named "widget" | ||
return {widget: extension}; | ||
return { extension }; | ||
} | ||
@@ -51,0 +50,0 @@ |
@@ -5,3 +5,3 @@ 'use strict'; | ||
// @todo maybe in the future we should rename this endpoint | ||
let base = `/spaces/${spaceId}/widgets`; | ||
let base = `/spaces/${spaceId}/extensions`; | ||
@@ -8,0 +8,0 @@ if (id) { |
{ | ||
"name": "contentful-extension-cli", | ||
"author": "Contentful GmbH", | ||
"version": "1.3.0", | ||
"version": "2.0.0", | ||
"scripts": { | ||
@@ -6,0 +6,0 @@ "test": "npm run lint && npm run test-unit && npm run test-integration", |
@@ -75,4 +75,4 @@ 'use strict'; | ||
expect(payload.sys.id).to.eql('456'); | ||
expect(payload.widget.name).to.eql('foo'); | ||
expect(payload.widget.src).to.eql('foo.com'); | ||
expect(payload.extension.name).to.eql('foo'); | ||
expect(payload.extension.src).to.eql('foo.com'); | ||
}); | ||
@@ -93,4 +93,4 @@ }); | ||
expect(payload.sys.id).to.eql('456'); | ||
expect(payload.widget.name).to.eql('foo'); | ||
expect(payload.widget.src).to.eql('foo.com'); | ||
expect(payload.extension.name).to.eql('foo'); | ||
expect(payload.extension.src).to.eql('foo.com'); | ||
}); | ||
@@ -132,3 +132,3 @@ }); | ||
expect(error.error.code).to.eq(1); | ||
expect(error.stderr).to.match(/no value given for: name, fieldTypes, src or srcdoc/); | ||
expect(error.stderr).to.match(/you're missing the following parameters: name, fieldTypes, src or srcdoc/); | ||
}); | ||
@@ -148,4 +148,4 @@ }); | ||
expect(payload.widget.src).to.eql('lol.com'); | ||
expect(payload.widget.name).to.eql('lol'); | ||
expect(payload.extension.src).to.eql('lol.com'); | ||
expect(payload.extension.name).to.eql('lol'); | ||
}); | ||
@@ -165,3 +165,3 @@ }); | ||
expect(payload.widget.fieldTypes).to.eql([ | ||
expect(payload.extension.fieldTypes).to.eql([ | ||
{type: 'Symbol'}, | ||
@@ -184,3 +184,3 @@ {type: 'Text'} | ||
expect(payload.widget.sidebar).to.be.true(); | ||
expect(payload.extension.sidebar).to.be.true(); | ||
}); | ||
@@ -200,3 +200,3 @@ }); | ||
expect(payload.widget.sidebar).to.be.false(); | ||
expect(payload.extension.sidebar).to.be.false(); | ||
}); | ||
@@ -216,3 +216,3 @@ }); | ||
expect(payload.widget.sidebar).to.be.undefined(); | ||
expect(payload.extension.sidebar).to.be.undefined(); | ||
}); | ||
@@ -232,3 +232,3 @@ }); | ||
expect(payload.widget.src).to.eql('lol.com'); | ||
expect(payload.extension.src).to.eql('lol.com'); | ||
expect(payload.sys.id).to.eql('456'); | ||
@@ -310,3 +310,3 @@ }); | ||
expect(payload.widget.srcdoc).to.eql('the-bundle-contents'); | ||
expect(payload.extension.srcdoc).to.eql('the-bundle-contents'); | ||
}); | ||
@@ -341,3 +341,3 @@ }); | ||
expect(payload.widget.src).to.eql('lol.com'); | ||
expect(payload.extension.src).to.eql('lol.com'); | ||
expect(payload.sys.id).to.eql('456'); | ||
@@ -361,3 +361,3 @@ }); | ||
expect(payload.widget.src).to.eql('lol.com'); | ||
expect(payload.extension.src).to.eql('lol.com'); | ||
expect(payload.sys.id).to.eql('456'); | ||
@@ -429,3 +429,3 @@ }); | ||
expect(payload.widget.src).to.eql('lol.com'); | ||
expect(payload.extension.src).to.eql('lol.com'); | ||
expect(payload.sys.id).to.eql('456'); | ||
@@ -453,6 +453,6 @@ }); | ||
expect(payloads.total).to.eq(2); | ||
expect(lolExtension.widget.name).to.eql('lol'); | ||
expect(lolExtension.widget.src).to.eql('lol.com'); | ||
expect(fooExtension.widget.name).to.eql('foo'); | ||
expect(fooExtension.widget.src).to.eql('foo.com'); | ||
expect(lolExtension.extension.name).to.eql('lol'); | ||
expect(lolExtension.extension.src).to.eql('lol.com'); | ||
expect(fooExtension.extension.name).to.eql('foo'); | ||
expect(fooExtension.extension.src).to.eql('foo.com'); | ||
}); | ||
@@ -491,3 +491,3 @@ }); | ||
expect(payload.widget.src).to.eql('foo.com'); | ||
expect(payload.extension.src).to.eql('foo.com'); | ||
}); | ||
@@ -514,3 +514,3 @@ }); | ||
expect(payload.widget.src).to.eql('foo.com'); | ||
expect(payload.extension.src).to.eql('foo.com'); | ||
expect(payload.sys.id).to.eql('456'); | ||
@@ -550,3 +550,3 @@ }); | ||
let cmd = 'update --space-id 123 --id 456 --src foo.com --field-types Symbol --host http://localhost:3000'; | ||
let msg = 'no value given for: name'; | ||
let msg = `you're missing the following parameters: name`; | ||
@@ -558,3 +558,3 @@ return expectErrorAndMessage(cmd, execOptions, msg); | ||
let cmd = 'update --space-id 123 --name lol --src foo.com --field-types Symbol --host http://localhost:3000'; | ||
let msg = 'no value given for: id'; | ||
let msg = `you're missing the following parameters: id`; | ||
@@ -566,3 +566,3 @@ return expectErrorAndMessage(cmd, execOptions, msg); | ||
let cmd = 'update --space-id 123 --name lol --field-types Symbol --id 123 --force --host http://localhost:3000'; | ||
let msg = 'no value given for: src or srcdoc'; | ||
let msg = `you're missing the following parameters: src or srcdoc`; | ||
@@ -574,3 +574,3 @@ return expectErrorAndMessage(cmd, execOptions, msg); | ||
let cmd = 'update --space-id 123 --name lol --src lol.com --id 123 --host http://localhost:3000'; | ||
let msg = 'no value given for: fieldTypes'; | ||
let msg = `you're missing the following parameters: fieldTypes`; | ||
@@ -620,4 +620,4 @@ return expectErrorAndMessage(cmd, execOptions, msg); | ||
expect(payload.widget.name).to.eql('foo'); | ||
expect(payload.widget.src).to.eql('foo.com'); | ||
expect(payload.extension.name).to.eql('foo'); | ||
expect(payload.extension.src).to.eql('foo.com'); | ||
}); | ||
@@ -648,4 +648,4 @@ }); | ||
expect(payload.widget.name).to.eql('foo'); | ||
expect(payload.widget.src).to.eql('foo.com'); | ||
expect(payload.extension.name).to.eql('foo'); | ||
expect(payload.extension.src).to.eql('foo.com'); | ||
}); | ||
@@ -656,3 +656,3 @@ }); | ||
let cmd = 'update --space-id 123 --name lol --id 456'; | ||
let msg = 'no value given for: fieldTypes, src or srcdoc'; | ||
let msg = `you're missing the following parameters: fieldTypes, src or srcdoc`; | ||
@@ -677,3 +677,3 @@ return expectErrorAndMessage(cmd, execOptions, msg); | ||
expect(payload.widget.name).to.eql('doge'); | ||
expect(payload.extension.name).to.eql('doge'); | ||
}); | ||
@@ -697,3 +697,3 @@ }); | ||
expect(payload.widget.fieldTypes).to.eql([ | ||
expect(payload.extension.fieldTypes).to.eql([ | ||
{type: 'Text'}, | ||
@@ -721,3 +721,3 @@ {type: 'Symbol'}, | ||
expect(payload.widget.sidebar).to.be.true(); | ||
expect(payload.extension.sidebar).to.be.true(); | ||
}); | ||
@@ -741,3 +741,3 @@ }); | ||
expect(payload.widget.sidebar).to.be.false(); | ||
expect(payload.extension.sidebar).to.be.false(); | ||
}); | ||
@@ -761,3 +761,3 @@ }); | ||
expect(payload.widget).to.not.have.ownProperty('sidebar'); | ||
expect(payload.extension).to.not.have.ownProperty('sidebar'); | ||
}); | ||
@@ -829,3 +829,3 @@ }); | ||
expect(payload.widget.srcdoc).to.eql('the-bundle-contents'); | ||
expect(payload.extension.srcdoc).to.eql('the-bundle-contents'); | ||
}); | ||
@@ -832,0 +832,0 @@ }); |
@@ -95,9 +95,9 @@ 'use strict'; | ||
expect(payload.widget.name).to.eql(customDescriptor.name); | ||
expect(payload.widget.src).to.eql(customDescriptor.src); | ||
expect(payload.widget.fieldTypes).to.eql([ | ||
expect(payload.extension.name).to.eql(customDescriptor.name); | ||
expect(payload.extension.src).to.eql(customDescriptor.src); | ||
expect(payload.extension.fieldTypes).to.eql([ | ||
{type: 'Symbol'}, | ||
{type: 'Array', items: {type: 'Link', linkType: 'Asset'}} | ||
]); | ||
expect(payload.widget.sidebar).to.be.true(); | ||
expect(payload.extension.sidebar).to.be.true(); | ||
expect(payload.sys.id).to.eql(customDescriptor.id); | ||
@@ -207,6 +207,6 @@ expect(payload.sys.space.sys.id).to.eql('123'); | ||
expect(payload.widget.name).to.eql(descriptor.name); | ||
expect(payload.widget.src).to.eql(descriptor.src); | ||
expect(payload.extension.name).to.eql(descriptor.name); | ||
expect(payload.extension.src).to.eql(descriptor.src); | ||
expect(payload.sys.id).to.eql(descriptor.id); | ||
expect(payload.widget.fieldTypes).to.eql([ | ||
expect(payload.extension.fieldTypes).to.eql([ | ||
{type: 'Symbol'}, | ||
@@ -256,3 +256,3 @@ {type: 'Array', items: {type: 'Link', linkType: 'Asset'}} | ||
expect(payload.widget.srcdoc).to.eql(bundle); | ||
expect(payload.extension.srcdoc).to.eql(bundle); | ||
expect(payload.sys.id).to.eql(descriptor.id); | ||
@@ -286,4 +286,4 @@ }); | ||
expect(payload.widget).to.not.have.ownProperty('srcdoc'); | ||
expect(payload.widget.src).to.eql('foo.com'); | ||
expect(payload.extension).to.not.have.ownProperty('srcdoc'); | ||
expect(payload.extension.src).to.eql('foo.com'); | ||
expect(payload.sys.id).to.eql(descriptor.id); | ||
@@ -314,3 +314,3 @@ }); | ||
expect(payload.widget.src).to.eql('foo.com'); | ||
expect(payload.extension.src).to.eql('foo.com'); | ||
expect(payload.sys.id).to.eql(descriptor.id); | ||
@@ -340,3 +340,3 @@ }); | ||
expect(payload.widget.name).to.eql('doge'); | ||
expect(payload.extension.name).to.eql('doge'); | ||
expect(payload.sys.id).to.eql(descriptor.id); | ||
@@ -366,3 +366,3 @@ }); | ||
expect(payload.widget.fieldTypes).to.eql([ | ||
expect(payload.extension.fieldTypes).to.eql([ | ||
{type: 'Number'}, | ||
@@ -422,3 +422,3 @@ {type: 'Date'} | ||
expect(payload.widget.srcdoc).to.eql(b); | ||
expect(payload.extension.srcdoc).to.eql(b); | ||
expect(payload.sys.id).to.eql(descriptor.id); | ||
@@ -449,4 +449,4 @@ }); | ||
expect(payload.widget).to.not.have.ownProperty('src'); | ||
expect(payload.widget.srcdoc).to.eql(b); | ||
expect(payload.extension).to.not.have.ownProperty('src'); | ||
expect(payload.extension.srcdoc).to.eql(b); | ||
expect(payload.sys.id).to.eql(descriptor.id); | ||
@@ -479,3 +479,3 @@ }); | ||
expect(payload.widget.src).to.eql(descriptor.src); | ||
expect(payload.extension.src).to.eql(descriptor.src); | ||
expect(payload.sys.id).to.eql('88'); | ||
@@ -505,3 +505,3 @@ }); | ||
expect(payload.widget.sidebar).to.be.false(); | ||
expect(payload.extension.sidebar).to.be.false(); | ||
}); | ||
@@ -616,15 +616,15 @@ }); | ||
expect(payload.widget.name).to.eql(customDescriptor.name); | ||
expect(payload.widget.src).to.eql(customDescriptor.src); | ||
expect(payload.widget.fieldTypes).to.eql([ | ||
expect(payload.extension.name).to.eql(customDescriptor.name); | ||
expect(payload.extension.src).to.eql(customDescriptor.src); | ||
expect(payload.extension.fieldTypes).to.eql([ | ||
{type: 'Link', linkType: 'Asset'}, | ||
{type: 'Text'} | ||
]); | ||
expect(payload.widget.sidebar).to.be.true(); | ||
expect(payload.extension.sidebar).to.be.true(); | ||
expect(payload.sys.id).to.eql(customDescriptor.id); | ||
expect(payload.sys.space.sys.id).to.eql('123'); | ||
expect(payload.widget.name).not.to.eql(descriptor.name); | ||
expect(payload.widget.src).not.to.eql(descriptor.src); | ||
expect(payload.widget.fieldTypes).not.to.eql(descriptor.fieldTypes); | ||
expect(payload.extension.name).not.to.eql(descriptor.name); | ||
expect(payload.extension.src).not.to.eql(descriptor.src); | ||
expect(payload.extension.fieldTypes).not.to.eql(descriptor.fieldTypes); | ||
expect(payload.sys.id).not.to.eql(descriptor.id); | ||
@@ -631,0 +631,0 @@ }); |
@@ -22,3 +22,3 @@ 'use strict'; | ||
app.all('/spaces/:space/widgets/:id', function (req, res, next) { | ||
app.all('/spaces/:space/extensions/:id', function (req, res, next) { | ||
if (req.params.id === 'not-found') { | ||
@@ -45,6 +45,6 @@ let error = buildError('NotFound', 'The resource can\'t be found.'); | ||
app.post('/spaces/:space/widgets', function (req, res) { | ||
if (_.get(req, 'body.widget.fieldTypes[0].type') === 'Lol') { | ||
app.post('/spaces/:space/extensions', function (req, res) { | ||
if (_.get(req, 'body.extension.fieldTypes[0].type') === 'Lol') { | ||
return respondWithValidationError(res, { | ||
path: ['widget', 'fieldTypes'], | ||
path: ['extension', 'fieldTypes'], | ||
expected: ['Symbol', 'Yolo'] | ||
@@ -61,3 +61,3 @@ }); | ||
app.put('/spaces/:space/widgets/:id', function (req, res) { | ||
app.put('/spaces/:space/extensions/:id', function (req, res) { | ||
let extension = store[req.params.id]; | ||
@@ -69,3 +69,3 @@ let versionInHeader = req.headers['x-contentful-version']; | ||
if (req.params.id === 'too-long-name') { | ||
return respondWithValidationError(res, {path: ['widget', 'name']}); | ||
return respondWithValidationError(res, {path: ['extension', 'name']}); | ||
} else if (req.params.id === 'so-invalid') { | ||
@@ -75,3 +75,3 @@ return respondWithValidationError(res); | ||
return respondWithValidationError(res, { | ||
path: ['widget', 'srcdoc'], | ||
path: ['extension', 'srcdoc'], | ||
max: 7777 | ||
@@ -115,3 +115,3 @@ }); | ||
app.get('/spaces/:space/widgets', function (req, res) { | ||
app.get('/spaces/:space/extensions', function (req, res) { | ||
let extensions = _.filter(store, {sys: {space: {sys: {id: req.params.space}}}}); | ||
@@ -134,3 +134,3 @@ let response = { sys: {type: 'Array'}, total: extensions.length, items: extensions }; | ||
app.get('/spaces/:space/widgets/:id', function (req, res) { | ||
app.get('/spaces/:space/extensions/:id', function (req, res) { | ||
let extension = store[req.params.id]; | ||
@@ -143,3 +143,3 @@ | ||
app.delete('/spaces/:space/widgets/:id', function (req, res) { | ||
app.delete('/spaces/:space/extensions/:id', function (req, res) { | ||
let extension = store[req.params.id]; | ||
@@ -146,0 +146,0 @@ let xVersion = parseInt(req.headers['x-contentful-version'], 10); |
@@ -43,3 +43,3 @@ 'use strict'; | ||
return {widget: extension}; | ||
return { extension }; | ||
} | ||
@@ -217,3 +217,3 @@ | ||
payload: { | ||
widget: { | ||
extension: { | ||
src: 'the-url', | ||
@@ -220,0 +220,0 @@ fieldTypes: [ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
115587
2588
2