proposit-core
    Preparing search index...

    Interface TArgumentExpressionQueries<TExpr>

    Cross-premise expression lookups and analysis.

    interface TArgumentExpressionQueries<
        TExpr extends
            TCorePropositionalExpression = TCorePropositionalExpression,
    > {
        collectReferencedVariables(): {
            byId: Record<string, { premiseIds: string[]; symbol: string }>;
            bySymbol: Record<string, { premiseIds: string[]; variableIds: string[] }>;
            variableIds: string[];
        };
        getAllExpressions(): TExpr[];
        getExpression(expressionId: string): TExpr | undefined;
        getExpressionPremiseId(expressionId: string): string | undefined;
        getExpressionsByVariableId(variableId: string): TExpr[];
        hasExpression(expressionId: string): boolean;
        listRootExpressions(): TExpr[];
        patchExpressionAppFields(
            expressionId: string,
            fields: Partial<TExpr>,
        ): void;
    }

    Type Parameters

    Implemented by

    Index

    Methods

    • Collects all variables referenced by expressions across all premises, indexed both by variable ID and by symbol.

      Returns {
          byId: Record<string, { premiseIds: string[]; symbol: string }>;
          bySymbol: Record<string, { premiseIds: string[]; variableIds: string[] }>;
          variableIds: string[];
      }

      An object with variableIds, byId, and bySymbol indexes.

    • Returns the premise ID that contains the given expression, or undefined.

      Parameters

      • expressionId: string

        The expression ID to look up.

      Returns string | undefined

      The owning premise ID, or undefined.

    • Returns true if an expression with the given ID exists in any premise.

      Parameters

      • expressionId: string

        The expression ID to check.

      Returns boolean

      Whether the expression exists.

    • Patches application-specific fields onto an expression across all premises, then marks the expression and its ancestors dirty so the next checksum flush recomputes from the patched values.

      This is the public API for consumers that need to attach app-level metadata (e.g. creatorId, createdOn) to expressions synthesized by the engine's auto-normalization. It resolves the owning premise internally, applies the patch in place, and marks the expression dirty — callers cannot patch without marking or mark without patching (atomic patch-and-mark).

      Parameters

      • expressionId: string

        The ID of the expression to patch.

      • fields: Partial<TExpr>

        Fields to merge into the expression via Object.assign. The generic Partial<TExpr> ensures type compatibility with the engine's expression type (which includes app-specific fields when the engine is instantiated with a consumer-supplied expression type).

      Returns void

      NotFoundError if no expression with the given ID exists.

      2.3.1