Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minio

Package Overview
Dependencies
Maintainers
4
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minio - npm Package Compare versions

Comparing version 7.0.18 to 7.0.19

4

dist/main/errors.js

@@ -20,7 +20,7 @@ "use strict";

function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

@@ -27,0 +27,0 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -16,5 +16,5 @@ "use strict";

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

@@ -21,0 +21,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -38,2 +38,5 @@ "use strict";

exports.extractMetadata = extractMetadata;
exports.getVersionId = getVersionId;
exports.sanitizeETag = sanitizeETag;
exports.toSha256 = exports.toMd5 = exports.LEGAL_HOLD_STATUS = exports.RETENTION_VALIDITY_UNITS = exports.RETENTION_MODES = void 0;

@@ -61,4 +64,6 @@ var _stream = _interopRequireDefault(require("stream"));

*/
// Returns a wrapper function that will promisify a given callback function.
var Crypto = require('crypto'); // Returns a wrapper function that will promisify a given callback function.
// It will preserve 'this'.
function promisify(fn) {

@@ -172,6 +177,6 @@ return function () {

return false;
} // Host cannot start or end with a '.'
} // Host cannot start with a '.'
if (host[0] === '.' || host.substr(-1) === '.') {
if (host[0] === '.') {
return false;

@@ -407,2 +412,55 @@ }

}
function getVersionId() {
var headers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var versionIdValue = headers["x-amz-version-id"];
return versionIdValue || null;
}
function sanitizeETag() {
var etag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var replaceChars = {
'"': '',
'"': '',
'"': '',
'"': '',
'&#x00022': ''
};
return etag.replace(/^("|"|")|("|"|")$/g, function (m) {
return replaceChars[m];
});
}
var RETENTION_MODES = {
GOVERNANCE: "GOVERNANCE",
COMPLIANCE: "COMPLIANCE"
};
exports.RETENTION_MODES = RETENTION_MODES;
var RETENTION_VALIDITY_UNITS = {
DAYS: "Days",
YEARS: "Years"
};
exports.RETENTION_VALIDITY_UNITS = RETENTION_VALIDITY_UNITS;
var LEGAL_HOLD_STATUS = {
ENABLED: "ON",
DISABLED: "OFF"
};
exports.LEGAL_HOLD_STATUS = LEGAL_HOLD_STATUS;
var objectToBuffer = function objectToBuffer(payload) {
var payloadBuf = Buffer.from(Buffer.from(JSON.stringify(payload)));
return payloadBuf;
};
var toMd5 = function toMd5(payload) {
return Crypto.createHash('md5').update(objectToBuffer(payload)).digest().toString('base64');
};
exports.toMd5 = toMd5;
var toSha256 = function toSha256(payload) {
return Crypto.createHash('sha256').update(payload).digest('hex');
};
exports.toSha256 = toSha256;
//# sourceMappingURL=helpers.js.map

@@ -14,5 +14,5 @@ "use strict";

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

@@ -25,7 +25,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

@@ -201,3 +201,3 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

exports.ObjectCreatedCopy = ObjectCreatedCopy;
var ObjectCreatedCompleteMultipartUpload = "sh:ObjectCreated:CompleteMultipartUpload";
var ObjectCreatedCompleteMultipartUpload = "s3:ObjectCreated:CompleteMultipartUpload";
exports.ObjectCreatedCompleteMultipartUpload = ObjectCreatedCompleteMultipartUpload;

@@ -204,0 +204,0 @@ var ObjectRemovedAll = "s3:ObjectRemoved:*";

@@ -14,6 +14,8 @@ "use strict";

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
var _helpers = require("./helpers");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -33,7 +35,7 @@

function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

@@ -61,3 +63,3 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

_this.metaData = metaData; // Call like: callback(error, etag).
_this.metaData = metaData; // Call like: callback(error, {etag, versionId}).

@@ -92,5 +94,5 @@ _this.callback = callback; // We need to keep track of what number chunk/part we're on. This increments

var method = 'PUT';
var headers = Object.assign({}, this.metaData, {
var headers = {
'Content-Length': chunk.length
});
};
var md5digest = ''; // Calculate and set Content-MD5 header if SHA256 is not set.

@@ -111,3 +113,4 @@ // This will happen only when there is a secure connection to the s3 server.

method,
headers,
// Set user metadata as this is not a multipart upload
headers: Object.assign({}, this.metaData, headers),
query: '',

