Guard / foldkit-guard/media

GuardMedia

namespace · packages/guard/src/media.ts:78

const GuardMedia = { uploadPolicy }

In the guides

Members

GuardMedia.uploadPolicy

function · packages/guard/src/media.ts:54

uploadPolicy<User, E, R>(
  policy: Policy<User>,
  config: UploadPolicyConfig<User, E, R>,
): Layer.Layer<UploadPolicy, never, R>

An UploadPolicy deciding each route by policy's principal guards for who resolve says is asking. A route admits when any one of its guards allows; a refusal's reason stays on the server, as every media refusal says only its kind. policy must need no service of its own: give it what its bodies need with Policy.provide, as the other seams take it.