@effect/platform 0.18.7 → 0.19.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 (155) hide show
  1. package/Command/dist/effect-platform-Command.cjs.dev.js +419 -26
  2. package/Command/dist/effect-platform-Command.cjs.prod.js +419 -26
  3. package/Command/dist/effect-platform-Command.esm.js +382 -9
  4. package/CommandExecutor/dist/effect-platform-CommandExecutor.cjs.dev.js +72 -7
  5. package/CommandExecutor/dist/effect-platform-CommandExecutor.cjs.prod.js +72 -7
  6. package/CommandExecutor/dist/effect-platform-CommandExecutor.esm.js +71 -2
  7. package/Effectify/dist/effect-platform-Effectify.cjs.dev.js +55 -3
  8. package/Effectify/dist/effect-platform-Effectify.cjs.prod.js +55 -3
  9. package/Effectify/dist/effect-platform-Effectify.esm.js +38 -2
  10. package/Error/dist/effect-platform-Error.cjs.dev.js +87 -5
  11. package/Error/dist/effect-platform-Error.cjs.prod.js +87 -5
  12. package/Error/dist/effect-platform-Error.esm.js +68 -2
  13. package/FileSystem/dist/effect-platform-FileSystem.cjs.dev.js +287 -20
  14. package/FileSystem/dist/effect-platform-FileSystem.cjs.prod.js +287 -20
  15. package/FileSystem/dist/effect-platform-FileSystem.esm.js +256 -9
  16. package/Http/App/dist/effect-platform-Http-App.cjs.dev.js +15 -0
  17. package/Http/App/dist/effect-platform-Http-App.cjs.mjs +6 -1
  18. package/Http/App/dist/effect-platform-Http-App.cjs.prod.js +15 -0
  19. package/Http/App/dist/effect-platform-Http-App.esm.js +6 -1
  20. package/Http/Body/dist/effect-platform-Http-Body.cjs.dev.js +4 -4
  21. package/Http/Body/dist/effect-platform-Http-Body.cjs.prod.js +4 -4
  22. package/Http/Body/dist/effect-platform-Http-Body.esm.js +4 -4
  23. package/Http/Client/dist/effect-platform-Http-Client.cjs.dev.js +6 -6
  24. package/Http/Client/dist/effect-platform-Http-Client.cjs.prod.js +6 -6
  25. package/Http/Client/dist/effect-platform-Http-Client.esm.js +6 -6
  26. package/Http/ClientRequest/dist/effect-platform-Http-ClientRequest.cjs.dev.js +5 -5
  27. package/Http/ClientRequest/dist/effect-platform-Http-ClientRequest.cjs.prod.js +5 -5
  28. package/Http/ClientRequest/dist/effect-platform-Http-ClientRequest.esm.js +5 -5
  29. package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.cjs.dev.js +4 -4
  30. package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.cjs.prod.js +4 -4
  31. package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.esm.js +4 -4
  32. package/Http/FormData/dist/effect-platform-Http-FormData.cjs.dev.js +3 -3
  33. package/Http/FormData/dist/effect-platform-Http-FormData.cjs.prod.js +3 -3
  34. package/Http/FormData/dist/effect-platform-Http-FormData.esm.js +3 -3
  35. package/Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.cjs.dev.js +2 -2
  36. package/Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.cjs.prod.js +2 -2
  37. package/Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.esm.js +2 -2
  38. package/Http/Middleware/dist/effect-platform-Http-Middleware.cjs.dev.js +11 -11
  39. package/Http/Middleware/dist/effect-platform-Http-Middleware.cjs.mjs +0 -1
  40. package/Http/Middleware/dist/effect-platform-Http-Middleware.cjs.prod.js +11 -11
  41. package/Http/Middleware/dist/effect-platform-Http-Middleware.esm.js +11 -10
  42. package/Http/Platform/dist/effect-platform-Http-Platform.cjs.dev.js +3 -3
  43. package/Http/Platform/dist/effect-platform-Http-Platform.cjs.prod.js +3 -3
  44. package/Http/Platform/dist/effect-platform-Http-Platform.esm.js +2 -2
  45. package/Http/Router/dist/effect-platform-Http-Router.cjs.dev.js +5 -5
  46. package/Http/Router/dist/effect-platform-Http-Router.cjs.prod.js +5 -5
  47. package/Http/Router/dist/effect-platform-Http-Router.esm.js +5 -5
  48. package/Http/ServerRequest/dist/effect-platform-Http-ServerRequest.cjs.dev.js +4 -4
  49. package/Http/ServerRequest/dist/effect-platform-Http-ServerRequest.cjs.prod.js +4 -4
  50. package/Http/ServerRequest/dist/effect-platform-Http-ServerRequest.esm.js +4 -4
  51. package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.cjs.dev.js +4 -4
  52. package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.cjs.prod.js +4 -4
  53. package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.esm.js +4 -4
  54. package/HttpClient/dist/effect-platform-HttpClient.cjs.dev.js +9 -9
  55. package/HttpClient/dist/effect-platform-HttpClient.cjs.prod.js +9 -9
  56. package/HttpClient/dist/effect-platform-HttpClient.esm.js +9 -9
  57. package/HttpServer/dist/effect-platform-HttpServer.cjs.dev.js +15 -15
  58. package/HttpServer/dist/effect-platform-HttpServer.cjs.prod.js +15 -15
  59. package/HttpServer/dist/effect-platform-HttpServer.esm.js +15 -15
  60. package/KeyValueStore/dist/effect-platform-KeyValueStore.cjs.dev.js +227 -18
  61. package/KeyValueStore/dist/effect-platform-KeyValueStore.cjs.prod.js +227 -18
  62. package/KeyValueStore/dist/effect-platform-KeyValueStore.esm.js +199 -10
  63. package/Path/dist/effect-platform-Path.cjs.dev.js +142 -9
  64. package/Path/dist/effect-platform-Path.cjs.prod.js +142 -9
  65. package/Path/dist/effect-platform-Path.esm.js +122 -7
  66. package/Runtime/dist/effect-platform-Runtime.cjs.dev.js +44 -4
  67. package/Runtime/dist/effect-platform-Runtime.cjs.prod.js +44 -4
  68. package/Runtime/dist/effect-platform-Runtime.esm.js +26 -3
  69. package/dist/App-18152f12.cjs.dev.js +93 -0
  70. package/dist/App-1ca51fa7.esm.js +65 -0
  71. package/dist/App-d8b904fa.cjs.prod.js +93 -0
  72. package/dist/{Body-ec1353f9.esm.js → Body-40ced606.esm.js} +1 -1
  73. package/dist/{Body-86ef2922.cjs.dev.js → Body-4a7ad057.cjs.dev.js} +1 -1
  74. package/dist/{Body-b77eac75.cjs.prod.js → Body-c26fa93f.cjs.prod.js} +1 -1
  75. package/dist/{Client-537f76ae.cjs.prod.js → Client-03fea3d9.cjs.prod.js} +3 -3
  76. package/dist/{Client-cdbd4ff7.esm.js → Client-55ef15d5.esm.js} +3 -3
  77. package/dist/{Client-0fbb38ab.cjs.dev.js → Client-c05eadcd.cjs.dev.js} +3 -3
  78. package/dist/{ClientRequest-fc429335.esm.js → ClientRequest-490c76cd.esm.js} +1 -1
  79. package/dist/{ClientRequest-750d8d59.cjs.prod.js → ClientRequest-a729f345.cjs.prod.js} +1 -1
  80. package/dist/{ClientRequest-00e89da8.cjs.dev.js → ClientRequest-c5336a28.cjs.dev.js} +1 -1
  81. package/dist/{ClientResponse-7e4fe7b5.esm.js → ClientResponse-6e84da40.esm.js} +1 -1
  82. package/dist/{ClientResponse-f9f19afb.cjs.prod.js → ClientResponse-c19fd519.cjs.prod.js} +1 -1
  83. package/dist/{ClientResponse-75423399.cjs.dev.js → ClientResponse-df62564e.cjs.dev.js} +1 -1
  84. package/dist/{FormData-ee0b1cf2.cjs.dev.js → FormData-6d030595.cjs.prod.js} +1 -1
  85. package/dist/{FormData-902afd18.cjs.prod.js → FormData-7ea13198.cjs.dev.js} +1 -1
  86. package/dist/{FormData-f54de878.esm.js → FormData-bd727d2f.esm.js} +1 -1
  87. package/dist/{Middleware-f9a073d7.cjs.prod.js → Middleware-6de1c21d.cjs.prod.js} +14 -20
  88. package/dist/{Middleware-e2edf820.cjs.dev.js → Middleware-b1d126b4.cjs.dev.js} +14 -20
  89. package/dist/{Middleware-240f91f6.esm.js → Middleware-d38ef616.esm.js} +15 -20
  90. package/dist/{Router-bf32317a.esm.js → Router-2ee665b4.esm.js} +2 -2
  91. package/dist/{Router-bd2b3014.cjs.dev.js → Router-43e62bd9.cjs.dev.js} +2 -2
  92. package/dist/{Router-6c80a4c9.cjs.prod.js → Router-53ec1aea.cjs.prod.js} +2 -2
  93. package/dist/{ServerRequest-03161edc.esm.js → ServerRequest-a641c507.esm.js} +1 -1
  94. package/dist/{ServerRequest-8d9c2c6b.cjs.dev.js → ServerRequest-cb289dae.cjs.dev.js} +1 -1
  95. package/dist/{ServerRequest-938f3ed0.cjs.prod.js → ServerRequest-ec4da01b.cjs.prod.js} +1 -1
  96. package/dist/{ServerResponse-93038062.esm.js → ServerResponse-03c252ea.esm.js} +2 -2
  97. package/dist/{ServerResponse-b63b7192.cjs.dev.js → ServerResponse-9af42ecb.cjs.dev.js} +2 -2
  98. package/dist/{ServerResponse-eae85b08.cjs.prod.js → ServerResponse-db87bde2.cjs.prod.js} +2 -2
  99. package/dist/{body-33521da5.cjs.prod.js → body-95276637.cjs.prod.js} +3 -3
  100. package/dist/{body-c7d7a944.cjs.dev.js → body-cea7c1c9.cjs.dev.js} +3 -3
  101. package/dist/{body-20d78ec1.esm.js → body-db8cfb3d.esm.js} +1 -1
  102. package/dist/{clientRequest-3e72ec54.cjs.prod.js → clientRequest-539df396.cjs.prod.js} +1 -1
  103. package/dist/{clientRequest-1e9e0b0d.esm.js → clientRequest-6121a7f6.esm.js} +1 -1
  104. package/dist/{clientRequest-423fd562.cjs.dev.js → clientRequest-dae0c34e.cjs.dev.js} +1 -1
  105. package/dist/declarations/src/Http/App.d.ts +28 -1
  106. package/dist/declarations/src/Http/App.d.ts.map +1 -1
  107. package/dist/declarations/src/Http/Middleware.d.ts +0 -5
  108. package/dist/declarations/src/Http/Middleware.d.ts.map +1 -1
  109. package/dist/declarations/src/index.d.ts.map +1 -1
  110. package/dist/effect-platform.cjs.dev.js +49 -68
  111. package/dist/effect-platform.cjs.prod.js +49 -68
  112. package/dist/effect-platform.esm.js +20 -58
  113. package/package.json +8 -5
  114. package/src/Http/App.ts +76 -3
  115. package/src/Http/Middleware.ts +0 -6
  116. package/src/index.ts +10 -10
  117. package/src/internal/http/middleware.ts +21 -19
  118. package/src/internal/http/router.ts +1 -1
  119. package/src/internal/http/serverResponse.ts +1 -1
  120. package/dist/App-0916639a.cjs.prod.js +0 -7
  121. package/dist/App-44aa3275.cjs.dev.js +0 -7
  122. package/dist/App-687366d8.esm.js +0 -5
  123. package/dist/Command-032c414c.cjs.dev.js +0 -446
  124. package/dist/Command-25ef5e94.cjs.prod.js +0 -446
  125. package/dist/Command-d8ab0c8d.esm.js +0 -403
  126. package/dist/CommandExecutor-158ea1d3.cjs.dev.js +0 -87
  127. package/dist/CommandExecutor-5807b66b.esm.js +0 -80
  128. package/dist/CommandExecutor-7fcae408.cjs.prod.js +0 -87
  129. package/dist/Effectify-2d8c3af9.cjs.dev.js +0 -66
  130. package/dist/Effectify-38757ba5.cjs.prod.js +0 -66
  131. package/dist/Effectify-e5a9d266.esm.js +0 -43
  132. package/dist/Error-09496a70.cjs.dev.js +0 -100
  133. package/dist/Error-2c4e6ce2.cjs.prod.js +0 -100
  134. package/dist/Error-3099667c.esm.js +0 -75
  135. package/dist/FileSystem-3d439a05.cjs.prod.js +0 -308
  136. package/dist/FileSystem-4c7daaf0.cjs.dev.js +0 -308
  137. package/dist/FileSystem-7e31dccd.esm.js +0 -271
  138. package/dist/HttpClient-44d9df26.cjs.prod.js +0 -26
  139. package/dist/HttpClient-5179b5b7.esm.js +0 -24
  140. package/dist/HttpClient-6782fcab.cjs.dev.js +0 -26
  141. package/dist/HttpServer-16159c3a.cjs.dev.js +0 -32
  142. package/dist/HttpServer-50f8df76.esm.js +0 -30
  143. package/dist/HttpServer-93c0fbb3.cjs.prod.js +0 -32
  144. package/dist/KeyValueStore-2f9a70bf.esm.js +0 -210
  145. package/dist/KeyValueStore-f6c5b981.cjs.prod.js +0 -244
  146. package/dist/KeyValueStore-f9c93610.cjs.dev.js +0 -244
  147. package/dist/Path-3574641f.cjs.prod.js +0 -154
  148. package/dist/Path-46f84ba7.esm.js +0 -128
  149. package/dist/Path-7ba7e370.cjs.dev.js +0 -154
  150. package/dist/Runtime-1edd577a.cjs.dev.js +0 -55
  151. package/dist/Runtime-515efccf.cjs.prod.js +0 -55
  152. package/dist/Runtime-7265fb98.esm.js +0 -31
  153. /package/dist/{clientResponse-47df36b8.esm.js → clientResponse-0ace0007.esm.js} +0 -0
  154. /package/dist/{clientResponse-2e4c45a9.cjs.dev.js → clientResponse-43bb73b9.cjs.dev.js} +0 -0
  155. /package/dist/{clientResponse-4d53f425.cjs.prod.js → clientResponse-82dae5d8.cjs.prod.js} +0 -0
