(
toolkitId: string,
policyId: string,
input: {
readonly pattern?: string;
readonly action?: ToolPolicyAction;
readonly position?: string;
},
)
| 399 | }); |
| 400 | |
| 401 | const updatePolicy = ( |
| 402 | toolkitId: string, |
| 403 | policyId: string, |
| 404 | input: { |
| 405 | readonly pattern?: string; |
| 406 | readonly action?: ToolPolicyAction; |
| 407 | readonly position?: string; |
| 408 | }, |
| 409 | ) => |
| 410 | Effect.gen(function* () { |
| 411 | if (input.pattern !== undefined) yield* validatePolicyPattern(input.pattern); |
| 412 | const toolkit = yield* requireToolkit(toolkitId); |
| 413 | const existing = yield* requirePolicy(toolkitId, policyId, toolkit.owner); |
| 414 | const entry = yield* storage.policies.put({ |
| 415 | owner: toolkit.owner, |
| 416 | key: policyId, |
| 417 | data: { |
| 418 | ...existing.data, |
| 419 | ...(input.pattern !== undefined ? { pattern: input.pattern } : {}), |
| 420 | ...(input.action !== undefined ? { action: input.action } : {}), |
| 421 | ...(input.position !== undefined ? { position: input.position } : {}), |
| 422 | updatedAt: Date.now(), |
| 423 | }, |
| 424 | }); |
| 425 | return policyToResponse(entry.data); |
| 426 | }); |
| 427 | |
| 428 | const removePolicy = (toolkitId: string, policyId: string) => |
| 429 | Effect.gen(function* () { |
nothing calls this directly
no test coverage detected