@bwi-mentorspaces/application-utils-npm 0.0.6 → 0.0.7

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.
Files changed (114) hide show
  1. package/chat/index.d.ts +36 -36
  2. package/chat/index.js +58 -58
  3. package/chat/stream/enum/index.d.ts +33 -27
  4. package/chat/stream/enum/index.js +41 -34
  5. package/chat/stream/enum/index.js.map +1 -1
  6. package/chat/stream/index.d.ts +9 -9
  7. package/chat/stream/index.js +17 -17
  8. package/chat/stream/models/_/channel.data.d.ts +19 -19
  9. package/chat/stream/models/_/channel.data.js +2 -2
  10. package/chat/stream/models/_/channel.member.d.ts +14 -14
  11. package/chat/stream/models/_/channel.member.js +11 -11
  12. package/chat/stream/models/_/channel.response.d.ts +8 -8
  13. package/chat/stream/models/_/channel.response.js +2 -2
  14. package/chat/stream/models/_/event.data.d.ts +16 -0
  15. package/chat/stream/models/_/event.data.js +4 -0
  16. package/chat/stream/models/_/event.data.js.map +1 -0
  17. package/chat/stream/models/_/message.response.d.ts +8 -8
  18. package/chat/stream/models/_/message.response.js +2 -2
  19. package/chat/stream/models/_/stream.config.d.ts +22 -22
  20. package/chat/stream/models/_/stream.config.js +2 -2
  21. package/chat/stream/models/_/user.response.d.ts +8 -8
  22. package/chat/stream/models/_/user.response.js +2 -2
  23. package/chat/stream/models/index.d.ts +9 -7
  24. package/chat/stream/models/index.js +5 -5
  25. package/chat/stream/models/index.js.map +1 -1
  26. package/chat/stream/stream.api.d.ts +63 -63
  27. package/chat/stream/stream.api.js +76 -76
  28. package/chat/stream/stream.auth.d.ts +70 -70
  29. package/chat/stream/stream.auth.js +80 -80
  30. package/chat/stream/stream.base.d.ts +56 -56
  31. package/chat/stream/stream.base.js +93 -93
  32. package/chat/stream/stream.channel.d.ts +132 -118
  33. package/chat/stream/stream.channel.js +306 -285
  34. package/chat/stream/stream.channel.js.map +1 -1
  35. package/chat/stream/stream.error.d.ts +19 -19
  36. package/chat/stream/stream.error.js +17 -17
  37. package/chat/stream/stream.member.d.ts +75 -75
  38. package/chat/stream/stream.member.js +175 -175
  39. package/chat/stream/stream.message.d.ts +59 -59
  40. package/chat/stream/stream.message.js +112 -112
  41. package/chat/stream/stream.user.d.ts +49 -49
  42. package/chat/stream/stream.user.js +90 -90
  43. package/core/_/api-error.d.ts +24 -24
  44. package/core/_/api-error.js +21 -21
  45. package/core/_/api-response.d.ts +25 -25
  46. package/core/_/api-response.js +21 -21
  47. package/core/_/cors-headers.d.ts +16 -16
  48. package/core/_/cors-headers.js +32 -32
  49. package/core/_/model.d.ts +39 -31
  50. package/core/_/model.js +2 -2
  51. package/core/_/service-request.d.ts +66 -66
  52. package/core/_/service-request.js +104 -104
  53. package/core/_/service-request.js.map +1 -1
  54. package/core/index.d.ts +10 -10
  55. package/core/index.js +11 -11
  56. package/deployment/_/serverless.d.ts +26 -26
  57. package/deployment/_/serverless.js +43 -43
  58. package/deployment/index.d.ts +2 -2
  59. package/deployment/index.js +5 -5
  60. package/endpoint-test-factory/_/test-factory.d.ts +45 -45
  61. package/endpoint-test-factory/_/test-factory.js +91 -91
  62. package/endpoint-test-factory/index.d.ts +2 -2
  63. package/endpoint-test-factory/index.js +5 -5
  64. package/enums/index.d.ts +92 -92
  65. package/enums/index.js +2 -2
  66. package/meet/index.d.ts +36 -36
  67. package/meet/index.js +58 -58
  68. package/meet/twilio/enum/index.d.ts +6 -6
  69. package/meet/twilio/enum/index.js +10 -10
  70. package/meet/twilio/index.d.ts +5 -5
  71. package/meet/twilio/index.js +11 -11
  72. package/meet/twilio/models/_/room.data.d.ts +6 -6
  73. package/meet/twilio/models/_/room.data.js +2 -2
  74. package/meet/twilio/models/_/twilio.config.d.ts +29 -29
  75. package/meet/twilio/models/_/twilio.config.js +2 -2
  76. package/meet/twilio/models/index.d.ts +3 -3
  77. package/meet/twilio/models/index.js +2 -2
  78. package/meet/twilio/twilio.api.d.ts +28 -28
  79. package/meet/twilio/twilio.api.js +45 -45
  80. package/meet/twilio/twilio.auth.d.ts +55 -55
  81. package/meet/twilio/twilio.auth.js +83 -83
  82. package/meet/twilio/twilio.base.d.ts +41 -41
  83. package/meet/twilio/twilio.base.js +53 -53
  84. package/meet/twilio/twilio.room.d.ts +46 -46
  85. package/meet/twilio/twilio.room.js +124 -124
  86. package/package.json +57 -57
  87. package/swagger/_/swagger.config.d.ts +21 -21
  88. package/swagger/_/swagger.config.js +2 -2
  89. package/swagger/_/swagger.d.ts +37 -37
  90. package/swagger/_/swagger.js +78 -78
  91. package/swagger/index.d.ts +3 -3
  92. package/swagger/index.js +5 -5
  93. package/types/index.d.ts +19 -19
  94. package/types/index.js +2 -2
  95. package/utils/_/encoder.d.ts +19 -19
  96. package/utils/_/encoder.js +27 -27
  97. package/utils/_/encryptor.d.ts +26 -26
  98. package/utils/_/encryptor.js +67 -67
  99. package/utils/_/hasher.d.ts +25 -25
  100. package/utils/_/hasher.js +63 -63
  101. package/utils/_/object-mapper.d.ts +12 -12
  102. package/utils/_/object-mapper.js +22 -22
  103. package/utils/_/string-formatter.d.ts +34 -34
  104. package/utils/_/string-formatter.js +49 -49
  105. package/utils/_/utc-date.d.ts +35 -35
  106. package/utils/_/utc-date.js +84 -84
  107. package/utils/index.d.ts +7 -7
  108. package/utils/index.js +15 -15
  109. package/validators/_/checker.d.ts +62 -62
  110. package/validators/_/checker.js +98 -98
  111. package/validators/_/regex.d.ts +98 -98
  112. package/validators/_/regex.js +142 -142
  113. package/validators/index.d.ts +3 -3
  114. package/validators/index.js +7 -7
