da259d5b79
apple / swift (push) Successful in 1m22s
apple / screenshots (push) Successful in 6m35s
ci / web (push) Successful in 1m13s
ci / docs-site (push) Successful in 1m14s
android / android (push) Successful in 17m3s
decky / build-publish (push) Successful in 18s
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Successful in 11s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 10s
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 9s
docker / build-push (ci, ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 9s
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 9s
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 8s
arch / build-publish (push) Successful in 16m33s
ci / bench (push) Successful in 14m48s
deb / build-publish (push) Successful in 14m48s
ci / rust (push) Successful in 22m36s
deb / build-publish-host (push) Successful in 18m16s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 18m30s
docker / deploy-docs (push) Successful in 23s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 28m25s
Plugin contracts share ProviderEntry/Artwork/LaunchSpec/PrepStep with their UIs; the kit root stays node-only (reconcile keeps the HostClient transport). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
// The library-provider client, owned by the kit so plugins stop hand-copying host calls.
|
|
// The wire SCHEMAS live in ./wire.ts (browser-safe — plugin contracts re-use them); the
|
|
// transport here stays the SDK's untyped `pf.request` seam (version-skew-safe under the
|
|
// runner-bundled SDK — design D7).
|
|
import { Context, Effect, Layer } from "effect";
|
|
import type { HostRequestError } from "./errors.js";
|
|
import { HostClient } from "./host-client.js";
|
|
import type { ProviderEntry } from "./wire.js";
|
|
|
|
export * from "./wire.js";
|
|
|
|
export interface ProviderClientService {
|
|
/** Full-replace reconcile: PUT the desired set; the host diffs by `external_id`. */
|
|
readonly reconcile: (
|
|
providerId: string,
|
|
entries: ReadonlyArray<ProviderEntry>,
|
|
) => Effect.Effect<void, HostRequestError>;
|
|
/** Remove every entry this provider owns (the explicit-uninstall path). */
|
|
readonly remove: (providerId: string) => Effect.Effect<void, HostRequestError>;
|
|
}
|
|
|
|
export class ProviderClient extends Context.Service<
|
|
ProviderClient,
|
|
ProviderClientService
|
|
>()("@punktfunk/plugin-kit/ProviderClient") {
|
|
static readonly layer: Layer.Layer<ProviderClient, never, HostClient> =
|
|
Layer.effect(ProviderClient)(
|
|
Effect.gen(function* () {
|
|
const host = yield* HostClient;
|
|
return {
|
|
reconcile: (providerId, entries) =>
|
|
host
|
|
.request("PUT", `/library/provider/${providerId}`, entries)
|
|
.pipe(Effect.asVoid),
|
|
remove: (providerId) =>
|
|
host
|
|
.request("DELETE", `/library/provider/${providerId}`)
|
|
.pipe(Effect.asVoid),
|
|
} satisfies ProviderClientService;
|
|
}),
|
|
);
|
|
}
|