Canonical contracts for varying numeric, data, storage, and host facilities.
Importing this module defines typed service handles and registers catalog loaders without loading their implementations. Setup imports a handle, registers or selects a named provider, and only then requires consumers. A facade resolves its provider during top-level assembly and retains the actual table or functions.
For example, a setup module can select a packaged buffer implementation without loading the facade:
Use these handles rather than defining a second handle with the same string ID. All contracts use API 1 except data.json, which uses API 2. Representation services must match the target's layout and pointer conventions. Structvalue and WasmProvider describe members of one storage family; they are not independent selection points. See Service Providers for registration, package descriptors, initialization, and worker setup.
Types
BitopsProviderinterface
interface BitopsProvider
readonly tobit: function(value: number): integer
readonly tohex: function(value: number, digits: number?): string
readonly rol: function(value: number, count: number): integer
readonly ror: function(value: number, count: number): integer
readonly bswap: function(value: number): integer
readonly band: function(first: number, ...: number): integer
readonly bor: function(first: number, ...: number): integer
readonly bxor: function(first: number, ...: number): integer
readonly bnot: function(value: number): integer
readonly lshift: function(value: number, count: number): integer
readonly rshift: function(value: number, count: number): integer
readonly arshift: function(value: number, count: number): integer
end
32-bit operations with Lua BitOp semantics.
Results are signed integers representing 32-bit words, including logical right shift results whose high bit is set. Inputs normalize to 32 bits; shifts and rotates mask counts to five bits. Variadic operations consume every operand. Providers must preserve these conventions even on hosts with unsigned primitives.
Methods
tobit
tobit: function(value: number): integer
Normalizes a numeric operand to a signed 32-bit word.
Arguments
| Name | Type | Description |
|---|
value | number | |
Returns
tohex
tohex: function(value: number, digits: number?): string
Formats the low requested hexadecimal digits; negative digits select uppercase.
Arguments
| Name | Type | Description |
|---|
value | number | |
digits | number? | |
Returns
rol
rol: function(value: number, count: number): integer
Rotates left by the low five bits of count.
Arguments
| Name | Type | Description |
|---|
value | number | |
count | number | |
Returns
ror
ror: function(value: number, count: number): integer
Rotates right by the low five bits of count.
Arguments
| Name | Type | Description |
|---|
value | number | |
count | number | |
Returns
bswap
bswap: function(value: number): integer
Reverses the four bytes of the normalized word.
Arguments
| Name | Type | Description |
|---|
value | number | |
Returns
band
band: function(first: number, ...: number): integer
Bitwise conjunction of the first operand and every remaining operand.
Arguments
| Name | Type | Description |
|---|
first | number | |
... | number | |
Returns
bor
bor: function(first: number, ...: number): integer
Bitwise disjunction of every operand.
Arguments
| Name | Type | Description |
|---|
first | number | |
... | number | |
Returns
bxor
bxor: function(first: number, ...: number): integer
Bitwise exclusive-or of every operand.
Arguments
| Name | Type | Description |
|---|
first | number | |
... | number | |
Returns
bnot
bnot: function(value: number): integer
Inverts all 32 bits.
Arguments
| Name | Type | Description |
|---|
value | number | |
Returns
lshift
lshift: function(value: number, count: number): integer
Shifts left, discarding bits beyond the word.
Arguments
| Name | Type | Description |
|---|
value | number | |
count | number | |
Returns
rshift
rshift: function(value: number, count: number): integer
Shifts right with zero fill, then returns the signed word representation.
Arguments
| Name | Type | Description |
|---|
value | number | |
count | number | |
Returns
arshift
arshift: function(value: number, count: number): integer
Shifts right with sign extension.
Arguments
| Name | Type | Description |
|---|
value | number | |
count | number | |
Returns
CastElementstype
type CastElements = function<T>(element: ctype<T>, pointer: any): any
Casts storage to elements of any supplied ctype.
The implementation must remain generic in T and use the target's representation; accepting one particular element type is not sufficient.
CryptoProviderinterface
interface CryptoProvider
readonly randomBytes: function(count: integer): string
end
Cryptographically secure randomness for the executing host.
Use the host secure random source and propagate its failures. Deterministic pseudo-random generators do not satisfy this contract. Host requests may suspend.
Methods
randomBytes
Returns exactly count random bytes. Accepts integers from zero through 1048576; zero returns an empty string. Raises on invalid counts or failure.
Arguments
| Name | Type | Description |
|---|
count | integer | |
Returns
CstorageProviderinterface
One coherent family of physical storage operations.
representation is native for native pointers or linear32 for 32-bit linear memory. The facade checks it against the target before publishing this table. Linear32 implementations must also supply layout, reference, integers, structs, and host. Their structs must be reference-valued. The integer facade must use the exact integer provider attached to this storage family.
Allocation, descriptors, scalar codecs, and copies must agree on byte order, alignment, width, and pointer units. Decode inputs contain at least the scalar width in bytes. Borrowed views preserve source lifetimes; borrows, generic casts, and const views are part of the implementation contract. Opaque values in these signatures carry provider storage, not permission to change a compiled representation at runtime.
Methods
boundedCount
boundedCount: function(borrows source: any, count: integer): integer
Returns the requested count after any representation-specific extent check. Callers remain responsible for valid native pointer extents.
Arguments
| Name | Type | Description |
|---|
borrows source | any | |
count | integer | |
Returns
scalar
Returns the canonical descriptor for a scalar kind within this provider.
Arguments
| Name | Type | Description |
|---|
kind | string | |
Returns
descriptor
Reports layout and bounds for a provider value.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
allocateArray
allocateArray: function(element: any, count: integer): any
Allocates count elements of the supplied descriptor.
Arguments
| Name | Type | Description |
|---|
element | any | |
count | integer | |
Returns
allocateBytes
allocateBytes: function(count: integer): uint8[?]
Allocates a writable byte region containing count bytes.
Arguments
| Name | Type | Description |
|---|
count | integer | |
Returns
borrowString
borrowString: function(borrows bytes: string): const uint8[?] borrows (bytes)
Returns a read-only byte view whose lifetime borrows the source string.
Arguments
| Name | Type | Description |
|---|
borrows bytes | string | |
Returns
| Type | Description |
|---|
const uint8[?] borrows (bytes) | |
castBytes
Returns a read-only byte view borrowing the pointer owner.
Arguments
| Name | Type | Description |
|---|
borrows pointer | any | |
Returns
| Type | Description |
|---|
const uint8[?] borrows (pointer) | |
copy
copy: function(borrows destination: any, borrows source: any, count: integer): nil
Copies count bytes into destination without replacing its owner.
Arguments
| Name | Type | Description |
|---|
borrows destination | any | |
borrows source | any | |
count | integer | |
Returns
fill
fill: function(destination: any, count: integer, value: integer): nil
Fills count bytes in destination with the given byte value.
Arguments
| Name | Type | Description |
|---|
destination | any | |
count | integer | |
value | integer | |
Returns
sizeOf
sizeOf: function(element: any): integer
Returns the descriptor size in bytes.
Arguments
| Name | Type | Description |
|---|
element | any | |
Returns
string
string: function(borrows source: any, count: integer): string
Copies count source bytes into an independent Lua string.
Arguments
| Name | Type | Description |
|---|
borrows source | any | |
count | integer | |
Returns
decodeUint8
decodeUint8: function(bytes: string): uint32
Decodes one unsigned 8-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeUint8
encodeUint8: function(value: uint32): string
Encodes one unsigned 8-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | uint32 | |
Returns
decodeInt8
decodeInt8: function(bytes: string): int32
Decodes one signed 8-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeInt8
encodeInt8: function(value: int32): string
Encodes one signed 8-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | int32 | |
Returns
decodeUint16
decodeUint16: function(bytes: string): uint32
Decodes one unsigned 16-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeUint16
encodeUint16: function(value: uint32): string
Encodes one unsigned 16-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | uint32 | |
Returns
decodeInt16
decodeInt16: function(bytes: string): int32
Decodes one signed 16-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeInt16
encodeInt16: function(value: int32): string
Encodes one signed 16-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | int32 | |
Returns
decodeUint32
decodeUint32: function(bytes: string): uint32
Decodes one unsigned 32-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeUint32
encodeUint32: function(value: uint32): string
Encodes one unsigned 32-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | uint32 | |
Returns
decodeInt32
decodeInt32: function(bytes: string): int32
Decodes one signed 32-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeInt32
encodeInt32: function(value: int32): string
Encodes one signed 32-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | int32 | |
Returns
decodeUint64
Decodes one unsigned 64-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeUint64
Encodes one unsigned 64-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | uint64 | |
Returns
decodeInt64
Decodes one signed 64-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeInt64
Encodes one signed 64-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | int64 | |
Returns
decodeFloat32
Decodes one IEEE-754 binary32 value using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeFloat32
encodeFloat32: function(value: number): string
Encodes one IEEE-754 binary32 value using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | number | |
Returns
decodeFloat64
decodeFloat64: function(bytes: string): number
Decodes one IEEE-754 binary64 value using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeFloat64
encodeFloat64: function(value: number): string
Encodes one IEEE-754 binary64 value using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | number | |
Returns
Fields
representation
Target pointer/layout convention: native or linear32.
integers
Integer operations sharing this storage representation; required for linear32.
structs
Struct descriptors and row operations sharing this storage family.
host
Opaque memory-host operations sharing these allocations and pointers.
layout
layout: (function(subject: any): any)?
Returns target layout facts for a type or descriptor; required for linear32.
reference
reference: (function(resolve: function(): any): any)?
Creates a deferred descriptor reference for recursive layouts.
castElements
Interprets a pointer using any supplied element ctype.
HttpCapabilitiesrecord
Transport capability flags describing observable HTTP guarantees.
A true flag promises the corresponding behavior; callers must not infer support from a provider name or the presence of unrelated methods.
Fields
streamingResponse
streamingResponse: boolean
Response bytes become available before the whole response arrives.
streamingRequest
streamingRequest: boolean
Request bodies may be read incrementally from a reader or file.
transportPolicy
Proxy and per-host certificate policy can be configured by the caller.
connectionPolicy
connectionPolicy: boolean
Redirect and connection limits can be enforced by the caller.
protocolVersion
The negotiated HTTP version is observable.
Int64Providerinterface
interface Int64Provider
readonly int64: function(value: any): any
readonly uint64: function(value: any): any
readonly add: function(left: any, right: any): any
readonly sub: function(left: any, right: any): any
readonly mul: function(left: any, right: any): any
readonly div: function(left: any, right: any): any
readonly mod: function(left: any, right: any): any
readonly pow: function(left: any, right: any): any
readonly neg: function(value: any): any
readonly band: function(left: any, right: any): any
readonly bor: function(left: any, right: any): any
readonly bxor: function(left: any, right: any): any
readonly bnot: function(value: any): any
readonly lshift: function(value: any, count: number): any
readonly rshift: function(value: any, count: number): any
readonly arshift: function(value: any, count: number): any
readonly compare: function(left: any, right: any): number
readonly toNumber: function(value: any): number
readonly toString: function(value: any): string
end
64-bit signed and unsigned arithmetic for generated portable operations.
Values must retain their full width rather than round through a Lua number. Arithmetic, comparisons, shifts, and conversions must agree with the signedness created by int64/uint64. toNumber is the explicit potentially inexact conversion. When physical storage supplies integers, this must be that same implementation.
Methods
int64
Constructs or converts a signed 64-bit value.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
uint64
Constructs or converts an unsigned 64-bit value.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
add
Adds two full-width values.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
sub
Subtracts the right operand.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
mul
Multiplies full-width values.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
div
Divides using the integer representation semantics.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
mod
Computes the corresponding integer remainder.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
pow
Raises to an integer power.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
neg
Negates the value.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
band
Computes 64-bit conjunction.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
bor
Computes 64-bit disjunction.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
bxor
Computes 64-bit exclusive-or.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
bnot
Inverts all 64 bits.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
lshift
Shifts left within the 64-bit representation.
Arguments
| Name | Type | Description |
|---|
value | any | |
count | number | |
Returns
rshift
Shifts right with zero fill.
Arguments
| Name | Type | Description |
|---|
value | any | |
count | number | |
Returns
arshift
Shifts right with sign extension.
Arguments
| Name | Type | Description |
|---|
value | any | |
count | number | |
Returns
compare
compare: function(left: any, right: any): number
Returns a negative number, zero, or a positive number for ordering.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
toNumber
Converts to a Lua number, which may lose integer precision.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
toString
Returns an exact decimal representation.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
JsonProviderinterface
interface JsonProvider
readonly arrayOf: function(shape: any?): any
readonly asArray: MarkContainer
readonly asObject: MarkContainer
readonly isArray: function(value: any): boolean
readonly decode: function(text: string, nullValue: any?): any
readonly encode: function(value: any, nullValue: any?): string
readonly serialize: function(value: any, nullValue: any?): string
readonly encoded: function(value: any, nullValue: any?): any
readonly encodedString: function(value: string): any
readonly pull: function(text: string, shape: any, nullValue: any?): any
readonly verified: function(text: string): any
readonly verifiedString: function(text: string): any
readonly writer: function(exclusive out: SharedBuffer, nullValue: any?): any
readonly NULL: any
readonly EMPTY_ARRAY: table
readonly EMPTY_OBJECT: table
readonly compileSerde: (function(plan: any, unknownMembers: string): any)?
readonly decodeSerde: (function(schema: any, text: string): (any?, string?))?
readonly decodeSerdeBuffer: (function(schema: any, exclusive input: SharedBuffer): (any?, string?))?
end
JSON API 2, including portable encoding and optional compiled serde.
Arrays, objects, null sentinels, and verified fragments must agree across every member of this table. Keep marker identities stable for the loaded provider. The caller's nullValue controls null conversion; omission follows the public JSON API's nil behavior. Reject malformed syntax, invalid UTF-8, unsupported container shapes, and invalid raw fragments according to that API.
The three serde hooks are optional accelerators. If supplied together, compiled schemas and both decode entry points must share their representation and unknown-member policy. All buffer operations use the canonical shared Buffer; they must preserve the declared exclusive access and ownership guarantees.
Methods
arrayOf
Builds an array projection shape with the supplied element shape.
Arguments
| Name | Type | Description |
|---|
shape | any? | |
Returns
isArray
Reports whether a value has JSON array semantics.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
decode
decode: function(text: string, nullValue: any?): any
Parses JSON, applying the caller-selected representation of null.
Arguments
| Name | Type | Description |
|---|
text | string | |
nullValue | any? | |
Returns
encode
Serializes a value with this provider's markers and null convention.
Arguments
| Name | Type | Description |
|---|
value | any | |
nullValue | any? | |
Returns
serialize
Serializes with the same semantics as encode.
Arguments
| Name | Type | Description |
|---|
value | any | |
nullValue | any? | |
Returns
encoded
Creates a validated encoded-value fragment for subsequent composition.
Arguments
| Name | Type | Description |
|---|
value | any | |
nullValue | any? | |
Returns
encodedString
Creates a fragment containing one escaped JSON string.
Arguments
| Name | Type | Description |
|---|
value | string | |
Returns
pull
Parses only the value projection described by shape.
Arguments
| Name | Type | Description |
|---|
text | string | |
shape | any | |
nullValue | any? | |
Returns
verified
Validates raw JSON and retains a fragment suitable for composition.
Arguments
| Name | Type | Description |
|---|
text | string | |
Returns
verifiedString
Validates a raw encoded JSON string fragment.
Arguments
| Name | Type | Description |
|---|
text | string | |
Returns
writer
writer: function(exclusive out: SharedBuffer, nullValue: any?): any
Creates a JSON writer over exclusive access to the canonical buffer.
Arguments
| Name | Type | Description |
|---|
exclusive out | SharedBuffer | |
nullValue | any? | |
Returns
Fields
asArray
Marks and returns the same table as an array, preserving its ownership.
asObject
Marks and returns the same table as an object, preserving its ownership.
NULL
Stable explicit null marker owned by this loaded implementation.
EMPTY_ARRAY
Stable empty-array marker value.
EMPTY_OBJECT
Stable empty-object marker value.
compileSerde
compileSerde: (function(plan: any, unknownMembers: string): any)?
Optionally prepares a schema plan with its unknown-member policy.
decodeSerde
decodeSerde: (function(schema: any, text: string): (any?, string?))?
Optionally decodes a prepared schema, returning value or diagnostic.
decodeSerdeBuffer
decodeSerdeBuffer: (function(schema: any, exclusive input: SharedBuffer): (any?, string?))?
Optionally decodes from exclusive access to the canonical buffer.
MarkContainertype
type MarkContainer = function<T is table>(takes value: T): T preserves value
Marks a table while returning the same generic table and ownership.
The takes/preserves relation is intentional: an implementation must not copy the container or erase an affine owner while applying its JSON marker.
PathProviderinterface
Environmental path facts, independent of lexical path manipulation.
separator reports the host convention. currentDirectory and canonicalize may return nil with an explanatory message when the host has no such facility or an operating-system operation fails. Public Path identity remains in nupp.io.path.
Methods
separator
Returns the host path separator.
Returns
currentDirectory
currentDirectory: function(): (string?, string?)
Returns the process directory or nil and an environmental error.
Returns
| Type | Description |
|---|
string? | |
string? | |
canonicalize
canonicalize: function(path: string): (string?, string?)
Resolves a host filesystem path or returns nil and an error.
Arguments
| Name | Type | Description |
|---|
path | string | |
Returns
| Type | Description |
|---|
string? | |
string? | |
StorageProviderinterface
interface StorageProvider
readonly get: function(name: string): string?
readonly set: function(name: string, value: string): nil
readonly remove: function(name: string): nil
readonly clear: function(): nil
end
Persistent string key/value storage in the host's application namespace.
Missing keys return nil. Successful writes, removals, and clearing complete before returning; host-backed implementations may suspend and may raise on quota or access errors. clear affects the host-defined application namespace, not arbitrary storage outside it.
Methods
get
get: function(name: string): string?
Returns the stored string, or nil when the key is absent.
Arguments
| Name | Type | Description |
|---|
name | string | |
Returns
set
Stores the complete string value.
Arguments
| Name | Type | Description |
|---|
name | string | |
value | string | |
Returns
remove
remove: function(name: string): nil
Removes the key; an absent key needs no value.
Arguments
| Name | Type | Description |
|---|
name | string | |
Returns
clear
Removes all entries in the host-defined application namespace.
Returns
StructvalueProviderinterface
Struct-value operations supplied as part of the storage family.
Descriptors, arrays, and constructed values must agree with compiler layouts and canonical struct declarations. referenceValued reports whether a row reference addresses the underlying storage. This interface has no independently selectable handle; representation assembly supplies a compatible implementation.
Methods
scalar
Returns a scalar descriptor accepted by define and array.
Arguments
| Name | Type | Description |
|---|
kind | string | |
Returns
array
Allocates count elements using this family's element descriptor.
Arguments
| Name | Type | Description |
|---|
element | any | |
count | integer | |
Returns
define
define: function(layout: any, methods: table): any
Constructs a type descriptor from a compiler layout and method table.
Arguments
| Name | Type | Description |
|---|
layout | any | |
methods | table | |
Returns
Fields
referenceValued
Whether row references address their underlying storage.
TextBufferProviderinterface
interface TextBufferProvider
readonly new: function(size: (integer | table)?, options: table?): SharedBuffer
end
Construction of the canonical portable FIFO Buffer.
Return the shared Buffer type from nupp.text.buffer.types. Implementations may use native objects or portable state, but all signatures and chaining results must retain that identity. Native pointer and serializer facilities are outside this portable contract.
Methods
new
new: function(size: (integer | table)?, options: table?): SharedBuffer
Creates an independent FIFO buffer; accepts a size hint or an options table.
Arguments
| Name | Type | Description |
|---|
size | (integer | table)? | |
options | table? | |
Returns
| Type | Description |
|---|
SharedBuffer | |
TimeProviderinterface
interface TimeProvider
readonly wakeAt: function(deadline: number, resume: function(boolean): nil): function(): nil
readonly now: function(): number
readonly wallTime: function(): number
readonly sleep: function(milliseconds: number): nil
readonly sleepUntil: function(deadline: number): nil
end
Clocks and cancellable waits, measured in milliseconds.
now is monotonic with an unspecified origin; wallTime is Unix epoch time and must not be used for monotonic deadlines. wakeAt and sleepUntil use the same origin as now. Finite non-negative durations and deadlines are required. Waits cooperate with the selected suspension implementation. Timer callbacks and cancellation functions belong to the current Lua state.
Methods
wakeAt
wakeAt: function(deadline: number, resume: function(boolean): nil): function(): nil
Schedules one deadline callback and returns its cancellation function. Registration itself must not suspend the subscriber.
Arguments
| Name | Type | Description |
|---|
deadline | number | |
resume | function(boolean): nil | |
Returns
| Type | Description |
|---|
function(): nil | |
now
Returns monotonic milliseconds used for durations and deadlines.
Returns
wallTime
wallTime: function(): number
Returns milliseconds since the Unix epoch.
Returns
sleep
sleep: function(milliseconds: number): nil
Waits for a relative interval through the current suspension context.
Arguments
| Name | Type | Description |
|---|
milliseconds | number | |
Returns
sleepUntil
sleepUntil: function(deadline: number): nil
Waits until an absolute deadline in the now clock domain.
Arguments
| Name | Type | Description |
|---|
deadline | number | |
Returns
UriPartsrecord
Normalized absolute-URI components shared by every parser.
Use nil for an absent optional component and an empty string for a present empty one. text is the normalized serialization; scheme is normalized consistently with it. The public URI wrapper uses this record without introducing a provider-specific nominal identity.
Fields
text
Normalized complete URI text.
scheme
Normalized scheme without the colon.
authority
Serialized authority, or nil if the URI has none.
username
Username component, empty when absent.
password
Password component, retaining absent versus empty.
host
Normalized host, or nil for a URI without one.
port
Explicit non-default port when present.
path
Normalized path component.
query
Query without its question mark, or nil when absent.
fragment
Fragment without its hash mark, or nil when absent.
UriTextProviderinterface
interface UriTextProvider
readonly parse: function(text: string): (UriParts?, string?)
end
Absolute-URI parsing into canonical components.
Return nil and a diagnostic for unsupported or invalid input. Successful parses must make text, authority, host, port, and path mutually consistent and preserve absent versus empty query and fragment values.
Methods
parse
parse: function(text: string): (UriParts?, string?)
Parses an absolute URI into shared components or returns nil and a message.
Arguments
| Name | Type | Description |
|---|
text | string | |
Returns
UuidProviderinterface
interface UuidProvider
readonly uuid4: function(): string
readonly uuid7: function(): string
end
Canonical lowercase, hyphenated UUID generation.
Version 4 provides random UUIDs and version 7 provides time-ordered UUIDs. Version and variant bits must be correct; randomness failures must be reported.
Methods
uuid4
uuid4: function(): string
Generates a random version 4 UUID.
Returns
uuid7
uuid7: function(): string
Generates a time-ordered version 7 UUID.
Returns
WasmProviderinterface
interface WasmProvider
readonly allocate: function(bytes: integer): any
readonly pointer: function(allocation: any, index: integer, stride: integer): any
readonly offset: function(pointer: any, count: integer): any
readonly load: function(pointer: any, byteOffset: integer, kind: string): any
readonly store: function(pointer: any, byteOffset: integer, kind: string, value: any): nil
readonly copy: function(destination: any, source: any, bytes: integer): nil
readonly descriptor: function(value: any): any
end
Opaque linear-memory operations belonging to a storage implementation.
Allocation and pointer values must refer to that implementation's memory host. Offsets and copy lengths are bytes; pointer's index/stride pair locates an element in an allocation. Loads and stores use the scalar kind's width and encoding. Bounds and owner lifetimes must remain valid across every operation. This interface is supplied through CstorageProvider.host, not a separate SPI.
Methods
allocate
Allocates the requested number of bytes in this memory host.
Arguments
| Name | Type | Description |
|---|
bytes | integer | |
Returns
pointer
pointer: function(allocation: any, index: integer, stride: integer): any
Locates a zero-based element using index and byte stride.
Arguments
| Name | Type | Description |
|---|
allocation | any | |
index | integer | |
stride | integer | |
Returns
offset
Offsets an existing pointer by count bytes.
Arguments
| Name | Type | Description |
|---|
pointer | any | |
count | integer | |
Returns
load
load: function(pointer: any, byteOffset: integer, kind: string): any
Reads a scalar kind at a byte offset from the pointer.
Arguments
| Name | Type | Description |
|---|
pointer | any | |
byteOffset | integer | |
kind | string | |
Returns
store
Writes a scalar kind at a byte offset from the pointer.
Arguments
| Name | Type | Description |
|---|
pointer | any | |
byteOffset | integer | |
kind | string | |
value | any | |
Returns
copy
copy: function(destination: any, source: any, bytes: integer): nil
Copies bytes between regions belonging to this host.
Arguments
| Name | Type | Description |
|---|
destination | any | |
source | any | |
bytes | integer | |
Returns
descriptor
Returns bounds and layout information for a host value.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns