@jambudipa/spider 0.2.1 → 0.3.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 (90) hide show
  1. package/README.md +10 -16
  2. package/dist/index.d.ts +33 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +3091 -1657
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/BrowserEngine/BrowserEngine.service.d.ts +107 -0
  7. package/dist/lib/BrowserEngine/BrowserEngine.service.d.ts.map +1 -0
  8. package/dist/lib/Config/SpiderConfig.service.d.ts +256 -0
  9. package/dist/lib/Config/SpiderConfig.service.d.ts.map +1 -0
  10. package/dist/lib/HttpClient/CookieManager.d.ts +58 -0
  11. package/dist/lib/HttpClient/CookieManager.d.ts.map +1 -0
  12. package/dist/lib/HttpClient/EnhancedHttpClient.d.ts +63 -0
  13. package/dist/lib/HttpClient/EnhancedHttpClient.d.ts.map +1 -0
  14. package/dist/lib/HttpClient/SessionStore.d.ts +114 -0
  15. package/dist/lib/HttpClient/SessionStore.d.ts.map +1 -0
  16. package/dist/lib/HttpClient/TokenExtractor.d.ts +83 -0
  17. package/dist/lib/HttpClient/TokenExtractor.d.ts.map +1 -0
  18. package/dist/lib/HttpClient/index.d.ts +8 -0
  19. package/dist/lib/HttpClient/index.d.ts.map +1 -0
  20. package/dist/lib/LinkExtractor/LinkExtractor.service.d.ts +166 -0
  21. package/dist/lib/LinkExtractor/LinkExtractor.service.d.ts.map +1 -0
  22. package/dist/lib/LinkExtractor/index.d.ts +37 -0
  23. package/dist/lib/LinkExtractor/index.d.ts.map +1 -0
  24. package/dist/lib/Logging/FetchLogger.d.ts +24 -0
  25. package/dist/lib/Logging/FetchLogger.d.ts.map +1 -0
  26. package/dist/lib/Logging/SpiderLogger.service.d.ts +37 -0
  27. package/dist/lib/Logging/SpiderLogger.service.d.ts.map +1 -0
  28. package/dist/lib/Middleware/SpiderMiddleware.d.ts +239 -0
  29. package/dist/lib/Middleware/SpiderMiddleware.d.ts.map +1 -0
  30. package/dist/lib/Middleware/types.d.ts +99 -0
  31. package/dist/lib/Middleware/types.d.ts.map +1 -0
  32. package/dist/lib/PageData/PageData.d.ts +28 -0
  33. package/dist/lib/PageData/PageData.d.ts.map +1 -0
  34. package/dist/lib/Resumability/Resumability.service.d.ts +178 -0
  35. package/dist/lib/Resumability/Resumability.service.d.ts.map +1 -0
  36. package/dist/lib/Resumability/backends/FileStorageBackend.d.ts +47 -0
  37. package/dist/lib/Resumability/backends/FileStorageBackend.d.ts.map +1 -0
  38. package/dist/lib/Resumability/backends/PostgresStorageBackend.d.ts +95 -0
  39. package/dist/lib/Resumability/backends/PostgresStorageBackend.d.ts.map +1 -0
  40. package/dist/lib/Resumability/backends/RedisStorageBackend.d.ts +92 -0
  41. package/dist/lib/Resumability/backends/RedisStorageBackend.d.ts.map +1 -0
  42. package/dist/lib/Resumability/index.d.ts +51 -0
  43. package/dist/lib/Resumability/index.d.ts.map +1 -0
  44. package/dist/lib/Resumability/strategies.d.ts +76 -0
  45. package/dist/lib/Resumability/strategies.d.ts.map +1 -0
  46. package/dist/lib/Resumability/types.d.ts +201 -0
  47. package/dist/lib/Resumability/types.d.ts.map +1 -0
  48. package/dist/lib/Robots/Robots.service.d.ts +78 -0
  49. package/dist/lib/Robots/Robots.service.d.ts.map +1 -0
  50. package/dist/lib/Scheduler/SpiderScheduler.service.d.ts +211 -0
  51. package/dist/lib/Scheduler/SpiderScheduler.service.d.ts.map +1 -0
  52. package/dist/lib/Scraper/Scraper.service.d.ts +123 -0
  53. package/dist/lib/Scraper/Scraper.service.d.ts.map +1 -0
  54. package/dist/lib/Spider/Spider.defaults.d.ts +24 -0
  55. package/dist/lib/Spider/Spider.defaults.d.ts.map +1 -0
  56. package/dist/lib/Spider/Spider.service.d.ts +239 -0
  57. package/dist/lib/Spider/Spider.service.d.ts.map +1 -0
  58. package/dist/lib/StateManager/StateManager.service.d.ts +107 -0
  59. package/dist/lib/StateManager/StateManager.service.d.ts.map +1 -0
  60. package/dist/lib/StateManager/index.d.ts +5 -0
  61. package/dist/lib/StateManager/index.d.ts.map +1 -0
  62. package/dist/lib/UrlDeduplicator/UrlDeduplicator.service.d.ts +58 -0
  63. package/dist/lib/UrlDeduplicator/UrlDeduplicator.service.d.ts.map +1 -0
  64. package/dist/lib/WebScrapingEngine/WebScrapingEngine.service.d.ts +109 -0
  65. package/dist/lib/WebScrapingEngine/WebScrapingEngine.service.d.ts.map +1 -0
  66. package/dist/lib/WebScrapingEngine/index.d.ts +5 -0
  67. package/dist/lib/WebScrapingEngine/index.d.ts.map +1 -0
  68. package/dist/lib/WorkerHealth/WorkerHealthMonitor.service.d.ts +39 -0
  69. package/dist/lib/WorkerHealth/WorkerHealthMonitor.service.d.ts.map +1 -0
  70. package/dist/lib/api-facades.d.ts +313 -0
  71. package/dist/lib/api-facades.d.ts.map +1 -0
  72. package/dist/lib/errors/effect-errors.d.ts +312 -0
  73. package/dist/lib/errors/effect-errors.d.ts.map +1 -0
  74. package/dist/lib/utils/FileUtils.d.ts +284 -0
  75. package/dist/lib/utils/FileUtils.d.ts.map +1 -0
  76. package/dist/lib/utils/JsonUtils.d.ts +196 -0
  77. package/dist/lib/utils/JsonUtils.d.ts.map +1 -0
  78. package/dist/lib/utils/RegexUtils.d.ts +257 -0
  79. package/dist/lib/utils/RegexUtils.d.ts.map +1 -0
  80. package/dist/lib/utils/SchemaUtils.d.ts +251 -0
  81. package/dist/lib/utils/SchemaUtils.d.ts.map +1 -0
  82. package/dist/lib/utils/UrlUtils.d.ts +223 -0
  83. package/dist/lib/utils/UrlUtils.d.ts.map +1 -0
  84. package/dist/lib/utils/effect-migration.d.ts +31 -0
  85. package/dist/lib/utils/effect-migration.d.ts.map +1 -0
  86. package/dist/lib/utils/index.d.ts +15 -0
  87. package/dist/lib/utils/index.d.ts.map +1 -0
  88. package/dist/lib/utils/url-deduplication.d.ts +108 -0
  89. package/dist/lib/utils/url-deduplication.d.ts.map +1 -0
  90. package/package.json +22 -13
