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)

65 lines 2.73 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var bson_1 = __importDefault(require("bson")); var ResultDecoders_1 = __importDefault(require("./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_1.default.Binary(body); } if (body instanceof Uint8Array) { return new bson_1.default.Binary(new Buffer(body)); } if (body instanceof ArrayBuffer) { return new bson_1.default.Binary(new Buffer(body)); } return body; })(); args[PutAction.BodyParam] = binaryBody; return this.service.callFunction(PutAction.ActionName, [args], ResultDecoders_1.default.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_1.default.SignPolicyResultDecoder); }; return CoreAwsS3ServiceClient; }()); exports.default = CoreAwsS3ServiceClient; //# sourceMappingURL=CoreAwsS3ServiceClient.js.map