@geekmidas/audit 10.0.0-alpha.2 → 10.0.0-alpha.21

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 (77) hide show
  1. package/dist/{Auditor-CW2NrfHS.d.mts → Auditor-BBXXCD0v.d.cts} +2 -7
  2. package/dist/Auditor-BBXXCD0v.d.cts.map +1 -0
  3. package/dist/{Auditor-DpBHXIJM.d.cts → Auditor-BBXXCD0v.d.mts} +2 -7
  4. package/dist/Auditor-BBXXCD0v.d.mts.map +1 -0
  5. package/dist/Auditor.d.cts +1 -1
  6. package/dist/Auditor.d.mts +1 -1
  7. package/dist/Auditor.mjs +1 -0
  8. package/dist/DefaultAuditor.cjs +95 -2
  9. package/dist/DefaultAuditor.cjs.map +1 -0
  10. package/dist/DefaultAuditor.d.cts +55 -3
  11. package/dist/DefaultAuditor.d.cts.map +1 -0
  12. package/dist/DefaultAuditor.d.mts +55 -3
  13. package/dist/DefaultAuditor.d.mts.map +1 -0
  14. package/dist/DefaultAuditor.mjs +94 -2
  15. package/dist/DefaultAuditor.mjs.map +1 -0
  16. package/dist/cache.cjs +166 -2
  17. package/dist/cache.cjs.map +1 -0
  18. package/dist/cache.d.cts +92 -3
  19. package/dist/cache.d.cts.map +1 -0
  20. package/dist/cache.d.mts +92 -3
  21. package/dist/cache.d.mts.map +1 -0
  22. package/dist/cache.mjs +165 -2
  23. package/dist/cache.mjs.map +1 -0
  24. package/dist/index.cjs +3 -3
  25. package/dist/index.d.cts +3 -3
  26. package/dist/index.d.mts +3 -3
  27. package/dist/index.mjs +2 -3
  28. package/dist/knex.cjs +9 -9
  29. package/dist/knex.cjs.map +1 -1
  30. package/dist/knex.d.cts +9 -11
  31. package/dist/knex.d.cts.map +1 -1
  32. package/dist/knex.d.mts +9 -11
  33. package/dist/knex.d.mts.map +1 -1
  34. package/dist/knex.mjs +7 -7
  35. package/dist/knex.mjs.map +1 -1
  36. package/dist/kysely.cjs +9 -9
  37. package/dist/kysely.cjs.map +1 -1
  38. package/dist/kysely.d.cts +9 -11
  39. package/dist/kysely.d.cts.map +1 -1
  40. package/dist/kysely.d.mts +9 -11
  41. package/dist/kysely.d.mts.map +1 -1
  42. package/dist/kysely.mjs +7 -7
  43. package/dist/kysely.mjs.map +1 -1
  44. package/dist/memory.cjs +6 -7
  45. package/dist/memory.cjs.map +1 -1
  46. package/dist/memory.d.cts +3 -7
  47. package/dist/memory.d.cts.map +1 -1
  48. package/dist/memory.d.mts +3 -7
  49. package/dist/memory.d.mts.map +1 -1
  50. package/dist/memory.mjs +3 -4
  51. package/dist/memory.mjs.map +1 -1
  52. package/dist/storage.d.cts +1 -1
  53. package/dist/storage.d.mts +1 -1
  54. package/dist/storage.mjs +1 -0
  55. package/dist/types.d.cts +1 -1
  56. package/dist/types.d.mts +1 -1
  57. package/dist/types.mjs +1 -0
  58. package/package.json +13 -13
  59. package/dist/Auditor-CW2NrfHS.d.mts.map +0 -1
  60. package/dist/Auditor-DpBHXIJM.d.cts.map +0 -1
  61. package/dist/DefaultAuditor-BAVnNmRh.mjs +0 -96
  62. package/dist/DefaultAuditor-BAVnNmRh.mjs.map +0 -1
  63. package/dist/DefaultAuditor-DlJ1ENfx.d.mts +0 -59
  64. package/dist/DefaultAuditor-DlJ1ENfx.d.mts.map +0 -1
  65. package/dist/DefaultAuditor-GRFI86N_.d.cts +0 -59
  66. package/dist/DefaultAuditor-GRFI86N_.d.cts.map +0 -1
  67. package/dist/DefaultAuditor-JbZ_BQfh.cjs +0 -102
  68. package/dist/DefaultAuditor-JbZ_BQfh.cjs.map +0 -1
  69. package/dist/cache-BbIl31RL.mjs +0 -167
  70. package/dist/cache-BbIl31RL.mjs.map +0 -1
  71. package/dist/cache-Bih6HxY6.d.cts +0 -96
  72. package/dist/cache-Bih6HxY6.d.cts.map +0 -1
  73. package/dist/cache-l7jAptBl.cjs +0 -173
  74. package/dist/cache-l7jAptBl.cjs.map +0 -1
  75. package/dist/cache-wET57t6d.d.mts +0 -96
  76. package/dist/cache-wET57t6d.d.mts.map +0 -1
  77. package/dist/chunk-CUT6urMc.cjs +0 -30
