← Server functions

Server.DecodeSuccess

luastra/server

Server.DecodeSuccess represents the successful branch of a discriminated SDK result. Its value and success-specific fields are safe to read only after the shared success tag has narrowed the union.

Before you use it

Add luastra/server to this module's dependencies in luastra.json, then import it with require("luastra/server"). Declare rpc.call in luastra.json and configure a declared backend operation with a deployed trusted handler. Application code should prefer its generated operation function and decoder.

How it fits

The type describes request options, v2 limits, nullable values, public errors, or the tagged envelope-decoding result.

When to use it

Use Server.DecodeSuccess after narrowing the related result with success == true. Only this branch guarantees access to the decoded value and other success-specific fields.

Fields or definition

ParameterType / valuesDescription
successtrueDiscriminator that must be checked before reading branch-specific fields.
fields{ [string]: string }Validated bounded field map carried by the decoded or migrated value.
errornilBounded failure information, or nil on the successful branch.

SDK type flow

Produced by

Server.decodeServer.decodeV2

What happens next

A checked request, result, limit, nullable-value, or public-error annotation.

Failures and fixes

Handle transport failure, envelope decode failure, and domain validation failure separately. The static web build does not deploy trusted backend handlers, credentials, or production operations for you.

Availability

Public-source alpha API in 0.5.0-alpha; production backend deployment remains application-owned.

Exact declaration

export type DecodeSuccess = { success: true, fields: { [string]: string }, error: nil }

Continue learning

Prerequisites

Server.decode

Companions

Server.decodeV2

Next steps

Server.DecodeResult

Complete inventory

View all pages in Server functions
← Previous: Server.V2LimitsNext: Server.DecodeFailure →