Skip to content

rune-langium / core/src / RuneStoreHydrator

Class: RuneStoreHydrator ​

Defined in: packages/core/src/services/rune-store-hydrator.ts:32

Hydrator variant for the Rune store substrate.

Differences from DefaultHydrator:

  • CST nodes are dropped entirely — the store has no use for parse-tree data. ($cstNode, $containerIndex, and $containerProperty are deleted from the output so the runtime object matches the Dehydrated<T> type, which excludes all Langium runtime fields.)
  • $cstText (a custom field stamped by preserveCstText BEFORE dehydration) is preserved — the visual editor's expression cells read it after the round-trip, and DefaultHydrator would otherwise drop it as a $-field.
  • References are stored as { $refText: string } only — the editable Dehydrated<T> wire format.
  • Re-hydration rebuilds a proper Reference via this.linker.buildReference, passing undefined for the CST node (consistent with the drop above).
  • $namespace is stamped from the enclosing RosettaModel before $container is stripped.

Extends ​

  • DefaultHydrator

Constructors ​

Constructor ​

ts
new RuneStoreHydrator(services): RuneStoreHydrator;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:48

Parameters ​

ParameterType
servicesLangiumCoreServices

Returns ​

RuneStoreHydrator

Inherited from ​

DefaultHydrator.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
cstNodeBuilderprotected readonlyCstNodeBuilderUsed to assemble the CST during hydration; CstNodeBuilder is not a service, so we keep a local instance.DefaultHydrator.cstNodeBuildernode_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:47
grammarprotected readonlyGrammar-DefaultHydrator.grammarnode_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:41
grammarElementIdMapprotected readonlyBiMap<AbstractElement, number>-DefaultHydrator.grammarElementIdMapnode_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:44
lexerprotected readonlyLexer-DefaultHydrator.lexernode_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:42
linkerprotected readonlyLinker-DefaultHydrator.linkernode_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:43
tokenTypeIdMapprotected readonlyBiMap<number, TokenType>-DefaultHydrator.tokenTypeIdMapnode_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:45

Methods ​

createDehyrationContext() ​

ts
protected createDehyrationContext(node): DehydrateContext;

Defined in: packages/core/src/services/rune-store-hydrator.ts:44

CST nodes never survive dehydration here (see class doc), so skip the base class's full CST-tree walk when building the context — on large corpora that walk dominates dehydration cost for zero benefit.

Parameters ​

ParameterType
nodeAstNode

Returns ​

DehydrateContext

Overrides ​

DefaultHydrator.createDehyrationContext


createGrammarElementIdMap() ​

ts
protected createGrammarElementIdMap(): void;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:65

Returns ​

void

Inherited from ​

DefaultHydrator.createGrammarElementIdMap


createHydrationContext() ​

ts
protected createHydrationContext(node): HydrateContext;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:56

Parameters ​

ParameterType
nodeany

Returns ​

HydrateContext

Inherited from ​

DefaultHydrator.createHydrationContext


dehydrate() ​

ts
dehydrate(result): ParseResult<object>;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:49

Converts a parse result to a plain object. The resulting object can be sent across worker threads.

Parameters ​

ParameterType
resultParseResult<AstNode>

Returns ​

ParseResult<object>

Inherited from ​

DefaultHydrator.dehydrate


dehydrateAstNode() ​

ts
protected dehydrateAstNode(node, context): object;

Defined in: packages/core/src/services/rune-store-hydrator.ts:52

Parameters ​

ParameterType
nodeAstNode
contextDehydrateContext

Returns ​

object

Overrides ​

DefaultHydrator.dehydrateAstNode


dehydrateCstNode() ​

ts
protected dehydrateCstNode(_node, _context): Record<string, never>;

Defined in: packages/core/src/services/rune-store-hydrator.ts:89

Parameters ​

ParameterType
_nodeCstNode
_contextDehydrateContext

Returns ​

Record<string, never>

Overrides ​

