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. ///