@sendhome/common 1.0.188 → 1.0.190
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.
- package/build/events/publishers/{activity-created.d.ts → activity-created-event.d.ts} +2 -4
- package/build/events/publishers/system-log-created.d.ts +2 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/package.json +1 -1
- package/build/utils/activity-logger.d.ts +0 -21
- package/build/utils/activity-logger.js +0 -28
- /package/build/events/publishers/{activity-created.js → activity-created-event.js} +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Subjects } from "../subjects/subjects";
|
|
2
|
-
import { ActivityType } from "../types/activity-type";
|
|
3
2
|
import { AccountType } from "../types/account-type";
|
|
4
3
|
export interface ActivityCreatedEvent {
|
|
5
4
|
subject: Subjects.ActivityCreated;
|
|
@@ -7,8 +6,8 @@ export interface ActivityCreatedEvent {
|
|
|
7
6
|
id: string;
|
|
8
7
|
user: string;
|
|
9
8
|
account_type: AccountType;
|
|
10
|
-
activity:
|
|
11
|
-
resource: string;
|
|
9
|
+
activity: string;
|
|
10
|
+
resource: string | null;
|
|
12
11
|
changes: Record<string, {
|
|
13
12
|
oldValue: any;
|
|
14
13
|
newValue: any;
|
|
@@ -19,6 +18,5 @@ export interface ActivityCreatedEvent {
|
|
|
19
18
|
user_agent: string;
|
|
20
19
|
};
|
|
21
20
|
created_at: Date;
|
|
22
|
-
version: number;
|
|
23
21
|
};
|
|
24
22
|
}
|
|
@@ -2,6 +2,7 @@ import { Subjects } from "../subjects/subjects";
|
|
|
2
2
|
export interface SystemLogCreatedEvent {
|
|
3
3
|
subject: Subjects.SystemLogCreated;
|
|
4
4
|
data: {
|
|
5
|
+
id: string;
|
|
5
6
|
correlation_id: string;
|
|
6
7
|
service_name: string;
|
|
7
8
|
route_path: string;
|
|
@@ -10,6 +11,6 @@ export interface SystemLogCreatedEvent {
|
|
|
10
11
|
log_message: string;
|
|
11
12
|
error_message: string;
|
|
12
13
|
log_timestamp: Date;
|
|
13
|
-
additional_metadata
|
|
14
|
+
additional_metadata: object;
|
|
14
15
|
};
|
|
15
16
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export * from "./events/subjects/subjects";
|
|
|
15
15
|
export * from "./events/publishers/bonus-awarded-event";
|
|
16
16
|
export * from "./events/publishers/branch-created-event";
|
|
17
17
|
export * from "./events/publishers/branch-updated-event";
|
|
18
|
-
export * from "./events/publishers/activity-created";
|
|
18
|
+
export * from "./events/publishers/activity-created-event";
|
|
19
19
|
export * from "./events/publishers/brand-created-event";
|
|
20
20
|
export * from "./events/publishers/brand-updated-event";
|
|
21
21
|
export * from "./events/publishers/cart-created-event";
|
package/build/index.js
CHANGED
|
@@ -28,7 +28,7 @@ __exportStar(require("./events/subjects/subjects"), exports);
|
|
|
28
28
|
__exportStar(require("./events/publishers/bonus-awarded-event"), exports);
|
|
29
29
|
__exportStar(require("./events/publishers/branch-created-event"), exports);
|
|
30
30
|
__exportStar(require("./events/publishers/branch-updated-event"), exports);
|
|
31
|
-
__exportStar(require("./events/publishers/activity-created"), exports);
|
|
31
|
+
__exportStar(require("./events/publishers/activity-created-event"), exports);
|
|
32
32
|
__exportStar(require("./events/publishers/brand-created-event"), exports);
|
|
33
33
|
__exportStar(require("./events/publishers/brand-updated-event"), exports);
|
|
34
34
|
__exportStar(require("./events/publishers/cart-created-event"), exports);
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Stan } from "node-nats-streaming";
|
|
2
|
-
import { ActivityType } from "../events/types/activity-type";
|
|
3
|
-
import { AccountType } from "../events/types/account-type";
|
|
4
|
-
interface ActivityLogData {
|
|
5
|
-
user: string;
|
|
6
|
-
account_type: AccountType;
|
|
7
|
-
activity: ActivityType;
|
|
8
|
-
resource: string;
|
|
9
|
-
changes: Record<string, {
|
|
10
|
-
oldValue: any;
|
|
11
|
-
newValue: any;
|
|
12
|
-
}>;
|
|
13
|
-
details: string;
|
|
14
|
-
metadata: {
|
|
15
|
-
ip: string;
|
|
16
|
-
user_agent: string;
|
|
17
|
-
};
|
|
18
|
-
created_at: Date;
|
|
19
|
-
}
|
|
20
|
-
export declare const logActivity: (stan: Stan, activityLog: ActivityLogData) => Promise<void>;
|
|
21
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.logActivity = void 0;
|
|
13
|
-
const logActivity = (stan, activityLog) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
try {
|
|
15
|
-
stan.publish("activity:log", JSON.stringify(activityLog), (err, guid) => {
|
|
16
|
-
if (err) {
|
|
17
|
-
console.error("Failed to publish activity log:", err);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
console.log(`Activity log published with guid: ${guid}`);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
console.error("Error in activity logger:", error);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
exports.logActivity = logActivity;
|
|
File without changes
|