@samatawy/rules
    Preparing search index...

    Interface WorkingContext

    interface WorkingContext {
        setCache(id: string, value: any): void;
        getCached(id: string): any;
        clearCache(id?: string): void;
        getCacheMetrics(): { sets: number; hits: number; misses: number };
        get(key: string): any;
        getData(): any;
        hasData(key: string): boolean;
        getConstant(key: string): any;
        hasConstant(key: string): boolean;
        rootKeys(): string[];
        addException(exception: AbstractException): void;
        setOutput(key: string, value: any): void;
        getOutput(key?: string): any;
        commandHandler(): CommandHandler | undefined;
        logger(): ILogger;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Methods

    • Keep a value under a given identifier.

      Parameters

      • id: string

        the identifier to set,

      • value: any

        the value to keep for the identifier.

      Returns void

    • Get the value kept under a given identifer.

      Parameters

      • id: string

        the identifer to look for.

      Returns any

      the value kept under that identifer, or undefined if the id was not found.

    • Delete a single identifier and its value, or entirely delete all values.

      Parameters

      • Optionalid: string

        the identifier to delete. If not provided, the entire cache will be cleared.

      Returns void

    • Retrieve metrics for this cache instance. This is mainly a debugging/monitoring method.

      Returns { sets: number; hits: number; misses: number }

      a metrics object containing sets, hits, and misses.

    • Read data from the context using the given key or path. This method will first attempt to retrieve the value from the context's data. If the value is not found in the data, it will then attempt to retrieve it from the context's constants. Nested keys can be accessed using dot notation (e.g., "user.name").

      Parameters

      • key: string

        the key to look up in the context.

      Returns any

      the value associated with the key, or undefined if the key is not found.

    • Get all data from the context, excluding any shared data.

      Returns any

      an object containing all data in the context.

    • Check if the context contains data for the given key or path. Nested keys can be accessed using dot notation (e.g., "user.name").

      Parameters

      • key: string

        the key to check in the context.

      Returns boolean

      true if the key exists in the context, false otherwise.

    • Get a constant value from the context using the given key. Nested keys are not allowed.

      Parameters

      • key: string

        the key to look up in the constants.

      Returns any

      the constant value associated with the key, or undefined if the key is not found.

    • Check if the context contains a constant for the given key. Nested keys are not allowed.

      Parameters

      • key: string

        the key to check in the constants.

      Returns boolean

      true if the constant exists, false otherwise.

    • Get the root-level keys of the context. This can be useful for determining what data is available in the context and for debugging purposes.

      Returns string[]

      an array of root-level keys in the context.

    • Set an output value in the context with the given key.

      Parameters

      • key: string

        the key to associate with the output value.

      • value: any

        the value to set for the given key.

      Returns void

    • Get an output value from the context using the given key, excluding any shared data. Nested keys can be accessed using dot notation (e.g., "result.value"). If no key is provided, all output data will be returned.

      Parameters

      • Optionalkey: string

        the key to look up in the outputs.

      Returns any

      the output value associated with the key, or undefined if the key is not found.

    • Get the logger implementation used in this object. This can be used to log messages related to this object, such as during type checking or execution.

      Returns ILogger

      the logger associated with this object.