Repository navigation
0.71.0
Chef now provides an SDK for javascript providers, so they dont need
to write the json RPC code manually (though its not a lot of code)
example of a client using this SDK:
import { runChefProvider } from "jsr:@sigmasd/chef/sdk";
import {
uninstallScript,
updateScripts,
listScripts
} from "./main.ts";
export async function runChefMode() {
await runChefProvider({
list: async (_signal: AbortSignal) => {
const result = await listScripts();
return result;
},
update: async ({ name }: {
name: string;
version: string;
force?: boolean;
signal: AbortSignal;
}) => {
try {
await updateScripts([name], { "dry-run": false });
return true;
} catch {
return false;
}
},
remove: async (name: string, _signal: AbortSignal) => {
return await uninstallScript(name, {});
},
});
}