@nathapp/nestjs-audit 4.5.0 → 4.6.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/AGENTS.md +39 -0
- package/CLAUDE.md +37 -0
- package/GEMINI.md +37 -0
- package/README.md +1 -1
- package/codex.md +37 -0
- package/dist/provider/logger-audit-storage.d.ts +1 -1
- package/dist/provider/logger-audit-storage.js +13 -3
- package/dist/provider/logger-audit-storage.js.map +1 -1
- package/package.json +3 -3
package/AGENTS.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Agent Instructions
|
|
2
|
+
|
|
3
|
+
This file is auto-generated from `.nax/context.md`.
|
|
4
|
+
DO NOT EDIT MANUALLY — run `nax generate` to regenerate.
|
|
5
|
+
|
|
6
|
+
These instructions apply to all AI coding agents in this project.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Project Metadata
|
|
11
|
+
|
|
12
|
+
> Auto-injected by `nax generate`
|
|
13
|
+
|
|
14
|
+
**Project:** `@nathapp/nestjs-audit`
|
|
15
|
+
|
|
16
|
+
**Language:** TypeScript
|
|
17
|
+
|
|
18
|
+
**Key dependencies:** @nathapp/typescript-config, @nestjs/common, @nestjs/core, @nestjs/testing, @types/jest, jest, ts-jest, typescript
|
|
19
|
+
|
|
20
|
+
**Commands:** test: `npm run test` | lint: `npm run lint` | typecheck: `npm run type-check && npm run type-check:test`
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
# @nathapp/nestjs-audit
|
|
24
|
+
|
|
25
|
+
Decorator-driven audit logging with pluggable storage.
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
Run from `packages/nestjs-audit/`. Replace the example test path with a path relative to this package.
|
|
30
|
+
|
|
31
|
+
| Purpose | Command |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| Build this package | `npm run build` |
|
|
34
|
+
| Run specific test files | `npm test -- --runTestsByPath path/to/file.spec.ts` |
|
|
35
|
+
| Run the default suite | `npm test` |
|
|
36
|
+
| Run the default suite with coverage | `npm run test:cov` |
|
|
37
|
+
| Type-check library source | `npm run type-check` |
|
|
38
|
+
| Type-check test source | `npm run type-check:test` |
|
|
39
|
+
| Lint library and test source | `npm run lint` |
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Project Context
|
|
2
|
+
|
|
3
|
+
This file is auto-generated from `.nax/context.md`.
|
|
4
|
+
DO NOT EDIT MANUALLY — run `nax generate` to regenerate.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Project Metadata
|
|
9
|
+
|
|
10
|
+
> Auto-injected by `nax generate`
|
|
11
|
+
|
|
12
|
+
**Project:** `@nathapp/nestjs-audit`
|
|
13
|
+
|
|
14
|
+
**Language:** TypeScript
|
|
15
|
+
|
|
16
|
+
**Key dependencies:** @nathapp/typescript-config, @nestjs/common, @nestjs/core, @nestjs/testing, @types/jest, jest, ts-jest, typescript
|
|
17
|
+
|
|
18
|
+
**Commands:** test: `npm run test` | lint: `npm run lint` | typecheck: `npm run type-check && npm run type-check:test`
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
# @nathapp/nestjs-audit
|
|
22
|
+
|
|
23
|
+
Decorator-driven audit logging with pluggable storage.
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
|
|
27
|
+
Run from `packages/nestjs-audit/`. Replace the example test path with a path relative to this package.
|
|
28
|
+
|
|
29
|
+
| Purpose | Command |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| Build this package | `npm run build` |
|
|
32
|
+
| Run specific test files | `npm test -- --runTestsByPath path/to/file.spec.ts` |
|
|
33
|
+
| Run the default suite | `npm test` |
|
|
34
|
+
| Run the default suite with coverage | `npm run test:cov` |
|
|
35
|
+
| Type-check library source | `npm run type-check` |
|
|
36
|
+
| Type-check test source | `npm run type-check:test` |
|
|
37
|
+
| Lint library and test source | `npm run lint` |
|
package/GEMINI.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Gemini CLI Context
|
|
2
|
+
|
|
3
|
+
This file is auto-generated from `.nax/context.md`.
|
|
4
|
+
DO NOT EDIT MANUALLY — run `nax generate` to regenerate.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Project Metadata
|
|
9
|
+
|
|
10
|
+
> Auto-injected by `nax generate`
|
|
11
|
+
|
|
12
|
+
**Project:** `@nathapp/nestjs-audit`
|
|
13
|
+
|
|
14
|
+
**Language:** TypeScript
|
|
15
|
+
|
|
16
|
+
**Key dependencies:** @nathapp/typescript-config, @nestjs/common, @nestjs/core, @nestjs/testing, @types/jest, jest, ts-jest, typescript
|
|
17
|
+
|
|
18
|
+
**Commands:** test: `npm run test` | lint: `npm run lint` | typecheck: `npm run type-check && npm run type-check:test`
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
# @nathapp/nestjs-audit
|
|
22
|
+
|
|
23
|
+
Decorator-driven audit logging with pluggable storage.
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
|
|
27
|
+
Run from `packages/nestjs-audit/`. Replace the example test path with a path relative to this package.
|
|
28
|
+
|
|
29
|
+
| Purpose | Command |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| Build this package | `npm run build` |
|
|
32
|
+
| Run specific test files | `npm test -- --runTestsByPath path/to/file.spec.ts` |
|
|
33
|
+
| Run the default suite | `npm test` |
|
|
34
|
+
| Run the default suite with coverage | `npm run test:cov` |
|
|
35
|
+
| Type-check library source | `npm run type-check` |
|
|
36
|
+
| Type-check test source | `npm run type-check:test` |
|
|
37
|
+
| Lint library and test source | `npm run lint` |
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Decorator-driven, storage-agnostic audit logging for NestJS applications.
|
|
|
16
16
|
npm install @nathapp/nestjs-audit @nathapp/nestjs-common @nathapp/nestjs-logging
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
> **Peer
|
|
19
|
+
> **Peer requirements: `ClockModule` and `LoggingModule`.** `AuditModule` does not import `ClockModule` itself — `AuditInterceptor` depends on the `CLOCK` token from `@nathapp/nestjs-common`, and expects it to already be available in your application's module tree. Register `ClockModule.register()` in your root module's `imports` if it is not already available. Opt-in `LoggerAuditStorage` likewise needs a `Logger` from `@nathapp/nestjs-logging`: it resolves the exported `Logger` class — register `LoggingModule.register()` (or its async equivalent) in your module tree — and also accepts a provider registered under the `LOGGER_SERVICE` token, so an app that supplies that token directly can inject the storage without importing the logging module. When both are available the `Logger` class wins; when neither is available, constructing the storage fails with an error that names `LoggerAuditStorage`. Manual construction, `new LoggerAuditStorage(logger)`, still works with a single logger argument. `ClockModule` is `global: true`, so apps using nestjs-common's clock seam often already satisfy the clock requirement.
|
|
20
20
|
|
|
21
21
|
## Quick Start
|
|
22
22
|
|
package/codex.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Codex Instructions
|
|
2
|
+
|
|
3
|
+
This file is auto-generated from `.nax/context.md`.
|
|
4
|
+
DO NOT EDIT MANUALLY — run `nax generate` to regenerate.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Project Metadata
|
|
9
|
+
|
|
10
|
+
> Auto-injected by `nax generate`
|
|
11
|
+
|
|
12
|
+
**Project:** `@nathapp/nestjs-audit`
|
|
13
|
+
|
|
14
|
+
**Language:** TypeScript
|
|
15
|
+
|
|
16
|
+
**Key dependencies:** @nathapp/typescript-config, @nestjs/common, @nestjs/core, @nestjs/testing, @types/jest, jest, ts-jest, typescript
|
|
17
|
+
|
|
18
|
+
**Commands:** test: `npm run test` | lint: `npm run lint` | typecheck: `npm run type-check && npm run type-check:test`
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
# @nathapp/nestjs-audit
|
|
22
|
+
|
|
23
|
+
Decorator-driven audit logging with pluggable storage.
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
|
|
27
|
+
Run from `packages/nestjs-audit/`. Replace the example test path with a path relative to this package.
|
|
28
|
+
|
|
29
|
+
| Purpose | Command |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| Build this package | `npm run build` |
|
|
32
|
+
| Run specific test files | `npm test -- --runTestsByPath path/to/file.spec.ts` |
|
|
33
|
+
| Run the default suite | `npm test` |
|
|
34
|
+
| Run the default suite with coverage | `npm run test:cov` |
|
|
35
|
+
| Type-check library source | `npm run type-check` |
|
|
36
|
+
| Type-check test source | `npm run type-check:test` |
|
|
37
|
+
| Lint library and test source | `npm run lint` |
|
|
@@ -2,7 +2,7 @@ import { Logger } from '@nathapp/nestjs-logging';
|
|
|
2
2
|
import { AuditEntry, IAuditStorage } from '../interface';
|
|
3
3
|
export declare class LoggerAuditStorage implements IAuditStorage {
|
|
4
4
|
private readonly logger;
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(loggerByClass?: Logger, loggerByToken?: Logger);
|
|
6
6
|
record(entry: AuditEntry): Promise<void>;
|
|
7
7
|
query(): Promise<AuditEntry[]>;
|
|
8
8
|
}
|
|
@@ -17,7 +17,13 @@ const common_1 = require("@nestjs/common");
|
|
|
17
17
|
const nestjs_common_1 = require("@nathapp/nestjs-common");
|
|
18
18
|
const nestjs_logging_1 = require("@nathapp/nestjs-logging");
|
|
19
19
|
let LoggerAuditStorage = class LoggerAuditStorage {
|
|
20
|
-
constructor(
|
|
20
|
+
constructor(loggerByClass, loggerByToken) {
|
|
21
|
+
const logger = loggerByClass !== null && loggerByClass !== void 0 ? loggerByClass : loggerByToken;
|
|
22
|
+
if (!logger) {
|
|
23
|
+
throw new Error('LoggerAuditStorage requires a logger: provide the exported Logger from ' +
|
|
24
|
+
'@nathapp/nestjs-logging (e.g. import LoggingModule.register()) or bind a ' +
|
|
25
|
+
'Logger under the LOGGER_SERVICE token.');
|
|
26
|
+
}
|
|
21
27
|
this.logger = logger;
|
|
22
28
|
}
|
|
23
29
|
async record(entry) {
|
|
@@ -40,7 +46,11 @@ let LoggerAuditStorage = class LoggerAuditStorage {
|
|
|
40
46
|
exports.LoggerAuditStorage = LoggerAuditStorage;
|
|
41
47
|
exports.LoggerAuditStorage = LoggerAuditStorage = __decorate([
|
|
42
48
|
(0, common_1.Injectable)(),
|
|
43
|
-
__param(0, (0, common_1.
|
|
44
|
-
|
|
49
|
+
__param(0, (0, common_1.Optional)()),
|
|
50
|
+
__param(0, (0, common_1.Inject)(nestjs_logging_1.Logger)),
|
|
51
|
+
__param(1, (0, common_1.Optional)()),
|
|
52
|
+
__param(1, (0, common_1.Inject)(nestjs_logging_1.LOGGER_SERVICE)),
|
|
53
|
+
__metadata("design:paramtypes", [nestjs_logging_1.Logger,
|
|
54
|
+
nestjs_logging_1.Logger])
|
|
45
55
|
], LoggerAuditStorage);
|
|
46
56
|
//# sourceMappingURL=logger-audit-storage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger-audit-storage.js","sourceRoot":"","sources":["../../lib/provider/logger-audit-storage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"logger-audit-storage.js","sourceRoot":"","sources":["../../lib/provider/logger-audit-storage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,0DAA8D;AAC9D,4DAAiE;AAQ1D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAG7B,YAC8B,aAAsB,EACd,aAAsB;QAE1D,MAAM,MAAM,GAAG,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,aAAa,CAAC;QAC9C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,yEAAyE;gBACvE,2EAA2E;gBAC3E,wCAAwC,CAC3C,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAiB;QAC5B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE;YACvB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE;YACxC,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACzB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,oCAAoB,CAAC;YAC7B,OAAO,EAAE,6CAA6C;SACvD,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAnCY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,uBAAM,CAAC,CAAA;IAC1B,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,+BAAc,CAAC,CAAA;qCADS,uBAAM;QACE,uBAAM;GALjD,kBAAkB,CAmC9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nathapp/nestjs-audit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "Decorator-driven, storage-agnostic audit logging for NestJS applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@nathapp/eslint-config": "1.0.1",
|
|
35
|
-
"@nathapp/nestjs-common": "^4.
|
|
36
|
-
"@nathapp/nestjs-logging": "^4.
|
|
35
|
+
"@nathapp/nestjs-common": "^4.6.0",
|
|
36
|
+
"@nathapp/nestjs-logging": "^4.6.0",
|
|
37
37
|
"@nathapp/typescript-config": "1.0.1",
|
|
38
38
|
"@nestjs/common": "^12.0.0",
|
|
39
39
|
"@nestjs/core": "^12.0.0",
|