Skip to main content

Functions

Function objects describe a piece of logic that is to be run on a certain runtime. They're usually generated through helpers provided by the runtimes such as the crud helpers from the Prisma runtime that generate functions to allows easy crud operations. The different places where typegraphs use functions include:

  • CRUD and SQL operations from the PrismaRuntime
  • Evaluation of requests inputs for Policies using the DenoRuntime
  • The expose function takes a mapping function objects to generate the GQL api
  • Authoring Faas like operations using runtimes like DenoRuntime and PythonRuntime.

Effects

Effects are a property of functions and help categorization what happens to data when it gets transformed. Although they are similar to REST verbs and SQL statements, there is no direct one-to-one mapping.

EffectsREST verbsSQL statements
noneGETSELECT
createPOSTINSERT
updatePUT/PATCHUPDATE
upsertPUTINSERT ON CONFLICT
deleteDELETEDELETE

They provide hints to the typegates for the query orchestration by splitting the queries and mutations. For example, the create effect is exposed as a mutation. They also allow setting different policies based on them, that's for the next page.