@@ -119,13 +122,11 @@ bucketName: this.bucketName,

if (err) return callback(err);
var etag = response.headers.etag;
var result = {
etag: (0, _helpers.sanitizeETag)(response.headers.etag),
versionId: (0, _helpers.getVersionId)(response.headers)
}; // Ignore the 'data' event so that the stream closes. (nodejs stream requirement)
if (etag) {
etag = etag.replace(/^"/, '').replace(/"$/, '');
} // Ignore the 'data' event so that the stream closes. (nodejs stream requirement)
response.on('data', function () {}); // Give the etag back, we're done!
process.nextTick(function () {
_this2.callback(null, etag);
_this2.callback(null, result);
}); // Because we're sure the stream has ended, allow it to flush and end.

@@ -251,13 +252,11 @@

if (err) return callback(err);
var etag = response.headers.etag;
var result = {
etag: (0, _helpers.sanitizeETag)(response.headers.etag),
versionId: (0, _helpers.getVersionId)(response.headers)
}; // Ignore the 'data' event so that the stream closes. (nodejs stream requirement)
if (etag) {
etag = etag.replace(/^"/, '').replace(/"$/, '');
} // Ignore the 'data' event so that the stream closes. (nodejs stream requirement)
response.on('data', function () {}); // Give the etag back, we're done!
process.nextTick(function () {
_this3.callback(null, etag);
_this3.callback(null, result);
}); // Because we're sure the stream has ended, allow it to flush and end.

@@ -264,0 +263,0 @@

@@ -40,3 +40,4 @@ "use strict";

'ap-northeast-1': 's3-ap-northeast-1.amazonaws.com',
'cn-north-1': 's3.cn-north-1.amazonaws.com.cn' // Add new endpoints here.
'cn-north-1': 's3.cn-north-1.amazonaws.com.cn',
'ap-east-1': 's3.ap-east-1.amazonaws.com' // Add new endpoints here.

@@ -43,0 +44,0 @@ }; // getS3Endpoint get relevant endpoint for the region.

@@ -18,5 +18,5 @@ "use strict";

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

@@ -312,3 +312,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

if (sessionToken) {
requestQuery.push(`X-Amz-Security-Token=${sessionToken}`);
requestQuery.push(`X-Amz-Security-Token=${(0, _helpers.uriEscape)(sessionToken)}`);
}

@@ -315,0 +315,0 @@

@@ -21,2 +21,10 @@ "use strict";

exports.getNotificationTransformer = getNotificationTransformer;
exports.bucketVersioningTransformer = bucketVersioningTransformer;
exports.getTagsTransformer = getTagsTransformer;
exports.lifecycleTransformer = lifecycleTransformer;
exports.objectLockTransformer = objectLockTransformer;
exports.objectRetentionTransformer = objectRetentionTransformer;
exports.bucketEncryptionTransformer = bucketEncryptionTransformer;
exports.replicationConfigTransformer = replicationConfigTransformer;
exports.objectLegalHoldTransformer = objectLegalHoldTransformer;

