UNPKG

@gravitywelluk/aws

Version:

Library of commonly used AWS wrapper functions to communicate with the AWS SDK

49 lines (48 loc) 2.13 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.s3Configure = exports.S3Level = void 0; const aws_xray_sdk_core_1 = __importDefault(require("aws-xray-sdk-core")); const AWSModule = __importStar(require("aws-sdk")); const utils_1 = require("../utils"); const AWS = aws_xray_sdk_core_1.default.captureAWS(AWSModule); var S3Level; (function (S3Level) { S3Level["public"] = "public"; S3Level["private"] = "private"; S3Level["protected"] = "protected"; S3Level["admin"] = "admin"; S3Level["global"] = "global"; // writable by admins, readable by all })(S3Level = exports.S3Level || (exports.S3Level = {})); /** * Create a new S3 service object * * @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property * @param awsS3ConfigOverrides - Configuration option overrides */ const s3Configure = (awsS3ConfigOverrides = {}) => { const awsConfig = (0, utils_1.awsConfigure)(); return new AWS.S3(Object.assign(Object.assign(Object.assign({}, awsConfig), awsS3ConfigOverrides), { signatureVersion: "v4" })); }; exports.s3Configure = s3Configure;