@jmlq/logger-plugin-fs 0.1.0-alpha.1 → 0.1.0-alpha.11

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.
Files changed (119) hide show
  1. package/README.md +551 -0
  2. package/architecture.md +299 -0
  3. package/dist/application/dto/index.d.ts +1 -0
  4. package/dist/application/dto/index.js +17 -0
  5. package/dist/application/dto/rotate-if-needed.request.d.ts +10 -0
  6. package/dist/application/dto/rotate-if-needed.request.js +2 -0
  7. package/dist/application/factory/create-fs-datasource.factory.d.ts +16 -0
  8. package/dist/application/factory/create-fs-datasource.factory.js +51 -0
  9. package/dist/application/factory/index.d.ts +1 -0
  10. package/dist/application/factory/index.js +17 -0
  11. package/dist/application/types/filesystem-datasource-options.type.d.ts +45 -0
  12. package/dist/application/types/filesystem-datasource-options.type.js +2 -0
  13. package/dist/application/types/index.d.ts +1 -0
  14. package/dist/application/types/index.js +17 -0
  15. package/dist/application/use-cases/append-log.use-case.d.ts +30 -0
  16. package/dist/application/use-cases/append-log.use-case.js +39 -0
  17. package/dist/application/use-cases/ensure-directory.use-case.d.ts +58 -0
  18. package/dist/application/use-cases/ensure-directory.use-case.js +64 -0
  19. package/dist/application/use-cases/find-logs-use-case.d.ts +17 -0
  20. package/dist/application/use-cases/find-logs-use-case.js +64 -0
  21. package/dist/application/use-cases/index.d.ts +5 -0
  22. package/dist/application/use-cases/index.js +21 -0
  23. package/dist/application/use-cases/persist-log.use-case.d.ts +96 -0
  24. package/dist/application/use-cases/persist-log.use-case.js +105 -0
  25. package/dist/application/use-cases/rotate-if-needed.use-case.d.ts +55 -0
  26. package/dist/application/use-cases/rotate-if-needed.use-case.js +61 -0
  27. package/dist/domain/model/index.d.ts +1 -0
  28. package/dist/domain/model/index.js +17 -0
  29. package/dist/domain/model/log-entry.model.d.ts +8 -0
  30. package/dist/domain/model/log-entry.model.js +2 -0
  31. package/dist/domain/ports/file/file-path.port.d.ts +38 -0
  32. package/dist/domain/ports/file/file-path.port.js +2 -0
  33. package/dist/domain/ports/file/file-rotator.port.d.ts +42 -0
  34. package/dist/domain/ports/file/file-rotator.port.js +2 -0
  35. package/dist/domain/ports/file/index.d.ts +2 -0
  36. package/dist/domain/ports/file/index.js +18 -0
  37. package/dist/domain/ports/file/log-stream-writer.port.d.ts +70 -0
  38. package/dist/domain/ports/file/log-stream-writer.port.js +2 -0
  39. package/dist/domain/ports/filesystem-provider.port.d.ts +61 -0
  40. package/dist/domain/ports/filesystem-provider.port.js +2 -0
  41. package/dist/domain/ports/index.d.ts +5 -0
  42. package/dist/domain/ports/index.js +21 -0
  43. package/dist/domain/ports/logs/find/index.d.ts +2 -0
  44. package/dist/domain/ports/logs/find/index.js +18 -0
  45. package/dist/domain/ports/logs/find/log-file-line-reader.port.d.ts +3 -0
  46. package/dist/domain/ports/logs/find/log-file-line-reader.port.js +2 -0
  47. package/dist/domain/ports/logs/find/log-file-numerator.port.d.ts +3 -0
  48. package/dist/domain/ports/logs/find/log-file-numerator.port.js +2 -0
  49. package/dist/domain/ports/logs/index.d.ts +2 -0
  50. package/dist/domain/ports/logs/index.js +18 -0
  51. package/dist/domain/ports/logs/log-datasource.port.d.ts +10 -0
  52. package/dist/domain/ports/logs/log-datasource.port.js +2 -0
  53. package/dist/domain/ports/system-clock.port.d.ts +8 -0
  54. package/dist/domain/ports/system-clock.port.js +2 -0
  55. package/dist/domain/request/index.d.ts +2 -0
  56. package/dist/domain/request/index.js +18 -0
  57. package/dist/domain/request/log-filter.request.d.ts +9 -0
  58. package/dist/domain/request/log-filter.request.js +2 -0
  59. package/dist/domain/request/save-log.request.d.ts +7 -0
  60. package/dist/domain/request/save-log.request.js +2 -0
  61. package/dist/domain/response/index.d.ts +1 -0
  62. package/dist/domain/response/index.js +17 -0
  63. package/dist/domain/response/log.response.d.ts +8 -0
  64. package/dist/domain/response/log.response.js +2 -0
  65. package/dist/domain/types/fs-rotation-by.type.d.ts +8 -0
  66. package/dist/domain/types/fs-rotation-by.type.js +2 -0
  67. package/dist/domain/types/index.d.ts +1 -0
  68. package/dist/domain/types/index.js +17 -0
  69. package/dist/domain/value-objects/file-name-pattern.vo.d.ts +36 -0
  70. package/dist/domain/value-objects/file-name-pattern.vo.js +53 -0
  71. package/dist/domain/value-objects/file-path.vo.d.ts +91 -0
  72. package/dist/domain/value-objects/file-path.vo.js +100 -0
  73. package/dist/domain/value-objects/file-rotation-policy.vo.d.ts +51 -0
  74. package/dist/domain/value-objects/file-rotation-policy.vo.js +76 -0
  75. package/dist/domain/value-objects/file-size.vo.d.ts +75 -0
  76. package/dist/domain/value-objects/file-size.vo.js +114 -0
  77. package/dist/domain/value-objects/index.d.ts +5 -0
  78. package/dist/domain/value-objects/index.js +21 -0
  79. package/dist/domain/value-objects/log-level.vo.d.ts +8 -0
  80. package/dist/domain/value-objects/log-level.vo.js +13 -0
  81. package/dist/index.d.ts +4 -13
  82. package/dist/index.js +10 -38
  83. package/dist/infrastructure/adapters/file-rotator.adapter.d.ts +79 -0
  84. package/dist/infrastructure/adapters/file-rotator.adapter.js +171 -0
  85. package/dist/infrastructure/adapters/fileSystem-datasource.adapter.d.ts +26 -0
  86. package/dist/infrastructure/adapters/fileSystem-datasource.adapter.js +45 -0
  87. package/dist/infrastructure/adapters/filesystem-log-file-enumerator.adapter.d.ts +6 -0
  88. package/dist/infrastructure/adapters/filesystem-log-file-enumerator.adapter.js +54 -0
  89. package/dist/infrastructure/adapters/filesystem-log-file-line-reader.adapter.d.ts +4 -0
  90. package/dist/infrastructure/adapters/filesystem-log-file-line-reader.adapter.js +53 -0
  91. package/dist/infrastructure/adapters/filesystem-provider.adapter.d.ts +122 -0
  92. package/dist/infrastructure/adapters/filesystem-provider.adapter.js +182 -0
  93. package/dist/infrastructure/adapters/index.d.ts +8 -0
  94. package/dist/infrastructure/adapters/index.js +24 -0
  95. package/dist/infrastructure/adapters/log-stream-writer.adapter.d.ts +80 -0
  96. package/dist/infrastructure/adapters/log-stream-writer.adapter.js +163 -0
  97. package/dist/infrastructure/adapters/system-clock.adapter.d.ts +25 -0
  98. package/dist/infrastructure/adapters/system-clock.adapter.js +30 -0
  99. package/dist/infrastructure/adapters/system-file-path.adapter.d.ts +47 -0
  100. package/dist/infrastructure/adapters/system-file-path.adapter.js +141 -0
  101. package/dist/infrastructure/errors/file-operation.error.d.ts +28 -0
  102. package/dist/infrastructure/errors/file-operation.error.js +54 -0
  103. package/dist/infrastructure/errors/index.d.ts +1 -0
  104. package/dist/infrastructure/errors/index.js +17 -0
  105. package/dist/infrastructure/errors/types/file-operation-error-options.type.d.ts +8 -0
  106. package/dist/infrastructure/errors/types/file-operation-error-options.type.js +2 -0
  107. package/dist/infrastructure/errors/types/file-operation.type.d.ts +1 -0
  108. package/dist/infrastructure/errors/types/file-operation.type.js +2 -0
  109. package/dist/infrastructure/errors/types/fs-error-scope.type.d.ts +1 -0
  110. package/dist/infrastructure/errors/types/fs-error-scope.type.js +2 -0
  111. package/dist/infrastructure/errors/types/index.d.ts +3 -0
  112. package/dist/infrastructure/errors/types/index.js +19 -0
  113. package/dist/infrastructure/filesystem/index.d.ts +1 -0
  114. package/dist/infrastructure/filesystem/index.js +17 -0
  115. package/dist/infrastructure/filesystem/types/filesystem-rotation.type.d.ts +12 -0
  116. package/dist/infrastructure/filesystem/types/filesystem-rotation.type.js +2 -0
  117. package/dist/infrastructure/filesystem/types/index.d.ts +1 -0
  118. package/dist/infrastructure/filesystem/types/index.js +17 -0
  119. package/package.json +40 -13
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,12 @@
1
+ import { FsRotationBy } from "../../../domain/types";
2
+ /**
3
+ * Representa la configuración que el sistema de log debe seguir para decidir cuándo rotar archivos.
4
+ * by: Estrategia principal de rotación: "none", "day", "size".
5
+ * maxSizeMB: Tamaño máximo del archivo antes de rotar (solo aplica si by === "size").
6
+ * maxFiles: Cuántos archivos rotados se mantienen. Ejemplo: si maxFiles = 5, se mantienen:
7
+ */
8
+ export interface IFileSystemRotationConfig {
9
+ by: FsRotationBy;
10
+ maxSizeMB?: number;
11
+ maxFiles?: number;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./filesystem-rotation.type";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./filesystem-rotation.type"), exports);
package/package.json CHANGED
@@ -1,22 +1,49 @@
1
1
  {
2
2
  "name": "@jmlq/logger-plugin-fs",
3
- "version": "0.1.0-alpha.1",
4
- "author": "MLahuasi",
3
+ "description": "Filesystem plugin for JMLQ Logger implementing Clean Architecture principles.",
4
+ "version": "0.1.0-alpha.11",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "files": [
8
- "dist"
9
- ],
10
7
  "scripts": {
11
- "build": "tsc -p tsconfig.json",
12
- "prepublishOnly": "pnpm build"
8
+ "dev": "rimraf dist && mkdir dist && tsc -p tsconfig.json",
9
+ "build": "rimraf dist && mkdir dist && tsc -p tsconfig.build.json",
10
+ "prepublishOnly": "npm run build",
11
+ "test": "jest --passWithNoTests",
12
+ "test:watch": "jest --watch",
13
+ "test:coverage": "jest --coverage",
14
+ "example:help": "tsx examples/index.example.ts help",
15
+ "example:all": "tsx examples/index.example.ts",
16
+ "example:value-objects": "tsx examples/index.example.ts value-objects",
17
+ "example:infrastructure-adapters": "tsx examples/index.example.ts infrastructure-adapters",
18
+ "example:application-use-cases": "tsx examples/index.example.ts application-use-cases",
19
+ "example:application-services": "tsx examples/index.example.ts application-services",
20
+ "example:application-factories": "tsx examples/index.example.ts application-factories"
13
21
  },
22
+ "keywords": [
23
+ "logger",
24
+ "filesystem",
25
+ "clean-architecture",
26
+ "typescript"
27
+ ],
14
28
  "devDependencies": {
15
- "@types/node": "^24.3.0",
16
- "tsx": "^4.20.5",
17
- "typescript": "^5.9.2"
29
+ "@swc/core": "^1.3.95",
30
+ "@swc/jest": "^0.2.29",
31
+ "@types/bcryptjs": "^2.4.5",
32
+ "@types/jest": "^29.5.8",
33
+ "@types/node": "^20.8.10",
34
+ "jest": "^29.7.0",
35
+ "rimraf": "^6.1.2",
36
+ "tsx": "^4.1.4",
37
+ "typescript": "^5.2.2"
18
38
  },
19
- "peerDependencies": {
20
- "@jmlq/logger": "^0.1.0-alpha.0"
21
- }
39
+ "files": [
40
+ "dist",
41
+ "README.md",
42
+ "architecture.md"
43
+ ],
44
+ "dependencies": {
45
+ "@jmlq/logger": "^0.1.0-alpha.20"
46
+ },
47
+ "author": "MLahuasi",
48
+ "license": "MIT"
22
49
  }