Regenerate protocol modules

This commit is contained in:
Emery Hemingway 2023-03-01 20:50:46 -06:00
parent a8e75bd4db
commit 76b7b75211
4 changed files with 14 additions and 21 deletions

View File

@ -8,32 +8,25 @@ type
UriRunnerConfigKind* {.pure.} = enum
`ListenOn`, `ActionHandler`
`UriRunnerConfig`*[E] {.preservesOr.} = ref object
`UriRunnerConfig`* {.preservesOr.} = object
case orKind*: UriRunnerConfigKind
of UriRunnerConfigKind.`ListenOn`:
`listenon`*: ListenOn[E]
`listenon`*: ListenOn
of UriRunnerConfigKind.`ActionHandler`:
`actionhandler`*: ActionHandler[E]
`actionhandler`*: ActionHandler
ListenOn*[E] {.preservesRecord: "listen-on".} = ref object
`dataspace`*: Preserve[E]
ListenOn* {.preservesRecord: "listen-on".} = object
`dataspace`* {.preservesEmbedded.}: Preserve[void]
ActionHandler*[E] {.preservesRecord: "action-handler".} = ref object
ActionHandler* {.preservesRecord: "action-handler".} = object
`pat`*: string
`action`*: Preserve[E]
`entity`*: Preserve[E]
`entity`* {.preservesEmbedded.}: Preserve[void]
`action`*: Preserve[void]
proc `$`*[E](x: UriRunnerConfig[E] | ListenOn[E] | ActionHandler[E]): string =
`$`(toPreserve(x, E))
proc encode*[E](x: UriRunnerConfig[E] | ListenOn[E] | ActionHandler[E]): seq[
byte] =
encode(toPreserve(x, E))
proc `$`*(x: XdgOpen): string =
proc `$`*(x: XdgOpen | UriRunnerConfig | ListenOn | ActionHandler): string =
`$`(toPreserve(x))
proc encode*(x: XdgOpen): seq[byte] =
proc encode*(x: XdgOpen | UriRunnerConfig | ListenOn | ActionHandler): seq[byte] =
encode(toPreserve(x))

View File

@ -18,10 +18,10 @@ bootDataspace("main") do (root: Ref; turn: var Turn):
connectStdio(root, turn)
onPublish(turn, root, ?ActionHandler[Ref]) do (pat: string; entity: Ref; response: Assertion):
onPublish(turn, root, ?ActionHandler) do (pat: string; entity: Ref; response: Assertion):
handlers.add (re(pat, {reIgnoreCase, reStudy}), entity, response,)
during(turn, root, ?ListenOn[Ref]) do (ds: Ref):
during(turn, root, ?ListenOn) do (ds: Ref):
onMessage(turn, ds, ?XdgOpen) do (uris: seq[string]):
for uri in uris:
var matched: bool

View File

@ -13,7 +13,7 @@ proc unixSocketPath: string =
proc mintCap: SturdyRef =
var key: array[16, byte]
mint(key, "syndicate")
cast[SturdyRef](mint(key, "syndicate"))
bootDataspace("main") do (root: Ref; turn: var Turn):
connectUnix(turn, unixSocketPath(), mintCap()) do (turn: var Turn; ds: Ref):

View File

@ -1,6 +1,6 @@
# Package
version = "99999999"
version = "20230301"
author = "Emery"
description = "A better xdg-open"
license = "Unlicense"