Skip to content
Playground(another site)

bynk.adapter.provider_has_body

Error A provider inside an adapter has a Bynk body; adapter providers must be external.

An adapter wraps code written in TypeScript. Its provider has no body: provides Jwt = JoseJwt, and the binding exports a class of that name. A Bynk body would be a second implementation beside the binding's. Remove the body and implement the operations in the binding, or, for a provider written in Bynk, move it to a context. An external provider in a context is bynk.context.external_provider.

Example

adapter tokens {
binding "./tokens.binding.ts"
capability Jwt {
fn sign(secret: String) -> Effect[String]
}
provides Jwt = JoseJwt { // ✗ the binding supplies it
fn sign(secret: String) -> Effect[String] { secret }
}
}
adapter tokens {
binding "./tokens.binding.ts"
capability Jwt {
fn sign(secret: String) -> Effect[String]
}
provides Jwt = JoseJwt // ✓ no body
}

In the Book

See also

  • The grammar rule it governs: provider_decl.
  • Every code in its category, Adapters, on the diagnostic index.
  • bynk explain bynk.adapter.provider_has_body shows the same from the installed toolchain, without a network.