@@ -2,27 +2,294 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('effect/Brand');
6
- var FileSystem_dist_effectPlatformFileSystem = require('../../dist/FileSystem-3d439a05.cjs.prod.js');
7
- require('effect/Context');
8
- require('effect/Effect');
9
- require('effect/Function');
10
- require('effect/Option');
11
- require('effect/Sink');
12
- require('effect/Stream');
13
- require('../../dist/Error-2c4e6ce2.cjs.prod.js');
5
+ var Brand = require('effect/Brand');
6
+ var Context = require('effect/Context');
7
+ var Effect = require('effect/Effect');
8
+ var Function = require('effect/Function');
9
+ var Option = require('effect/Option');
10
+ var Sink = require('effect/Sink');
11
+ var Stream = require('effect/Stream');
12
+ var Error_dist_effectPlatformError = require('../../Error/dist/effect-platform-Error.cjs.prod.js');
14
13
  require('effect/Data');
15
14
 
15
+ function _interopNamespace(e) {
16
+ if (e && e.__esModule) return e;
17
+ var n = Object.create(null);
18
+ if (e) {
19
+ Object.keys(e).forEach(function (k) {
20
+ if (k !== 'default') {
21
+ var d = Object.getOwnPropertyDescriptor(e, k);
22
+ Object.defineProperty(n, k, d.get ? d : {
23
+ enumerable: true,
24
+ get: function () { return e[k]; }
25
+ });
26
+ }
27
+ });
28
+ }
29
+ n["default"] = e;
30
+ return Object.freeze(n);
31
+ }
16
32
 
