chatbot-nc 2.0.35 → 2.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ declare class idObfuscationService {
2
+ private hashIds;
3
+ private config;
4
+ constructor();
5
+ private getHashIds;
6
+ encode(id: string): Promise<string | undefined>;
7
+ decode(id: string): Promise<import("hashids/cjs/util").NumberLike>;
8
+ }
9
+ declare let hashIds: idObfuscationService;
10
+ export default hashIds;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const AWSSSM_1 = require("../aws/services/AWSSSM");
16
+ const SSMParameters_1 = require("../config/SSMParameters");
17
+ const hashids_1 = __importDefault(require("hashids"));
18
+ class idObfuscationService {
19
+ constructor() {
20
+ this.hashIds = new hashids_1.default();
21
+ (() => __awaiter(this, void 0, void 0, function* () {
22
+ console.log("Calling Get HashIds");
23
+ yield this.getHashIds();
24
+ }))();
25
+ }
26
+ getHashIds() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ try {
29
+ console.log("Checking config is avaliable or not");
30
+ if (!this.config) {
31
+ this.config = yield AWSSSM_1.SSM.getSSMParameter(SSMParameters_1.ssmParameter.idObfuscationSSM);
32
+ console.log("Config is not avaliable");
33
+ }
34
+ console.log("Salt", this.config.Salt);
35
+ console.log("MinHashLength", this.config.MinHashLength);
36
+ this.hashIds = yield new hashids_1.default(this.config.Salt, +this.config.MinHashLength);
37
+ return;
38
+ }
39
+ catch (error) {
40
+ throw error;
41
+ }
42
+ });
43
+ }
44
+ encode(id) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ try {
47
+ return yield this.hashIds.encode(id)[0];
48
+ }
49
+ catch (error) {
50
+ }
51
+ });
52
+ }
53
+ decode(id) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ try {
56
+ return yield this.hashIds.decode(id)[0];
57
+ }
58
+ catch (error) {
59
+ throw error;
60
+ }
61
+ });
62
+ }
63
+ }
64
+ let hashIds = new idObfuscationService();
65
+ exports.default = hashIds;
66
+ //# sourceMappingURL=idObfuscation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idObfuscation.js","sourceRoot":"","sources":["../../../hashing/idObfuscation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,mDAA4C;AAC5C,2DAAuD;AACvD,sDAA8B;AAE9B,MAAM,oBAAoB;IAItB;QAHQ,YAAO,GAAY,IAAI,iBAAO,EAAE,CAAC;QAIxC,CAAC,GAAQ,EAAE;YACP,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACnC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC,CAAA,CAAC,EAAE,CAAC;IACN,CAAC;IAEa,UAAU;;YACvB,IAAI;gBACA,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;gBACnD,IAAG,CAAC,IAAI,CAAC,MAAM,EACf;oBACI,IAAI,CAAC,MAAM,GAAG,MAAM,YAAG,CAAC,eAAe,CAAC,4BAAY,CAAC,gBAAgB,CAAC,CAAC;oBACvE,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;iBACzC;gBACD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACtC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBACxD,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,iBAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBAC/E,OAAO;aACV;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,KAAK,CAAC;aACf;QACF,CAAC;KAAA;IAEK,MAAM,CAAC,EAAS;;YAErB,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aAEzC;YAAC,OAAO,KAAK,EAAE;aAEf;QACF,CAAC;KAAA;IAEK,MAAM,CAAC,EAAS;;YAErB,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aACzC;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,KAAK,CAAC;aACb;QACF,CAAC;KAAA;CACJ;AAED,IAAI,OAAO,GAAG,IAAI,oBAAoB,EAAE,CAAC;AACzC,kBAAe,OAAO,CAAC"}
@@ -5,6 +5,7 @@ import WebHookEvent from "./webbookEvent";
5
5
  import BaseDynamoDBRepository from "./repository/dynamodb";
6
6
  import BaseCommunicationService from "./communication";