DefaultHydrator.dehydrateCstNode


dehydrateLexerReport() ​

ts
protected dehydrateLexerReport(lexerReport): LexingReport;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:50

Parameters ​

ParameterType
lexerReportLexingReport

Returns ​

LexingReport

Inherited from ​

DefaultHydrator.dehydrateLexerReport


dehydrateNode() ​

ts
dehydrateNode<T>(node): Dehydrated<T>;

Defined in: packages/core/src/services/rune-store-hydrator.ts:34

Dehydrate a single AST node to its Dehydrated<T> wire form.

Type Parameters ​

Type Parameter
T extends AstNode

Parameters ​

ParameterType
nodeT

Returns ​

Dehydrated<T>


dehydrateReference() ​

ts
protected dehydrateReference(reference, _context): {
  $refText: string;
};

Defined in: packages/core/src/services/rune-store-hydrator.ts:93

Parameters ​

ParameterType
referenceReference
_contextDehydrateContext

Returns ​

ts
{
  $refText: string;
}
NameTypeDefined in
$refTextstringpackages/core/src/services/rune-store-hydrator.ts:93

Overrides ​

DefaultHydrator.dehydrateReference


getGrammarElement() ​

ts
protected getGrammarElement(id): AbstractElement | undefined;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:64

Parameters ​

ParameterType
idnumber

Returns ​

AbstractElement | undefined

Inherited from ​

DefaultHydrator.getGrammarElement


getGrammarElementId() ​

ts
protected getGrammarElementId(node): number | undefined;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:63

Parameters ​

ParameterType
nodeAbstractElement | undefined

Returns ​

number | undefined

Inherited from ​

DefaultHydrator.getGrammarElementId


getTokenType() ​

ts
protected getTokenType(name): TokenType;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:62

Parameters ​

ParameterType
namestring

Returns ​

TokenType

Inherited from ​

DefaultHydrator.getTokenType


hydrate() ​

ts
hydrate<T>(result): ParseResult<T>;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:55

Converts a plain object to a parse result. The included AST node can then be used in the main thread. Calling this method on objects that have not been dehydrated first will result in undefined behavior.

Type Parameters ​

Type ParameterDefault type
T extends AstNodeAstNode

Parameters ​

ParameterType
resultParseResult<object>

Returns ​

ParseResult<T>

Inherited from ​

DefaultHydrator.hydrate


hydrateAstNode() ​

ts
protected hydrateAstNode(node, context): AstNode;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:57

Parameters ​

ParameterType
nodeany
contextHydrateContext

Returns ​

AstNode

Inherited from ​

DefaultHydrator.hydrateAstNode


hydrateCstLeafNode() ​

ts
protected hydrateCstLeafNode(cstNode): LeafCstNode;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:61

Parameters ​

ParameterType
cstNodeany

Returns ​

LeafCstNode

Inherited from ​

DefaultHydrator.hydrateCstLeafNode


hydrateCstNode() ​

ts
protected hydrateCstNode(
   cstNode, 
   context, 
   num?
): CstNode;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:60

Parameters ​

ParameterType
cstNodeany
contextHydrateContext
num?number

Returns ​

CstNode

Inherited from ​

DefaultHydrator.hydrateCstNode


hydrateReference() ​

ts
protected hydrateReference(
   reference, 
   node, 
   name, 
   _context
): Reference;

Defined in: packages/core/src/services/rune-store-hydrator.ts:97

Parameters ​

ParameterType
reference{ $refText: string; }
reference.$refTextstring
nodeAstNode
namestring
_contextHydrateContext

Returns ​

Reference

Overrides ​

DefaultHydrator.hydrateReference


setParent() ​

ts
protected setParent(node, parent): any;

Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:58

Parameters ​

ParameterType
nodeany
parentany

Returns ​

any

Inherited from ​

DefaultHydrator.setParent

Core packages released under MIT. Studio app released under FSL-1.1-ALv2.