@@ -0,0 +1,312 @@
1
+ /**
2
+ * Consolidated Effect-based Error Types
3
+ * Comprehensive error hierarchy using Data.TaggedError for type-safe error handling
4
+ */
5
+ declare const SpiderError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
6
+ readonly _tag: "SpiderError";
7
+ } & Readonly<A>;
8
+ /**
9
+ * Base error class for all Spider errors
10
+ */
11
+ export declare class SpiderError extends SpiderError_base<{
12
+ readonly operation: string;
13
+ readonly details?: unknown;
14
+ readonly cause?: unknown;
15
+ }> {
16
+ get message(): string;
17
+ }
18
+ declare const NetworkError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
19
+ readonly _tag: "NetworkError";
20
+ } & Readonly<A>;
21
+ /**
22
+ * Network-related errors (fetch failures, timeouts, etc.)
23
+ */
24
+ export declare class NetworkError extends NetworkError_base<{
25
+ readonly url: string;
26
+ readonly statusCode?: number;
27
+ readonly method?: string;
28
+ readonly cause?: unknown;
29
+ }> {
30
+ get message(): string;
31
+ static fromResponse(url: string, response: Response): NetworkError;
32
+ static fromCause(url: string, cause: unknown): NetworkError;
33
+ }
34
+ declare const TimeoutError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
35
+ readonly _tag: "TimeoutError";
36
+ } & Readonly<A>;
37
+ export declare class TimeoutError extends TimeoutError_base<{
38
+ readonly url: string;
39
+ readonly timeoutMs: number;
40
+ readonly operation: string;
41
+ }> {
42
+ get message(): string;
43
+ }
44
+ declare const RobotsTxtError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
45
+ readonly _tag: "RobotsTxtError";
46
+ } & Readonly<A>;
47
+ /**
48
+ * Robots.txt fetching errors
49
+ */
50
+ export declare class RobotsTxtError extends RobotsTxtError_base<{
51
+ readonly url: string;
52
+ readonly cause?: unknown;
53
+ readonly message: string;
54
+ }> {
55
+ static fromCause(url: string, cause: unknown): RobotsTxtError;
56
+ }
57
+ declare const ResponseError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
58
+ readonly _tag: "ResponseError";
59
+ } & Readonly<A>;
60
+ /**
61
+ * Response processing errors (invalid content, parsing failures)
62
+ */
63
+ export declare class ResponseError extends ResponseError_base<{
64
+ readonly url: string;
65
+ readonly cause?: unknown;
66
+ readonly message: string;
67
+ }> {
68
+ static fromCause(url: string, cause: unknown): ResponseError;
69
+ }
70
+ declare const ParseError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
71
+ readonly _tag: "ParseError";
72
+ } & Readonly<A>;
73
+ export declare class ParseError extends ParseError_base<{
74
+ readonly input?: string;
75
+ readonly expected: string;
76
+ readonly cause?: unknown;
77
+ }> {
78
+ get message(): string;
79
+ static json(input: string, cause?: unknown): ParseError;
80
+ static html(input: string, cause?: unknown): ParseError;
81
+ }
82
+ declare const ValidationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
83
+ readonly _tag: "ValidationError";
84
+ } & Readonly<A>;
85
+ export declare class ValidationError extends ValidationError_base<{
86
+ readonly field: string;
87
+ readonly value?: unknown;
88
+ readonly constraint: string;
89
+ }> {
90
+ get message(): string;
91
+ static url(url: string): ValidationError;
92
+ }
93
+ declare const ConfigurationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
94
+ readonly _tag: "ConfigurationError";
95
+ } & Readonly<A>;
96
+ /**
97
+ * Configuration errors (from original errors.ts)
98
+ */
99
+ export declare class ConfigurationError extends ConfigurationError_base<{
100
+ readonly message: string;
101
+ readonly details?: unknown;
102
+ }> {
103
+ }
104
+ declare const ConfigError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
105
+ readonly _tag: "ConfigError";
106
+ } & Readonly<A>;
107
+ /**
108
+ * Configuration errors (field-level, from effect-errors.ts)
109
+ */
110
+ export declare class ConfigError extends ConfigError_base<{
111
+ readonly field: string;
112
+ readonly value?: unknown;
113
+ readonly reason: string;
114
+ }> {
115
+ get message(): string;
116
+ static invalid(field: string, value: unknown, expected: string): ConfigError;
117
+ }
118
+ declare const MiddlewareError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
119
+ readonly _tag: "MiddlewareError";
120
+ } & Readonly<A>;
121
+ /**
122
+ * Middleware processing errors
123
+ */
124
+ export declare class MiddlewareError extends MiddlewareError_base<{
125
+ readonly phase: 'transform' | 'error' | 'request' | 'response';
126
+ readonly middlewareName: string;
127
+ readonly cause?: unknown;
128
+ }> {
129
+ get message(): string;
130
+ static transform(middlewareName: string, cause: unknown): MiddlewareError;
131
+ static error(middlewareName: string, cause: unknown): MiddlewareError;
132
+ }
133
+ declare const FileSystemError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
134
+ readonly _tag: "FileSystemError";
135
+ } & Readonly<A>;
136
+ /**
137
+ * File system errors
138
+ */
139
+ export declare class FileSystemError extends FileSystemError_base<{
140
+ readonly operation: 'read' | 'write' | 'create' | 'delete';
141
+ readonly path: string;
142
+ readonly cause?: unknown;
143
+ }> {
144
+ get message(): string;
145
+ static write(path: string, cause: unknown): FileSystemError;
146
+ static create(path: string, cause: unknown): FileSystemError;
147
+ }
148
+ declare const PersistenceError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
149
+ readonly _tag: "PersistenceError";
150
+ } & Readonly<A>;
151
+ /**
152
+ * Persistence layer errors
153
+ */
154
+ export declare class PersistenceError extends PersistenceError_base<{
155
+ readonly operation: string;
156
+ readonly key?: string;
157
+ readonly cause?: unknown;
158
+ readonly message: string;
159
+ }> {
160
+ static save(cause: unknown, key?: string): PersistenceError;
161
+ static load(cause: unknown, key?: string): PersistenceError;
162
+ static delete(cause: unknown, key?: string): PersistenceError;
163
+ }
164
+ declare const ContentTypeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
165
+ readonly _tag: "ContentTypeError";
166
+ } & Readonly<A>;
167
+ /**
168
+ * Content type validation errors
169
+ */
170
+ export declare class ContentTypeError extends ContentTypeError_base<{
171
+ readonly url: string;
172
+ readonly contentType: string;
173
+ readonly expectedTypes: readonly string[];
174
+ readonly message: string;
175
+ }> {
176
+ static create(url: string, contentType: string, expectedTypes: readonly string[]): ContentTypeError;
177
+ }
178
+ declare const RequestAbortError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
179
+ readonly _tag: "RequestAbortError";
180
+ } & Readonly<A>;
181
+ /**
182
+ * Request abort errors
183
+ */
184
+ export declare class RequestAbortError extends RequestAbortError_base<{
185
+ readonly url: string;
186
+ readonly duration: number;
187
+ readonly reason: 'timeout' | 'cancelled';
188
+ readonly message: string;
189
+ }> {
190
+ static timeout(url: string, duration: number): RequestAbortError;
191
+ static cancelled(url: string, duration: number): RequestAbortError;
192
+ }
193
+ declare const AdapterNotInitialisedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
194
+ readonly _tag: "AdapterNotInitialisedError";
195
+ } & Readonly<A>;
196
+ /**
197
+ * Adapter initialisation errors
198
+ */
199
+ export declare class AdapterNotInitialisedError extends AdapterNotInitialisedError_base<{
200
+ readonly adapterId: string;
201
+ readonly operation: string;
202
+ readonly message: string;
203
+ }> {
204
+ static create(adapterId: string, operation: string): AdapterNotInitialisedError;
205
+ }
206
+ declare const BrowserError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
207
+ readonly _tag: "BrowserError";
208
+ } & Readonly<A>;
209
+ /**
210
+ * Browser operation errors
211
+ */
212
+ export declare class BrowserError extends BrowserError_base<{
213
+ readonly operation: string;
214
+ readonly browserId?: string;
215
+ readonly cause?: unknown;
216
+ }> {
217
+ get message(): string;
218
+ static launch(cause: unknown): BrowserError;
219
+ static createContext(cause: unknown): BrowserError;
220
+ static createPage(cause: unknown): BrowserError;
221
+ static closeContext(cause: unknown): BrowserError;
222
+ static notLaunched(): BrowserError;
223
+ static launchFailed(cause: unknown): BrowserError;
224
+ }
225
+ declare const BrowserCleanupError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
226
+ readonly _tag: "BrowserCleanupError";
227
+ } & Readonly<A>;
228
+ /**
229
+ * Browser cleanup errors
230
+ */
231
+ export declare class BrowserCleanupError extends BrowserCleanupError_base<{
232
+ readonly resourceType: 'context' | 'browser';
233
+ readonly resourceId: string;
234
+ readonly cause: unknown;
235
+ readonly message: string;
236
+ }> {
237
+ static context(id: string, cause: unknown): BrowserCleanupError;
238
+ static browser(id: string, cause: unknown): BrowserCleanupError;
239
+ }
240
+ declare const PageError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
241
+ readonly _tag: "PageError";
242
+ } & Readonly<A>;
243
+ export declare class PageError extends PageError_base<{
244
+ readonly url: string;
245
+ readonly operation: string;
246
+ readonly selector?: string;
247
+ readonly cause?: unknown;
248
+ }> {
249
+ get message(): string;
250
+ }
251
+ declare const StateError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
252
+ readonly _tag: "StateError";
253
+ } & Readonly<A>;
254
+ export declare class StateError extends StateError_base<{
255
+ readonly operation: 'save' | 'load' | 'delete' | 'update';
256
+ readonly stateKey?: string;
257
+ readonly cause?: unknown;
258
+ }> {
259
+ get message(): string;
260
+ }
261
+ declare const SessionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
262
+ readonly _tag: "SessionError";
263
+ } & Readonly<A>;
264
+ export declare class SessionError extends SessionError_base<{
265
+ readonly sessionId?: string;
266
+ readonly operation: string;
267
+ readonly cause?: unknown;
268
+ }> {
269
+ get message(): string;
270
+ static noActiveSession(): SessionError;
271
+ }
272
+ declare const CrawlError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
273
+ readonly _tag: "CrawlError";
274
+ } & Readonly<A>;
275
+ export declare class CrawlError extends CrawlError_base<{
276
+ readonly url: string;
277
+ readonly depth: number;
278
+ readonly reason: string;
279
+ readonly cause?: unknown;
280
+ }> {
281
+ get message(): string;
282
+ static maxDepthReached(url: string, depth: number): CrawlError;
283
+ static robotsBlocked(url: string): CrawlError;
284
+ }
285
+ declare const QueueError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
286
+ readonly _tag: "QueueError";
287
+ } & Readonly<A>;
288
+ export declare class QueueError extends QueueError_base<{
289
+ readonly operation: 'enqueue' | 'dequeue' | 'peek';
290
+ readonly queueSize?: number;
291
+ readonly cause?: unknown;
292
+ }> {
293
+ get message(): string;
294
+ }
295
+ /**
296
+ * Type guard for Spider errors
297
+ */
298
+ export declare const isSpiderError: (error: unknown) => error is SpiderError;
299
+ /**
300
+ * Type guard for network-related errors
301
+ */
302
+ export declare const isNetworkError: (error: unknown) => error is NetworkError | TimeoutError;
303
+ /**
304
+ * Type guard for browser-related errors
305
+ */
306
+ export declare const isBrowserError: (error: unknown) => error is BrowserError | PageError;
307
+ /**
308
+ * Union type of all Spider errors (public API)
309
+ */
310
+ export type AllSpiderErrors = SpiderError | NetworkError | TimeoutError | ResponseError | ParseError | ValidationError | ConfigurationError | ConfigError | MiddlewareError | FileSystemError | PersistenceError | ContentTypeError | RequestAbortError | AdapterNotInitialisedError | BrowserError | BrowserCleanupError | PageError | StateError | SessionError | CrawlError | QueueError;
311
+ export {};
312
+ //# sourceMappingURL=effect-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect-errors.d.ts","sourceRoot":"","sources":["../../../src/lib/errors/effect-errors.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AAC,EAAE,OAAO,CAAC;CAC1B,CAAC;IACA,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU;IAQ9D,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;CAO9C;;;;AAED,qBAAa,UAAW,SAAQ,gBAA+B;IAC7D,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;IACnD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;IACA,IAAI,OAAO,IAAI,MAAM,CAMpB;CACF;AAMD;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAEvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,YAAY,GAAG,YAEvE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,YAAY,GAAG,SAEvE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,UAAU,GACV,eAAe,GACf,kBAAkB,GAClB,WAAW,GACX,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,0BAA0B,GAC1B,YAAY,GACZ,mBAAmB,GACnB,SAAS,GACT,UAAU,GACV,YAAY,GACZ,UAAU,GACV,UAAU,CAAC"}
@@ -0,0 +1,284 @@
1
+ /**
2
+ * File System Utilities
3
+ * Effect-based file operations with proper error handling
4
+ */
5
+ import { Effect, Option, Schema } from 'effect';
6
+ type FileEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
7
+ export type FileError = FileReadError | FileWriteError | DirectoryError;
8
+ export type FileErrorType = 'FileReadError' | 'FileWriteError' | 'DirectoryError';
9
+ declare const FileReadError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
10
+ readonly _tag: "FileReadError";
11
+ } & Readonly<A>;
12
+ export declare class FileReadError extends FileReadError_base<{
13
+ readonly path: string;
14
+ readonly code: Option.Option<string>;
15
+ readonly cause?: unknown;
16
+ }> {
17
+ get message(): string;
18
+ }
19
+ declare const FileWriteError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
20
+ readonly _tag: "FileWriteError";
21
+ } & Readonly<A>;
22
+ export declare class FileWriteError extends FileWriteError_base<{
23
+ readonly path: string;
24
+ readonly code: Option.Option<string>;
25
+ readonly cause?: unknown;
26
+ }> {
27
+ get message(): string;
28
+ }
29
+ declare const DirectoryError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
30
+ readonly _tag: "DirectoryError";
31
+ } & Readonly<A>;
32
+ export declare class DirectoryError extends DirectoryError_base<{
33
+ readonly path: string;
34
+ readonly operation: 'create' | 'read' | 'delete';
35
+ readonly code: Option.Option<string>;
36
+ readonly cause?: unknown;
37
+ }> {
38
+ get message(): string;
39
+ }
40
+ export declare const FileUtils: {
41
+ /**
42
+ * Read file as text
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const content = yield* FileUtils.readText('/path/to/file.txt');
47
+ * ```
48
+ */
49
+ readText: (filePath: string, encoding?: FileEncoding) => Effect.Effect<string, FileReadError, never>;
50
+ /**
51
+ * Write text to file
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * yield* FileUtils.writeText('/path/to/file.txt', 'Hello, World!');
56
+ * ```
57
+ */
58
+ writeText: (filePath: string, content: string, encoding?: FileEncoding) => Effect.Effect<void, FileWriteError, never>;
59
+ /**
60
+ * Read file as buffer
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const buffer = yield* FileUtils.readBuffer('/path/to/image.png');
65
+ * ```
66
+ */
67
+ readBuffer: (filePath: string) => Effect.Effect<Buffer<ArrayBufferLike>, FileReadError, never>;
68
+ /**
69
+ * Write buffer to file
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * yield* FileUtils.writeBuffer('/path/to/image.png', imageBuffer);
74
+ * ```
75
+ */
76
+ writeBuffer: (filePath: string, buffer: Buffer) => Effect.Effect<void, FileWriteError, never>;
77
+ /**
78
+ * Read JSON file with schema validation
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const ConfigSchema = Schema.Struct({ debug: Schema.Boolean });
83
+ * const config = yield* FileUtils.readJson('/path/to/config.json', ConfigSchema);
84
+ * ```
85
+ */
86
+ readJson: <A, I = A, R = never>(filePath: string, schema: Schema.Schema<A, I, R>) => Effect.Effect<A, import("./JsonUtils.js").JsonParseError | FileReadError, R>;
87
+ /**
88
+ * Write JSON file
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * yield* FileUtils.writeJson('/path/to/config.json', configData, 2);
93
+ * ```
94
+ */
95
+ writeJson: (filePath: string, data: unknown, space?: number) => Effect.Effect<void, import("./JsonUtils.js").JsonStringifyError | FileWriteError, never>;
96
+ /**
97
+ * Check if file exists
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const exists = yield* FileUtils.exists('/path/to/file.txt');
102
+ * if (exists) {
103
+ * // File exists
104
+ * }
105
+ * ```
106
+ */
107
+ exists: (filePath: string) => Effect.Effect<boolean, never, never>;
108
+ /**
109
+ * Get file stats
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * const stats = yield* FileUtils.stat('/path/to/file.txt');
114
+ * console.log(`File size: ${stats.size} bytes`);
115
+ * ```
116
+ */
117
+ stat: (filePath: string) => Effect.Effect<import("fs").Stats, FileReadError, never>;
118
+ /**
119
+ * Delete file
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * yield* FileUtils.delete('/path/to/file.txt');
124
+ * ```
125
+ */
126
+ delete: (filePath: string) => Effect.Effect<void, FileWriteError, never>;
127
+ /**
128
+ * Copy file
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * yield* FileUtils.copy('/src/file.txt', '/dest/file.txt');
133
+ * ```
134
+ */
135
+ copy: (src: string, dest: string) => Effect.Effect<void, FileWriteError, never>;
136
+ /**
137
+ * Move/rename file
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * yield* FileUtils.move('/old/path.txt', '/new/path.txt');
142
+ * ```
143
+ */
144
+ move: (src: string, dest: string) => Effect.Effect<void, FileWriteError, never>;
145
+ /**
146
+ * Ensure directory exists (create if not)
147
+ *
148
+ * @example
149
+ * ```ts
150
+ * yield* FileUtils.ensureDir('/path/to/directory');
151
+ * ```
152
+ */
153
+ ensureDir: (dirPath: string) => Effect.Effect<string | undefined, DirectoryError, never>;
154
+ /**
155
+ * Read directory contents
156
+ *
157
+ * @example
158
+ * ```ts
159
+ * const files = yield* FileUtils.readDir('/path/to/directory');
160
+ * ```
161
+ */
162
+ readDir: (dirPath: string) => Effect.Effect<string[], DirectoryError, never>;
163
+ /**
164
+ * Read directory with file stats
165
+ *
166
+ * @example
167
+ * ```ts
168
+ * const entries = yield* FileUtils.readDirWithStats('/path/to/directory');
169
+ * for (const entry of entries) {
170
+ * if (entry.isFile()) {
171
+ * console.log(`File: ${entry.name}`);
172
+ * }
173
+ * }
174
+ * ```
175
+ */
176
+ readDirWithStats: (dirPath: string) => Effect.Effect<import("fs").Dirent<string>[], DirectoryError, never>;
177
+ /**
178
+ * Delete directory (recursive)
179
+ *
180
+ * @example
181
+ * ```ts
182
+ * yield* FileUtils.deleteDir('/path/to/directory');
183
+ * ```
184
+ */
185
+ deleteDir: (dirPath: string) => Effect.Effect<void, DirectoryError, never>;
186
+ /**
187
+ * Read file or return default value
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * const content = yield* FileUtils.readTextOrDefault(
192
+ * '/path/to/config.txt',
193
+ * 'default config'
194
+ * );
195
+ * ```
196
+ */
197
+ readTextOrDefault: (filePath: string, defaultContent: string) => Effect.Effect<string, never, never>;
198
+ /**
199
+ * Read JSON with schema validation or return default value
200
+ *
201
+ * @example
202
+ * ```ts
203
+ * const ConfigSchema = Schema.Struct({ debug: Schema.Boolean });
204
+ * const config = yield* FileUtils.readJsonOrDefault(
205
+ * '/path/to/config.json',
206
+ * ConfigSchema,
207
+ * { debug: false }
208
+ * );
209
+ * ```
210
+ */
211
+ readJsonOrDefault: <A, I = A, R = never>(filePath: string, schema: Schema.Schema<A, I, R>, defaultValue: A) => Effect.Effect<A, never, R>;
212
+ /**
213
+ * Try read file and return Option
214
+ *
215
+ * @example
216
+ * ```ts
217
+ * const maybeContent = yield* FileUtils.tryReadText('/path/to/file.txt');
218
+ * if (Option.isSome(maybeContent)) {
219
+ * console.log(maybeContent.value);
220
+ * }
221
+ * ```
222
+ */
223
+ tryReadText: (filePath: string) => Effect.Effect<Option.Option<string> | Option.Option<never>, never, never>;
224
+ /**
225
+ * Append text to file
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * yield* FileUtils.append('/path/to/log.txt', 'New log entry\n');
230
+ * ```
231
+ */
232
+ append: (filePath: string, content: string) => Effect.Effect<void, FileWriteError, never>;
233
+ /**
234
+ * Create temporary file
235
+ *
236
+ * @example
237
+ * ```ts
238
+ * const tempPath = yield* FileUtils.createTempFile('data', '.json');
239
+ * // Use temp file...
240
+ * yield* FileUtils.delete(tempPath);
241
+ * ```
242
+ */
243
+ createTempFile: (prefix?: string, suffix?: string) => Effect.Effect<string, FileWriteError | import("effect/ConfigError").ConfigError, never>;
244
+ /**
245
+ * Get file size
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * const size = yield* FileUtils.getSize('/path/to/file.txt');
250
+ * console.log(`File is ${size} bytes`);
251
+ * ```
252
+ */
253
+ getSize: (filePath: string) => Effect.Effect<number, FileReadError, never>;
254
+ /**
255
+ * Check if path is a file
256
+ *
257
+ * @example
258
+ * ```ts
259
+ * const isFile = yield* FileUtils.isFile('/path/to/something');
260
+ * ```
261
+ */
262
+ isFile: (filePath: string) => Effect.Effect<boolean, never, never>;
263
+ /**
264
+ * Check if path is a directory
265
+ *
266
+ * @example
267
+ * ```ts
268
+ * const isDir = yield* FileUtils.isDirectory('/path/to/something');
269
+ * ```
270
+ */
271
+ isDirectory: (dirPath: string) => Effect.Effect<boolean, never, never>;
272
+ /**
273
+ * Walk directory tree recursively
274
+ *
275
+ * @example
276
+ * ```ts
277
+ * const allFiles = yield* FileUtils.walk('/path/to/root');
278
+ * ```
279
+ */
280
+ walk: (dirPath: string) => Effect.Effect<string[], DirectoryError>;
281
+ };
282
+ export declare const readText: (filePath: string, encoding?: FileEncoding) => Effect.Effect<string, FileReadError, never>, writeText: (filePath: string, content: string, encoding?: FileEncoding) => Effect.Effect<void, FileWriteError, never>, readBuffer: (filePath: string) => Effect.Effect<Buffer<ArrayBufferLike>, FileReadError, never>, writeBuffer: (filePath: string, buffer: Buffer) => Effect.Effect<void, FileWriteError, never>, readJson: <A, I = A, R = never>(filePath: string, schema: Schema.Schema<A, I, R>) => Effect.Effect<A, import("./JsonUtils.js").JsonParseError | FileReadError, R>, writeJson: (filePath: string, data: unknown, space?: number) => Effect.Effect<void, import("./JsonUtils.js").JsonStringifyError | FileWriteError, never>, exists: (filePath: string) => Effect.Effect<boolean, never, never>, stat: (filePath: string) => Effect.Effect<import("fs").Stats, FileReadError, never>, deleteFile: (filePath: string) => Effect.Effect<void, FileWriteError, never>, copy: (src: string, dest: string) => Effect.Effect<void, FileWriteError, never>, move: (src: string, dest: string) => Effect.Effect<void, FileWriteError, never>, ensureDir: (dirPath: string) => Effect.Effect<string | undefined, DirectoryError, never>, readDir: (dirPath: string) => Effect.Effect<string[], DirectoryError, never>, readDirWithStats: (dirPath: string) => Effect.Effect<import("fs").Dirent<string>[], DirectoryError, never>, deleteDir: (dirPath: string) => Effect.Effect<void, DirectoryError, never>, readTextOrDefault: (filePath: string, defaultContent: string) => Effect.Effect<string, never, never>, readJsonOrDefault: <A, I = A, R = never>(filePath: string, schema: Schema.Schema<A, I, R>, defaultValue: A) => Effect.Effect<A, never, R>, tryReadText: (filePath: string) => Effect.Effect<Option.Option<string> | Option.Option<never>, never, never>, append: (filePath: string, content: string) => Effect.Effect<void, FileWriteError, never>, createTempFile: (prefix?: string, suffix?: string) => Effect.Effect<string, FileWriteError | import("effect/ConfigError").ConfigError, never>, getSize: (filePath: string) => Effect.Effect<number, FileReadError, never>, isFile: (filePath: string) => Effect.Effect<boolean, never, never>, isDirectory: (dirPath: string) => Effect.Effect<boolean, never, never>, walk: (dirPath: string) => Effect.Effect<string[], DirectoryError>;
283
+ export {};
284
+ //# sourceMappingURL=FileUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileUtils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/FileUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAQ,MAAM,EAAmC,MAAM,EAAE,MAAM,QAAQ,CAAC;AASvF,KAAK,YAAY,GACb,OAAO,GACP,MAAM,GACN,OAAO,GACP,SAAS,GACT,MAAM,GACN,OAAO,GACP,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,KAAK,CAAC;AAqBV,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,cAAc,GAAG,cAAc,CAAC;AACxE,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;;;;AAElF,qBAAa,aAAc,SAAQ,mBAAkC;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IA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