alepha 0.15.0 → 0.15.1
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/README.md +43 -98
- package/dist/api/audits/index.d.ts +240 -240
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +2 -2
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.d.ts +185 -185
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +2 -2
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.d.ts +245 -245
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/notifications/index.browser.js +4 -4
- package/dist/api/notifications/index.browser.js.map +1 -1
- package/dist/api/notifications/index.d.ts +74 -74
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +4 -4
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/parameters/index.d.ts +221 -221
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/users/index.d.ts +1632 -1631
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +26 -34
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.d.ts +132 -132
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/batch/index.d.ts +122 -122
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/bucket/index.d.ts +163 -163
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/cache/core/index.d.ts +46 -46
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cache/redis/index.js +2 -2
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/cli/index.d.ts +5933 -201
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +609 -169
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +296 -296
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +19 -19
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +268 -79
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +768 -694
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +268 -79
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +268 -79
- package/dist/core/index.native.js.map +1 -1
- package/dist/datetime/index.d.ts +44 -44
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/email/index.d.ts +25 -25
- package/dist/email/index.d.ts.map +1 -1
- package/dist/fake/index.d.ts +5409 -5409
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +22 -22
- package/dist/fake/index.js.map +1 -1
- package/dist/file/index.d.ts +435 -435
- package/dist/file/index.d.ts.map +1 -1
- package/dist/lock/core/index.d.ts +208 -208
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/redis/index.d.ts.map +1 -1
- package/dist/logger/index.d.ts +24 -24
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +1 -5
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +216 -198
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +28 -4
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/index.browser.js +9 -9
- package/dist/orm/index.browser.js.map +1 -1
- package/dist/orm/index.bun.js +83 -76
- package/dist/orm/index.bun.js.map +1 -1
- package/dist/orm/index.d.ts +961 -960
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +88 -81
- package/dist/orm/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +244 -244
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/redis/index.d.ts +105 -105
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/retry/index.d.ts +69 -69
- package/dist/retry/index.d.ts.map +1 -1
- package/dist/router/index.d.ts +6 -6
- package/dist/router/index.d.ts.map +1 -1
- package/dist/scheduler/index.d.ts +108 -26
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +393 -1
- package/dist/scheduler/index.js.map +1 -1
- package/dist/security/index.d.ts +532 -209
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1422 -11
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +1296 -271
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +1249 -18
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cache/index.d.ts +56 -56
- package/dist/server/cache/index.d.ts.map +1 -1
- package/dist/server/compress/index.d.ts +3 -3
- package/dist/server/compress/index.d.ts.map +1 -1
- package/dist/server/cookies/index.d.ts +6 -6
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/core/index.d.ts +196 -186
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +43 -27
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +11 -11
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/helmet/index.d.ts +2 -2
- package/dist/server/helmet/index.d.ts.map +1 -1
- package/dist/server/links/index.browser.js +9 -1
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +83 -83
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +13 -5
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +514 -1
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js +4462 -4
- package/dist/server/metrics/index.js.map +1 -1
- package/dist/server/multipart/index.d.ts +6 -6
- package/dist/server/multipart/index.d.ts.map +1 -1
- package/dist/server/proxy/index.d.ts +102 -102
- package/dist/server/proxy/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.d.ts +16 -16
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/static/index.d.ts +44 -44
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/swagger/index.d.ts +47 -47
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/sms/index.d.ts +11 -11
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js +3 -3
- package/dist/sms/index.js.map +1 -1
- package/dist/thread/index.d.ts +71 -71
- package/dist/thread/index.d.ts.map +1 -1
- package/dist/thread/index.js +2 -2
- package/dist/thread/index.js.map +1 -1
- package/dist/topic/core/index.d.ts +318 -318
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/redis/index.d.ts +6 -6
- package/dist/topic/redis/index.d.ts.map +1 -1
- package/dist/vite/index.d.ts +2324 -1719
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +123 -475
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.browser.js +3 -3
- package/dist/websocket/index.browser.js.map +1 -1
- package/dist/websocket/index.d.ts +275 -275
- package/dist/websocket/index.d.ts.map +1 -1
- package/dist/websocket/index.js +3 -3
- package/dist/websocket/index.js.map +1 -1
- package/package.json +9 -9
- package/src/api/users/services/SessionService.ts +0 -10
- package/src/cli/apps/AlephaCli.ts +2 -2
- package/src/cli/apps/AlephaPackageBuilderCli.ts +9 -1
- package/src/cli/assets/apiHelloControllerTs.ts +2 -1
- package/src/cli/assets/biomeJson.ts +2 -1
- package/src/cli/assets/claudeMd.ts +9 -4
- package/src/cli/assets/dummySpecTs.ts +2 -1
- package/src/cli/assets/editorconfig.ts +2 -1
- package/src/cli/assets/mainBrowserTs.ts +2 -1
- package/src/cli/assets/mainCss.ts +24 -0
- package/src/cli/assets/tsconfigJson.ts +2 -1
- package/src/cli/assets/webAppRouterTs.ts +2 -1
- package/src/cli/assets/webHelloComponentTsx.ts +6 -2
- package/src/cli/atoms/appEntryOptions.ts +13 -0
- package/src/cli/atoms/buildOptions.ts +1 -1
- package/src/cli/atoms/changelogOptions.ts +1 -1
- package/src/cli/commands/build.ts +63 -47
- package/src/cli/commands/dev.ts +16 -33
- package/src/cli/commands/gen/env.ts +1 -1
- package/src/cli/commands/init.ts +17 -8
- package/src/cli/commands/lint.ts +1 -1
- package/src/cli/defineConfig.ts +9 -0
- package/src/cli/index.ts +2 -1
- package/src/cli/providers/AppEntryProvider.ts +131 -0
- package/src/cli/providers/ViteBuildProvider.ts +82 -0
- package/src/cli/providers/ViteDevServerProvider.ts +350 -0
- package/src/cli/providers/ViteTemplateProvider.ts +27 -0
- package/src/cli/services/AlephaCliUtils.ts +33 -2
- package/src/cli/services/PackageManagerUtils.ts +13 -6
- package/src/cli/services/ProjectScaffolder.ts +72 -49
- package/src/core/Alepha.ts +2 -8
- package/src/core/primitives/$module.ts +12 -0
- package/src/core/providers/KeylessJsonSchemaCodec.spec.ts +257 -0
- package/src/core/providers/KeylessJsonSchemaCodec.ts +396 -14
- package/src/core/providers/SchemaValidator.spec.ts +236 -0
- package/src/logger/providers/PrettyFormatterProvider.ts +0 -9
- package/src/mcp/errors/McpError.ts +30 -0
- package/src/mcp/index.ts +3 -0
- package/src/mcp/transports/SseMcpTransport.ts +16 -6
- package/src/orm/providers/DrizzleKitProvider.ts +3 -5
- package/src/orm/services/Repository.ts +11 -0
- package/src/server/core/index.ts +1 -1
- package/src/server/core/providers/BunHttpServerProvider.ts +1 -1
- package/src/server/core/providers/NodeHttpServerProvider.spec.ts +125 -0
- package/src/server/core/providers/NodeHttpServerProvider.ts +71 -22
- package/src/server/core/providers/ServerLoggerProvider.ts +2 -2
- package/src/server/core/providers/ServerProvider.ts +9 -12
- package/src/server/links/atoms/apiLinksAtom.ts +7 -0
- package/src/server/links/index.browser.ts +2 -0
- package/src/server/links/index.ts +2 -0
- package/src/vite/index.ts +3 -2
- package/src/vite/tasks/buildClient.ts +0 -1
- package/src/vite/tasks/buildServer.ts +68 -21
- package/src/vite/tasks/copyAssets.ts +5 -4
- package/src/vite/tasks/generateSitemap.ts +64 -23
- package/src/vite/tasks/index.ts +0 -2
- package/src/vite/tasks/prerenderPages.ts +49 -24
- package/src/cli/assets/indexHtml.ts +0 -15
- package/src/cli/commands/format.ts +0 -23
- package/src/vite/helpers/boot.ts +0 -117
- package/src/vite/plugins/viteAlephaDev.ts +0 -177
- package/src/vite/tasks/devServer.ts +0 -71
- package/src/vite/tasks/runAlepha.ts +0 -270
- /package/dist/orm/{chunk-DtkW-qnP.js → chunk-DH6iiROE.js} +0 -0
package/dist/file/index.d.ts
CHANGED
|
@@ -13,16 +13,16 @@ declare class FileError extends Error {
|
|
|
13
13
|
*/
|
|
14
14
|
interface CreateFileFromUrlOptions {
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
* The URL to load the file from (file://, http://, or https://)
|
|
17
|
+
*/
|
|
18
18
|
url: string;
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
* The MIME type of the file (optional, will be detected from filename if not provided)
|
|
21
|
+
*/
|
|
22
22
|
type?: string;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
* The name of the file (optional, will be extracted from URL if not provided)
|
|
25
|
+
*/
|
|
26
26
|
name?: string;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -30,16 +30,16 @@ interface CreateFileFromUrlOptions {
|
|
|
30
30
|
*/
|
|
31
31
|
interface CreateFileFromPathOptions {
|
|
32
32
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
* The path to the file on the local filesystem
|
|
34
|
+
*/
|
|
35
35
|
path: string;
|
|
36
36
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
* The MIME type of the file (optional, will be detected from filename if not provided)
|
|
38
|
+
*/
|
|
39
39
|
type?: string;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
* The name of the file (optional, will be extracted from URL if not provided)
|
|
42
|
+
*/
|
|
43
43
|
name?: string;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
@@ -47,16 +47,16 @@ interface CreateFileFromPathOptions {
|
|
|
47
47
|
*/
|
|
48
48
|
interface CreateFileFromBufferOptions {
|
|
49
49
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
* The Buffer containing the file data
|
|
51
|
+
*/
|
|
52
52
|
buffer: Buffer;
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
55
|
+
*/
|
|
56
56
|
type?: string;
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
* The name of the file (required for proper content type detection)
|
|
59
|
+
*/
|
|
60
60
|
name?: string;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
@@ -64,20 +64,20 @@ interface CreateFileFromBufferOptions {
|
|
|
64
64
|
*/
|
|
65
65
|
interface CreateFileFromStreamOptions {
|
|
66
66
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
* The readable stream containing the file data
|
|
68
|
+
*/
|
|
69
69
|
stream: StreamLike;
|
|
70
70
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
72
|
+
*/
|
|
73
73
|
type?: string;
|
|
74
74
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
* The name of the file (required for proper content type detection)
|
|
76
|
+
*/
|
|
77
77
|
name?: string;
|
|
78
78
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
* The size of the file in bytes (optional)
|
|
80
|
+
*/
|
|
81
81
|
size?: number;
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
@@ -85,30 +85,30 @@ interface CreateFileFromStreamOptions {
|
|
|
85
85
|
*/
|
|
86
86
|
interface CreateFileFromTextOptions {
|
|
87
87
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
* The text content to create the file from
|
|
89
|
+
*/
|
|
90
90
|
text: string;
|
|
91
91
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
* The MIME type of the file (default: text/plain)
|
|
93
|
+
*/
|
|
94
94
|
type?: string;
|
|
95
95
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
* The name of the file (default: "file.txt")
|
|
97
|
+
*/
|
|
98
98
|
name?: string;
|
|
99
99
|
}
|
|
100
100
|
interface CreateFileFromResponseOptions {
|
|
101
101
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
* The Response object containing the file data
|
|
103
|
+
*/
|
|
104
104
|
response: Response;
|
|
105
105
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
* Override the name (optional, uses filename from Content-Disposition header if not provided)
|
|
107
|
+
*/
|
|
108
108
|
name?: string;
|
|
109
109
|
/**
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
* Override the MIME type (optional, uses file.type if not provided)
|
|
111
|
+
*/
|
|
112
112
|
type?: string;
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
@@ -116,20 +116,20 @@ interface CreateFileFromResponseOptions {
|
|
|
116
116
|
*/
|
|
117
117
|
interface CreateFileFromWebFileOptions {
|
|
118
118
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
* The Web File object
|
|
120
|
+
*/
|
|
121
121
|
file: File;
|
|
122
122
|
/**
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
* Override the MIME type (optional, uses file.type if not provided)
|
|
124
|
+
*/
|
|
125
125
|
type?: string;
|
|
126
126
|
/**
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
* Override the name (optional, uses file.name if not provided)
|
|
128
|
+
*/
|
|
129
129
|
name?: string;
|
|
130
130
|
/**
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
* Override the size (optional, uses file.size if not provided)
|
|
132
|
+
*/
|
|
133
133
|
size?: number;
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
@@ -137,16 +137,16 @@ interface CreateFileFromWebFileOptions {
|
|
|
137
137
|
*/
|
|
138
138
|
interface CreateFileFromArrayBufferOptions {
|
|
139
139
|
/**
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
* The ArrayBuffer containing the file data
|
|
141
|
+
*/
|
|
142
142
|
arrayBuffer: ArrayBuffer;
|
|
143
143
|
/**
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
145
|
+
*/
|
|
146
146
|
type?: string;
|
|
147
147
|
/**
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
* The name of the file (required for proper content type detection)
|
|
149
|
+
*/
|
|
150
150
|
name?: string;
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
@@ -158,12 +158,12 @@ type CreateFileOptions = CreateFileFromUrlOptions | CreateFileFromPathOptions |
|
|
|
158
158
|
*/
|
|
159
159
|
interface RmOptions {
|
|
160
160
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
* If true, removes directories and their contents recursively
|
|
162
|
+
*/
|
|
163
163
|
recursive?: boolean;
|
|
164
164
|
/**
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
* If true, no error will be thrown if the path does not exist
|
|
166
|
+
*/
|
|
167
167
|
force?: boolean;
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
@@ -171,12 +171,12 @@ interface RmOptions {
|
|
|
171
171
|
*/
|
|
172
172
|
interface CpOptions {
|
|
173
173
|
/**
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
* If true, copy directories recursively
|
|
175
|
+
*/
|
|
176
176
|
recursive?: boolean;
|
|
177
177
|
/**
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
* If true, overwrite existing destination
|
|
179
|
+
*/
|
|
180
180
|
force?: boolean;
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
@@ -184,12 +184,12 @@ interface CpOptions {
|
|
|
184
184
|
*/
|
|
185
185
|
interface MkdirOptions {
|
|
186
186
|
/**
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
* If true, creates parent directories as needed
|
|
188
|
+
*/
|
|
189
189
|
recursive?: boolean;
|
|
190
190
|
/**
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
* File mode (permission and sticky bits)
|
|
192
|
+
*/
|
|
193
193
|
mode?: number;
|
|
194
194
|
}
|
|
195
195
|
/**
|
|
@@ -197,12 +197,12 @@ interface MkdirOptions {
|
|
|
197
197
|
*/
|
|
198
198
|
interface LsOptions {
|
|
199
199
|
/**
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
* If true, list contents of directories recursively
|
|
201
|
+
*/
|
|
202
202
|
recursive?: boolean;
|
|
203
203
|
/**
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
* If true, include hidden files (starting with .)
|
|
205
|
+
*/
|
|
206
206
|
hidden?: boolean;
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
@@ -210,92 +210,92 @@ interface LsOptions {
|
|
|
210
210
|
*/
|
|
211
211
|
declare abstract class FileSystemProvider {
|
|
212
212
|
/**
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
* Joins multiple path segments into a single path.
|
|
214
|
+
*
|
|
215
|
+
* @param paths - The path segments to join
|
|
216
|
+
* @returns The joined path
|
|
217
|
+
*/
|
|
218
218
|
abstract join(...paths: string[]): string;
|
|
219
219
|
/**
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
* Creates a FileLike object from various sources.
|
|
221
|
+
*
|
|
222
|
+
* @param options - Options for creating the file
|
|
223
|
+
* @returns A FileLike object
|
|
224
|
+
*/
|
|
225
225
|
abstract createFile(options: CreateFileOptions): FileLike;
|
|
226
226
|
/**
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
227
|
+
* Removes a file or directory.
|
|
228
|
+
*
|
|
229
|
+
* @param path - The path to remove
|
|
230
|
+
* @param options - Remove options
|
|
231
|
+
*/
|
|
232
232
|
abstract rm(path: string, options?: RmOptions): Promise<void>;
|
|
233
233
|
/**
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
234
|
+
* Copies a file or directory.
|
|
235
|
+
*
|
|
236
|
+
* @param src - Source path
|
|
237
|
+
* @param dest - Destination path
|
|
238
|
+
* @param options - Copy options
|
|
239
|
+
*/
|
|
240
240
|
abstract cp(src: string, dest: string, options?: CpOptions): Promise<void>;
|
|
241
241
|
/**
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
242
|
+
* Moves/renames a file or directory.
|
|
243
|
+
*
|
|
244
|
+
* @param src - Source path
|
|
245
|
+
* @param dest - Destination path
|
|
246
|
+
*/
|
|
247
247
|
abstract mv(src: string, dest: string): Promise<void>;
|
|
248
248
|
/**
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
* Creates a directory.
|
|
250
|
+
*
|
|
251
|
+
* @param path - The directory path to create
|
|
252
|
+
* @param options - Mkdir options
|
|
253
|
+
*/
|
|
254
254
|
abstract mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
255
255
|
/**
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
256
|
+
* Lists files in a directory.
|
|
257
|
+
*
|
|
258
|
+
* @param path - The directory path to list
|
|
259
|
+
* @param options - List options
|
|
260
|
+
* @returns Array of filenames
|
|
261
|
+
*/
|
|
262
262
|
abstract ls(path: string, options?: LsOptions): Promise<string[]>;
|
|
263
263
|
/**
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
264
|
+
* Checks if a file or directory exists.
|
|
265
|
+
*
|
|
266
|
+
* @param path - The path to check
|
|
267
|
+
* @returns True if the path exists, false otherwise
|
|
268
|
+
*/
|
|
269
269
|
abstract exists(path: string): Promise<boolean>;
|
|
270
270
|
/**
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
271
|
+
* Reads the content of a file.
|
|
272
|
+
*
|
|
273
|
+
* @param path - The file path to read
|
|
274
|
+
* @returns The file content as a Buffer
|
|
275
|
+
*/
|
|
276
276
|
abstract readFile(path: string): Promise<Buffer>;
|
|
277
277
|
/**
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
278
|
+
* Writes data to a file.
|
|
279
|
+
*
|
|
280
|
+
* @param path - The file path to write to
|
|
281
|
+
* @param data - The data to write (Buffer or string)
|
|
282
|
+
*/
|
|
283
283
|
abstract writeFile(path: string, data: Uint8Array | Buffer | string | FileLike): Promise<void>;
|
|
284
284
|
}
|
|
285
285
|
//#endregion
|
|
286
286
|
//#region ../../src/file/providers/MemoryFileSystemProvider.d.ts
|
|
287
287
|
interface MemoryFileSystemProviderOptions {
|
|
288
288
|
/**
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
* Error to throw on mkdir operations (for testing error handling)
|
|
290
|
+
*/
|
|
291
291
|
mkdirError?: Error | null;
|
|
292
292
|
/**
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
* Error to throw on writeFile operations (for testing error handling)
|
|
294
|
+
*/
|
|
295
295
|
writeFileError?: Error | null;
|
|
296
296
|
/**
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
* Error to throw on readFile operations (for testing error handling)
|
|
298
|
+
*/
|
|
299
299
|
readFileError?: Error | null;
|
|
300
300
|
}
|
|
301
301
|
/**
|
|
@@ -323,111 +323,111 @@ interface MemoryFileSystemProviderOptions {
|
|
|
323
323
|
*/
|
|
324
324
|
declare class MemoryFileSystemProvider implements FileSystemProvider {
|
|
325
325
|
/**
|
|
326
|
-
|
|
327
|
-
|
|
326
|
+
* In-memory storage for files (path -> content)
|
|
327
|
+
*/
|
|
328
328
|
files: Map<string, Buffer<ArrayBufferLike>>;
|
|
329
329
|
/**
|
|
330
|
-
|
|
331
|
-
|
|
330
|
+
* In-memory storage for directories
|
|
331
|
+
*/
|
|
332
332
|
directories: Set<string>;
|
|
333
333
|
/**
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
* Track mkdir calls for test assertions
|
|
335
|
+
*/
|
|
336
336
|
mkdirCalls: Array<{
|
|
337
337
|
path: string;
|
|
338
338
|
options?: MkdirOptions;
|
|
339
339
|
}>;
|
|
340
340
|
/**
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
* Track writeFile calls for test assertions
|
|
342
|
+
*/
|
|
343
343
|
writeFileCalls: Array<{
|
|
344
344
|
path: string;
|
|
345
345
|
data: string;
|
|
346
346
|
}>;
|
|
347
347
|
/**
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
* Track join calls for test assertions
|
|
349
|
+
*/
|
|
350
350
|
joinCalls: Array<string[]>;
|
|
351
351
|
/**
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
* Error to throw on mkdir (for testing error handling)
|
|
353
|
+
*/
|
|
354
354
|
mkdirError: Error | null;
|
|
355
355
|
/**
|
|
356
|
-
|
|
357
|
-
|
|
356
|
+
* Error to throw on writeFile (for testing error handling)
|
|
357
|
+
*/
|
|
358
358
|
writeFileError: Error | null;
|
|
359
359
|
/**
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
* Error to throw on readFile (for testing error handling)
|
|
361
|
+
*/
|
|
362
362
|
readFileError: Error | null;
|
|
363
363
|
constructor(options?: MemoryFileSystemProviderOptions);
|
|
364
364
|
/**
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
* Join path segments using forward slashes.
|
|
366
|
+
*/
|
|
367
367
|
join(...paths: string[]): string;
|
|
368
368
|
/**
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
* Create a FileLike object from various sources.
|
|
370
|
+
*/
|
|
371
371
|
createFile(options: CreateFileOptions): FileLike;
|
|
372
372
|
/**
|
|
373
|
-
|
|
374
|
-
|
|
373
|
+
* Remove a file or directory from memory.
|
|
374
|
+
*/
|
|
375
375
|
rm(path: string, options?: RmOptions): Promise<void>;
|
|
376
376
|
/**
|
|
377
|
-
|
|
378
|
-
|
|
377
|
+
* Copy a file or directory in memory.
|
|
378
|
+
*/
|
|
379
379
|
cp(src: string, dest: string, options?: CpOptions): Promise<void>;
|
|
380
380
|
/**
|
|
381
|
-
|
|
382
|
-
|
|
381
|
+
* Move/rename a file or directory in memory.
|
|
382
|
+
*/
|
|
383
383
|
mv(src: string, dest: string): Promise<void>;
|
|
384
384
|
/**
|
|
385
|
-
|
|
386
|
-
|
|
385
|
+
* Create a directory in memory.
|
|
386
|
+
*/
|
|
387
387
|
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
388
388
|
/**
|
|
389
|
-
|
|
390
|
-
|
|
389
|
+
* List files in a directory.
|
|
390
|
+
*/
|
|
391
391
|
ls(path: string, options?: LsOptions): Promise<string[]>;
|
|
392
392
|
/**
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
* Check if a file or directory exists in memory.
|
|
394
|
+
*/
|
|
395
395
|
exists(path: string): Promise<boolean>;
|
|
396
396
|
/**
|
|
397
|
-
|
|
398
|
-
|
|
397
|
+
* Read a file from memory.
|
|
398
|
+
*/
|
|
399
399
|
readFile(path: string): Promise<Buffer>;
|
|
400
400
|
/**
|
|
401
|
-
|
|
402
|
-
|
|
401
|
+
* Write a file to memory.
|
|
402
|
+
*/
|
|
403
403
|
writeFile(path: string, data: Uint8Array | Buffer | string | FileLike): Promise<void>;
|
|
404
404
|
/**
|
|
405
|
-
|
|
406
|
-
|
|
405
|
+
* Reset all in-memory state (useful between tests).
|
|
406
|
+
*/
|
|
407
407
|
reset(): void;
|
|
408
408
|
/**
|
|
409
|
-
|
|
410
|
-
|
|
409
|
+
* Get the content of a file as a string (convenience method for testing).
|
|
410
|
+
*/
|
|
411
411
|
getFileContent(path: string): string | undefined;
|
|
412
412
|
}
|
|
413
413
|
//#endregion
|
|
414
414
|
//#region ../../src/file/services/FileDetector.d.ts
|
|
415
415
|
interface FileTypeResult {
|
|
416
416
|
/**
|
|
417
|
-
|
|
418
|
-
|
|
417
|
+
* The detected MIME type
|
|
418
|
+
*/
|
|
419
419
|
mimeType: string;
|
|
420
420
|
/**
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
* The detected file extension
|
|
422
|
+
*/
|
|
423
423
|
extension: string;
|
|
424
424
|
/**
|
|
425
|
-
|
|
426
|
-
|
|
425
|
+
* Whether the file type was verified by magic bytes
|
|
426
|
+
*/
|
|
427
427
|
verified: boolean;
|
|
428
428
|
/**
|
|
429
|
-
|
|
430
|
-
|
|
429
|
+
* The stream (potentially wrapped to allow re-reading)
|
|
430
|
+
*/
|
|
431
431
|
stream: Readable;
|
|
432
432
|
}
|
|
433
433
|
/**
|
|
@@ -449,92 +449,92 @@ interface FileTypeResult {
|
|
|
449
449
|
*/
|
|
450
450
|
declare class FileDetector {
|
|
451
451
|
/**
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
452
|
+
* Magic byte signatures for common file formats.
|
|
453
|
+
* Each signature is represented as an array of bytes or null (wildcard).
|
|
454
|
+
*/
|
|
455
455
|
protected static readonly MAGIC_BYTES: Record<string, {
|
|
456
456
|
signature: (number | null)[];
|
|
457
457
|
mimeType: string;
|
|
458
458
|
}[]>;
|
|
459
459
|
/**
|
|
460
|
-
|
|
461
|
-
|
|
460
|
+
* All possible format signatures for checking against actual file content
|
|
461
|
+
*/
|
|
462
462
|
protected static readonly ALL_SIGNATURES: {
|
|
463
463
|
signature: (number | null)[];
|
|
464
464
|
mimeType: string;
|
|
465
465
|
ext: string;
|
|
466
466
|
}[];
|
|
467
467
|
/**
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
468
|
+
* MIME type map for file extensions.
|
|
469
|
+
*
|
|
470
|
+
* Can be used to get the content type of file based on its extension.
|
|
471
|
+
* Feel free to add more mime types in your project!
|
|
472
|
+
*/
|
|
473
473
|
static readonly mimeMap: Record<string, string>;
|
|
474
474
|
/**
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
475
|
+
* Reverse MIME type map for looking up extensions from MIME types.
|
|
476
|
+
* Prefers shorter, more common extensions when multiple exist.
|
|
477
|
+
*/
|
|
478
478
|
protected static readonly reverseMimeMap: Record<string, string>;
|
|
479
479
|
/**
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
480
|
+
* Returns the file extension for a given MIME type.
|
|
481
|
+
*
|
|
482
|
+
* @param mimeType - The MIME type to look up
|
|
483
|
+
* @returns The file extension (without dot), or "bin" if not found
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* ```typescript
|
|
487
|
+
* const detector = alepha.inject(FileDetector);
|
|
488
|
+
* const ext = detector.getExtensionFromMimeType("image/png"); // "png"
|
|
489
|
+
* const ext2 = detector.getExtensionFromMimeType("application/octet-stream"); // "bin"
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
492
|
getExtensionFromMimeType(mimeType: string): string;
|
|
493
493
|
/**
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
494
|
+
* Returns the content type of file based on its filename.
|
|
495
|
+
*
|
|
496
|
+
* @param filename - The filename to check
|
|
497
|
+
* @returns The MIME type
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* ```typescript
|
|
501
|
+
* const detector = alepha.inject(FileDetector);
|
|
502
|
+
* const mimeType = detector.getContentType("image.png"); // "image/png"
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
505
|
getContentType(filename: string): string;
|
|
506
506
|
/**
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
507
|
+
* Detects the file type by checking magic bytes against the stream content.
|
|
508
|
+
*
|
|
509
|
+
* @param stream - The readable stream to check
|
|
510
|
+
* @param filename - The filename (used to get the extension)
|
|
511
|
+
* @returns File type information including MIME type, extension, and verification status
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* ```typescript
|
|
515
|
+
* const detector = alepha.inject(FileDetector);
|
|
516
|
+
* const stream = createReadStream('image.png');
|
|
517
|
+
* const result = await detector.detectFileType(stream, 'image.png');
|
|
518
|
+
* console.log(result.mimeType); // 'image/png'
|
|
519
|
+
* console.log(result.verified); // true if magic bytes match
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
522
|
detectFileType(stream: Readable, filename: string): Promise<FileTypeResult>;
|
|
523
523
|
/**
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
524
|
+
* Reads all bytes from a stream and returns the first N bytes along with a new stream containing all data.
|
|
525
|
+
* This approach reads the entire stream upfront to avoid complex async handling issues.
|
|
526
|
+
*
|
|
527
|
+
* @protected
|
|
528
|
+
*/
|
|
529
529
|
protected peekBytes(stream: Readable, numBytes: number): Promise<{
|
|
530
530
|
buffer: Buffer;
|
|
531
531
|
stream: Readable;
|
|
532
532
|
}>;
|
|
533
533
|
/**
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
534
|
+
* Checks if a buffer matches a magic byte signature.
|
|
535
|
+
*
|
|
536
|
+
* @protected
|
|
537
|
+
*/
|
|
538
538
|
protected matchesSignature(buffer: Buffer, signature: (number | null)[]): boolean;
|
|
539
539
|
}
|
|
540
540
|
//#endregion
|
|
@@ -567,212 +567,212 @@ declare class NodeFileSystemProvider implements FileSystemProvider {
|
|
|
567
567
|
protected detector: FileDetector;
|
|
568
568
|
join(...paths: string[]): string;
|
|
569
569
|
/**
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
570
|
+
* Creates a FileLike object from various sources.
|
|
571
|
+
*
|
|
572
|
+
* @param options - Options for creating the file
|
|
573
|
+
* @returns A FileLike object
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* ```typescript
|
|
577
|
+
* const fs = alepha.inject(NodeFileSystemProvider);
|
|
578
|
+
*
|
|
579
|
+
* // From URL
|
|
580
|
+
* const file1 = fs.createFile({ url: "https://example.com/image.png" });
|
|
581
|
+
*
|
|
582
|
+
* // From Buffer
|
|
583
|
+
* const file2 = fs.createFile({
|
|
584
|
+
* buffer: Buffer.from("hello"),
|
|
585
|
+
* name: "hello.txt",
|
|
586
|
+
* type: "text/plain"
|
|
587
|
+
* });
|
|
588
|
+
*
|
|
589
|
+
* // From text
|
|
590
|
+
* const file3 = fs.createFile({ text: "Hello!", name: "greeting.txt" });
|
|
591
|
+
*
|
|
592
|
+
* // From stream with detection
|
|
593
|
+
* const stream = createReadStream("/path/to/file.png");
|
|
594
|
+
* const file4 = fs.createFile({ stream, name: "image.png" });
|
|
595
|
+
* ```
|
|
596
|
+
*/
|
|
597
597
|
createFile(options: CreateFileOptions): FileLike;
|
|
598
598
|
/**
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
599
|
+
* Removes a file or directory.
|
|
600
|
+
*
|
|
601
|
+
* @param path - The path to remove
|
|
602
|
+
* @param options - Remove options
|
|
603
|
+
*
|
|
604
|
+
* @example
|
|
605
|
+
* ```typescript
|
|
606
|
+
* const fs = alepha.inject(NodeFileSystemProvider);
|
|
607
|
+
*
|
|
608
|
+
* // Remove a file
|
|
609
|
+
* await fs.rm("/tmp/file.txt");
|
|
610
|
+
*
|
|
611
|
+
* // Remove a directory recursively
|
|
612
|
+
* await fs.rm("/tmp/mydir", { recursive: true });
|
|
613
|
+
*
|
|
614
|
+
* // Remove with force (no error if doesn't exist)
|
|
615
|
+
* await fs.rm("/tmp/maybe-exists.txt", { force: true });
|
|
616
|
+
* ```
|
|
617
|
+
*/
|
|
618
618
|
rm(path: string, options?: RmOptions): Promise<void>;
|
|
619
619
|
/**
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
620
|
+
* Copies a file or directory.
|
|
621
|
+
*
|
|
622
|
+
* @param src - Source path
|
|
623
|
+
* @param dest - Destination path
|
|
624
|
+
* @param options - Copy options
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
* ```typescript
|
|
628
|
+
* const fs = alepha.inject(NodeFileSystemProvider);
|
|
629
|
+
*
|
|
630
|
+
* // Copy a file
|
|
631
|
+
* await fs.cp("/src/file.txt", "/dest/file.txt");
|
|
632
|
+
*
|
|
633
|
+
* // Copy a directory recursively
|
|
634
|
+
* await fs.cp("/src/dir", "/dest/dir", { recursive: true });
|
|
635
|
+
*
|
|
636
|
+
* // Copy with force (overwrite existing)
|
|
637
|
+
* await fs.cp("/src/file.txt", "/dest/file.txt", { force: true });
|
|
638
|
+
* ```
|
|
639
|
+
*/
|
|
640
640
|
cp(src: string, dest: string, options?: CpOptions): Promise<void>;
|
|
641
641
|
/**
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
642
|
+
* Moves/renames a file or directory.
|
|
643
|
+
*
|
|
644
|
+
* @param src - Source path
|
|
645
|
+
* @param dest - Destination path
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* ```typescript
|
|
649
|
+
* const fs = alepha.inject(NodeFileSystemProvider);
|
|
650
|
+
*
|
|
651
|
+
* // Move/rename a file
|
|
652
|
+
* await fs.mv("/old/path.txt", "/new/path.txt");
|
|
653
|
+
*
|
|
654
|
+
* // Move a directory
|
|
655
|
+
* await fs.mv("/old/dir", "/new/dir");
|
|
656
|
+
* ```
|
|
657
|
+
*/
|
|
658
658
|
mv(src: string, dest: string): Promise<void>;
|
|
659
659
|
/**
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
660
|
+
* Creates a directory.
|
|
661
|
+
*
|
|
662
|
+
* @param path - The directory path to create
|
|
663
|
+
* @param options - Mkdir options
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
* ```typescript
|
|
667
|
+
* const fs = alepha.inject(NodeFileSystemProvider);
|
|
668
|
+
*
|
|
669
|
+
* // Create a directory
|
|
670
|
+
* await fs.mkdir("/tmp/mydir");
|
|
671
|
+
*
|
|
672
|
+
* // Create nested directories
|
|
673
|
+
* await fs.mkdir("/tmp/path/to/dir", { recursive: true });
|
|
674
|
+
*
|
|
675
|
+
* // Create with specific permissions
|
|
676
|
+
* await fs.mkdir("/tmp/mydir", { mode: 0o755 });
|
|
677
|
+
* ```
|
|
678
|
+
*/
|
|
679
679
|
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
680
680
|
/**
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
681
|
+
* Lists files in a directory.
|
|
682
|
+
*
|
|
683
|
+
* @param path - The directory path to list
|
|
684
|
+
* @param options - List options
|
|
685
|
+
* @returns Array of filenames
|
|
686
|
+
*
|
|
687
|
+
* @example
|
|
688
|
+
* ```typescript
|
|
689
|
+
* const fs = alepha.inject(NodeFileSystemProvider);
|
|
690
|
+
*
|
|
691
|
+
* // List files in a directory
|
|
692
|
+
* const files = await fs.ls("/tmp");
|
|
693
|
+
* console.log(files); // ["file1.txt", "file2.txt", "subdir"]
|
|
694
|
+
*
|
|
695
|
+
* // List with hidden files
|
|
696
|
+
* const allFiles = await fs.ls("/tmp", { hidden: true });
|
|
697
|
+
*
|
|
698
|
+
* // List recursively
|
|
699
|
+
* const allFilesRecursive = await fs.ls("/tmp", { recursive: true });
|
|
700
|
+
* ```
|
|
701
|
+
*/
|
|
702
702
|
ls(path: string, options?: LsOptions): Promise<string[]>;
|
|
703
703
|
/**
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
704
|
+
* Checks if a file or directory exists.
|
|
705
|
+
*
|
|
706
|
+
* @param path - The path to check
|
|
707
|
+
* @returns True if the path exists, false otherwise
|
|
708
|
+
*
|
|
709
|
+
* @example
|
|
710
|
+
* ```typescript
|
|
711
|
+
* const fs = alepha.inject(NodeFileSystemProvider);
|
|
712
|
+
*
|
|
713
|
+
* if (await fs.exists("/tmp/file.txt")) {
|
|
714
|
+
* console.log("File exists");
|
|
715
|
+
* }
|
|
716
|
+
* ```
|
|
717
|
+
*/
|
|
718
718
|
exists(path: string): Promise<boolean>;
|
|
719
719
|
/**
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
720
|
+
* Reads the content of a file.
|
|
721
|
+
*
|
|
722
|
+
* @param path - The file path to read
|
|
723
|
+
* @returns The file content as a Buffer
|
|
724
|
+
*
|
|
725
|
+
* @example
|
|
726
|
+
* ```typescript
|
|
727
|
+
* const fs = alepha.inject(NodeFileSystemProvider);
|
|
728
|
+
*
|
|
729
|
+
* const buffer = await fs.readFile("/tmp/file.txt");
|
|
730
|
+
* console.log(buffer.toString("utf-8"));
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
733
|
readFile(path: string): Promise<Buffer>;
|
|
734
734
|
/**
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
735
|
+
* Writes data to a file.
|
|
736
|
+
*
|
|
737
|
+
* @param path - The file path to write to
|
|
738
|
+
* @param data - The data to write (Buffer or string)
|
|
739
|
+
*
|
|
740
|
+
* @example
|
|
741
|
+
* ```typescript
|
|
742
|
+
* const fs = alepha.inject(NodeFileSystemProvider);
|
|
743
|
+
*
|
|
744
|
+
* // Write string
|
|
745
|
+
* await fs.writeFile("/tmp/file.txt", "Hello, world!");
|
|
746
|
+
*
|
|
747
|
+
* // Write Buffer
|
|
748
|
+
* await fs.writeFile("/tmp/file.bin", Buffer.from([0x01, 0x02, 0x03]));
|
|
749
|
+
* ```
|
|
750
|
+
*/
|
|
751
751
|
writeFile(path: string, data: Uint8Array | Buffer | string | FileLike): Promise<void>;
|
|
752
752
|
/**
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
753
|
+
* Creates a FileLike object from a Web File.
|
|
754
|
+
*
|
|
755
|
+
* @protected
|
|
756
|
+
*/
|
|
757
757
|
protected createFileFromWebFile(source: File, options?: {
|
|
758
758
|
type?: string;
|
|
759
759
|
name?: string;
|
|
760
760
|
size?: number;
|
|
761
761
|
}): FileLike;
|
|
762
762
|
/**
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
763
|
+
* Creates a FileLike object from a Buffer.
|
|
764
|
+
*
|
|
765
|
+
* @protected
|
|
766
|
+
*/
|
|
767
767
|
protected createFileFromBuffer(source: Buffer, options?: {
|
|
768
768
|
type?: string;
|
|
769
769
|
name?: string;
|
|
770
770
|
}): FileLike;
|
|
771
771
|
/**
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
772
|
+
* Creates a FileLike object from a stream.
|
|
773
|
+
*
|
|
774
|
+
* @protected
|
|
775
|
+
*/
|
|
776
776
|
protected createFileFromStream(source: StreamLike, options?: {
|
|
777
777
|
type?: string;
|
|
778
778
|
name?: string;
|
|
@@ -781,43 +781,43 @@ declare class NodeFileSystemProvider implements FileSystemProvider {
|
|
|
781
781
|
_buffer: null | Buffer;
|
|
782
782
|
};
|
|
783
783
|
/**
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
784
|
+
* Creates a FileLike object from a URL.
|
|
785
|
+
*
|
|
786
|
+
* @protected
|
|
787
|
+
*/
|
|
788
788
|
protected createFileFromUrl(url: string, options?: {
|
|
789
789
|
type?: string;
|
|
790
790
|
name?: string;
|
|
791
791
|
}): FileLike;
|
|
792
792
|
/**
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
793
|
+
* Gets a streaming response from a URL.
|
|
794
|
+
*
|
|
795
|
+
* @protected
|
|
796
|
+
*/
|
|
797
797
|
protected getStreamingResponse(url: string): Readable;
|
|
798
798
|
/**
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
799
|
+
* Loads data from a URL.
|
|
800
|
+
*
|
|
801
|
+
* @protected
|
|
802
|
+
*/
|
|
803
803
|
protected loadFromUrl(url: string): Promise<Buffer>;
|
|
804
804
|
/**
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
805
|
+
* Creates a stream from a URL.
|
|
806
|
+
*
|
|
807
|
+
* @protected
|
|
808
|
+
*/
|
|
809
809
|
protected createStreamFromUrl(url: string): Readable;
|
|
810
810
|
/**
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
811
|
+
* Converts a stream-like object to a Buffer.
|
|
812
|
+
*
|
|
813
|
+
* @protected
|
|
814
|
+
*/
|
|
815
815
|
protected streamToBuffer(streamLike: StreamLike): Promise<Buffer>;
|
|
816
816
|
/**
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
817
|
+
* Converts a Node.js Buffer to an ArrayBuffer.
|
|
818
|
+
*
|
|
819
|
+
* @protected
|
|
820
|
+
*/
|
|
821
821
|
protected bufferToArrayBuffer(buffer: Buffer): ArrayBuffer;
|
|
822
822
|
}
|
|
823
823
|
//#endregion
|