@duvdu-v1/duvdu 1.1.71 → 1.1.73

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,8 @@
1
+ import nats from 'node-nats-streaming';
2
+ declare class NatsWrapper {
3
+ private _client?;
4
+ get client(): nats.Stan;
5
+ connect(clusterId: string, clientId: string, url: string): Promise<void>;
6
+ }
7
+ export declare const natsWrapper: NatsWrapper;
8
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.natsWrapper = void 0;
7
+ const node_nats_streaming_1 = __importDefault(require("node-nats-streaming"));
8
+ class NatsWrapper {
9
+ get client() {
10
+ if (!this._client) {
11
+ throw new Error('can not access nats client before conection');
12
+ }
13
+ return this._client;
14
+ }
15
+ connect(clusterId, clientId, url) {
16
+ this._client = node_nats_streaming_1.default.connect(clusterId, clientId, { url });
17
+ return new Promise((resolve, reject) => {
18
+ this.client.on('connect', () => {
19
+ console.log('connected to nats');
20
+ resolve();
21
+ });
22
+ this.client.on('error', (err) => {
23
+ reject(err);
24
+ });
25
+ });
26
+ }
27
+ }
28
+ exports.natsWrapper = new NatsWrapper();
@@ -0,0 +1,14 @@
1
+ import { Subject } from './subject';
2
+ import { Inotification } from '../models/notification.model';
3
+ export interface TicketCreatedEvent {
4
+ subject: Subject.newNotification;
5
+ data: {
6
+ targetUser: string;
7
+ notificationDetails: {
8
+ title: string;
9
+ message: string;
10
+ };
11
+ populatedNotification: Inotification;
12
+ socketChannel: string;
13
+ };
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,3 @@
1
1
  export declare enum Subject {
2
- orderCreated = "order:created"
2
+ newNotification = "new:notification"
3
3
  }
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Subject = void 0;
4
4
  var Subject;
5
5
  (function (Subject) {
6
- Subject["orderCreated"] = "order:created";
6
+ Subject["newNotification"] = "new:notification";
7
7
  })(Subject || (exports.Subject = Subject = {}));
package/build/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- export * from './events/base-listener';
2
- export * from './events/base-publisher';
3
- export * from './events/subject';
4
1
  export * from './errors/bad-request-error';
5
2
  export * from './errors/data-base-connections';
6
3
  export * from './errors/notfound-error';
@@ -47,6 +44,7 @@ export * from './types/pagination-response';
47
44
  export * from './types/portfolio-post-order';
48
45
  export * from './types/cycles';
49
46
  export * from './types/booking-states';
47
+ export * from './types/socket-channel';
50
48
  export * from './models/Bookmark.model';
51
49
  export * from './models/Plan.model';
52
50
  export * from './models/Role.model';
@@ -65,3 +63,9 @@ export * from './models/teamProject.model';
65
63
  export * from './models/contracts.model';
66
64
  export * from './models/producer.model';
67
65
  export * from './services/category.service';
66
+ export * from './types/notification.type';
67
+ export * from './events/new-notification.event';
68
+ export * from './events/nats-wrapper';
69
+ export * from './events/base-listener';
70
+ export * from './events/base-publisher';
71
+ export * from './events/subject';
package/build/index.js CHANGED
@@ -14,9 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./events/base-listener"), exports);
18
- __exportStar(require("./events/base-publisher"), exports);
19
- __exportStar(require("./events/subject"), exports);
20
17
  __exportStar(require("./errors/bad-request-error"), exports);
21
18
  __exportStar(require("./errors/data-base-connections"), exports);
22
19
  __exportStar(require("./errors/notfound-error"), exports);
@@ -63,6 +60,7 @@ __exportStar(require("./types/pagination-response"), exports);
63
60
  __exportStar(require("./types/portfolio-post-order"), exports);
64
61
  __exportStar(require("./types/cycles"), exports);
65
62
  __exportStar(require("./types/booking-states"), exports);
63
+ __exportStar(require("./types/socket-channel"), exports);
66
64
  __exportStar(require("./models/Bookmark.model"), exports);
67
65
  __exportStar(require("./models/Plan.model"), exports);
68
66
  __exportStar(require("./models/Role.model"), exports);
@@ -81,3 +79,10 @@ __exportStar(require("./models/teamProject.model"), exports);
81
79
  __exportStar(require("./models/contracts.model"), exports);
82
80
  __exportStar(require("./models/producer.model"), exports);
83
81
  __exportStar(require("./services/category.service"), exports);
82
+ __exportStar(require("./types/notification.type"), exports);
83
+ // events
84
+ __exportStar(require("./events/new-notification.event"), exports);
85
+ __exportStar(require("./events/nats-wrapper"), exports);
86
+ __exportStar(require("./events/base-listener"), exports);
87
+ __exportStar(require("./events/base-publisher"), exports);
88
+ __exportStar(require("./events/subject"), exports);
@@ -0,0 +1,3 @@
1
+ export declare enum NotificationType {
2
+ new_message = "new_message"
3
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationType = void 0;
4
+ var NotificationType;
5
+ (function (NotificationType) {
6
+ NotificationType["new_message"] = "new_message";
7
+ })(NotificationType || (exports.NotificationType = NotificationType = {}));
@@ -0,0 +1,3 @@
1
+ export declare enum Channels {
2
+ new_message = "new_message"
3
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Channels = void 0;
4
+ var Channels;
5
+ (function (Channels) {
6
+ Channels["new_message"] = "new_message";
7
+ })(Channels || (exports.Channels = Channels = {}));
package/package.json CHANGED
@@ -1,55 +1,55 @@
1
- {
2
- "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.71",
4
- "main": "./build/index.js",
5
- "types": "./build/index.d.ts",
6
- "files": [
7
- "build/**/*"
8
- ],
9
- "scripts": {
10
- "clean": "rimraf ./build",
11
- "build": "npm run clean && tsc",
12
- "fix:build": "mv ./build/common/src/* ./build && rm -rf ./build/auth ./build/portfolio-post ./build/common",
13
- "pub": "git add . && git commit -m \"updates\" && npm version patch && npm run build && npm publish",
14
- "lint": "eslint .",
15
- "lint:fix": "eslint --fix .",
16
- "format": "prettier --write ."
17
- },
18
- "keywords": [],
19
- "author": "motemed khaled",
20
- "license": "ISC",
21
- "dependencies": {
22
- "@duvdu-v1/duvdu": "^1.1.4",
23
- "@types/express": "^4.17.21",
24
- "@types/express-session": "^1.18.0",
25
- "@types/jsonwebtoken": "^9.0.5",
26
- "@types/multer": "^1.4.11",
27
- "@types/node": "^20.11.0",
28
- "@typescript-eslint/eslint-plugin": "^6.19.0",
29
- "@typescript-eslint/parser": "^6.19.0",
30
- "aws-sdk": "^2.1595.0",
31
- "connect-redis": "^7.1.1",
32
- "express": "^4.18.2",
33
- "express-async-errors": "^3.1.1",
34
- "express-session": "^1.18.0",
35
- "express-validator": "^7.0.1",
36
- "jsonwebtoken": "^9.0.2",
37
- "mongoose": "^8.0.4",
38
- "multer": "^1.4.5-lts.1",
39
- "node-nats-streaming": "^0.3.2",
40
- "redis": "^4.6.13",
41
- "rimraf": "^5.0.5",
42
- "typescript": "^5.3.3",
43
- "uuid": "^9.0.1"
44
- },
45
- "devDependencies": {
46
- "@types/uuid": "^9.0.8",
47
- "del-cli": "^5.1.0",
48
- "eslint": "^8.56.0",
49
- "eslint-config-prettier": "^9.1.0",
50
- "eslint-plugin-import": "^2.29.1",
51
- "eslint-plugin-prettier": "^5.1.3",
52
- "prettier": "^3.2.4"
53
- },
54
- "description": ""
55
- }
1
+ {
2
+ "name": "@duvdu-v1/duvdu",
3
+ "version": "1.1.73",
4
+ "main": "./build/index.js",
5
+ "types": "./build/index.d.ts",
6
+ "files": [
7
+ "build/**/*"
8
+ ],
9
+ "scripts": {
10
+ "clean": "rimraf ./build",
11
+ "build": "npm run clean && tsc",
12
+ "fix:build": "mv ./build/common/src/* ./build && rm -rf ./build/auth ./build/portfolio-post ./build/common",
13
+ "pub": "git add . && git commit -m \"updates\" && npm version patch && npm run build && npm publish",
14
+ "lint": "eslint .",
15
+ "lint:fix": "eslint --fix .",
16
+ "format": "prettier --write ."
17
+ },
18
+ "keywords": [],
19
+ "author": "motemed khaled",
20
+ "license": "ISC",
21
+ "dependencies": {
22
+ "@duvdu-v1/duvdu": "^1.1.4",
23
+ "@types/express": "^4.17.21",
24
+ "@types/express-session": "^1.18.0",
25
+ "@types/jsonwebtoken": "^9.0.5",
26
+ "@types/multer": "^1.4.11",
27
+ "@types/node": "^20.11.0",
28
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
29
+ "@typescript-eslint/parser": "^6.19.0",
30
+ "aws-sdk": "^2.1595.0",
31
+ "connect-redis": "^7.1.1",
32
+ "express": "^4.18.2",
33
+ "express-async-errors": "^3.1.1",
34
+ "express-session": "^1.18.0",
35
+ "express-validator": "^7.0.1",
36
+ "jsonwebtoken": "^9.0.2",
37
+ "mongoose": "^8.0.4",
38
+ "multer": "^1.4.5-lts.1",
39
+ "node-nats-streaming": "^0.3.2",
40
+ "redis": "^4.6.13",
41
+ "rimraf": "^5.0.5",
42
+ "typescript": "^5.3.3",
43
+ "uuid": "^9.0.1"
44
+ },
45
+ "devDependencies": {
46
+ "@types/uuid": "^9.0.8",
47
+ "del-cli": "^5.1.0",
48
+ "eslint": "^8.56.0",
49
+ "eslint-config-prettier": "^9.1.0",
50
+ "eslint-plugin-import": "^2.29.1",
51
+ "eslint-plugin-prettier": "^5.1.3",
52
+ "prettier": "^3.2.4"
53
+ },
54
+ "description": ""
55
+ }