~/bend-docscommunity

input.bend relies on unsafe/foreign

raw source on the hub · import bend-kit-camber@0.7.0.0/input.bend as Input

Checked typed inputs; bodies are consumed once, without caching or decompression.

7 imports
import Base
import bend-kit-http@0.32.0.0/http.bend as Http
import bend-kit-router@0.2.0.0/target.bend as Target
import bend-kit-json@0.5.1.0/json.bend as Json
import 0x49814d83de8f70993a43e1002be29ecd/bytes.bend as Bytes
import bend-kit-url@0.4.1.0/url.bend as Url
import ./response.bend as Response

Types

type Parent source · line 218 · raw

Type

An explicit stack avoids mutually recursive tree walkers. Each decoded object has its own key set; escaped and literal spellings compare as the same text.

type Walk source · line 222 · raw

Type

Definitions

def decimal.step source · line 16 · raw

@ok:Bool -> @+acc:U32 -> @digit:U32 -> @next:(@_:U32 -> Maybe<&2, U32>) -> Maybe<&2, U32>

def decimal.go source · line 21 · raw

@text:String -> @+acc:U32 -> Maybe<&2, U32>

def u32 source · line 29 · raw

@text:String -> Maybe<&2, U32>

Nonempty ASCII decimal only; arithmetic happens only after the overflow guard.

def query.keep source · line 57 · raw

@same:Bool -> @value:String -> @rest:List<&2, String> -> List<&2, String>

def query.values source · line 61 · raw

@xs:List<&2, 0x9606cc4b1afb0de13a7da7c0f6fc3a82/target.Query> -> @+key:String -> List<&2, String>

def utf8.step source · line 89 · raw

@pair:Pair(Array<U32>, U32) -> @state:0x9606cc4b1afb0de13a7da7c0f6fc3a82/target.Utf -> Pair(Array<U32>, Maybe<&2, 0x9606cc4b1afb0de13a7da7c0f6fc3a82/target.Utf>)

Reuse Target's RFC 3629 state machine directly over the owned packed array.

def utf8.go source · line 94 · raw

@fuel:Nat -> @pair:Pair(Array<U32>, Maybe<&2, 0x9606cc4b1afb0de13a7da7c0f6fc3a82/target.Utf>) -> @+index:U32 -> Pair(Array<U32>, Maybe<&2, String>)

def utf8.borrowed source · line 105 · raw

@len:U32 -> @pair:Pair(Array<U32>, Maybe<&2, String>) -> Pair(0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body, Maybe<&2, String>)

def utf8.borrow source · line 109 · raw

@bytes:0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body -> Pair(0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body, Maybe<&2, String>)

def utf8.text source · line 113 · raw

@pair:Pair(0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body, Maybe<&2, String>) -> Maybe<&2, String>

def utf8 source · line 117 · raw

@bytes:0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body -> Maybe<&2, String>

def media.part source · line 121 · raw

@split:Bool -> @+c:U32 -> @+quoted:Bool -> @+escaped:Bool -> @acc:String -> @parts:List<&2, String> -> Pair(Bool, Pair(Bool, Pair(String, List<&2, String>)))

Split only unquoted semicolons, retaining quoted parameter syntax for checks.

def media.end source · line 127 · raw

@invalid:Bool -> @acc:String -> @parts:List<&2, String> -> List<&2, String>

def media.parts source · line 132 · raw

@text:String -> @state:Pair(Bool, Pair(Bool, Pair(String, List<&2, String>))) -> List<&2, String>

def media.charset.quoted source · line 142 · raw

@text:String -> @expected:String -> @escaped:Bool -> Bool

Compare the decoded quoted-string charset without allocating a second value.

def media.charset.start source · line 159 · raw

@quoted:Bool -> @c:U32 -> @rest:String -> Bool

def media.charset.value source · line 164 · raw

@value:String -> Bool

def media.parameter source · line 169 · raw

@pair:Pair(String, String) -> Bool

def media.charset source · line 175 · raw

@parts:List<&2, String> -> Bool

def media.type source · line 180 · raw

@json:Bool -> @+name:String -> Bool

def media.content source · line 187 · raw

@json:Bool -> @parts:List<&2, String> -> Bool

def media.encoding source · line 192 · raw

@values:List<&2, String> -> Bool

def media.headers source · line 197 · raw

@json:Bool -> @types:List<&2, String> -> @encodings:List<&2, String> -> Bool

def media source · line 202 · raw

@json:Bool -> @+headers:Map<&2, List<&2, String>> -> Bool

def raw source · line 205 · raw

@body:0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body -> Result<&2, &1, U32, 0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body>

def text.accepted source · line 208 · raw

@accepted:Bool -> @body:0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body -> Result<&2, &1, U32, String>

