@kylewebb/aws-sig-v4
Version:
NestJS http client library with automatic aws v4 request signing
35 lines • 2.05 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AwsV4HttpService = void 0;
const common_1 = require("@nestjs/common");
const http_constants_1 = require("@nestjs/common/http/http.constants");
const interceptor_1 = require("aws4-axios/dist/interceptor");
const axios_1 = require("@nestjs/axios");
const constants_1 = require("./constants");
let AwsV4HttpService = class AwsV4HttpService extends axios_1.HttpService {
constructor(axiosInstance, config) {
super(axiosInstance);
axiosInstance.interceptors.request.use((0, interceptor_1.aws4Interceptor)({ options: config, credentials: config === null || config === void 0 ? void 0 : config.credentials }));
}
};
AwsV4HttpService = __decorate([
(0, common_1.Injectable)(),
__param(0, (0, common_1.Inject)(http_constants_1.AXIOS_INSTANCE_TOKEN)),
__param(1, (0, common_1.Optional)()),
__param(1, (0, common_1.Inject)(constants_1.AWS_V4_HTTP_MODULE_OPTIONS)),
__metadata("design:paramtypes", [Function, Object])
], AwsV4HttpService);
exports.AwsV4HttpService = AwsV4HttpService;
//# sourceMappingURL=aws-v4-http.service.js.map