7
7
  import { HashService } from "./hashing";
8
+ import hashids from "./hashing/idObfuscation";
8
9
  import UrlService from "./shortner";
9
10
  import { Utils } from "./utils";
10
- export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService };
11
+ export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids };
package/dist/cjs/index.js CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.UrlService = exports.HashService = exports.BaseDynamoDBRepository = exports.WebHookEvent = exports.BaseCommunicationService = exports.Utils = exports.ENUM = exports.axios = exports.AWS = void 0;
29
+ exports.hashids = exports.UrlService = exports.HashService = exports.BaseDynamoDBRepository = exports.WebHookEvent = exports.BaseCommunicationService = exports.Utils = exports.ENUM = exports.axios = exports.AWS = void 0;
30
30
  const aws_1 = require("./aws");
31
31
  Object.defineProperty(exports, "AWS", { enumerable: true, get: function () { return aws_1.AWS; } });
32
32
  const axios_1 = __importDefault(require("axios"));
@@ -41,6 +41,8 @@ const communication_1 = __importDefault(require("./communication"));
41
41
  exports.BaseCommunicationService = communication_1.default;
42
42
  const hashing_1 = require("./hashing");
43
43
  Object.defineProperty(exports, "HashService", { enumerable: true, get: function () { return hashing_1.HashService; } });
44
+ const idObfuscation_1 = __importDefault(require("./hashing/idObfuscation"));
45
+ exports.hashids = idObfuscation_1.default;
44
46
  const shortner_1 = __importDefault(require("./shortner"));
45
47
  exports.UrlService = shortner_1.default;
46
48
  const utils_1 = require("./utils");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAWzB,oFAXM,SAAG,OAWN;AAVN,kDAAyB;AAWtB,gBAXI,eAAK,CAWJ;AAVR,6CAA+B;AAW5B,oBAAI;AAVP,kEAA0C;AAavC,uBAbI,sBAAY,CAaJ;AAZf,qEAA2D;AAaxD,iCAbI,kBAAsB,CAaJ;AAZzB,oEAAuD;AAUpD,mCAVI,uBAAwB,CAUJ;AAT3B,uCAAwC;AAYrC,4FAZM,qBAAW,OAYN;AAXd,0DAAoC;AAYjC,qBAZI,kBAAU,CAYJ;AAXb,mCAAgC;AAM7B,sFANM,aAAK,OAMN"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAYzB,oFAZM,SAAG,OAYN;AAXN,kDAAyB;AAYtB,gBAZI,eAAK,CAYJ;AAXR,6CAA+B;AAY5B,oBAAI;AAXP,kEAA0C;AAcvC,uBAdI,sBAAY,CAcJ;AAbf,qEAA2D;AAcxD,iCAdI,kBAAsB,CAcJ;AAbzB,oEAAuD;AAWpD,mCAXI,uBAAwB,CAWJ;AAV3B,uCAAwC;AAarC,4FAbM,qBAAW,OAaN;AAZd,4EAA8C;AAc3C,kBAdI,uBAAO,CAcJ;AAbV,0DAAoC;AAYjC,qBAZI,kBAAU,CAYJ;AAXb,mCAAgC;AAM7B,sFANM,aAAK,OAMN"}
