content: on-the-wire serialization (wire.sx) + 11 tests (534/534)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 40s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 40s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
14
lib/content/wire.sx
Normal file
14
lib/content/wire.sx
Normal file
@@ -0,0 +1,14 @@
|
||||
;; content-on-sx — on-the-wire serialization.
|
||||
;;
|
||||
;; content/to-wire serialises a document to a transmittable SX-text string (via
|
||||
;; the data form + the SX serializer); content/from-wire parses it back into a
|
||||
;; live document. This is the format to persist a whole document or send it over
|
||||
;; HTTP / federation, distinct from the per-op persist log.
|
||||
;;
|
||||
;; Requires (loaded by harness): data.sx (content/to-data / content/from-data).
|
||||
|
||||
(define content/to-wire (fn (doc) (serialize (content/to-data doc))))
|
||||
(define content/from-wire (fn (s) (content/from-data (parse s))))
|
||||
(define
|
||||
content/wire-round-trip
|
||||
(fn (doc) (content/from-wire (content/to-wire doc))))
|
||||
Reference in New Issue
Block a user