@konplit-services/common 1.0.26 → 1.0.28

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.
@@ -4,8 +4,10 @@ export interface AccountCreatedEvent {
4
4
  streamName: StreamName.name;
5
5
  streamEvents: StreamEvent.Event;
6
6
  data: {
7
- title: string;
7
+ accountId: string;
8
8
  id: string;
9
9
  price: number;
10
+ account_status: boolean;
11
+ version: number;
10
12
  };
11
13
  }
@@ -1,11 +1,12 @@
1
1
  import { StreamEvent, StreamName, Subjects } from "../../subjects";
2
2
  export interface AccountUpdatedEvent {
3
- subject: Subjects.AccountCreated;
3
+ subject: Subjects.AccountUpdated;
4
4
  streamName: StreamName.name;
5
5
  streamEvents: StreamEvent.Event;
6
6
  data: {
7
- title: string;
7
+ accountId: string;
8
8
  id: string;
9
- price: number;
9
+ account_status: boolean;
10
+ version: number;
10
11
  };
11
12
  }
@@ -2,3 +2,5 @@ export * from "./account-created.interface";
2
2
  export * from "./account-updated.interface";
3
3
  export * from "./permission-created.interface";
4
4
  export * from "./permission-removed.interface";
5
+ export * from "./user-created.interface";
6
+ export * from "./user-updated.interface";
@@ -18,3 +18,5 @@ __exportStar(require("./account-created.interface"), exports);
18
18
  __exportStar(require("./account-updated.interface"), exports);
19
19
  __exportStar(require("./permission-created.interface"), exports);
20
20
  __exportStar(require("./permission-removed.interface"), exports);
21
+ __exportStar(require("./user-created.interface"), exports);
22
+ __exportStar(require("./user-updated.interface"), exports);
@@ -0,0 +1,14 @@
1
+ import { Roles } from "../../../helper";
2
+ import { StreamEvent, StreamName, Subjects } from "../../subjects";
3
+ export interface UserCreatedEvent {
4
+ subject: Subjects.UserCreated;
5
+ streamName: StreamName.name;
6
+ streamEvents: StreamEvent.Event;
7
+ data: {
8
+ email: string;
9
+ accountId: string;
10
+ permissions: string[];
11
+ role: Roles;
12
+ id: string;
13
+ };
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ import { Roles } from "../../../helper";
2
+ import { StreamEvent, StreamName, Subjects } from "../../subjects";
3
+ export interface UserUpdatedEvent {
4
+ subject: Subjects.UserUpdated;
5
+ streamName: StreamName.name;
6
+ streamEvents: StreamEvent.Event;
7
+ data: {
8
+ email: string;
9
+ accountId: string;
10
+ permissions: string[];
11
+ role: Roles;
12
+ id: string;
13
+ };
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -10,9 +10,9 @@ export declare enum StreamName {
10
10
  }
11
11
  export declare enum Subjects {
12
12
  AccountCreated = "events.account.created",
13
- AccountVerified = "events.account.verified",
14
13
  AccountUpdated = "events.account.updated",
15
- AccountBlocked = "events.account.blocked",
14
+ UserCreated = "events.user.created",
15
+ UserUpdated = "events.account.updated",
16
16
  MerchantCreated = "events.merchant.created",
17
17
  MerchantUpdated = "events.merchant.updated",
18
18
  MerchantKeyUpdated = "events.merchant.key.updated",
@@ -17,9 +17,10 @@ var Subjects;
17
17
  (function (Subjects) {
18
18
  // Accounts Subjects
19
19
  Subjects["AccountCreated"] = "events.account.created";
20
- Subjects["AccountVerified"] = "events.account.verified";
21
20
  Subjects["AccountUpdated"] = "events.account.updated";
22
- Subjects["AccountBlocked"] = "events.account.blocked";
21
+ //users
22
+ Subjects["UserCreated"] = "events.user.created";
23
+ Subjects["UserUpdated"] = "events.account.updated";
23
24
  //Merchants Subjects
24
25
  Subjects["MerchantCreated"] = "events.merchant.created";
25
26
  Subjects["MerchantUpdated"] = "events.merchant.updated";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @param alphabet Set of random strings to be used to generate IDs
3
+ * @param numberOfCharacters The number of characters to be returned
4
+ *
5
+ * This function takes in the number of characters to be returned.
6
+ * If the numberOfCharacters input is not provided, the default of 15 is returned.
7
+ */
8
+ declare const uniqueId: (alphabet?: string, numberOfCharacters?: number) => string;
9
+ export { uniqueId };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uniqueId = void 0;
4
+ const nanoid_1 = require("nanoid");
5
+ /**
6
+ * @param alphabet Set of random strings to be used to generate IDs
7
+ * @param numberOfCharacters The number of characters to be returned
8
+ *
9
+ * This function takes in the number of characters to be returned.
10
+ * If the numberOfCharacters input is not provided, the default of 15 is returned.
11
+ */
12
+ const uniqueId = (alphabet = "0123456789", numberOfCharacters = 13) => {
13
+ const nanoid = (0, nanoid_1.customAlphabet)(alphabet, numberOfCharacters);
14
+ return `vp${nanoid()}`;
15
+ };
16
+ exports.uniqueId = uniqueId;
@@ -1,3 +1,4 @@
1
1
  export * from "./lib/nats/nat-error-codes";
2
2
  export * from "./jwt.validation";
3
3
  export * from "./parse-query-string";
4
+ export * from "./id";
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./lib/nats/nat-error-codes"), exports);
18
18
  __exportStar(require("./jwt.validation"), exports);
19
19
  __exportStar(require("./parse-query-string"), exports);
20
+ __exportStar(require("./id"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -31,6 +31,7 @@
31
31
  "jsonwebtoken": "^8.5.1",
32
32
  "mailersend": "^2.0.5",
33
33
  "mongoose": "^6.9.2",
34
+ "nanoid": "^5.0.7",
34
35
  "nats": "^2.25.0",
35
36
  "node-ipinfo": "^3.5.0",
36
37
  "swagger-jsdoc": "^6.2.8",