alepha 0.11.3 → 0.11.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.
- package/api/files.d.ts +1 -1
- package/api/jobs.d.ts +140 -140
- package/api/users.d.ts +496 -496
- package/batch.d.ts +3 -0
- package/bucket.d.ts +4 -0
- package/command.d.ts +14 -0
- package/core.d.ts +274 -11
- package/datetime.d.ts +2 -1
- package/devtools.d.ts +261 -259
- package/fake.cjs +8 -0
- package/fake.d.ts +73 -0
- package/fake.js +1 -0
- package/file.d.ts +476 -1
- package/logger.d.ts +2 -1
- package/package.json +63 -49
- package/postgres.d.ts +34 -104
- package/react/i18n.d.ts +26 -1
- package/react.d.ts +373 -64
- package/security.d.ts +28 -28
- package/server/swagger.d.ts +3 -3
- package/server.d.ts +20 -20
- package/ui.cjs +8 -0
- package/ui.d.ts +683 -0
- package/ui.js +1 -0
- package/vite.d.ts +18 -29
package/fake.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as _alepha_core0 from "alepha";
|
|
2
|
+
import { StaticDecode, TSchema } from "alepha";
|
|
3
|
+
|
|
4
|
+
//#region src/providers/FakeProvider.d.ts
|
|
5
|
+
interface FakeOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Faker locale to use for generating fake data.
|
|
8
|
+
* @default "en"
|
|
9
|
+
*/
|
|
10
|
+
locale?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Seed for deterministic fake data generation.
|
|
13
|
+
*/
|
|
14
|
+
seed?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generate fake data from TypeBox schemas using faker.js.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const fake = new FakeProvider();
|
|
22
|
+
* const userSchema = t.object({
|
|
23
|
+
* id: t.uuid(),
|
|
24
|
+
* name: t.text(),
|
|
25
|
+
* email: t.email(),
|
|
26
|
+
* });
|
|
27
|
+
* const fakeUser = fake.generate(userSchema);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare class FakeProvider {
|
|
31
|
+
private readonly faker;
|
|
32
|
+
private readonly guard;
|
|
33
|
+
constructor(options?: FakeOptions);
|
|
34
|
+
/**
|
|
35
|
+
* Generate fake data matching the given TypeBox schema.
|
|
36
|
+
*/
|
|
37
|
+
generate<T extends TSchema>(schema: T): StaticDecode<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Generate multiple fake data items.
|
|
40
|
+
*/
|
|
41
|
+
generateMany<T extends TSchema>(schema: T, count: number): StaticDecode<T>[];
|
|
42
|
+
private generateValue;
|
|
43
|
+
private generateString;
|
|
44
|
+
private generateNumber;
|
|
45
|
+
private generateInteger;
|
|
46
|
+
private generateBigInt;
|
|
47
|
+
private generateBoolean;
|
|
48
|
+
private generateArray;
|
|
49
|
+
private generateObject;
|
|
50
|
+
/**
|
|
51
|
+
* Generate a value with context from the property key name.
|
|
52
|
+
* This helps generate more realistic fake data based on field names.
|
|
53
|
+
*/
|
|
54
|
+
private generateValueWithContext;
|
|
55
|
+
private generateRecord;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/index.d.ts
|
|
59
|
+
/**
|
|
60
|
+
* Provides fake data generation capabilities for Alepha applications using faker.js and TypeBox schemas.
|
|
61
|
+
*
|
|
62
|
+
* The fake module enables declarative fake data generation from TypeBox schemas, making it easy to create
|
|
63
|
+
* realistic test data, seed databases, or generate mock responses. It intelligently uses property key names
|
|
64
|
+
* to generate contextually appropriate data (e.g., "email" generates an email address, "firstName" generates
|
|
65
|
+
* a first name).
|
|
66
|
+
*
|
|
67
|
+
* @see {@link FakeProvider}
|
|
68
|
+
* @module alepha.fake
|
|
69
|
+
*/
|
|
70
|
+
declare const AlephaFake: _alepha_core0.Service<_alepha_core0.Module<{}>>;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { AlephaFake, FakeOptions, FakeProvider };
|
|
73
|
+
//# sourceMappingURL=index.d.ts.map
|
package/fake.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@alepha/fake'
|
package/file.d.ts
CHANGED
|
@@ -1,5 +1,275 @@
|
|
|
1
|
+
import * as _alepha_core0 from "alepha";
|
|
1
2
|
import { FileLike, StreamLike } from "alepha";
|
|
3
|
+
import { Readable } from "node:stream";
|
|
2
4
|
|
|
5
|
+
//#region src/helpers/detectFileType.d.ts
|
|
6
|
+
interface FileTypeResult {
|
|
7
|
+
/**
|
|
8
|
+
* The detected MIME type
|
|
9
|
+
*/
|
|
10
|
+
mimeType: string;
|
|
11
|
+
/**
|
|
12
|
+
* The detected file extension
|
|
13
|
+
*/
|
|
14
|
+
extension: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the file type was verified by magic bytes
|
|
17
|
+
*/
|
|
18
|
+
verified: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The stream (potentially wrapped to allow re-reading)
|
|
21
|
+
*/
|
|
22
|
+
stream: Readable;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Detects the file type by checking magic bytes against the stream content.
|
|
26
|
+
*
|
|
27
|
+
* @param stream - The readable stream to check
|
|
28
|
+
* @param filename - The filename (used to get the extension)
|
|
29
|
+
* @returns File type information including MIME type, extension, and verification status
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const stream = fs.createReadStream('image.png');
|
|
34
|
+
* const result = await detectFileType(stream, 'image.png');
|
|
35
|
+
* console.log(result.mimeType); // 'image/png'
|
|
36
|
+
* console.log(result.verified); // true if magic bytes match
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function detectFileType(stream: Readable, filename: string): Promise<FileTypeResult>;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/FileSystem.d.ts
|
|
42
|
+
/**
|
|
43
|
+
* Options for creating a file from a URL
|
|
44
|
+
*/
|
|
45
|
+
interface CreateFileFromUrlOptions {
|
|
46
|
+
/**
|
|
47
|
+
* The URL to load the file from (file://, http://, or https://)
|
|
48
|
+
*/
|
|
49
|
+
url: string;
|
|
50
|
+
/**
|
|
51
|
+
* The MIME type of the file (optional, will be detected from filename if not provided)
|
|
52
|
+
*/
|
|
53
|
+
type?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The name of the file (optional, will be extracted from URL if not provided)
|
|
56
|
+
*/
|
|
57
|
+
name?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Options for creating a file from a Buffer
|
|
61
|
+
*/
|
|
62
|
+
interface CreateFileFromBufferOptions {
|
|
63
|
+
/**
|
|
64
|
+
* The Buffer containing the file data
|
|
65
|
+
*/
|
|
66
|
+
buffer: Buffer;
|
|
67
|
+
/**
|
|
68
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
69
|
+
*/
|
|
70
|
+
type?: string;
|
|
71
|
+
/**
|
|
72
|
+
* The name of the file (required for proper content type detection)
|
|
73
|
+
*/
|
|
74
|
+
name?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Options for creating a file from a stream
|
|
78
|
+
*/
|
|
79
|
+
interface CreateFileFromStreamOptions {
|
|
80
|
+
/**
|
|
81
|
+
* The readable stream containing the file data
|
|
82
|
+
*/
|
|
83
|
+
stream: StreamLike;
|
|
84
|
+
/**
|
|
85
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
86
|
+
*/
|
|
87
|
+
type?: string;
|
|
88
|
+
/**
|
|
89
|
+
* The name of the file (required for proper content type detection)
|
|
90
|
+
*/
|
|
91
|
+
name?: string;
|
|
92
|
+
/**
|
|
93
|
+
* The size of the file in bytes (optional)
|
|
94
|
+
*/
|
|
95
|
+
size?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Options for creating a file from text content
|
|
99
|
+
*/
|
|
100
|
+
interface CreateFileFromTextOptions {
|
|
101
|
+
/**
|
|
102
|
+
* The text content to create the file from
|
|
103
|
+
*/
|
|
104
|
+
text: string;
|
|
105
|
+
/**
|
|
106
|
+
* The MIME type of the file (default: text/plain)
|
|
107
|
+
*/
|
|
108
|
+
type?: string;
|
|
109
|
+
/**
|
|
110
|
+
* The name of the file (default: "file.txt")
|
|
111
|
+
*/
|
|
112
|
+
name?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Options for creating a file from a Web File object
|
|
116
|
+
*/
|
|
117
|
+
interface CreateFileFromWebFileOptions {
|
|
118
|
+
/**
|
|
119
|
+
* The Web File object
|
|
120
|
+
*/
|
|
121
|
+
file: File;
|
|
122
|
+
/**
|
|
123
|
+
* Override the MIME type (optional, uses file.type if not provided)
|
|
124
|
+
*/
|
|
125
|
+
type?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Override the name (optional, uses file.name if not provided)
|
|
128
|
+
*/
|
|
129
|
+
name?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Override the size (optional, uses file.size if not provided)
|
|
132
|
+
*/
|
|
133
|
+
size?: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Options for creating a file from an ArrayBuffer
|
|
137
|
+
*/
|
|
138
|
+
interface CreateFileFromArrayBufferOptions {
|
|
139
|
+
/**
|
|
140
|
+
* The ArrayBuffer containing the file data
|
|
141
|
+
*/
|
|
142
|
+
arrayBuffer: ArrayBuffer;
|
|
143
|
+
/**
|
|
144
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
145
|
+
*/
|
|
146
|
+
type?: string;
|
|
147
|
+
/**
|
|
148
|
+
* The name of the file (required for proper content type detection)
|
|
149
|
+
*/
|
|
150
|
+
name?: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Union type for all createFile options
|
|
154
|
+
*/
|
|
155
|
+
type CreateFileOptions = CreateFileFromUrlOptions | CreateFileFromBufferOptions | CreateFileFromStreamOptions | CreateFileFromTextOptions | CreateFileFromWebFileOptions | CreateFileFromArrayBufferOptions;
|
|
156
|
+
/**
|
|
157
|
+
* Options for rm (remove) operation
|
|
158
|
+
*/
|
|
159
|
+
interface RmOptions {
|
|
160
|
+
/**
|
|
161
|
+
* If true, removes directories and their contents recursively
|
|
162
|
+
*/
|
|
163
|
+
recursive?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* If true, no error will be thrown if the path does not exist
|
|
166
|
+
*/
|
|
167
|
+
force?: boolean;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Options for cp (copy) operation
|
|
171
|
+
*/
|
|
172
|
+
interface CpOptions {
|
|
173
|
+
/**
|
|
174
|
+
* If true, copy directories recursively
|
|
175
|
+
*/
|
|
176
|
+
recursive?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* If true, overwrite existing destination
|
|
179
|
+
*/
|
|
180
|
+
force?: boolean;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Options for mkdir operation
|
|
184
|
+
*/
|
|
185
|
+
interface MkdirOptions {
|
|
186
|
+
/**
|
|
187
|
+
* If true, creates parent directories as needed
|
|
188
|
+
*/
|
|
189
|
+
recursive?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* File mode (permission and sticky bits)
|
|
192
|
+
*/
|
|
193
|
+
mode?: number;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Options for ls (list) operation
|
|
197
|
+
*/
|
|
198
|
+
interface LsOptions {
|
|
199
|
+
/**
|
|
200
|
+
* If true, list contents of directories recursively
|
|
201
|
+
*/
|
|
202
|
+
recursive?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* If true, include hidden files (starting with .)
|
|
205
|
+
*/
|
|
206
|
+
hidden?: boolean;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* FileSystem interface providing utilities for working with files.
|
|
210
|
+
*/
|
|
211
|
+
declare abstract class FileSystem {
|
|
212
|
+
/**
|
|
213
|
+
* Creates a FileLike object from various sources.
|
|
214
|
+
*
|
|
215
|
+
* @param options - Options for creating the file
|
|
216
|
+
* @returns A FileLike object
|
|
217
|
+
*/
|
|
218
|
+
abstract createFile(options: CreateFileOptions): FileLike;
|
|
219
|
+
/**
|
|
220
|
+
* Detects the file type by checking magic bytes in a stream.
|
|
221
|
+
*
|
|
222
|
+
* @param stream - The readable stream to check
|
|
223
|
+
* @param filename - The filename (used to get the extension)
|
|
224
|
+
* @returns File type information including MIME type, extension, and verification status
|
|
225
|
+
*/
|
|
226
|
+
abstract detectFileType(stream: Readable, filename: string): Promise<FileTypeResult>;
|
|
227
|
+
/**
|
|
228
|
+
* Gets the content type (MIME type) based on a filename.
|
|
229
|
+
*
|
|
230
|
+
* @param filename - The filename to check
|
|
231
|
+
* @returns The MIME type
|
|
232
|
+
*/
|
|
233
|
+
abstract getContentType(filename: string): string;
|
|
234
|
+
/**
|
|
235
|
+
* Removes a file or directory.
|
|
236
|
+
*
|
|
237
|
+
* @param path - The path to remove
|
|
238
|
+
* @param options - Remove options
|
|
239
|
+
*/
|
|
240
|
+
abstract rm(path: string, options?: RmOptions): Promise<void>;
|
|
241
|
+
/**
|
|
242
|
+
* Copies a file or directory.
|
|
243
|
+
*
|
|
244
|
+
* @param src - Source path
|
|
245
|
+
* @param dest - Destination path
|
|
246
|
+
* @param options - Copy options
|
|
247
|
+
*/
|
|
248
|
+
abstract cp(src: string, dest: string, options?: CpOptions): Promise<void>;
|
|
249
|
+
/**
|
|
250
|
+
* Moves/renames a file or directory.
|
|
251
|
+
*
|
|
252
|
+
* @param src - Source path
|
|
253
|
+
* @param dest - Destination path
|
|
254
|
+
*/
|
|
255
|
+
abstract mv(src: string, dest: string): Promise<void>;
|
|
256
|
+
/**
|
|
257
|
+
* Creates a directory.
|
|
258
|
+
*
|
|
259
|
+
* @param path - The directory path to create
|
|
260
|
+
* @param options - Mkdir options
|
|
261
|
+
*/
|
|
262
|
+
abstract mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Lists files in a directory.
|
|
265
|
+
*
|
|
266
|
+
* @param path - The directory path to list
|
|
267
|
+
* @param options - List options
|
|
268
|
+
* @returns Array of filenames
|
|
269
|
+
*/
|
|
270
|
+
abstract ls(path: string, options?: LsOptions): Promise<string[]>;
|
|
271
|
+
}
|
|
272
|
+
//#endregion
|
|
3
273
|
//#region src/helpers/createFile.d.ts
|
|
4
274
|
declare const createFile: (source: string | Buffer | ArrayBuffer | StreamLike | File, options?: {
|
|
5
275
|
type?: string;
|
|
@@ -49,5 +319,210 @@ declare const mimeMap: Record<string, string>;
|
|
|
49
319
|
*/
|
|
50
320
|
declare const getContentType: (filename: string) => string;
|
|
51
321
|
//#endregion
|
|
52
|
-
|
|
322
|
+
//#region src/NodeFileSystem.d.ts
|
|
323
|
+
/**
|
|
324
|
+
* Node.js implementation of FileSystem interface.
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* const fs = new NodeFileSystem();
|
|
329
|
+
*
|
|
330
|
+
* // Create from URL
|
|
331
|
+
* const file1 = fs.createFile({ url: "file:///path/to/file.png" });
|
|
332
|
+
*
|
|
333
|
+
* // Create from Buffer
|
|
334
|
+
* const file2 = fs.createFile({ buffer: Buffer.from("hello"), name: "hello.txt" });
|
|
335
|
+
*
|
|
336
|
+
* // Create from text
|
|
337
|
+
* const file3 = fs.createFile({ text: "Hello, world!", name: "greeting.txt" });
|
|
338
|
+
*
|
|
339
|
+
* // File operations
|
|
340
|
+
* await fs.mkdir("/tmp/mydir", { recursive: true });
|
|
341
|
+
* await fs.cp("/src/file.txt", "/dest/file.txt");
|
|
342
|
+
* await fs.mv("/old/path.txt", "/new/path.txt");
|
|
343
|
+
* const files = await fs.ls("/tmp");
|
|
344
|
+
* await fs.rm("/tmp/file.txt");
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
declare class NodeFileSystem implements FileSystem {
|
|
348
|
+
/**
|
|
349
|
+
* Creates a FileLike object from various sources.
|
|
350
|
+
*
|
|
351
|
+
* @param options - Options for creating the file
|
|
352
|
+
* @returns A FileLike object
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```typescript
|
|
356
|
+
* const fs = new NodeFileSystem();
|
|
357
|
+
*
|
|
358
|
+
* // From URL
|
|
359
|
+
* const file1 = fs.createFile({ url: "https://example.com/image.png" });
|
|
360
|
+
*
|
|
361
|
+
* // From Buffer
|
|
362
|
+
* const file2 = fs.createFile({
|
|
363
|
+
* buffer: Buffer.from("hello"),
|
|
364
|
+
* name: "hello.txt",
|
|
365
|
+
* type: "text/plain"
|
|
366
|
+
* });
|
|
367
|
+
*
|
|
368
|
+
* // From text
|
|
369
|
+
* const file3 = fs.createFile({ text: "Hello!", name: "greeting.txt" });
|
|
370
|
+
*
|
|
371
|
+
* // From stream with detection
|
|
372
|
+
* const stream = createReadStream("/path/to/file.png");
|
|
373
|
+
* const file4 = fs.createFile({ stream, name: "image.png" });
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
createFile(options: CreateFileOptions): FileLike;
|
|
377
|
+
/**
|
|
378
|
+
* Detects the file type by checking magic bytes in a stream.
|
|
379
|
+
*
|
|
380
|
+
* @param stream - The readable stream to check
|
|
381
|
+
* @param filename - The filename (used to get the extension)
|
|
382
|
+
* @returns File type information including MIME type, extension, and verification status
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```typescript
|
|
386
|
+
* const fs = new NodeFileSystem();
|
|
387
|
+
* const stream = createReadStream('image.png');
|
|
388
|
+
* const result = await fs.detectFileType(stream, 'image.png');
|
|
389
|
+
* console.log(result.mimeType); // 'image/png'
|
|
390
|
+
* console.log(result.verified); // true if magic bytes match
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
detectFileType(stream: Readable, filename: string): Promise<FileTypeResult>;
|
|
394
|
+
/**
|
|
395
|
+
* Gets the content type (MIME type) based on a filename.
|
|
396
|
+
*
|
|
397
|
+
* @param filename - The filename to check
|
|
398
|
+
* @returns The MIME type
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* ```typescript
|
|
402
|
+
* const fs = new NodeFileSystem();
|
|
403
|
+
* const mimeType = fs.getContentType("image.png"); // "image/png"
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
getContentType(filename: string): string;
|
|
407
|
+
/**
|
|
408
|
+
* Removes a file or directory.
|
|
409
|
+
*
|
|
410
|
+
* @param path - The path to remove
|
|
411
|
+
* @param options - Remove options
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* ```typescript
|
|
415
|
+
* const fs = new NodeFileSystem();
|
|
416
|
+
*
|
|
417
|
+
* // Remove a file
|
|
418
|
+
* await fs.rm("/tmp/file.txt");
|
|
419
|
+
*
|
|
420
|
+
* // Remove a directory recursively
|
|
421
|
+
* await fs.rm("/tmp/mydir", { recursive: true });
|
|
422
|
+
*
|
|
423
|
+
* // Remove with force (no error if doesn't exist)
|
|
424
|
+
* await fs.rm("/tmp/maybe-exists.txt", { force: true });
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
427
|
+
rm(path: string, options?: RmOptions): Promise<void>;
|
|
428
|
+
/**
|
|
429
|
+
* Copies a file or directory.
|
|
430
|
+
*
|
|
431
|
+
* @param src - Source path
|
|
432
|
+
* @param dest - Destination path
|
|
433
|
+
* @param options - Copy options
|
|
434
|
+
*
|
|
435
|
+
* @example
|
|
436
|
+
* ```typescript
|
|
437
|
+
* const fs = new NodeFileSystem();
|
|
438
|
+
*
|
|
439
|
+
* // Copy a file
|
|
440
|
+
* await fs.cp("/src/file.txt", "/dest/file.txt");
|
|
441
|
+
*
|
|
442
|
+
* // Copy a directory recursively
|
|
443
|
+
* await fs.cp("/src/dir", "/dest/dir", { recursive: true });
|
|
444
|
+
*
|
|
445
|
+
* // Copy with force (overwrite existing)
|
|
446
|
+
* await fs.cp("/src/file.txt", "/dest/file.txt", { force: true });
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
449
|
+
cp(src: string, dest: string, options?: CpOptions): Promise<void>;
|
|
450
|
+
/**
|
|
451
|
+
* Moves/renames a file or directory.
|
|
452
|
+
*
|
|
453
|
+
* @param src - Source path
|
|
454
|
+
* @param dest - Destination path
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```typescript
|
|
458
|
+
* const fs = new NodeFileSystem();
|
|
459
|
+
*
|
|
460
|
+
* // Move/rename a file
|
|
461
|
+
* await fs.mv("/old/path.txt", "/new/path.txt");
|
|
462
|
+
*
|
|
463
|
+
* // Move a directory
|
|
464
|
+
* await fs.mv("/old/dir", "/new/dir");
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
mv(src: string, dest: string): Promise<void>;
|
|
468
|
+
/**
|
|
469
|
+
* Creates a directory.
|
|
470
|
+
*
|
|
471
|
+
* @param path - The directory path to create
|
|
472
|
+
* @param options - Mkdir options
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```typescript
|
|
476
|
+
* const fs = new NodeFileSystem();
|
|
477
|
+
*
|
|
478
|
+
* // Create a directory
|
|
479
|
+
* await fs.mkdir("/tmp/mydir");
|
|
480
|
+
*
|
|
481
|
+
* // Create nested directories
|
|
482
|
+
* await fs.mkdir("/tmp/path/to/dir", { recursive: true });
|
|
483
|
+
*
|
|
484
|
+
* // Create with specific permissions
|
|
485
|
+
* await fs.mkdir("/tmp/mydir", { mode: 0o755 });
|
|
486
|
+
* ```
|
|
487
|
+
*/
|
|
488
|
+
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
489
|
+
/**
|
|
490
|
+
* Lists files in a directory.
|
|
491
|
+
*
|
|
492
|
+
* @param path - The directory path to list
|
|
493
|
+
* @param options - List options
|
|
494
|
+
* @returns Array of filenames
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```typescript
|
|
498
|
+
* const fs = new NodeFileSystem();
|
|
499
|
+
*
|
|
500
|
+
* // List files in a directory
|
|
501
|
+
* const files = await fs.ls("/tmp");
|
|
502
|
+
* console.log(files); // ["file1.txt", "file2.txt", "subdir"]
|
|
503
|
+
*
|
|
504
|
+
* // List with hidden files
|
|
505
|
+
* const allFiles = await fs.ls("/tmp", { hidden: true });
|
|
506
|
+
*
|
|
507
|
+
* // List recursively
|
|
508
|
+
* const allFilesRecursive = await fs.ls("/tmp", { recursive: true });
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
511
|
+
ls(path: string, options?: LsOptions): Promise<string[]>;
|
|
512
|
+
}
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region src/index.d.ts
|
|
515
|
+
/**
|
|
516
|
+
* Provides file system capabilities for Alepha applications with support for multiple file sources and operations.
|
|
517
|
+
*
|
|
518
|
+
* The file module enables working with files from various sources (URLs, buffers, streams) and provides
|
|
519
|
+
* utilities for file type detection, content type determination, and common file system operations.
|
|
520
|
+
*
|
|
521
|
+
* @see {@link FileSystem}
|
|
522
|
+
* @see {@link NodeFileSystem}
|
|
523
|
+
* @module alepha.file
|
|
524
|
+
*/
|
|
525
|
+
declare const AlephaFile: _alepha_core0.Service<_alepha_core0.Module<{}>>;
|
|
526
|
+
//#endregion
|
|
527
|
+
export { AlephaFile, CpOptions, CreateFileFromArrayBufferOptions, CreateFileFromBufferOptions, CreateFileFromStreamOptions, CreateFileFromTextOptions, CreateFileFromUrlOptions, CreateFileFromWebFileOptions, CreateFileOptions, FileSystem, FileTypeResult, LsOptions, MkdirOptions, NodeFileSystem, RmOptions, bufferToArrayBuffer, createFile, createFileFromBuffer, createFileFromStream, createFileFromUrl, createFileFromWebFile, detectFileType, getContentType, isReadableStream, mimeMap, streamToBuffer };
|
|
53
528
|
//# sourceMappingURL=index.d.ts.map
|
package/logger.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ declare class Logger implements LoggerInterface {
|
|
|
51
51
|
debug(message: string, data?: unknown): void;
|
|
52
52
|
trace(message: string, data?: unknown): void;
|
|
53
53
|
protected log(level: LogLevel, message: string, data?: unknown): void;
|
|
54
|
+
protected emit(entry: LogEntry, message?: string): void;
|
|
54
55
|
}
|
|
55
56
|
//#endregion
|
|
56
57
|
//#region src/descriptors/$logger.d.ts
|
|
@@ -273,7 +274,7 @@ declare module "alepha" {
|
|
|
273
274
|
}
|
|
274
275
|
interface Hooks {
|
|
275
276
|
log: {
|
|
276
|
-
message
|
|
277
|
+
message?: string;
|
|
277
278
|
entry: LogEntry;
|
|
278
279
|
};
|
|
279
280
|
}
|