33
+ var Brand__namespace = /*#__PURE__*/_interopNamespace(Brand);
34
+ var Effect__namespace = /*#__PURE__*/_interopNamespace(Effect);
35
+ var Option__namespace = /*#__PURE__*/_interopNamespace(Option);
36
+ var Sink__namespace = /*#__PURE__*/_interopNamespace(Sink);
37
+ var Stream__namespace = /*#__PURE__*/_interopNamespace(Stream);
17
38
 
18
- exports.FileDescriptor = FileSystem_dist_effectPlatformFileSystem.FileDescriptor;
19
- exports.FileSystem = FileSystem_dist_effectPlatformFileSystem.FileSystem$1;
20
- exports.FileTypeId = FileSystem_dist_effectPlatformFileSystem.FileTypeId;
21
- exports.GiB = FileSystem_dist_effectPlatformFileSystem.GiB;
22
- exports.KiB = FileSystem_dist_effectPlatformFileSystem.KiB;
23
- exports.MiB = FileSystem_dist_effectPlatformFileSystem.MiB;
24
- exports.PiB = FileSystem_dist_effectPlatformFileSystem.PiB;
25
- exports.Size = FileSystem_dist_effectPlatformFileSystem.Size;
26
- exports.TiB = FileSystem_dist_effectPlatformFileSystem.TiB;
27
- exports.isFile = FileSystem_dist_effectPlatformFileSystem.isFile;
28
- exports.make = FileSystem_dist_effectPlatformFileSystem.make;
39
+ /** @internal */
40
+ const tag = /*#__PURE__*/Context.Tag("@effect/platform/FileSystem");
41
+
42
+ /** @internal */
43
+ const Size$1 = bytes => typeof bytes === "bigint" ? bytes : BigInt(bytes);
44
+
45
+ /** @internal */
46
+ const KiB$1 = n => Size$1(n * 1024);
47
+
48
+ /** @internal */
49
+ const MiB$1 = n => Size$1(n * 1024 * 1024);
50
+
51
+ /** @internal */
52
+ const GiB$1 = n => Size$1(n * 1024 * 1024 * 1024);
53
+
54
+ /** @internal */
55
+ const TiB$1 = n => Size$1(n * 1024 * 1024 * 1024 * 1024);
56
+ const bigint1024 = /*#__PURE__*/BigInt(1024);
57
+ const bigintPiB = bigint1024 * bigint1024 * bigint1024 * bigint1024 * bigint1024;
58
+
59
+ /** @internal */
60
+ const PiB$1 = n => Size$1(BigInt(n) * bigintPiB);
61
+
62
+ /** @internal */
63
+ const make$1 = impl => {
64
+ return tag.of({
65
+ ...impl,
66
+ exists: path => Function.pipe(impl.access(path), Effect__namespace.as(true), Effect__namespace.catchTag("SystemError", e => e.reason === "NotFound" ? Effect__namespace.succeed(false) : Effect__namespace.fail(e))),
67
+ readFileString: (path, encoding) => Effect__namespace.tryMap(impl.readFile(path), {
68
+ try: _ => new TextDecoder(encoding).decode(_),
69
+ catch: () => Error_dist_effectPlatformError.BadArgument({
70
+ module: "FileSystem",
71
+ method: "readFileString",
72
+ message: "invalid encoding"
73
+ })
74
+ }),
75
+ stream: (path, options) => Function.pipe(impl.open(path, {
76
+ flag: "r"
77
+ }), options?.offset ? Effect__namespace.tap(file => file.seek(options.offset, "start")) : Function.identity, Effect__namespace.map(file => stream(file, options)), Stream__namespace.unwrapScoped),
78
+ sink: (path, options) => Function.pipe(impl.open(path, {
79
+ flag: "w",
80
+ ...options
81
+ }), Effect__namespace.map(file => Sink__namespace.forEach(_ => file.writeAll(_))), Sink__namespace.unwrapScoped),
82
+ writeFileString: (path, data, options) => Effect__namespace.flatMap(Effect__namespace.try({
83
+ try: () => new TextEncoder().encode(data),
84
+ catch: () => Error_dist_effectPlatformError.BadArgument({
85
+ module: "FileSystem",
86
+ method: "writeFileString",
87
+ message: "could not encode string"
88
+ })
89
+ }), _ => impl.writeFile(path, _, options))
90
+ });
91
+ };
92
+
93
+ /** @internal */
94
+ const stream = (file, {
95
+ bufferSize = 4,
96
+ bytesToRead: bytesToRead_,
97
+ chunkSize: chunkSize_ = Size$1(64 * 1024)
98
+ } = {}) => {
99
+ const bytesToRead = bytesToRead_ !== undefined ? Size$1(bytesToRead_) : undefined;
100
+ const chunkSize = Size$1(chunkSize_);
101
+ return Stream__namespace.bufferChunks(Stream__namespace.unfoldEffect(BigInt(0), totalBytesRead => {
102
+ if (bytesToRead !== undefined && bytesToRead <= totalBytesRead) {
103
+ return Effect__namespace.succeed(Option__namespace.none());
104
+ }
105
+ const toRead = bytesToRead !== undefined && bytesToRead - totalBytesRead < chunkSize ? bytesToRead - totalBytesRead : chunkSize;
106
+ return Effect__namespace.map(file.readAlloc(toRead), Option__namespace.map(buf => [buf, Size$1(totalBytesRead + BigInt(buf.length))]));
107
+ }), {
108
+ capacity: bufferSize
109
+ });
110
+ };
111
+
112
+ /**
113
+ * @since 1.0.0
114
+ */
115
+
116
+ /**
117
+ * @since 1.0.0
118
+ * @category model
119
+ */
120
+
121
+ /**
122
+ * Represents a size in bytes.
123
+ *
124
+ * @since 1.0.0
125
+ * @category sizes
126
+ */
127
+
128
+ /**
129
+ * Represents a size in bytes.
130
+ *
131
+ * @since 1.0.0
132
+ * @category sizes
133
+ */
134
+
135
+ /**
136
+ * @since 1.0.0
137
+ * @category sizes
138
+ */
139
+ const Size = Size$1;
140
+
141
+ /**
142
+ * @since 1.0.0
143
+ * @category sizes
144
+ */
145
+ const KiB = KiB$1;
146
+
147
+ /**
148
+ * @since 1.0.0
149
+ * @category sizes
150
+ */
151
+ const MiB = MiB$1;
152
+
153
+ /**
154
+ * @since 1.0.0
155
+ * @category sizes
156
+ */
157
+ const GiB = GiB$1;
158
+
159
+ /**
160
+ * @since 1.0.0
161
+ * @category sizes
162
+ */
163
+ const TiB = TiB$1;
164
+
165
+ /**
166
+ * @since 1.0.0
167
+ * @category sizes
168
+ */
169
+ const PiB = PiB$1;
170
+
171
+ /**
172
+ * @since 1.0.0
173
+ * @category model
174
+ */
175
+
176
+ /**
177
+ * @since 1.0.0
178
+ * @category options
179
+ */
180
+
181
+ /**
182
+ * @since 1.0.0
183
+ * @category options
184
+ */
185
+
186
+ /**
187
+ * @since 1.0.0
188
+ * @category options
189
+ */
190
+
191
+ /**
192
+ * @since 1.0.0
193
+ * @category options
194
+ */
195
+
196
+ /**
197
+ * @since 1.0.0
198
+ * @category options
199
+ */
200
+
201
+ /**
202
+ * @since 1.0.0
203
+ * @category options
204
+ */
205
+
206
+ /**
207
+ * @since 1.0.0
208
+ * @category options
209
+ */
210
+
211
+ /**
212
+ * @since 1.0.0
213
+ * @category options
214
+ */
215
+
216
+ /**
217
+ * @since 1.0.0
218
+ * @category options
219
+ */
220
+
221
+ /**
222
+ * @since 1.0.0
223
+ * @category options
224
+ */
225
+
226
+ /**
227
+ * @since 1.0.0
228
+ * @category options
229
+ */
230
+
231
+ /**
232
+ * @since 1.0.0
233
+ * @category options
234
+ */
235
+
236
+ /**
237
+ * @since 1.0.0
238
+ * @category tag
239
+ */
240
+ const FileSystem = tag;
241
+
242
+ /**
243
+ * @since 1.0.0
244
+ * @category constructor
245
+ */
246
+ const make = make$1;
247
+
248
+ /**
249
+ * @since 1.0.0
250
+ * @category type id
251
+ */
252
+ const FileTypeId = /*#__PURE__*/Symbol.for("@effect/platform/FileSystem/File");
253
+
254
+ /**
255
+ * @since 1.0.0
256
+ * @category type id
257
+ */
258
+
259
+ /**
260
+ * @since 1.0.0
261
+ * @category guard
262
+ */
263
+ const isFile = u => typeof u === "object" && u !== null && FileTypeId in u;
264
+
265
+ /**
266
+ * @since 1.0.0
267
+ * @category model
268
+ */
269
+
270
+ /**
271
+ * @since 1.0.0
272
+ */
273
+
274
+ /**
275
+ * @since 1.0.0
276
+ * @category constructor
277
+ */
278
+ const FileDescriptor = /*#__PURE__*/Brand__namespace.nominal();
279
+
280
+ /**
281
+ * @since 1.0.0
282
+ * @category model
283
+ */
284
+
285
+ exports.FileDescriptor = FileDescriptor;
286
+ exports.FileSystem = FileSystem;
287
+ exports.FileTypeId = FileTypeId;
288
+ exports.GiB = GiB;
289
+ exports.KiB = KiB;
290
+ exports.MiB = MiB;
291
+ exports.PiB = PiB;
292
+ exports.Size = Size;
293
+ exports.TiB = TiB;
294
+ exports.isFile = isFile;
295
+ exports.make = make;
@@ -1,10 +1,257 @@
1
- import 'effect/Brand';
2
- export { c as FileDescriptor, a as FileSystem, b as FileTypeId, G as GiB, K as KiB, M as MiB, P as PiB, S as Size, T as TiB, i as isFile, m as make } from '../../dist/FileSystem-7e31dccd.esm.js';
3
- import 'effect/Context';
4
- import 'effect/Effect';
5
- import 'effect/Function';
6
- import 'effect/Option';
7
- import 'effect/Sink';
8
- import 'effect/Stream';
9
- import '../../dist/Error-3099667c.esm.js';
1
+ import * as Brand from 'effect/Brand';
2
+ import { Tag } from 'effect/Context';
3
+ import * as Effect from 'effect/Effect';
4
+ import { pipe, identity } from 'effect/Function';
5
+ import * as Option from 'effect/Option';
6
+ import * as Sink from 'effect/Sink';
7
+ import * as Stream from 'effect/Stream';
8
+ import { BadArgument } from '../../Error/dist/effect-platform-Error.esm.js';
10
9
  import 'effect/Data';
