@carlonicora/nestjs-neo4jsonapi 1.56.3 → 1.58.0
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/dist/common/decorators/audit.decorator.d.ts +1 -1
- package/dist/common/decorators/audit.decorator.js +2 -2
- package/dist/common/decorators/audit.decorator.js.map +1 -1
- package/dist/common/decorators/index.d.ts +0 -1
- package/dist/common/decorators/index.d.ts.map +1 -1
- package/dist/common/decorators/index.js +0 -1
- package/dist/common/decorators/index.js.map +1 -1
- package/dist/common/guards/jwt.auth.guard.d.ts.map +1 -1
- package/dist/common/guards/jwt.auth.guard.js +1 -0
- package/dist/common/guards/jwt.auth.guard.js.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.service.d.ts +3 -1
- package/dist/core/neo4j/abstracts/abstract.service.d.ts.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.service.js +36 -1
- package/dist/core/neo4j/abstracts/abstract.service.js.map +1 -1
- package/dist/foundations/audit/audit.module.js +1 -1
- package/dist/foundations/audit/audit.module.js.map +1 -1
- package/dist/foundations/audit/controllers/audit.controller.d.ts +3 -2
- package/dist/foundations/audit/controllers/audit.controller.d.ts.map +1 -1
- package/dist/foundations/audit/controllers/audit.controller.js +27 -7
- package/dist/foundations/audit/controllers/audit.controller.js.map +1 -1
- package/dist/foundations/audit/entities/audit.entity.d.ts +9 -3
- package/dist/foundations/audit/entities/audit.entity.d.ts.map +1 -1
- package/dist/foundations/audit/entities/audit.map.d.ts +3 -3
- package/dist/foundations/audit/entities/audit.map.d.ts.map +1 -1
- package/dist/foundations/audit/entities/audit.map.js +11 -6
- package/dist/foundations/audit/entities/audit.map.js.map +1 -1
- package/dist/foundations/audit/entities/audit.meta.d.ts +1 -1
- package/dist/foundations/audit/entities/audit.meta.d.ts.map +1 -1
- package/dist/foundations/audit/entities/audit.meta.js +6 -6
- package/dist/foundations/audit/entities/audit.meta.js.map +1 -1
- package/dist/foundations/audit/entities/audit.model.d.ts +2 -2
- package/dist/foundations/audit/entities/audit.model.d.ts.map +1 -1
- package/dist/foundations/audit/entities/audit.model.js +7 -8
- package/dist/foundations/audit/entities/audit.model.js.map +1 -1
- package/dist/foundations/audit/index.d.ts +3 -3
- package/dist/foundations/audit/index.d.ts.map +1 -1
- package/dist/foundations/audit/index.js +3 -3
- package/dist/foundations/audit/index.js.map +1 -1
- package/dist/foundations/audit/repositories/audit.repository.d.ts +18 -8
- package/dist/foundations/audit/repositories/audit.repository.d.ts.map +1 -1
- package/dist/foundations/audit/repositories/audit.repository.js +68 -27
- package/dist/foundations/audit/repositories/audit.repository.js.map +1 -1
- package/dist/foundations/audit/serialisers/audit.serialiser.d.ts.map +1 -1
- package/dist/foundations/audit/serialisers/audit.serialiser.js +10 -4
- package/dist/foundations/audit/serialisers/audit.serialiser.js.map +1 -1
- package/dist/foundations/audit/services/audit.service.d.ts +26 -6
- package/dist/foundations/audit/services/audit.service.d.ts.map +1 -1
- package/dist/foundations/audit/services/audit.service.js +126 -17
- package/dist/foundations/audit/services/audit.service.js.map +1 -1
- package/dist/scripts/generate-module/generator.js +1 -1
- package/dist/scripts/generate-module/generator.js.map +1 -1
- package/dist/scripts/generate-module/types/json-schema.interface.d.ts +2 -0
- package/dist/scripts/generate-module/types/json-schema.interface.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/common/decorators/write-audit.decorator.d.ts +0 -10
- package/dist/common/decorators/write-audit.decorator.d.ts.map +0 -1
- package/dist/common/decorators/write-audit.decorator.js +0 -55
- package/dist/common/decorators/write-audit.decorator.js.map +0 -1
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WriteAudit = WriteAudit;
|
|
4
|
-
const REDACTED_FIELDS = new Set([
|
|
5
|
-
"password",
|
|
6
|
-
"passwordHash",
|
|
7
|
-
"token",
|
|
8
|
-
"secret",
|
|
9
|
-
"apiKey",
|
|
10
|
-
"refreshToken",
|
|
11
|
-
"accessToken",
|
|
12
|
-
]);
|
|
13
|
-
/**
|
|
14
|
-
* Decorator that automatically logs a write audit entry after the method executes.
|
|
15
|
-
* Captures the submitted JSON:API body data (attributes + relationships) as the changes record.
|
|
16
|
-
*
|
|
17
|
-
* @param meta - The entity metadata (provides labelName for audit)
|
|
18
|
-
* @param auditType - The type of write operation: "create" or "edit"
|
|
19
|
-
*/
|
|
20
|
-
function WriteAudit(meta, auditType) {
|
|
21
|
-
return function (target, propertyKey, descriptor) {
|
|
22
|
-
const originalMethod = descriptor.value;
|
|
23
|
-
descriptor.value = async function (...args) {
|
|
24
|
-
const result = await originalMethod.apply(this, args);
|
|
25
|
-
// Extract entity ID and body data from request body (JSON:API format)
|
|
26
|
-
const body = args.find((arg) => arg?.data?.id || arg?.data?.type);
|
|
27
|
-
const entityId = body?.data?.id;
|
|
28
|
-
if (entityId && this.auditService) {
|
|
29
|
-
// Capture the submitted data as changes
|
|
30
|
-
const changes = {};
|
|
31
|
-
if (body.data.attributes) {
|
|
32
|
-
const sanitised = { ...body.data.attributes };
|
|
33
|
-
for (const key of Object.keys(sanitised)) {
|
|
34
|
-
if (REDACTED_FIELDS.has(key)) {
|
|
35
|
-
sanitised[key] = "[REDACTED]";
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
changes.attributes = sanitised;
|
|
39
|
-
}
|
|
40
|
-
if (body.data.relationships) {
|
|
41
|
-
changes.relationships = body.data.relationships;
|
|
42
|
-
}
|
|
43
|
-
await this.auditService.createWriteAuditEntry({
|
|
44
|
-
entityType: meta.labelName,
|
|
45
|
-
entityId: entityId,
|
|
46
|
-
auditType,
|
|
47
|
-
changes: Object.keys(changes).length > 0 ? JSON.stringify(changes) : undefined,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return result;
|
|
51
|
-
};
|
|
52
|
-
return descriptor;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=write-audit.decorator.js.map
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