(
toolkitId: string,
policyId: string,
input: {
readonly pattern?: string;
readonly action?: ToolPolicyAction;
readonly position?: string;
},
)
| 445 | }); |
| 446 | |
| 447 | const updatePolicy = ( |
| 448 | toolkitId: string, |
| 449 | policyId: string, |
| 450 | input: { |
| 451 | readonly pattern?: string; |
| 452 | readonly action?: ToolPolicyAction; |
| 453 | readonly position?: string; |
| 454 | }, |
| 455 | ) => |
| 456 | Effect.gen(function* () { |
| 457 | if (input.pattern !== undefined) yield* validatePolicyPattern(input.pattern); |
| 458 | const toolkit = yield* requireToolkit(toolkitId); |
| 459 | const existing = yield* requirePolicy(toolkitId, policyId, toolkit.owner); |
| 460 | const entry = yield* storage.policies.put({ |
| 461 | owner: toolkit.owner, |
| 462 | key: policyId, |
| 463 | data: { |
| 464 | ...existing.data, |
| 465 | ...(input.pattern !== undefined ? { pattern: input.pattern } : {}), |
| 466 | ...(input.action !== undefined ? { action: input.action } : {}), |
| 467 | ...(input.position !== undefined ? { position: input.position } : {}), |
| 468 | updatedAt: Date.now(), |
| 469 | }, |
| 470 | }); |
| 471 | return policyToResponse(entry.data); |
| 472 | }); |
| 473 | |
| 474 | const removePolicy = (toolkitId: string, policyId: string) => |
| 475 | Effect.gen(function* () { |
nothing calls this directly
no test coverage detected