@@ -1,37 +1,37 @@
1
- import Express from "express";
2
- import { ISwaggerConfig } from "./swagger.config";
3
- /**
4
- * Swagger declarations
5
- */
6
- interface ISwagger {
7
- config: ISwaggerConfig;
8
- /**
9
- * Setup method declaration
10
- */
11
- setup(): void;
12
- }
13
- /**
14
- * Swagger implemenation
15
- */
16
- export declare class Swagger implements ISwagger {
17
- private _app;
18
- private _config;
19
- /**
20
- * Swagger constructor
21
- *
22
- * @param {Express.Application} app express instance
23
- * @param {ISwaggerConfig} config swagger configuration
24
- */
25
- constructor(app: Express.Application, config: ISwaggerConfig);
26
- /**
27
- * getter for swagger config
28
- *
29
- * @returns {ISwaggerConfig} swagger config
30
- */
31
- get config(): ISwaggerConfig;
32
- /**
33
- * Setup method
34
- */
35
- setup(): void;
36
- }
37
- export {};
1
+ import Express from "express";
2
+ import { ISwaggerConfig } from "./swagger.config";
3
+ /**
4
+ * Swagger declarations
5
+ */
6
+ interface ISwagger {
7
+ config: ISwaggerConfig;
8
+ /**
9
+ * Setup method declaration
10
+ */
11
+ setup(): void;
12
+ }
13
+ /**
14
+ * Swagger implemenation
15
+ */
16
+ export declare class Swagger implements ISwagger {
17
+ private _app;
18
+ private _config;
19
+ /**
20
+ * Swagger constructor
21
+ *
22
+ * @param {Express.Application} app express instance
23
+ * @param {ISwaggerConfig} config swagger configuration
24
+ */
25
+ constructor(app: Express.Application, config: ISwaggerConfig);
26
+ /**
27
+ * getter for swagger config
28
+ *
29
+ * @returns {ISwaggerConfig} swagger config
30
+ */
31
+ get config(): ISwaggerConfig;
32
+ /**
33
+ * Setup method
34
+ */
35
+ setup(): void;
36
+ }
37
+ export {};
@@ -1,79 +1,79 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.Swagger = void 0;
26
- const SwaggerUI = __importStar(require("swagger-ui-express"));
27
- const swagger_jsdoc_1 = __importDefault(require("swagger-jsdoc"));
28
- /**
29
- * Swagger implemenation
30
- */
31
- class Swagger {
32
- /**
33
- * Swagger constructor
34
- *
35
- * @param {Express.Application} app express instance
36
- * @param {ISwaggerConfig} config swagger configuration
37
- */
38
- constructor(app, config) {
39
- this._app = app;
40
- this._config = config;
41
- }
42
- // getters / setters
43
- /**
44
- * getter for swagger config
45
- *
46
- * @returns {ISwaggerConfig} swagger config
47
- */
48
- get config() {
49
- return this._config;
50
- }
51
- /**
52
- * Setup method
53
- */
54
- setup() {
55
- const options = {
56
- definition: {
57
- swagger: this._config.swaggerVersion,
58
- info: {
59
- version: this._config.service.version,
60
- title: this._config.service.title,
61
- description: this._config.service.description,
62
- contact: {
63
- name: this._config.contact.name,
64
- url: this._config.contact.url
65
- }
66
- },
67
- tags: this._config.tags,
68
- basePath: this._config.basePath,
69
- paths: this._config.paths,
70
- definitions: this._config.definitions
71
- },
72
- apis: [this._config.service.routes]
73
- };
74
- const specs = (0, swagger_jsdoc_1.default)(options);
75
- this._app.use(this._config.service.docsUrl, SwaggerUI.serveFiles(specs), SwaggerUI.setup(specs));
76
- }
77
- }
78
- exports.Swagger = Swagger;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.Swagger = void 0;
26
+ const SwaggerUI = __importStar(require("swagger-ui-express"));
27
+ const swagger_jsdoc_1 = __importDefault(require("swagger-jsdoc"));
28
+ /**
29
+ * Swagger implemenation
30
+ */
31
+ class Swagger {
32
+ /**
33
+ * Swagger constructor
34
+ *
35
+ * @param {Express.Application} app express instance
36
+ * @param {ISwaggerConfig} config swagger configuration
37
+ */
38
+ constructor(app, config) {
39
+ this._app = app;
40
+ this._config = config;
41
+ }
42
+ // getters / setters
43
+ /**
44
+ * getter for swagger config
45
+ *
46
+ * @returns {ISwaggerConfig} swagger config
47
+ */
48
+ get config() {
49
+ return this._config;
50
+ }
51
+ /**
52
+ * Setup method
53
+ */
54
+ setup() {
55
+ const options = {
56
+ definition: {
57
+ swagger: this._config.swaggerVersion,
58
+ info: {
59
+ version: this._config.service.version,
60
+ title: this._config.service.title,
61
+ description: this._config.service.description,
62
+ contact: {
63
+ name: this._config.contact.name,
64
+ url: this._config.contact.url
65
+ }
66
+ },
67
+ tags: this._config.tags,
68
+ basePath: this._config.basePath,
69
+ paths: this._config.paths,
70
+ definitions: this._config.definitions
71
+ },
72
+ apis: [this._config.service.routes]
73
+ };
74
+ const specs = (0, swagger_jsdoc_1.default)(options);
75
+ this._app.use(this._config.service.docsUrl, SwaggerUI.serveFiles(specs), SwaggerUI.setup(specs));
76
+ }
77
+ }
78
+ exports.Swagger = Swagger;
79
79
  //# sourceMappingURL=swagger.js.map
