Skip to content

Commit

Permalink
feat: add settings schema to plugin initialization
Browse files Browse the repository at this point in the history
Include pluginSettingsSchema in createPluginWithEnv for enhanced validation.
  • Loading branch information
gentlementlegen committed Oct 15, 2024
1 parent a429556 commit 6addf2f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import { run } from "./run";
import { SupportedEvents } from "./types/context";
import { Database } from "./types/database";
import { Env } from "./types/env";
import { PluginSettings } from "./types/plugin-input";
import { PluginSettings, pluginSettingsSchema } from "./types/plugin-input";

function createPluginWithEnv(env: Record<string, string>) {
return createPlugin<PluginSettings, Env, SupportedEvents>(
(context) => {
const supabase = createClient<Database>(context.env.SUPABASE_URL, context.env.SUPABASE_KEY);
const supabase = createClient<Database>(env.SUPABASE_URL, env.SUPABASE_KEY);
return run({ ...context, adapters: createAdapters(supabase, context) });
},
// @ts-expect-error strings cannot be assigned to events
manifest,
{ kernelPublicKey: env.KERNEL_PUBLIC_KEY }
{ kernelPublicKey: env.KERNEL_PUBLIC_KEY, settingsSchema: pluginSettingsSchema }
);
}

Expand Down

0 comments on commit 6addf2f

Please sign in to comment.