cairn
Import
Section titled “Import”import * as api from "@fungi.computer/cairn";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| constant | identifierDefinitionSchema | Validate one bounded version 1 family declaration. |
| constant | identifierCandidateSchema | Decode a wire candidate before calling a typed string codec. |
| constant | ALPHABET | URL-safe lowercase alphabet used for opaque identifiers. |
| constant | SHORT | Identifier size for compact, non-security-sensitive labels. |
| constant | DEFAULT | Default identifier size. |
| constant | LONG | Identifier size for callers that require additional collision resistance. |
| function | nanoid() | Generate a raw opaque identifier through the runtime-selected nanoid implementation. |
identifierDefinitionSchemaconstant
Section titled “identifierDefinitionSchema”const identifierDefinitionSchema: ZodObject< { family: ZodString; version: ZodLiteral<1>; kinds: ZodRecord< ZodString, ZodObject< { prefix: ZodString; }, $strip > >; }, $strip>;Validate one bounded version 1 family declaration.
identifierCandidateSchemaconstant
Section titled “identifierCandidateSchema”const identifierCandidateSchema: ZodString;Decode a wire candidate before calling a typed string codec.
ALPHABETconstant
Section titled “ALPHABET”const ALPHABET: "abcdefghijklmnopqrstuvwxyz0123456789" = "abcdefghijklmnopqrstuvwxyz0123456789";URL-safe lowercase alphabet used for opaque identifiers.
SHORTconstant
Section titled “SHORT”const SHORT: 8 = 8;Identifier size for compact, non-security-sensitive labels.
DEFAULTconstant
Section titled “DEFAULT”const DEFAULT: 21 = 21;Default identifier size.
LONGconstant
Section titled “LONG”const LONG: 32 = 32;Identifier size for callers that require additional collision resistance.
nanoid()function
Section titled “nanoid()”function nanoid(length?): string;Generate a raw opaque identifier through the runtime-selected nanoid implementation.
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
length |
number |
DEFAULT |
Requested output size; supply a bounded nonnegative integer unless accepting upstream/runtime-specific behavior. |
Returns
Section titled “Returns”string
A lowercase alphanumeric identifier.
Remarks
Section titled “Remarks”This legacy helper accepts trusted sizing-policy inputs; CPU and output scale
with the requested size. Finite sizing values delegate exactly to the
runtime-selected upstream implementation and may be runtime-specific. Callers
should supply a bounded nonnegative integer unless they consciously accept
upstream/runtime-specific behavior. Only positive and negative infinity receive
Cairn’s fixed bounded RangeError. For new durable identifiers, use
defineIdFamily.
Throws
Section titled “Throws”If length is positive or negative infinity. Other finite-size exceptions
follow the upstream runtime behavior.
References
Section titled “References”CairnDefinitionError
Section titled “CairnDefinitionError”Re-exports CairnDefinitionError
CairnGenerationError
Section titled “CairnGenerationError”Re-exports CairnGenerationError
defineIdFamily
Section titled “defineIdFamily”Re-exports defineIdFamily
CairnId
Section titled “CairnId”Re-exports CairnId
IdCodec
Section titled “IdCodec”Re-exports IdCodec
IdFamily
Section titled “IdFamily”Re-exports IdFamily
IdKindDefinition
Section titled “IdKindDefinition”Re-exports IdKindDefinition
Re-exports IdOf
IdParseError
Section titled “IdParseError”Re-exports IdParseError
IdParseResult
Section titled “IdParseResult”Re-exports IdParseResult
ADJECTIVES
Section titled “ADJECTIVES”Re-exports ADJECTIVES
Re-exports NOUNS
Re-exports words
replayKey
Section titled “replayKey”Re-exports replayKey
deterministicReplayKey
Section titled “deterministicReplayKey”Re-exports deterministicReplayKey
correlationKey
Section titled “correlationKey”Re-exports correlationKey
createCorrelationSequence
Section titled “createCorrelationSequence”Re-exports createCorrelationSequence
ReplayKey
Section titled “ReplayKey”Re-exports ReplayKey
CorrelationKey
Section titled “CorrelationKey”Re-exports CorrelationKey