@noony-serverless/core 0.1.0 → 0.1.5

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 (56) hide show
  1. package/build/middlewares/authenticationMiddleware.d.ts +379 -0
  2. package/build/middlewares/authenticationMiddleware.js +216 -0
  3. package/build/middlewares/bodyParserMiddleware.d.ts +99 -0
  4. package/build/middlewares/bodyParserMiddleware.js +99 -0
  5. package/build/middlewares/bodyValidationMiddleware.d.ts +68 -4
  6. package/build/middlewares/bodyValidationMiddleware.js +64 -0
  7. package/build/middlewares/dependencyInjectionMiddleware.d.ts +238 -0
  8. package/build/middlewares/dependencyInjectionMiddleware.js +238 -0
  9. package/build/middlewares/errorHandlerMiddleware.d.ts +94 -0
  10. package/build/middlewares/errorHandlerMiddleware.js +105 -0
  11. package/build/middlewares/guards/RouteGuards.d.ts +475 -0
  12. package/build/middlewares/guards/RouteGuards.js +604 -0
  13. package/build/middlewares/guards/cache/CacheAdapter.d.ts +473 -0
  14. package/build/middlewares/guards/cache/CacheAdapter.js +205 -0
  15. package/build/middlewares/guards/cache/ConservativeCacheInvalidation.d.ts +191 -0
  16. package/build/middlewares/guards/cache/ConservativeCacheInvalidation.js +510 -0
  17. package/build/middlewares/guards/cache/MemoryCacheAdapter.d.ts +228 -0
  18. package/build/middlewares/guards/cache/MemoryCacheAdapter.js +403 -0
  19. package/build/middlewares/guards/cache/NoopCacheAdapter.d.ts +95 -0
  20. package/build/middlewares/guards/cache/NoopCacheAdapter.js +131 -0
  21. package/build/middlewares/guards/config/GuardConfiguration.d.ts +612 -0
  22. package/build/middlewares/guards/config/GuardConfiguration.js +334 -0
  23. package/build/middlewares/guards/guards/FastAuthGuard.d.ts +201 -0
  24. package/build/middlewares/guards/guards/FastAuthGuard.js +460 -0
  25. package/build/middlewares/guards/guards/PermissionGuardFactory.d.ts +202 -0
  26. package/build/middlewares/guards/guards/PermissionGuardFactory.js +563 -0
  27. package/build/middlewares/guards/index.d.ts +67 -0
  28. package/build/middlewares/guards/index.js +192 -0
  29. package/build/middlewares/guards/registry/PermissionRegistry.d.ts +188 -0
  30. package/build/middlewares/guards/registry/PermissionRegistry.js +425 -0
  31. package/build/middlewares/guards/resolvers/ExpressionPermissionResolver.d.ts +129 -0
  32. package/build/middlewares/guards/resolvers/ExpressionPermissionResolver.js +451 -0
  33. package/build/middlewares/guards/resolvers/PermissionResolver.d.ts +155 -0
  34. package/build/middlewares/guards/resolvers/PermissionResolver.js +176 -0
  35. package/build/middlewares/guards/resolvers/PlainPermissionResolver.d.ts +101 -0
  36. package/build/middlewares/guards/resolvers/PlainPermissionResolver.js +248 -0
  37. package/build/middlewares/guards/resolvers/WildcardPermissionResolver.d.ts +146 -0
  38. package/build/middlewares/guards/resolvers/WildcardPermissionResolver.js +377 -0
  39. package/build/middlewares/guards/services/FastUserContextService.d.ts +216 -0
  40. package/build/middlewares/guards/services/FastUserContextService.js +435 -0
  41. package/build/middlewares/headerVariablesMiddleware.d.ts +118 -0
  42. package/build/middlewares/headerVariablesMiddleware.js +118 -0
  43. package/build/middlewares/httpAttributesMiddleware.d.ts +235 -0
  44. package/build/middlewares/httpAttributesMiddleware.js +235 -0
  45. package/build/middlewares/index.d.ts +1 -0
  46. package/build/middlewares/index.js +1 -0
  47. package/build/middlewares/queryParametersMiddleware.d.ts +105 -0
  48. package/build/middlewares/queryParametersMiddleware.js +105 -0
  49. package/build/middlewares/rateLimitingMiddleware.d.ts +109 -5
  50. package/build/middlewares/rateLimitingMiddleware.js +109 -5
  51. package/build/middlewares/responseWrapperMiddleware.d.ts +170 -1
  52. package/build/middlewares/responseWrapperMiddleware.js +170 -1
  53. package/build/middlewares/securityAuditMiddleware.js +5 -5
  54. package/build/middlewares/validationMiddleware.d.ts +145 -0
  55. package/build/middlewares/validationMiddleware.js +145 -0
  56. package/package.json +2 -2
