MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / txPlugin

Function txPlugin

packages/core/sdk/src/oauth-remove-client.test.ts:261–283  ·  view source on GitHub ↗
(store: Map<string, string>)

Source from the content-addressed store, hash-verified

259// row while its secret stayed destroyed, leaving a client that looks configured
260// and can never authenticate again.
261const txPlugin = (store: Map<string, string>) =>
262 definePlugin(() => ({
263 id: "demo" as const,
264 storage: () => ({}),
265 credentialProviders: [
266 {
267 key: ProviderKey.make("memory"),
268 writable: true as const,
269 get: (id: ProviderItemId) => Effect.sync(() => store.get(String(id)) ?? null),
270 set: (id: ProviderItemId, value: string) =>
271 Effect.sync(() => {
272 store.set(String(id), value);
273 }),
274 delete: (id: ProviderItemId) =>
275 Effect.sync(() => {
276 store.delete(String(id));
277 }),
278 },
279 ],
280 extension: (ctx) => ({
281 inTransaction: <A, E>(effect: Effect.Effect<A, E>) => ctx.transaction(effect),
282 }),
283 }))();
284
285// The client secret is keyed by (owner, slug) ALONE — the key outlives the row
286// it belonged to, which is what makes the deferred delete a claim that has to be

Callers 1

Calls 6

definePluginFunction · 0.90
syncMethod · 0.65
getMethod · 0.65
setMethod · 0.65
deleteMethod · 0.65
transactionMethod · 0.65

Tested by

no test coverage detected