Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor syscalls not present in the query for all syscalls from the documentation #824

Closed
simone-viozzi opened this issue Mar 19, 2024 · 1 comment

Comments

@simone-viozzi
Copy link

This query should list all syscalls:

{{#each @module in {syscall select replace(name, /\.\w+$/, "") as name}}}
## {{@module.name}}
{{#each {syscall where @module.name = replace(name, /\.\w+$/, "")}}}
* `{{name}}`
{{/each}}

{{/each}}

Yet editor.* are not present in this list.

I know they should be present because they are being used in a script https://github.com/gorootde/silverbullet-collection/blob/main/scripts/InsertDate.md:

const picked=await syscall("editor.filterBox","Pick a date",dateOptions)
  if(picked){
    await syscall("editor.insertAtCursor",picked.date.toString())
  }

here is my list:

event

  • event.dispatch
  • event.list

space

  • space.listPages
  • space.readPage
  • space.getPageMeta
  • space.listPlugs
  • space.listAttachments
  • space.readAttachment
  • space.getAttachmentMeta
  • space.listFiles
  • space.getFileMeta
  • space.readFile
  • space.writePage
  • space.deletePage
  • space.writeAttachment
  • space.deleteAttachment
  • space.writeFile
  • space.deleteFile

asset

  • asset.readAsset

yaml

  • yaml.parse
  • yaml.stringify

system

  • system.invokeFunction
  • system.invokeCommand
  • system.listCommands
  • system.listSyscalls
  • system.reloadPlugs
  • system.loadSpaceScripts
  • system.loadSpaceStyles
  • system.invokeSpaceFunction
  • system.applyAttributeExtractors
  • system.getEnv
  • system.getMode
  • system.getVersion

mq

  • mq.send
  • mq.batchSend
  • mq.ack
  • mq.batchAck
  • mq.getQueueStats

language

  • language.parseLanguage
  • language.listLanguages

template

  • template.renderTemplate
  • template.parseTemplate

datastore

  • datastore.batchGet
  • datastore.get
  • datastore.query
  • datastore.listFunctions
  • datastore.delete
  • datastore.set
  • datastore.batchSet
  • datastore.batchDelete
  • datastore.queryDelete

codeWidget

  • codeWidget.render

markdown

  • markdown.parseMarkdown

sandboxFetch

  • sandboxFetch.fetch

shell

  • shell.run
@tmichela
Copy link
Contributor

cf. this post

Right. These syscalls don’t appear on that page because they’re not available on the server, just on the client. Therefore they can only be used for some use cases like commands (which run in the client), but not custom functions used in templates (rendered on the server). The reason they don’t appear on that list is that that list is rendered by a template, which queries for all available syscalls… on the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants