effect-start 0.22.1 → 0.23.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 (313) hide show
  1. package/dist/BlobStore.d.ts +80 -0
  2. package/dist/BlobStore.js +19 -0
  3. package/dist/ChildProcess.d.ts +60 -0
  4. package/dist/ChildProcess.js +30 -0
  5. package/dist/Commander.d.ts +3 -6
  6. package/dist/Commander.js +6 -13
  7. package/dist/ContentNegotiation.d.ts +8 -9
  8. package/dist/ContentNegotiation.js +32 -37
  9. package/dist/Cookies.d.ts +47 -0
  10. package/dist/Cookies.js +273 -363
  11. package/dist/Development.d.ts +2 -2
  12. package/dist/Development.js +3 -4
  13. package/dist/Effectify.d.ts +1 -4
  14. package/dist/FilePathPattern.d.ts +3 -3
  15. package/dist/FileRouter.d.ts +5 -8
  16. package/dist/FileRouter.js +9 -10
  17. package/dist/FileRouterCodegen.d.ts +1 -1
  18. package/dist/FileRouterCodegen.js +33 -13
  19. package/dist/FileSystem.d.ts +158 -0
  20. package/dist/FileSystem.js +64 -125
  21. package/dist/Http.js +2 -6
  22. package/dist/PathPattern.d.ts +7 -7
  23. package/dist/PathPattern.js +1 -3
  24. package/dist/PlatformError.d.ts +24 -32
  25. package/dist/PlatformError.js +3 -21
  26. package/dist/PlatformRuntime.js +5 -10
  27. package/dist/Route.d.ts +14 -19
  28. package/dist/Route.js +8 -11
  29. package/dist/RouteBody.d.ts +6 -12
  30. package/dist/RouteBody.js +2 -2
  31. package/dist/RouteError.d.ts +98 -0
  32. package/dist/RouteError.js +55 -0
  33. package/dist/RouteHook.js +6 -11
  34. package/dist/RouteHttp.d.ts +3 -3
  35. package/dist/RouteHttp.js +27 -22
  36. package/dist/RouteMount.d.ts +16 -50
  37. package/dist/RouteMount.js +6 -20
  38. package/dist/RouteSchema.d.ts +22 -1
  39. package/dist/RouteSchema.js +33 -0
  40. package/dist/RouteSse.js +4 -10
  41. package/dist/RouteTree.d.ts +2 -1
  42. package/dist/RouteTree.js +17 -15
  43. package/dist/RouteTrie.d.ts +2 -2
  44. package/dist/RouteTrie.js +4 -9
  45. package/dist/SchemaExtra.d.ts +1 -1
  46. package/dist/Socket.d.ts +27 -0
  47. package/dist/Socket.js +20 -28
  48. package/dist/Sql.d.ts +34 -0
  49. package/dist/Sql.js +5 -0
  50. package/dist/SqlIntrospect.d.ts +91 -0
  51. package/dist/SqlIntrospect.js +466 -0
  52. package/dist/Start.d.ts +4 -6
  53. package/dist/Start.js +10 -2
  54. package/dist/StreamExtra.d.ts +1 -1
  55. package/dist/StreamExtra.js +9 -9
  56. package/dist/System.d.ts +7 -0
  57. package/dist/System.js +22 -0
  58. package/dist/TuplePathPattern.js +55 -50
  59. package/dist/Unique.js +7 -7
  60. package/dist/Values.d.ts +2 -1
  61. package/dist/Values.js +19 -13
  62. package/dist/bun/BunBlobStoreDisk.d.ts +6 -0
  63. package/dist/bun/BunBlobStoreDisk.js +116 -0
  64. package/dist/bun/BunBlobStoreS3.d.ts +11 -0
  65. package/dist/bun/BunBlobStoreS3.js +89 -0
  66. package/dist/bun/BunBlobWatcherDisk.d.ts +6 -0
  67. package/dist/bun/BunBlobWatcherDisk.js +60 -0
  68. package/dist/bun/BunBlobWatcherQueue.d.ts +6 -0
  69. package/dist/bun/BunBlobWatcherQueue.js +17 -0
  70. package/dist/bun/BunBundle.d.ts +5 -6
  71. package/dist/bun/BunBundle.js +7 -15
  72. package/dist/bun/BunChildProcessSpawner.d.ts +3 -0
  73. package/dist/bun/BunChildProcessSpawner.js +103 -0
  74. package/dist/bun/BunImportTrackerPlugin.d.ts +1 -1
  75. package/dist/bun/BunImportTrackerPlugin.js +3 -5
  76. package/dist/bun/BunRoute.d.ts +3 -2
  77. package/dist/bun/BunRoute.js +5 -7
  78. package/dist/bun/BunRuntime.js +1 -1
  79. package/dist/bun/BunServer.d.ts +11 -4
  80. package/dist/bun/BunServer.js +35 -11
  81. package/dist/bun/BunSql.d.ts +4 -0
  82. package/dist/bun/BunSql.js +81 -0
  83. package/dist/bun/_BunEnhancedResolve.d.ts +3 -3
  84. package/dist/bun/_BunEnhancedResolve.js +2 -4
  85. package/dist/bun/index.d.ts +1 -0
  86. package/dist/bun/index.js +1 -0
  87. package/dist/bundler/Bundle.d.ts +2 -1
  88. package/dist/bundler/Bundle.js +1 -1
  89. package/dist/bundler/BundleFiles.d.ts +5 -5
  90. package/dist/bundler/BundleFiles.js +10 -8
  91. package/dist/bundler/BundleRoute.d.ts +27 -0
  92. package/dist/bundler/BundleRoute.js +51 -0
  93. package/dist/client/ScrollState.js +2 -6
  94. package/dist/client/index.js +6 -8
  95. package/dist/console/Console.d.ts +6 -0
  96. package/dist/console/Console.js +26 -0
  97. package/dist/console/ConsoleErrors.d.ts +3 -0
  98. package/dist/console/ConsoleErrors.js +200 -0
  99. package/dist/console/ConsoleLogger.d.ts +3 -0
  100. package/dist/console/ConsoleLogger.js +47 -0
  101. package/dist/console/ConsoleMetrics.d.ts +3 -0
  102. package/dist/console/ConsoleMetrics.js +61 -0
  103. package/dist/console/ConsoleProcess.d.ts +3 -0
  104. package/dist/console/ConsoleProcess.js +49 -0
  105. package/dist/console/ConsoleStore.d.ts +144 -0
  106. package/dist/console/ConsoleStore.js +61 -0
  107. package/dist/console/ConsoleTracer.d.ts +3 -0
  108. package/dist/console/ConsoleTracer.js +94 -0
  109. package/dist/console/Simulation.d.ts +2 -0
  110. package/dist/console/Simulation.js +633 -0
  111. package/dist/console/index.d.ts +3 -0
  112. package/dist/console/index.js +3 -0
  113. package/dist/console/routes/errors/route.d.ts +10 -0
  114. package/dist/console/routes/errors/route.js +47 -0
  115. package/dist/console/routes/fiberDetail.d.ts +16 -0
  116. package/dist/console/routes/fiberDetail.js +38 -0
  117. package/dist/console/routes/fibers/route.d.ts +10 -0
  118. package/dist/console/routes/fibers/route.js +19 -0
  119. package/dist/console/routes/git/route.d.ts +11 -0
  120. package/dist/console/routes/git/route.js +33 -0
  121. package/dist/console/routes/layout.d.ts +9 -0
  122. package/dist/console/routes/layout.js +3 -0
  123. package/dist/console/routes/logs/route.d.ts +10 -0
  124. package/dist/console/routes/logs/route.js +32 -0
  125. package/dist/console/routes/metrics/route.d.ts +10 -0
  126. package/dist/console/routes/metrics/route.js +17 -0
  127. package/dist/console/routes/route.d.ts +6 -0
  128. package/dist/console/routes/route.js +5 -0
  129. package/dist/console/routes/routes/route.d.ts +6 -0
  130. package/dist/console/routes/routes/route.js +20 -0
  131. package/dist/console/routes/services/route.d.ts +6 -0
  132. package/dist/console/routes/services/route.js +12 -0
  133. package/dist/console/routes/system/route.d.ts +10 -0
  134. package/dist/console/routes/system/route.js +18 -0
  135. package/dist/console/routes/traceDetail.d.ts +16 -0
  136. package/dist/console/routes/traceDetail.js +14 -0
  137. package/dist/console/routes/traces/route.d.ts +10 -0
  138. package/dist/console/routes/traces/route.js +39 -0
  139. package/dist/console/routes/tree.d.ts +153 -0
  140. package/dist/console/routes/tree.js +29 -0
  141. package/dist/console/ui/Errors.d.ts +4 -0
  142. package/dist/console/ui/Errors.js +15 -0
  143. package/dist/console/ui/Fibers.d.ts +24 -0
  144. package/dist/console/ui/Fibers.js +121 -0
  145. package/dist/console/ui/Git.d.ts +20 -0
  146. package/dist/console/ui/Git.js +95 -0
  147. package/dist/console/ui/Logs.d.ts +4 -0
  148. package/dist/console/ui/Logs.js +25 -0
  149. package/dist/console/ui/Metrics.d.ts +4 -0
  150. package/dist/console/ui/Metrics.js +26 -0
  151. package/dist/console/ui/Routes.d.ts +8 -0
  152. package/dist/console/ui/Routes.js +70 -0
  153. package/dist/console/ui/Services.d.ts +10 -0
  154. package/dist/console/ui/Services.js +246 -0
  155. package/dist/console/ui/Shell.d.ts +10 -0
  156. package/dist/console/ui/Shell.js +7 -0
  157. package/dist/console/ui/System.d.ts +4 -0
  158. package/dist/console/ui/System.js +35 -0
  159. package/dist/console/ui/Traces.d.ts +12 -0
  160. package/dist/console/ui/Traces.js +179 -0
  161. package/dist/datastar/actions/fetch.d.ts +1 -1
  162. package/dist/datastar/actions/fetch.js +10 -18
  163. package/dist/datastar/actions/peek.js +1 -2
  164. package/dist/datastar/actions/setAll.js +1 -2
  165. package/dist/datastar/actions/toggleAll.js +1 -2
  166. package/dist/datastar/attributes/attr.js +1 -2
  167. package/dist/datastar/attributes/bind.js +10 -18
  168. package/dist/datastar/attributes/class.js +2 -5
  169. package/dist/datastar/attributes/computed.js +2 -3
  170. package/dist/datastar/attributes/effect.js +1 -2
  171. package/dist/datastar/attributes/indicator.js +2 -4
  172. package/dist/datastar/attributes/init.js +2 -3
  173. package/dist/datastar/attributes/jsonSignals.js +1 -2
  174. package/dist/datastar/attributes/on.js +41 -22
  175. package/dist/datastar/attributes/onIntersect.js +2 -3
  176. package/dist/datastar/attributes/onInterval.js +2 -3
  177. package/dist/datastar/attributes/onSignalPatch.js +2 -4
  178. package/dist/datastar/attributes/ref.js +1 -2
  179. package/dist/datastar/attributes/show.js +1 -2
  180. package/dist/datastar/attributes/signals.js +1 -2
  181. package/dist/datastar/attributes/style.js +6 -12
  182. package/dist/datastar/attributes/text.js +1 -2
  183. package/dist/datastar/engine.d.ts +13 -7
  184. package/dist/datastar/engine.js +76 -48
  185. package/dist/datastar/happydom.d.ts +1 -0
  186. package/dist/datastar/happydom.js +8 -0
  187. package/dist/datastar/index.d.ts +1 -1
  188. package/dist/datastar/index.js +1 -1
  189. package/dist/datastar/utils.js +4 -7
  190. package/dist/datastar/watchers/patchElements.js +24 -45
  191. package/dist/datastar/watchers/patchSignals.js +1 -2
  192. package/dist/experimental/EncryptedCookies.d.ts +2 -5
  193. package/dist/experimental/EncryptedCookies.js +17 -48
  194. package/dist/experimental/index.d.ts +0 -1
  195. package/dist/experimental/index.js +0 -1
  196. package/dist/hyper/Hyper.d.ts +2 -9
  197. package/dist/hyper/Hyper.js +1 -12
  198. package/dist/hyper/HyperHtml.d.ts +1 -1
  199. package/dist/hyper/HyperHtml.js +18 -12
  200. package/dist/hyper/HyperHtml.test.d.ts +1 -0
  201. package/dist/hyper/HyperHtml.test.js +197 -0
  202. package/dist/hyper/HyperRoute.test.js +14 -3
  203. package/dist/hyper/html.d.ts +11 -0
  204. package/dist/hyper/html.js +30 -0
  205. package/dist/hyper/index.d.ts +2 -0
  206. package/dist/hyper/index.js +1 -0
  207. package/dist/hyper/jsx-runtime.d.ts +1 -1
  208. package/dist/hyper/jsx-runtime.js +1 -1
  209. package/dist/index.d.ts +1 -0
  210. package/dist/index.js +1 -0
  211. package/dist/lint/plugin.d.ts +86 -0
  212. package/dist/lint/plugin.js +341 -0
  213. package/dist/node/NodeFileSystem.d.ts +2 -2
  214. package/dist/node/NodeFileSystem.js +4 -14
  215. package/dist/sql/bun/index.d.ts +3 -0
  216. package/dist/sql/bun/index.js +75 -0
  217. package/dist/sql/mssql/docker.d.ts +2 -0
  218. package/dist/sql/mssql/docker.js +67 -0
  219. package/dist/sql/mssql/index.d.ts +21 -0
  220. package/dist/sql/mssql/index.js +113 -0
  221. package/dist/testing/TestLogger.js +4 -1
  222. package/dist/testing/index.d.ts +0 -1
  223. package/dist/testing/index.js +0 -1
  224. package/dist/testing/utils.d.ts +3 -3
  225. package/dist/testing/utils.js +4 -4
  226. package/dist/x/cloudflare/CloudflareTunnel.d.ts +2 -5
  227. package/dist/x/cloudflare/CloudflareTunnel.js +14 -27
  228. package/dist/x/datastar/Datastar.d.ts +1 -1
  229. package/dist/x/datastar/Datastar.js +13 -12
  230. package/dist/x/datastar/index.d.ts +1 -2
  231. package/dist/x/datastar/index.js +1 -2
  232. package/dist/x/tailscale/TailscaleTunnel.d.ts +15 -0
  233. package/dist/x/tailscale/TailscaleTunnel.js +68 -0
  234. package/dist/x/tailscale/index.d.ts +1 -0
  235. package/dist/x/tailscale/index.js +1 -0
  236. package/dist/x/tailwind/TailwindPlugin.js +19 -19
  237. package/dist/x/tailwind/compile.d.ts +2 -2
  238. package/dist/x/tailwind/compile.js +2 -4
  239. package/package.json +22 -9
  240. package/src/ChildProcess.ts +145 -0
  241. package/src/PlatformError.ts +27 -50
  242. package/src/Route.ts +2 -2
  243. package/src/RouteError.ts +76 -0
  244. package/src/RouteHttp.ts +13 -5
  245. package/src/RouteSchema.ts +96 -1
  246. package/src/RouteTree.ts +12 -0
  247. package/src/Sql.ts +51 -0
  248. package/src/SqlIntrospect.ts +620 -0
  249. package/src/Start.ts +15 -3
  250. package/src/System.ts +43 -0
  251. package/src/Values.ts +7 -0
  252. package/src/bun/BunChildProcessSpawner.ts +143 -0
  253. package/src/bun/BunRoute.ts +5 -2
  254. package/src/bun/BunServer.ts +22 -1
  255. package/src/bun/index.ts +1 -0
  256. package/src/bundler/BundleRoute.ts +66 -0
  257. package/src/console/Console.ts +42 -0
  258. package/src/console/ConsoleErrors.ts +213 -0
  259. package/src/console/ConsoleLogger.ts +56 -0
  260. package/src/console/ConsoleMetrics.ts +72 -0
  261. package/src/console/ConsoleProcess.ts +59 -0
  262. package/src/console/ConsoleStore.ts +187 -0
  263. package/src/console/ConsoleTracer.ts +107 -0
  264. package/src/console/Simulation.ts +814 -0
  265. package/src/console/console.html +340 -0
  266. package/src/console/index.ts +3 -0
  267. package/src/console/routes/errors/route.tsx +97 -0
  268. package/src/console/routes/fiberDetail.tsx +54 -0
  269. package/src/console/routes/fibers/route.tsx +45 -0
  270. package/src/console/routes/git/route.tsx +64 -0
  271. package/src/console/routes/layout.tsx +4 -0
  272. package/src/console/routes/logs/route.tsx +77 -0
  273. package/src/console/routes/metrics/route.tsx +36 -0
  274. package/src/console/routes/route.tsx +8 -0
  275. package/src/console/routes/routes/route.tsx +30 -0
  276. package/src/console/routes/services/route.tsx +21 -0
  277. package/src/console/routes/system/route.tsx +43 -0
  278. package/src/console/routes/traceDetail.tsx +22 -0
  279. package/src/console/routes/traces/route.tsx +81 -0
  280. package/src/console/routes/tree.ts +30 -0
  281. package/src/console/ui/Errors.tsx +76 -0
  282. package/src/console/ui/Fibers.tsx +321 -0
  283. package/src/console/ui/Git.tsx +182 -0
  284. package/src/console/ui/Logs.tsx +46 -0
  285. package/src/console/ui/Metrics.tsx +78 -0
  286. package/src/console/ui/Routes.tsx +125 -0
  287. package/src/console/ui/Services.tsx +273 -0
  288. package/src/console/ui/Shell.tsx +62 -0
  289. package/src/console/ui/System.tsx +131 -0
  290. package/src/console/ui/Traces.tsx +426 -0
  291. package/src/datastar/README.md +6 -1
  292. package/src/datastar/actions/fetch.ts +0 -1
  293. package/src/datastar/attributes/on.ts +40 -20
  294. package/src/datastar/engine.ts +51 -0
  295. package/src/datastar/jsx.d.ts +79 -0
  296. package/src/hyper/Hyper.ts +1 -16
  297. package/src/hyper/HyperHtml.ts +6 -4
  298. package/src/hyper/HyperRoute.ts +2 -1
  299. package/src/hyper/html.ts +47 -0
  300. package/src/hyper/index.ts +2 -0
  301. package/src/hyper/jsx.d.ts +5 -3
  302. package/src/index.ts +1 -0
  303. package/src/lint/plugin.js +129 -0
  304. package/src/sql/bun/index.ts +147 -0
  305. package/src/sql/mssql/docker.ts +117 -0
  306. package/src/sql/mssql/index.ts +223 -0
  307. package/src/sql/mssql/mssql.d.ts +41 -0
  308. package/src/x/cloudflare/CloudflareTunnel.ts +8 -36
  309. package/src/x/tailscale/TailscaleTunnel.ts +113 -0
  310. package/src/x/tailscale/index.ts +1 -0
  311. package/src/x/datastar/Datastar.ts +0 -61
  312. package/src/x/datastar/index.ts +0 -2
  313. package/src/x/datastar/jsx-datastar.d.ts +0 -60