@@ -0,0 +1,95 @@
1
+ /**
2
+ * No-Operation Cache Adapter
3
+ *
4
+ * A cache adapter implementation that doesn't actually cache anything.
5
+ * Useful for testing scenarios, disabled caching configurations, or
6
+ * development environments where cache behavior needs to be bypassed.
7
+ *
8
+ * All operations return immediately without storing or retrieving data,
9
+ * ensuring that the guard system can operate without caching when needed.
10
+ *
11
+ * @author Noony Framework Team
12
+ * @version 1.0.0
13
+ */
14
+ import { CacheAdapter, CacheStats } from './CacheAdapter';
15
+ /**
16
+ * No-operation cache adapter that doesn't cache anything
17
+ *
18
+ * This implementation provides the CacheAdapter interface but performs
19
+ * no actual caching operations. All get operations return null, all set
20
+ * operations are ignored, and all delete operations are no-ops.
21
+ *
22
+ * Useful for:
23
+ * - Testing scenarios where caching should be disabled
24
+ * - Development environments with live data
25
+ * - Troubleshooting cache-related issues
26
+ * - Performance baseline measurements
27
+ */
28
+ export declare class NoopCacheAdapter implements CacheAdapter {
29
+ private readonly startTime;
30
+ private readonly name;
31
+ private stats;
32
+ constructor(name?: string);
33
+ /**
34
+ * Always returns null (no caching)
35
+ *
36
+ * @param key - Cache key to retrieve (ignored)
37
+ * @returns Promise resolving to null
38
+ */
39
+ get<T>(_key: string): Promise<T | null>;
40
+ /**
41
+ * Does nothing (no caching)
42
+ *
43
+ * @param key - Cache key to store under (ignored)
44
+ * @param value - Value to cache (ignored)
45
+ * @param ttlMs - Time to live in milliseconds (ignored)
46
+ */
47
+ set<T>(_key: string, _value: T, _ttlMs?: number): Promise<void>;
48
+ /**
49
+ * Does nothing (no caching)
50
+ *
51
+ * @param key - Cache key to delete (ignored)
52
+ */
53
+ delete(_key: string): Promise<void>;
54
+ /**
55
+ * Does nothing (no caching)
56
+ *
57
+ * @param pattern - Pattern to match keys (ignored)
58
+ */
59
+ deletePattern(_pattern: string): Promise<void>;
60
+ /**
61
+ * Does nothing (no caching)
62
+ */
63
+ flush(): Promise<void>;
64
+ /**
65
+ * Get statistics for monitoring
66
+ *
67
+ * Returns statistics about operations performed, even though
68
+ * no actual caching occurs. This helps with monitoring and
69
+ * understanding system behavior.
70
+ *
71
+ * @returns Cache statistics with 0% hit rate
72
+ */
73
+ getStats(): Promise<CacheStats>;
74
+ /**
75
+ * Get adapter name for debugging
76
+ */
77
+ getName(): string;
78
+ /**
79
+ * Get operation statistics for debugging
80
+ */
81
+ getOperationStats(): {
82
+ gets: number;
83
+ sets: number;
84
+ deletes: number;
85
+ flushes: number;
86
+ };
87
+ /**
88
+ * Check if this is a no-op cache adapter
89
+ *
90
+ * Utility method for other components to detect when
91
+ * caching is disabled and adjust behavior accordingly.
92
+ */
93
+ isNoop(): boolean;
94
+ }
95
+ //# sourceMappingURL=NoopCacheAdapter.d.ts.map
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ /**
3
+ * No-Operation Cache Adapter
4
+ *
5
+ * A cache adapter implementation that doesn't actually cache anything.
6
+ * Useful for testing scenarios, disabled caching configurations, or
7
+ * development environments where cache behavior needs to be bypassed.
8
+ *
9
+ * All operations return immediately without storing or retrieving data,
10
+ * ensuring that the guard system can operate without caching when needed.
11
+ *
12
+ * @author Noony Framework Team
13
+ * @version 1.0.0
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.NoopCacheAdapter = void 0;
17
+ /**
18
+ * No-operation cache adapter that doesn't cache anything
19
+ *
20
+ * This implementation provides the CacheAdapter interface but performs
21
+ * no actual caching operations. All get operations return null, all set
22
+ * operations are ignored, and all delete operations are no-ops.
23
+ *
24
+ * Useful for:
25
+ * - Testing scenarios where caching should be disabled
26
+ * - Development environments with live data
27
+ * - Troubleshooting cache-related issues
28
+ * - Performance baseline measurements
29
+ */
30
+ class NoopCacheAdapter {
31
+ startTime = Date.now();
32
+ name;
33
+ // Track statistics even though we don't cache
34
+ stats = {
35
+ gets: 0,
36
+ sets: 0,
37
+ deletes: 0,
38
+ flushes: 0,
39
+ };
40
+ constructor(name = 'noop-cache') {
41
+ this.name = name;
42
+ }
43
+ /**
44
+ * Always returns null (no caching)
45
+ *
46
+ * @param key - Cache key to retrieve (ignored)
47
+ * @returns Promise resolving to null
48
+ */
49
+ async get(_key) {
50
+ this.stats.gets++;
51
+ return null;
52
+ }
53
+ /**
54
+ * Does nothing (no caching)
55
+ *
56
+ * @param key - Cache key to store under (ignored)
57
+ * @param value - Value to cache (ignored)
58
+ * @param ttlMs - Time to live in milliseconds (ignored)
59
+ */
60
+ async set(_key, _value, _ttlMs) {
61
+ this.stats.sets++;
62
+ // Intentionally do nothing
63
+ }
64
+ /**
65
+ * Does nothing (no caching)
66
+ *
67
+ * @param key - Cache key to delete (ignored)
68
+ */
69
+ async delete(_key) {
70
+ this.stats.deletes++;
71
+ // Intentionally do nothing
72
+ }
73
+ /**
74
+ * Does nothing (no caching)
75
+ *
76
+ * @param pattern - Pattern to match keys (ignored)
77
+ */
78
+ async deletePattern(_pattern) {
79
+ this.stats.deletes++;
80
+ // Intentionally do nothing
81
+ }
82
+ /**
83
+ * Does nothing (no caching)
84
+ */
85
+ async flush() {
86
+ this.stats.flushes++;
87
+ // Intentionally do nothing
88
+ }
89
+ /**
90
+ * Get statistics for monitoring
91
+ *
92
+ * Returns statistics about operations performed, even though
93
+ * no actual caching occurs. This helps with monitoring and
94
+ * understanding system behavior.
95
+ *
96
+ * @returns Cache statistics with 0% hit rate
97
+ */
98
+ async getStats() {
99
+ return {
100
+ totalEntries: 0, // Never stores anything
101
+ hits: 0, // Never hits (always returns null)
102
+ misses: this.stats.gets, // Every get is a miss
103
+ hitRate: 0, // Always 0% hit rate
104
+ memoryUsage: 0, // Uses no memory for caching
105
+ uptime: Date.now() - this.startTime,
106
+ };
107
+ }
108
+ /**
109
+ * Get adapter name for debugging
110
+ */
111
+ getName() {
112
+ return this.name;
113
+ }
114
+ /**
115
+ * Get operation statistics for debugging
116
+ */
117
+ getOperationStats() {
118
+ return { ...this.stats };
119
+ }
120
+ /**
121
+ * Check if this is a no-op cache adapter
122
+ *
123
+ * Utility method for other components to detect when
124
+ * caching is disabled and adjust behavior accordingly.
125
+ */
126
+ isNoop() {
127
+ return true;
128
+ }
129
+ }
130
+ exports.NoopCacheAdapter = NoopCacheAdapter;
131
+ //# sourceMappingURL=NoopCacheAdapter.js.map