UNPKG

@mbc-cqrs-serverless/core

Version:
41 lines 1.96 kB
"use strict"; 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); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.StepFunctionService = void 0; const client_sfn_1 = require("@aws-sdk/client-sfn"); const common_1 = require("@nestjs/common"); const config_1 = require("@nestjs/config"); const CLIENT_INSTANCE = Symbol('step-func'); let StepFunctionService = class StepFunctionService { constructor(config) { this.config = config; this[CLIENT_INSTANCE] = new client_sfn_1.SFNClient({ endpoint: config.get('SFN_ENDPOINT'), region: config.get('SFN_REGION'), }); } get client() { return this[CLIENT_INSTANCE]; } startExecution(arn, input, name) { return this.client.send(new client_sfn_1.StartExecutionCommand({ stateMachineArn: arn, name: name && name.length < 80 ? name : undefined, input: JSON.stringify(input), })); } }; exports.StepFunctionService = StepFunctionService; exports.StepFunctionService = StepFunctionService = __decorate([ (0, common_1.Injectable)(), __metadata("design:paramtypes", [config_1.ConfigService]) ], StepFunctionService); //# sourceMappingURL=step-function.service.js.map