@@ -1,3 +1,3 @@
1
- import { ISwaggerConfig } from "./_/swagger.config";
2
- import { Swagger } from "./_/swagger";
3
- export { ISwaggerConfig, Swagger };
1
+ import { ISwaggerConfig } from "./_/swagger.config";
2
+ import { Swagger } from "./_/swagger";
3
+ export { ISwaggerConfig, Swagger };
package/swagger/index.js CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Swagger = void 0;
4
- const swagger_1 = require("./_/swagger");
5
- Object.defineProperty(exports, "Swagger", { enumerable: true, get: function () { return swagger_1.Swagger; } });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Swagger = void 0;
4
+ const swagger_1 = require("./_/swagger");
5
+ Object.defineProperty(exports, "Swagger", { enumerable: true, get: function () { return swagger_1.Swagger; } });
6
6
  //# sourceMappingURL=index.js.map
package/types/index.d.ts CHANGED
@@ -1,19 +1,19 @@
1
- /**
2
- * A union type composed of all primitive types.
3
- */
4
- export declare type Primitive = string | boolean | number | bigint | symbol | null | undefined;
5
- /**
6
- * Like `any` this type can represent any type. Unlike `any`, this type
7
- * does not give the TS compiler a blank check skip any type checking. A variable
8
- * typed as `Any`, can only be passed around and compared for equality. Members
9
- * are not accessible.
10
- */
11
- export declare type Any = object | Primitive;
12
- /**
13
- * Type of callback function of type T
14
- */
15
- export declare type Callback<T> = (res: T) => void;
16
- /**
17
- * Type of callback function for Test Factory (test server status + service response as IApiResponse<T>)
18
- */
19
- export declare type ServerCallback<T> = (status: number, res: T) => void;
1
+ /**
2
+ * A union type composed of all primitive types.
3
+ */
4
+ export declare type Primitive = string | boolean | number | bigint | symbol | null | undefined;
5
+ /**
6
+ * Like `any` this type can represent any type. Unlike `any`, this type
7
+ * does not give the TS compiler a blank check skip any type checking. A variable
8
+ * typed as `Any`, can only be passed around and compared for equality. Members
9
+ * are not accessible.
10
+ */
11
+ export declare type Any = object | Primitive;
12
+ /**
13
+ * Type of callback function of type T
14
+ */
15
+ export declare type Callback<T> = (res: T) => void;
16
+ /**
17
+ * Type of callback function for Test Factory (test server status + service response as IApiResponse<T>)
18
+ */
19
+ export declare type ServerCallback<T> = (status: number, res: T) => void;
package/types/index.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=index.js.map
@@ -1,19 +1,19 @@
1
- /**
2
- * Class that provides encoding/decoding methods
3
- */
4
- export declare abstract class Encoder {
5
- /**
6
- * Method to encode value to Base64
7
- *
8
- * @param {string} value value to be encoded
9
- * @returns {string} base64 encoded value
10
- */
11
- static toBase64(value: string): string;
12
- /**
13
- * Method to decode base64 value
14
- *
15
- * @param {string} encodedValue encoded base64 value
16
- * @returns {string} decoded value
17
- */
18
- static fromBase64(encodedValue: string): string;
19
- }
1
+ /**
2
+ * Class that provides encoding/decoding methods
3
+ */
4
+ export declare abstract class Encoder {
5
+ /**
6
+ * Method to encode value to Base64
7
+ *
8
+ * @param {string} value value to be encoded
9
+ * @returns {string} base64 encoded value
10
+ */
11
+ static toBase64(value: string): string;
12
+ /**
13
+ * Method to decode base64 value
14
+ *
15
+ * @param {string} encodedValue encoded base64 value
16
+ * @returns {string} decoded value
17
+ */
18
+ static fromBase64(encodedValue: string): string;
19
+ }
@@ -1,28 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Encoder = void 0;
4
- /**
5
- * Class that provides encoding/decoding methods
6
- */
7
- class Encoder {
8
- /**
9
- * Method to encode value to Base64
10
- *
11
- * @param {string} value value to be encoded
12
- * @returns {string} base64 encoded value
13
- */
14
- static toBase64(value) {
15
- return Buffer.from(value).toString("base64");
16
- }
17
- /**
18
- * Method to decode base64 value
19
- *
20
- * @param {string} encodedValue encoded base64 value
21
- * @returns {string} decoded value
22
- */
23
- static fromBase64(encodedValue) {
24
- return Buffer.from(encodedValue, "base64").toString();
25
- }
26
- }
27
- exports.Encoder = Encoder;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Encoder = void 0;
4
+ /**
5
+ * Class that provides encoding/decoding methods
6
+ */
7
+ class Encoder {
8
+ /**
9
+ * Method to encode value to Base64
10
+ *
11
+ * @param {string} value value to be encoded
12
+ * @returns {string} base64 encoded value
13
+ */
14
+ static toBase64(value) {
15
+ return Buffer.from(value).toString("base64");
16
+ }
17
+ /**
18
+ * Method to decode base64 value
19
+ *
20
+ * @param {string} encodedValue encoded base64 value
21
+ * @returns {string} decoded value
22
+ */
23
+ static fromBase64(encodedValue) {
24
+ return Buffer.from(encodedValue, "base64").toString();
25
+ }
26
+ }
27
+ exports.Encoder = Encoder;
28
28
  //# sourceMappingURL=encoder.js.map