10
+
11
+ /** @internal */
12
+ const tag = /*#__PURE__*/Tag("@effect/platform/FileSystem");
13
+
14
+ /** @internal */
15
+ const Size$1 = bytes => typeof bytes === "bigint" ? bytes : BigInt(bytes);
16
+
17
+ /** @internal */
18
+ const KiB$1 = n => Size$1(n * 1024);
19
+
20
+ /** @internal */
21
+ const MiB$1 = n => Size$1(n * 1024 * 1024);
22
+
23
+ /** @internal */
24
+ const GiB$1 = n => Size$1(n * 1024 * 1024 * 1024);
25
+
26
+ /** @internal */
27
+ const TiB$1 = n => Size$1(n * 1024 * 1024 * 1024 * 1024);
28
+ const bigint1024 = /*#__PURE__*/BigInt(1024);
29
+ const bigintPiB = bigint1024 * bigint1024 * bigint1024 * bigint1024 * bigint1024;
30
+
31
+ /** @internal */
32
+ const PiB$1 = n => Size$1(BigInt(n) * bigintPiB);
33
+
34
+ /** @internal */
35
+ const make$1 = impl => {
36
+ return tag.of({
37
+ ...impl,
38
+ exists: path => pipe(impl.access(path), Effect.as(true), Effect.catchTag("SystemError", e => e.reason === "NotFound" ? Effect.succeed(false) : Effect.fail(e))),
39
+ readFileString: (path, encoding) => Effect.tryMap(impl.readFile(path), {
40
+ try: _ => new TextDecoder(encoding).decode(_),
41
+ catch: () => BadArgument({
42
+ module: "FileSystem",
43
+ method: "readFileString",
44
+ message: "invalid encoding"
45
+ })
46
+ }),
47
+ stream: (path, options) => pipe(impl.open(path, {
48
+ flag: "r"
49
+ }), options?.offset ? Effect.tap(file => file.seek(options.offset, "start")) : identity, Effect.map(file => stream(file, options)), Stream.unwrapScoped),
50
+ sink: (path, options) => pipe(impl.open(path, {
51
+ flag: "w",
52
+ ...options
53
+ }), Effect.map(file => Sink.forEach(_ => file.writeAll(_))), Sink.unwrapScoped),
54
+ writeFileString: (path, data, options) => Effect.flatMap(Effect.try({
55
+ try: () => new TextEncoder().encode(data),
56
+ catch: () => BadArgument({
57
+ module: "FileSystem",
58
+ method: "writeFileString",
59
+ message: "could not encode string"
60
+ })
61
+ }), _ => impl.writeFile(path, _, options))
62
+ });
63
+ };
64
+
65
+ /** @internal */
66
+ const stream = (file, {
67
+ bufferSize = 4,
68
+ bytesToRead: bytesToRead_,
69
+ chunkSize: chunkSize_ = Size$1(64 * 1024)
70
+ } = {}) => {
71
+ const bytesToRead = bytesToRead_ !== undefined ? Size$1(bytesToRead_) : undefined;
72
+ const chunkSize = Size$1(chunkSize_);
73
+ return Stream.bufferChunks(Stream.unfoldEffect(BigInt(0), totalBytesRead => {
74
+ if (bytesToRead !== undefined && bytesToRead <= totalBytesRead) {
75
+ return Effect.succeed(Option.none());
76
+ }
77
+ const toRead = bytesToRead !== undefined && bytesToRead - totalBytesRead < chunkSize ? bytesToRead - totalBytesRead : chunkSize;
78
+ return Effect.map(file.readAlloc(toRead), Option.map(buf => [buf, Size$1(totalBytesRead + BigInt(buf.length))]));
79
+ }), {
80
+ capacity: bufferSize
81
+ });
82
+ };
83
+
84
+ /**
85
+ * @since 1.0.0
86
+ */
87
+
88
+ /**
89
+ * @since 1.0.0
90
+ * @category model
91
+ */
92
+
93
+ /**
94
+ * Represents a size in bytes.
95
+ *
96
+ * @since 1.0.0
97
+ * @category sizes
98
+ */
99
+
100
+ /**
101
+ * Represents a size in bytes.
102
+ *
103
+ * @since 1.0.0
104
+ * @category sizes
105
+ */
106
+
107
+ /**
108
+ * @since 1.0.0
109
+ * @category sizes
110
+ */
111
+ const Size = Size$1;
112
+
113
+ /**
114
+ * @since 1.0.0
115
+ * @category sizes
116
+ */
117
+ const KiB = KiB$1;
118
+
119
+ /**
120
+ * @since 1.0.0
121
+ * @category sizes
122
+ */
123
+ const MiB = MiB$1;
124
+
125
+ /**
126
+ * @since 1.0.0
127
+ * @category sizes
128
+ */
129
+ const GiB = GiB$1;
130
+
131
+ /**
132
+ * @since 1.0.0
133
+ * @category sizes
134
+ */
135
+ const TiB = TiB$1;
136
+
137
+ /**
138
+ * @since 1.0.0
139
+ * @category sizes
140
+ */
141
+ const PiB = PiB$1;
142
+
143
+ /**
144
+ * @since 1.0.0
145
+ * @category model
146
+ */
147
+
148
+ /**
149
+ * @since 1.0.0
150
+ * @category options
151
+ */
152
+
153
+ /**
154
+ * @since 1.0.0
155
+ * @category options
156
+ */
157
+
158
+ /**
159
+ * @since 1.0.0
160
+ * @category options
161
+ */
162
+
163
+ /**
164
+ * @since 1.0.0
165
+ * @category options
166
+ */
167
+
168
+ /**
169
+ * @since 1.0.0
170
+ * @category options
171
+ */
172
+
173
+ /**
174
+ * @since 1.0.0
175
+ * @category options
176
+ */
177
+
178
+ /**
179
+ * @since 1.0.0
180
+ * @category options
181
+ */
182
+
183
+ /**
184
+ * @since 1.0.0
185
+ * @category options
186
+ */
187
+
188
+ /**
189
+ * @since 1.0.0
190
+ * @category options
191
+ */
192
+
193
+ /**
194
+ * @since 1.0.0
195
+ * @category options
196
+ */
197
+
198
+ /**
199
+ * @since 1.0.0
200
+ * @category options
201
+ */
202
+
203
+ /**
204
+ * @since 1.0.0
205
+ * @category options
206
+ */
207
+
208
+ /**
209
+ * @since 1.0.0
210
+ * @category tag
211
+ */
212
+ const FileSystem = tag;
213
+
214
+ /**
215
+ * @since 1.0.0
216
+ * @category constructor
217
+ */
218
+ const make = make$1;
219
+
220
+ /**
221
+ * @since 1.0.0
222
+ * @category type id
223
+ */
224
+ const FileTypeId = /*#__PURE__*/Symbol.for("@effect/platform/FileSystem/File");
225
+
226
+ /**
227
+ * @since 1.0.0
228
+ * @category type id
229
+ */
230
+
231
+ /**
232
+ * @since 1.0.0
233
+ * @category guard
234
+ */
235
+ const isFile = u => typeof u === "object" && u !== null && FileTypeId in u;
236
+
237
+ /**
238
+ * @since 1.0.0
239
+ * @category model
240
+ */
241
+
242
+ /**
243
+ * @since 1.0.0
244
+ */
245
+
246
+ /**
247
+ * @since 1.0.0
248
+ * @category constructor
249
+ */
250
+ const FileDescriptor = /*#__PURE__*/Brand.nominal();
251
+
252
+ /**
253
+ * @since 1.0.0
254
+ * @category model
255
+ */
256
+
257
+ export { FileDescriptor, FileSystem, FileTypeId, GiB, KiB, MiB, PiB, Size, TiB, isFile, make };
@@ -1,2 +1,17 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('effect/Effect');
6
+ require('effect/FiberRef');
7
+ require('effect/Function');
8
+ require('effect/GlobalValue');
9
+ require('effect/ReadonlyArray');
10
+ var Http_App_dist_effectPlatformHttpApp = require('../../../dist/App-18152f12.cjs.dev.js');
11
+
12
+
13
+
14
+ exports.appendPreResponseHandler = Http_App_dist_effectPlatformHttpApp.appendPreResponseHandler;
15
+ exports.currentPreResponseHandlers = Http_App_dist_effectPlatformHttpApp.currentPreResponseHandlers;
16
+ exports.preResponseHandler = Http_App_dist_effectPlatformHttpApp.preResponseHandler;
17
+ exports.withPreResponseHandler = Http_App_dist_effectPlatformHttpApp.withPreResponseHandler;
@@ -1 +1,6 @@
1
- import "./effect-platform-Http-App.cjs.js";
1
+ export {
2
+ appendPreResponseHandler,
3
+ currentPreResponseHandlers,
4
+ preResponseHandler,
5
+ withPreResponseHandler
6
+ } from "./effect-platform-Http-App.cjs.js";
@@ -1,2 +1,17 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('effect/Effect');
6
+ require('effect/FiberRef');
7
+ require('effect/Function');
8
+ require('effect/GlobalValue');
9
+ require('effect/ReadonlyArray');
10
+ var Http_App_dist_effectPlatformHttpApp = require('../../../dist/App-d8b904fa.cjs.prod.js');
11
+
12
+
13
+
14
+ exports.appendPreResponseHandler = Http_App_dist_effectPlatformHttpApp.appendPreResponseHandler;
15
+ exports.currentPreResponseHandlers = Http_App_dist_effectPlatformHttpApp.currentPreResponseHandlers;
16
+ exports.preResponseHandler = Http_App_dist_effectPlatformHttpApp.preResponseHandler;
17
+ exports.withPreResponseHandler = Http_App_dist_effectPlatformHttpApp.withPreResponseHandler;
@@ -1 +1,6 @@
1
-
1
+ import 'effect/Effect';
2
+ import 'effect/FiberRef';
3
+ import 'effect/Function';
4
+ import 'effect/GlobalValue';
5
+ import 'effect/ReadonlyArray';
6
+ export { a as appendPreResponseHandler, c as currentPreResponseHandlers, p as preResponseHandler, w as withPreResponseHandler } from '../../../dist/App-1ca51fa7.esm.js';
@@ -2,19 +2,19 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('../../../dist/body-c7d7a944.cjs.dev.js');
6
- var Http_Body_dist_effectPlatformHttpBody = require('../../../dist/Body-86ef2922.cjs.dev.js');
5
+ require('../../../dist/body-cea7c1c9.cjs.dev.js');
6
+ var Http_Body_dist_effectPlatformHttpBody = require('../../../dist/Body-4a7ad057.cjs.dev.js');
7
7
  require('@effect/schema/Schema');
