@guren/server 2.1.0 → 2.2.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/dist/{McpServiceProvider-7BB5FPF3.js → McpServiceProvider-GRDYNEQG.js} +1 -1
- package/dist/auth/AuthManager.d.ts +30 -0
- package/dist/auth/AuthenticatableModel.d.ts +25 -0
- package/dist/auth/RequestAuthContext.d.ts +24 -0
- package/dist/auth/SessionGuard.d.ts +31 -0
- package/dist/auth/api-token.d.ts +299 -0
- package/dist/auth/email-verification.d.ts +203 -0
- package/dist/auth/index.d.ts +18 -110
- package/dist/auth/index.js +3 -1
- package/dist/auth/oauth/index.d.ts +239 -0
- package/dist/auth/password/DefaultHasher.d.ts +13 -0
- package/dist/auth/password/NodeHasher.d.ts +22 -0
- package/dist/auth/password/PasswordHasher.d.ts +5 -0
- package/dist/auth/password/ScryptHasher.d.ts +26 -0
- package/dist/auth/password-reset.d.ts +91 -0
- package/dist/auth/providers/ModelUserProvider.d.ts +36 -0
- package/dist/auth/providers/UserProvider.d.ts +9 -0
- package/dist/auth/types.d.ts +102 -0
- package/dist/auth/utils.d.ts +39 -0
- package/dist/{Gate-CynjZCtS.d.ts → authorization/Gate.d.ts} +30 -111
- package/dist/authorization/Policy.d.ts +77 -0
- package/dist/authorization/index.d.ts +5 -129
- package/dist/authorization/index.js +3 -1
- package/dist/authorization/middleware.d.ts +49 -0
- package/dist/authorization/types.d.ts +108 -0
- package/dist/broadcasting/BroadcastManager.d.ts +205 -0
- package/dist/broadcasting/channels/Channel.d.ts +28 -0
- package/dist/broadcasting/channels/PresenceChannel.d.ts +72 -0
- package/dist/broadcasting/channels/PrivateChannel.d.ts +32 -0
- package/dist/broadcasting/channels/index.d.ts +3 -0
- package/dist/broadcasting/drivers/MemoryDriver.d.ts +93 -0
- package/dist/broadcasting/drivers/RedisDriver.d.ts +112 -0
- package/dist/broadcasting/drivers/index.d.ts +2 -0
- package/dist/broadcasting/index.d.ts +6 -233
- package/dist/broadcasting/index.js +1 -1
- package/dist/broadcasting/typed.d.ts +23 -0
- package/dist/broadcasting/types.d.ts +155 -0
- package/dist/cache/CacheManager.d.ts +87 -0
- package/dist/cache/TaggedCache.d.ts +62 -0
- package/dist/cache/index.d.ts +6 -233
- package/dist/cache/index.js +1 -1
- package/dist/cache/stores/FileStore.d.ts +64 -0
- package/dist/cache/stores/MemoryStore.d.ts +52 -0
- package/dist/cache/stores/RedisStore.d.ts +53 -0
- package/dist/{CacheManager-BmDzUKrF.d.ts → cache/types.d.ts} +26 -99
- package/dist/{chunk-TVY72CLV.js → chunk-4VE3LYOM.js} +3 -2
- package/dist/{chunk-FZD2AKJI.js → chunk-7OB2YXRE.js} +56 -28
- package/dist/{chunk-HONCNQXZ.js → chunk-BUQXOZCT.js} +97 -10
- package/dist/{chunk-DSDX3ASM.js → chunk-CDZUNKI6.js} +65 -83
- package/dist/{chunk-CWI4AJ47.js → chunk-HPET6XY5.js} +13 -9
- package/dist/{chunk-A3ISJVEV.js → chunk-HR2KZ3WL.js} +23 -5
- package/dist/{chunk-EARA7JM4.js → chunk-PZKUDFMW.js} +11 -8
- package/dist/console/Command.d.ts +179 -0
- package/dist/{ConsoleKernel-CJg975mp.d.ts → console/ConsoleKernel.d.ts} +4 -6
- package/dist/console/Input.d.ts +140 -0
- package/dist/console/Output.d.ts +161 -0
- package/dist/console/index.d.ts +5 -0
- package/dist/console/types.d.ts +106 -0
- package/dist/container/Container.d.ts +148 -0
- package/dist/container/ServiceProvider.d.ts +103 -0
- package/dist/container/bindings.d.ts +55 -0
- package/dist/container/defineModule.d.ts +88 -0
- package/dist/container/definePlugin.d.ts +62 -0
- package/dist/container/index.d.ts +8 -0
- package/dist/container/types.d.ts +73 -0
- package/dist/database/Factory.d.ts +82 -0
- package/dist/database/Seeder.d.ts +35 -0
- package/dist/database/SeederRunner.d.ts +41 -0
- package/dist/database/index.d.ts +4 -0
- package/dist/database/types.d.ts +49 -0
- package/dist/discovery/AutoDiscovery.d.ts +113 -0
- package/dist/discovery/index.d.ts +2 -0
- package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +12 -0
- package/dist/docs-viewer/endpoint.d.ts +19 -0
- package/dist/encryption/Encrypter.d.ts +96 -0
- package/dist/encryption/Hash.d.ts +69 -0
- package/dist/encryption/MessageSigner.d.ts +21 -0
- package/dist/encryption/Random.d.ts +119 -0
- package/dist/encryption/app-key.d.ts +12 -0
- package/dist/encryption/index.d.ts +10 -222
- package/dist/encryption/signed-url.d.ts +9 -0
- package/dist/encryption/types.d.ts +103 -0
- package/dist/errors/ExceptionHandler.d.ts +118 -0
- package/dist/errors/HttpException.d.ts +106 -0
- package/dist/errors/debug-page.d.ts +22 -0
- package/dist/errors/error-page.d.ts +1 -0
- package/dist/errors/exceptions/AuthenticationException.d.ts +32 -0
- package/dist/errors/exceptions/AuthorizationException.d.ts +32 -0
- package/dist/errors/exceptions/MethodNotAllowedException.d.ts +31 -0
- package/dist/errors/exceptions/NotFoundHttpException.d.ts +36 -0
- package/dist/errors/exceptions/ValidationException.d.ts +60 -0
- package/dist/errors/exceptions/index.d.ts +5 -0
- package/dist/errors/index.d.ts +5 -0
- package/dist/errors/types.d.ts +43 -0
- package/dist/events/Event.d.ts +33 -0
- package/dist/{EventManager-CmIoLt7r.d.ts → events/EventManager.d.ts} +4 -86
- package/dist/events/Listener.d.ts +79 -0
- package/dist/events/builtin.d.ts +73 -0
- package/dist/events/index.d.ts +6 -155
- package/dist/events/types.d.ts +48 -0
- package/dist/facades/index.d.ts +31 -0
- package/dist/health/HealthCheck.d.ts +34 -0
- package/dist/health/HealthManager.d.ts +53 -0
- package/dist/health/checks/CacheCheck.d.ts +35 -0
- package/dist/health/checks/CustomCheck.d.ts +23 -0
- package/dist/health/checks/DatabaseCheck.d.ts +33 -0
- package/dist/health/checks/MemoryCheck.d.ts +32 -0
- package/dist/health/checks/RedisCheck.d.ts +27 -0
- package/dist/health/checks/StorageCheck.d.ts +35 -0
- package/dist/health/checks/index.d.ts +12 -0
- package/dist/health/index.d.ts +5 -185
- package/dist/health/types.d.ts +52 -0
- package/dist/hot-reload/hot-disposables.d.ts +96 -0
- package/dist/hot-reload/testing.d.ts +14 -0
- package/dist/http/Application.d.ts +187 -0
- package/dist/http/FormRequest.d.ts +73 -0
- package/dist/http/dev-assets.d.ts +51 -0
- package/dist/http/dev-banner.d.ts +7 -0
- package/dist/http/inertia-assets.d.ts +22 -0
- package/dist/http/middleware/auth.d.ts +13 -0
- package/dist/http/middleware/capabilities.d.ts +22 -0
- package/dist/http/middleware/cors.d.ts +40 -0
- package/dist/http/middleware/csp.d.ts +59 -0
- package/dist/http/middleware/csrf.d.ts +121 -0
- package/dist/http/middleware/detect-locale.d.ts +65 -0
- package/dist/http/middleware/force-https.d.ts +34 -0
- package/dist/http/middleware/host-authorization.d.ts +24 -0
- package/dist/http/middleware/index.d.ts +19 -0
- package/dist/http/middleware/loopback-guard.d.ts +38 -0
- package/dist/{rate-limit-D9J2b4S1.d.ts → http/middleware/rate-limit.d.ts} +22 -50
- package/dist/http/middleware/redirect-safety.d.ts +29 -0
- package/dist/http/middleware/request-id.d.ts +19 -0
- package/dist/http/middleware/request-logging.d.ts +16 -0
- package/dist/http/middleware/security-headers.d.ts +49 -0
- package/dist/http/middleware/session.d.ts +93 -0
- package/dist/http/middleware/validation.d.ts +94 -0
- package/dist/http/public-assets.d.ts +15 -0
- package/dist/http/request.d.ts +24 -0
- package/dist/http/resources/CursorPaginator.d.ts +106 -0
- package/dist/http/resources/Paginator.d.ts +130 -0
- package/dist/http/resources/Resource.d.ts +67 -0
- package/dist/http/resources/ResourceCollection.d.ts +60 -0
- package/dist/http/resources/index.d.ts +6 -0
- package/dist/http/resources/types.d.ts +91 -0
- package/dist/http/validation/Validator.d.ts +128 -0
- package/dist/http/validation/index.d.ts +3 -0
- package/dist/http/validation/rules.d.ts +196 -0
- package/dist/http/validation/types.d.ts +96 -0
- package/dist/http/vite-dev-server.d.ts +27 -0
- package/dist/i18n/I18nManager.d.ts +114 -0
- package/dist/i18n/Translator.d.ts +80 -0
- package/dist/i18n/index.d.ts +6 -101
- package/dist/i18n/index.js +5 -3
- package/dist/i18n/loaders/JsonLoader.d.ts +47 -0
- package/dist/i18n/loaders/MemoryLoader.d.ts +37 -0
- package/dist/i18n/pluralization.d.ts +19 -0
- package/dist/i18n/types.d.ts +106 -0
- package/dist/index.d.ts +69 -2605
- package/dist/index.js +332 -152
- package/dist/lambda/index.d.ts +17 -37
- package/dist/logging/LogManager.d.ts +83 -0
- package/dist/logging/Logger.d.ts +76 -0
- package/dist/logging/channels/ConsoleChannel.d.ts +11 -0
- package/dist/logging/channels/DailyFileChannel.d.ts +20 -0
- package/dist/logging/channels/FileChannel.d.ts +15 -0
- package/dist/logging/index.d.ts +8 -50
- package/dist/logging/types.d.ts +96 -0
- package/dist/mail/Mail.d.ts +138 -0
- package/dist/mail/MailManager.d.ts +79 -0
- package/dist/mail/address.d.ts +8 -0
- package/dist/mail/index.d.ts +7 -316
- package/dist/mail/transports/LogTransport.d.ts +19 -0
- package/dist/mail/transports/MemoryTransport.d.ts +84 -0
- package/dist/mail/transports/ResendTransport.d.ts +32 -0
- package/dist/mail/transports/SmtpTransport.d.ts +40 -0
- package/dist/{MailManager-DpMvYiP9.d.ts → mail/types.d.ts} +11 -92
- package/dist/mcp/McpServiceProvider.d.ts +17 -0
- package/dist/mcp/create-mcp-server.d.ts +144 -0
- package/dist/mcp/endpoint.d.ts +29 -0
- package/dist/mcp/index.d.ts +3 -185
- package/dist/mcp/index.js +1 -1
- package/dist/mvc/Controller.d.ts +326 -0
- package/dist/mvc/Router.d.ts +239 -0
- package/dist/mvc/ViewEngine.d.ts +11 -0
- package/dist/mvc/inertia/InertiaEngine.d.ts +114 -0
- package/dist/mvc/inertia/shared.d.ts +90 -0
- package/dist/mvc/mount-route.d.ts +10 -0
- package/dist/notifications/Notification.d.ts +99 -0
- package/dist/notifications/NotificationManager.d.ts +150 -0
- package/dist/notifications/channels/DatabaseChannel.d.ts +55 -0
- package/dist/notifications/channels/MailChannel.d.ts +45 -0
- package/dist/notifications/channels/MemoryChannel.d.ts +85 -0
- package/dist/notifications/channels/SlackChannel.d.ts +73 -0
- package/dist/notifications/channels/index.d.ts +4 -0
- package/dist/notifications/index.d.ts +6 -322
- package/dist/notifications/notifiable-type.d.ts +10 -0
- package/dist/notifications/registry.d.ts +39 -0
- package/dist/notifications/types.d.ts +162 -0
- package/dist/providers/AuthServiceProvider.d.ts +7 -0
- package/dist/providers/AuthorizationServiceProvider.d.ts +9 -0
- package/dist/providers/BroadcastServiceProvider.d.ts +7 -0
- package/dist/providers/CacheServiceProvider.d.ts +7 -0
- package/dist/providers/EncryptionServiceProvider.d.ts +7 -0
- package/dist/providers/ErrorServiceProvider.d.ts +9 -0
- package/dist/providers/EventServiceProvider.d.ts +7 -0
- package/dist/providers/HealthServiceProvider.d.ts +7 -0
- package/dist/providers/I18nServiceProvider.d.ts +27 -0
- package/dist/providers/InertiaServiceProvider.d.ts +20 -0
- package/dist/providers/LogServiceProvider.d.ts +7 -0
- package/dist/providers/MailServiceProvider.d.ts +7 -0
- package/dist/providers/NotificationServiceProvider.d.ts +8 -0
- package/dist/providers/OAuthServiceProvider.d.ts +7 -0
- package/dist/providers/QueueServiceProvider.d.ts +7 -0
- package/dist/providers/SchedulingServiceProvider.d.ts +7 -0
- package/dist/providers/StorageServiceProvider.d.ts +7 -0
- package/dist/providers/index.d.ts +17 -0
- package/dist/queue/FailedJobReporter.d.ts +40 -0
- package/dist/queue/Job.d.ts +140 -0
- package/dist/queue/QueueManager.d.ts +79 -0
- package/dist/queue/Worker.d.ts +99 -0
- package/dist/queue/drivers/MemoryDriver.d.ts +60 -0
- package/dist/queue/drivers/RedisDriver.d.ts +96 -0
- package/dist/queue/drivers/SqsDriver.d.ts +108 -0
- package/dist/queue/drivers/SyncDriver.d.ts +28 -0
- package/dist/queue/index.d.ts +9 -453
- package/dist/queue/types.d.ts +171 -0
- package/dist/redis/RedisApiTokenStore.d.ts +78 -0
- package/dist/redis/RedisEmailVerificationStore.d.ts +54 -0
- package/dist/redis/RedisOAuthStateStore.d.ts +26 -0
- package/dist/redis/RedisPasswordResetStore.d.ts +57 -0
- package/dist/redis/RedisRateLimitStore.d.ts +77 -0
- package/dist/redis/RedisSessionStore.d.ts +61 -0
- package/dist/redis/client.d.ts +41 -0
- package/dist/redis/index.d.ts +14 -356
- package/dist/redis/index.js +5 -2
- package/dist/redis/scan-keys.d.ts +6 -0
- package/dist/runtime/index.d.ts +8 -95
- package/dist/runtime/index.js +1 -1
- package/dist/scheduling/CronParser.d.ts +37 -0
- package/dist/scheduling/Schedule.d.ts +229 -0
- package/dist/scheduling/ScheduledTask.d.ts +47 -0
- package/dist/scheduling/Scheduler.d.ts +99 -0
- package/dist/scheduling/index.d.ts +5 -41
- package/dist/scheduling/types.d.ts +97 -0
- package/dist/storage/StorageManager.d.ts +65 -0
- package/dist/storage/drivers/LocalDriver.d.ts +55 -0
- package/dist/storage/drivers/MemoryDriver.d.ts +66 -0
- package/dist/storage/drivers/S3Driver.d.ts +72 -0
- package/dist/storage/index.d.ts +5 -197
- package/dist/{StorageManager-oZTHqaza.d.ts → storage/types.d.ts} +10 -77
- package/dist/support/error-polyfill.d.ts +9 -0
- package/dist/support/import-map.d.ts +13 -0
- package/dist/support/redirect-target.d.ts +11 -0
- package/dist/support/stack-frames.d.ts +56 -0
- package/dist/support/trim-slashes.d.ts +11 -0
- package/dist/vite/index.d.ts +2 -35
- package/dist/vite/index.js +0 -3
- package/dist/vite/plugin.d.ts +34 -0
- package/package.json +3 -3
- package/dist/AuthManager-DBP4KYsx.d.ts +0 -79
- package/dist/BroadcastManager-D8KoJxiV.d.ts +0 -492
- package/dist/HealthManager-DUyMIzsZ.d.ts +0 -141
- package/dist/I18nManager-BiSoczfV.d.ts +0 -275
- package/dist/LogManager-7mxnkaPM.d.ts +0 -256
- package/dist/Scheduler-pZiT8i57.d.ts +0 -471
- package/dist/api-token-D24VPr_E.d.ts +0 -663
- package/dist/app-key-CsBfRC_Q.d.ts +0 -214
- package/dist/email-verification-D60YF2ZO.d.ts +0 -329
- package/dist/index-9_Jzj5jo.d.ts +0 -7
- package/dist/validation-yAL53e1S.d.ts +0 -2610
package/dist/cache/index.d.ts
CHANGED
|
@@ -1,233 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 };
|
|
1
|
+
export type { CacheStore, TaggableCacheStore, TaggedCacheStore, CacheStoreFactory, CacheConfig, MemoryStoreOptions, RedisStoreOptions, FileStoreOptions, StoreConfig, CachedItem, } from './types.js';
|
|
2
|
+
export { MemoryStore } from './stores/MemoryStore.js';
|
|
3
|
+
export { RedisStore } from './stores/RedisStore.js';
|
|
4
|
+
export { FileStore } from './stores/FileStore.js';
|
|
5
|
+
export { TaggedCache } from './TaggedCache.js';
|
|
6
|
+
export { CacheManager, createCacheManager } from './CacheManager.js';
|
package/dist/cache/index.js
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { CacheStore, FileStoreOptions } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* File-based cache store.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const store = new FileStore({ path: './storage/cache' })
|
|
8
|
+
*
|
|
9
|
+
* await store.set('user:1', { name: 'John' }, 3600)
|
|
10
|
+
* const user = await store.get<User>('user:1')
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare class FileStore implements CacheStore {
|
|
14
|
+
private readonly basePath;
|
|
15
|
+
private readonly extension;
|
|
16
|
+
private readonly now;
|
|
17
|
+
constructor(options: FileStoreOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Generate a hashed filename for a cache key.
|
|
20
|
+
*/
|
|
21
|
+
private getFilePath;
|
|
22
|
+
/**
|
|
23
|
+
* Ensure the cache directory exists.
|
|
24
|
+
*/
|
|
25
|
+
private ensureDirectory;
|
|
26
|
+
/**
|
|
27
|
+
* Read a cache file.
|
|
28
|
+
*/
|
|
29
|
+
private readCacheFile;
|
|
30
|
+
/**
|
|
31
|
+
* Write a cache file.
|
|
32
|
+
*/
|
|
33
|
+
private writeCacheFile;
|
|
34
|
+
/**
|
|
35
|
+
* Delete a cache file.
|
|
36
|
+
*/
|
|
37
|
+
private deleteCacheFile;
|
|
38
|
+
/**
|
|
39
|
+
* Check if a cached item is expired.
|
|
40
|
+
*/
|
|
41
|
+
private isExpired;
|
|
42
|
+
get<T>(key: string): Promise<T | null>;
|
|
43
|
+
set<T>(key: string, value: T, ttl?: number): Promise<void>;
|
|
44
|
+
has(key: string): Promise<boolean>;
|
|
45
|
+
delete(key: string): Promise<boolean>;
|
|
46
|
+
clear(): Promise<void>;
|
|
47
|
+
increment(key: string, value?: number): Promise<number>;
|
|
48
|
+
decrement(key: string, value?: number): Promise<number>;
|
|
49
|
+
remember<T>(key: string, ttl: number, callback: () => Promise<T>): Promise<T>;
|
|
50
|
+
rememberForever<T>(key: string, callback: () => Promise<T>): Promise<T>;
|
|
51
|
+
getMany<T>(keys: string[]): Promise<Map<string, T | null>>;
|
|
52
|
+
setMany<T>(items: Map<string, T>, ttl?: number): Promise<void>;
|
|
53
|
+
deleteMany(keys: string[]): Promise<number>;
|
|
54
|
+
ttl(key: string): Promise<number>;
|
|
55
|
+
/**
|
|
56
|
+
* Clean up expired cache files.
|
|
57
|
+
* This can be called periodically to free disk space.
|
|
58
|
+
*/
|
|
59
|
+
cleanup(): Promise<number>;
|
|
60
|
+
/**
|
|
61
|
+
* Get the base path.
|
|
62
|
+
*/
|
|
63
|
+
getBasePath(): string;
|
|
64
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CacheStore, MemoryStoreOptions } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* In-memory cache store.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const store = new MemoryStore()
|
|
8
|
+
*
|
|
9
|
+
* await store.set('user:1', { name: 'John' }, 3600)
|
|
10
|
+
* const user = await store.get<User>('user:1')
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare class MemoryStore implements CacheStore {
|
|
14
|
+
private readonly cache;
|
|
15
|
+
private readonly maxSize;
|
|
16
|
+
private readonly now;
|
|
17
|
+
private checkInterval;
|
|
18
|
+
constructor(options?: MemoryStoreOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Remove expired items from the cache.
|
|
21
|
+
*/
|
|
22
|
+
private removeExpired;
|
|
23
|
+
/**
|
|
24
|
+
* Check if an item is expired.
|
|
25
|
+
*/
|
|
26
|
+
private isExpired;
|
|
27
|
+
/**
|
|
28
|
+
* Evict items if cache is full.
|
|
29
|
+
*/
|
|
30
|
+
private evictIfNeeded;
|
|
31
|
+
get<T>(key: string): Promise<T | null>;
|
|
32
|
+
set<T>(key: string, value: T, ttl?: number): Promise<void>;
|
|
33
|
+
has(key: string): Promise<boolean>;
|
|
34
|
+
delete(key: string): Promise<boolean>;
|
|
35
|
+
clear(): Promise<void>;
|
|
36
|
+
increment(key: string, value?: number): Promise<number>;
|
|
37
|
+
decrement(key: string, value?: number): Promise<number>;
|
|
38
|
+
remember<T>(key: string, ttl: number, callback: () => Promise<T>): Promise<T>;
|
|
39
|
+
rememberForever<T>(key: string, callback: () => Promise<T>): Promise<T>;
|
|
40
|
+
getMany<T>(keys: string[]): Promise<Map<string, T | null>>;
|
|
41
|
+
setMany<T>(items: Map<string, T>, ttl?: number): Promise<void>;
|
|
42
|
+
deleteMany(keys: string[]): Promise<number>;
|
|
43
|
+
ttl(key: string): Promise<number>;
|
|
44
|
+
/**
|
|
45
|
+
* Get the number of items in the cache.
|
|
46
|
+
*/
|
|
47
|
+
size(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Stop the expiration check interval.
|
|
50
|
+
*/
|
|
51
|
+
destroy(): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CacheStore, RedisStoreOptions } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Redis-backed cache store.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import Redis from 'ioredis'
|
|
8
|
+
*
|
|
9
|
+
* const redis = new Redis(process.env.REDIS_URL)
|
|
10
|
+
* const store = new RedisStore({ client: redis })
|
|
11
|
+
*
|
|
12
|
+
* await store.set('user:1', { name: 'John' }, 3600)
|
|
13
|
+
* const user = await store.get<User>('user:1')
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class RedisStore implements CacheStore {
|
|
17
|
+
private readonly client;
|
|
18
|
+
private readonly prefix;
|
|
19
|
+
constructor(options: RedisStoreOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Get the prefixed key.
|
|
22
|
+
*/
|
|
23
|
+
private prefixKey;
|
|
24
|
+
/**
|
|
25
|
+
* Serialize a value for storage.
|
|
26
|
+
*/
|
|
27
|
+
private serialize;
|
|
28
|
+
/**
|
|
29
|
+
* Deserialize a stored value.
|
|
30
|
+
*/
|
|
31
|
+
private deserialize;
|
|
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 Redis client instance.
|
|
47
|
+
*/
|
|
48
|
+
getClient(): unknown;
|
|
49
|
+
/**
|
|
50
|
+
* Get the key prefix.
|
|
51
|
+
*/
|
|
52
|
+
getPrefix(): string;
|
|
53
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cache store interface.
|
|
3
3
|
*/
|
|
4
|
-
interface CacheStore {
|
|
4
|
+
export interface CacheStore {
|
|
5
5
|
/**
|
|
6
6
|
* Get a value from the cache.
|
|
7
7
|
*/
|
|
@@ -73,7 +73,7 @@ interface CacheStore {
|
|
|
73
73
|
/**
|
|
74
74
|
* Cache store that supports tagging.
|
|
75
75
|
*/
|
|
76
|
-
interface TaggableCacheStore extends CacheStore {
|
|
76
|
+
export interface TaggableCacheStore extends CacheStore {
|
|
77
77
|
/**
|
|
78
78
|
* Get a tagged cache instance.
|
|
79
79
|
*/
|
|
@@ -82,7 +82,7 @@ interface TaggableCacheStore extends CacheStore {
|
|
|
82
82
|
/**
|
|
83
83
|
* Tagged cache store interface.
|
|
84
84
|
*/
|
|
85
|
-
interface TaggedCacheStore extends CacheStore {
|
|
85
|
+
export interface TaggedCacheStore extends CacheStore {
|
|
86
86
|
/**
|
|
87
87
|
* Flush all items with the current tags.
|
|
88
88
|
*/
|
|
@@ -95,11 +95,11 @@ interface TaggedCacheStore extends CacheStore {
|
|
|
95
95
|
/**
|
|
96
96
|
* Cache store factory function.
|
|
97
97
|
*/
|
|
98
|
-
type CacheStoreFactory = () => CacheStore;
|
|
98
|
+
export type CacheStoreFactory = () => CacheStore;
|
|
99
99
|
/**
|
|
100
100
|
* Memory store options.
|
|
101
101
|
*/
|
|
102
|
-
interface MemoryStoreOptions {
|
|
102
|
+
export interface MemoryStoreOptions {
|
|
103
103
|
/**
|
|
104
104
|
* Maximum number of items to store.
|
|
105
105
|
* @default Infinity
|
|
@@ -110,11 +110,19 @@ interface MemoryStoreOptions {
|
|
|
110
110
|
* @default 60000 (1 minute)
|
|
111
111
|
*/
|
|
112
112
|
checkPeriod?: number;
|
|
113
|
+
/**
|
|
114
|
+
* Clock used for TTL calculations. Must return a Unix timestamp in
|
|
115
|
+
* milliseconds (compatible with `Date.now()`) — persisted `expiresAt`
|
|
116
|
+
* values are read by other instances using the default clock.
|
|
117
|
+
* Injectable for tests.
|
|
118
|
+
* @default Date.now
|
|
119
|
+
*/
|
|
120
|
+
now?: () => number;
|
|
113
121
|
}
|
|
114
122
|
/**
|
|
115
123
|
* Redis store options.
|
|
116
124
|
*/
|
|
117
|
-
interface RedisStoreOptions {
|
|
125
|
+
export interface RedisStoreOptions {
|
|
118
126
|
/**
|
|
119
127
|
* Redis client instance (ioredis).
|
|
120
128
|
*/
|
|
@@ -128,7 +136,7 @@ interface RedisStoreOptions {
|
|
|
128
136
|
/**
|
|
129
137
|
* File store options.
|
|
130
138
|
*/
|
|
131
|
-
interface FileStoreOptions {
|
|
139
|
+
export interface FileStoreOptions {
|
|
132
140
|
/**
|
|
133
141
|
* Directory path for cache files.
|
|
134
142
|
*/
|
|
@@ -138,11 +146,19 @@ interface FileStoreOptions {
|
|
|
138
146
|
* @default '.cache'
|
|
139
147
|
*/
|
|
140
148
|
extension?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Clock used for TTL calculations. Must return a Unix timestamp in
|
|
151
|
+
* milliseconds (compatible with `Date.now()`) — persisted `expiresAt`
|
|
152
|
+
* values are read by other instances using the default clock.
|
|
153
|
+
* Injectable for tests.
|
|
154
|
+
* @default Date.now
|
|
155
|
+
*/
|
|
156
|
+
now?: () => number;
|
|
141
157
|
}
|
|
142
158
|
/**
|
|
143
159
|
* Store configuration union type.
|
|
144
160
|
*/
|
|
145
|
-
type StoreConfig = {
|
|
161
|
+
export type StoreConfig = {
|
|
146
162
|
driver: 'memory';
|
|
147
163
|
} & MemoryStoreOptions | {
|
|
148
164
|
driver: 'redis';
|
|
@@ -152,7 +168,7 @@ type StoreConfig = {
|
|
|
152
168
|
/**
|
|
153
169
|
* Cache manager configuration.
|
|
154
170
|
*/
|
|
155
|
-
interface CacheConfig {
|
|
171
|
+
export interface CacheConfig {
|
|
156
172
|
/**
|
|
157
173
|
* Default store name.
|
|
158
174
|
* @default 'memory'
|
|
@@ -166,96 +182,7 @@ interface CacheConfig {
|
|
|
166
182
|
/**
|
|
167
183
|
* Cached item with metadata.
|
|
168
184
|
*/
|
|
169
|
-
interface CachedItem<T = unknown> {
|
|
185
|
+
export interface CachedItem<T = unknown> {
|
|
170
186
|
value: T;
|
|
171
187
|
expiresAt: number | null;
|
|
172
188
|
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Cache manager for handling multiple cache stores.
|
|
176
|
-
*
|
|
177
|
-
* @example
|
|
178
|
-
* ```ts
|
|
179
|
-
* const cache = new CacheManager({
|
|
180
|
-
* default: 'redis',
|
|
181
|
-
* stores: {
|
|
182
|
-
* memory: { driver: 'memory' },
|
|
183
|
-
* redis: { driver: 'redis', client: redisClient },
|
|
184
|
-
* file: { driver: 'file', path: './storage/cache' },
|
|
185
|
-
* }
|
|
186
|
-
* })
|
|
187
|
-
*
|
|
188
|
-
* // Use the default store
|
|
189
|
-
* await cache.store().set('key', 'value', 3600)
|
|
190
|
-
*
|
|
191
|
-
* // Use a specific store
|
|
192
|
-
* await cache.store('memory').set('key', 'value')
|
|
193
|
-
*
|
|
194
|
-
* // Use tagged cache
|
|
195
|
-
* await cache.store().tags(['posts', 'user:1']).set('user:1:posts', posts)
|
|
196
|
-
* await cache.store().tags(['user:1']).flush()
|
|
197
|
-
* ```
|
|
198
|
-
*/
|
|
199
|
-
declare class CacheManager {
|
|
200
|
-
private readonly defaultStoreName;
|
|
201
|
-
private readonly storeFactories;
|
|
202
|
-
private readonly resolvedStores;
|
|
203
|
-
/**
|
|
204
|
-
* Where this manager was built, for identifying its stores across hot reloads.
|
|
205
|
-
*
|
|
206
|
-
* Captured here rather than in `store()` because stores resolve lazily, from
|
|
207
|
-
* whichever request first asks for one — a call site that says nothing about
|
|
208
|
-
* which manager owns the result. Skipped outside `--hot`, where it would be a
|
|
209
|
-
* formatted stack string held for the manager's lifetime and never read.
|
|
210
|
-
*/
|
|
211
|
-
private readonly builtAt;
|
|
212
|
-
constructor(config?: CacheConfig);
|
|
213
|
-
private driverFactories;
|
|
214
|
-
/**
|
|
215
|
-
* Register built-in store drivers.
|
|
216
|
-
*/
|
|
217
|
-
private registerBuiltinDrivers;
|
|
218
|
-
/**
|
|
219
|
-
* Register a store from configuration.
|
|
220
|
-
*/
|
|
221
|
-
private registerStoreFromConfig;
|
|
222
|
-
/**
|
|
223
|
-
* Get a cache store by name.
|
|
224
|
-
* Returns the default store if no name is specified.
|
|
225
|
-
*/
|
|
226
|
-
store(name?: string): TaggableCacheStore;
|
|
227
|
-
/**
|
|
228
|
-
* Under `bun --hot`, stops the sweep timer held by the store this one replaces.
|
|
229
|
-
*
|
|
230
|
-
* Registered from here rather than from `MemoryStore` itself because this is
|
|
231
|
-
* where the store's name is known, and the name is what keeps two memory
|
|
232
|
-
* stores in one config from sharing a slot and cancelling each other's sweep.
|
|
233
|
-
*/
|
|
234
|
-
private stopPreviousStore;
|
|
235
|
-
/**
|
|
236
|
-
* Register a custom store factory.
|
|
237
|
-
*/
|
|
238
|
-
registerStore(name: string, factory: CacheStoreFactory): void;
|
|
239
|
-
/**
|
|
240
|
-
* Register a custom driver.
|
|
241
|
-
*/
|
|
242
|
-
registerDriver(name: string, factory: (options: unknown) => CacheStore): void;
|
|
243
|
-
/**
|
|
244
|
-
* Check if a store is registered.
|
|
245
|
-
*/
|
|
246
|
-
hasStore(name: string): boolean;
|
|
247
|
-
/**
|
|
248
|
-
* Get the default store name.
|
|
249
|
-
*/
|
|
250
|
-
getDefaultStoreName(): string;
|
|
251
|
-
/**
|
|
252
|
-
* Get all registered store names.
|
|
253
|
-
*/
|
|
254
|
-
getStoreNames(): string[];
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Create a cache manager with configuration.
|
|
258
|
-
*/
|
|
259
|
-
declare function createCacheManager(config?: CacheConfig): CacheManager;
|
|
260
|
-
|
|
261
|
-
export { CacheManager as C, type FileStoreOptions as F, type MemoryStoreOptions as M, type RedisStoreOptions as R, type StoreConfig as S, type TaggedCacheStore as T, type CacheConfig as a, type CacheStore as b, type CacheStoreFactory as c, createCacheManager as d, type CachedItem as e, type TaggableCacheStore as f };
|
|
@@ -649,9 +649,10 @@ var BroadcastManager = class {
|
|
|
649
649
|
}
|
|
650
650
|
if (registration.type === "presence") {
|
|
651
651
|
const presenceAuth = registration.authorizer;
|
|
652
|
-
|
|
652
|
+
const member = await presenceAuth(channelName, user);
|
|
653
|
+
return typeof member === "object" && member !== null ? member : false;
|
|
653
654
|
}
|
|
654
|
-
return await registration.authorizer(channelName, user);
|
|
655
|
+
return await registration.authorizer(channelName, user) === true;
|
|
655
656
|
}
|
|
656
657
|
/**
|
|
657
658
|
* Find channel registration for a channel name.
|