@vtex/api
Advanced tools
Comparing version 0.10.0-beta to 0.10.1-beta
@@ -7,15 +7,13 @@ 'use strict'; | ||
var _vinylMultipartStream = require('vinyl-multipart-stream'); | ||
var _multipartStream = require('multipart-stream'); | ||
var _vinylMultipartStream2 = _interopRequireDefault(_vinylMultipartStream); | ||
var _multipartStream2 = _interopRequireDefault(_multipartStream); | ||
var _common = require('vinyl-multipart-stream/common'); | ||
var _zlib = require('zlib'); | ||
var _Client = require('./Client'); | ||
var _path = require('path'); | ||
var _Client2 = _interopRequireDefault(_Client); | ||
var _mimeTypes = require('mime-types'); | ||
var _endpoints = require('./endpoints'); | ||
var _mimeTypes2 = _interopRequireDefault(_mimeTypes); | ||
@@ -26,2 +24,8 @@ var _stream = require('stream'); | ||
var _Client = require('./Client'); | ||
var _Client2 = _interopRequireDefault(_Client); | ||
var _endpoints = require('./endpoints'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -157,4 +161,2 @@ | ||
// eslint-disable-line | ||
const routes = { | ||
@@ -182,10 +184,29 @@ Registry: (account, workspace) => `/${ account }/${ workspace }/registry`, | ||
*/ | ||
publishApp(account, workspace, stream) { | ||
publishApp(account, workspace, files) { | ||
let isDevelopment = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
if (!(stream.pipe && stream.on)) { | ||
throw new Error('Argument stream must be a readable stream of Vinyl files'); | ||
if (!(files[0] && files[0].path && files[0].contents)) { | ||
throw new Error('Argument files must be an array of {path, contents}, where contents can be a String, a Buffer or a ReadableStream.'); | ||
} | ||
const boundary = (0, _common.randomString)(); | ||
const multipart = stream.pipe((0, _vinylMultipartStream2.default)({ boundary: boundary })); | ||
const indexOfManifest = files.findIndex((_ref) => { | ||
let path = _ref.path; | ||
return path === 'manifest.json'; | ||
}); | ||
if (indexOfManifest === -1) { | ||
throw new Error('No manifest.json file found in files.'); | ||
} | ||
const sortedFiles = files.splice(indexOfManifest, 1).concat(files); | ||
const multipart = new _multipartStream2.default(); | ||
const boundary = multipart.boundary; | ||
sortedFiles.forEach((_ref2) => { | ||
let path = _ref2.path; | ||
let contents = _ref2.contents; | ||
return multipart.addPart({ | ||
headers: { | ||
'Content-Disposition': `inline; filename="${ path }"`, | ||
'Content-Type': _mimeTypes2.default.contentType((0, _path.basename)(path)) | ||
}, | ||
body: contents | ||
}); | ||
}); | ||
const gz = (0, _zlib.createGzip)(); | ||
@@ -192,0 +213,0 @@ return this.http({ |
{ | ||
"name": "@vtex/api", | ||
"version": "0.10.0-beta", | ||
"version": "0.10.1-beta", | ||
"description": "VTEX I/O API client", | ||
@@ -15,3 +15,3 @@ "main": "./lib/index.js", | ||
"lint": "eslint src", | ||
"prepublish": "run-s test build copy" | ||
"prepublish": "run-s build copy test" | ||
}, | ||
@@ -32,3 +32,3 @@ "engines": { | ||
"mime-types": "^2.1.12", | ||
"vinyl-multipart-stream": "^1.2.6" | ||
"multipart-stream": "^2.0.1" | ||
}, | ||
@@ -50,4 +50,3 @@ "devDependencies": { | ||
"npm-run-all": "^2.3.0", | ||
"rimraf": "^2.5.2", | ||
"vinyl": "^2.0.0" | ||
"rimraf": "^2.5.2" | ||
}, | ||
@@ -54,0 +53,0 @@ "ava": { |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
52585
15
1079
0
+ Addedmultipart-stream@^2.0.1
- Removedvinyl-multipart-stream@^1.2.6
- Removedacorn@4.0.137.4.1(transitive)
- Removedarr-diff@2.0.0(transitive)
- Removedarr-flatten@1.1.0(transitive)
- Removedarray-unique@0.2.1(transitive)
- Removedatob@2.1.2(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbraces@1.8.5(transitive)
- Removedbrfs@1.6.1(transitive)
- Removedbuffer-equal@0.0.1(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedclone@1.0.4(transitive)
- Removedclone-stats@0.0.1(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconcat-stream@1.6.2(transitive)
- Removedconvert-source-map@1.9.0(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedcss@2.2.4(transitive)
- Removeddebug-fabulous@0.0.4(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removeddeep-is@0.1.4(transitive)
- Removeddetect-newline@2.1.0(transitive)
- Removedduplexer2@0.1.4(transitive)
- Removedduplexify@3.7.1(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedescodegen@1.9.12.1.0(transitive)
- Removedesprima@3.1.34.0.1(transitive)
- Removedestraverse@4.3.05.3.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedexpand-brackets@0.1.5(transitive)
- Removedexpand-range@1.8.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextend-shallow@2.0.1(transitive)
- Removedextglob@0.3.2(transitive)
- Removedfalafel@2.2.5(transitive)
- Removedfast-levenshtein@2.0.6(transitive)
- Removedfilename-regex@2.0.1(transitive)
- Removedfill-range@2.2.4(transitive)
- Removedfor-in@1.0.2(transitive)
- Removedfor-own@0.1.5(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedgaze@0.5.2(transitive)
- Removedglob@3.1.215.0.15(transitive)
- Removedglob-base@0.3.0(transitive)
- Removedglob-parent@2.0.03.1.0(transitive)
- Removedglob-stream@5.3.5(transitive)
- Removedglob-watcher@2.0.0(transitive)
- Removedglobule@0.1.0(transitive)
- Removedgraceful-fs@1.2.34.2.11(transitive)
- Removedgulp-sourcemaps@1.12.1(transitive)
- Removedhas@1.0.4(transitive)
- Removedhasown@2.0.2(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@1.0.2(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-core-module@2.16.1(transitive)
- Removedis-dotfile@1.0.3(transitive)
- Removedis-equal-shallow@0.1.3(transitive)
- Removedis-extendable@0.1.1(transitive)
- Removedis-extglob@1.0.02.1.1(transitive)
- Removedis-glob@2.0.13.1.0(transitive)
- Removedis-number@2.1.04.0.0(transitive)
- Removedis-posix-bracket@0.1.1(transitive)
- Removedis-primitive@2.0.0(transitive)
- Removedis-utf8@0.2.1(transitive)
- Removedis-valid-glob@0.3.0(transitive)
- Removedisarray@0.0.11.0.02.0.5(transitive)
- Removedisobject@2.1.0(transitive)
- Removedjson-stable-stringify-without-jsonify@1.0.1(transitive)
- Removedkind-of@3.2.26.0.3(transitive)
- Removedlazy-debug-legacy@0.0.1(transitive)
- Removedlevn@0.3.0(transitive)
- Removedlodash@1.0.2(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedmagic-string@0.22.5(transitive)
- Removedmath-random@1.0.4(transitive)
- Removedmerge-source-map@1.0.4(transitive)
- Removedmerge-stream@0.1.8(transitive)
- Removedmicromatch@2.3.11(transitive)
- Removedminimatch@0.2.143.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removednormalize-path@2.1.1(transitive)
- Removedobject-assign@3.0.04.1.0(transitive)
- Removedobject-inspect@1.4.1(transitive)
- Removedobject.omit@2.0.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedordered-read-streams@0.3.0(transitive)
- Removedparse-glob@3.0.4(transitive)
- Removedpath-dirname@1.0.2(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedpreserve@0.2.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedquote-stream@1.0.2(transitive)
- Removedrandomatic@3.1.1(transitive)
- Removedreadable-stream@1.0.342.3.83.6.2(transitive)
- Removedregex-cache@0.4.4(transitive)
- Removedremove-trailing-separator@1.1.0(transitive)
- Removedrepeat-element@1.1.4(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedreplace-ext@0.0.1(transitive)
- Removedresolve@1.22.10(transitive)
- Removedresolve-url@0.2.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedshallow-copy@0.0.1(transitive)
- Removedsigmund@1.0.1(transitive)
- Removedsource-map@0.5.70.6.1(transitive)
- Removedsource-map-resolve@0.5.3(transitive)
- Removedsource-map-url@0.4.1(transitive)
- Removedstatic-eval@2.1.1(transitive)
- Removedstatic-module@2.2.5(transitive)
- Removedstream-shift@1.0.3(transitive)
- Removedstring_decoder@0.10.311.1.1(transitive)
- Removedstrip-bom@2.0.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedthrough2@0.6.52.0.54.0.2(transitive)
- Removedthrough2-filter@2.0.03.1.0(transitive)
- Removedto-absolute-glob@0.1.1(transitive)
- Removedtype-check@0.3.2(transitive)
- Removedtypedarray@0.0.6(transitive)
- Removedunique-stream@2.3.1(transitive)
- Removedurix@0.1.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedvinyl@0.5.31.2.0(transitive)
- Removedvinyl-fs-that-respects-files@1.0.2(transitive)
- Removedvinyl-multipart-stream@1.2.6(transitive)
- Removedvlq@0.2.3(transitive)
- Removedword-wrap@1.2.5(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedxtend@4.0.2(transitive)