core.exec
0.000000

Executes a composition.

Arguments
procrequired
The composition to execute.
**
Other arguments passed along to the composition.
Return Value
The result of the given composition.

Procs can be composed into more complex programs, called compositions. When called through core.exec, each proc in the composition is called in order, piping the output of a proc as input to the next. The entire composition is called in a single api request, making compositions quite performant.

something went wrong :(
Calling a composition
Setup
authorization=PROCAUTH
require "proc"

client = Proc.connect("PROCAUTH")
const Proc = require("@proc.dev/client");
const client = Proc.connect("PROCAUTH");
client.core.exec {
  client.type.string.reverse >> client.type.string.upcase
}.call("hello")
client.core.exec.call("hello", {}, () => {
  return client.type.string.reverse.compose(
    client.type.string.upcase
  );
});
curl "https://proc.run/core/exec" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: application/vnd.proc+json" \
--header "accept: text/plain" \
--data '[[">>", ["%%", "hello"]], ["$$", "proc", ["{}", ["()", "type.string.reverse"], ["()", "type.string.upcase"]]]]'
 

OLLEH

Additional arguments given to core.exec are passed through to the composition.

Composition is a powerful part of the platform—learn how to leverage composition in your projects.

Authorizations

Granting access to core.exec does not automatically grant access to procs included in a composition. When creating an authorization with access to core.exec, you must explicitly list all eligible procs as abilities.

You can learn more about authorizations and how to use them in the docs.


Stuck? Want to chat about an idea? Join the community on Discord.