🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

crs-client-js

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crs-client-js - npm Package Compare versions

Comparing version
0.3.9
to
0.3.10
+19
dist/crs-client.d.ts
import { SQSClient } from '@aws-sdk/client-sqs';
import { JsonValue } from 'type-fest';
export declare enum SourceEventType {
LAMBDA_TRIGGER = "LAMBDA_TRIGGER",
API_CALL = "API_CALL"
}
export type SourceEvent = {
type: SourceEventType;
payload: JsonValue;
};
export type CRSClientOptions = {
replicationQueueName: string;
sqsClient: SQSClient;
};
export declare class CRSClient {
readonly options: CRSClientOptions;
constructor(options: CRSClientOptions);
replicateEvent: (sourceEvent: SourceEvent) => Promise<void>;
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CRSClient = exports.SourceEventType = void 0;
const client_sqs_1 = require("@aws-sdk/client-sqs");
const queue_1 = require("./helpers/queue");
var SourceEventType;
(function (SourceEventType) {
SourceEventType["LAMBDA_TRIGGER"] = "LAMBDA_TRIGGER";
SourceEventType["API_CALL"] = "API_CALL";
})(SourceEventType || (exports.SourceEventType = SourceEventType = {}));
class CRSClient {
constructor(options) {
this.options = options;
this.replicateEvent = (sourceEvent) => __awaiter(this, void 0, void 0, function* () {
const command = new client_sqs_1.SendMessageCommand({
QueueUrl: yield (0, queue_1.getQueueUrl)(this.options.sqsClient, this.options.replicationQueueName),
MessageBody: JSON.stringify(sourceEvent),
});
yield this.options.sqsClient.send(command);
});
}
}
exports.CRSClient = CRSClient;
//# sourceMappingURL=crs-client.js.map
{"version":3,"file":"crs-client.js","sourceRoot":"","sources":["../src/crs-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoE;AAGpE,2CAA8C;AAE9C,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,oDAAiC,CAAA;IACjC,wCAAqB,CAAA;AACvB,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAYD,MAAa,SAAS;IACpB,YAA4B,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;QAE9C,mBAAc,GAAG,CAAO,WAAwB,EAAiB,EAAE;YACxE,MAAM,OAAO,GAAG,IAAI,+BAAkB,CAAC;gBACrC,QAAQ,EAAE,MAAM,IAAA,mBAAW,EAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;gBACtF,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;aACzC,CAAC,CAAC;YACH,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC,CAAA,CAAC;IARsD,CAAC;CAS1D;AAVD,8BAUC"}
import { SQSClient } from '@aws-sdk/client-sqs';
export declare const getQueueUrl: (sqsClient: SQSClient, queueName: string) => Promise<string>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getQueueUrl = void 0;
const client_sqs_1 = require("@aws-sdk/client-sqs");
const getQueueUrl = (sqsClient, queueName) => __awaiter(void 0, void 0, void 0, function* () {
const command = new client_sqs_1.GetQueueUrlCommand({
QueueName: queueName,
});
const result = yield sqsClient.send(command);
return result.QueueUrl;
});
exports.getQueueUrl = getQueueUrl;
//# sourceMappingURL=queue.js.map
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../src/helpers/queue.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoE;AAE7D,MAAM,WAAW,GAAG,CAAO,SAAoB,EAAE,SAAiB,EAAmB,EAAE;IAC5F,MAAM,OAAO,GAAG,IAAI,+BAAkB,CAAC;QACrC,SAAS,EAAE,SAAS;KACrB,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,QAAQ,CAAC;AACzB,CAAC,CAAA,CAAC;AANW,QAAA,WAAW,eAMtB"}
+2
-2
{
"name": "crs-client-js",
"version": "0.3.9",
"version": "0.3.10",
"title": "Cognito Replication Solution JS Client",

@@ -40,3 +40,3 @@ "description": "Cognito user pool replication solution Javascript/Typescript client",

"prettier:format": "prettier --config .prettierrc 'src/**/*.{js,ts}' --write",
"package:publish": "rm -rf ./dist & tsc & npm publish"
"package:publish": "rm -rf ./dist && tsc && npm publish"
},

@@ -43,0 +43,0 @@ "keywords": [],