@@ -1,96 +0,0 @@
1
- import { AuditQueryOptions, AuditRecord, AuditStorage, AuditableAction } from "./Auditor-CW2NrfHS.mjs";
2
- import { Cache } from "@geekmidas/cache";
3
-
4
- //#region src/cache.d.ts
5
-
6
- /**
7
- * Configuration for CacheAuditStorage.
8
- */
9
- interface CacheAuditStorageConfig {
10
- /** Cache instance to use for storage */
11
- cache: Cache;
12
- /**
13
- * Key prefix for audit records.
14
- * Records are stored as `${prefix}:${id}`.
15
- * @default 'audit'
16
- */
17
- prefix?: string;
18
- /**
19
- * TTL (time-to-live) in seconds for audit records.
20
- * If not set, records use the cache's default TTL.
21
- */
22
- ttl?: number;
23
- }
24
- /**
25
- * Cache-based audit storage implementation.
26
- * Uses any @geekmidas/cache implementation for storage.
27
- *
28
- * Best suited for:
29
- * - Development and testing
30
- * - Temporary audit logs that don't need persistence
31
- * - Applications with existing cache infrastructure
32
- * - Distributed systems needing shared audit state (with Redis/Upstash)
33
- *
34
- * Note: Query performance may degrade with large numbers of records
35
- * since filtering happens in memory after fetching all records.
36
- *
37
- * @template TAuditAction - Optional type parameter for type-safe audit actions.
38
- *
39
- * @example
40
- * ```typescript
41
- * import { CacheAuditStorage } from '@geekmidas/audit/cache';
42
- * import { InMemoryCache } from '@geekmidas/cache/memory';
43
- * import { UpstashCache } from '@geekmidas/cache/upstash';
44
- *
45
- * // With in-memory cache (development/testing)
46
- * const storage = new CacheAuditStorage({
47
- * cache: new InMemoryCache(),
48
- * ttl: 86400, // 24 hours
49
- * });
50
- *
51
- * // With Upstash Redis (production)
52
- * const storage = new CacheAuditStorage({
53
- * cache: new UpstashCache({
54
- * url: process.env.UPSTASH_REDIS_URL,
55
- * token: process.env.UPSTASH_REDIS_TOKEN,
56
- * }),
57
- * ttl: 604800, // 7 days
58
- * });
59
- * ```
60
- */
61
- declare class CacheAuditStorage<TAuditAction extends AuditableAction<string, unknown> = AuditableAction<string, unknown>> implements AuditStorage<TAuditAction> {
62
- private readonly cache;
63
- private readonly prefix;
64
- private readonly ttl?;
65
- private readonly indexKey;
66
- constructor(config: CacheAuditStorageConfig);
67
- /**
68
- * Write audit records to cache.
69
- */
70
- write(records: AuditRecord[]): Promise<void>;
71
- /**
72
- * Query audit records from cache.
73
- */
74
- query(options: AuditQueryOptions): Promise<AuditRecord[]>;
75
- /**
76
- * Count audit records matching filters.
77
- */
78
- count(options: Omit<AuditQueryOptions, 'limit' | 'offset'>): Promise<number>;
79
- /**
80
- * Get all stored records (for testing/debugging).
81
- */
82
- getRecords(): Promise<AuditRecord[]>;
83
- /**
84
- * Clear all stored records.
85
- */
86
- clear(): Promise<void>;
87
- private getRecordKey;
88
- private getAllRecords;
89
- private serializeRecord;
90
- private deserializeRecord;
91
- private applyFilters;
92
- }
93
- //# sourceMappingURL=cache.d.ts.map
94
- //#endregion
95
- export { CacheAuditStorage, CacheAuditStorageConfig };
96
- //# sourceMappingURL=cache-wET57t6d.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache-wET57t6d.d.mts","names":[],"sources":["../src/cache.ts"],"sourcesContent":[],"mappings":";;;;;;AAOA;AAqDA;AAA8B,UArDb,uBAAA,CAqDa;EAAA;EACO,KAAoB,EApDjD,KAoDiD;EAAe;;;;;EA+CjC,MAAW,CAAA,EAAA,MAAA;EAAW;;;;EA+BlD,GAQkB,CAAA,EAAA,MAAA;;;;AAlFJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cALZ,uCACS,mCAAmC,6CAI5C,aAAa;;;;;sBAOL;;;;iBAUC,gBAAgB;;;;iBA0BhB,oBAAoB,QAAQ;;;;iBA8BvC,KAAK,yCACZ;;;;gBAQiB,QAAQ;;;;WAOb"}
@@ -1,30 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
-
25
- Object.defineProperty(exports, '__toESM', {
26
- enumerable: true,
27
- get: function () {
28
- return __toESM;
29
- }
30
- });