UNPKG

mongodb-stitch

Version:

[![Join the chat at https://gitter.im/mongodb/stitch](https://badges.gitter.im/mongodb/stitch.svg)](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

60 lines 2.42 kB
import BSON from "bson"; import ResultDecoders from "./ResultDecoders"; var PutAction; (function (PutAction) { PutAction["ActionName"] = "put"; PutAction["BucketParam"] = "bucket"; PutAction["KeyParam"] = "key"; PutAction["AclParam"] = "acl"; PutAction["ContentTypeParam"] = "contentType"; PutAction["BodyParam"] = "body"; })(PutAction || (PutAction = {})); var SignPolicyAction; (function (SignPolicyAction) { SignPolicyAction["ActionName"] = "signPolicy"; SignPolicyAction["BucketParam"] = "bucket"; SignPolicyAction["KeyParam"] = "key"; SignPolicyAction["AclParam"] = "acl"; SignPolicyAction["ContentTypeParam"] = "contentType"; })(SignPolicyAction || (SignPolicyAction = {})); var CoreAwsS3ServiceClient = (function () { function CoreAwsS3ServiceClient(service) { this.service = service; } CoreAwsS3ServiceClient.prototype.putObject = function (bucket, key, acl, contentType, body) { var _a; var args = (_a = {}, _a[PutAction.BucketParam] = bucket, _a[PutAction.KeyParam] = key, _a[PutAction.AclParam] = acl, _a[PutAction.ContentTypeParam] = contentType, _a); var binaryBody = (function () { if (body instanceof Buffer) { return new BSON.Binary(body); } if (body instanceof Uint8Array) { return new BSON.Binary(new Buffer(body)); } if (body instanceof ArrayBuffer) { return new BSON.Binary(new Buffer(body)); } return body; })(); args[PutAction.BodyParam] = binaryBody; return this.service.callFunction(PutAction.ActionName, [args], ResultDecoders.PutObjectResultDecoder); }; CoreAwsS3ServiceClient.prototype.signPolicy = function (bucket, key, acl, contentType) { var _a; var args = (_a = {}, _a[SignPolicyAction.BucketParam] = bucket, _a[SignPolicyAction.KeyParam] = key, _a[SignPolicyAction.AclParam] = acl, _a[SignPolicyAction.ContentTypeParam] = contentType, _a); return this.service.callFunction(SignPolicyAction.ActionName, [args], ResultDecoders.SignPolicyResultDecoder); }; return CoreAwsS3ServiceClient; }()); export default CoreAwsS3ServiceClient; //# sourceMappingURL=CoreAwsS3ServiceClient.js.map