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

View File

@ -18,10 +18,10 @@ bootDataspace("main") do (root: Ref; turn: var Turn):
connectStdio(root, 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,) 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]): onMessage(turn, ds, ?XdgOpen) do (uris: seq[string]):
for uri in uris: for uri in uris:
var matched: bool var matched: bool

View File

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

View File

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