Comparing version 7.0.25 to 7.0.26
@@ -12,5 +12,9 @@ "use strict"; | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
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 _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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
@@ -42,3 +46,3 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
return AnonymousRequestError; | ||
return _createClass(AnonymousRequestError); | ||
}(_es6Error.default); // InvalidArgumentError is generated for all invalid arguments. | ||
@@ -60,3 +64,3 @@ | ||
return InvalidArgumentError; | ||
return _createClass(InvalidArgumentError); | ||
}(_es6Error.default); // InvalidPortError is generated when a non integer value is provided | ||
@@ -79,3 +83,3 @@ // for ports. | ||
return InvalidPortError; | ||
return _createClass(InvalidPortError); | ||
}(_es6Error.default); // InvalidEndpointError is generated when an invalid end point value is | ||
@@ -98,3 +102,3 @@ // provided which does not follow domain standards. | ||
return InvalidEndpointError; | ||
return _createClass(InvalidEndpointError); | ||
}(_es6Error.default); // InvalidBucketNameError is generated when an invalid bucket name is | ||
@@ -118,3 +122,3 @@ // provided which does not follow AWS S3 specifications. | ||
return InvalidBucketNameError; | ||
return _createClass(InvalidBucketNameError); | ||
}(_es6Error.default); // InvalidObjectNameError is generated when an invalid object name is | ||
@@ -138,3 +142,3 @@ // provided which does not follow AWS S3 specifications. | ||
return InvalidObjectNameError; | ||
return _createClass(InvalidObjectNameError); | ||
}(_es6Error.default); // AccessKeyRequiredError generated by signature methods when access | ||
@@ -157,3 +161,3 @@ // key is not found. | ||
return AccessKeyRequiredError; | ||
return _createClass(AccessKeyRequiredError); | ||
}(_es6Error.default); // SecretKeyRequiredError generated by signature methods when secret | ||
@@ -176,3 +180,3 @@ // key is not found. | ||
return SecretKeyRequiredError; | ||
return _createClass(SecretKeyRequiredError); | ||
}(_es6Error.default); // ExpiresParamError generated when expires parameter value is not | ||
@@ -195,3 +199,3 @@ // well within stipulated limits. | ||
return ExpiresParamError; | ||
return _createClass(ExpiresParamError); | ||
}(_es6Error.default); // InvalidDateError generated when invalid date is found. | ||
@@ -213,3 +217,3 @@ | ||
return InvalidDateError; | ||
return _createClass(InvalidDateError); | ||
}(_es6Error.default); // InvalidPrefixError generated when object prefix provided is invalid | ||
@@ -232,3 +236,3 @@ // or does not conform to AWS S3 object key restrictions. | ||
return InvalidPrefixError; | ||
return _createClass(InvalidPrefixError); | ||
}(_es6Error.default); // InvalidBucketPolicyError generated when the given bucket policy is invalid. | ||
@@ -250,3 +254,3 @@ | ||
return InvalidBucketPolicyError; | ||
return _createClass(InvalidBucketPolicyError); | ||
}(_es6Error.default); // IncorrectSizeError generated when total data read mismatches with | ||
@@ -269,3 +273,3 @@ // the input size. | ||
return IncorrectSizeError; | ||
return _createClass(IncorrectSizeError); | ||
}(_es6Error.default); // InvalidXMLError generated when an unknown XML is found. | ||
@@ -287,3 +291,3 @@ | ||
return InvalidXMLError; | ||
return _createClass(InvalidXMLError); | ||
}(_es6Error.default); // S3Error is generated for errors returned from S3 server. | ||
@@ -306,3 +310,3 @@ // see getErrorTransformer for details | ||
return S3Error; | ||
return _createClass(S3Error); | ||
}(_es6Error.default); | ||
@@ -309,0 +313,0 @@ |
@@ -26,3 +26,3 @@ "use strict"; | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
@@ -29,0 +29,0 @@ var extensions = /*#__PURE__*/function () { |
@@ -6,5 +6,7 @@ "use strict"; | ||
}); | ||
exports.RETENTION_VALIDITY_UNITS = exports.RETENTION_MODES = exports.LEGAL_HOLD_STATUS = void 0; | ||
exports.RETENTION_VALIDITY_UNITS = exports.RETENTION_MODES = exports.PART_CONSTRAINTS = exports.LEGAL_HOLD_STATUS = exports.ENCRYPTION_TYPES = exports.CopySourceOptions = exports.CopyDestinationOptions = void 0; | ||
exports.calculateEvenSplits = calculateEvenSplits; | ||
exports.extractMetadata = extractMetadata; | ||
exports.getScope = getScope; | ||
exports.getSourceVersionId = getSourceVersionId; | ||
exports.getVersionId = getVersionId; | ||
@@ -34,2 +36,3 @@ exports.insertContentType = insertContentType; | ||
exports.makeDateShort = makeDateShort; | ||
exports.partsRequired = void 0; | ||
exports.pipesetup = pipesetup; | ||
@@ -40,2 +43,3 @@ exports.prependXAMZMeta = prependXAMZMeta; | ||
exports.readableStream = readableStream; | ||
exports.removeDirAndFiles = removeDirAndFiles; | ||
exports.sanitizeETag = sanitizeETag; | ||
@@ -52,19 +56,20 @@ exports.toSha256 = exports.toMd5 = exports.toArray = exports.sanitizeObjectKey = void 0; | ||
var _lodash = _interopRequireDefault(require("lodash")); | ||
var errors = _interopRequireWildcard(require("./errors.js")); | ||
var _querystring = _interopRequireDefault(require("querystring")); | ||
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 }; } | ||
/* | ||
* MinIO Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2015 MinIO, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
var Crypto = require('crypto-browserify'); | ||
@@ -74,2 +79,6 @@ | ||
var fs = require('fs'); | ||
var path = require("path"); | ||
// Returns a wrapper function that will promisify a given callback function. | ||
@@ -159,8 +168,3 @@ // It will preserve 'this'. | ||
function isValidEndpoint(endpoint) { | ||
if (!isValidDomain(endpoint) && !isValidIP(endpoint)) { | ||
return false; | ||
} // Return true. | ||
return true; | ||
return isValidDomain(endpoint) || isValidIP(endpoint); | ||
} // isValidDomain - true if input host is a valid domain. | ||
@@ -425,2 +429,8 @@ | ||
function getSourceVersionId() { | ||
var headers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var sourceVersionId = headers["x-amz-copy-source-version-id"]; | ||
return sourceVersionId || null; | ||
} | ||
function sanitizeETag() { | ||
@@ -498,2 +508,359 @@ var etag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; | ||
exports.sanitizeObjectKey = sanitizeObjectKey; | ||
var PART_CONSTRAINTS = { | ||
// absMinPartSize - absolute minimum part size (5 MiB) | ||
ABS_MIN_PART_SIZE: 1024 * 1024 * 5, | ||
// MIN_PART_SIZE - minimum part size 16MiB per object after which | ||
MIN_PART_SIZE: 1024 * 1024 * 16, | ||
// MAX_PARTS_COUNT - maximum number of parts for a single multipart session. | ||
MAX_PARTS_COUNT: 10000, | ||
// MAX_PART_SIZE - maximum part size 5GiB for a single multipart upload | ||
// operation. | ||
MAX_PART_SIZE: 1024 * 1024 * 1024 * 5, | ||
// MAX_SINGLE_PUT_OBJECT_SIZE - maximum size 5GiB of object per PUT | ||
// operation. | ||
MAX_SINGLE_PUT_OBJECT_SIZE: 1024 * 1024 * 1024 * 5, | ||
// MAX_MULTIPART_PUT_OBJECT_SIZE - maximum size 5TiB of object for | ||
// Multipart operation. | ||
MAX_MULTIPART_PUT_OBJECT_SIZE: 1024 * 1024 * 1024 * 1024 * 5 | ||
}; | ||
exports.PART_CONSTRAINTS = PART_CONSTRAINTS; | ||
var ENCRYPTION_TYPES = { | ||
// SSEC represents server-side-encryption with customer provided keys | ||
SSEC: "SSE-C", | ||
// KMS represents server-side-encryption with managed keys | ||
KMS: "KMS" | ||
}; | ||
exports.ENCRYPTION_TYPES = ENCRYPTION_TYPES; | ||
var GENERIC_SSE_HEADER = "X-Amz-Server-Side-Encryption"; | ||
var ENCRYPTION_HEADERS = { | ||
// sseGenericHeader is the AWS SSE header used for SSE-S3 and SSE-KMS. | ||
sseGenericHeader: GENERIC_SSE_HEADER, | ||
// sseKmsKeyID is the AWS SSE-KMS key id. | ||
sseKmsKeyID: GENERIC_SSE_HEADER + "-Aws-Kms-Key-Id" | ||
}; | ||
/** | ||
* Return Encryption headers | ||
* @param encConfig | ||
* @returns an object with key value pairs that can be used in headers. | ||
*/ | ||
function getEncryptionHeaders(encConfig) { | ||
var encType = encConfig.type; | ||
var encHeaders = {}; | ||
if (!_lodash.default.isEmpty(encType)) { | ||
if (encType === ENCRYPTION_TYPES.SSEC) { | ||
return { | ||
[encHeaders[ENCRYPTION_HEADERS.sseGenericHeader]]: "AES256" | ||
}; | ||
} else if (encType === ENCRYPTION_TYPES.KMS) { | ||
return { | ||
[ENCRYPTION_HEADERS.sseGenericHeader]: encConfig.SSEAlgorithm, | ||
[ENCRYPTION_HEADERS.sseKmsKeyID]: encConfig.KMSMasterKeyID | ||
}; | ||
} | ||
} | ||
return encHeaders; | ||
} | ||
var CopySourceOptions = /*#__PURE__*/function () { | ||
/** | ||
* | ||
* @param Bucket __string__ Bucket Name | ||
* @param Object __string__ Object Name | ||
* @param VersionID __string__ Valid versionId | ||
* @param MatchETag __string__ Etag to match | ||
* @param NoMatchETag __string__ Etag to exclude | ||
* @param MatchModifiedSince __string__ Modified Date of the object/part. UTC Date in string format | ||
* @param MatchUnmodifiedSince __string__ Modified Date of the object/part to exclude UTC Date in string format | ||
* @param MatchRange __boolean__ true or false Object range to match | ||
* @param Start | ||
* @param End | ||
* @param Encryption | ||
*/ | ||
function CopySourceOptions() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
_ref$Bucket = _ref.Bucket, | ||
Bucket = _ref$Bucket === void 0 ? "" : _ref$Bucket, | ||
_ref$Object = _ref.Object, | ||
Object = _ref$Object === void 0 ? "" : _ref$Object, | ||
_ref$VersionID = _ref.VersionID, | ||
VersionID = _ref$VersionID === void 0 ? "" : _ref$VersionID, | ||
_ref$MatchETag = _ref.MatchETag, | ||
MatchETag = _ref$MatchETag === void 0 ? "" : _ref$MatchETag, | ||
_ref$NoMatchETag = _ref.NoMatchETag, | ||
NoMatchETag = _ref$NoMatchETag === void 0 ? "" : _ref$NoMatchETag, | ||
_ref$MatchModifiedSin = _ref.MatchModifiedSince, | ||
MatchModifiedSince = _ref$MatchModifiedSin === void 0 ? null : _ref$MatchModifiedSin, | ||
_ref$MatchUnmodifiedS = _ref.MatchUnmodifiedSince, | ||
MatchUnmodifiedSince = _ref$MatchUnmodifiedS === void 0 ? null : _ref$MatchUnmodifiedS, | ||
_ref$MatchRange = _ref.MatchRange, | ||
MatchRange = _ref$MatchRange === void 0 ? false : _ref$MatchRange, | ||
_ref$Start = _ref.Start, | ||
Start = _ref$Start === void 0 ? 0 : _ref$Start, | ||
_ref$End = _ref.End, | ||
End = _ref$End === void 0 ? 0 : _ref$End, | ||
_ref$Encryption = _ref.Encryption, | ||
Encryption = _ref$Encryption === void 0 ? {} : _ref$Encryption; | ||
_classCallCheck(this, CopySourceOptions); | ||
this.Bucket = Bucket; | ||
this.Object = Object; | ||
this.VersionID = VersionID; | ||
this.MatchETag = MatchETag; | ||
this.NoMatchETag = NoMatchETag; | ||
this.MatchModifiedSince = MatchModifiedSince; | ||
this.MatchUnmodifiedSince = MatchUnmodifiedSince; | ||
this.MatchRange = MatchRange; | ||
this.Start = Start; | ||
this.End = End; | ||
this.Encryption = Encryption; | ||
} | ||
_createClass(CopySourceOptions, [{ | ||
key: "validate", | ||
value: function validate() { | ||
if (!isValidBucketName(this.Bucket)) { | ||
throw new errors.InvalidBucketNameError('Invalid Source bucket name: ' + this.Bucket); | ||
} | ||
if (!isValidObjectName(this.Object)) { | ||
throw new errors.InvalidObjectNameError(`Invalid Source object name: ${this.Object}`); | ||
} | ||
if (this.MatchRange && this.Start !== -1 && this.End !== -1 && this.Start > this.End || this.Start < 0) { | ||
throw new errors.InvalidObjectNameError("Source start must be non-negative, and start must be at most end."); | ||
} else if (this.MatchRange && !isNumber(this.Start) || !isNumber(this.End)) { | ||
throw new errors.InvalidObjectNameError("MatchRange is specified. But Invalid Start and End values are specified. "); | ||
} | ||
return true; | ||
} | ||
}, { | ||
key: "getHeaders", | ||
value: function getHeaders() { | ||
var headerOptions = {}; | ||
headerOptions["x-amz-copy-source"] = encodeURI(this.Bucket + "/" + this.Object); | ||
if (!_lodash.default.isEmpty(this.VersionID)) { | ||
headerOptions["x-amz-copy-source"] = encodeURI(this.Bucket + "/" + this.Object) + "?versionId=" + this.VersionID; | ||
} | ||
if (!_lodash.default.isEmpty(this.MatchETag)) { | ||
headerOptions["x-amz-copy-source-if-match"] = this.MatchETag; | ||
} | ||
if (!_lodash.default.isEmpty(this.NoMatchETag)) { | ||
headerOptions["x-amz-copy-source-if-none-match"] = this.NoMatchETag; | ||
} | ||
if (!_lodash.default.isEmpty(this.MatchModifiedSince)) { | ||
headerOptions["x-amz-copy-source-if-modified-since"] = this.MatchModifiedSince; | ||
} | ||
if (!_lodash.default.isEmpty(this.MatchUnmodifiedSince)) { | ||
headerOptions["x-amz-copy-source-if-unmodified-since"] = this.MatchUnmodifiedSince; | ||
} | ||
return headerOptions; | ||
} | ||
}]); | ||
return CopySourceOptions; | ||
}(); | ||
exports.CopySourceOptions = CopySourceOptions; | ||
var CopyDestinationOptions = /*#__PURE__*/function () { | ||
/* | ||
* @param Bucket __string__ | ||
* @param Object __string__ Object Name for the destination (composed/copied) object defaults | ||
* @param Encryption __object__ Encryption configuration defaults to {} | ||
* @param UserMetadata __object__ | ||
* @param UserTags __object__ | __string__ | ||
* @param LegalHold __string__ ON | OFF | ||
* @param RetainUntilDate __string__ UTC Date String | ||
* @param Mode | ||
*/ | ||
function CopyDestinationOptions(_ref2) { | ||
var _ref2$Bucket = _ref2.Bucket, | ||
Bucket = _ref2$Bucket === void 0 ? "" : _ref2$Bucket, | ||
_ref2$Object = _ref2.Object, | ||
Object = _ref2$Object === void 0 ? "" : _ref2$Object, | ||
_ref2$Encryption = _ref2.Encryption, | ||
Encryption = _ref2$Encryption === void 0 ? null : _ref2$Encryption, | ||
_ref2$UserMetadata = _ref2.UserMetadata, | ||
UserMetadata = _ref2$UserMetadata === void 0 ? null : _ref2$UserMetadata, | ||
_ref2$UserTags = _ref2.UserTags, | ||
UserTags = _ref2$UserTags === void 0 ? null : _ref2$UserTags, | ||
_ref2$LegalHold = _ref2.LegalHold, | ||
LegalHold = _ref2$LegalHold === void 0 ? null : _ref2$LegalHold, | ||
_ref2$RetainUntilDate = _ref2.RetainUntilDate, | ||
RetainUntilDate = _ref2$RetainUntilDate === void 0 ? null : _ref2$RetainUntilDate, | ||
_ref2$Mode = _ref2.Mode, | ||
Mode = _ref2$Mode === void 0 ? null : _ref2$Mode; | ||
_classCallCheck(this, CopyDestinationOptions); | ||
this.Bucket = Bucket; | ||
this.Object = Object; | ||
this.Encryption = Encryption; | ||
this.UserMetadata = UserMetadata; | ||
this.UserTags = UserTags; | ||
this.LegalHold = LegalHold; | ||
this.Mode = Mode; // retention mode | ||
this.RetainUntilDate = RetainUntilDate; | ||
} | ||
_createClass(CopyDestinationOptions, [{ | ||
key: "getHeaders", | ||
value: function getHeaders() { | ||
var _this2 = this; | ||
var replaceDirective = "REPLACE"; | ||
var headerOptions = {}; | ||
var userTags = this.UserTags; | ||
if (!_lodash.default.isEmpty(userTags)) { | ||
headerOptions["X-Amz-Tagging-Directive"] = replaceDirective; | ||
headerOptions["X-Amz-Tagging"] = isObject(userTags) ? _querystring.default.stringify(userTags) : isString(userTags) ? userTags : ""; | ||
} | ||
if (!_lodash.default.isEmpty(this.Mode)) { | ||
headerOptions["X-Amz-Object-Lock-Mode"] = this.Mode; // GOVERNANCE or COMPLIANCE | ||
} | ||
if (!_lodash.default.isEmpty(this.RetainUntilDate)) { | ||
headerOptions["X-Amz-Object-Lock-Retain-Until-Date"] = this.RetainUntilDate; // needs to be UTC. | ||
} | ||
if (!_lodash.default.isEmpty(this.LegalHold)) { | ||
headerOptions["X-Amz-Object-Lock-Legal-Hold"] = this.LegalHold; // ON or OFF | ||
} | ||
if (!_lodash.default.isEmpty(this.UserMetadata)) { | ||
var headerKeys = Object.keys(this.UserMetadata); | ||
headerKeys.forEach(function (key) { | ||
headerOptions[`X-Amz-Meta-${key}`] = _this2.UserMetadata[key]; | ||
}); | ||
} | ||
if (!_lodash.default.isEmpty(this.Encryption)) { | ||
var encryptionHeaders = getEncryptionHeaders(this.Encryption); | ||
Object.keys(encryptionHeaders).forEach(function (key) { | ||
headerOptions[key] = encryptionHeaders[key]; | ||
}); | ||
} | ||
return headerOptions; | ||
} | ||
}, { | ||
key: "validate", | ||
value: function validate() { | ||
if (!isValidBucketName(this.Bucket)) { | ||
throw new errors.InvalidBucketNameError('Invalid Destination bucket name: ' + this.Bucket); | ||
} | ||
if (!isValidObjectName(this.Object)) { | ||
throw new errors.InvalidObjectNameError(`Invalid Destination object name: ${this.Object}`); | ||
} | ||
if (!_lodash.default.isEmpty(this.UserMetadata) && !isObject(this.UserMetadata)) { | ||
throw new errors.InvalidObjectNameError(`Destination UserMetadata should be an object with key value pairs`); | ||
} | ||
if (!_lodash.default.isEmpty(this.Mode) && ![RETENTION_MODES.GOVERNANCE, RETENTION_MODES.COMPLIANCE].includes(this.Mode)) { | ||
throw new errors.InvalidObjectNameError(`Invalid Mode specified for destination object it should be one of [GOVERNANCE,COMPLIANCE]`); | ||
} | ||
if (!_lodash.default.isEmpty(this.Encryption) && _lodash.default.isEmpty(this.Encryption)) { | ||
throw new errors.InvalidObjectNameError(`Invalid Encryption configuration for destination object `); | ||
} | ||
return true; | ||
} | ||
}]); | ||
return CopyDestinationOptions; | ||
}(); | ||
exports.CopyDestinationOptions = CopyDestinationOptions; | ||
var partsRequired = function partsRequired(size) { | ||
var maxPartSize = PART_CONSTRAINTS.MAX_MULTIPART_PUT_OBJECT_SIZE / (PART_CONSTRAINTS.MAX_PARTS_COUNT - 1); | ||
var requiredPartSize = size / maxPartSize; | ||
if (size % maxPartSize > 0) { | ||
requiredPartSize++; | ||
} | ||
requiredPartSize = Math.trunc(requiredPartSize); | ||
return requiredPartSize; | ||
}; // calculateEvenSplits - computes splits for a source and returns | ||
// start and end index slices. Splits happen evenly to be sure that no | ||
// part is less than 5MiB, as that could fail the multipart request if | ||
// it is not the last part. | ||
exports.partsRequired = partsRequired; | ||
var startIndexParts = []; | ||
var endIndexParts = []; | ||
function calculateEvenSplits(size, objInfo) { | ||
if (size === 0) { | ||
return null; | ||
} | ||
var reqParts = partsRequired(size); | ||
startIndexParts = new Array(reqParts); | ||
endIndexParts = new Array(reqParts); | ||
var start = objInfo.Start; | ||
if (_lodash.default.isEmpty(objInfo.Start) || start === -1) { | ||
start = 0; | ||
} | ||
var divisorValue = Math.trunc(size / reqParts); | ||
var reminderValue = size % reqParts; | ||
var nextStart = start; | ||
for (var i = 0; i < reqParts; i++) { | ||
var curPartSize = divisorValue; | ||
if (i < reminderValue) { | ||
curPartSize++; | ||
} | ||
var currentStart = nextStart; | ||
var currentEnd = currentStart + curPartSize - 1; | ||
nextStart = currentEnd + 1; | ||
startIndexParts[i] = currentStart; | ||
endIndexParts[i] = currentEnd; | ||
} | ||
return { | ||
startIndex: startIndexParts, | ||
endIndex: endIndexParts, | ||
objInfo: objInfo | ||
}; | ||
} | ||
function removeDirAndFiles(dirPath, removeSelf) { | ||
if (removeSelf === undefined) removeSelf = true; | ||
try { | ||
var files = fs.readdirSync(dirPath); | ||
} catch (e) { | ||
return; | ||
} | ||
if (files.length > 0) for (var i = 0; i < files.length; i++) { | ||
var filePath = path.join(dirPath, files[i]); | ||
if (fs.statSync(filePath).isFile()) fs.unlinkSync(filePath);else removeDirAndFiles(filePath); | ||
} | ||
if (removeSelf) fs.rmdirSync(dirPath); | ||
} | ||
//# sourceMappingURL=helpers.js.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
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 _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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
@@ -37,3 +37,3 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
@@ -141,3 +141,3 @@ // Notification config - array of target configs. | ||
return TopicConfig; | ||
return _createClass(TopicConfig); | ||
}(TargetConfig); // 2. Queue (simple queue service) | ||
@@ -163,3 +163,3 @@ | ||
return QueueConfig; | ||
return _createClass(QueueConfig); | ||
}(TargetConfig); // 3. CloudFront (lambda function) | ||
@@ -185,3 +185,3 @@ | ||
return CloudFunctionConfig; | ||
return _createClass(CloudFunctionConfig); | ||
}(TargetConfig); | ||
@@ -188,0 +188,0 @@ |
@@ -26,5 +26,5 @@ "use strict"; | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
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 _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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
@@ -31,0 +31,0 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } |
@@ -29,2 +29,3 @@ "use strict"; | ||
exports.replicationConfigTransformer = replicationConfigTransformer; | ||
exports.uploadPartTransformer = uploadPartTransformer; | ||
@@ -302,2 +303,6 @@ var xmlParsers = _interopRequireWildcard(require("./xml-parsers.js")); | ||
} | ||
function uploadPartTransformer() { | ||
return getConcater(xmlParsers.uploadPartParser); | ||
} | ||
//# sourceMappingURL=transformers.js.map |
@@ -26,2 +26,3 @@ "use strict"; | ||
exports.parseTagging = parseTagging; | ||
exports.uploadPartParser = uploadPartParser; | ||
@@ -131,3 +132,3 @@ var _fastXmlParser = _interopRequireDefault(require("fast-xml-parser")); | ||
result.prefixes.push({ | ||
prefix: (0, _helpers.toArray)(prefix)[0] | ||
prefix: (0, _helpers.sanitizeObjectKey)((0, _helpers.toArray)(prefix.Prefix)[0]) | ||
}); | ||
@@ -411,5 +412,4 @@ }); | ||
(0, _helpers.toArray)(responseEntity).forEach(function (commonPrefix) { | ||
var prefix = (0, _helpers.toArray)(commonPrefix.Prefix)[0]; | ||
result.objects.push({ | ||
prefix, | ||
prefix: (0, _helpers.sanitizeObjectKey)((0, _helpers.toArray)(commonPrefix.Prefix)[0]), | ||
size: 0 | ||
@@ -523,7 +523,5 @@ }); | ||
(0, _helpers.toArray)(xmlobj.CommonPrefixes).forEach(function (commonPrefix) { | ||
var prefix = (0, _helpers.toArray)(commonPrefix.Prefix)[0]; | ||
var size = 0; | ||
result.objects.push({ | ||
prefix, | ||
size | ||
prefix: (0, _helpers.sanitizeObjectKey)((0, _helpers.toArray)(commonPrefix.Prefix)[0]), | ||
size: 0 | ||
}); | ||
@@ -578,7 +576,5 @@ }); | ||
(0, _helpers.toArray)(xmlobj.CommonPrefixes).forEach(function (commonPrefix) { | ||
var prefix = (0, _helpers.toArray)(commonPrefix.Prefix)[0]; | ||
var size = 0; | ||
result.objects.push({ | ||
prefix, | ||
size | ||
prefix: (0, _helpers.sanitizeObjectKey)((0, _helpers.toArray)(commonPrefix.Prefix)[0]), | ||
size: 0 | ||
}); | ||
@@ -678,2 +674,8 @@ }); | ||
} | ||
function uploadPartParser(xml) { | ||
var xmlObj = parseXml(xml); | ||
var respEl = xmlObj.CopyPartResult; | ||
return respEl; | ||
} | ||
//# sourceMappingURL=xml-parsers.js.map |
{ | ||
"name": "minio", | ||
"version": "7.0.25", | ||
"version": "7.0.26", | ||
"description": "S3 Compatible Cloud Storage client", | ||
@@ -69,2 +69,3 @@ "main": "./dist/main/minio.js", | ||
"source-map-support": "^0.5.13", | ||
"split-file": "^2.2.2", | ||
"superagent": "^5.1.0", | ||
@@ -71,0 +72,0 @@ "uuid": "^3.3.2" |
@@ -215,3 +215,4 @@ # MinIO JavaScript Library for Amazon S3 Compatible Cloud Storage [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io) | ||
* [get-object-legal-hold.js](https://github.com/minio/minio-js/blob/master/examples/get-object-legal-hold.js) | ||
* [compose-object.js](https://github.com/minio/minio-js/blob/master/examples/compose-object.js) | ||
#### Full Examples : Presigned Operations | ||
@@ -218,0 +219,0 @@ * [presigned-getobject.js](https://github.com/minio/minio-js/blob/master/examples/presigned-getobject.js) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
317463
17
6245
246
19
2