@@ -1,26 +1,26 @@
1
- import { EncryptionType } from "../../enums";
2
- /**
3
-
4
- /**
5
- * Class that provides encryption/decryption methods
6
- */
7
- export declare abstract class Encryptor {
8
- /**
9
- * Method that encrypts a value
10
- *
11
- * @param {EncryptionType} type encryption type
12
- * @param {string} value a value to encrypt
13
- * @param {string} key encryption key
14
- * @returns {string} encrypted value
15
- */
16
- static encrypt(type: EncryptionType, value: string, key: string): string;
17
- /**
18
- * Method that decrypts a value
19
- *
20
- * @param {EncryptionType} type encryption type
21
- * @param {string} cipher encrypted value / cipher
22
- * @param {string} key decryption key
23
- * @returns {string} decrypted value
24
- */
25
- static decrypt(type: EncryptionType, cipher: string, key: string): string;
26
- }
1
+ import { EncryptionType } from "../../enums";
2
+ /**
3
+
4
+ /**
5
+ * Class that provides encryption/decryption methods
6
+ */
7
+ export declare abstract class Encryptor {
8
+ /**
9
+ * Method that encrypts a value
10
+ *
11
+ * @param {EncryptionType} type encryption type
12
+ * @param {string} value a value to encrypt
13
+ * @param {string} key encryption key
14
+ * @returns {string} encrypted value
15
+ */
16
+ static encrypt(type: EncryptionType, value: string, key: string): string;
17
+ /**
18
+ * Method that decrypts a value
19
+ *
20
+ * @param {EncryptionType} type encryption type
21
+ * @param {string} cipher encrypted value / cipher
22
+ * @param {string} key decryption key
23
+ * @returns {string} decrypted value
24
+ */
25
+ static decrypt(type: EncryptionType, cipher: string, key: string): string;
26
+ }
@@ -1,68 +1,68 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.Encryptor = void 0;
23
- const Crypto = __importStar(require("crypto-js"));
24
- /**
25
-
26
- /**
27
- * Class that provides encryption/decryption methods
28
- */
29
- class Encryptor {
30
- /**
31
- * Method that encrypts a value
32
- *
33
- * @param {EncryptionType} type encryption type
34
- * @param {string} value a value to encrypt
35
- * @param {string} key encryption key
36
- * @returns {string} encrypted value
37
- */
38
- static encrypt(type, value, key) {
39
- switch (type) {
40
- case 0 /* AES */:
41
- return Crypto.AES.encrypt(value, key).toString();
42
- break;
43
- default:
44
- return Crypto.AES.encrypt(value, key).toString();
45
- break;
46
- }
47
- }
48
- /**
49
- * Method that decrypts a value
50
- *
51
- * @param {EncryptionType} type encryption type
52
- * @param {string} cipher encrypted value / cipher
53
- * @param {string} key decryption key
54
- * @returns {string} decrypted value
55
- */
56
- static decrypt(type, cipher, key) {
57
- switch (type) {
58
- case 0 /* AES */:
59
- return Crypto.AES.decrypt(cipher, key).toString(Crypto.enc.Utf8);
60
- break;
61
- default:
62
- return Crypto.AES.decrypt(cipher, key).toString(Crypto.enc.Utf8);
63
- break;
64
- }
65
- }
66
- }
67
- exports.Encryptor = Encryptor;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.Encryptor = void 0;
23
+ const Crypto = __importStar(require("crypto-js"));
24
+ /**
25
+
26
+ /**
27
+ * Class that provides encryption/decryption methods
28
+ */
29
+ class Encryptor {
30
+ /**
31
+ * Method that encrypts a value
32
+ *
33
+ * @param {EncryptionType} type encryption type
34
+ * @param {string} value a value to encrypt
35
+ * @param {string} key encryption key
36
+ * @returns {string} encrypted value
37
+ */
38
+ static encrypt(type, value, key) {
39
+ switch (type) {
40
+ case 0 /* AES */:
41
+ return Crypto.AES.encrypt(value, key).toString();
42
+ break;
43
+ default:
44
+ return Crypto.AES.encrypt(value, key).toString();
45
+ break;
46
+ }
47
+ }
48
+ /**
49
+ * Method that decrypts a value
50
+ *
51
+ * @param {EncryptionType} type encryption type
52
+ * @param {string} cipher encrypted value / cipher
53
+ * @param {string} key decryption key
54
+ * @returns {string} decrypted value
55
+ */
56
+ static decrypt(type, cipher, key) {
57
+ switch (type) {
58
+ case 0 /* AES */:
59
+ return Crypto.AES.decrypt(cipher, key).toString(Crypto.enc.Utf8);
60
+ break;
61
+ default:
62
+ return Crypto.AES.decrypt(cipher, key).toString(Crypto.enc.Utf8);
63
+ break;
64
+ }
65
+ }
66
+ }
67
+ exports.Encryptor = Encryptor;
68
68
  //# sourceMappingURL=encryptor.js.map
