Packages

Gleam SDK for Dagger — type-safe pipelines via GraphQL codegen

Current section

Files

Jump to
dagger_gleam src dagger dsl source_map.gleam
Raw

src/dagger/dsl/source_map.gleam

// AUTO-GENERATED BY DAGGER_GLEAM - DO NOT EDIT
import dagger/types.{type Client, type Try} as types
import dagger/interpreter
import dagger/dsl/types as t
import gleam/dynamic/decode
import gleam/list
pub fn source_map(id id: t.SourceMap) -> t.SourceMap {
let field = types.Field(name: "loadSourceMapFromID", args: [#("id", types.GDeferred(id.op))], subfields: [])
t.SourceMap(op: types.Pure([field]))
}
/// The column number within the line.
pub fn column(parent: t.SourceMap, client client: Client, then handler: fn(Try(Int)) -> a) -> a {
let field = types.Field(name: "column", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.int)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("column")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The filename from the module source.
pub fn filename(parent: t.SourceMap, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "filename", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.string)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("filename")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// A unique identifier for this SourceMap.
pub fn id(parent: t.SourceMap) -> t.SourceMap {
let field = types.Field(name: "id", args: [], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.SourceMap(op: new_op)
}
/// The line number within the filename.
pub fn line(parent: t.SourceMap, client client: Client, then handler: fn(Try(Int)) -> a) -> a {
let field = types.Field(name: "line", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.int)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("line")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The module dependency this was declared in.
pub fn module(parent: t.SourceMap, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "module", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.string)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("module")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The URL to the file, if any. This can be used to link to the source map in the browser.
pub fn url(parent: t.SourceMap, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "url", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.string)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("url")))
}
}
)
}
handler(interpreter.run(op, client))
}