8
8
  require('effect/Data');
9
9
  require('effect/Effect');
10
10
  require('effect/Function');
11
11
  require('effect/Stream');
12
- require('../../../dist/FileSystem-4c7daaf0.cjs.dev.js');
12
+ require('../../../FileSystem/dist/effect-platform-FileSystem.cjs.dev.js');
13
13
  require('effect/Brand');
14
14
  require('effect/Context');
15
15
  require('effect/Option');
16
16
  require('effect/Sink');
17
- require('../../../dist/Error-09496a70.cjs.dev.js');
17
+ require('../../../Error/dist/effect-platform-Error.cjs.dev.js');
18
18
 
19
19
 
20
20
 
@@ -2,19 +2,19 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('../../../dist/body-33521da5.cjs.prod.js');
6
- var Http_Body_dist_effectPlatformHttpBody = require('../../../dist/Body-b77eac75.cjs.prod.js');
5
+ require('../../../dist/body-95276637.cjs.prod.js');
6
+ var Http_Body_dist_effectPlatformHttpBody = require('../../../dist/Body-c26fa93f.cjs.prod.js');
7
7
  require('@effect/schema/Schema');
8
8
  require('effect/Data');
9
9
  require('effect/Effect');
10
10
  require('effect/Function');
11
11
  require('effect/Stream');
