@guren/server 0.2.0-alpha.7 → 1.0.0-rc.12
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/Application-DtWDHXr1.d.ts +2110 -0
- package/dist/BroadcastManager-AkIWUGJo.d.ts +466 -0
- package/dist/CacheManager-BkvHEOZX.d.ts +244 -0
- package/dist/ConsoleKernel-CqCVrdZs.d.ts +207 -0
- package/dist/EventManager-CmIoLt7r.d.ts +207 -0
- package/dist/Gate-CNkBYf8m.d.ts +268 -0
- package/dist/HealthManager-DUyMIzsZ.d.ts +141 -0
- package/dist/I18nManager-Dtgzsf5n.d.ts +270 -0
- package/dist/LogManager-7mxnkaPM.d.ts +256 -0
- package/dist/MailManager-DpMvYiP9.d.ts +292 -0
- package/dist/Scheduler-BstvSca7.d.ts +469 -0
- package/dist/StorageManager-oZTHqaza.d.ts +337 -0
- package/dist/api-token-JOif2CtG.d.ts +1792 -0
- package/dist/app-key-CsBfRC_Q.d.ts +214 -0
- package/dist/auth/index.d.ts +418 -0
- package/dist/auth/index.js +6742 -0
- package/dist/authorization/index.d.ts +129 -0
- package/dist/authorization/index.js +621 -0
- package/dist/broadcasting/index.d.ts +233 -0
- package/dist/broadcasting/index.js +907 -0
- package/dist/cache/index.d.ts +233 -0
- package/dist/cache/index.js +817 -0
- package/dist/encryption/index.d.ts +222 -0
- package/dist/encryption/index.js +602 -0
- package/dist/events/index.d.ts +155 -0
- package/dist/events/index.js +330 -0
- package/dist/health/index.d.ts +185 -0
- package/dist/health/index.js +379 -0
- package/dist/i18n/index.d.ts +101 -0
- package/dist/i18n/index.js +597 -0
- package/dist/index-9_Jzj5jo.d.ts +7 -0
- package/dist/index.d.ts +2628 -619
- package/dist/index.js +22231 -3116
- package/dist/lambda/index.d.ts +156 -0
- package/dist/lambda/index.js +91 -0
- package/dist/logging/index.d.ts +50 -0
- package/dist/logging/index.js +557 -0
- package/dist/mail/index.d.ts +288 -0
- package/dist/mail/index.js +695 -0
- package/dist/mcp/index.d.ts +139 -0
- package/dist/mcp/index.js +382 -0
- package/dist/notifications/index.d.ts +271 -0
- package/dist/notifications/index.js +741 -0
- package/dist/queue/index.d.ts +423 -0
- package/dist/queue/index.js +958 -0
- package/dist/runtime/index.d.ts +93 -0
- package/dist/runtime/index.js +836 -0
- package/dist/scheduling/index.d.ts +41 -0
- package/dist/scheduling/index.js +836 -0
- package/dist/storage/index.d.ts +196 -0
- package/dist/storage/index.js +832 -0
- package/dist/vite/index.js +203 -3
- package/package.json +93 -6
- package/dist/chunk-FK2XQSBF.js +0 -160
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { b as CacheStore, M as MemoryStoreOptions, R as RedisStoreOptions, F as FileStoreOptions, T as TaggedCacheStore } from '../CacheManager-BkvHEOZX.js';
|
|
2
|
+
export { a as CacheConfig, C as CacheManager, c as CacheStoreFactory, e as CachedItem, S as StoreConfig, f as TaggableCacheStore, d as createCacheManager } from '../CacheManager-BkvHEOZX.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* In-memory cache store.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const store = new MemoryStore()
|
|
10
|
+
*
|
|
11
|
+
* await store.set('user:1', { name: 'John' }, 3600)
|
|
12
|
+
* const user = await store.get<User>('user:1')
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare class MemoryStore implements CacheStore {
|
|
16
|
+
private readonly cache;
|
|
17
|
+
private readonly maxSize;
|
|
18
|
+
private checkInterval;
|
|
19
|
+
constructor(options?: MemoryStoreOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Remove expired items from the cache.
|
|
22
|
+
*/
|
|
23
|
+
private removeExpired;
|
|
24
|
+
/**
|
|
25
|
+
* Check if an item is expired.
|
|
26
|
+
*/
|
|
27
|
+
private isExpired;
|
|
28
|
+
/**
|
|
29
|
+
* Evict items if cache is full.
|
|
30
|
+
*/
|
|
31
|
+
private evictIfNeeded;
|
|
32
|
+
get<T>(key: string): Promise<T | null>;
|
|
33
|
+
set<T>(key: string, value: T, ttl?: number): Promise<void>;
|
|
34
|
+
has(key: string): Promise<boolean>;
|
|
35
|
+
delete(key: string): Promise<boolean>;
|
|
36
|
+
clear(): Promise<void>;
|
|
37
|
+
increment(key: string, value?: number): Promise<number>;
|
|
38
|
+
decrement(key: string, value?: number): Promise<number>;
|
|
39
|
+
remember<T>(key: string, ttl: number, callback: () => Promise<T>): Promise<T>;
|
|
40
|
+
rememberForever<T>(key: string, callback: () => Promise<T>): Promise<T>;
|
|
41
|
+
getMany<T>(keys: string[]): Promise<Map<string, T | null>>;
|
|
42
|
+
setMany<T>(items: Map<string, T>, ttl?: number): Promise<void>;
|
|
43
|
+
deleteMany(keys: string[]): Promise<number>;
|
|
44
|
+
ttl(key: string): Promise<number>;
|
|
45
|
+
/**
|
|
46
|
+
* Get the number of items in the cache.
|
|
47
|
+
*/
|
|
48
|
+
size(): number;
|
|
49
|
+
/**
|
|
50
|
+
* Stop the expiration check interval.
|
|
51
|
+
*/
|
|
52
|
+
destroy(): void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Redis-backed cache store.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* import Redis from 'ioredis'
|
|
61
|
+
*
|
|
62
|
+
* const redis = new Redis(process.env.REDIS_URL)
|
|
63
|
+
* const store = new RedisStore({ client: redis })
|
|
64
|
+
*
|
|
65
|
+
* await store.set('user:1', { name: 'John' }, 3600)
|
|
66
|
+
* const user = await store.get<User>('user:1')
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare class RedisStore implements CacheStore {
|
|
70
|
+
private readonly client;
|
|
71
|
+
private readonly prefix;
|
|
72
|
+
constructor(options: RedisStoreOptions);
|
|
73
|
+
/**
|
|
74
|
+
* Get the prefixed key.
|
|
75
|
+
*/
|
|
76
|
+
private prefixKey;
|
|
77
|
+
/**
|
|
78
|
+
* Serialize a value for storage.
|
|
79
|
+
*/
|
|
80
|
+
private serialize;
|
|
81
|
+
/**
|
|
82
|
+
* Deserialize a stored value.
|
|
83
|
+
*/
|
|
84
|
+
private deserialize;
|
|
85
|
+
get<T>(key: string): Promise<T | null>;
|
|
86
|
+
set<T>(key: string, value: T, ttl?: number): Promise<void>;
|
|
87
|
+
has(key: string): Promise<boolean>;
|
|
88
|
+
delete(key: string): Promise<boolean>;
|
|
89
|
+
clear(): Promise<void>;
|
|
90
|
+
increment(key: string, value?: number): Promise<number>;
|
|
91
|
+
decrement(key: string, value?: number): Promise<number>;
|
|
92
|
+
remember<T>(key: string, ttl: number, callback: () => Promise<T>): Promise<T>;
|
|
93
|
+
rememberForever<T>(key: string, callback: () => Promise<T>): Promise<T>;
|
|
94
|
+
getMany<T>(keys: string[]): Promise<Map<string, T | null>>;
|
|
95
|
+
setMany<T>(items: Map<string, T>, ttl?: number): Promise<void>;
|
|
96
|
+
deleteMany(keys: string[]): Promise<number>;
|
|
97
|
+
ttl(key: string): Promise<number>;
|
|
98
|
+
/**
|
|
99
|
+
* Get the Redis client instance.
|
|
100
|
+
*/
|
|
101
|
+
getClient(): unknown;
|
|
102
|
+
/**
|
|
103
|
+
* Get the key prefix.
|
|
104
|
+
*/
|
|
105
|
+
getPrefix(): string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* File-based cache store.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* const store = new FileStore({ path: './storage/cache' })
|
|
114
|
+
*
|
|
115
|
+
* await store.set('user:1', { name: 'John' }, 3600)
|
|
116
|
+
* const user = await store.get<User>('user:1')
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
declare class FileStore implements CacheStore {
|
|
120
|
+
private readonly basePath;
|
|
121
|
+
private readonly extension;
|
|
122
|
+
constructor(options: FileStoreOptions);
|
|
123
|
+
/**
|
|
124
|
+
* Generate a hashed filename for a cache key.
|
|
125
|
+
*/
|
|
126
|
+
private getFilePath;
|
|
127
|
+
/**
|
|
128
|
+
* Ensure the cache directory exists.
|
|
129
|
+
*/
|
|
130
|
+
private ensureDirectory;
|
|
131
|
+
/**
|
|
132
|
+
* Read a cache file.
|
|
133
|
+
*/
|
|
134
|
+
private readCacheFile;
|
|
135
|
+
/**
|
|
136
|
+
* Write a cache file.
|
|
137
|
+
*/
|
|
138
|
+
private writeCacheFile;
|
|
139
|
+
/**
|
|
140
|
+
* Delete a cache file.
|
|
141
|
+
*/
|
|
142
|
+
private deleteCacheFile;
|
|
143
|
+
/**
|
|
144
|
+
* Check if a cached item is expired.
|
|
145
|
+
*/
|
|
146
|
+
private isExpired;
|
|
147
|
+
get<T>(key: string): Promise<T | null>;
|
|
148
|
+
set<T>(key: string, value: T, ttl?: number): Promise<void>;
|
|
149
|
+
has(key: string): Promise<boolean>;
|
|
150
|
+
delete(key: string): Promise<boolean>;
|
|
151
|
+
clear(): Promise<void>;
|
|
152
|
+
increment(key: string, value?: number): Promise<number>;
|
|
153
|
+
decrement(key: string, value?: number): Promise<number>;
|
|
154
|
+
remember<T>(key: string, ttl: number, callback: () => Promise<T>): Promise<T>;
|
|
155
|
+
rememberForever<T>(key: string, callback: () => Promise<T>): Promise<T>;
|
|
156
|
+
getMany<T>(keys: string[]): Promise<Map<string, T | null>>;
|
|
157
|
+
setMany<T>(items: Map<string, T>, ttl?: number): Promise<void>;
|
|
158
|
+
deleteMany(keys: string[]): Promise<number>;
|
|
159
|
+
ttl(key: string): Promise<number>;
|
|
160
|
+
/**
|
|
161
|
+
* Clean up expired cache files.
|
|
162
|
+
* This can be called periodically to free disk space.
|
|
163
|
+
*/
|
|
164
|
+
cleanup(): Promise<number>;
|
|
165
|
+
/**
|
|
166
|
+
* Get the base path.
|
|
167
|
+
*/
|
|
168
|
+
getBasePath(): string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Tagged cache implementation.
|
|
173
|
+
* Allows grouping cache items by tags for bulk invalidation.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* const tagged = new TaggedCache(store, ['posts', 'user:1'])
|
|
178
|
+
*
|
|
179
|
+
* await tagged.set('user:1:posts', posts, 3600)
|
|
180
|
+
* await tagged.flush() // Removes all items with these tags
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
declare class TaggedCache implements TaggedCacheStore {
|
|
184
|
+
private readonly store;
|
|
185
|
+
private readonly tags;
|
|
186
|
+
private readonly tagSetPrefix;
|
|
187
|
+
constructor(store: CacheStore, tags: string[], tagSetPrefix?: string);
|
|
188
|
+
/**
|
|
189
|
+
* Get a unique namespace for the current tags.
|
|
190
|
+
*/
|
|
191
|
+
private getTagNamespace;
|
|
192
|
+
/**
|
|
193
|
+
* Generate a unique namespace identifier.
|
|
194
|
+
*/
|
|
195
|
+
private generateNamespace;
|
|
196
|
+
/**
|
|
197
|
+
* Get the tagged key.
|
|
198
|
+
*/
|
|
199
|
+
private taggedKey;
|
|
200
|
+
/**
|
|
201
|
+
* Track a key in the tag sets.
|
|
202
|
+
*/
|
|
203
|
+
private trackKey;
|
|
204
|
+
get<T>(key: string): Promise<T | null>;
|
|
205
|
+
set<T>(key: string, value: T, ttl?: number): Promise<void>;
|
|
206
|
+
has(key: string): Promise<boolean>;
|
|
207
|
+
delete(key: string): Promise<boolean>;
|
|
208
|
+
clear(): Promise<void>;
|
|
209
|
+
increment(key: string, value?: number): Promise<number>;
|
|
210
|
+
decrement(key: string, value?: number): Promise<number>;
|
|
211
|
+
remember<T>(key: string, ttl: number, callback: () => Promise<T>): Promise<T>;
|
|
212
|
+
rememberForever<T>(key: string, callback: () => Promise<T>): Promise<T>;
|
|
213
|
+
getMany<T>(keys: string[]): Promise<Map<string, T | null>>;
|
|
214
|
+
setMany<T>(items: Map<string, T>, ttl?: number): Promise<void>;
|
|
215
|
+
deleteMany(keys: string[]): Promise<number>;
|
|
216
|
+
ttl(key: string): Promise<number>;
|
|
217
|
+
/**
|
|
218
|
+
* Flush all items with the current tags.
|
|
219
|
+
* This works by resetting the tag namespaces, effectively
|
|
220
|
+
* making all previously tagged items inaccessible.
|
|
221
|
+
*/
|
|
222
|
+
flush(): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* Get the current tags.
|
|
225
|
+
*/
|
|
226
|
+
getTags(): string[];
|
|
227
|
+
/**
|
|
228
|
+
* Get the underlying store.
|
|
229
|
+
*/
|
|
230
|
+
getStore(): CacheStore;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export { CacheStore, FileStore, FileStoreOptions, MemoryStore, MemoryStoreOptions, RedisStore, RedisStoreOptions, TaggedCache, TaggedCacheStore };
|