mirror of
https://github.com/urbit/shrub.git
synced 2024-09-11 20:27:19 +03:00
json: remove deprecated JSON parser calls
This commit is contained in:
parent
43160147f4
commit
71ccdbe4ab
@ -460,7 +460,7 @@
|
||||
:- ~
|
||||
^- octs
|
||||
=; pro=json
|
||||
(as-octt:mimes:html (en-json:html (sign:jws key.act pro bod)))
|
||||
(as-octs:mimes:html (en:json:html (sign:jws key.act pro bod)))
|
||||
:- %o %- my :~
|
||||
nonce+s+non
|
||||
url+s+(crip (en-purl:html url))
|
||||
@ -487,7 +487,7 @@
|
||||
::
|
||||
?. =(400 p.rep) |
|
||||
?~ r.rep |
|
||||
=/ jon=(unit json) (de-json:html q.u.r.rep)
|
||||
=/ jon=(unit json) (de:json:html q.u.r.rep)
|
||||
?~ jon |
|
||||
=('urn:ietf:params:acme:error:badNonce' type:(error:grab u.jon))
|
||||
:: +rate-limited: handle Acme service rate-limits
|
||||
@ -496,7 +496,7 @@
|
||||
|= [try=@ud act=@tas spur=wire bod=(unit octs)]
|
||||
^+ this
|
||||
=/ jon=(unit json)
|
||||
?~(bod ~ (de-json:html q.u.bod))
|
||||
?~(bod ~ (de:json:html q.u.bod))
|
||||
?~ jon
|
||||
:: no details, back way off
|
||||
:: XX specifically based on wire
|
||||
@ -839,7 +839,7 @@
|
||||
?: (lth try 10)
|
||||
(retry:effect try %directory / (min ~m30 (backoff try)))
|
||||
(emil (notify (failure-message directory-base) [(sell !>(rep)) ~]))
|
||||
=. dir (directory:grab (need (de-json:html q:(need r.rep))))
|
||||
=. dir (directory:grab (need (de:json:html q:(need r.rep))))
|
||||
?~(reg.act register:effect this)
|
||||
:: +nonce: accept new nonce and trigger next effect
|
||||
::
|
||||
@ -883,7 +883,7 @@
|
||||
?~ r.rep
|
||||
(scot %da now.bow)
|
||||
=/ bod=acct:body
|
||||
(acct:grab (need (de-json:html q.u.r.rep)))
|
||||
(acct:grab (need (de:json:html q.u.r.rep)))
|
||||
?> ?=(%valid sas.bod)
|
||||
wen.bod
|
||||
=. reg.act `[wen loc]
|
||||
@ -913,7 +913,7 @@
|
||||
:: XX check status
|
||||
::
|
||||
=/ bod=order:body
|
||||
(order:grab (need (de-json:html q:(need r.rep))))
|
||||
(order:grab (need (de:json:html q:(need r.rep))))
|
||||
=/ dom=(set turf) ~(key by dom.u.next-order)
|
||||
:: XX maybe generate key here?
|
||||
::
|
||||
@ -956,7 +956,7 @@
|
||||
::
|
||||
(emil (notify (failure-message ego.u.rod) [(sell !>(rep)) ~]))
|
||||
=/ bod=order:body
|
||||
(order:grab (need (de-json:html q:(need r.rep))))
|
||||
(order:grab (need (de:json:html q:(need r.rep))))
|
||||
?+ sas.bod
|
||||
~& [%check-order-status-unknown sas.bod]
|
||||
this
|
||||
@ -1063,7 +1063,7 @@
|
||||
::
|
||||
(emil (notify (failure-message i.pending.aut.u.rod) [(sell !>(rep)) ~]))
|
||||
=/ bod=auth:body
|
||||
(auth:grab (need (de-json:html q:(need r.rep))))
|
||||
(auth:grab (need (de:json:html q:(need r.rep))))
|
||||
=/ cal=trial
|
||||
:: XX parse token to verify url-safe base64?
|
||||
::
|
||||
@ -1147,7 +1147,7 @@
|
||||
:: XX get challenge, confirm urn:ietf:params:acme:error:connection
|
||||
::
|
||||
:: =/ err=error:body
|
||||
:: (error:grab (need (de-json:html q:(need r.rep))))
|
||||
:: (error:grab (need (de:json:html q:(need r.rep))))
|
||||
:: ?: =('urn:ietf:params:acme:error:malformed' status.err)
|
||||
::
|
||||
=< cancel-order:effect
|
||||
@ -1155,7 +1155,7 @@
|
||||
'unable to finalize domain validation challenge'
|
||||
(emil (notify msg [(sell !>(rep)) ~]))
|
||||
=/ bod=challenge:body
|
||||
(challenge:grab (need (de-json:html q:(need r.rep))))
|
||||
(challenge:grab (need (de:json:html q:(need r.rep))))
|
||||
:: XX check for other possible values in 200 response
|
||||
:: note: may have already been validated
|
||||
::
|
||||
|
@ -269,7 +269,7 @@
|
||||
|= reg=cord
|
||||
^- (list [=ship rights])
|
||||
~| %registration-json-insane
|
||||
=+ jon=(need (de-json:html reg))
|
||||
=+ jon=(need (de:json:html reg))
|
||||
~| %registration-json-invalid
|
||||
?> ?=(%o -.jon)
|
||||
=. p.jon (~(del by p.jon) 'idCode')
|
||||
|
@ -70,7 +70,7 @@
|
||||
^- card:agent:gall
|
||||
[%pass /import-all %agent [our.bowl app] %poke %import !>(data)]
|
||||
=/ jon=json
|
||||
(need (de-json:html body))
|
||||
(need (de:json:html body))
|
||||
=/ com=command:lens
|
||||
(json:grab:lens-mark jon)
|
||||
::
|
||||
|
@ -315,7 +315,7 @@
|
||||
::
|
||||
=/ tube (convert-tube %json input-mark desk bowl)
|
||||
?> ?=(^ body.request.inbound-request)
|
||||
=/ body=json (need (de-json:html q.u.body.request.inbound-request))
|
||||
=/ body=json (need (de:json:html q.u.body.request.inbound-request))
|
||||
=/ input=vase (slop !>(~) (tube !>(body)))
|
||||
=/ boc bec
|
||||
=/ =start-args:spider [~ `tid boc(q desk, r da+now.bowl) thread input]
|
||||
|
@ -57,7 +57,7 @@
|
||||
++ get-single-req
|
||||
|= req=@t
|
||||
=/ batch
|
||||
((ar:dejs:format same) (need (de-json:html req)))
|
||||
((ar:dejs:format same) (need (de:json:html req)))
|
||||
?> ?=([* ~] batch)
|
||||
i.batch
|
||||
::
|
||||
@ -110,8 +110,7 @@
|
||||
|= [req=@t result=json]
|
||||
^- card:agent:gall
|
||||
=/ resp
|
||||
%- crip
|
||||
%- en-json:html
|
||||
%- en:json:html
|
||||
:- %a :_ ~
|
||||
%- pairs
|
||||
:~ id+s+(get-id req)
|
||||
|
@ -10,8 +10,8 @@
|
||||
%- ~(gas in *math:eyre)
|
||||
~['Content-Type'^['application/json']~]
|
||||
%- some
|
||||
%- as-octt:mimes:html
|
||||
(en-json:html (request-to-json req))
|
||||
%- as-octs:mimes:html
|
||||
(en:json:html (request-to-json req))
|
||||
::
|
||||
++ request-to-json
|
||||
|= request
|
||||
@ -65,7 +65,7 @@
|
||||
|= body=(unit octs)
|
||||
^- (unit batch-request)
|
||||
?~ body ~
|
||||
?~ jon=(de-json:html q.u.body) ~
|
||||
?~ jon=(de:json:html q.u.body) ~
|
||||
=, dejs-soft:format
|
||||
=; reparser
|
||||
?: ?=([%a *] u.jon)
|
||||
|
@ -49,8 +49,8 @@
|
||||
::
|
||||
++ czar
|
||||
^- octs
|
||||
%- as-octt:mimes:html
|
||||
%- en-json:html
|
||||
%- as-octs:mimes:html
|
||||
%- en:json:html
|
||||
:- %a
|
||||
%+ turn (gulf 0 255)
|
||||
|= gal=@
|
||||
@ -63,8 +63,8 @@
|
||||
++ point
|
||||
|= who=ship
|
||||
^- octs
|
||||
%- as-octt:mimes:html
|
||||
%- en-json:html
|
||||
%- as-octs:mimes:html
|
||||
%- en:json:html
|
||||
%+ request-to-json
|
||||
~.
|
||||
:- 'getPoint'
|
||||
@ -73,8 +73,8 @@
|
||||
::
|
||||
++ turf
|
||||
^- octs
|
||||
%- as-octt:mimes:html
|
||||
%- en-json:html
|
||||
%- as-octs:mimes:html
|
||||
%- en:json:html
|
||||
%+ request-to-json
|
||||
'turf'
|
||||
['getDns' ~]
|
||||
@ -106,7 +106,7 @@
|
||||
++ czar
|
||||
|= rep=octs
|
||||
^- (unit (map ship [=rift =life =pass]))
|
||||
=/ jon=(unit json) (de-json:html q.rep)
|
||||
=/ jon=(unit json) (de:json:html q.rep)
|
||||
?~ jon
|
||||
~&([%czar-take-dawn %invalid-json] ~)
|
||||
=/ res=(unit (list [@t @ud @ud @]))
|
||||
@ -142,7 +142,7 @@
|
||||
|= [who=ship rep=octs]
|
||||
^- (unit point:azimuth)
|
||||
~! *point:azimuth
|
||||
=/ jon=(unit json) (de-json:html q.rep)
|
||||
=/ jon=(unit json) (de:json:html q.rep)
|
||||
?~ jon
|
||||
~&([%point-take-dawn %invalid-json] ~)
|
||||
=- ?~ res
|
||||
@ -202,7 +202,7 @@
|
||||
++ turf
|
||||
|= rep=octs
|
||||
^- (unit (list ^turf))
|
||||
=/ jon=(unit json) (de-json:html q.rep)
|
||||
=/ jon=(unit json) (de:json:html q.rep)
|
||||
?~ jon
|
||||
~&([%turf-take-dawn %invalid-json] ~)
|
||||
=/ res=(unit (list @t))
|
||||
|
@ -224,7 +224,7 @@
|
||||
^- (each (list channel-request) @t)
|
||||
?- mode
|
||||
%json
|
||||
?~ maybe-json=(de-json:html q.body)
|
||||
?~ maybe-json=(de:json:html q.body)
|
||||
|+'put body not json'
|
||||
?~ maybe-requests=(parse-channel-request-json u.maybe-json)
|
||||
|+'invalid channel json'
|
||||
@ -1840,7 +1840,7 @@
|
||||
^- (unit (quip move tape))
|
||||
?- mode.channel
|
||||
%json %+ bind (channel-event-to-json channel request-id channel-event)
|
||||
|=((quip move json) [+<- (en-json:html +<+)])
|
||||
|=((quip move json) [+<- (trip (en:json:html +<+))])
|
||||
%jam =- `[~ (scow %uw (jam -))]
|
||||
[request-id channel-event]
|
||||
==
|
||||
|
@ -4331,7 +4331,7 @@
|
||||
~% %json ..part ~
|
||||
|%
|
||||
:: :: ++en:json:html
|
||||
++ en :: encode JSON to tape
|
||||
++ en :: encode JSON to cord
|
||||
~% %en +>+ ~
|
||||
|^ |= jon=^json
|
||||
^- cord
|
||||
@ -4399,11 +4399,11 @@
|
||||
|^ |= txt=cord
|
||||
^- (unit ^json)
|
||||
(rush txt apex)
|
||||
:: :: ++abox:de-json:html
|
||||
:: :: ++abox:de:json:html
|
||||
++ abox :: array
|
||||
%+ stag %a
|
||||
(ifix [sel (wish ser)] (more (wish com) apex))
|
||||
:: :: ++apex:de-json:html
|
||||
:: :: ++apex:de:json:html
|
||||
++ apex :: any value
|
||||
%+ knee *^json |. ~+
|
||||
%+ ifix [spac spac]
|
||||
@ -4415,13 +4415,13 @@
|
||||
abox
|
||||
obox
|
||||
==
|
||||
:: :: ++bool:de-json:html
|
||||
:: :: ++bool:de:json:html
|
||||
++ bool :: boolean
|
||||
;~ pose
|
||||
(cold & (jest 'true'))
|
||||
(cold | (jest 'false'))
|
||||
==
|
||||
:: :: ++esca:de-json:html
|
||||
:: :: ++esca:de:json:html
|
||||
++ esca :: escaped character
|
||||
;~ pfix bas
|
||||
=* loo
|
||||
@ -4435,23 +4435,23 @@
|
||||
(sear ~(get by wow) low)
|
||||
;~(pose doq fas bas loo unic)
|
||||
==
|
||||
:: :: ++expo:de-json:html
|
||||
:: :: ++expo:de:json:html
|
||||
++ expo :: exponent
|
||||
;~ (comp weld)
|
||||
(piec (mask "eE"))
|
||||
(mayb (piec (mask "+-")))
|
||||
(plus nud)
|
||||
==
|
||||
:: :: ++frac:de-json:html
|
||||
:: :: ++frac:de:json:html
|
||||
++ frac :: fraction
|
||||
;~(plug dot (plus nud))
|
||||
:: :: ++jcha:de-json:html
|
||||
:: :: ++jcha:de:json:html
|
||||
++ jcha :: string character
|
||||
;~(pose ;~(less doq bas (shim 32 255)) esca)
|
||||
:: :: ++mayb:de-json:html
|
||||
:: :: ++mayb:de:json:html
|
||||
++ mayb :: optional
|
||||
|*(bus=rule ;~(pose bus (easy ~)))
|
||||
:: :: ++numb:de-json:html
|
||||
:: :: ++numb:de:json:html
|
||||
++ numb :: number
|
||||
;~ (comp weld)
|
||||
(mayb (piec hep))
|
||||
@ -4462,31 +4462,31 @@
|
||||
(mayb frac)
|
||||
(mayb expo)
|
||||
==
|
||||
:: :: ++obje:de-json:html
|
||||
:: :: ++obje:de:json:html
|
||||
++ obje :: object list
|
||||
%+ ifix [(wish kel) (wish ker)]
|
||||
(more (wish com) pear)
|
||||
:: :: ++obox:de-json:html
|
||||
:: :: ++obox:de:json:html
|
||||
++ obox :: object
|
||||
(stag %o (cook malt obje))
|
||||
:: :: ++pear:de-json:html
|
||||
:: :: ++pear:de:json:html
|
||||
++ pear :: key-value
|
||||
;~(plug ;~(sfix (wish stri) (wish col)) apex)
|
||||
:: :: ++piec:de-json:html
|
||||
:: :: ++piec:de:json:html
|
||||
++ piec :: listify
|
||||
|* bus=rule
|
||||
(cook |=(a=@ [a ~]) bus)
|
||||
:: :: ++stri:de-json:html
|
||||
:: :: ++stri:de:json:html
|
||||
++ stri :: string
|
||||
%+ sear
|
||||
|= a=cord
|
||||
?. (sune a) ~
|
||||
(some a)
|
||||
(cook crip (ifix [doq doq] (star jcha)))
|
||||
:: :: ++spac:de-json:html
|
||||
:: :: ++spac:de:json:html
|
||||
++ spac :: whitespace
|
||||
(star (mask [`@`9 `@`10 `@`13 ' ' ~]))
|
||||
:: :: ++unic:de-json:html
|
||||
:: :: ++unic:de:json:html
|
||||
++ unic :: escaped UTF16
|
||||
=* lob 0x0
|
||||
=* hsb 0xd800
|
||||
@ -4529,7 +4529,7 @@
|
||||
==
|
||||
==
|
||||
--
|
||||
:: :: ++utfe:de-json:html
|
||||
:: :: ++utfe:de:json:html
|
||||
++ utfe :: UTF-8 sequence
|
||||
;~ less doq bas
|
||||
=* qua
|
||||
@ -4590,18 +4590,18 @@
|
||||
==
|
||||
;~(pose qua tre dos)
|
||||
==
|
||||
:: :: ++wish:de-json:html
|
||||
:: :: ++wish:de:json:html
|
||||
++ wish :: with whitespace
|
||||
|*(sef=rule ;~(pfix spac sef))
|
||||
:: XX: These gates should be moved to hoon.hoon
|
||||
:: :: ++sune:de-json:html
|
||||
:: :: ++sune:de:json:html
|
||||
++ sune :: cord UTF-8 sanity
|
||||
|= b=@t
|
||||
^- ?
|
||||
?: =(0 b) &
|
||||
?. (sung b) |
|
||||
$(b (rsh [3 (teff b)] b))
|
||||
:: :: ++sung:de-json:html
|
||||
:: :: ++sung:de:json:html
|
||||
++ sung :: char UTF-8 sanity
|
||||
|^ |= b=@t
|
||||
^- ?
|
||||
@ -4682,7 +4682,7 @@
|
||||
&((gte a bot) (lte a top))
|
||||
--
|
||||
:: XX: This +teff should overwrite the existing +teff
|
||||
:: :: ++teff:de-json:html
|
||||
:: :: ++teff:de:json:html
|
||||
++ teff :: UTF-8 length
|
||||
|= a=@t
|
||||
^- @
|
||||
|
@ -114,7 +114,7 @@
|
||||
++ get-single-req
|
||||
|= req=@t
|
||||
=/ batch
|
||||
((ar:dejs:format same) (need (de-json:html req)))
|
||||
((ar:dejs:format same) (need (de:json:html req)))
|
||||
?> ?=([* ~] batch)
|
||||
i.batch
|
||||
::
|
||||
@ -167,8 +167,7 @@
|
||||
|= [req=@t result=json]
|
||||
^- card:agent:gall
|
||||
=/ resp
|
||||
%- crip
|
||||
%- en-json:html
|
||||
%- en:json:html
|
||||
:- %a :_ ~
|
||||
%- pairs
|
||||
:~ id+s+(get-id req)
|
||||
|
@ -137,7 +137,7 @@
|
||||
=(chain-id 1)
|
||||
==
|
||||
fallback
|
||||
?~ jon=(de-json:html q.data.u.full-file.u.rep)
|
||||
?~ jon=(de:json:html q.data.u.full-file.u.rep)
|
||||
fallback
|
||||
=; res=(unit @ud)
|
||||
?~ res fallback
|
||||
|
@ -43,8 +43,8 @@
|
||||
url=url
|
||||
header-list=['Content-Type'^'application/json' ~]
|
||||
^= body
|
||||
%- some %- as-octt:mimes:html
|
||||
%- en-json:html
|
||||
%- some %- as-octs:mimes:html
|
||||
%- en:json:html
|
||||
(request-to-json:rpc:ethereum id req)
|
||||
==
|
||||
;< ~ bind:m (send-request:strandio request)
|
||||
@ -62,7 +62,7 @@
|
||||
?~ full-file.client-response
|
||||
(pure:m ~)
|
||||
=/ body=@t q.data.u.full-file.client-response
|
||||
=/ jon=(unit json) (de-json:html body)
|
||||
=/ jon=(unit json) (de:json:html body)
|
||||
?~ jon
|
||||
(pure:m ~)
|
||||
=, dejs-soft:format
|
||||
|
@ -652,7 +652,7 @@
|
||||
:^ url %post
|
||||
%- ~(gas in *math)
|
||||
~['Content-Type'^['application/json']~]
|
||||
(some (as-octt (en-json:html jon)))
|
||||
(some (as-octs (en:json:html jon)))
|
||||
:: +light-json-request: like json-request, but for %l
|
||||
::
|
||||
:: TODO: Exorcising +purl from our system is a much longer term effort;
|
||||
@ -665,7 +665,7 @@
|
||||
:* %'POST'
|
||||
(crip (en-purl:html url))
|
||||
~[['content-type' 'application/json']]
|
||||
(some (as-octt (en-json:html jon)))
|
||||
(some (as-octs (en:json:html jon)))
|
||||
==
|
||||
::
|
||||
++ batch-read-request
|
||||
|
@ -76,8 +76,8 @@
|
||||
header-list=['Content-Type'^'application/json' ~]
|
||||
::
|
||||
^= body
|
||||
%- some %- as-octt:mimes:html
|
||||
%- en-json:html
|
||||
%- some %- as-octs:mimes:html
|
||||
%- en:json:html
|
||||
a+(turn reqs request-to-json:rpc:ethereum)
|
||||
==
|
||||
;< ~ bind:m
|
||||
@ -96,7 +96,7 @@
|
||||
?~ full-file.client-response
|
||||
(pure:m ~)
|
||||
=/ body=@t q.data.u.full-file.client-response
|
||||
=/ jon=(unit json) (de-json:html body)
|
||||
=/ jon=(unit json) (de:json:html body)
|
||||
?~ jon
|
||||
(pure:m ~)
|
||||
=/ array=(unit (list response:rpc))
|
||||
|
@ -19,7 +19,7 @@
|
||||
++ json-to-octs
|
||||
|= jon=json
|
||||
^- octs
|
||||
(as-octt:mimes:html (en-json:html jon))
|
||||
(as-octs:mimes:html (en:json:html jon))
|
||||
::
|
||||
++ app
|
||||
|%
|
||||
|
@ -470,7 +470,7 @@
|
||||
=/ m (strand ,json)
|
||||
^- form:m
|
||||
;< =cord bind:m (fetch-cord url)
|
||||
=/ json=(unit json) (de-json:html cord)
|
||||
=/ json=(unit json) (de:json:html cord)
|
||||
?~ json
|
||||
(strand-fail %json-parse-error ~)
|
||||
(pure:m u.json)
|
||||
|
@ -120,7 +120,7 @@
|
||||
?~ data
|
||||
:: data is null
|
||||
[~ state]
|
||||
=/ ujon=(unit json) (de-json:html q.data.u.data)
|
||||
=/ ujon=(unit json) (de:json:html q.data.u.data)
|
||||
?~ ujon
|
||||
[~ state]
|
||||
?> ?=(%o -.u.ujon)
|
||||
|
@ -110,8 +110,8 @@
|
||||
url=url
|
||||
header-list=['Content-Type'^'application/json' ~]
|
||||
^= body
|
||||
%- some %- as-octt:mimes:html
|
||||
%- en-json:html
|
||||
%- some %- as-octs:mimes:html
|
||||
%- en:json:html
|
||||
%: pairs:enjs:format
|
||||
:- 'grant_type'
|
||||
s+'urn:ietf:params:oauth:grant-type:jwt-bearer'
|
||||
@ -125,7 +125,7 @@
|
||||
?~ full-file.rep
|
||||
(strand-fail:strandio %gcp-no-response ~)
|
||||
=/ body=@t q.data.u.full-file.rep
|
||||
=/ jon=(unit json) (de-json:html body)
|
||||
=/ jon=(unit json) (de:json:html body)
|
||||
?~ jon
|
||||
~| body
|
||||
(strand-fail:strandio %gcp-bad-body ~)
|
||||
|
Loading…
Reference in New Issue
Block a user