@@ -0,0 +1,80 @@
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import type * as Option from "effect/Option";
4
+ import * as Stream from "effect/Stream";
5
+ import type * as PlatformError from "./PlatformError.ts";
6
+ export interface BlobInfo {
7
+ readonly size: number;
8
+ readonly lastModified: Option.Option<Date>;
9
+ readonly etag: Option.Option<string>;
10
+ readonly type: Option.Option<string>;
11
+ }
12
+ export interface BlobRef {
13
+ readonly key: string;
14
+ readonly bytes: Effect.Effect<Uint8Array, PlatformError.PlatformError>;
15
+ readonly text: Effect.Effect<string, PlatformError.PlatformError>;
16
+ readonly json: Effect.Effect<unknown, PlatformError.PlatformError>;
17
+ readonly stat: Effect.Effect<BlobInfo, PlatformError.PlatformError>;
18
+ readonly exists: Effect.Effect<boolean, PlatformError.PlatformError>;
19
+ readonly delete: Effect.Effect<void, PlatformError.PlatformError>;
20
+ readonly stream: Stream.Stream<Uint8Array, PlatformError.PlatformError>;
21
+ readonly write: (data: string | Uint8Array | ArrayBuffer) => Effect.Effect<void, PlatformError.PlatformError>;
22
+ readonly slice: (begin?: number, end?: number) => BlobRef;
23
+ }
24
+ export interface ListEntry {
25
+ readonly key: string;
26
+ readonly size: Option.Option<number>;
27
+ readonly lastModified: Option.Option<Date>;
28
+ readonly etag: Option.Option<string>;
29
+ }
30
+ export interface ListOptions {
31
+ readonly prefix?: string;
32
+ }
33
+ export interface PresignOptions {
34
+ readonly expiresIn?: number;
35
+ readonly method?: "GET" | "PUT" | "DELETE" | "HEAD";
36
+ }
37
+ declare const BlobStore_base: Context.TagClass<BlobStore, "effect-start/BlobStore", {
38
+ readonly ref: (key: string) => Effect.Effect<BlobRef, PlatformError.PlatformError>;
39
+ readonly list: (options?: ListOptions) => Stream.Stream<ListEntry, PlatformError.PlatformError>;
40
+ readonly presign: (key: string, options?: PresignOptions) => Effect.Effect<string, PlatformError.PlatformError>;
41
+ }>;
42
+ export declare class BlobStore extends BlobStore_base {
43
+ }
44
+ declare const WatchEventCreated_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]; }) => Readonly<A> & {
45
+ readonly _tag: "Created";
46
+ };
47
+ export declare class WatchEventCreated extends WatchEventCreated_base<{
48
+ readonly key: string;
49
+ }> {
50
+ }
51
+ declare const WatchEventUpdated_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]; }) => Readonly<A> & {
52
+ readonly _tag: "Updated";
53
+ };
54
+ export declare class WatchEventUpdated extends WatchEventUpdated_base<{
55
+ readonly key: string;
56
+ }> {
57
+ }
58
+ declare const WatchEventDeleted_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]; }) => Readonly<A> & {
59
+ readonly _tag: "Deleted";
60
+ };
61
+ export declare class WatchEventDeleted extends WatchEventDeleted_base<{
62
+ readonly key: string;
63
+ }> {
64
+ }
65
+ export type WatchEvent = WatchEventCreated | WatchEventUpdated | WatchEventDeleted;
66
+ export interface WatchOptions {
67
+ readonly prefix?: string;
68
+ }
69
+ declare const BlobWatcher_base: Context.TagClass<BlobWatcher, "effect-start/BlobWatcher", {
70
+ readonly watch: (options?: WatchOptions) => Stream.Stream<WatchEvent, PlatformError.PlatformError>;
71
+ readonly notify: (event: WatchEvent) => Effect.Effect<boolean, PlatformError.PlatformError>;
72
+ }>;
73
+ export declare class BlobWatcher extends BlobWatcher_base {
74
+ }
75
+ export declare const watch: (options?: WatchOptions) => Stream.Stream<WatchEvent, PlatformError.PlatformError, BlobWatcher>;
76
+ export declare const notify: (event: WatchEvent) => Effect.Effect<boolean, PlatformError.PlatformError, BlobWatcher>;
77
+ export declare const ref: (key: string) => Effect.Effect<BlobRef, PlatformError.PlatformError, BlobStore>;
78
+ export declare const list: (options?: ListOptions) => Stream.Stream<ListEntry, PlatformError.PlatformError, BlobStore>;
79
+ export declare const presign: (key: string, options?: PresignOptions) => Effect.Effect<string, PlatformError.PlatformError, BlobStore>;
80
+ export {};
@@ -0,0 +1,19 @@
1
+ import * as Context from "effect/Context";
2
+ import * as Data from "effect/Data";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Stream from "effect/Stream";
5
+ export class BlobStore extends Context.Tag("effect-start/BlobStore")() {
6
+ }
7
+ export class WatchEventCreated extends Data.TaggedClass("Created") {
8
+ }
9
+ export class WatchEventUpdated extends Data.TaggedClass("Updated") {
10
+ }
11
+ export class WatchEventDeleted extends Data.TaggedClass("Deleted") {
12
+ }
13
+ export class BlobWatcher extends Context.Tag("effect-start/BlobWatcher")() {
14
+ }
15
+ export const watch = (options) => Stream.unwrap(Effect.map(BlobWatcher, (watcher) => watcher.watch(options)));
16
+ export const notify = (event) => Effect.flatMap(BlobWatcher, (watcher) => watcher.notify(event));
17
+ export const ref = (key) => Effect.flatMap(BlobStore, (store) => store.ref(key));
18
+ export const list = (options) => Stream.unwrap(Effect.map(BlobStore, (store) => store.list(options)));
19
+ export const presign = (key, options) => Effect.flatMap(BlobStore, (store) => store.presign(key, options));
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Adapted from upcomnig Effect 4 aka effect-smol.
3
+ *
4
+ * Kept a minimal interface without tempaltes and file descirptor
5
+ * to keep it compatible if it lands in the core (ie. not in seperate platform package.)
6
+ */
7
+ import * as Context from "effect/Context";
8
+ import * as Effect from "effect/Effect";
9
+ import * as Pipeable from "effect/Pipeable";
10
+ import type * as Scope from "effect/Scope";
11
+ import type * as Sink from "effect/Sink";
12
+ import type * as Stream from "effect/Stream";
13
+ import type * as PlatformError from "./PlatformError.ts";
14
+ declare const TypeId: unique symbol;
15
+ type TypeId = typeof TypeId;
16
+ type Stdio = "pipe" | "inherit" | "ignore";
17
+ export interface Command extends Pipeable.Pipeable {
18
+ readonly [TypeId]: TypeId;
19
+ readonly command: string;
20
+ readonly args: ReadonlyArray<string>;
21
+ readonly cwd?: string;
22
+ readonly env?: Record<string, string>;
23
+ readonly stdin?: Stdio;
24
+ readonly stdout?: Stdio;
25
+ readonly stderr?: Stdio;
26
+ readonly detached?: boolean;
27
+ [Symbol.iterator](): Effect.EffectGenerator<Effect.Effect<ChildProcessHandle, PlatformError.PlatformError, ChildProcessSpawner | Scope.Scope>>;
28
+ }
29
+ export declare namespace Command {
30
+ interface Options {
31
+ readonly cwd?: string;
32
+ readonly env?: Record<string, string>;
33
+ readonly stdin?: Stdio;
34
+ readonly stdout?: Stdio;
35
+ readonly stderr?: Stdio;
36
+ readonly detached?: boolean;
37
+ }
38
+ }
39
+ export declare const isCommand: (u: unknown) => u is Command;
40
+ export declare const make: (command: string, args?: ReadonlyArray<string>, options?: Command.Options) => Command;
41
+ export type Signal = "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" | "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" | "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" | "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
42
+ export interface KillOptions {
43
+ readonly killSignal?: Signal | undefined;
44
+ }
45
+ export interface ChildProcessHandle {
46
+ readonly pid: number;
47
+ readonly exitCode: Effect.Effect<number, PlatformError.PlatformError>;
48
+ readonly isRunning: Effect.Effect<boolean, PlatformError.PlatformError>;
49
+ readonly kill: (options?: KillOptions) => Effect.Effect<void, PlatformError.PlatformError>;
50
+ readonly stdin: Sink.Sink<void, Uint8Array, never, PlatformError.PlatformError>;
51
+ readonly stdout: Stream.Stream<Uint8Array, PlatformError.PlatformError>;
52
+ readonly stderr: Stream.Stream<Uint8Array, PlatformError.PlatformError>;
53
+ }
54
+ declare const ChildProcessSpawner_base: Context.TagClass<ChildProcessSpawner, "effect-start/ChildProcessSpawner", {
55
+ readonly spawn: (command: Command) => Effect.Effect<ChildProcessHandle, PlatformError.PlatformError, Scope.Scope>;
56
+ }>;
57
+ export declare class ChildProcessSpawner extends ChildProcessSpawner_base {
58
+ }
59
+ export declare const spawn: (command: Command) => Effect.Effect<ChildProcessHandle, PlatformError.PlatformError, ChildProcessSpawner | Scope.Scope>;
60
+ export {};
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Adapted from upcomnig Effect 4 aka effect-smol.
3
+ *
4
+ * Kept a minimal interface without tempaltes and file descirptor
5
+ * to keep it compatible if it lands in the core (ie. not in seperate platform package.)
6
+ */
7
+ import * as Context from "effect/Context";
8
+ import * as Effect from "effect/Effect";
9
+ import * as Pipeable from "effect/Pipeable";
10
+ import * as Predicate from "effect/Predicate";
11
+ import * as Utils from "effect/Utils";
12
+ const TypeId = Symbol.for("effect-start/ChildProcess/Command");
13
+ const CommandProto = {
14
+ [TypeId]: TypeId,
15
+ pipe() {
16
+ return Pipeable.pipeArguments(this, arguments);
17
+ },
18
+ [Symbol.iterator]() {
19
+ return new Utils.SingleShotGen(new Utils.YieldWrap(spawn(this)));
20
+ },
21
+ };
22
+ export const isCommand = (u) => Predicate.hasProperty(u, TypeId);
23
+ export const make = (command, args, options) => Object.assign(Object.create(CommandProto), {
24
+ command,
25
+ args: args ?? [],
26
+ ...options,
27
+ });
28
+ export class ChildProcessSpawner extends Context.Tag("effect-start/ChildProcessSpawner")() {
29
+ }
30
+ export const spawn = (command) => Effect.flatMap(ChildProcessSpawner, (spawner) => spawner.spawn(command));
@@ -50,10 +50,7 @@ export interface SubcommandDef<Handled extends boolean = boolean> {
50
50
  readonly _tag: "SubcommandDef";
51
51
  readonly command: CommanderSet<any, any, Handled>;
52
52
  }
