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

@vtex/api

Package Overview
Dependencies
Maintainers
5
Versions
890
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vtex/api - npm Package Compare versions

Comparing version 0.10.0-beta to 0.10.1-beta

49

lib/RegistryClient.js

@@ -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

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