@@ -39,5 +47,5 @@ var xmlParsers = _interopRequireWildcard(require("./xml-parsers.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

@@ -263,2 +271,34 @@ /*

}
function bucketVersioningTransformer() {
return getConcater(xmlParsers.parseBucketVersioningConfig);
}
function getTagsTransformer() {
return getConcater(xmlParsers.parseTagging);
}
function lifecycleTransformer() {
return getConcater(xmlParsers.parseLifecycleConfig);
}
function objectLockTransformer() {
return getConcater(xmlParsers.parseObjectLockConfig);
}
function objectRetentionTransformer() {
return getConcater(xmlParsers.parseObjectRetentionConfig);
}
function bucketEncryptionTransformer() {
return getConcater(xmlParsers.parseBucketEncryptionConfig);
}
function replicationConfigTransformer() {
return getConcater(xmlParsers.parseReplicationConfig);
}
function objectLegalHoldTransformer() {
return getConcater(xmlParsers.parseObjectLegalHoldConfig);
}
//# sourceMappingURL=transformers.js.map

@@ -18,2 +18,10 @@ "use strict";

exports.parseListObjectsV2WithMetadata = parseListObjectsV2WithMetadata;
exports.parseBucketVersioningConfig = parseBucketVersioningConfig;
exports.parseTagging = parseTagging;
exports.parseLifecycleConfig = parseLifecycleConfig;
exports.parseObjectLockConfig = parseObjectLockConfig;
exports.parseObjectRetentionConfig = parseObjectRetentionConfig;
exports.parseBucketEncryptionConfig = parseBucketEncryptionConfig;
exports.parseReplicationConfig = parseReplicationConfig;
exports.parseObjectLegalHoldConfig = parseObjectLegalHoldConfig;

@@ -26,6 +34,8 @@ var _fastXmlParser = _interopRequireDefault(require("fast-xml-parser"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
var _helpers = require("./helpers");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -370,5 +380,32 @@

}
} // parse XML response for list objects in a bucket
}
var formatObjInfo = function formatObjInfo(content) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var Key = content.Key,
LastModified = content.LastModified,
ETag = content.ETag,
Size = content.Size,
VersionId = content.VersionId,
IsLatest = content.IsLatest;
if (!(0, _helpers.isObject)(opts)) {
opts = {};
}
var name = toArray(Key)[0];
var lastModified = new Date(toArray(LastModified)[0]);
var etag = (0, _helpers.sanitizeETag)(toArray(ETag)[0]);
return {
name,
lastModified,
etag,
size: Size,
versionId: VersionId,
isLatest: IsLatest,
isDeleteMarker: opts.IsDeleteMarker ? opts.IsDeleteMarker : false
};
}; // parse XML response for list objects in a bucket
function parseListObjects(xml) {

@@ -379,41 +416,82 @@ var result = {

};
var nextMarker;
var isTruncated = false;
var nextMarker, nextVersionKeyMarker;
var xmlobj = parseXml(xml);
if (!xmlobj.ListBucketResult) {
throw new errors.InvalidXMLError('Missing tag: "ListBucketResult"');
}
var parseCommonPrefixesEntity = function parseCommonPrefixesEntity(responseEntity) {
if (responseEntity) {
toArray(responseEntity).forEach(function (commonPrefix) {
var prefix = toArray(commonPrefix.Prefix)[0];
result.objects.push({
prefix,
size: 0
});
});
}
};
xmlobj = xmlobj.ListBucketResult;
if (xmlobj.IsTruncated) result.isTruncated = xmlobj.IsTruncated;
var listBucketResult = xmlobj.ListBucketResult;
var listVersionsResult = xmlobj.ListVersionsResult;
if (xmlobj.Contents) {
xmlobj.Contents.forEach(function (content) {
var name = toArray(content.Key)[0];
var lastModified = new Date(toArray(content.LastModified)[0]);
var etag = toArray(content.ETag)[0].replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '');
var size = content.Size;
result.objects.push({
name,
lastModified,
etag,
size
if (listBucketResult) {
if (listBucketResult.IsTruncated) {
isTruncated = listBucketResult.IsTruncated;
}
if (listBucketResult.Contents) {
toArray(listBucketResult.Contents).forEach(function (content) {
var name = toArray(content.Key)[0];
var lastModified = new Date(toArray(content.LastModified)[0]);
var etag = (0, _helpers.sanitizeETag)(toArray(content.ETag)[0]);
var size = content.Size;
result.objects.push({
name,
lastModified,
etag,
size
});
});
nextMarker = name;
});
}
if (listBucketResult.NextMarker) {
nextMarker = listBucketResult.NextMarker;
}
parseCommonPrefixesEntity(listBucketResult.CommonPrefixes);
}
if (xmlobj.CommonPrefixes) {
toArray(xmlobj.CommonPrefixes).forEach(function (commonPrefix) {
var prefix = toArray(commonPrefix.Prefix)[0];
var size = 0;
result.objects.push({
prefix,
size
if (listVersionsResult) {
if (listVersionsResult.IsTruncated) {
isTruncated = listVersionsResult.IsTruncated;
}
if (listVersionsResult.Version) {
toArray(listVersionsResult.Version).forEach(function (content) {
result.objects.push(formatObjInfo(content));
});
});
}
if (listVersionsResult.DeleteMarker) {
toArray(listVersionsResult.DeleteMarker).forEach(function (content) {
result.objects.push(formatObjInfo(content, {
IsDeleteMarker: true
}));
});
}
if (listVersionsResult.NextKeyMarker) {
nextVersionKeyMarker = listVersionsResult.NextKeyMarker;
}
if (listVersionsResult.NextVersionIdMarker) {
result.versionIdMarker = listVersionsResult.NextVersionIdMarker;
}
parseCommonPrefixesEntity(listVersionsResult.CommonPrefixes);
}
if (result.isTruncated) {
result.nextMarker = xmlobj.NextMarker ? toArray(xmlobj.NextMarker)[0] : nextMarker;
result.isTruncated = isTruncated;
if (isTruncated) {
result.nextMarker = nextVersionKeyMarker || nextMarker;
}

@@ -444,3 +522,3 @@

var lastModified = new Date(content.LastModified);
var etag = content.ETag.replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '');
var etag = (0, _helpers.sanitizeETag)(content.ETag);
var size = content.Size;

@@ -490,3 +568,3 @@ result.objects.push({

var lastModified = new Date(content.LastModified);
var etag = content.ETag.replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '').replace(/^"/g, '').replace(/"$/g, '');
var etag = (0, _helpers.sanitizeETag)(content.ETag);
var size = content.Size;

@@ -524,2 +602,90 @@ var metadata;

}
function parseBucketVersioningConfig(xml) {
var xmlObj = parseXml(xml);
return xmlObj.VersioningConfiguration;
}
function parseTagging(xml) {
var xmlObj = parseXml(xml);
var result = [];
if (xmlObj.Tagging && xmlObj.Tagging.TagSet && xmlObj.Tagging.TagSet.Tag) {
var tagResult = xmlObj.Tagging.TagSet.Tag; //if it is a single tag convert into an array so that the return value is always an array.
if ((0, _helpers.isObject)(tagResult)) {
result.push(tagResult);
} else {
result = tagResult;
}
}
return result;
}
function parseLifecycleConfig(xml) {
var xmlObj = parseXml(xml);
return xmlObj.LifecycleConfiguration;
}
function parseObjectLockConfig(xml) {
var xmlObj = parseXml(xml);
var lockConfigResult = {};
if (xmlObj.ObjectLockConfiguration) {
lockConfigResult = {
objectLockEnabled: xmlObj.ObjectLockConfiguration.ObjectLockEnabled
};
var retentionResp;
if (xmlObj.ObjectLockConfiguration && xmlObj.ObjectLockConfiguration.Rule && xmlObj.ObjectLockConfiguration.Rule.DefaultRetention) {
retentionResp = xmlObj.ObjectLockConfiguration.Rule.DefaultRetention || {};
lockConfigResult.mode = retentionResp.Mode;
}
if (retentionResp) {
var isUnitYears = retentionResp.Years;
if (isUnitYears) {
lockConfigResult.validity = isUnitYears;
lockConfigResult.unit = _helpers.RETENTION_VALIDITY_UNITS.YEARS;
} else {
lockConfigResult.validity = retentionResp.Days;
lockConfigResult.unit = _helpers.RETENTION_VALIDITY_UNITS.DAYS;
}
}
return lockConfigResult;
}
}
function parseObjectRetentionConfig(xml) {
var xmlObj = parseXml(xml);
var retentionConfig = xmlObj.Retention;
return {
mode: retentionConfig.Mode,
retainUntilDate: retentionConfig.RetainUntilDate
};
}
function parseBucketEncryptionConfig(xml) {
var encConfig = parseXml(xml);
return encConfig;
}
function parseReplicationConfig(xml) {
var xmlObj = parseXml(xml);
var replicationConfig = {
ReplicationConfiguration: {
role: xmlObj.ReplicationConfiguration.Role,
rules: toArray(xmlObj.ReplicationConfiguration.Rule)
}
};
return replicationConfig;
}
function parseObjectLegalHoldConfig(xml) {
var xmlObj = parseXml(xml);
return xmlObj.LegalHold;
}
//# sourceMappingURL=xml-parsers.js.map
{
"name": "minio",
"version": "7.0.18",
"version": "7.0.19",
"description": "S3 Compatible Cloud Storage client",

@@ -39,3 +39,3 @@ "main": "./dist/main/minio.js",

"json-stream": "^1.0.0",
"lodash": "^4.17.20",
"lodash": "^4.17.21",
"mime-types": "^2.1.14",

@@ -45,2 +45,3 @@ "mkdirp": "^0.5.1",

"through2": "^3.0.1",
"web-encoding": "^1.1.5",
"xml": "^1.0.0",

@@ -47,0 +48,0 @@ "xml2js": "^0.4.15"

@@ -128,2 +128,9 @@ # MinIO JavaScript Library for Amazon S3 Compatible Cloud Storage [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io)

* [`listIncompleteUploads`](https://docs.min.io/docs/javascript-client-api-reference#listIncompleteUploads)
* [`getBucketVersioning`](https://docs.min.io/docs/javascript-client-api-reference#getBucketVersioning)
* [`setBucketVersioning`](https://docs.min.io/docs/javascript-client-api-reference#setBucketVersioning)
* [`setBucketLifecycle`](https://docs.min.io/docs/javascript-client-api-reference#setBucketLifecycle)
* [`getBucketLifecycle`](https://docs.min.io/docs/javascript-client-api-reference#getBucketLifecycle)
* [`removeBucketLifecycle`](https://docs.min.io/docs/javascript-client-api-reference#removeBucketLifecycle)
* [`getObjectLockConfig`](https://docs.min.io/docs/javascript-client-api-reference#getObjectLockConfig)
* [`setObjectLockConfig`](https://docs.min.io/docs/javascript-client-api-reference#setObjectLockConfig)

@@ -176,2 +183,15 @@ ### API Reference : File Object Operations

* [list-incomplete-uploads.js](https://github.com/minio/minio-js/blob/master/examples/list-incomplete-uploads.js)
* [get-bucket-versioning.js](https://github.com/minio/minio-js/blob/master/examples/get-bucket-versioning.js)
* [set-bucket-versioning.js](https://github.com/minio/minio-js/blob/master/examples/set-bucket-versioning.js)
* [set-bucket-tagging.js](https://github.com/minio/minio-js/blob/master/examples/set-bucket-tagging.js)
* [get-bucket-tagging.js](https://github.com/minio/minio-js/blob/master/examples/get-bucket-tagging.js)
* [remove-bucket-tagging.js](https://github.com/minio/minio-js/blob/master/examples/remove-bucket-tagging.js)
* [set-bucket-lifecycle.js](https://github.com/minio/minio-js/blob/master/examples/set-bucket-lifecycle.js)
* [get-bucket-lifecycle.js](https://github.com/minio/minio-js/blob/master/examples/get-bucket-lifecycle.js)
* [remove-bucket-lifecycle.js](https://github.com/minio/minio-js/blob/master/examples/remove-bucket-lifecycle.js)
* [get-object-lock-config.js](https://github.com/minio/minio-js/blob/master/examples/get-object-lock-config.js)
* [set-object-lock-config.js](https://github.com/minio/minio-js/blob/master/examples/set-object-lock-config.js)
* [set-bucket-replication.js](https://github.com/minio/minio-js/blob/master/examples/set-bucket-replication.js)
* [get-bucket-replication.js](https://github.com/minio/minio-js/blob/master/examples/get-bucket-replication.js)
* [remove-bucket-replication.js](https://github.com/minio/minio-js/blob/master/examples/remove-bucket-replication.js)

@@ -190,2 +210,9 @@ #### Full Examples : File Object Operations

* [stat-object.js](https://github.com/minio/minio-js/blob/master/examples/stat-object.js)
* [get-object-retention.js](https://github.com/minio/minio-js/blob/master/examples/get-object-retention.js)
* [put-object-retention.js](https://github.com/minio/minio-js/blob/master/examples/put-object-retention.js)
* [put-object-tagging.js](https://github.com/minio/minio-js/blob/master/examples/put-object-tagging.js)
* [get-object-tagging.js](https://github.com/minio/minio-js/blob/master/examples/get-object-tagging.js)
* [remove-object-tagging.js](https://github.com/minio/minio-js/blob/master/examples/remove-object-tagging.js)
* [set-object-legal-hold.js](https://github.com/minio/minio-js/blob/master/examples/set-object-legalhold.js)
* [get-object-legal-hold.js](https://github.com/minio/minio-js/blob/master/examples/get-object-legal-hold.js)

@@ -207,2 +234,5 @@ #### Full Examples : Presigned Operations

## Custom Settings
* [setAccelerateEndPoint](https://github.com/minio/minio-js/blob/master/examples/set-accelerate-end-point.js)
## Explore Further

@@ -209,0 +239,0 @@ * [Complete Documentation](https://docs.min.io)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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