def text source · line 213 · raw

@headers:Map<&2, List<&2, String>> -> @body:0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body -> Result<&2, &1, U32, String>

def unique.field source · line 228 · raw

@repeated:Bool -> @key:0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes -> @value:0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val -> @rest:List<&1, Pair(0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val)> -> @acc:List<&1, Pair(0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val)> -> @seen:Set -> @parents:List<&1, Parent> -> Maybe<&1, Walk>

def unique.seen source · line 233 · raw

@pair:Pair(Set, Bool) -> @name:String -> @key:0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes -> @value:0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val -> @rest:List<&1, Pair(0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val)> -> @acc:List<&1, Pair(0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val)> -> @parents:List<&1, Parent> -> Maybe<&1, Walk>

def unique.key source · line 237 · raw

@text:Maybe<&2, String> -> @key:0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes -> @value:0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val -> @rest:List<&1, Pair(0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val)> -> @acc:List<&1, Pair(0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val)> -> @seen:Set -> @parents:List<&1, Parent> -> Maybe<&1, Walk>

def unique.borrowed source · line 243 · raw

@pair:Pair(0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body, Maybe<&2, String>) -> @value:0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val -> @rest:List<&1, Pair(0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val)> -> @acc:List<&1, Pair(0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val)> -> @seen:Set -> @parents:List<&1, Parent> -> Maybe<&1, Walk>

def unique.step source · line 247 · raw

@step:Walk -> Maybe<&1, Walk>

def unique source · line 272 · raw

@fuel:Nat -> @step:Maybe<&1, Walk> -> Maybe<&1, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val>

def json.parsed source · line 281 · raw

@fuel:Nat -> @value:Maybe<&1, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val> -> Result<&2, &1, U32, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val>

def json.accepted source · line 286 · raw

@accepted:Bool -> @cap:U32 -> @body:0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body -> Result<&2, &1, U32, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val>

def json.with_depth source · line 293 · raw

@headers:Map<&2, List<&2, String>> -> @body:0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body -> @cap:U32 -> Result<&2, &1, U32, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val>

def json source · line 296 · raw

@headers:Map<&2, List<&2, String>> -> @body:0x6a946b742ab6f76f0ba5b90b14da52ad/http.Body -> Result<&2, &1, U32, 0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val>

def number.u32 source · line 300 · raw

@value:0xc57af2d86db2e94187b6fb2ac4976fc9/json.Val -> Result<&2, &1, U32, U32>

Exact number text remains packed until this explicit checked conversion.

Templates

template checked source · line 11 · raw

@-I:Type -> @value:Maybe<&1, I> -> Result<&2, &1, U32, I>

Expected HTTP status, not an exception; the dispatch executor maps it once.

template scalar.convert source · line 34 · raw

@-I:Data -> @value:Maybe<&2, I> -> Result<&2, &1, U32, I>

template path.value source · line 39 · raw

@-I:Data -> @-convert:(@_:String -> Maybe<&2, I>) -> @pair:Pair(Map<&2, String>, String) -> Result<&2, &1, U32, I>

template path.present source · line 43 · raw

@-I:Data -> @-convert:(@_:String -> Maybe<&2, I>) -> @present:Bool -> @params:Map<&2, String> -> @key:String -> Result<&2, &1, U32, I>

template path.found source · line 49 · raw

@-I:Data -> @-convert:(@_:String -> Maybe<&2, I>) -> @key:String -> @pair:Pair(Map<&2, String>, Bool) -> Result<&2, &1, U32, I>

template path source · line 53 · raw

@-I:Data -> @-convert:(@_:String -> Maybe<&2, I>) -> @params:Map<&2, String> -> @+key:String -> Result<&2, &1, U32, I>

template scalar.values source · line 68 · raw

@-I:Data -> @-convert:(@_:String -> Maybe<&2, I>) -> @values:List<&2, String> -> Result<&2, &1, U32, I>

template query.scalar source · line 73 · raw

@-I:Data -> @-convert:(@_:String -> Maybe<&2, I>) -> @query:List<&2, 0x9606cc4b1afb0de13a7da7c0f6fc3a82/target.Query> -> @key:String -> Result<&2, &1, U32, I>

template list.values source · line 76 · raw

@-I:Data -> @-convert:(@_:String -> Maybe<&2, I>) -> @values:List<&2, String> -> Result<&2, &1, U32, List<&2, I>>

template query.list source · line 85 · raw

@-I:Data -> @-convert:(@_:String -> Maybe<&2, I>) -> @query:List<&2, 0x9606cc4b1afb0de13a7da7c0f6fc3a82/target.Query> -> @key:String -> Result<&2, &1, U32, List<&2, I>>