import { EffectStore } from '@voltro/runtime' import type { AppContext } from '@voltro/runtime' import { requireFlag } from '@voltro/plugin-flags' import { Effect } from 'effect' const execute = ( input: { tenantId: string; title: string; body: string }, ctx: AppContext, ) => Effect.gen(function* () { // In-handler flag guard — short-circuits with typed FlagDisabled when the // flag is off. Same shape as `requireScope` / `requireEntitlement`. yield* requireFlag(ctx, 'newEditor') const store = yield* EffectStore const row = yield* store.insert('notes', { title: input.title, body: input.body, tenantId: input.tenantId, }) return { id: row['id'] as string, title: row['title'] as string, body: row['body'] as string, tenantId: row['tenantId'] as string, } }) export default execute