@guren/server 0.2.0-alpha.7 → 1.0.0-rc.9
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 +22229 -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 +834 -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,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for putting files.
|
|
3
|
+
*/
|
|
4
|
+
interface PutOptions {
|
|
5
|
+
/**
|
|
6
|
+
* File visibility.
|
|
7
|
+
*/
|
|
8
|
+
visibility?: 'public' | 'private';
|
|
9
|
+
/**
|
|
10
|
+
* Content type (MIME type).
|
|
11
|
+
*/
|
|
12
|
+
contentType?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Custom metadata.
|
|
15
|
+
*/
|
|
16
|
+
metadata?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* File metadata.
|
|
20
|
+
*/
|
|
21
|
+
interface FileMetadata {
|
|
22
|
+
/**
|
|
23
|
+
* File path.
|
|
24
|
+
*/
|
|
25
|
+
path: string;
|
|
26
|
+
/**
|
|
27
|
+
* File size in bytes.
|
|
28
|
+
*/
|
|
29
|
+
size: number;
|
|
30
|
+
/**
|
|
31
|
+
* Last modified date.
|
|
32
|
+
*/
|
|
33
|
+
lastModified: Date;
|
|
34
|
+
/**
|
|
35
|
+
* Content type (if available).
|
|
36
|
+
*/
|
|
37
|
+
contentType?: string;
|
|
38
|
+
/**
|
|
39
|
+
* File visibility.
|
|
40
|
+
*/
|
|
41
|
+
visibility?: 'public' | 'private';
|
|
42
|
+
/**
|
|
43
|
+
* Custom metadata.
|
|
44
|
+
*/
|
|
45
|
+
metadata?: Record<string, string>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Storage driver interface.
|
|
49
|
+
*/
|
|
50
|
+
interface StorageDriver {
|
|
51
|
+
/**
|
|
52
|
+
* Put a file into storage.
|
|
53
|
+
* @param path File path
|
|
54
|
+
* @param content File content
|
|
55
|
+
* @param options Put options
|
|
56
|
+
* @returns The stored file path
|
|
57
|
+
*/
|
|
58
|
+
put(path: string, content: Buffer | string, options?: PutOptions): Promise<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Put a file from a local path.
|
|
61
|
+
* @param path Destination path
|
|
62
|
+
* @param localPath Local file path
|
|
63
|
+
* @param options Put options
|
|
64
|
+
* @returns The stored file path
|
|
65
|
+
*/
|
|
66
|
+
putFile(path: string, localPath: string, options?: PutOptions): Promise<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Get file contents.
|
|
69
|
+
* @param path File path
|
|
70
|
+
* @returns File contents or null if not found
|
|
71
|
+
*/
|
|
72
|
+
get(path: string): Promise<Buffer | null>;
|
|
73
|
+
/**
|
|
74
|
+
* Get file contents as string.
|
|
75
|
+
* @param path File path
|
|
76
|
+
* @returns File contents as string or null if not found
|
|
77
|
+
*/
|
|
78
|
+
getAsString(path: string): Promise<string | null>;
|
|
79
|
+
/**
|
|
80
|
+
* Check if a file exists.
|
|
81
|
+
* @param path File path
|
|
82
|
+
*/
|
|
83
|
+
exists(path: string): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Delete a file.
|
|
86
|
+
* @param path File path
|
|
87
|
+
* @returns True if deleted, false if not found
|
|
88
|
+
*/
|
|
89
|
+
delete(path: string): Promise<boolean>;
|
|
90
|
+
/**
|
|
91
|
+
* Delete multiple files.
|
|
92
|
+
* @param paths File paths
|
|
93
|
+
* @returns Number of deleted files
|
|
94
|
+
*/
|
|
95
|
+
deleteMany(paths: string[]): Promise<number>;
|
|
96
|
+
/**
|
|
97
|
+
* Copy a file.
|
|
98
|
+
* @param from Source path
|
|
99
|
+
* @param to Destination path
|
|
100
|
+
* @returns The destination path
|
|
101
|
+
*/
|
|
102
|
+
copy(from: string, to: string): Promise<string>;
|
|
103
|
+
/**
|
|
104
|
+
* Move a file.
|
|
105
|
+
* @param from Source path
|
|
106
|
+
* @param to Destination path
|
|
107
|
+
* @returns The destination path
|
|
108
|
+
*/
|
|
109
|
+
move(from: string, to: string): Promise<string>;
|
|
110
|
+
/**
|
|
111
|
+
* Get the public URL for a file.
|
|
112
|
+
* @param path File path
|
|
113
|
+
*/
|
|
114
|
+
url(path: string): string;
|
|
115
|
+
/**
|
|
116
|
+
* Get a temporary (signed) URL for a file.
|
|
117
|
+
* @param path File path
|
|
118
|
+
* @param expiration Expiration date
|
|
119
|
+
*/
|
|
120
|
+
temporaryUrl(path: string, expiration: Date): Promise<string>;
|
|
121
|
+
/**
|
|
122
|
+
* Get the file size in bytes.
|
|
123
|
+
* @param path File path
|
|
124
|
+
*/
|
|
125
|
+
size(path: string): Promise<number>;
|
|
126
|
+
/**
|
|
127
|
+
* Get the last modified date.
|
|
128
|
+
* @param path File path
|
|
129
|
+
*/
|
|
130
|
+
lastModified(path: string): Promise<Date>;
|
|
131
|
+
/**
|
|
132
|
+
* Get file metadata.
|
|
133
|
+
* @param path File path
|
|
134
|
+
*/
|
|
135
|
+
metadata(path: string): Promise<FileMetadata | null>;
|
|
136
|
+
/**
|
|
137
|
+
* List files in a directory.
|
|
138
|
+
* @param directory Directory path
|
|
139
|
+
*/
|
|
140
|
+
files(directory: string): Promise<string[]>;
|
|
141
|
+
/**
|
|
142
|
+
* List subdirectories in a directory.
|
|
143
|
+
* @param directory Directory path
|
|
144
|
+
*/
|
|
145
|
+
directories(directory: string): Promise<string[]>;
|
|
146
|
+
/**
|
|
147
|
+
* List all files recursively.
|
|
148
|
+
* @param directory Directory path
|
|
149
|
+
*/
|
|
150
|
+
allFiles(directory: string): Promise<string[]>;
|
|
151
|
+
/**
|
|
152
|
+
* Create a directory.
|
|
153
|
+
* @param path Directory path
|
|
154
|
+
*/
|
|
155
|
+
makeDirectory(path: string): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Delete a directory and its contents.
|
|
158
|
+
* @param path Directory path
|
|
159
|
+
*/
|
|
160
|
+
deleteDirectory(path: string): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Set file visibility.
|
|
163
|
+
* @param path File path
|
|
164
|
+
* @param visibility Visibility setting
|
|
165
|
+
*/
|
|
166
|
+
setVisibility(path: string, visibility: 'public' | 'private'): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Get file visibility.
|
|
169
|
+
* @param path File path
|
|
170
|
+
*/
|
|
171
|
+
getVisibility(path: string): Promise<'public' | 'private'>;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Storage driver factory function.
|
|
175
|
+
*/
|
|
176
|
+
type StorageDriverFactory = () => StorageDriver;
|
|
177
|
+
/**
|
|
178
|
+
* Local driver options.
|
|
179
|
+
*/
|
|
180
|
+
interface LocalDriverOptions {
|
|
181
|
+
/**
|
|
182
|
+
* Root directory for file storage.
|
|
183
|
+
*/
|
|
184
|
+
root: string;
|
|
185
|
+
/**
|
|
186
|
+
* Base URL for public files.
|
|
187
|
+
*/
|
|
188
|
+
url?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Default visibility for new files.
|
|
191
|
+
* @default 'private'
|
|
192
|
+
*/
|
|
193
|
+
visibility?: 'public' | 'private';
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* S3 driver options.
|
|
197
|
+
*/
|
|
198
|
+
interface S3DriverOptions {
|
|
199
|
+
/**
|
|
200
|
+
* S3 client instance (@aws-sdk/client-s3).
|
|
201
|
+
*/
|
|
202
|
+
client?: unknown;
|
|
203
|
+
/**
|
|
204
|
+
* S3 bucket name.
|
|
205
|
+
*/
|
|
206
|
+
bucket: string;
|
|
207
|
+
/**
|
|
208
|
+
* AWS region.
|
|
209
|
+
*/
|
|
210
|
+
region?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Custom endpoint URL.
|
|
213
|
+
*/
|
|
214
|
+
endpoint?: string;
|
|
215
|
+
/**
|
|
216
|
+
* Access key ID.
|
|
217
|
+
*/
|
|
218
|
+
accessKeyId?: string;
|
|
219
|
+
/**
|
|
220
|
+
* Secret access key.
|
|
221
|
+
*/
|
|
222
|
+
secretAccessKey?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Key prefix.
|
|
225
|
+
*/
|
|
226
|
+
prefix?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Base URL for public files.
|
|
229
|
+
*/
|
|
230
|
+
url?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Default visibility for new files.
|
|
233
|
+
* @default 'private'
|
|
234
|
+
*/
|
|
235
|
+
visibility?: 'public' | 'private';
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Memory driver options.
|
|
239
|
+
*/
|
|
240
|
+
interface MemoryDriverOptions {
|
|
241
|
+
/**
|
|
242
|
+
* Base URL for public files.
|
|
243
|
+
*/
|
|
244
|
+
url?: string;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Driver configuration union type.
|
|
248
|
+
*/
|
|
249
|
+
type DriverConfig = ({
|
|
250
|
+
driver: 'local';
|
|
251
|
+
} & LocalDriverOptions) | ({
|
|
252
|
+
driver: 's3';
|
|
253
|
+
} & S3DriverOptions) | ({
|
|
254
|
+
driver: 'memory';
|
|
255
|
+
} & MemoryDriverOptions);
|
|
256
|
+
type DiskConfig = DriverConfig;
|
|
257
|
+
/**
|
|
258
|
+
* Storage configuration.
|
|
259
|
+
*/
|
|
260
|
+
interface StorageConfig {
|
|
261
|
+
/**
|
|
262
|
+
* Default disk name.
|
|
263
|
+
* @default 'local'
|
|
264
|
+
*/
|
|
265
|
+
default?: string;
|
|
266
|
+
/**
|
|
267
|
+
* Disk configurations.
|
|
268
|
+
*/
|
|
269
|
+
disks?: Record<string, DriverConfig>;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Storage manager for handling multiple storage disks.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* const storage = new StorageManager({
|
|
278
|
+
* default: 'local',
|
|
279
|
+
* disks: {
|
|
280
|
+
* local: { driver: 'local', root: './storage/app' },
|
|
281
|
+
* s3: { driver: 's3', bucket: 'my-bucket', region: 'ap-northeast-1' },
|
|
282
|
+
* }
|
|
283
|
+
* })
|
|
284
|
+
*
|
|
285
|
+
* // Use the default disk
|
|
286
|
+
* await storage.disk().put('avatars/user-1.jpg', imageBuffer)
|
|
287
|
+
*
|
|
288
|
+
* // Use a specific disk
|
|
289
|
+
* await storage.disk('s3').put('avatars/user-1.jpg', imageBuffer)
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
declare class StorageManager {
|
|
293
|
+
private readonly defaultDiskName;
|
|
294
|
+
private readonly diskFactories;
|
|
295
|
+
private readonly resolvedDisks;
|
|
296
|
+
private driverFactories;
|
|
297
|
+
constructor(config?: StorageConfig);
|
|
298
|
+
/**
|
|
299
|
+
* Register built-in disk drivers.
|
|
300
|
+
*/
|
|
301
|
+
private registerBuiltinDrivers;
|
|
302
|
+
/**
|
|
303
|
+
* Register a disk from configuration.
|
|
304
|
+
*/
|
|
305
|
+
private registerDiskFromConfig;
|
|
306
|
+
/**
|
|
307
|
+
* Get a storage disk by name.
|
|
308
|
+
* Returns the default disk if no name is specified.
|
|
309
|
+
*/
|
|
310
|
+
disk(name?: string): StorageDriver;
|
|
311
|
+
/**
|
|
312
|
+
* Register a custom disk factory.
|
|
313
|
+
*/
|
|
314
|
+
registerDisk(name: string, factory: StorageDriverFactory): void;
|
|
315
|
+
/**
|
|
316
|
+
* Register a custom driver.
|
|
317
|
+
*/
|
|
318
|
+
registerDriver(name: string, factory: (options: unknown) => StorageDriver): void;
|
|
319
|
+
/**
|
|
320
|
+
* Check if a disk is registered.
|
|
321
|
+
*/
|
|
322
|
+
hasDisk(name: string): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Get the default disk name.
|
|
325
|
+
*/
|
|
326
|
+
getDefaultDiskName(): string;
|
|
327
|
+
/**
|
|
328
|
+
* Get all registered disk names.
|
|
329
|
+
*/
|
|
330
|
+
getDiskNames(): string[];
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Create a storage manager with configuration.
|
|
334
|
+
*/
|
|
335
|
+
declare function createStorageManager(config?: StorageConfig): StorageManager;
|
|
336
|
+
|
|
337
|
+
export { type DiskConfig as D, type FileMetadata as F, type LocalDriverOptions as L, type MemoryDriverOptions as M, type PutOptions as P, StorageManager as S, type StorageConfig as a, type StorageDriver as b, type StorageDriverFactory as c, createStorageManager as d, type S3DriverOptions as e, type DriverConfig as f };
|