@@ -1,25 +1,25 @@
1
- /**
2
- * Utility methods for Hash
3
- */
4
- export declare abstract class Hasher {
5
- /**
6
- * Generate hash with/without base64 encoding
7
- *
8
- * @param {boolean?} encoded optional flag for encoded hash
9
- * @returns {string} randomly generated hash value
10
- */
11
- static generate(encoded?: boolean): string;
12
- /**
13
- * Generate guid type
14
- *
15
- * @returns {string} Guid as string
16
- */
17
- static guid(): string;
18
- /**
19
- * Validate if string is a guid type
20
- *
21
- * @param {string} value optional flag for encoded hash
22
- * @returns {boolean} is Guid
23
- */
24
- static isGuid(value: string): boolean;
25
- }
1
+ /**
2
+ * Utility methods for Hash
3
+ */
4
+ export declare abstract class Hasher {
5
+ /**
6
+ * Generate hash with/without base64 encoding
7
+ *
8
+ * @param {boolean?} encoded optional flag for encoded hash
9
+ * @returns {string} randomly generated hash value
10
+ */
11
+ static generate(encoded?: boolean): string;
12
+ /**
13
+ * Generate guid type
14
+ *
15
+ * @returns {string} Guid as string
16
+ */
17
+ static guid(): string;
18
+ /**
19
+ * Validate if string is a guid type
20
+ *
21
+ * @param {string} value optional flag for encoded hash
22
+ * @returns {boolean} is Guid
23
+ */
24
+ static isGuid(value: string): boolean;
25
+ }