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