53
- type Extend<S, NewOpts extends OptionsMap, NewSubs extends ReadonlyArray<SubcommandDef> = [], Handled extends boolean = false> = S extends CommanderSet<infer Opts, infer Subs, infer _H> ? CommanderSet<Opts & NewOpts, [
54
- ...Subs,
55
- ...NewSubs
56
- ], Handled> : CommanderSet<NewOpts, NewSubs, Handled>;
53
+ type Extend<S, NewOpts extends OptionsMap, NewSubs extends ReadonlyArray<SubcommandDef> = [], Handled extends boolean = false> = S extends CommanderSet<infer Opts, infer Subs, infer _H> ? CommanderSet<Opts & NewOpts, [...Subs, ...NewSubs], Handled> : CommanderSet<NewOpts, NewSubs, Handled>;
57
54
  type CommanderBuilder = {
58
55
  option: typeof optionMethod;
59
56
  optionHelp: typeof optionHelp;
@@ -81,10 +78,10 @@ export declare namespace CommanderSet {
81
78
  }
82
79
  declare const optionMethod: <S, Opt extends OptionBuilder<any, any>>(this: S, opt: Opt) => Extend<S, { [K in Opt["name"] as OptionNameToCamelCase<K>]: Opt; }>;
83
80
  export declare const optionHelp: <S>(this: S) => Extend<S, {
84
- "help": OptionBuilder<boolean, "--help">;
81
+ help: OptionBuilder<boolean, "--help">;
85
82
  }>;
86
83
  export declare const optionVersion: <S>(this: S) => Extend<S, {
87
- "version": OptionBuilder<boolean, "--version">;
84
+ version: OptionBuilder<boolean, "--version">;
88
85
  }>;
89
86
  export declare const subcommand: <S, SubOpts extends OptionsMap, SubSubs extends ReadonlyArray<SubcommandDef>, SubHandled extends boolean>(this: S, cmd: CommanderSet<SubOpts, SubSubs, SubHandled>) => Extend<S, {}, [SubcommandDef<SubHandled>]>;
90
87
  export declare const handle: <Opts extends OptionsMap, Subs extends ReadonlyArray<SubcommandDef>>(this: CommanderSet<Opts, Subs, false>, handler: (args: ExtractOptionValues<Opts>) => Effect.Effect<void>) => CommanderSet<Opts, Subs, true>;
package/dist/Commander.js CHANGED
@@ -222,8 +222,7 @@ const parseRawArgs = (args) => Effect.gen(function* () {
222
222
  const chars = arg.slice(1);
223
223
  for (let j = 0; j < chars.length; j++) {
224
224
  const char = chars[j];
225
- if (j === chars.length - 1 && i + 1 < args.length && !args[i + 1]
226
- .startsWith("-")) {
225
+ if (j === chars.length - 1 && i + 1 < args.length && !args[i + 1].startsWith("-")) {
227
226
  options[char] = args[i + 1];
228
227
  i++;
229
228
  }
@@ -247,7 +246,7 @@ export const parse = (cmd, args) => Effect.gen(function* () {
247
246
  const shortName = optBuilder.short;
248
247
  const longMatch = parsed.options[longName] || parsed.flags[longName];
249
248
  const shortMatch = shortName
250
- ? (parsed.options[shortName] || parsed.flags[shortName])
249
+ ? parsed.options[shortName] || parsed.flags[shortName]
251
250
  : undefined;
252
251
  const rawValue = longMatch ?? shortMatch;
253
252
  const camelKey = kebabToCamel(stripPrefix(optBuilder.long));
@@ -256,9 +255,7 @@ export const parse = (cmd, args) => Effect.gen(function* () {
256
255
  result[camelKey] = rawValue;
257
256
  }
258
257
  else if (optBuilder.schema) {
259
- const decoded = yield* Schema
260
- .decode(optBuilder.schema)(rawValue)
261
- .pipe(Effect.mapError((error) => new CommanderError({
258
+ const decoded = yield* Schema.decode(optBuilder.schema)(rawValue).pipe(Effect.mapError((error) => new CommanderError({
262
259
  message: `Invalid value for option ${optBuilder.long}: ${error.message}`,
263
260
  cause: error,
264
261
  })));
@@ -281,9 +278,7 @@ export const runMain = (cmd) => Effect.gen(function* () {
281
278
  console.log(generateHelp(cmd));
282
279
  return;
283
280
  }
284
- if (Predicate.hasProperty(parsedOptions, "version")
285
- && parsedOptions.version
286
- && cmd.version) {
281
+ if (Predicate.hasProperty(parsedOptions, "version") && parsedOptions.version && cmd.version) {
287
282
  console.log(`${cmd.name} v${cmd.version}`);
288
283
  return;
289
284
  }
@@ -324,10 +319,8 @@ const generateHelp = (cmd) => {
324
319
  export const help = (cmd) => generateHelp(cmd);
325
320
  export const NumberFromString = Schema.NumberFromString;
326
321
  export const choice = (choices) => Schema.Literal(...choices);
327
- export const repeatable = (schema) => Schema
328
- .transform(Schema.String, Schema.Array(Schema.String), {
322
+ export const repeatable = (schema) => Schema.transform(Schema.String, Schema.Array(Schema.String), {
329
323
  strict: true,
330
324
  decode: (s) => s.split(",").map((part) => part.trim()),
331
325
  encode: (arr) => arr.join(","),
332
- })
333
- .pipe(Schema.compose(Schema.Array(schema)));
326
+ }).pipe(Schema.compose(Schema.Array(schema)));
@@ -2,12 +2,11 @@
2
2
  * RFC 7231 Content Negotiation compatible with Express/Node.js ecosystem.
3
3
  * Based on {@link https://github.com/jshttp/negotiator}
4
4
  */
5
- import type * as Headers from "@effect/platform/Headers";
6
- export declare function media(accept: string, available?: string[]): string[];
7
- export declare function language(accept: string, available?: string[]): string[];
8
- export declare function encoding(accept: string, available?: string[]): string[];
9
- export declare function charset(accept: string, available?: string[]): string[];
10
- export declare function headerMedia(headers: Headers.Headers, available?: string[]): string[];
11
- export declare function headerLanguage(headers: Headers.Headers, available?: string[]): string[];
12
- export declare function headerEncoding(headers: Headers.Headers, available?: string[]): string[];
13
- export declare function headerCharset(headers: Headers.Headers, available?: string[]): string[];
5
+ export declare function media(accept: string, available?: Array<string>): Array<string>;
6
+ export declare function language(accept: string, available?: Array<string>): Array<string>;
7
+ export declare function encoding(accept: string, available?: Array<string>): Array<string>;
8
+ export declare function charset(accept: string, available?: Array<string>): Array<string>;
9
+ export declare function headerMedia(headers: Headers, available?: Array<string>): Array<string>;
10
+ export declare function headerLanguage(headers: Headers, available?: Array<string>): Array<string>;
11
+ export declare function headerEncoding(headers: Headers, available?: Array<string>): Array<string>;
12
+ export declare function headerCharset(headers: Headers, available?: Array<string>): Array<string>;
@@ -2,7 +2,7 @@
2
2
  * RFC 7231 Content Negotiation compatible with Express/Node.js ecosystem.
3
3
  * Based on {@link https://github.com/jshttp/negotiator}
4
4
  */
5
- const simpleMediaTypeRegExp = /^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;
5
+ const simpleMediaTypeRegExp = /^\s*([^\s/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;
6
6
  const simpleLanguageRegExp = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;
7
7
  const simpleEncodingRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/;
8
8
  const simpleCharsetRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/;
@@ -26,7 +26,7 @@ function splitMediaTypeParams(params) {
26
26
  continue;
27
27
  const key = trimmed.slice(0, eqIndex).trim().toLowerCase();
28
28
  let value = trimmed.slice(eqIndex + 1).trim();
29
- if (value.startsWith("\"") && value.endsWith("\"")) {
29
+ if (value.startsWith('"') && value.endsWith('"')) {
30
30
  value = value.slice(1, -1);
31
31
  }
32
32
  if (key === "q") {
@@ -53,9 +53,7 @@ function parseAccept(accept) {
53
53
  continue;
54
54
  const type = match[1].toLowerCase();
55
55
  const subtype = match[2].toLowerCase();
56
- const { params, q } = match[3]
57
- ? splitMediaTypeParams(match[3])
58
- : { params: {}, q: 1 };
56
+ const { params, q } = match[3] ? splitMediaTypeParams(match[3]) : { params: {}, q: 1 };
59
57
  if (q > 0) {
60
58
  specs.push({ type, subtype, params, q, o });
61
59
  }
@@ -104,16 +102,14 @@ function getMediaTypePriority(mediaType, accepted, index) {
104
102
  }
105
103
  const type = match[1].toLowerCase();
106
104
  const subtype = match[2].toLowerCase();
107
- const { params } = match[3]
108
- ? splitMediaTypeParams(match[3])
109
- : { params: {} };
105
+ const { params } = match[3] ? splitMediaTypeParams(match[3]) : { params: {} };
110
106
  for (const spec of accepted) {
111
107
  const result = specifyMediaType(type, subtype, params, spec);
112
- if (result
113
- && (best === null
114
- || result.s > best.s
115
- || (result.s === best.s && result.q > best.q)
116
- || (result.s === best.s && result.q === best.q && result.o < best.o))) {
108
+ if (result &&
109
+ (best === null ||
110
+ result.s > best.s ||
111
+ (result.s === best.s && result.q > best.q) ||
112
+ (result.s === best.s && result.q === best.q && result.o < best.o))) {
117
113
  best = result;
118
114
  }
119
115
  }
@@ -168,11 +164,11 @@ function getLanguagePriority(language, accepted, index) {
168
164
  let best = null;
169
165
  for (const spec of accepted) {
170
166
  const result = specifyLanguage(language, spec);
171
- if (result
172
- && (best === null
173
- || result.s > best.s
174
- || (result.s === best.s && result.q > best.q)
175
- || (result.s === best.s && result.q === best.q && result.o < best.o))) {
167
+ if (result &&
168
+ (best === null ||
169
+ result.s > best.s ||
170
+ (result.s === best.s && result.q > best.q) ||
171
+ (result.s === best.s && result.q === best.q && result.o < best.o))) {
176
172
  best = result;
177
173
  }
178
174
  }
@@ -222,11 +218,11 @@ function getEncodingPriority(encoding, accepted, index) {
222
218
  let best = null;
223
219
  for (const spec of accepted) {
224
220
  const result = specifyEncoding(encoding, spec);
225
- if (result
226
- && (best === null
227
- || result.s > best.s
228
- || (result.s === best.s && result.q > best.q)
229
- || (result.s === best.s && result.q === best.q && result.o < best.o))) {
221
+ if (result &&
222
+ (best === null ||
223
+ result.s > best.s ||
224
+ (result.s === best.s && result.q > best.q) ||
225
+ (result.s === best.s && result.q === best.q && result.o < best.o))) {
230
226
  best = result;
231
227
  }
232
228
  }
@@ -268,11 +264,11 @@ function getCharsetPriority(charset, accepted, index) {
268
264
  let best = null;
269
265
  for (const spec of accepted) {
270
266
  const result = specifyCharset(charset, spec);
271
- if (result
272
- && (best === null
273
- || result.s > best.s
274
- || (result.s === best.s && result.q > best.q)
275
- || (result.s === best.s && result.q === best.q && result.o < best.o))) {
267
+ if (result &&
268
+ (best === null ||
269
+ result.s > best.s ||
270
+ (result.s === best.s && result.q > best.q) ||
271
+ (result.s === best.s && result.q === best.q && result.o < best.o))) {
276
272
  best = result;
277
273
  }
278
274
  }
@@ -285,10 +281,7 @@ function getCharsetPriority(charset, accepted, index) {
285
281
  };
286
282
  }
287
283
  function compareSpecs(a, b) {
288
- return (b.q - a.q
289
- || b.s - a.s
290
- || a.o - b.o
291
- || a.i - b.i);
284
+ return b.q - a.q || b.s - a.s || a.o - b.o || a.i - b.i;
292
285
  }
293
286
  export function media(accept, available) {
294
287
  const parsed = parseAccept(accept);
@@ -308,7 +301,9 @@ export function language(accept, available) {
308
301
  return [];
309
302
  }
310
303
  if (!available) {
311
- return parsed.sort((a, b) => b.q - a.q || a.o - b.o).map((p) => p.suffix ? `${p.prefix}-${p.suffix}` : p.prefix);
304
+ return parsed
305
+ .sort((a, b) => b.q - a.q || a.o - b.o)
306
+ .map((p) => (p.suffix ? `${p.prefix}-${p.suffix}` : p.prefix));
312
307
  }
313
308
  const priorities = available.map((l, i) => getLanguagePriority(l, parsed, i));
314
309
  const sorted = priorities.filter((p) => p.q > 0).sort(compareSpecs);
@@ -339,25 +334,25 @@ export function charset(accept, available) {
339
334
  return sorted.map((p) => p.value);
340
335
  }
341
336
  export function headerMedia(headers, available) {
342
- const accept = headers["accept"];
337
+ const accept = headers.get("accept");
343
338
  if (!accept)
344
339
  return [];
345
340
  return media(accept, available);
346
341
  }
347
342
  export function headerLanguage(headers, available) {
348
- const accept = headers["accept-language"];
343
+ const accept = headers.get("accept-language");
349
344
  if (!accept)
350
345
  return [];
351
346
  return language(accept, available);
352
347
  }
353
348
  export function headerEncoding(headers, available) {
354
- const accept = headers["accept-encoding"];
349
+ const accept = headers.get("accept-encoding");
355
350
  if (!accept)
356
351
  return [];
357
352
  return encoding(accept, available);
358
353
  }
359
354
  export function headerCharset(headers, available) {
360
- const accept = headers["accept-charset"];
355
+ const accept = headers.get("accept-charset");
361
356
  if (!accept)
362
357
  return [];
363
358
  return charset(accept, available);
@@ -0,0 +1,47 @@
1
+ import * as Duration from "effect/Duration";
2
+ import * as Inspectable from "effect/Inspectable";
3
+ import * as Option from "effect/Option";
4
+ import * as Pipeable from "effect/Pipeable";
5
+ export declare const TypeId: unique symbol;
6
+ export type TypeId = typeof TypeId;
7
+ export declare const isCookies: (u: unknown) => u is Cookies;
8
+ export interface Cookies extends Pipeable.Pipeable, Inspectable.Inspectable {
9
+ readonly [TypeId]: TypeId;
10
+ readonly cookies: Record<string, Cookie>;
11
+ }
12
+ export declare const CookieTypeId: unique symbol;
13
+ export type CookieTypeId = typeof CookieTypeId;
14
+ export interface Cookie extends Inspectable.Inspectable {
15
+ readonly [CookieTypeId]: CookieTypeId;
16
+ readonly name: string;
17
+ readonly value: string;
18
+ readonly valueEncoded: string;
19
+ readonly options?: {
20
+ readonly domain?: string | undefined;
21
+ readonly expires?: Date | undefined;
22
+ readonly maxAge?: Duration.DurationInput | undefined;
23
+ readonly path?: string | undefined;
24
+ readonly priority?: "low" | "medium" | "high" | undefined;
25
+ readonly httpOnly?: boolean | undefined;
26
+ readonly secure?: boolean | undefined;
27
+ readonly partitioned?: boolean | undefined;
28
+ readonly sameSite?: "lax" | "strict" | "none" | undefined;
29
+ } | undefined;
30
+ }
31
+ export declare const empty: Cookies;
32
+ export declare const fromIterable: (cookies: Iterable<Cookie>) => Cookies;
33
+ export declare const fromSetCookie: (headers: Iterable<string> | string) => Cookies;
34
+ export declare const unsafeMakeCookie: (name: string, value: string, options?: Cookie["options"] | undefined) => Cookie;
35
+ export declare const isEmpty: (self: Cookies) => boolean;
36
+ export declare const get: (self: Cookies, name: string) => Option.Option<Cookie>;
37
+ export declare const getValue: (self: Cookies, name: string) => Option.Option<string>;
38
+ export declare const setCookie: (self: Cookies, cookie: Cookie) => Cookies;
39
+ export declare const unsafeSet: (self: Cookies, name: string, value: string, options?: Cookie["options"]) => Cookies;
40
+ export declare const unsafeSetAll: (self: Cookies, cookies: Iterable<readonly [name: string, value: string, options?: Cookie["options"]]>) => Cookies;
41
+ export declare const remove: (self: Cookies, name: string) => Cookies;
42
+ export declare const merge: (self: Cookies, that: Cookies) => Cookies;
43
+ export declare function serializeCookie(self: Cookie): string;
44
+ export declare const toCookieHeader: (self: Cookies) => string;
45
+ export declare const toRecord: (self: Cookies) => Record<string, string>;
46
+ export declare const toSetCookieHeaders: (self: Cookies) => Array<string>;
47
+ export declare function parseHeader(header: string): Record<string, string>;