@@ -0,0 +1,10 @@
1
+ declare class idObfuscationService {
2
+ private hashIds;
3
+ private config;
4
+ constructor();
5
+ private getHashIds;
6
+ encode(id: string): Promise<string | undefined>;
7
+ decode(id: string): Promise<import("hashids/cjs/util").NumberLike>;
8
+ }
9
+ declare let hashIds: idObfuscationService;
10
+ export default hashIds;
@@ -0,0 +1,61 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { SSM } from "../aws/services/AWSSSM";
11
+ import { ssmParameter } from '../config/SSMParameters';
12
+ import Hashids from "hashids";
13
+ class idObfuscationService {
14
+ constructor() {
15
+ this.hashIds = new Hashids();
16
+ (() => __awaiter(this, void 0, void 0, function* () {
17
+ console.log("Calling Get HashIds");
18
+ yield this.getHashIds();
19
+ }))();
20
+ }
21
+ getHashIds() {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ try {
24
+ console.log("Checking config is avaliable or not");
25
+ if (!this.config) {
26
+ this.config = yield SSM.getSSMParameter(ssmParameter.idObfuscationSSM);
27
+ console.log("Config is not avaliable");
28
+ }
29
+ console.log("Salt", this.config.Salt);
30
+ console.log("MinHashLength", this.config.MinHashLength);
31
+ this.hashIds = yield new Hashids(this.config.Salt, +this.config.MinHashLength);
32
+ return;
33
+ }
34
+ catch (error) {
35
+ throw error;
36
+ }
37
+ });
38
+ }
39
+ encode(id) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ try {
42
+ return yield this.hashIds.encode(id)[0];
43
+ }
44
+ catch (error) {
45
+ }
46
+ });
47
+ }
48
+ decode(id) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ try {
51
+ return yield this.hashIds.decode(id)[0];
52
+ }
53
+ catch (error) {
54
+ throw error;
55
+ }
56
+ });
57
+ }
58
+ }
59
+ let hashIds = new idObfuscationService();
60
+ export default hashIds;
61
+ //# sourceMappingURL=idObfuscation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idObfuscation.js","sourceRoot":"","sources":["../../../hashing/idObfuscation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,oBAAoB;IAItB;QAHQ,YAAO,GAAY,IAAI,OAAO,EAAE,CAAC;QAIxC,CAAC,GAAQ,EAAE;YACP,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACnC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC,CAAA,CAAC,EAAE,CAAC;IACN,CAAC;IAEa,UAAU;;YACvB,IAAI;gBACA,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;gBACnD,IAAG,CAAC,IAAI,CAAC,MAAM,EACf;oBACI,IAAI,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,eAAe,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;oBACvE,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;iBACzC;gBACD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACtC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBACxD,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBAC/E,OAAO;aACV;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,KAAK,CAAC;aACf;QACF,CAAC;KAAA;IAEK,MAAM,CAAC,EAAS;;YAErB,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aAEzC;YAAC,OAAO,KAAK,EAAE;aAEf;QACF,CAAC;KAAA;IAEK,MAAM,CAAC,EAAS;;YAErB,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aACzC;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,KAAK,CAAC;aACb;QACF,CAAC;KAAA;CACJ;AAED,IAAI,OAAO,GAAG,IAAI,oBAAoB,EAAE,CAAC;AACzC,eAAe,OAAO,CAAC"}
@@ -5,6 +5,7 @@ import WebHookEvent from "./webbookEvent";
5
5
  import BaseDynamoDBRepository from "./repository/dynamodb";
6
6
  import BaseCommunicationService from "./communication";
7
7
  import { HashService } from "./hashing";
8
+ import hashids from "./hashing/idObfuscation";
8
9
  import UrlService from "./shortner";
9
10
  import { Utils } from "./utils";
10
- export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService };
11
+ export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids };
package/dist/esm/index.js CHANGED
@@ -5,7 +5,8 @@ import WebHookEvent from "./webbookEvent";
5
5
  import BaseDynamoDBRepository from "./repository/dynamodb";
6
6
  import BaseCommunicationService from "./communication";
7
7
  import { HashService } from "./hashing";
8
+ import hashids from "./hashing/idObfuscation";
8
9
  import UrlService from "./shortner";
9
10
  import { Utils } from "./utils";
10
- export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService };
11
+ export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids };
11
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,sBAAsB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,wBAAwB,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EACJ,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,EACL,wBAAwB,EACxB,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,UAAU,EACZ,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,sBAAsB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,wBAAwB,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EACJ,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,EACL,wBAAwB,EACxB,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,OAAO,EACT,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatbot-nc",
3
- "version": "2.0.35",
3
+ "version": "2.0.37",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",