dangshared

package
v1.0.0-beta.27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package dangshared holds the plumbing of the Dang SDK that does not depend on the Dang library (core/sdk/dang/v2): the nested-client server, client metadata, error conversion and naming.

Nothing in this package may import github.com/vito/dang (any major), so a future Dang major can be linked beside the current one without a copy of it. See core/sdk/dang/README.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertError

func ConvertError(rerr error) *core.Error

ConvertError converts an error from Dang evaluation into a *core.Error, preserving GraphQL error extensions as error values.

func ModuleNamer

func ModuleNamer(ctx context.Context) core.Namer

ModuleNamer is the naming rules of the module recorded by WithModuleNaming, or the latest rules.

func NamingSelectors

func NamingSelectors(ctx context.Context, srv *dagql.Server, sels ...dagql.Selector) []dagql.Selector

NamingSelectors stamps the view recorded by WithModuleNaming on the selectors of typedef constructors that normalize names (see core.IsNamingField), so they name the module's types, fields and arguments by its naming rules. sels is a chain selected from srv's root; other selectors are left alone.

func NewNestedClientMetadata

func NewNestedClientMetadata(ctx context.Context) (*engine.ClientMetadata, error)

NewNestedClientMetadata returns fresh metadata for a nested client to evaluate Dang code under, in the caller's session.

func WithModuleNaming

func WithModuleNaming(ctx context.Context, src *core.ModuleSource) context.Context

WithModuleNaming records, for NamingSelectors, the naming view of the module whose typedefs the Dang runtime is about to register (see core.ModuleSource.NamingView).

A module's runtime normally registers its typedefs over the API, at the view of the engine version the module declares, and the typedef constructors pick the naming rules from that view (see core.NamerFromContext). The Dang runtime runs in the engine and selects those constructors directly, which records no view unless the selector carries one.

func WithNestedClientServer

func WithNestedClientServer(
	ctx context.Context,
	query *core.Query,
	nestedClientMetadata *engine.ClientMetadata,
	inertAttachables bool,
	fnCall *core.FunctionCall,
	moduleContext dagql.ObjectResult[*core.Module],
	fn func(ctx context.Context, gqlClient graphql.Client) ([]byte, error),
) ([]byte, error)

WithNestedClientServer serves the Dagger API for a nested client on a local listener and calls fn with a GraphQL client pointed at it. The server is shut down when fn returns; any error it hit while serving is returned. In-engine SDK clients pass inertAttachables to reject implicit access to the caller's host while still allowing graph values explicitly passed to them.

The nested client's parent is the client whose scope ctx holds, exactly as for container execs: workspace operations run under a scope other than the client their request metadata names, and the session only accepts a child registered by its held parent scope.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL