From 63b3f2ef6a7bba90ea63d97c4cc37fcf30cdeac7 Mon Sep 17 00:00:00 2001 From: zzal Date: Sun, 19 Jul 2026 16:39:31 -0400 Subject: [PATCH 1/2] =?UTF-8?q?refactor!:=20drop=20the=20HTTP=20facade=20a?= =?UTF-8?q?nd=20the=20dead=20SwiflowStore=E2=86=92SwiflowFetcher=20edge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part-1 modularization audit findings. The HTTP enum was eight pure pass-throughs to HTTPClient() with zero consumers in examples or tests; callers construct an HTTPClient directly. PersistentStore's SwiflowFetcher import resolved no symbols (compile-verified), so the target dependency goes too. Co-Authored-By: Claude Fable 5 --- .mcp.json | 8 +++ CHANGELOG.md | 10 +++ Package.swift | 1 - Sources/SwiflowFetcher/HTTP.swift | 76 ---------------------- Sources/SwiflowStore/PersistentStore.swift | 1 - 5 files changed, 18 insertions(+), 78 deletions(-) create mode 100644 .mcp.json delete mode 100644 Sources/SwiflowFetcher/HTTP.swift diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 00000000..90ec89fc --- /dev/null +++ b/.mcp.json @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "webstorm": { + "url": "http://127.0.0.1:64542/stream", + "type": "http" + } + } +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index dcd5be70..b08602ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,16 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com). ## [Unreleased] +### Removed + +- **BREAKING:** the `HTTP` static facade (`HTTP.get/post/put/patch/delete/send`) + is gone. Construct an `HTTPClient()` and call the same methods on it — + every signature is otherwise identical. + +### Changed + +- `SwiflowStore` no longer depends on `SwiflowFetcher`. + --- ## [0.5.3] — 2026-07-19 diff --git a/Package.swift b/Package.swift index 4cd069fd..881e441e 100644 --- a/Package.swift +++ b/Package.swift @@ -161,7 +161,6 @@ let package = Package( name: "SwiflowStore", dependencies: [ "Swiflow", - "SwiflowFetcher", "SwiflowMacrosPlugin", .product(name: "JavaScriptKit", package: "JavaScriptKit"), .product(name: "JavaScriptEventLoop", package: "JavaScriptKit"), diff --git a/Sources/SwiflowFetcher/HTTP.swift b/Sources/SwiflowFetcher/HTTP.swift deleted file mode 100644 index 89f7e280..00000000 --- a/Sources/SwiflowFetcher/HTTP.swift +++ /dev/null @@ -1,76 +0,0 @@ -// Sources/SwiflowFetcher/HTTP.swift -// -// Static convenience facade over a base-URL-less `HTTPClient`, for one-off -// requests against absolute URLs. For a configured client (base URL + default -// headers), construct an `HTTPClient` directly. WASM-only, like `HTTPClient`. - -#if canImport(JavaScriptKit) -import Swiflow - -/// One-off JSON requests against absolute URLs. -/// -/// ```swift -/// let user = try await HTTP.get("https://api.example.com/me", as: User.self) -/// ``` -/// -/// This is a thin wrapper over `HTTPClient()` (no base URL). When you make more -/// than a couple of calls to the same host, prefer constructing an -/// `HTTPClient(baseURL:headers:)` and calling it with relative paths. -public enum HTTP { - public static func get( - _ url: String, query: [String: HTTPQueryValue] = [:], - headers: [String: String] = [:], as type: T.Type = T.self - ) async throws -> T { - try await HTTPClient().get(url, query: query, headers: headers, as: type) - } - - public static func post( - _ url: String, json: JSONValue, query: [String: HTTPQueryValue] = [:], - headers: [String: String] = [:], as type: T.Type = T.self - ) async throws -> T { - try await HTTPClient().post(url, json: json, query: query, headers: headers, as: type) - } - - public static func post( - _ url: String, body: some Encodable & Sendable, query: [String: HTTPQueryValue] = [:], - headers: [String: String] = [:], as type: T.Type = T.self - ) async throws -> T { - try await HTTPClient().post(url, body: body, query: query, headers: headers, as: type) - } - - public static func put( - _ url: String, json: JSONValue, query: [String: HTTPQueryValue] = [:], - headers: [String: String] = [:], as type: T.Type = T.self - ) async throws -> T { - try await HTTPClient().put(url, json: json, query: query, headers: headers, as: type) - } - - public static func put( - _ url: String, body: some Encodable & Sendable, query: [String: HTTPQueryValue] = [:], - headers: [String: String] = [:], as type: T.Type = T.self - ) async throws -> T { - try await HTTPClient().put(url, body: body, query: query, headers: headers, as: type) - } - - public static func patch( - _ url: String, json: JSONValue, query: [String: HTTPQueryValue] = [:], - headers: [String: String] = [:], as type: T.Type = T.self - ) async throws -> T { - try await HTTPClient().patch(url, json: json, query: query, headers: headers, as: type) - } - - public static func patch( - _ url: String, body: some Encodable & Sendable, query: [String: HTTPQueryValue] = [:], - headers: [String: String] = [:], as type: T.Type = T.self - ) async throws -> T { - try await HTTPClient().patch(url, body: body, query: query, headers: headers, as: type) - } - - public static func delete( - _ url: String, query: [String: HTTPQueryValue] = [:], headers: [String: String] = [:] - ) async throws { - try await HTTPClient().delete(url, query: query, headers: headers) - } -} - -#endif diff --git a/Sources/SwiflowStore/PersistentStore.swift b/Sources/SwiflowStore/PersistentStore.swift index 8c76a6e5..70c5d062 100644 --- a/Sources/SwiflowStore/PersistentStore.swift +++ b/Sources/SwiflowStore/PersistentStore.swift @@ -22,7 +22,6 @@ #if arch(wasm32) import Swiflow import JavaScriptKit -import SwiflowFetcher /// A persistent key/value store backed by one IndexedDB object store. /// From 82218880bf192651cada98ea58b726ef60037cf0 Mon Sep 17 00:00:00 2001 From: zzal Date: Sun, 19 Jul 2026 16:42:25 -0400 Subject: [PATCH 2/2] chore: untrack local .mcp.json swept into the previous commit Co-Authored-By: Claude Fable 5 --- .mcp.json | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .mcp.json diff --git a/.mcp.json b/.mcp.json deleted file mode 100644 index 90ec89fc..00000000 --- a/.mcp.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "mcpServers": { - "webstorm": { - "url": "http://127.0.0.1:64542/stream", - "type": "http" - } - } -} \ No newline at end of file