-- Generated by scripts/generate.mjs. Do not edit. module Dagger.Module ( contextSource , dependencies , description , enums , generatedContextDirectory , id , interfaces , introspectionSchemaJSON , name , objects , runtime , sdk , serve , serveWith , ServeOpts , defaultServeOpts , source , sync , userDefaults , withDescription , withEnum , withInterface , withObject ) where import Data.Maybe (Maybe(..)) import Effect.Aff (Aff) import Dagger.Internal.Runtime as R import Dagger.Types as T -- | The source used to resolve contextual files and directories, when different from source. contextSource :: T.Module -> Aff (Maybe T.ModuleSource) contextSource = R.nullableObject "ModuleSource" "contextSource" [] -- | The dependencies of the module. dependencies :: T.Module -> Aff (Array T.Module) dependencies = R.objectList "Module" "dependencies" [] -- | The doc string of the module, if any description :: T.Module -> Aff String description = R.scalar "description" [] -- | Enumerations served by this module. enums :: T.Module -> Aff (Array T.TypeDef) enums = R.objectList "TypeDef" "enums" [] -- | The generated files and directories made on top of the module source's context directory. generatedContextDirectory :: T.Module -> T.Directory generatedContextDirectory = R.select "generatedContextDirectory" [] -- | A unique identifier for this Module. id :: T.Module -> Aff T.ID id = R.scalar "id" [] -- | Interfaces served by this module. interfaces :: T.Module -> Aff (Array T.TypeDef) interfaces = R.objectList "TypeDef" "interfaces" [] -- | The introspection schema JSON file for this module. -- | -- | This file represents the schema visible to the module's source code, including all core types and those from the dependencies. -- | -- | Note: this is in the context of a module, so some core types may be hidden. introspectionSchemaJSON :: T.Module -> T.File introspectionSchemaJSON = R.select "introspectionSchemaJSON" [] -- | The name of the module name :: T.Module -> Aff String name = R.scalar "name" [] -- | Objects served by this module. objects :: T.Module -> Aff (Array T.TypeDef) objects = R.objectList "TypeDef" "objects" [] -- | The container that runs the module's entrypoint. It will fail to execute if the module doesn't compile. runtime :: T.Module -> Aff (Maybe T.Container) runtime = R.nullableObject "Container" "runtime" [] -- | The SDK config used by this module. sdk :: T.Module -> Aff (Maybe T.SDKConfig) sdk = R.nullableObject "SDKConfig" "sdk" [] type ServeOpts = { includeDependencies :: Maybe Boolean , main :: Maybe Boolean , entrypoint :: Maybe Boolean } defaultServeOpts :: ServeOpts defaultServeOpts = { includeDependencies: Nothing , main: Nothing , entrypoint: Nothing } -- | Serve a module's API in the current session. -- | -- | Note: this can only be called once per session. In the future, it could return a stream or service to remove the side effect. serve :: T.Module -> Aff (Maybe T.Void) serve = serveWith defaultServeOpts -- | Serve a module's API in the current session. -- | -- | Note: this can only be called once per session. In the future, it could return a stream or service to remove the side effect. serveWith :: ServeOpts -> T.Module -> Aff (Maybe T.Void) serveWith opts = R.scalar "serve" [R.optional (R.argument "includeDependencies" "Boolean") opts.includeDependencies, R.optional (R.argument "main" "Boolean") opts.main, R.optional (R.argument "entrypoint" "Boolean") opts.entrypoint] -- | The source for the module. source :: T.Module -> Aff (Maybe T.ModuleSource) source = R.nullableObject "ModuleSource" "source" [] -- | Forces evaluation of the module, including any loading into the engine and associated validation. sync :: T.Module -> Aff T.ID sync = R.scalar "sync" [] -- | User-defined default values, loaded from local .env files. userDefaults :: T.Module -> T.EnvFile userDefaults = R.select "userDefaults" [] -- | Retrieves the module with the given description withDescription :: String -> T.Module -> T.Module withDescription argDescription = R.select "withDescription" [R.argument "description" "String!" argDescription] -- | This module plus the given Enum type and associated values withEnum :: T.TypeDef -> T.Module -> T.Module withEnum argEnum = R.select "withEnum" [R.objectArgument "enum" "ID!" argEnum] -- | This module plus the given Interface type and associated functions withInterface :: T.TypeDef -> T.Module -> T.Module withInterface argIface = R.select "withInterface" [R.objectArgument "iface" "ID!" argIface] -- | This module plus the given Object type and associated functions. withObject :: T.TypeDef -> T.Module -> T.Module withObject argObject = R.select "withObject" [R.objectArgument "object" "ID!" argObject]