12
- require('../../../dist/FileSystem-3d439a05.cjs.prod.js');
12
+ require('../../../FileSystem/dist/effect-platform-FileSystem.cjs.prod.js');
13
13
  require('effect/Brand');
14
14
  require('effect/Context');
15
15
  require('effect/Option');
16
16
  require('effect/Sink');
17
- require('../../../dist/Error-2c4e6ce2.cjs.prod.js');
17
+ require('../../../Error/dist/effect-platform-Error.cjs.prod.js');
18
18
 
19
19
 
20
20
 
@@ -1,13 +1,13 @@
1
- import '../../../dist/body-20d78ec1.esm.js';
2
- export { a as BodyError, E as ErrorTypeId, T as TypeId, e as empty, d as file, g as fileInfo, h as fileWeb, f as formData, j as json, c as jsonSchema, r as raw, s as stream, t as text, u as uint8Array, b as unsafeJson } from '../../../dist/Body-ec1353f9.esm.js';
1
+ import '../../../dist/body-db8cfb3d.esm.js';
2
+ export { a as BodyError, E as ErrorTypeId, T as TypeId, e as empty, d as file, g as fileInfo, h as fileWeb, f as formData, j as json, c as jsonSchema, r as raw, s as stream, t as text, u as uint8Array, b as unsafeJson } from '../../../dist/Body-40ced606.esm.js';
3
3
  import '@effect/schema/Schema';
4
4
  import 'effect/Data';
5
5
  import 'effect/Effect';
6
6
  import 'effect/Function';
7
7
  import 'effect/Stream';
8
- import '../../../dist/FileSystem-7e31dccd.esm.js';
8
+ import '../../../FileSystem/dist/effect-platform-FileSystem.esm.js';
9
9
  import 'effect/Brand';
10
10
  import 'effect/Context';
11
11
  import 'effect/Option';
12
12
  import 'effect/Sink';
13
- import '../../../dist/Error-3099667c.esm.js';
13
+ import '../../../Error/dist/effect-platform-Error.esm.js';