---
icon: material/language-javascript
---

The runtime JavaScript [API](#api-reference) is the primary control method for dynamically configuring the 10x Engine and operating on typed TenXObjects. To load custom .js files see [JavaScript configuration](https://doc.log10x.com/config/javascript/).

??? tip "Quick Start Guides"

    <div class="grid cards" markdown>

    -   :simple-yaml: __Configure__

        ---

        [Configure](https://doc.log10x.com/config/yaml/#javascript-expressions) YAML runtime launch argument values and `include` directives.

        :material-github: Example [config.yaml](https://github.com/log-10x/config/blob/main/pipelines/run/output/metric/prometheus/remote-write/config.yaml#L4)

    -   :material-check: __Validate__

        ---

        [Validate](https://doc.log10x.com/run/transform/script/input/) launch arguments and initialize text/GeoIP lookups.

        :material-github: Example [http.js](https://github.com/log-10x/modules/blob/main/pipelines/run/modules/initialize/httpCode/http-object.js#L9)

    -   :material-butterfly-outline: __Initialize__

        ---

        [Initialize](https://doc.log10x.com/run/transform/script/object/) TenXObject calculated fields using lookup values, env variables and more.

        :material-github: Example [http.js](https://github.com/log-10x/modules/blob/main/pipelines/run/modules/initialize/httpCode/http-object.js#L9)

    -   :material-filter-cog-outline: __Filter__

        ---

        [Filter](https://doc.log10x.com/run/output/receive/) 'noisy' telemetry based on node and environment-level policies.

        :material-github: Example [rate-object-global.js](https://github.com/log-10x/config/blob/main/pipelines/run/modules/receive/rate/rate-object-global.js){target="\_blank"}

    -   :material-set-split: __Output__

        ---

        [Output](https://doc.log10x.com/run/output/stream/) TenXObjects field values to output (e.g., stdout, Prometheus).

        :material-github: Example [config.yaml](https://github.com/log-10x/config/blob/main/pipelines/run/output/event/process/config.yaml#L63)

    -   :material-math-log: __Log4j__

        ---

        [Log](https://doc.log10x.com/run/output/event/) TenXObjects field values to log4j [appenders](https://logging.apache.org/log4j/2.x/manual/appenders.html).

        :material-github: Example [filebeat/log4j2.yaml](https://github.com/log-10x/modules/blob/main/pipelines/run/modules/input/forwarder/filebeat/log4j2.yaml)

    </div>

## :material-language-javascript: API Reference 

This API provides the base classes from which custom [input](https://doc.log10x.com/run/transform/script/input/), 
[object](https://doc.log10x.com/run/transform/script/object/) and 
[summary](https://doc.log10x.com/run/transform/script/summary/) initializers are derived
as well utility functions for operating on strings, numbers, lookups, etc.

Name | Description
------ | -----------
[TenXBaseObject] | Provide a joint class base for TenXObject, summary and template and instances.
[TenXInput] | Serves as a base class to allow for custom [input](https://doc.log10x.com/run/input/stream) initialization.
[TenXOutput] | Serves as a base class to allow for custom [output](https://doc.log10x.com/run/output/stream) initialization.
[TenXUnit] | Serves as a base class to allow for custom [pipeline unit](https://doc.log10x.com/engine/pipeline/#units) initialization.
[TenXObject] | Provide structured, reflective access to log/trace events read from input(s)
[TenXSummary] | Access aggregate values of TenXObjects which share a target set of field values. 
[TenXTemplate] | Base class for custom template initialization.
[TenXCollection] | Base class for collection utilities (arrays and maps).
[TenXArray](#TenXArray) | Query array elements, length, and search.
[TenXMap] | Utilities for map (object) operations.
[TenXString] | Search, pattern-match and join string values.
[TenXLookup] |  Load and query the values of text lookup tables (.csv, .tsv) and geoIP DB files (.mmdb).
[TenXConsole] | Print values to the host process' stdout/stderr output streams.
[TenXDate] | Access system time and formatting/parsing date values. 
[TenXCounter] | Get and set the values of global atomic counters.
[TenXMath] | Mathematical functions such as aggregation, parsing and hashing. 
[TenXEnv] | Access 10x launch arguments.
[TenXLog] | Write messages to the 10x log.
[TenXEngine] | The 10x Engine provides the underlying implementation of all classes and functions in the 'tenx.js' module.

!!! note ""

    10x JavaScript does NOT allow for explicit new object allocations, loops, and other language constructs that have indeterminate execution times/memory costs. 

<a name="TenXBaseObject"></a>

## TenXBaseObject
Provide a joint class base for TenXObject, summary and template and instances.

**Objects**: provide a structured approach to operating on semi/unstructured events.
To learn more see [TenXObject](#TenXObject)

**Templates**:describe the schema/structure of other TenXObject similar to programmatic classes (who are themselves object instances)
who describes the structure of other instances. 
To learn more see [TenXTemplates](https://doc.log10x.com/run/template).

**Summaries**: aggregate the values of other Objects. Summaries are instantiated by an [aggregator](https://doc.log10x.com/run/aggregate)
after a certain number of TenXObjects have been aggregated or a certain interval has elapsed.
They are commonly used with time series outputs (e.g. Prometheus)
To learn more see [TenXSummary](#TenXSummary)

**Kind**: global class  

* [TenXBaseObject](#TenXBaseObject)
    * [.text](#TenXBaseObject+text) : <code>string</code>
    * [.utf8Size](#TenXBaseObject+utf8Size) : <code>number</code>
    * [.fullText](#TenXBaseObject+fullText) : <code>string</code>
    * [.vars](#TenXBaseObject+vars) : <code>Array.&lt;string&gt;</code>
    * [.isTemplate](#TenXBaseObject+isTemplate) : <code>boolean</code>
    * [.isObject](#TenXBaseObject+isObject) : <code>boolean</code>
    * [.isEncoded](#TenXBaseObject+isEncoded) : <code>boolean</code>
    * [.isSummary](#TenXBaseObject+isSummary) : <code>boolean</code>
    * [.template](#TenXBaseObject+template) : <code>string</code>
    * [.templateHash](#TenXBaseObject+templateHash) : <code>string</code>
    * [.timestamped](#TenXBaseObject+timestamped) : <code>boolean</code>
    * [.inputName](#TenXBaseObject+inputName) : <code>string</code>
    * [.get(field, [index])](#TenXBaseObject+get) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
    * [.set(field, value)](#TenXBaseObject+set) ⇒ <code>boolean</code>
    * [.joinFields(delimiter, ...fields)](#TenXBaseObject+joinFields) ⇒ <code>string</code>
    * [.length()](#TenXBaseObject+length) ⇒ <code>number</code>
    * [.includes()](#TenXBaseObject+includes) ⇒ <code>boolean</code>
    * [.startsWith()](#TenXBaseObject+startsWith) ⇒ <code>boolean</code>
    * [.endsWith()](#TenXBaseObject+endsWith) ⇒ <code>boolean</code>
    * [.indexOf()](#TenXBaseObject+indexOf) ⇒ <code>number</code>
    * [.lastIndexOf()](#TenXBaseObject+lastIndexOf) ⇒ <code>number</code>
    * [.toLowerCase()](#TenXBaseObject+toLowerCase) ⇒ <code>string</code>
    * [.toUpperCase()](#TenXBaseObject+toUpperCase) ⇒ <code>string</code>
    * [.matchAll()](#TenXBaseObject+matchAll) ⇒ <code>Array.&lt;string&gt;</code>
    * [.match()](#TenXBaseObject+match) ⇒ <code>string</code>
    * [.replace()](#TenXBaseObject+replace) ⇒ <code>string</code>
    * [.toString()](#TenXBaseObject+toString) ⇒ <code>string</code>
    * [.token([tokenOffset], [tokenTypes], [from])](#TenXBaseObject+token) ⇒ <code>string</code>
    * [.tokenSize()](#TenXBaseObject+tokenSize) ⇒ <code>number</code>
    * [.findToken(type, valueOrFrom, [to])]((#TenXBaseObject+findToken))  ⇒ <code>number</code>
    * [.findTokenNear(type, value, center, window)](#TenXBaseObject+findTokenNear) ⇒ <code>number</code>
    * [.timestampStart(index)](#TenXBaseObject+timestampStart) ⇒ <code>number</code>
    * [.timestampEnd(index)](#TenXBaseObject+timestampEnd) ⇒ <code>number</code>
    * [.timestampFormat([timestampIndex])](#TenXBaseObject+timestampFormat) ⇒ <code>string</code>

<a name="TenXBaseObject+text"></a>

### text : <code>string</code>
The content of the event from which this instance was structured.
This value may be read directly from an [input](https://doc.log10x.com/run/input/) or calculated on demand for [expanded](https://doc.log10x.com/run/transform/#expand) instances.

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)
<a name="TenXBaseObject+utf8Size"></a>

### utf8Size : <code>number</code>
The byte size of UTF8 encoding of [text](#TenXBaseObject+text).

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+fullText"></a>

### fullText : <code>string</code>
A text value [extracted](https://doc.log10x.com/run/input/extract/#outer-text) from the input stream from 
which the object originated which encloses its [text](#TenXBaseObject+text) field.
For example, if an object's text reflects a field extracted from a JSON object,
The value of `fullText` will return the text of its entire enclosing JSON object.

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+vars"></a>

### vars : <code>Array.&lt;string&gt;</code>
An array of [ variable sequences](https://doc.log10x.com/run/transform/structure) extracted from the object's [text](#TenXBaseObject+text).
The [length](#TenXArray.length) function can be used to query the number of elements in this array.

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Example**  
```js
export class HttpObject extends TenXObject {
  // Compute an HTTP error code field from the penultimate entry in vars[]
  // according to: https://httpd.apache.org/docs/2.4/logs.html schema.
  // For example, this will extract the '200' value into the 'code' field from:
  // 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326
  constructor() {
    // Grab the penultimate variable value
    var code =  TenXMath.parseInt(this.vars[-2]); 
    // Validate it's in the correct range       
    this.code = (code >= 200) && (code < 600) ? code : 0;
  }
}
```
<a name="TenXBaseObject+isTemplate"></a>

### isTemplate : <code>boolean</code>
Returns whether the current object is an TenXTemplate instance.
To learn more see [TenXTemplates](https://doc.log10x.com/run/template)

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+isObject"></a>

### isObject : <code>boolean</code>
Returns whether the current instance is an object and not a template or summary instance.

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+isEncoded"></a>

### isEncoded : <code>boolean</code>
Returns whether the current TenXObject was read from a compact input stream.
To learn more see [TenXTemplates](https://doc.log10x.com/run/template)

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+isSummary"></a>

### isSummary : <code>boolean</code>
Returns whether the current object is a summary instance produced by an [aggregator](https://doc.log10x.com/run/aggregate)

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+template"></a>

### template : <code>string</code>
A sequence of all symbol and delimiter tokens from the object's [text](#TenXBaseObject+text) field.
To learn more see [TenXTemplates](https://doc.log10x.com/run/template).

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+templateHash"></a>

### templateHash : <code>string</code>
An alphanumeric encoded value of a 64bit hash of the current object's [template](#TenXBaseObject+template) field.

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+timestamped"></a>

### timestamped : <code>boolean</code>
Return true if the instance is timestamped. Epoch values are accessible via the [timestamp](#TenXObject+timestamp) array.

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+inputName"></a>

### inputName : <code>string</code>
Returns the context in which the current object, template or summary was created.
   
At run time it may be needed to treat TenXObjects differently
based on the [input](https://doc.log10x.com/run/input/stream) or [aggregator](https://doc.log10x.com/run/aggregate) from which they originated.

For example, to check if the current TenXObject was read from the
'Fluentd' input, as configured via its [inputName](https://doc.log10x.com/run/input/stream/#inputname), the following check can be made:

**Kind**: instance property of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Example**  
```js
class MyObject extends TenXObject {
   constructor() {

      if (this.inputName == "Fluentd") {
        TenXCounter.inc("Fluentd");
        if this.startsWith("DEBUG") this.drop();
     } 
   }
}
```
<a name="TenXBaseObject+get"></a>

### get(field, [index]) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
Returns the value of a target intrinsic, extracted or calculated field of the current instance.

This function produces and returns a JSON object listing all intrinsic
(i.e., built into all objects), extracted (i.e., JSON and Key/Value
fields automatically extracted from the object's text field) and
encoded (i.e., assigned into the object through an event action) fields.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>number</code> \| <code>string</code> \| <code>boolean</code> - Value of 'field' at position 'index'  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| field | <code>string</code> |  | Field name to whose value to return |
| [index] | <code>number</code> | <code>0</code> | Index of the element if 'field' is an array |

**Example**  
```js
export class MyObject extends TenXObject {
  // filter instances for which the value of 'myField'
  // is different than the 'myValue' launch argument  
  constructor() {
    this.drop(this.get(TenXEnv.get("myField") != TenXEnv.get("myValue"));
  }
}
```
<a name="TenXBaseObject+set"></a>

### set(field, value) ⇒ <code>boolean</code>
Set a target value into a calculated field

This function is similar to [Reflect.set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set).

Note that intrinsic fields (i.e., fields declared by this class) cannot be set.

Calls to this function can only be made from within an TenXObject's constructor.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>boolean</code> - return true if the value was set  

| Param | Type | Description |
| --- | --- | --- |
| field | <code>string</code> | Field name to set |
| value | <code>number</code> \| <code>string</code> \| <code>boolean</code> | to assign to field |

**Example**  
```js
export class MyGeoObject extends TenXObject {
  // Assign a geo-ref lookup value (e.g., country, region) specified by a launch argument to a matching field
  constructor() {
    this.set(TenXEnv.get("geoField"), TenXLookup.get("geoIP"), this.ipAddress, TenXEnv.get("geoField"));
  }
}
```
<a name="TenXBaseObject+joinFields"></a>

### joinFields(delimiter, ...fields) ⇒ <code>string</code>
Returns a new String composed of evaluated TenXObject fields joined together with the specified delimiter
or as a JSON object containing the field name/value pairs.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>string</code> - a String composed of the evaluated fields separated by the delimiter. If an empty delimiter
                  is passed, the field values are formatted and escaped as JSON values of an array.
                  If only one argument is passed, the values of the argument are treated as the array of 
                  fields to join and the delimiter is assumed to be empty (formatting as JSON).  

| Param | Type | Description |
| --- | --- | --- |
| delimiter | <code>string</code> | the delimiter that separates each field value (should be one character long) |
| ...fields | <code>Array.&lt;string&gt;</code> | the current TenXObject's intrinsic/extracted/calculated fields to join. |

<a name="TenXBaseObject+length"></a>

### length() ⇒ <code>number</code>
Invokes [length](#TenXString.length), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+includes"></a>

### includes() ⇒ <code>boolean</code>
Invokes [includes](#TenXString.includes), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+startsWith"></a>

### startsWith() ⇒ <code>boolean</code>
Invokes [startsWith](#TenXString.startsWith), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+endsWith"></a>

### endsWith() ⇒ <code>boolean</code>
Invokes [endsWith](#TenXString.endsWith), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+indexOf"></a>

### indexOf() ⇒ <code>number</code>
Invokes [indexOf](#TenXString.indexOf), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+lastIndexOf"></a>

### lastIndexOf() ⇒ <code>number</code>
Invokes [lastIndexOf](#TenXString.lastIndexOf), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+toLowerCase"></a>

### toLowerCase() ⇒ <code>string</code>
Invokes [toLowerCase](#TenXString.toLowerCase), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+toUpperCase"></a>

### toUpperCase() ⇒ <code>string</code>
Invokes [toUpperCase](#TenXString.toUpperCase), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+matchAll"></a>

### matchAll() ⇒ <code>Array.&lt;string&gt;</code>
Invokes [matchAll](#TenXString.matchAll), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+match"></a>

### match() ⇒ <code>string</code>
Invokes [match](#TenXString.match), passing [text](#TenXBaseObject+text) as the value of 'str'.

<a name="TenXBaseObject+replace"></a>

### replace() ⇒ <code>string</code>
Invokes [replace](#TenXString.replace), passing [text](#TenXBaseObject+text) as the value of 'str'

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
<a name="TenXBaseObject+toString"></a>

### toString() ⇒ <code>string</code>
Returns a JSON representation of the current instance's intrinsic, extracted, and calculated fields.

This function  returns a JSON object listing all intrinsic (i.e., built into all TenXObjects),
extracted (i.e., JSON/KV entries extracted from [text](#TenXBaseObject+text)) and
calculated (i.e., assigned into the instance within its constructor) fields.

This function is useful for examining the state of a specific instance,
especially in conjunction with the [log()](#TenXConsole.log) function.

To print the JSON description of every object whose  [text](#TenXBaseObject+text) field contains the 'target' variable to console:

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>string</code> - the object's JSON representation  
**Example**  
```js
if this.includes(TenXEnv.get("target")) TenXConsole.log(this.toString());
```
<a name="TenXBaseObject+token"></a>

### token([tokenOffset], [tokenTypes], [from]) ⇒ <code>string</code>
Returns the value of specific tokens within the current TenXObject.

TenXObjects are comprised of `tokens`, which are alpha-numeric values categorized as:

- `symbol`: values found in the pipeline's [symbol library](https://doc.log10x.com/compile/link/#symbol-library).
- `delimiter`: single length [token delimiters](https://doc.log10x.com/run/transform/structure/#delimiters) (e.g. ',;<>.').
- `variable`: alpha-numeric values that are neither delimiter nor symbols.

This function provides a mechanism for querying the current TenXObject's token structure.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>string</code> - Value of the token of type 'tokenTypes',
						having skipped 'tokenOffset' tokens from the 'startIndex' start position  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [tokenOffset] | <code>number</code> | <code>0</code> | Number of tokens within the object's tokens array to begin searching from. |
| [tokenTypes] | <code>number</code> | <code>variable</code> | Comma delimited string containing the token type(s) to search for. 						                 Available values: [symbol, variable, delimiter]. |
| [from] | <code>number</code> \| <code>string</code> | <code>0</code> | Number: Position within the target string to begin searching for the target token. 						             If positive, the zero-based n character is used. If negative, the (length - n - 1) is used 						             if the index is out of bounds, it is ignored and 0 is used.

**Example**  

The following call can be made to look for the second [variable](https://doc.log10x.com/run/transform/structure/#variables) in the current TenXObject:

```js
this.status = this.token(2, "variable");
```
<a name="TenXBaseObject+tokenSize"></a>

### tokenSize() ⇒ <code>number</code>
Returns the number of tokens in the current TenXObject's [text](#TenXBaseObject+text) field.
To learn more about tokens, see:[token delimiters]https://doc.log10x.com/run/transform/structure/#delimiters)

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>number</code> - number of tokens in the current object  


<a name="TenXBaseObject+findToken"></a>

### findToken(type, valueOrFrom, [to]) ⇒ <code>number</code>
Returns the index of the first token matching the specified type and criteria.

Tokens within [timestamp](https://doc.log10x.com/api/js/#TenXObject+timestamp) and [IPaddress](https://doc.log10x.com/api/js/#TenXObject+ipAddress) values are excluded from the search.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>number</code> - Index of the first matching token, or -1 if not found. If valueOrFrom is array/map, returns first token included in array or map keyset.  

| Param | Type | Description |
| --- | --- | --- |
| type | <code>string</code> | Token type to search for: ["symbol"](https://doc.log10x.com/run/transform/structure#symbols) or ["variable"](https://doc.log10x.com/run/transform/structure#variables). |
| valueOrFrom | <code>number</code> \| <code>string</code> \| <code>Array.&lt;(number\|string)&gt;</code> \| <code>Object</code> | Single value to match, or array/map (generated by [TenXMap.fromEntries](https://doc.log10x.com/api/js/#TenXMap.fromEntries)) for inclusion check, or 'from' for range (number/string). |
| [to] | <code>number</code> \| <code>string</code> | Optional 'to' for range (same type as valueOrFrom). |

<a name="TenXBaseObject+findTokenNear"></a>

### findTokenNear(type, value, center, window) ⇒ <code>number</code>
Returns the index of the first token matching the specified type and value that lies within ±window tokens of the given center token index.

Useful for context-sensitive extraction where a candidate value is only meaningful when a confirming keyword appears nearby, for example requiring an HTTP method or status keyword within 5 tokens of a numeric HTTP code.

Tokens within [timestamp](https://doc.log10x.com/api/js/#TenXObject+timestamp) and [IPaddress](https://doc.log10x.com/api/js/#TenXObject+ipAddress) values are excluded from the search.

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>number</code> - Index of the first matching token within [center-window, center+window], or -1 if not found.  

| Param | Type | Description |
| --- | --- | --- |
| type | <code>string</code> | Token type to search for: ["symbol"](https://doc.log10x.com/run/transform/structure#symbols) or ["variable"](https://doc.log10x.com/run/transform/structure#variables). |
| value | <code>string</code> \| <code>Array.&lt;string&gt;</code> \| <code>Object</code> | Single value to match, or array/map (generated by [TenXMap.fromEntries](https://doc.log10x.com/api/js/#TenXMap.fromEntries)) for inclusion check. |
| center | <code>number</code> | Token index to search around (typically the index of the candidate token). |
| window | <code>number</code> | Number of tokens to search on each side of center (inclusive). |

<a name="TenXBaseObject+timestampStart"></a>

### timestampStart(index) ⇒ <code>number</code>
Returns the index of within the object's [text](#TenXBaseObject+text) where
the Nth timestamp sequence begins (inclusive).

To learn more see [timestamp extraction](https://doc.log10x.com/run/transform/timestamp).

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>number</code> - zero-based index of the start position (inclusive), -1 if not found  

| Param | Type | Description |
| --- | --- | --- |
| index | <code>number</code> | Index within the [timestamp](#TenXObject+timestamp) array to use.                          A negative value can be provided to search from the end of the timestamp array |

<a name="TenXBaseObject+timestampEnd"></a>

### timestampEnd(index) ⇒ <code>number</code>
Returns the index of within the object's [text](#TenXBaseObject+text) where
the Nth timestamp sequence ends (exclusive).

To learn more see [timestamp extraction](https://doc.log10x.com/run/transform/timestamp).

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>number</code> - zero-based index of the end position (exclusive), -1 if not found  

| Param | Type | Description |
| --- | --- | --- |
| index | <code>number</code> | Index within the [timestamp](#TenXObject+timestamp) array to use.                          A negative value can be provided to search from the end of the timestamp array |

<a name="TenXBaseObject+timestampFormat"></a>

### timestampFormat([timestampIndex]) ⇒ <code>string</code>
Returns the timestamp pattern for the specified timestamp.

For example, for an event whose timestamp is equal to: '2021-09-16T02:33:05.289552Z',
the return value would be: `yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'`

To learn more see [timestamp extraction](https://doc.log10x.com/run/transform/timestamp).

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>string</code> - Timestamp pattern if found, otherwise an empty value  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [timestampIndex] | <code>number</code> | <code>0</code> | Index of the desired timestamp within the object's timestamp array. |

<a name="TenXInput"></a>

## TenXInput

**Kind**: global class  

Serves as a base class to allow for custom [input](https://doc.log10x.com/run/input/stream) initialization.

Input constructors allow for the initialization of resources needed for event processing and aggregation
such as setting counters, loading lookup tables via [load()](#TenXLookup.load)
or connecting to GeoIP DBs via [loadGeoIPDB()](#TenXLookup.loadGeoIPDB).

These resources are available by [TenXObject](#TenXObject) and  [TenXSummary](#TenXSummary) sub-class to enrich and filter instances. 

* [TenXInput](#TenXInput)
    * _instance_
        * [.inputName](#TenXInput+inputName)
    * [.get(key)](#TenXInput.get) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
    * [.set(key, value)](#TenXInput.set) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>


<a name="TenXInput+inputName"></a>

### inputName
The name of this input (e.g., 'myElastic') as defined by the [input configuration](https://doc.log10x.com/run/input).

<a name="TenXInput.get"></a>

### .get(key) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
Get an input value specified by a key name.
 
This function gets a specific entry from a input field whose values are 
shared between different TenXObjects of the same [input](https://doc.log10x.com/run/input/stream).

**Kind**: static method of [<code>TenXInput</code>](#TenXInput)  
**Returns**: <code>number</code> \| <code>string</code> \| <code>boolean</code> - value of the input field. Empty string if input field item was not previously set.  

| Param | Type | Description |
| --- | --- | --- |
| key | <code>string</code> | name of the input field to get. |

<a name="TenXInput.set"></a>

### .set(key, value) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
Set the value of the input field specified by the key name.

This function sets a specific entry from a input field whose values are 
shared between different TenXObjects of the same [input](https://doc.log10x.com/run/input/stream).

**Kind**: static method of [<code>TenXInput</code>](#TenXInput)  
**Returns**: <code>number</code> \| <code>string</code> \| <code>boolean</code> - The value of the input field before the new value is set. 
                                         Empty string if set for the first time.  

| Param | Type | Description |
| --- | --- | --- |
| key | <code>string</code> | Name of the input input field to set. |
| value | <code>number</code> \| <code>string</code> \| <code>boolean</code> | Value to set in the input field. |


<a name="TenXOutput"></a>

## TenXOutput

**Kind**: global class  

Serves as a base class to allow for custom [output](https://doc.log10x.com/run/output/stream) initialization.

Output constructors allow for the initialization of resources needed for event processing and aggregation
such as setting counters.

Each option defined in the output's declaring module is available at runtime as a named member. 
For example, the [outputFilePath](https://doc.log10x.com/run/output/event/file/#outputfilepath) option can be accessed 
as a named member of the output instance:

``` js
export class FileOutput extends TenXOutput {
    constructor() { 
        if (this.outputFilePath) {
            if (this.outputFileWriteObjects != false) {
                if (this.outputFileWriteTemplates) {
                    TenXConsole.log("Writing TenXObjects and TenXTemplates to: " + this.outputFilePath);
                } else {
                    TenXConsole.log("Writing TenXObjects to: " + this.outputFilePath);
                }
            } else if (this.outputFileWriteTemplates ) {
                TenXConsole.log("Writing TenXTemplates to: " + this.outputFilePath);
            }
        }
    }
}
```

* [TenXOutput](#TenXOutput)
    * _instance_
        * [.outputName](#TenXOutput+outputName)
        * [.outputType](#TenXOutput+outputType)


<a name="TenXOutput+outputName"></a>

### outputName
Provides a logical name for the output instance as defined by its [declaring module](https://doc.log10x.com/run/output/#output-modules).

<a name="TenXOutput+outputType"></a>

### outputType
Provides the type of the output. Possible values: `file`, `stdout`, `event`, `metric`.


<a name="TenXUnit"></a>

## TenXUnit

**Kind**: global class  

Serves as a base class to allow for custom [pipeline unit](https://doc.log10x.com/engine/pipeline/#units) initialization and shutdown.

Unit constructors allow for the initialization of resources needed for pipeline execution
such as setting counters and configuring unit-specific behavior.

Unit close allow for releasing resources or finalizing actions such as closing connections
and printing post-processing results.

Each option defined in the unit's declaring module is available at runtime as a named member. 
For example, unit configuration options can be accessed as named members of the unit instance:

``` js
// @loader: tenx

import {TenXUnit, TenXEnv, TenXConsole} from '../../../../../../lib/script/tenx'

export class ConfigLoadUnit extends TenXUnit {

    static get shouldLoad() {
       return !TenXEnv.get("quiet", false);
    }

    constructor() { 
                
        if (this.unitName == "configLoader") {

            TenXConsole.log("🛠️ Launching 10x Engine (local run)");
        }
    }

    close() {

        if (this.unitName == "configLoader") {

            TenXConsole.log("🛠️ Pipeline excecution complete");
        }
    }
}
```

These resources are available by [TenXObject](#TenXObject) and [TenXSummary](#TenXSummary) sub-class to enrich and filter instances.

* [TenXUnit](#TenXUnit)
    * _instance_
        * [.unitName](#TenXUnit+unitName)


<a name="TenXUnit+unitName"></a>

### unitName
Provides a logical name for the unit instance as defined by its [declaring module](https://doc.log10x.com/engine/pipeline/#units).


<a name="TenXTemplate"></a>

## TenXTemplate

**Kind**: global class  

* [TenXTemplate](#TenXTemplate) ⇐ [<code>TenXBaseObject</code>](#TenXBaseObject)
    * [.get(field)](#TenXTemplate.get) ⇒
    * [.set(field,value)](#TenXTemplate.set) ⇒ <code>string|number|boolean</code>

Serves as a base class to allow for custom [template](https://doc.log10x.com/run/template/) initialization.

Static members allow all instances of the same template to share members. 

The example below assigns TenXTemplates with a calculated severity level using specific [symbol](https://doc.log10x.com/run/transform/structure/#symbols) values (e.g.,`Debug`, `Traceback most recent call last`) and configurable terms (e.g., `INFO`).

``` js

export class LevelTemplate extends TenXTemplate {

    constructor() {
    
        // check the template's symbol value starts with any of the configured 'levelTerms' values
        // use the map function to get the level value associated with a matching term
        
        LevelTemplate.level = TenXString.startsWith(
            this.symbolSequence("", "log", 30),           // capture the first 30 chars symbol values
            TenXMap.fromEntries(TenXEnv.get("levelTerms"))  // map the symbol value to a severity level
        );
    }
}

```

<a name="TenXTemplate.get"></a>

### .get(field) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
Returns the value of a target field of the current TenXTemplate instance.

**Kind**: static method of [<code>TenXTemplate</code>](#TenXTemplate)
**Returns**: <code>number</code> \| <code>string</code> \| <code>boolean</code> - Value of 'field'

| Param | Type | Description |
| --- | --- | --- |
| field | <code>string</code> | Field name whose value to return |


<a name="TenXTemplate.set"></a>

### .set(field, value) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
Set a target value into the current template field.

This function is similar to [Reflect.set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set).

**Kind**: static method of [<code>TenXTemplate</code>](#TenXTemplate)
**Returns**: <code>number</code> \| <code>string</code> \| <code>boolean</code> - the value set

| Param | Type | Description |
| --- | --- | --- |
| field | <code>string</code> | Field name to set |
| value | <code>number</code> \| <code>string</code> \| <code>boolean</code> | Value to assign to field |

**Example**

```js
export class MessageTemplate extends TenXTemplate {

    constructor() {

        if (GroupTemplate.isGroup) {

            TenXTemplate.set(
                TenXEnv.get("symbolMessageField", "symbolMessage"),
                this.symbolSequence(
                    TenXEnv.get("symbolContexts", "log,exec"),
                    TenXEnv.get("inputField"),
                    TenXEnv.get("symbolMaxLen", 0))
            );
        }
    }
}
```



<a name="TenXObject"></a>

## TenXObject

**Kind**: global class  
**Extends**: [<code>TenXBaseObject</code>](#TenXBaseObject)  

Provide structured, reflective access to log/trace events read from input(s).

The 10x Engine [transforms](https://doc.log10x.com/run/transform/) semi/unstructured log and trace events read from input(s) into well-defined, typed TenXObjects. Sub-classes of this class can declare constructors and functions that enrich, group and filter instances. 

#### Custom Constructors

The 10x Engine can load multiple subclasses, in which case their constructors will be executed 
to initialize matching TenXObject instances in their order of loading.

TenXObject instances provides access to the following capabilities:

#### Variables

The categorizes each value within an instance's [text](#TenXBaseObject+text) 
into high-cardinality (e.g., IP, number, and GUID) and constant/low-cardinality (e.g., class, function, message) values
through the [vars](#TenXBaseObject+vars) and [ipAddress](#TenXObject+ipAddress) fields and the [token](#TenXBaseObject+token) function. 

#### Timestamps

 Alphanumeric sequences convertible into a Unix Epoch values (e.g., `Thursday, April 11, 2024 2:51:58 PM` -> 1712847118000)
 are [extracted](https://doc.log10x.com/run/transform/timestamp) and accessible via the [timestamp](#TenXObject+timestamp) array.    

#### JSON/KV

[Embedded fields](https://doc.log10x.com/run/transform/fields) are accessible as named members. 
For example, if [text](#TenXBaseObject+text) contains the following segments:  
`...{"price":1}... {"price":2}...price=3...price:4...'
`
Price values are accessible as 'this.price' for the first element and 'this.price[N]' for zero-based access.
The [get](#TenXBaseObject+get) function allows the name of the field to be specified dynamically.

#### TenXTemplate

The [template](#TenXBaseObject+template) and [templateHash](#TenXBaseObject+templateHash) fields return a string representation of 
the instance's [TenXTemplate](https://doc.log10x.com/run/template).

#### Reflection

The source code/binary executable [origin](https://doc.log10x.com/run/transform/symbol) of constant and low cardinality values and 
context within their origin file (e.g., class, function, printout) are queryable via the [symbol()](#TenXObject+symbol) and [symbolSequence()](#TenXObject+symbolSequence) functions.

#### Encoding

TenXObjects can be serialized like proto-buffers to reference (vs. repeat) information contained in their templates 
to reduce their footprint by > 50% via the [encode](#TenXObject+encode) function
used by [Receiver compact-mode modules](https://doc.log10x.com/run/input/forwarder/module.yaml). 
 
#### Calculated Fields

New fields can be assigned to enrich each instance using any intrinsic/extracted fields, [reflective](symbolSequence) functions, [launch arguments](#TenXEnv)
and [lookup files](#TenXLookup). The example below enriches TenXObjects with HTTP code values:
``` js
export class HttpObject extends TenXObject {
  // Compute an HTTP error code field from the penultimate variable token
  // according to: https://httpd.apache.org/docs/2.4/logs.html schema.
  // For example, this will extract the '200' value into the 'code' field from:
  // 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326
  constructor() {
    // Grab the penultimate variable value
    var code =  TenXMath.parseInt(this.vars[-2]); 
    // Validate it's in the correct range       
    this.code = (code >= 200) && (code < 600) ? code : 0;
  }
}
```

#### Filtering

An TenXObject instance whose information is not required for [output](https://doc.log10x.com/run/output) can be filtered via the [drop](#TenXObject+drop) function to save on storage and analytics costs.

#### Grouping

TenXObjects can form [logical groups](https://doc.log10x.com/run/transform/group) that
can be aggregated, filtered and encoded as a single composite object (e.g., stack traces that comprise multiple lines to describe a single error) using the [groupExpressions](https://doc.log10x.com/run/transform/group/#groupexpressions) setting.

* [TenXObject](#TenXObject) ⇐ [<code>TenXBaseObject</code>](#TenXBaseObject)
    * [.isGroupHead](#TenXObject+isGroupHead) : <code>boolean</code>
    * [.groupSize](#TenXObject+groupSize) : <code>number</code>
    * [.extractorName](#TenXObject+extractorName) : <code>string</code>
    * [.extractorKey](#TenXObject+extractorKey) : <code>string</code>
    * [.source](#TenXObject+source) : <code>string</code>
    * [.timestamp](#TenXObject+timestamp) : <code>Array.&lt;string&gt;</code>
    * [.ipAddress](#TenXObject+ipAddress) : <code>Array.&lt;string&gt;</code>
    * [.classes](#TenXObject+classes) : <code>Array.&lt;string&gt;</code>
    * [.text](#TenXBaseObject+text) : <code>string</code>
    * [.utf8Size](#TenXBaseObject+utf8Size) : <code>number</code>
    * [.fullText](#TenXBaseObject+fullText) : <code>string</code>
    * [.vars](#TenXBaseObject+vars) : <code>Array.&lt;string&gt;</code>
    * [.encode](#TenXObject+encode) : <code>string</code>
    * [.isTemplate](#TenXBaseObject+isTemplate) : <code>boolean</code>
    * [.isObject](#TenXBaseObject+isObject) : <code>boolean</code>
    * [.isEncoded](#TenXBaseObject+isEncoded) : <code>boolean</code>
    * [.isSummary](#TenXBaseObject+isSummary) : <code>boolean</code>
    * [.template](#TenXBaseObject+template) : <code>string</code>
    * [.templateHash](#TenXBaseObject+templateHash) : <code>string</code>
    * [.timestamped](#TenXBaseObject+timestamped) : <code>boolean</code>
    * [.inputName](#TenXBaseObject+inputName) : <code>string</code>
    * [.drop([condition])](#TenXObject+drop) ⇒ <code>boolean</code>
    * [.outputType([types])](#TenXObject+outputType) ⇒ <code>string</code>
    * [.outputPath()](#TenXObject+outputPath) ⇒ <code>string</code>
    * [.encode([includeEnclosingText])](#TenXObject+encode) : <code>string</code>
    * [.symbol([type], [symbolName], [index])](#TenXObject+symbol) ⇒ <code>string</code>
    * [.symbolSequence([symbolContext],[field],[maxLen])](#TenXObject+symbolSequence) ⇒ <code>string</code>
    * [.symbolOrigin(symbolContext)](#TenXObject+symbolOrigin) ⇒ <code>string</code>
    * [.isNewTemplate()](#TenXObject+isNewTemplate) ⇒ <code>boolean</code>
    * [.get(field, [index])](#TenXBaseObject+get) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
    * [.set(field, value)](#TenXBaseObject+set) ⇒ <code>boolean</code>
    * [.joinFields(delimiter, ...fields)](#TenXBaseObject+joinFields) ⇒ <code>string</code>
    * [.length()](#TenXBaseObject+length) ⇒ <code>number</code>
    * [.includes()](#TenXBaseObject+includes) ⇒ <code>boolean</code>
    * [.startsWith()](#TenXBaseObject+startsWith) ⇒ <code>boolean</code>
    * [.endsWith()](#TenXBaseObject+endsWith) ⇒ <code>boolean</code>
    * [.indexOf()](#TenXBaseObject+indexOf) ⇒ <code>number</code>
    * [.lastIndexOf()](#TenXBaseObject+lastIndexOf) ⇒ <code>number</code>
    * [.toLowerCase()](#TenXBaseObject+toLowerCase) ⇒ <code>string</code>
    * [.toUpperCase()](#TenXBaseObject+toUpperCase) ⇒ <code>string</code>
    * [.matchAll()](#TenXBaseObject+matchAll) ⇒ <code>Array.&lt;string&gt;</code>
    * [.match()](#TenXBaseObject+match) ⇒ <code>string</code>
    * [.replace()](#TenXBaseObject+replace) ⇒ <code>string</code>
    * [.toString()](#TenXBaseObject+toString) ⇒ <code>string</code>
    * [.token([tokenOffset], [tokenTypes], [from])](#TenXBaseObject+token) ⇒ <code>string</code>
    * [.tokenSize()](#TenXBaseObject+tokenSize) ⇒ <code>number</code>
    * [.timestampStart(index)](#TenXBaseObject+timestampStart) ⇒ <code>number</code>
    * [.timestampEnd(index)](#TenXBaseObject+timestampEnd) ⇒ <code>number</code>
    * [.timestampFormat([timestampIndex])](#TenXBaseObject+timestampFormat) ⇒ <code>string</code>

<a name="TenXObject+groupSize"></a>

### .groupSize : <code>number</code>
If the current instance is a logical group formed via [groupExpressions](https://doc.log10x.com/run/transform/group/#groupexpressions) returns the number of TenXObject within the group.

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXObject+extractorName"></a>

### .extractorName : <code>string</code>
If the current object was extracted from a pattern match or JSON field using an input extractor,
returns 'name' property of the extractor; otherwise an empty string.
To learn more see [input extractors](https://doc.log10x.com/run/input/extract)

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXObject+extractorKey"></a>

### .extractorKey : <code>string</code>
If the object was extracted from a pattern match or JSON field using an input extractor,
returns the 'key' property of the extractor (i.e., the name of the JSON field or regex match group); 
otherwise empty string. 
To learn more see [input extractors](https://doc.log10x.com/run/input/extract)

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXObject+source"></a>

### .source : <code>string</code>
Returns the source value assigned to this instance by its input [source pattern](https://doc.log10x.com/run/input/stream/#inputsourcepattern)

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXObject+timestamp"></a>

### .timestamp : <code>Array.&lt;string&gt;</code>
An array of UNIX epoch values of timestamps parsed from the object's [text](#TenXBaseObject+text).
The [length](#TenXArray.length) function can be used to query the number of elements in this array.
To learn more about how timestamp values are extracted from events, see [timestamps](https://doc.log10x.com/run/transform/timestamp).

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXObject+ipAddress"></a>

### .ipAddress : <code>Array.&lt;string&gt;</code>
An array of string values of IPV4 parsed from the object's [text](#TenXBaseObject+text).
To geo-reference an entry in this array, see [loadGeoIPDB()](#TenXLookup.loadGeoIPDB).

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXObject+classes"></a>

### .classes : <code>Array.&lt;string&gt;</code>
An array of symbol source /binary file names from which class tokens within the object's [text](#TenXBaseObject+text) originated.
This value is only available if [symbol files](https://doc.log10x.com/run/symbol) have been loaded.
To learn more see [symbols](https://doc.log10x.com/run/transform/symbol).

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  

### .text : <code>string</code>
The content of the event from which this instance was structured.
This value may be read directly from an [input](https://doc.log10x.com/run/input/) or calculated on demand for [expanded](https://doc.log10x.com/run/transform/#expand) instances.

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)
<a name="TenXBaseObject+utf8Size"></a>

### .utf8Size : <code>number</code>
The byte size of UTF8 encoding of [text](#TenXBaseObject+text).

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+fullText"></a>

### .fullText : <code>string</code>
A text value [extracted](https://doc.log10x.com/run/input/extract/#outer-text) from the input stream from 
which the object originated which encloses its [text](#TenXBaseObject+text) field.
For example, if an object's text reflects a field extracted from a JSON object,
The value of `fullText` will return the text of its entire enclosing JSON object.

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+vars"></a>

### .vars : <code>Array.&lt;string&gt;</code>
An array of [ variable sequences](https://doc.log10x.com/run/transform/structure) extracted from the object's [text](#TenXBaseObject+text).
The [length](#TenXArray.length) function can be used to query the number of elements in this array.

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
**Example**  
```js
export class HttpObject extends TenXObject {
  // Compute an HTTP error code field from the penultimate entry in vars[]
  // according to: https://httpd.apache.org/docs/2.4/logs.html schema.
  // For example, this will extract the '200' value into the 'code' field from:
  // 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326
  constructor() {
    // Grab the penultimate variable value
    var code =  TenXMath.parseInt(this.vars[-2]); 
    // Validate it's in the correct range       
    this.code = (code >= 200) && (code < 600) ? code : 0;
  }
}
```
<a name="TenXBaseObject+isTemplate"></a>

### .isTemplate : <code>boolean</code>
Returns whether the current object is an TenXTemplate instance.
To learn more see [TenXTemplates](https://doc.log10x.com/run/template)

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+isObject"></a>

### .isObject : <code>boolean</code>
Returns whether the current instance is an object and not a template or summary instance.

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+isEncoded"></a>

### .isEncoded : <code>boolean</code>
Returns whether the current TenXObject was read from a compact input stream.
To learn more see [lossless compact](https://doc.log10x.com/run/transform/#compact)

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+isSummary"></a>

### .isSummary : <code>boolean</code>
Returns whether the current object is a summary instance produced by an [aggregator](https://doc.log10x.com/run/aggregate)

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+template"></a>

### .template : <code>string</code>
A sequence of all symbol and delimiter tokens from the object's [text](#TenXBaseObject+text) field.
To learn more see [TenXTemplates](https://doc.log10x.com/run/template/#structure).

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+templateHash"></a>

### .templateHash : <code>string</code>
An alphanumeric encoded value of a 64bit hash of the current object's [template](#TenXBaseObject+template) field.

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+timestamped"></a>

### .timestamped : <code>boolean</code>
Return true if the instance is timestamped. Epoch values are accessible via the [timestamp](#TenXObject+timestamp) array.

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+inputName"></a>

### .inputName : <code>string</code>
Returns the context in which the current object, template or summary was created.
   
At run time it may be needed to treat TenXObjects differently
based on the [input](https://doc.log10x.com/run/input/stream) or [aggregator](https://doc.log10x.com/run/aggregate) from which they originated.

For example, to check if the current TenXObject was read from the
'Fluentd' input, as configured via its [inputName](https://doc.log10x.com/run/input/stream/#inputname), the following check can be made:

**Kind**: instance property of [<code>TenXObject</code>](#TenXObject)  
**Example**  
```js
class MyObject extends TenXObject {
   constructor() {

      if (this.inputName == "Fluentd") {
        TenXCounter.inc("Fluentd");
        if this.startsWith("DEBUG") this.drop();
     } 
   }
}
```
<a name="TenXObject+drop"></a>

### .drop([condition]) ⇒ <code>boolean</code>
Drops the current instance from the 10x pipeline.

This function allows for removing TenXObjects whose log/trace information is not required 
from aggregation and output.

**Note**: Instances are structured from log/trace events 'on-demand'; that is if an instance is dropped 
without first accessing its template members, significant performance gains can be achieved.

#### Where the call is made matters

`drop()` can be called from a constructor or from a getter/method invoked later by a [groupFilter](https://doc.log10x.com/run/transform/group/#groupfilters) or [output filter](https://doc.log10x.com/run/output/filter). The two have different runtime cost:

- **Constructor (recommended fast path).** The decision is made before the event is committed to the pipeline. The engine short-circuits at the lexer: the event never reaches subsequent transform, group, aggregate, encode or output stages, and no further CPU is spent on it. Use this whenever the drop predicate can be resolved from intrinsic or extracted fields already available at construction time.
- **Later (getter or method).** By the time a filter or output-context call runs, the event has already been materialized and has flowed through earlier stages. The `dropped` flag is set on the instance and honored by the [output](https://doc.log10x.com/run/output) stage so the event is not serialized, but earlier [aggregator](https://doc.log10x.com/run/aggregate) stages have already counted it. Reserve this for decisions that genuinely depend on post-construction context such as [outputType()](#TenXObject+outputType) or [outputPath()](#TenXObject+outputPath).

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>boolean</code> - whether the current instance was successfully dropped.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [condition] | <code>boolean</code> | <code>true</code> | If truthy, the current object is dropped. |

**Example**  
```js
export class FilteredObject extends TenXObject {
  constructor() {
    // Fast path: drop before structuring, no downstream work performed.
    this.drop(this.startsWith("TRACE"));

    // Drops after structuring (vars[-2] requires a parsed object), still on the fast path
    // because the decision is made in the constructor.
    this.drop(this.vars[-2] != 200);
   }
 }
```

```js
export class OutputAwareObject extends TenXObject {
  // Later-drop: needs output context, so the event has already been aggregated by the time
  // this runs. The output stage will skip it.
  get shouldEmit() {
    if (this.outputType() == "metric" && !this.timestamped) this.drop();
    return true;
  }
}
```
<a name="TenXObject+outputType"></a>

### .outputType([types]) ⇒ <code>string</code>
Returns the type of output (e.g. event, metric, stream, file, stdout) the current instance 
is currently being emitted to.

This call can only be made within an [output context](https://doc.log10x.com/run/output/stream)
to control whether to serialize the current instance to a target output. 

For example, a [Receiver module](https://doc.log10x.com/run/regulate) may set the 'printToOutput'
function below into the [outputStreamsFilter argument](https://doc.log10x.com/run/output/filter) 
to write only timestamped TenXObjects to the console output.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>string</code> - type of the current output (e.g., 'stdout', 'file', 'event', 'metric', 'stream') or an empty string
                 if the output type is not contained in the 'types' array.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [types] | <code>Array.&lt;string&gt;</code> | <code>[]</code> | An array value compared against the current output type.                              If the array does not contain the output's type an empty string is returned |

**Example**  
```js
export class MyObject extends TenXObject { 
  get printOnlyTimestamped() {
    return this.outputType() == "stdout" ? this.timestamp : true;
  }
}
```
<a name="TenXObject+outputPath"></a>

### .outputPath() ⇒ <code>string</code>
Returns the 'path' value of an output the current instance is being serialized to.

This call can only be made within an [output context](https://doc.log10x.com/run/output/stream)
to control whether to serialize the current instance to a target output. 

For example, a [Receiver module](https://doc.log10x.com/run/regulate) may set the
[outputStreamsFilter argument](https://doc.log10x.com/run/output/filter) to the 'encodeToPrometheus'
function below that to only encode TenXObjects extracted from a 'message' JSON field to a Prometheus destination.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>string</code> - Path of the active output (e.g. file path, log4j appender, micrometer registry,.. )  
**Example**  
```js
export class MetricObject extends TenXObject {
  get encodeToPrometheus() {
    return TenXString.includes(this.outputPath(), "prometheus") ?
      this.extractorKey == "message" : false;
    }
 } 
```
<a name="TenXObject+encode"></a>

### .encode([includeEnclosingText]) ⇒ <code>string</code>
An encoded value combining the object's [templateHash](#TenXBaseObject+templateHash),
[timestamp](#TenXObject+timestamp) and [vars](#TenXBaseObject+vars) fields. 

This function generates an efficient representation of this object's
variable state (i.e., values not contained in its shared [TenXTemplate](https://doc.log10x.com/run/template/)).

if `includeEnclosingText` is true, the return value of enclosed by the value of [fullText](#TenXBaseObject+fullText)
which provides a representation of an TenXObject's encoded text within the context of the full
event from which it was extracted. This mode enables [Forwarder](https://doc.log10x.com/run/input/forwarder/) inputs to ship encoded TenXObjects to their target destination (e.g., Splunk, Elastic) with their full associated context (e.g., container id, name).

To learn more see [lossless compact](https://doc.log10x.com/run/transform/#compact).

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)
**Returns**: <code>string</code> - a compact representation of this instance.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| includeEnclosingText | <code>boolean</code> | <code>true</code> | whether to enclose the return encoded text |

**Example**  

For the following log event:
``` json
{"log":"[INFO] 127.0.0.1:48899 - 63371 \"HINFO IN 3388893353626257077.643398171450697041. udp 56 false 512\" NXDOMAIN qr,rd,ra 56 0.123504685s\n","stream":"stdout","docker":{"container_id":"4c195cfdbf7e41f640631629970b9af2d8a1f40f63dcffd15edca84e2e2e497e"},"kubernetes":{"container_name":"coredns","namespace_name":"kube-system","pod_name":"coredns-7db6d8ff4d-pddxj","container_image":"registry.k8s.io/coredns/coredns:v1.11.1","container_image_id":"docker-pullable://registry.k8s.io/coredns/coredns@sha256:1eeb4c7316bacb1d4c8ead65571cd92dd21e27359f0d4917f1a5822a73b75db1","pod_id":"38b91d65-ba47-4d0f-a689-711056955842","pod_ip":"10.244.0.99","host":"minikube","labels":{"k8s-app":"kube-dns","pod-template-hash":"7db6d8ff4d"}},"tenx_tag":"kubernetes.var.log.containers.coredns-7db6d8ff4d-pddxj_kube-system_coredns-4c195cfdbf7e41f640631629970b9af2d8a1f40f63dcffd15edca84e2e2e497e.log"}
```

The following call for an TenXObject [extracted](https://doc.log10x.com/run/input/extract/#first) from the event's `log` JSON field:

``` js
TenXConsole.log(this.encode(true));
```

Will print:

``` json
{"log":"~-Kw0UHgdH_9,127,0,1,48899,63371,3388893353626257077,643398171450697041,56,512,123504685s","stream":"stdout","docker":{"container_id":"4c195cfdbf7e41f640631629970b9af2d8a1f40f63dcffd15edca84e2e2e497e"},"kubernetes":{"container_name":"coredns","namespace_name":"kube-system","pod_name":"coredns-7db6d8ff4d-pddxj","container_image":"registry.k8s.io/coredns/coredns:v1.11.1","container_image_id":"docker-pullable://registry.k8s.io/coredns/coredns@sha256:1eeb4c7316bacb1d4c8ead65571cd92dd21e27359f0d4917f1a5822a73b75db1","pod_id":"38b91d65-ba47-4d0f-a689-711056955842","pod_ip":"10.244.0.99","host":"minikube","labels":{"k8s-app":"kube-dns","pod-template-hash":"7db6d8ff4d"}},"tenx_tag":"kubernetes.var.log.containers.coredns-7db6d8ff4d-pddxj_kube-system_coredns-4c195cfdbf7e41f640631629970b9af2d8a1f40f63dcffd15edca84e2e2e497e.log"}
```

Whereas a call to: `this.encode(false)` will drop portions of the event not encoded and return:
``` 
~-Kw0UHgdH_9,127,0,1,48899,63371,3388893353626257077,643398171450697041,56,512,123504685s 
```

<a name="TenXObject+symbol"></a>

### .symbol(type, symbolName, [index]) ⇒ <code>string</code>
Returns the N value of a [symbol](https://doc.log10x.com/run/transform/structure/#symbols) token sequence matching a target criteria

This function selects a certain set of [symbol](https://doc.log10x.com/run/transform/structure/#symbols) and delimiter tokens from the object's
[template](#TenXBaseObject+template) based on their context within the source code/binary file from which they originated.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>string</code> - the symbol and delimiter token sequence selected from the object's Template fields
			                    matching the selected criteria. If no matching sequence is found or [symbol files](https://doc.log10x.com/run/symbol).
			                    have not been loaded, an empty value is returned.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| type | <code>string</code> |  | Type of symbol that is being searched for.                               Supported values: PACKAGE, CLASS, METHOD, LOG, ENUM, CONST, TEXT (case insensitive).                              To select all symbol types, pass an empty string. |
| symbolName | <code>string</code> |  | A specific symbol name to look for. For example, look for 						        the values of an enum named "status", that value could be specified 						        to limit results to symbol tokens whose literals are defined in the "status" enum |
| [index] | <code>number</code> | <code>0</code> | index of the selected symbol token matching the type and 						        symbolName parameters. To choose the second symbol sequence, use 1; for last, use -1. |

**Example**  

To capture the symbol tokens that originated from an enum named "Status" for the following object:
`
 17/06/09 20:51:58 INFO spark.CacheManager: Partition rdd_2876_26 not found, computing Status ENABLED
`

```js
this.status = this.symbol("ENUM", "Status"); //capture the 'ENABLED value above
```
<a name="TenXObject+symbolSequence"></a>

### .symbolSequence(symbolContexts,fieldName,maxLen) ⇒ <code>string</code>
Returns a sequence of [symbol](https://doc.log10x.com/run/transform/structure/#symbols) tokens of a specified type.

This function selects a the longest set of symbol and delimiter tokens from the object's
[TenXTemplate](https://doc.log10x.com/run/template/) based on their context within the source code/binary file from which they originated.

To capture a symbol sequence for the following event:

```
17/06/24 20:51:58 INFO spark.CacheManager: Partition rdd_2876_26 not found, computing Status ENABLED
```

The following call can be used:

``` js
this.message = symbolSequence("log,class,exec"); // = 'Partition__not_found_computing_Status'
```

The `symbolContext` argument controls the [symbol contexts](https://doc.log10x.com/run/transform/symbol/#contexts) to search for; 
if the first type does not yield a result, the next one is tried etc. 
 
Supported values: package, class, method, log, enum, const, text, exec, any (case insensitive).

Specifying `any` produces Prometheus-compliant metric name comprised of symbol tokens from the current instance's [template](#TenXBaseObject+template) field.

The `field` argument can limit the sequence search to a target extracted field. 
For example, specifying an argument value of: "message" will search for matching symbols only in the object's `message` JSON/KV field (if exists). 

This function queries the template field and removes all characters that cannot be used as part of a metric name (e.g., variables, delimiters),
as well as any timestamp patterns.

The resulting string can be used within the context of an [aggregator](https://doc.log10x.com/run/aggregate).
to send aggregate information such as volume, bytes, counter information
that relates to all TenXObject instances sharing the same metric name (which will usually
describe different instances of the same logical event).

For example, the following event may have the following value as its [text](#TenXBaseObject+text) field:

``` json
{"timestamp": 1631753487.281258, "severity": "INFO", "name": "192.158.1.38", "message": "A request to send order confirmation email was sent"}
```

Its [template](#TenXBaseObject+template) field will be calculated as:

``` json
{"timestamp": $(epochNano), "severity": "INFO", "name": "$.$.$.$", "message": "A request to send order confirmation email sent"}"
```

This value cannot be used as a valid metric name, as described in [Metric naming](https://prometheus.io/docs/practices/naming).

Instead, this function will return the following valid metric name:

```
timestamp_severity_INFO_name_message_request_to_send_order_confirmation_email_sent
```

This return value can be used to periodically report the volume of email using an [aggregator](https://doc.log10x.com/run/aggregate/#aggregatorfields)
and [time-series](https://doc.log10x.com/run/output/metric/) output.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>string</code> - The symbol sequence selected from the object's Template fields
			                   matching the selected criteria. If no matching sequence is found or [symbol path](https://doc.log10x.com/run/symbol).
			                   have not been loaded, an empty value is returned.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| symbolContext | <code>string</code> |  | Comma delimited  symbol types to search for. Supported values: PACKAGE, CLASS, METHOD, LOG, ENUM, CONST, TEXT, EXEC, ANY (case insensitive). |
| fieldName | <code>string</code> |  | name of [extracted JSON/KV](https://doc.log10x.com/run/transform/fields) field name (e.g., 'log','message') to scan for symbol tokens. If not specified, scans the [text](TenXBaseObject#text) field. |
| maxLen | <code>number</code> |  | Max length of result string, 0 for unlimited. |

<a name="TenXObject+symbolOrigin"></a>

### .symbolOrigin(symbolContext) ⇒ <code>string</code>
Returns a the source code/binary origin of 'symbol' tokens of a specified type.

This function selects a the origin (i.e. the source code or binary executable which emitted) the longest set of [symbol](https://doc.log10x.com/run/transform/structure/#symbols) and delimiter tokens from the object's
TenXTemplate.

To capture the origin value for the following event:
```
17/06/24 20:51:58 INFO spark.CacheManager: Partition rdd_2876_26 not found, computing Status ENABLED
```

The following call can be used:

``` js
this.origin = symbolOrigin("log,class,exec"); // CacheManager.scala'
```

The 'symbolContext' argument controls the [symbol contexts](https://doc.log10x.com/run/transform/symbol/#contexts) to search for; if the first type does not yield a result, the next one is tried etc.  

Supported values: PACKAGE, CLASS, METHOD, LOG, ENUM, CONST, TEXT, EXEC (case insensitive).

A symbol context value may be preceded by [fieldName]: to limit the sequence search
to a target extracted field. For example, for: "log:message,class",
will search for symbols originating from code log statements (e.g., "log.error("...")" only in the object's "message" field (if it exists). 
When searching for "class" symbols, the entire object is searched.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>string</code> - The symbol sequence and/or origin selected from the object's Template fields
			                   matching the selected criteria. If no matching sequence is found or [symbol path](https://doc.log10x.com/run/symbol).
			                   have not been loaded, an empty value is returned.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| symbolContext | <code>string</code> |  | Types of symbols to search for. Supported values: PACKAGE, CLASS, METHOD, LOG, ENUM, CONST, TEXT, EXEC (case insensitive). |

<a name="TenXObject+isNewTemplate"></a>

### .isNewTemplate() ⇒ <code>boolean</code>
Returns whether the object's [TenXTemplate](https://doc.log10x.com/run/template) was loaded from disk, 
an [input stream](https://doc.log10x.com/run/input/stream) or generated at runtime on the fly.

This function is commonly used by [output streams](https://doc.log10x.com/run/output/stream) to determine
whether to encode the object's [template](#TenXBaseObject+template) to output, assuming pre-existing templates do not need to be shipped to output.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>boolean</code> - True if the object's template was generated on the fly.  
<a name="TenXBaseObject+get"></a>

### .get(field, [index]) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
Returns the value of a target intrinsic, extracted or calculated field of the current instance.

This function produces and returns a JSON object listing all intrinsic
(i.e., built into all objects), extracted (i.e., JSON and Key/Value
fields automatically extracted from the object's text field) and
encoded (i.e., assigned into the object through an event action) fields.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>number</code> \| <code>string</code> \| <code>boolean</code> - Value of 'field' at position 'index'  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| field | <code>string</code> |  | Field name to whose value to return |
| [index] | <code>number</code> | <code>0</code> | Index of the element if 'field' is an array |

**Example**  
```js
export class MyObject extends TenXObject {
  // filter instances for which the value of 'myField'
  // is different than the 'myValue' launch argument  
  constructor() {
    this.drop(this.get(TenXEnv.get("myField") != TenXEnv.get("myValue"));
  }
}
```
<a name="TenXBaseObject+set"></a>

### .set(field, value) ⇒ <code>boolean</code>
Set a target value into a calculated field

This function is similar to [Reflect.set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set).

Note that intrinsic fields (i.e., fields declared by this class) cannot be set.

Calls to this function can only be made from within an TenXObject's constructor.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>boolean</code> - return true if the value was set  

| Param | Type | Description |
| --- | --- | --- |
| field | <code>string</code> | Field name to set |
| value | <code>number</code> \| <code>string</code> \| <code>boolean</code> | to assign to field |

**Example**  
```js
export class MyGeoObject extends TenXObject {
  // Assign a geo-ref lookup value (e.g., country, region) specified by a launch argument to a matching field
  constructor() {
    this.set(TenXEnv.get("geoField"), TenXLookup.get("geoIP"), this.ipAddress, TenXEnv.get("geoField"));
  }
}
```
<a name="TenXBaseObject+joinFields"></a>

### .joinFields(delimiter, ...fields) ⇒ <code>string</code>
Returns a new String composed of evaluated TenXObject fields joined together with the specified delimiter
or as a JSON object containing the field name/value pairs.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>string</code> - a String composed of the evaluated fields separated by the delimiter. If an empty delimiter
                  is passed, the field values are formatted and escaped as JSON values of an array.
                  If only one argument is passed, the values of the argument are treated as the array of 
                  fields to join and the delimiter is assumed to be empty (formatting as JSON).  

| Param | Type | Description |
| --- | --- | --- |
| delimiter | <code>string</code> | the delimiter that separates each field value (should be one character long) |
| ...fields | <code>Array.&lt;string&gt;</code> | the current TenXObject's intrinsic/extracted/calculated fields to join. |

<a name="TenXBaseObject+length"></a>

### .length() ⇒ <code>number</code>
Invokes [length](#TenXString.length), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+includes"></a>

### .includes() ⇒ <code>boolean</code>
Invokes [includes](#TenXString.includes), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+startsWith"></a>

### .startsWith() ⇒ <code>boolean</code>
Invokes [startsWith](#TenXString.startsWith), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+endsWith"></a>

### .endsWith() ⇒ <code>boolean</code>
Invokes [endsWith](#TenXString.endsWith), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+indexOf"></a>

### .indexOf() ⇒ <code>number</code>
Invokes [indexOf](#TenXString.indexOf), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+lastIndexOf"></a>

### .lastIndexOf() ⇒ <code>number</code>
Invokes [lastIndexOf](#TenXString.lastIndexOf), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+toLowerCase"></a>

### .toLowerCase() ⇒ <code>string</code>
Invokes [toLowerCase](#TenXString.toLowerCase), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+toUpperCase"></a>

### .toUpperCase() ⇒ <code>string</code>
Invokes [toUpperCase](#TenXString.toUpperCase), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+matchAll"></a>

### .matchAll() ⇒ <code>Array.&lt;string&gt;</code>
Invokes [matchAll](#TenXString.matchAll), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+match"></a>

### .match() ⇒ <code>string</code>
Invokes [match](#TenXString.match), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  

<a name="TenXBaseObject+replace"></a>

### .replace() ⇒ <code>string</code>
Invokes [replace](#TenXString.replace), passing [text](#TenXBaseObject+text) as the value of 'str'

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
<a name="TenXBaseObject+toString"></a>

### .toString() ⇒ <code>string</code>
Returns a JSON representation of the current instance's intrinsic, extracted, and calculated fields.

This function  returns a JSON object listing all intrinsic (i.e., built into all TenXObjects),
extracted (i.e., JSON/KV entries extracted from [text](#TenXBaseObject+text)) and
calculated (i.e., assigned into the instance within its constructor) fields.

This function is useful for examining the state of a specific instance,
especially in conjunction with the [log()](#TenXConsole.log) function.

To print the JSON description of every object whose  [text](#TenXBaseObject+text) field contains the 'target' variable to console:

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>string</code> - the object's JSON representation  
**Example**  
```js
if this.includes(TenXEnv.get("target")) TenXConsole.log(this.toString());
```
<a name="TenXBaseObject+token"></a>

### .token([tokenOffset], [tokenTypes], [from]) ⇒ <code>string</code>
Returns the value of specific tokens within the current TenXObject.

TenXObjects are comprised of `tokens`, which are alpha-numeric values categorized as:

- `symbol`: values found in the pipeline's [symbol library](https://doc.log10x.com/compile/link/#symbol-library).
- `delimiter`: single length [token delimiters](https://doc.log10x.com/run/transform/structure/#delimiters) (e.g. ',;<>.').
- `variable`: alpha-numeric values that are neither delimiter nor symbols.

This function provides a mechanism for querying the current TenXObject's token structure.

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>string</code> - Value of the token of type 'tokenTypes',
						having skipped 'tokenOffset' tokens from the 'startIndex' start position  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [tokenOffset] | <code>number</code> | <code>0</code> | Number of tokens within the object's tokens array to begin searching from. |
| [tokenTypes] | <code>number</code> | <code>variable</code> | Comma delimited string containing the token type(s) to search for. 						                 Available values: [symbol, variable, delimiter]. |
| [from] | <code>number</code> \| <code>string</code> | <code>0</code> | Number: Position within the target string to begin searching for the target token. 						             If positive, the zero-based n character is used. If negative, the (length - n - 1) is used 						             if the index is out of bounds, it is ignored and 0 is used.

**Example**  

The following call can be made to look for the second [variable](https://doc.log10x.com/run/transform/structure/#variables) in the current TenXObject:

```js
this.status = this.token(2, "variable");
```
<a name="TenXBaseObject+tokenSize"></a>

### .tokenSize() ⇒ <code>number</code>
Returns the number of tokens in the current TenXObject's [text](#TenXBaseObject+text) field.
To learn more about tokens, see:[token delimiters](https://doc.log10x.com/run/transform/structure/#delimiters)

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>number</code> - number of tokens in the current object  
<a name="TenXBaseObject+timestampStart"></a>

### .timestampStart(index) ⇒ <code>number</code>
Returns the index of within the object's [text](#TenXBaseObject+text) where
the Nth timestamp sequence begins (inclusive).

To learn more see [timestamp extraction](https://doc.log10x.com/run/transform/timestamp).

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>number</code> - zero-based index of the start position (inclusive), -1 if not found  

| Param | Type | Description |
| --- | --- | --- |
| index | <code>number</code> | Index within the [timestamp](#TenXObject+timestamp) array to use.                          A negative value can be provided to search from the end of the timestamp array |

<a name="TenXBaseObject+timestampEnd"></a>

### .timestampEnd(index) ⇒ <code>number</code>
Returns the index of within the object's [text](#TenXBaseObject+text) where
the Nth timestamp sequence ends (exclusive).

To learn more see [timestamp extraction](https://doc.log10x.com/run/transform/timestamp).

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>number</code> - zero-based index of the end position (exclusive), -1 if not found  

| Param | Type | Description |
| --- | --- | --- |
| index | <code>number</code> | Index within the [timestamp](#TenXObject+timestamp) array to use.                          A negative value can be provided to search from the end of the timestamp array |

<a name="TenXBaseObject+timestampFormat"></a>

### .timestampFormat([timestampIndex]) ⇒ <code>string</code>
Returns the timestamp pattern for the specified timestamp.

For example, for an event whose timestamp is equal to: '2021-09-16T02:33:05.289552Z',
the return value would be: `yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'`

To learn more see [timestamp extraction](https://doc.log10x.com/run/transform/timestamp).

**Kind**: instance method of [<code>TenXObject</code>](#TenXObject)  
**Returns**: <code>string</code> - Timestamp pattern if found, otherwise an empty value  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [timestampIndex] | <code>number</code> | <code>0</code> | Index of the desired timestamp within the object's timestamp array. |

<a name="TenXSummary"></a>

## TenXSummary

**Kind**: global class  
**Extends**: [<code>TenXBaseObject</code>](#TenXBaseObject)  

Access aggregate values of TenXObjects which share a target set of field values. 

[Aggregators](https://doc.log10x.com/run/aggregate) are defined in a similar way to "GROUP BY" SQL statements
which groups table rows based on specific columns. 

Once the number of aggregated instances has exceeded a target threshold or interval,
the aggregator creates an instance of TenXSummary whose aggregated values are accessible as named members as well as 
via the intrinsic fields defined below. 

Below is a snippet that demonstrates initializing TenXSummary instances using [HTTP lookups](https://doc.log10x.com/run/initialize/lookup).

``` js
export class HttpSummary extends TenXSummary {
  constructor() {
   if (this.code) this.message = TenXLookup.get("http", this.code);
  }
}
```

* [TenXSummary](#TenXSummary) ⇐ [<code>TenXBaseObject</code>](#TenXBaseObject)
    * [.summaryVolume](#TenXSummary+summaryVolume) : <code>number</code>
    * [.summaryBytes](#TenXSummary+summaryBytes) : <code>number</code>
    * [.summaryValues](#TenXSummary+summaryValues) : <code>Array.&lt;string&gt;</code>
    * [.summaryValuesHash](#TenXSummary+summaryValuesHash) : <code>string</code>
    * [.summaryTotals](#TenXSummary+summaryTotals) : <code>Array.&lt;number&gt;</code>
    * [.text](#TenXBaseObject+text) : <code>string</code>
    * [.utf8Size](#TenXBaseObject+utf8Size) : <code>number</code>
    * [.fullText](#TenXBaseObject+fullText) : <code>string</code>
    * [.vars](#TenXBaseObject+vars) : <code>Array.&lt;string&gt;</code>
    * [.isTemplate](#TenXBaseObject+isTemplate) : <code>boolean</code>
    * [.isObject](#TenXBaseObject+isObject) : <code>boolean</code>
    * [.isEncoded](#TenXBaseObject+isEncoded) : <code>boolean</code>
    * [.isSummary](#TenXBaseObject+isSummary) : <code>boolean</code>
    * [.template](#TenXBaseObject+template) : <code>string</code>
    * [.templateHash](#TenXBaseObject+templateHash) : <code>string</code>
    * [.timestamped](#TenXBaseObject+timestamped) : <code>boolean</code>
    * [.inputName](#TenXBaseObject+inputName) : <code>string</code>
    * [.get(field, [index])](#TenXBaseObject+get) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
    * [.set(field, value)](#TenXBaseObject+set) ⇒ <code>boolean</code>
    * [.joinFields(delimiter, ...fields)](#TenXBaseObject+joinFields) ⇒ <code>string</code>
    * [.length()](#TenXBaseObject+length) ⇒ <code>number</code>
    * [.includes()](#TenXBaseObject+includes) ⇒ <code>boolean</code>
    * [.startsWith()](#TenXBaseObject+startsWith) ⇒ <code>boolean</code>
    * [.endsWith()](#TenXBaseObject+endsWith) ⇒ <code>boolean</code>
    * [.indexOf()](#TenXBaseObject+indexOf) ⇒ <code>number</code>
    * [.lastIndexOf()](#TenXBaseObject+lastIndexOf) ⇒ <code>number</code>
    * [.toLowerCase()](#TenXBaseObject+toLowerCase) ⇒ <code>string</code>
    * [.toUpperCase()](#TenXBaseObject+toUpperCase) ⇒ <code>string</code>
    * [.matchAll()](#TenXBaseObject+matchAll) ⇒ <code>Array.&lt;string&gt;</code>
    * [.match()](#TenXBaseObject+match) ⇒ <code>string</code>
    * [.replace()](#TenXBaseObject+replace) ⇒ <code>string</code>
    * [.toString()](#TenXBaseObject+toString) ⇒ <code>string</code>
    * [.token([tokenOffset], [tokenTypes], [from])](#TenXBaseObject+token) ⇒ <code>string</code>
    * [.tokenSize()](#TenXBaseObject+tokenSize) ⇒ <code>number</code>
    * [.timestampStart(index)](#TenXBaseObject+timestampStart) ⇒ <code>number</code>
    * [.timestampEnd(index)](#TenXBaseObject+timestampEnd) ⇒ <code>number</code>
    * [.timestampFormat([timestampIndex])](#TenXBaseObject+timestampFormat) ⇒ <code>string</code>

<a name="TenXSummary+summaryVolume"></a>

### .summaryVolume : <code>number</code>
The number of TenXObjects whose values have been aggregated into this summary instance.

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXSummary+summaryBytes"></a>

### .summaryBytes : <code>number</code>
The accumulative number of bytes in the values of [text](#TenXBaseObject+text) fields
of objects whose values have been incorporated into this summary instance.

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXSummary+summaryValues"></a>

### .summaryValues : <code>Array.&lt;string&gt;</code>
Array of values by which TenXObjects have been grouped into this summary instance.

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXSummary+summaryValuesHash"></a>

### .summaryValuesHash : <code>string</code>
A hash value of the [summaryValues](summaryValues) field used to
more concise representation of the values by which objects have been grouped into this summary.

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+text"></a>

<a name="TenXSummary+summaryTotals"></a>

### .summaryTotals : <code>Array.&lt;number&gt;</code>
Sum values of the [aggregatorTotalFields](https://doc.log10x.com/run/aggregate/#aggregatortotalfields) value of TenXObjects aggregated into this instance. This value commonly specifies [metric counter](https://www.baeldung.com/micrometer#2-counter) values when writing TenXSummaries to [time-series](https://doc.log10x.com/run/output/metric/) outputs.

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+text"></a>

### .text : <code>string</code>
The content of the event from which this instance was structured.
This value may be read directly from an [input](https://doc.log10x.com/run/input/) or calculated on demand for [expanded](https://doc.log10x.com/run/transform/#expand) instances.

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)
<a name="TenXBaseObject+utf8Size"></a>

### .utf8Size : <code>number</code>
The byte size of UTF8 encoding of [text](#TenXBaseObject+text).

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+fullText"></a>

### .fullText : <code>string</code>
A text value [extracted](https://doc.log10x.com/run/input/extract/#outer-text) from the input stream from 
which the object originated which encloses its [text](#TenXBaseObject+text) field.
For example, if an object's text reflects a field extracted from a JSON object,
The value of `fullText` will return the text of its entire enclosing JSON object.

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+vars"></a>

### .vars : <code>Array.&lt;string&gt;</code>
An array of [ variable sequences](https://doc.log10x.com/run/transform/structure) extracted from the object's [text](#TenXBaseObject+text).
The [length](#TenXArray.length) function can be used to query the number of elements in this array.

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
**Example**  
```js
export class HttpObject extends TenXObject {
  // Compute an HTTP error code field from the penultimate entry in vars[]
  // according to: https://httpd.apache.org/docs/2.4/logs.html schema.
  // For example, this will extract the '200' value into the 'code' field from:
  // 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326
  constructor() {
    // Grab the penultimate variable value
    var code =  TenXMath.parseInt(this.vars[-2]); 
    // Validate it's in the correct range       
    this.code = (code >= 200) && (code < 600) ? code : 0;
  }
}
```
<a name="TenXBaseObject+isTemplate"></a>

### .isTemplate : <code>boolean</code>
Returns whether the current object is an TenXTemplate instance.
To learn more see [TenXTemplates](https://doc.log10x.com/run/template)

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+isObject"></a>

### .isObject : <code>boolean</code>
Returns whether the current instance is an object and not a template or summary instance.

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+isEncoded"></a>

### .isEncoded : <code>boolean</code>
Returns whether the current TenXObject was read from a compact input stream.
To learn more see [TenXTemplates](https://doc.log10x.com/run/template)

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+isSummary"></a>

### .isSummary : <code>boolean</code>
Returns whether the current object is a summary instance produced by an [aggregator](https://doc.log10x.com/run/aggregate)

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+template"></a>

### .template : <code>string</code>
A sequence of all symbol and delimiter tokens from the object's [text](#TenXBaseObject+text) field.
To learn more see [TenXTemplates](https://doc.log10x.com/run/template/#structure).

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+templateHash"></a>

### .templateHash : <code>string</code>
An alphanumeric encoded value of a 64bit hash of the current object's [template](#TenXBaseObject+template) field.

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+timestamped"></a>

### .timestamped : <code>boolean</code>
Return true if length of [timestamp](TenXBaseObject#timestamp) is greater than 0

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+inputName"></a>

### .inputName : <code>string</code>
Returns the context in which the current object, template or summary was created.
   
At run time it may be needed to treat TenXObjects differently
based on the [input](https://doc.log10x.com/run/input/stream) or [aggregator](https://doc.log10x.com/run/aggregate) from which they originated.

For example, to check if the current TenXObject was read from the
'Fluentd' input, as configured via its [inputName](https://doc.log10x.com/run/input/stream/#inputname), the following check can be made:

**Kind**: instance property of [<code>TenXSummary</code>](#TenXSummary)  
**Example**  
```js
class MyObject extends TenXObject {
   constructor() {

      if (this.inputName == "Fluentd") {
        TenXCounter.inc("Fluentd");
        if this.startsWith("DEBUG") this.drop();
     } 
   }
}
```
<a name="TenXBaseObject+get"></a>

### .get(field, [index]) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
Returns the value of a target intrinsic, extracted or calculated field of the current instance.

This function produces and returns a JSON object listing all intrinsic
(i.e., built into all objects), extracted (i.e., JSON and Key/Value
fields automatically extracted from the object's text field) and
encoded (i.e., assigned into the object through an event action) fields.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
**Returns**: <code>number</code> \| <code>string</code> \| <code>boolean</code> - Value of 'field' at position 'index'  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| field | <code>string</code> |  | Field name to whose value to return |
| [index] | <code>number</code> | <code>0</code> | Index of the element if 'field' is an array |

**Example**  
```js
export class MyObject extends TenXObject {
  // filter instances for which the value of 'myField'
  // is different than the 'myValue' launch argument  
  constructor() {
    this.drop(this.get(TenXEnv.get("myField") != TenXEnv.get("myValue"));
  }
}
```
<a name="TenXBaseObject+set"></a>

### .set(field, value) ⇒ <code>boolean</code>
Set a target value into a calculated field

This function is similar to [Reflect.set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set).

Note that intrinsic fields (i.e., fields declared by this class) cannot be set.

Calls to this function can only be made from within an TenXObject's constructor.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
**Returns**: <code>boolean</code> - return true if the value was set  

| Param | Type | Description |
| --- | --- | --- |
| field | <code>string</code> | Field name to set |
| value | <code>number</code> \| <code>string</code> \| <code>boolean</code> | to assign to field |

**Example**  
```js
export class MyGeoObject extends TenXObject {
  // Assign a geo-ref lookup value (e.g., country, region) specified by a launch argument to a matching field
  constructor() {
    this.set(TenXEnv.get("geoField"), TenXLookup.get("geoIP"), this.ipAddress, TenXEnv.get("geoField"));
  }
}
```
<a name="TenXBaseObject+joinFields"></a>

### .joinFields(delimiter, ...fields) ⇒ <code>string</code>
Returns a new String composed of evaluated TenXObject fields joined together with the specified delimiter
or as a JSON object containing the field name/value pairs.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
**Returns**: <code>string</code> - a String composed of the evaluated fields separated by the delimiter. If an empty delimiter
                  is passed, the field values are formatted and escaped as JSON values of an array.
                  If only one argument is passed, the values of the argument are treated as the array of 
                  fields to join and the delimiter is assumed to be empty (formatting as JSON).  

| Param | Type | Description |
| --- | --- | --- |
| delimiter | <code>string</code> | the delimiter that separates each field value (should be one character long) |
| ...fields | <code>Array.&lt;string&gt;</code> | the current TenXObject's intrinsic/extracted/calculated fields to join. |

<a name="TenXBaseObject+length"></a>

### .length() ⇒ <code>number</code>
Invokes [length](#TenXString.length), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+includes"></a>

### .includes() ⇒ <code>boolean</code>
Invokes [includes](#TenXString.includes), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+startsWith"></a>

### .startsWith() ⇒ <code>boolean</code>
Invokes [startsWith](#TenXString.startsWith), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+endsWith"></a>

### .endsWith() ⇒ <code>boolean</code>
Invokes [endsWith](#TenXString.endsWith), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+indexOf"></a>

### .indexOf() ⇒ <code>number</code>
Invokes [indexOf](#TenXString.indexOf), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+lastIndexOf"></a>

### .lastIndexOf() ⇒ <code>number</code>
Invokes [lastIndexOf](#TenXString.lastIndexOf), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+toLowerCase"></a>

### .toLowerCase() ⇒ <code>string</code>
Invokes [toLowerCase](#TenXString.toLowerCase), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+toUpperCase"></a>

### .toUpperCase() ⇒ <code>string</code>
Invokes [toUpperCase](#TenXString.toUpperCase), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+matchAll"></a>

### .matchAll() ⇒ <code>Array.&lt;string&gt;</code>
Invokes [matchAll](#TenXString.matchAll), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+match"></a>

### .match() ⇒ <code>string</code>
Invokes [match](#TenXString.match), passing [text](#TenXBaseObject+text) as the value of 'str'.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+replace"></a>

### .replace() ⇒ <code>string</code>
Invokes [replace](#TenXString.replace), passing [text](#TenXBaseObject+text) as the value of 'str'

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
<a name="TenXBaseObject+toString"></a>

### .toString() ⇒ <code>string</code>
Returns a JSON representation of the current instance's intrinsic, extracted, and calculated fields.

This function  returns a JSON object listing all intrinsic (i.e., built into all TenXObjects),
extracted (i.e., JSON/KV entries extracted from [text](#TenXBaseObject+text)) and
calculated (i.e., assigned into the instance within its constructor) fields.

This function is useful for examining the state of a specific instance,
especially in conjunction with the [log()](#TenXConsole.log) function.

To print the JSON description of every object whose  [text](#TenXBaseObject+text) field contains the 'target' variable to console:

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
**Returns**: <code>string</code> - the object's JSON representation  
**Example**  
```js
if this.includes(TenXEnv.get("target")) TenXConsole.log(this.toString());
```
<a name="TenXBaseObject+token"></a>

### .token([tokenOffset], [tokenTypes], [from]) ⇒ <code>string</code>
Returns the value of specific tokens within the current TenXObject.

TenXObjects are comprised of `tokens`, which are alpha-numeric values categorized as:

- `symbol`: values found in the pipeline's [symbol library](https://doc.log10x.com/compile/link/#symbol-library).
- `delimiter`: single length [token delimiters](https://doc.log10x.com/run/transform/structure/#delimiters) (e.g. ',;<>.').
- `variable`: alpha-numeric values that are neither delimiter nor symbols.

This function provides a mechanism for querying the current TenXObject's token structure.

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
**Returns**: <code>string</code> - Value of the token of type 'tokenTypes',
						having skipped 'tokenOffset' tokens from the 'startIndex' start position  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [tokenOffset] | <code>number</code> | <code>0</code> | Number of tokens within the object's tokens array to begin searching from. |
| [tokenTypes] | <code>number</code> | <code>variable</code> | Comma delimited string containing the token type(s) to search for. 						                 Available values: [symbol, variable, delimiter]. |
| [from] | <code>number</code> \| <code>string</code> | <code>0</code> | Number: Position within the target string to begin searching for the target token. 						             If positive, the zero-based n character is used. If negative, the (length - n - 1) is used 						             if the index is out of bounds, it is ignored and 0 is used.

**Example**  

The following call can be made to look for the second [variable](https://doc.log10x.com/run/transform/structure/#variables) in the current TenXObject:

```js
this.status = this.token(2, "variable");
```
<a name="TenXBaseObject+tokenSize"></a>

### .tokenSize() ⇒ <code>number</code>
Returns the number of tokens in the current TenXObject's [text](#TenXBaseObject+text) field.
To learn more about tokens, see:[token delimiters](https://doc.log10x.com/run/transform/structure/#delimiters)

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
**Returns**: <code>number</code> - number of tokens in the current object  
<a name="TenXBaseObject+timestampStart"></a>

### .timestampStart(index) ⇒ <code>number</code>
Returns the index of within the object's [text](#TenXBaseObject+text) where
the Nth timestamp sequence begins (inclusive).

To learn more see [timestamp extraction](https://doc.log10x.com/run/transform/timestamp).

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
**Returns**: <code>number</code> - zero-based index of the start position (inclusive), -1 if not found  

| Param | Type | Description |
| --- | --- | --- |
| index | <code>number</code> | Index within the [timestamp](#TenXObject+timestamp) array to use.                          A negative value can be provided to search from the end of the timestamp array |

<a name="TenXBaseObject+timestampEnd"></a>

### .timestampEnd(index) ⇒ <code>number</code>
Returns the index of within the object's [text](#TenXBaseObject+text) where
the Nth timestamp sequence ends (exclusive).

To learn more see [timestamp extraction](https://doc.log10x.com/run/transform/timestamp).

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
**Returns**: <code>number</code> - zero-based index of the end position (exclusive), -1 if not found  

| Param | Type | Description |
| --- | --- | --- |
| index | <code>number</code> | Index within the [timestamp](#TenXObject+timestamp) array to use.                          A negative value can be provided to search from the end of the timestamp array |

<a name="TenXBaseObject+timestampFormat"></a>

### .timestampFormat([timestampIndex]) ⇒ <code>string</code>
Returns the timestamp pattern for the specified timestamp.

For example, for an event whose timestamp is equal to: '2021-09-16T02:33:05.289552Z',
the return value would be: `yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'`

To learn more see [timestamp extraction](https://doc.log10x.com/run/transform/timestamp).

**Kind**: instance method of [<code>TenXSummary</code>](#TenXSummary)  
**Returns**: <code>string</code> - Timestamp pattern if found, otherwise an empty value  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [timestampIndex] | <code>number</code> | <code>0</code> | Index of the desired timestamp within the object's timestamp array. |

<a name="TenXCollection"></a>

## TenXCollection
Base class for collection utilities, providing shared methods for length and access.

**Kind**: global class  

* [TenXCollection](#TenXCollection)
    * [.length(collection)](#TenXCollection.length) ⇒ <code>number</code>
    * [.get(collection, key)](#TenXCollection.get) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>
    * [.includes(collection, term)](#TenXCollection.includes) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>

<a name="TenXCollection.length"></a>

### TenXCollection.length(collection) ⇒ <code>number</code>
Returns the length of a collection (array or map).

**Kind**: static method of [<code>TenXCollection</code>](#TenXCollection)  
**Returns**: <code>number</code> - the number of elements in the collection  

| Param | Type | Description |
| --- | --- | --- |
| collection | <code>Array.&lt;(number\|string)&gt;</code> \| <code>Object</code> | the target collection |

<a name="TenXCollection.get"></a>

### TenXCollection.get(collection, key, [defValue]) ⇒
Returns an element from the collection by key or index.

For arrays, 'key' is treated as index (number). For maps, 'key' is the string key.

**Kind**: static method of [<code>TenXCollection</code>](#TenXCollection)  
**Returns**: the element at the specified key or index. If out of bounds or not found, returns defValue if provided, otherwise an empty value is returned  

| Param | Type | Description |
| --- | --- | --- |
| collection | <code>Array.&lt;(number\|string)&gt;</code> \| <code>Object</code> | the collection from which to retrieve the target element |
| key | <code>number</code> \| <code>string</code> | Key or index in collection. For arrays: positive/negative index (Python-style for negative). For maps: string key. |
| [defValue] | <code>\*</code> | Optional default value to return if the key/index is out of bounds or not found. If not provided, an empty value is returned. |

**Example**  
```js
export class CollectionExample extends TenXObject {
  constructor() {
    let myArray = ["apple", "banana", "cherry"];
    let myMap = {"fruit": "apple", "color": "red"};
    
    // Array access with default values
    let first = TenXArray.get(myArray, 0, "unknown");        // returns "apple"
    let outOfBounds = TenXArray.get(myArray, 10, "unknown");  // returns "unknown"
    
    // Map access with default values  
    let fruit = TenXMap.get(myMap, "fruit", "unknown");       // returns "apple"
    let missing = TenXMap.get(myMap, "missing", "unknown");   // returns "unknown"
  }
}
```

<a name="TenXCollection.includes"></a>

### TenXCollection.includes(collection, term) ⇒ <code>boolean</code> | <code>string</code> | <code>\*</code>
Tests if a target collection contains the specified term.

**Kind**: static method of [<code>TenXCollection</code>](#TenXString)  
**Returns**: <code>boolean</code> | <code>string</code> | <code>\*</code> - Returns true if the collection contains the term. If term is an array, returns the first item from term that is contained within str (or any element in str if an array, or any key in str if a map), or undefined if no match. If term is a map generated by [TenXMap.fromEntries](#TenXMap.fromEntries), returns the value associated with the first key from term that is contained within the collection, or undefined if no match.

| Param | Type | Description |
| --- | --- | --- |
| collection | <code>Object</code> | array or map to search in. |
| term | <code>string</code> \| <code>Array.<string></code> \| <code>Object</code> | Term to search for. If term is a string, checks if str (or any element/key) contains it. If term is an array, returns the first item from term contained in str (or any element/key). If term is a map generated by [TenXMap.fromEntries](#TenXMap.fromEntries), returns the value associated with the first key contained in str (or any element/key). |

<a name="TenXArray"></a>

## TenXArray ⇐ [<code>TenXCollection</code>](#TenXCollection)
Query array elements, length, and search.

**Kind**: global class  
**Extends**: [<code>TenXCollection</code>](#TenXCollection)  

* [TenXArray](#TenXArray) ⇐ [<code>TenXCollection</code>](#TenXCollection)
    * [.indexOf(list, value)](#TenXArray.indexOf) ⇒ <code>number</code>
    * [.length(collection)](#TenXCollection.length) ⇒ <code>number</code>
    * [.get(collection, key, [defValue])](#TenXCollection.get) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>

<a name="TenXArray.indexOf"></a>

### TenXArray.indexOf(list, value) ⇒ <code>number</code>
Returns the index of the first occurrence of 'value' in 'list'.

**Kind**: static method of [<code>TenXArray</code>](#TenXArray)  
**Returns**: <code>number</code> - the index of the first occurrence, or -1 if not found  

| Param | Type | Description |
| --- | --- | --- |
| list | <code>Array.&lt;(number\|string)&gt;</code> | the array to search in |
| value | <code>number</code> \| <code>string</code> | the value to search for |

<a name="TenXMap"></a>

## TenXMap ⇐ [<code>TenXCollection</code>](#TenXCollection)
Utilities for map (object) operations.

**Kind**: global class  
**Extends**: [<code>TenXCollection</code>](#TenXCollection)  

* [TenXMap](#TenXMap) ⇐ [<code>TenXCollection</code>](#TenXCollection)
    * [.fromEntries(list, [separator], [keyName], [valueName])](#TenXMap.fromEntries) ⇒ <code>Object</code>
    * [.length(collection)](#TenXCollection.length) ⇒ <code>number</code>
    * [.get(collection, key, [defValue])](#TenXCollection.get) ⇒ <code>number</code> \| <code>string</code> \| <code>boolean</code>

<a name="TenXMap.fromEntries"></a>

### TenXMap.fromEntries(list, [separator], [keyName], [valueName]) ⇒ <code>Object</code>
Returns a map object parsed from a list of values.

**Kind**: static method of [<code>TenXMap</code>](#TenXMap)  
**Returns**: <code>Object</code> - A map object parsed from the values array.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| list | <code>Array.&lt;string&gt;</code> |  | The array of values from which to parse the result map (e.g., `a=b,c=d,..`). |
| [separator] | <code>string</code> | <code>&quot;&#x3D;&quot;</code> | String to use to separate keys and values in the list. For separator `=`, returns: `{"a":"b","c":"d"}`. |
| [keyName] | <code>string</code> | <code>&quot;\&quot;\&quot;&quot;</code> | Name of key field name. For example, for keyName = `myKey` and valueName = `myVal`, returns: `[{"myKey":"a","myVal":"b"},{"myKey":"c","myVal":"d"}]`. |
| [valueName] | <code>string</code> | <code>&quot;\&quot;\&quot;&quot;</code> | Name of value field name (e.g., `myVal`). Required if `keyName` is specified. |

**Example**  
```js
class LevelTemplate extends TenXTemplate {
  constructor() {
    // Check the template's symbol value starts with any of the configured 'levelTerms' values
    // Use the fromEntries function to get the level value associated with a matching term
    let levelTerm = TenXString.startsWith(
      this.symbolSequence("", TenXEnv.get("inputField"), 30),
      TenXMap.fromEntries(TenXEnv.get("levelTerms"))
    );
    // If no match, try inferring from the template's timestamp pattern using configured 'levelTimestampPatterns' values
    if (!levelTerm) {
      levelTerm = TenXString.startsWith(
        this.timestampFormat(),
        TenXMap.fromEntries(TenXEnv.get("levelTimestampPatterns"))
      );
    }
  }
}
```

<a name="TenXString"></a>

## TenXString
Search, pattern-match and join string values.

**Kind**: global class  

* [TenXString](#TenXString)
    * [.length(list)](#TenXString.length) ⇒ <code>number</code>
    * [.split(str, delimiter, [limit])](#TenXString.split) ⇒ <code>Array.&lt;string&gt;</code>
    * [.includes(str, ...term)](#TenXString.includes) ⇒ <code>boolean</code>
    * [.startsWith(str, prefix)](#TenXString.startsWith) ⇒ <code>boolean</code>
    * [.endsWith(str, suffix)](#TenXString.endsWith) ⇒
    * [.indexOf(str, term, fromIndex)](#TenXString.indexOf) ⇒ <code>number</code>
    * [.lastIndexOf(str, term, fromIndex)](#TenXString.lastIndexOf) ⇒ <code>number</code>
    * [.toLowerCase(str)](#TenXString.toLowerCase) ⇒ <code>string</code>
    * [.toUpperCase(str)](#TenXString.toUpperCase) ⇒ <code>string</code>
    * [.matchAll(str, pattern)](#TenXString.matchAll) ⇒ <code>Array.&lt;string&gt;</code>
    * [.match(str, pattern)](#TenXString.match) ⇒ <code>string</code>
    * [.replace(str, target, replacement)](#TenXString.replace) ⇒ <code>string</code>
    * [.substring(str, beginIndex, endIndex)](#TenXString.substring) ⇒ <code>string</code>
    * [.join(delimiter, ...elements)](#TenXString.join) ⇒ <code>string</code>
    * [.concat(...elements)](#TenXString.concat) ⇒ <code>string</code>
    * [.stringify(...values)](#TenXString.stringify) ⇒ <code>string</code>
    * [.jsonPath(json, path)](#TenXString.jsonPath) ⇒ <code>\*</code>

<a name="TenXString.length"></a>

### TenXString.length(list) ⇒ <code>number</code>
returns the length of a string value in a local variable or object field

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>number</code> - the number of characters in the string  

| Param | Type | Description |
| --- | --- | --- |
| list | <code>string</code> | the target string |

<a name="TenXString.split"></a>

### TenXString.split(str, delimiter, [limit]) ⇒ <code>Array.&lt;string&gt;</code>
Splits the 'str' string around matches of delimiter.

The array returned by this method contains each substring of this
string that is terminated by another substring that matches the given
delimiter. The substrings in the array are in the order in which they occur in this string.
If the expression does not match any part of the input, then the resulting array
has just one element, namely str.

The limit parameter controls the number of times the
pattern is applied and therefore affects the length of the resulting
array.

If the limit is positive, then the pattern will be applied
at most limit - 1 times, the array's length will be
no greater than the limit, and the array's last entry will contain
all input beyond the last matched delimiter.

If the limit is zero, then the pattern will be applied as
many times as possible, the array can have any length and trailing
empty strings will be discarded.

 If the limit is negative, then the pattern will be applied
 as many times as possible, and the array can be any length.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>Array.&lt;string&gt;</code> - Array of strings computed by splitting string around matches of the delimiter  

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String to split |
| delimiter | <code>string</code> | Delimiting string |
| [limit] | <code>number</code> | Result threshold, as described above |

<a name="TenXString.includes"></a>

### TenXString.includes(str, term) ⇒ <code>boolean</code> | <code>string</code> | <code>\*</code>
Tests if a target string, array of strings, or map contains the specified term.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>boolean</code> | <code>string</code> | <code>\*</code> - Returns true if term is a string and str (or any element in str if an array, or any key in str if a map) contains it. If term is an array, returns the first item from term that is contained within str (or any element in str if an array, or any key in str if a map), or undefined if no match. If term is a map generated by [TenXMap.fromEntries](#TenXMap.fromEntries), returns the value associated with the first key from term that is contained within str (or any element in str if an array, or any key in str if a map), or undefined if no match.

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> \| <code>Array.<string></code> \| <code>Object</code> | String, array of strings, or map to search in. |
| term | <code>string</code> \| <code>Array.<string></code> \| <code>Object</code> | Term to search for. If term is a string, checks if str (or any element/key) contains it. If term is an array, returns the first item from term contained in str (or any element/key). If term is a map generated by [TenXMap.fromEntries](#TenXMap.fromEntries), returns the value associated with the first key contained in str (or any element/key). |

<a name="TenXString.startsWith"></a>

### TenXString.startsWith(str, prefix) ⇒ <code>boolean</code> | <code>string</code> | <code>\*</code>
Tests if a target string starts with the specified prefix.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>boolean</code> | <code>string</code> | <code>\*</code> - Returns true if prefix is a string and str starts with it, or if prefix is an empty string or equal to str. If prefix is an array, returns the matching item or undefined if no match. If prefix is a map generated by [TenXMap.fromEntries](#TenXMap.fromEntries), returns the value corresponding to the matching key or undefined if no match.

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String to search in. |
| prefix | <code>string</code> \| <code>Array.<string></code> \| <code>Object</code> | Prefix to match. If prefix is a string, checks if str starts with it. If prefix is an array, returns the first matching item from the array if str starts with it. If prefix is a map generated by [TenXMap.fromEntries](#TenXMap.fromEntries), returns the value from the map corresponding to the key that str starts with. |

<a name="TenXString.endsWith"></a>

### TenXString.endsWith(str, postfix) ⇒ <code>boolean</code> | <code>string</code> | <code>\*</code>
Tests if a target string ends with the specified postfix.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>boolean</code> | <code>string</code> | <code>\*</code> - Returns true if postfix is a string and str ends with it, or if postfix is an empty string or equal to str. If postfix is an array, returns the matching item or undefined if no match. If postfix is a map generated by [TenXMap.fromEntries](#TenXMap.fromEntries), returns the value from the map corresponding to the key that str ends with. |

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String to search in. |
| postfix | <code>string</code> \| <code>Array.<string></code> \| <code>Object</code> | Postfix to match. If postfix is a string, checks if str ends with it. If postfix is an array, returns the first matching item from the array if str ends with it. If postfix is a map generated by [TenXMap.fromEntries](#TenXMap.fromEntries), returns the value from the map corresponding to the key that str ends with. |

<a name="TenXString.indexOf"></a>

### TenXString.indexOf(str, term, fromIndex) ⇒ <code>number</code>
Returns the index within the search string of the first occurrence of the
specified substring, starting at the specified index.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>number</code> - the index of the first occurrence of the specified substring or array,
                             starting at the specified index,  or -1 if there is no such occurrence.  

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> \| <code>Array.&lt;string&gt;</code> | Substring or array to search in. |
| term | <code>string</code> | Substring to search for. |
| fromIndex | <code>number</code> | Index from which to start the search if 'str' is a string |

<a name="TenXString.lastIndexOf"></a>

### TenXString.lastIndexOf(str, term, fromIndex) ⇒ <code>number</code>
Returns the index within str of the last occurrence of the
specified substring, searching backward starting at the specified index.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>number</code> - the index of the last occurrence of the specified substring,
         searching backward from the specified index,
         or -1 if there is no such occurrence.  

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String to search in. |
| term | <code>string</code> | Substring to search for. |
| fromIndex | <code>number</code> | Index in str to start the search from. |

<a name="TenXString.toLowerCase"></a>

### TenXString.toLowerCase(str) ⇒ <code>string</code>
Converts all of the characters in str to lowercase.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>string</code> - String, converted to lowercase.  

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String to convert. |

<a name="TenXString.toUpperCase"></a>

### TenXString.toUpperCase(str) ⇒ <code>string</code>
Converts all of the characters in str to uppercase.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>string</code> - String, converted to uppercase.  

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String to convert. |

<a name="TenXString.matchAll"></a>

### TenXString.matchAll(str, pattern) ⇒ <code>Array.&lt;string&gt;</code>
Returns a list of matches of the specified pattern within str.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>Array.&lt;string&gt;</code> - List of matches within str. If no match is found, an empty array is returned  

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String to search in. |
| pattern | <code>string</code> | Regex pattern to match |

<a name="TenXString.match"></a>

### TenXString.match(str, pattern) ⇒ <code>string</code>
Returns the first matches of the specified pattern within str.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>string</code> - First string segment matching the pattern.
					    If no match is found, an empty string is returned  

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String to search in. |
| pattern | <code>string</code> | Regex pattern to match |

<a name="TenXString.replace"></a>

### TenXString.replace(str, target, replacement) ⇒ <code>string</code>
Replaces each substring in str that matches the literal target
sequence with the specified literal replacement sequence. 

The replacement proceeds from the beginning of the string to the end for
For example, replacing "aa" with "b" in the string "aaa" will result in
"ba" rather than "ab".

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>string</code> - The resulting string  

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | The string to search in. |
| target | <code>string</code> | The sequence of char values to be replaced |
| replacement | <code>string</code> | The replacement sequence of char values |

<a name="TenXString.substring"></a>

### TenXString.substring(str, beginIndex, endIndex) ⇒ <code>string</code>
Returns a string that is a substring of 'str'.

The substring begins at the specified beginIndex and extends to the character at index endIndex - 1.
Thus, the length of the substring is endIndex-beginIndex.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>string</code> - Specified substring.  

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String to search in. |
| beginIndex | <code>number</code> | Beginning index, inclusive.                                If negative, length(str) + beginIndex is used. If not provided, 0 is used |
| endIndex | <code>number</code> | Ending index, exclusive.                                If negative, length(str) + endIndex is used. If not provided, length(str) is used |

<a name="TenXString.join"></a>

### TenXString.join(delimiter, ...elements) ⇒ <code>string</code>
Returns a new String composed of elements joined together with the specified delimiter.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>string</code> - String composed of the elements separated by the delimiter  

| Param | Type | Description |
| --- | --- | --- |
| delimiter | <code>string</code> | Delimiter that separates each element |
| ...elements | <code>Array.&lt;string&gt;</code> | Elements to join together. |

<a name="TenXString.concat"></a>

### TenXString.concat(...elements) ⇒ <code>string</code>
Returns a new String composed of elements joined together.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>string</code> - String composed of the elements  

| Param | Type | Description |
| --- | --- | --- |
| ...elements | <code>Array.&lt;string&gt;</code> | Elements to join together. |

<a name="TenXString.stringify"></a>

### TenXString.stringify(...values) ⇒ <code>string</code>
Returns a JSON representation of an array of input values.

	If 'values' is provided, this function returns a JSON object of the values passed similar to 
      [JSON.stringify()](https://www.w3schools.com/js/js_json_stringify.asp)

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>string</code> - JSON representation of the 'values' array  

| Param | Type | Description |
| --- | --- | --- |
| ...values | <code>Array.&lt;Object&gt;</code> | Even-numbered array of values to format |

**Example**  
```js
this.print(this.stringify(
  "now", TenXDate.now(), 
  "str", "hello" + " world")
);

 will print: {"now": 1661782307673, "str": "hello world"}
```
<a name="TenXString.jsonPath"></a>

### TenXString.jsonPath(json, path) ⇒ <code>\*</code>
Applies a JsonPath query to a JSON string and returns the result.

This function parses the JSON string and applies the JsonPath query expression
to extract specific values or data structures from the JSON object.
JsonPath is a query language for JSON, similar to XPath for XML.

**Kind**: static method of [<code>TenXString</code>](#TenXString)  
**Returns**: <code>\*</code> - The result of the JsonPath query. Can be a single value, an array of values, or undefined if no match is found.  

| Param | Type | Description |
| --- | --- | --- |
| json | <code>string</code> | The JSON string to query |
| path | <code>string</code> | The JsonPath expression to apply |

**Example**  
```js
// Given JSON: {"users": [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]}
var jsonStr = '{"users": [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]}';

// Extract all user names:
var names = TenXString.jsonPath(jsonStr, "$.users[*].name");  // returns ["Alice", "Bob"]

// Extract first user's age:
var age = TenXString.jsonPath(jsonStr, "$.users[0].age");    // returns 30

// Extract users with age > 27:
var oldUsers = TenXString.jsonPath(jsonStr, "$.users[?(@.age > 27)]");
```
<a name="TenXLookup"></a>

## TenXLookup
Load and query the values of text lookup tables (.csv, .tsv) and geoIP DB files (.mmdb).

**Kind**: global class  

* [TenXLookup](#TenXLookup)
    * [.load(lookup, [extractColumns], ...columns)](#TenXLookup.load) ⇒ <code>number</code>
    * [.loadGeoIPDB(fileName)](#TenXLookup.loadGeoIPDB) ⇒ <code>number</code>
    * [.get(lookup, key, [keyColumn], [valueColumn])](#TenXLookup.get) ⇒ <code>string</code>
    * [.lookupMatch(lookup)](#TenXLookup.lookupMatch) ⇒ <code>boolean</code>
    * [.lastModified(lookupName, [offset])](#TenXLookup.lastModified) ⇒ <code>number</code> \| <code>boolean</code>

<a name="TenXLookup.load"></a>

### .load(lookup, [extractColumns], ...columns) ⇒ <code>number</code>
Load a comma/tab-delimited text lookup table into memory. 

An event may hold a value in a field that may need to be translated
to another using a key/value map for a specific action to be taken, or for the event
to be correctly encoded for output. 

This function scans a text file containing comma/tab
delimited rows to create an efficient in-memory table that can be used
to locate specific rows based on a selected column value and
retrieve the value of a specified value column. 

For example, the "example.csv" file can be loaded into memory in the following manner:

``` js
TenXLookup.load("example.csv", true, "Model", "Year", "Maker")
```
   
Column names are extracted from the header of the file, and the file is scanned
to index the file positions of the "Model", "Year" and "Maker" column values. 

Indexing allows for random access to column values without having to scan the file
each time the lookup table is queried. Queries to the table can be made via subsequent calls
to the [lookup()](lookup()) function to locate the maker of the "Focus" model (e.g., "Ford"). 
This function supports the loading of text lookup files, which can span GBs of data
without having to load them into memory in their raw form or scan them each time the lookup is queried

**Kind**: static method of [<code>TenXLookup</code>](#TenXLookup)  
**Returns**: <code>number</code> - The lastModified value (UNIX epoch in milliseconds) of the lookup file on disk (similar to the parameterless overload of [lastModified()](#TenXLookup.lastModified)), allowing the calling TenxInput instance to validate the lookup file's freshness. Raises an error if the lookup file could not be loaded.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| lookup | <code>string</code> |  | the name of the lookup file. If the name is a canonized path name 					       it is used as-is to locate the file. If the name does not contain a path name or is relative,                          it is treated as relative to the 'TENX_CONFIG' env variable value. |
| [extractColumns] | <code>boolean</code> | <code>true</code> | specifies whether the first row of the file should be used  						to determine the column names. If set to false, access to column names 						with subsequent calls to the [lookup](lookup) function will need to be made 						using numeric column indexes vs. alphanumeric names. |
| ...columns | <code>Array.&lt;string&gt;</code> |  | an array of up to 5 column names to index in memory. This provides 						    fast access to column values without having to re-scan the file when querying the lookup |

**Example**  
```js
this.maker = TenXLookup.get("example", this.model,  "Model",  "Maker"); 
```
<a name="TenXLookup.loadGeoIPDB"></a>

### .loadGeoIPDB(fileName) ⇒ <code>number</code>
Loads a GeoIP DB file to allow the geo location of host IP addresses.

This function uses the [Maxmind](https://www.maxmind.com/en/geoip2-databases)
client library to connect to a GeoIP DB file. Once connected, the [get()](#TenXLookup.get) function
can be used to query the location attributes of a target host IP address.

Supported lookup fields provided for an IP address are:
- Continent
- Country
- Subdivision
- City
- Postal
- Latitude
- Longitude

Field names are case insensitive.

The following call will load a MaxMind GeoIP db as part of input initialization:

``` js
export class CountryInput extends TenXInput {
  constructor() {
    TenXLookup.loadGeoIPDB("GeoLite2-City.mmdb");
  }
}
```

TenXObject constructors can use the calls to [get()](#TenXLookup.get) can
translate the [ipAddress](#TenXObject+ipAddress) field into its matching country value:
``` js
export class CountryObject extends TenXObject {
  constructor() {
    this.country = TenXLookup.get("GeoLite2-City", this.ipAddress, "country");
  }
}
```

**Kind**: static method of [<code>TenXLookup</code>](#TenXLookup)  
**Returns**: <code>number</code> - The lastModified value (UNIX epoch in milliseconds) of the GeoIP DB file on disk (similar to the parameterless overload of [lastModified()](#TenXLookup.lastModified)), allowing the calling TenxInput instance to validate the lookup file's freshness. Raises an error if the lookup file could not be loaded.  

| Param | Type | Description |
| --- | --- | --- |
| fileName | <code>string</code> | Path to the GeoIP DB file. |

<a name="TenXLookup.lookupMatch"></a>

### .lookupMatch(lookup) ⇒ <code>boolean</code>

Checks whether a specified lookup table has a row matching the current TenXObject equivalent fields.

This function scans a lookup table that has been previously loaded
via a call to [load()](#TenXLookup.load) for a row whose values matches those of fields
identified by the table's columns within the current object. The lookup table must be loaded
with an 'extractColumns' argument set to true for this function to operate correctly.

For example, a `dropPolicy.csv` lookup table containing a `message` and `severity` columns may be queried
against the current object's (intrinsic/calculated/extracted) fields of the same two names. If the
current object's `message` and `severity` fields match the values of a target row within the lookup -
the call would return true.

The lookup table can be further synchronized with a GitHub repository to allow changes to the table
to be made and reflected within the lifetime of the current 10x Engine via [config realod](https://doc.log10x.com/run/reload/).

**Kind**: instance method of [<code>TenXBaseObject</code>](#TenXBaseObject)  
**Returns**: <code>boolean</code> - whether the lookup table contains a row whose values match those
                          of current object's (intrinsic/calculated/extracted) fields named by the table's columns.  

| Param | Type | Description |
| --- | --- | --- |
| lookup | <code>string</code> | the name of the lookup to access. This name can be the name  of a 				             .csv/.tsv text file previously loaded via [load()](#TenXLookup.load).                           Lookup table names are case insensitive, and the parent folder/file extension                           may be omitted (e.g., specify 'examples' vs. '/etc/lookups/examples.csv') |

**Example**  
```js
if (TenXLookup.match("dropPolicy.csv") { // check whether 'this.message' and 'this.severity' are found in the table
  this.drop();                          // if so - filter out the current object
}
```

<a name="TenXLookup.get"></a>

### .get(lookup, key, [keyColumn], [valueColumn]) ⇒ <code>string</code>
Query a previously loaded lookup table using a specific key

This function queries a lookup table that has been previously loaded
via a call to [load()](#TenXLookup.load) or [loadGeoIPDB()](#TenXLookup.loadGeoIPDB) 
for a specific column value using a key and value column names.

For example, to calculate the make of a car object using an TenXObject's extracted/calculated 'model' field
from the 'examples' lookup table loaded via [load()](#TenXLookup.load), use:

**Kind**: static method of [<code>TenXLookup</code>](#TenXLookup)  
**Returns**: <code>string</code> - Value held within the table's 'valueColumn' for the row whose 'keyColumn' is equal to 'key'.
							If the key is not found, an empty string is returned.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| lookup | <code>string</code> |  | the name of the lookup to access. This name can be that of a  				            .csv/.tsv text file or geoIP DB previously loaded via [load()](#TenXLookup.load)                           Lookup table names are case insensitive, and the parent folder and file extension                           can be omitted (e.g., specify 'examples' vs. '/etc/lookups/examples.csv') |
| key | <code>string</code> |  | the lookup key value to search for, such as a  						    a host IP for a GeoIP DB or comma/tab-delimited value to look for within a .csv/.tsv text file. |
| [keyColumn] | <code>string</code> \| <code>number</code> | <code>0</code> | Name of the column containing the key value, or its zero-based numeric index in the lookup table. |
| [valueColumn] | <code>string</code> \| <code>number</code> | <code>0</code> | Name of the value column from which to retrieve 							              the function's result value or its zero-based numeric index in the lookup table. |

**Example**  
```js
export class Car extends TenXObject {
  constructor() {
    this.make = TenXLookup.get("examples", this.model, "model", "make"); 
  }
}
```

<a name="TenXLookup.lastModified"></a>

### .lastModified(lookupName, [offset]) ⇒ <code>number</code> \| <code>boolean</code>
Returns the last modified time of a lookup file as a 64-bit epoch timestamp,
or checks if the lookup is fresh based on a specified age threshold.

Allows determination of lookup data "freshness" by returning the last modification
time of the underlying lookup file on disk. Lookup files can be configured to sync 
with GitHub or reload from disk when changes occur.

This function helps determine when lookup data was last updated, which is useful
for monitoring data currency and triggering refresh operations when needed.

**Kind**: static method of [<code>TenXLookup</code>](#TenXLookup)  
**Returns**: <code>number</code> \| <code>boolean</code> - If offset is not provided: 64-bit epoch timestamp of the last modification time.
If offset is provided: true if lookup is fresh, false if stale.  

| Param | Type | Description |
| --- | --- | --- |
| lookupName | <code>string</code> | Name of the lookup whose last modified time to retrieve |
| [offset] | <code>number</code> | Optional. Maximum age in milliseconds to consider the lookup "fresh". If provided, the function returns true if the lookup is fresh (lastModified > TenXDate.now() - offset), false if stale. |

**Example**  
```js
// Get the last modified timestamp
export class GeoIPInput extends TenXInput {
  constructor() {
    // Do not load a lookup file that is more than 24 hours old
    let lastMod = TenXLookup.lastModified(TenXEnv.get("geoIpLookFile"));
    let twentyFourHoursAgo = TenXDate.now() - (24 * 60 * 60 * 1000);
    
    if (lastMod < twentyFourHoursAgo) {
      throw new Error("GeoIP lookup data is stale (older than 24h), last modified: " + 
        TenXDate.format(lastMod, "yyyy-MM-dd HH:mm:ss"));
    }
    
    // Load the GeoIP database if fresh
    TenXLookup.loadGeoIPDB(TenXEnv.get("geoIpLookFile"));
  }
}
```
**Example**  
```js
// Check if lookup is fresh (less than 5 minutes old)
export class GeoIPInput extends TenXInput {
  constructor() {
    if (!TenXLookup.lastModified(TenXEnv.get("geoIpLookFile"), 60000 * 5)) {
      throw new Error("GeoIP lookup data is stale (older than 5 minutes)");
    }
    
    // Load the GeoIP database if fresh
    TenXLookup.loadGeoIPDB(TenXEnv.get("geoIpLookFile"));
  }
}
```

**See also**: [Config reload](https://doc.log10x.com/run/reload/) • [GitHub sync](https://doc.log10x.com/config/github/)

<a name="TenXConsole"></a>

## TenXConsole
Print values to the host process' stdout/stderr output streams.

**Kind**: global class  

* [TenXConsole](#TenXConsole)
    * [.log([...values])](#TenXConsole.log)
    * [.error([...values])](#TenXConsole.error) ⇒ <code>string</code>

<a name="TenXConsole.log"></a>

### .log([...values])
Prints a set of values to the stdout device

This function prints an array of values into the stdout device.
If the _values_ array is empty, the value of [joinFields](#TenXBaseObject+joinFields)  is used.

**Kind**: static method of [<code>TenXConsole</code>](#TenXConsole)  
**Return{string}**: the actual string printed to the console  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [...values] | <code>Array.&lt;Object&gt;</code> | <code></code> | the list of values to print. |

<a name="TenXConsole.error"></a>

### .error([...values]) ⇒ <code>string</code>
Prints a set of values to the stderr device

This function prints an array of values to the stderr device.
If the _values_ array is empty, the value of [joinFields](#TenXBaseObject+joinFields)  is used.

**Kind**: static method of [<code>TenXConsole</code>](#TenXConsole)  
**Returns**: <code>string</code> - the actual string printed to the console  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [...values] | <code>Array.&lt;Object&gt;</code> | <code>[]</code> | the list of values to print. |

<a name="TenXDate"></a>

## TenXDate
Access system time and formatting/parsing date values. 

**Kind**: global class  

* [TenXDate](#TenXDate)
    * [.now([offset])](#TenXDate.now) ⇒ <code>number</code>
    * [.parse(str, pattern)](#TenXDate.parse) ⇒ <code>number</code>
    * [.format(epoch, pattern)](#TenXDate.format) ⇒ <code>string</code>
    * [.parseDuration(duration)](#TenXDate.parseDuration) ⇒ <code>number</code>
    * [.isBefore(left, right)](#TenXDate.isBefore) ⇒ <code>boolean</code>
    * [.isBeforeOrEqual(left, right)](#TenXDate.isBeforeOrEqual) ⇒ <code>boolean</code>
    * [.isAfter(left, right)](#TenXDate.isAfter) ⇒ <code>boolean</code>
    * [.isAfterOrEqual(left, right)](#TenXDate.isAfterOrEqual) ⇒ <code>boolean</code>

<a name="TenXDate.now"></a>

### .now([offset]) ⇒ <code>number</code>
Returns the current epoch time in milliseconds plus a specified offset

**Kind**: static method of [<code>TenXDate</code>](#TenXDate)  
**Returns**: <code>number</code> - Difference, measured in milliseconds, between the current time + offset
                 and midnight, January 1, 1970 UTC  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [offset] | <code>string</code> \| <code>number</code> | <code>0</code> | Offset duration to be added to the current epoch time.                                     If a string is provided (e.g., "30sec"), it is converted into milliseconds.                                    If a number is provided, it is treated as a +/- millisecond numeric offset. |

<a name="TenXDate.parse"></a>

### .parse(str, pattern) ⇒ <code>number</code>
Parses a string value into an epoch value based on a specified pattern

**Kind**: static method of [<code>TenXDate</code>](#TenXDate)  
**Returns**: <code>number</code> - Numerical value holding the epoch time resulting
				            from parsing str based on the pattern. If parsing fails, 0 is returned  

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String to parse |
| pattern | <code>string</code> | Date-time pattern |

**Example**  
```js
TenXConsole.log(TenXDate.parse("2021-09-16T02:33:05.289552Z", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'"));

will output: 1631773985289
```
<a name="TenXDate.format"></a>

### .format(epoch, pattern) ⇒ <code>string</code>
Formats a numeric epoch value into a string representation based on a specified pattern

**Kind**: static method of [<code>TenXDate</code>](#TenXDate)  
**Returns**: <code>string</code> - Numerical value holding the epoch time resulting
				            from formatting epoch based on pattern. If formatting fails, an empty string is returned  

| Param | Type | Description |
| --- | --- | --- |
| epoch | <code>number</code> | Epoch value to format |
| pattern | <code>string</code> | Date-time pattern to apply |

**Example**  
```js
TenXConsole.log(TenXDate.format(1631773985289, "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'"));

will output: 2021-09-16T02:33:05.289552
```
<a name="TenXDate.parseDuration"></a>

### .parseDuration(duration) ⇒ <code>number</code>
Parses a duration string and converts it to milliseconds

**Kind**: static method of [<code>TenXDate</code>](#TenXDate)  
**Returns**: <code>number</code> - Numerical value holding the duration in milliseconds.
                         If parsing fails, 0 is returned  

| Param | Type | Description |
| --- | --- | --- |
| duration | <code>string</code> | Duration string to parse (e.g., "6d", "3min", "1h", "30sec", "500ms") Supported units: ms (milliseconds), sec/s (seconds), min/m (minutes), h (hours), d (days), w (weeks) |

**Example**  
```js
TenXConsole.log(TenXDate.parseDuration("6d"));

will output: 518400000 (6 days in milliseconds)
```
**Example**
```js
TenXConsole.log(TenXDate.parseDuration("3min"));

will output: 180000 (3 minutes in milliseconds)
```
<a name="TenXDate.isBefore"></a>

### .isBefore(left, right) ⇒ <code>boolean</code>
Checks if the first epoch timestamp is before the second epoch timestamp.
Handles both millisecond and nanosecond epoch formats automatically.

**Kind**: static method of [<code>TenXDate</code>](#TenXDate)
**Returns**: <code>boolean</code> - true if left < right, false otherwise
**Throws**: <code>IllegalArgumentException</code> if either argument is null, not a valid number, or negative

| Param | Type | Description |
| --- | --- | --- |
| left | <code>number</code> | First epoch timestamp to compare (milliseconds or nanoseconds) |
| right | <code>number</code> | Second epoch timestamp to compare (milliseconds or nanoseconds) |

**Example**
```js
TenXDate.isBefore(1631773985289, 1631773985290); // returns true
```
**Example**
```js
TenXDate.isBefore(this.timestamp, TenXDate.now()); // compare event time to current time
```
<a name="TenXDate.isBeforeOrEqual"></a>

### .isBeforeOrEqual(left, right) ⇒ <code>boolean</code>
Checks if the first epoch timestamp is before or equal to the second epoch timestamp.
Handles both millisecond and nanosecond epoch formats automatically.

**Kind**: static method of [<code>TenXDate</code>](#TenXDate)
**Returns**: <code>boolean</code> - true if left <= right, false otherwise
**Throws**: <code>IllegalArgumentException</code> if either argument is null, not a valid number, or negative

| Param | Type | Description |
| --- | --- | --- |
| left | <code>number</code> | First epoch timestamp to compare (milliseconds or nanoseconds) |
| right | <code>number</code> | Second epoch timestamp to compare (milliseconds or nanoseconds) |

**Example**
```js
TenXDate.isBeforeOrEqual(1631773985289, 1631773985289); // returns true
```
**Example**
```js
TenXDate.isBeforeOrEqual(this.timestamp, TenXEnv.get("cutoff_time")); // compare event time to cutoff
```
<a name="TenXDate.isAfter"></a>

### .isAfter(left, right) ⇒ <code>boolean</code>
Checks if the first epoch timestamp is after the second epoch timestamp.
Handles both millisecond and nanosecond epoch formats automatically.

**Kind**: static method of [<code>TenXDate</code>](#TenXDate)
**Returns**: <code>boolean</code> - true if left > right, false otherwise
**Throws**: <code>IllegalArgumentException</code> if either argument is null, not a valid number, or negative

| Param | Type | Description |
| --- | --- | --- |
| left | <code>number</code> | First epoch timestamp to compare (milliseconds or nanoseconds) |
| right | <code>number</code> | Second epoch timestamp to compare (milliseconds or nanoseconds) |

**Example**
```js
TenXDate.isAfter(1631773985290, 1631773985289); // returns true
```
**Example**
```js
TenXDate.isAfter(this.timestamp, TenXDate.now("-1h")); // check if event is within the last hour
```
<a name="TenXDate.isAfterOrEqual"></a>

### .isAfterOrEqual(left, right) ⇒ <code>boolean</code>
Checks if the first epoch timestamp is after or equal to the second epoch timestamp.
Handles both millisecond and nanosecond epoch formats automatically.

**Kind**: static method of [<code>TenXDate</code>](#TenXDate)
**Returns**: <code>boolean</code> - true if left >= right, false otherwise
**Throws**: <code>IllegalArgumentException</code> if either argument is null, not a valid number, or negative

| Param | Type | Description |
| --- | --- | --- |
| left | <code>number</code> | First epoch timestamp to compare (milliseconds or nanoseconds) |
| right | <code>number</code> | Second epoch timestamp to compare (milliseconds or nanoseconds) |

**Example**
```js
TenXDate.isAfterOrEqual(1631773985289, 1631773985289); // returns true
```
**Example**
```js
TenXDate.isAfterOrEqual(this.timestamp, TenXEnv.get("start_time")); // check if event is at or after start
```
<a name="TenXCounter"></a>

## TenXCounter
Get and set the values of global atomic counters.

**Kind**: global class  

* [TenXCounter](#TenXCounter)
    * [.get([counter])](#TenXCounter.get) ⇒ <code>number</code>
    * [.inc([counter], [value], [resetInterval])](#TenXCounter.inc) ⇒ <code>number</code>
    * [.getAndInc([counter], [value], [resetInterval])](#TenXCounter.getAndInc) ⇒ <code>number</code>
    * [.getAndSet([counter], [value], [resetInterval])](#TenXCounter.getAndSet) ⇒ <code>number</code>

<a name="TenXCounter.get"></a>

### .get([counter]) ⇒ <code>number</code>
Returns the value of the specified atomic counter. If no counter
by this name found it is created.

**Kind**: static method of [<code>TenXCounter</code>](#TenXCounter)  
**Returns**: <code>number</code> - Value of the counter  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [counter] | <code>string</code> | <code>&quot;default&quot;</code> | Name of the counter whose value to get. |

<a name="TenXCounter.inc"></a>

### .inc([counter], [value], [resetInterval]) ⇒ <code>number</code>
Increase and return the value of the selected atomic counter by a specified value.

To add the values of the current object's calculated/extracted 'price' field to a 'purchases' counter:

**Kind**: static method of [<code>TenXCounter</code>](#TenXCounter)  
**Returns**: <code>number</code> - Value of the counter after 'value' has been added to it  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [counter] | <code>string</code> | <code>&quot;default&quot;</code> | Name of the counter to get. |
| [value] | <code>number</code> | <code>1</code> | Value by which to increase the counter. |
| [resetInterval] | <code>string</code> \| <code>number</code> | <code>&quot;&quot;</code> | Repeating interval after which the counter is reset to 0. Can be a number (milliseconds), string interval (e.g., "10s", "1min"), ISO-8601 duration format (e.g., "PT10S", "PT1M"), or name of a variable containing it. This value cannot exceed 255 seconds and is rounded up to the second. |

**Example**  
```js
TenXCounter.inc("purchases", this.price);
```
<a name="TenXCounter.getAndInc"></a>

### .getAndInc([counter], [value], [resetInterval]) ⇒ <code>number</code>
Increase the value of the selected counter by a specified value and return its value before increase.

To add the values of the current object's calculated/extracted 'price' field in a 'purchases' counter:

**Kind**: static method of [<code>TenXCounter</code>](#TenXCounter)  
**Returns**: <code>number</code> - The value of the counter before 'value' has been added to it  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [counter] | <code>string</code> | <code>&quot;default&quot;</code> | Name of the counter whose value to get. |
| [value] | <code>number</code> | <code>1</code> | The value by which to increase the counter. |
| [resetInterval] | <code>string</code> \| <code>number</code> | <code>&quot;&quot;</code> | Repeating interval after which the counter is reset to 0. Can be a number (milliseconds), string interval (e.g., "10s", "1min"), ISO-8601 duration format (e.g., "PT10S", "PT1M"), or name of a variable containing it. This value cannot exceed 255 seconds and is rounded up to the second. |

**Example**  
```js
TenXCounter.getAndInc("purchases", this.price);
```
<a name="TenXCounter.getAndSet"></a>

### .getAndSet([counter], [value], [resetInterval]) ⇒ <code>number</code>
Set the value of a target 64bit atomic counter to a specified value
and optionally reset every target interval.

A counter can be used to aggregate the number of events matching a specific condition:

``` js
export class MyObject extends TenXObject {

	    MyObject() {
	        if this.startsWith("ERROR")
             TenXCounter.inc("errors");
	    }
}
```

The counter can then be atomically queried and reset into a summary instance:

 ``` js
 export class ErrorSummary extends TenXSummary {
   constructor() {
     this.errors = TenXCounter.getAndSet("errors", 0);
   }
 }
```

An interval counter can be used to limit the rate of TenXObjects based on their [symbolSequence](#TenXObject+symbolSequence)
to a target limit (e.g. 1000) within a specific interval (e.g. "1s"). 

This prevents a "chatty" event from "hogging" the pipeline's bandwidth:

``` js
export class RateLimitObject extends TenXObject {
  constructor() {
	  
    var symbolSequence = this.symbolSequence();

    if (TenXCounter.getAndSet(symbolSequence, "1s") > 1000) 
		 this.drop();
    else 
      TenXCounter.inc(symbolSequence);      
  }
}
```

**Kind**: static method of [<code>TenXCounter</code>](#TenXCounter)  
**Returns**: <code>number</code> - Value of the counter before being reset  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [counter] | <code>string</code> | <code>&quot;default&quot;</code> | name of the counter whose value to get. |
| [value] | <code>number</code> | <code>1</code> | Value to set into the counter. |
| [resetInterval] | <code>string</code> \| <code>number</code> | <code>&quot;&quot;</code> | Repeating interval after which the counter is reset to 0. Can be a number (milliseconds), string interval (e.g., "10s", "1min"), ISO-8601 duration format (e.g., "PT10S", "PT1M"), or name of a variable containing it. This value cannot exceed 255 seconds and is rounded up to the second. |

<a name="TenXMath"></a>

## TenXMath
Mathematical functions such as aggregation, parsing and hashing. 

**Kind**: global class  

* [TenXMath](#TenXMath)
    * [.avg(...values)](#TenXMath.avg) ⇒ <code>number</code>
    * [.hash40(value)](#TenXMath.hash40) ⇒ <code>string</code>
    * [.hashCode(value)](#TenXMath.hashCode) ⇒ <code>number</code>
    * [.max(...values)](#TenXMath.max) ⇒ <code>number</code>
    * [.min(...values)](#TenXMath.min) ⇒ <code>number</code>
    * [.parseDouble(str, [defVal])](#TenXMath.parseDouble) ⇒ <code>number</code>
    * [.parseInt(str, [defVal])](#TenXMath.parseInt) ⇒ <code>number</code>
    * [.random([min], [max])](#TenXMath.random) ⇒ <code>number</code>
    * [.round(value)](#TenXMath.round) ⇒ <code>number</code>
    * [.sum(...values)](#TenXMath.sum) ⇒ <code>number</code>

<a name="TenXMath.avg"></a>

### .avg(...values) ⇒ <code>number</code>
Returns the average of an array of values

This function returns an average of the sum of each of the values
in the supplied array. If an element cannot be converted into a number, it is ignored.

**Kind**: static method of [<code>TenXMath</code>](#TenXMath)  
**Returns**: <code>number</code> - the resulting average value. If no value is found to average, return 0  

| Param | Type | Description |
| --- | --- | --- |
| ...values | <code>Array.&lt;number&gt;</code> | the list of values to average |

<a name="TenXMath.hash40"></a>

### .hash40(value) ⇒ <code>string</code>
Returns a 40-bit base-62 encoded hash string for a supplied value

This function computes a 64-bit hash of the input string, truncates it to 40 bits,
and encodes the result as a base-62 alphanumeric string (up to 7 characters using only `[0-9A-Za-z]`).

The base-62 encoding is safe for use as a field value across all SIEMs
(Datadog, Splunk, Elasticsearch, CloudWatch) without special character conflicts.

With 40 bits, the collision probability is negligible for up to 100K unique values
(p < 0.0005%), making it suitable for identifying log patterns in environments
with up to tens of thousands of unique patterns.

**Kind**: static method of [<code>TenXMath</code>](#TenXMath)
**Returns**: <code>string</code> - base-62 encoded 40-bit hash (up to 7 alphanumeric characters)

| Param | Type | Description |
| --- | --- | --- |
| value | <code>string</code> | Value to hash |

**Example**
```js
// Assign a pattern hash to each template based on its symbol sequence
let symbolSeq = this.symbolSequence("log,exec", "", 0);
TenXTemplate.setStatic("l10x", TenXMath.hash40(symbolSeq));
```

<a name="TenXMath.hashCode"></a>

### .hashCode(value) ⇒ <code>number</code>
Returns a simple 32bit hashCode for a supplied string

This function returns a simple hashing facility for an input string.
The hashing algorithm is the same as Java's [Object.hashCode](https://www.baeldung.com/java-objects-hash-vs-objects-hashcode#1-objecthashcode) function.

An example where this function can be useful in the context of the event
sampling. If only 10% of transaction spans that have a DEBUG level severity
are to be kept, the value of an alphanumeric field such as "transactionId"
which holds a GUID value can be hashed to filter in those values which
divide cleanly by 10, thus keeping (assuming a random GUID distribution) 10% of matching objects:

**Kind**: static method of [<code>TenXMath</code>](#TenXMath)  
**Returns**: <code>number</code> - 32-bit hashCode  

| Param | Type | Description |
| --- | --- | --- |
| value | <code>string</code> | Value to hash |

**Example**  
```js
if (this.startsWith("DEBUG") && (TenXMath.hashCode(this.transactionId) % 10) == 0) 
    this.drop();
```

<a name="TenXMath.max"></a>

### .max(...values) ⇒ <code>number</code>
Returns the highest numerical value within the supplied array

This function returns the highest numerical value within the supplied array.
If an element cannot be converted into a number, it is ignored.

**Kind**: static method of [<code>TenXMath</code>](#TenXMath)  
**Returns**: <code>number</code> - Resulting max value. If no numerical value is found, return 0.  

| Param | Type | Description |
| --- | --- | --- |
| ...values | <code>Array.&lt;number&gt;</code> | List of values to search in |

<a name="TenXMath.min"></a>

### .min(...values) ⇒ <code>number</code>
Returns the lowest numerical value in the supplied array

This function returns the lowest numerical value in the supplied array.
If an element cannot be converted into a number, it is ignored.

**Kind**: static method of [<code>TenXMath</code>](#TenXMath)  
**Returns**: <code>number</code> - Resulting average value. If no minimal value is found, return 0.  

| Param | Type | Description |
| --- | --- | --- |
| ...values | <code>Array.&lt;number&gt;</code> | List of values to search in |

<a name="TenXMath.parseDouble"></a>

### .parseDouble(str, [defVal]) ⇒ <code>number</code>
Return a 64bit double representation of a string

This function converts the input string into a 64-bit double value.
If the value does not represent a floating point value, 0 is returned.

**Kind**: static method of [<code>TenXMath</code>](#TenXMath)  
**Returns**: <code>number</code> - Parsed double value, defVal (if provided) or 0 in case of failure  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| str | <code>string</code> |  | String to parse |
| [defVal] | <code>number</code> | <code>0</code> | Value to return if str cannot be parsed |

<a name="TenXMath.parseInt"></a>

### .parseInt(str, [defVal]) ⇒ <code>number</code>
Return a 64bit long representation of a string

This function converts the input string into a 64-bit long value.
If the value does not represent a numeric point value, 0 is returned.

**Kind**: static method of [<code>TenXMath</code>](#TenXMath)  
**Returns**: <code>number</code> - Parsed long value, defVal (if provided) or 0 in case of failure  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| str | <code>string</code> |  | String to be parsed |
| [defVal] | <code>number</code> | <code>0</code> | Value to return if str cannot be parsed |

<a name="TenXMath.random"></a>

### .random([min], [max]) ⇒ <code>number</code>
Returns a randomly generated number

This function randomly generated an int number in the range between min and max. If
min and/or max are not supplied, and the function returns a double number between 0 and 1.

**Kind**: static method of [<code>TenXMath</code>](#TenXMath)  
**Returns**: <code>number</code> - Resulting random number.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [min] | <code>number</code> | <code>0</code> | Start of random range |
| [max] | <code>number</code> | <code>1</code> | End of random range |

<a name="TenXMath.round"></a>

### .round(value) ⇒ <code>number</code>
Returns the closest integer to the argument, with ties rounding to positive infinity.

This function rounds a number to the nearest integer using Java-style rounding rules.
For values exactly halfway between two integers (e.g., 2.5), it rounds up to the larger integer.

**Kind**: static method of [<code>TenXMath</code>](#TenXMath)  
**Returns**: <code>number</code> - The rounded integer value.  

| Param | Type | Description |
| --- | --- | --- |
| value | <code>number</code> | The number to round |

<a name="TenXMath.sum"></a>

### .sum(...values) ⇒ <code>number</code>
Returns the sum of values in the supplied array

This function returns the sum of values in the supplied array.
If an element cannot be converted into a number, it is ignored.

**Kind**: static method of [<code>TenXMath</code>](#TenXMath)  
**Returns**: <code>number</code> - Resulting sum value. If no numerical value is found, returns 0.  

| Param | Type | Description |
| --- | --- | --- |
| ...values | <code>Array.&lt;number&gt;</code> | List of values to search in |


<a name="TenXEnv"></a>

## TenXEnv
Access 10x launch arguments.

**Kind**: global class  

* [TenXEnv](#TenXEnv)
    * [.get(name, defValue)](#TenXEnv.get) ⇒ <code>string</code>
    * [.path(path)](#TenXEnv.path) ⇒ <code>string</code>

<a name="TenXEnv.get"></a>

### .get(name, defValue) ⇒ <code>string</code>
Returns the value of a launch argument or environment variable.

Requests for variable values are resolved in the following order:

  - Launch arguments passed on the [command line](https://doc.log10x.com/config/cli/) or via [config files](https://doc.log10x.com/config/yaml/).
  - OS Environment variable.
  - [JVM properties](https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html).
    

**Kind**: static method of [<code>TenXEnv</code>](#TenXEnv)  
**Returns**: <code>string</code> - Value of the variable if found, otherwise 'defValue' if provided or empty value if not.  

| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | Name of the launch arg or environment variable to query |
| defValue | <code>string</code> \| <code>number</code> \| <code>boolean</code> | Value to return if a matching variable is not found |

**Example**  

For example, the decision to drop `TRACE` events can be made configurable by introducing a `dropTrace` argument. This argument can then be checked as follows:

```js
class MyObject extends TenXObject {
  constructor() {
    this.drop(TenXEnv.get("dropTrace") && this.startsWith("TRACE")); 
  }
}
```

<a name="TenXEnv.path"></a>

### .path(path) ⇒ <code>string</code>
Resolves a relative path on disk to a canonical one.

Configuration files utilize this function to resolve a file/folder reference relative
to: 
- [includePaths](https://doc.log10x.com/run/bootstrap/#includepaths)
- Shell variable (e.g.,. `MY_FOLDER`)
- JVM system property (e.g.,. user.dir, temp.dir, tenx.temp.dir)

**Kind**: static method of [<code>TenXEnv</code>](#TenXEnv)  
**Returns**: <code>string</code> - canonical path value  

| Param | Type | Description |
| --- | --- | --- |
| paths | <code>string[]</code> | relative file/folder paths to attempt to resolve in order |
| emptyOnFail | <code>boolean</code> | return empty string if path not found, otherwise return last item in paths|

**Example**  
``` yaml
# Resolve a relative config path, if not found - default to pipeline temp dir variable.
localFolder: $=path("<user.dir>/compile/sources", <tenx.temp.dir>") 

# Resolve the 'astpretty.py' relative path
launchOptions:
  args:
    - $=path("pipelines/compile/modules/scanner/pythonAST/astpretty.py")
```
<a name="TenXLog"></a>

## TenXLog
Write messages to the 10x log.

**Kind**: global class  

* [TenXLog](#TenXLog)
    * [.debug(message, ...params)](#TenXLog.debug) ⇒ <code>string</code>
    * [.info()](#TenXLog.info)
    * [.error()](#TenXLog.error)
    * [.isDebug()](#TenXLog.isDebug) ⇒ <code>boolean</code>
    * [.throwError(message)](#TenXLog.throwError) ⇒

<a name="TenXLog.debug"></a>

### .debug(message, ...params) ⇒ <code>string</code>
logs a message to the 10x log with a DEBUG level.

This function logs a message and an optional list of parameters to the 10x log.
The destination to which log messages are written is configured in the 'log4j2.yaml' file.
It is recommended to apply the log4j parameter formatting scheme vs. concatenating the message and params manually.
To learn more see [messages](https://logging.apache.org/log4j/2.x/manual/messages.html).

**Kind**: static method of [<code>TenXLog</code>](#TenXLog)  
**Returns**: <code>string</code> - Message parameter passed into this function  

| Param | Type | Description |
| --- | --- | --- |
| message | <code>string</code> | Message to log |
| ...params | <code>Array.&lt;string&gt;</code> | Parameters to format into message |

**Example**  
``` js
TenXLog.debug("error parsing value: {} in object of type: {}", this.value, this.symbolSequence());
```
<a name="TenXLog.info"></a>

### .info()
logs a message to the 10x log with an INFO level.
See [debug](#TenXLog.debug) to learn more.

**Kind**: static method of [<code>TenXLog</code>](#TenXLog)  
<a name="TenXLog.error"></a>

### .error()
logs a message to the 10x log with an ERROR level.
See [debug](#TenXLog.debug) to learn more.

**Kind**: static method of [<code>TenXLog</code>](#TenXLog)  
<a name="TenXLog.isDebug"></a>

### .isDebug() ⇒ <code>boolean</code>
checks whether debug logging is enabled.

Returns a boolean value indicating whether debug-level logging is currently enabled.
The function can be used to conditionally log expensive debug messages only when debugging is active,
avoiding unnecessary string formatting or computation when debug logs would be discarded.

**Kind**: static method of [<code>TenXLog</code>](#TenXLog)  
**Returns**: <code>boolean</code> - boolean indicating whether debug logging is enabled  

**Example**  
```js
// Drop if rate is below minimum threshold
if (rate < minRate) {
    
    this.drop();

    if (TenXLog.isDebug()) {

        TenXLog.debug("drop by min rate. preIncrementCount={}, baseRate={}, rate={}, freqPerMin={}, randomValue=undefined, boost={}, baseline={}",
        preIncrementCount, baseRate, rate, freqPerMin, boost, baseline);
    }
}
```
<a name="TenXLog.throwError"></a>

### .throwError(message) ⇒
Throws an error to halt the 10x Engine.

This function can be used to validate input/configuration values to ensure they are 
present and correct before reading events from input(s).

For example, a `threshold` startup argument used for processing TenXObjects
may need to hold a positive numeric value. For this, an assertion is used to validate that the
launch argument is both present and can be converted into a positive number value. 

The threshold launch argument can be defined in a [module file](https://doc.log10x.com#Module) as:

``` yaml
  options:      
  - names:
    - threshold
    description: my threshold value
    type: number
    required: true
```

The script below validates a positive number was passed to the 10x Engine:

``` js
export class ThresholdInput extends TenXInput {
  constructor() {
    if (TenXMath.parseInt(TenXEnv.get("threshold", -1)) <= 0) 
      throw new Error("positive 'threshold' not set!");      
  }
}

//The threshold can be used to tally instances whose 'threshold' field is > 'threshold'
export class ThresholdObject extends TenXObject {
  constructor() {       
    if (this.threshold > TenXEnv.get("threshold")) TenXCounter.inc("overThreshold");
  }
}

// An aggregator can be configured to generate TenXSummaries to tally the volume of TenXObjects surpassing 'threshold'. 
// To learn more see: https://doc.log10x.com/run/aggregate
export class ThresholdSummary extends TenXSummary {
  constructor() {       
    this.overThreshold = TenXCounter.getAndSet("overThreshold", 0);
  }
}   
```

The module and script files can be passed alongside the threshold value to the 10x Engine: 
``` console
$ tenx run @threshold.js @threshold.yaml threshold 1000
```

A 'config.yaml' file can bundle these settings and passed to the runtime via:
> tenx @config.yaml: 

``` yaml 
tenx: run
include:
  - threshold.yaml
  - threshold.js
threshold: 1000   
```

**Kind**: static method of [<code>TenXLog</code>](#TenXLog)  
**Returns**: halt the runtime  

| Param | Type | Description |
| --- | --- | --- |
| message | <code>string</code> | a message to write to stderr if the condition is not 'truthy'. |

<a name="TenXEngine"></a>

## TenXEngine
The 10x Engine provides the underlying implementation of all classes and functions in the [tenx.js](https://github.com/log-10x/modules/blob/main/lib/script/tenx.js) API module.

To load custom JavaScript classes at runtime see [JavaScript configuration](https://doc.log10x.com/config/javascript/).

**Kind**: global class  

* [TenXEngine](#TenXEngine)
    * [.invoke(...args)](#TenXEngine.invoke)
    * [.shouldLoad(config)](#TenXEngine.shouldLoad) ⇒ <code>boolean</code>

<a name="TenXEngine.invoke"></a>

### .invoke(...args)
A sink method for invoking a target 10x API JS function. The concrete implementation of this method is provided at runtime by the 10x Engine. This method is not intended to be called directly by user code.

**Kind**: static method of [<code>TenXEngine</code>](#TenXEngine)  
**Returns**: return value of the target function invoked by the caller

| Param | Type | Description |
| --- | --- | --- |
| args | <code>...any</code> | arguments for the target function being invoked |


<a name="TenXEngine.shouldLoad"></a>

### .shouldLoad(config) ⇒ <code>boolean</code>
Determines whether a custom JavaScript class should be loaded and instantiated by the 10x Engine.

This static method is called by the engine during the loading phase to decide which user-defined
subclasses should be applied to specific instances. The engine passes a config object containing
all configuration values for the relevant module (input, output, unit, etc.).

For object, template, and summary subclasses, the config object provides all configuration values
from the input module for which these classes are instantiated.

Global configuration flags (such as `quiet`) are accessed via `TenXEnv.get()` and are not part of the config object.

**Kind**: static method of [<code>TenXEngine</code>](#TenXEngine)  
**Returns**: <code>boolean</code> - True if the class should be loaded and instantiated, false to skip  

| Param | Type | Description |
| --- | --- | --- |
| config | <code>Object</code> | Configuration object with named access to all module options |
| config.inputName | <code>string</code> | For inputs/objects/templates: name of the input (e.g., "CloudWatchLogs") |
| config.outputName | <code>string</code> | For outputs: name of the output (e.g., "FileOutput") |
| config.unitName | <code>string</code> | For units: name of the unit (e.g., "LoadConfig") |

**Example**  
```js
// In a CloudWatch Logs object processor
export class CloudwatchLogsObject extends TenXObject {
  // @https://doc.log10x.com/api/js/#TenXEngine.shouldLoad
  static shouldLoad(config) {
    return TenXString.endsWith(config.inputName, "CloudWatchLogs");
  }
}
```

**Example**  
```js
// In a file output with quiet mode check
export class FileOutput extends TenXOutput {
  // @https://doc.log10x.com/api/js/#TenXEngine.shouldLoad
  static shouldLoad(config) {
    return !TenXEnv.get("quiet") && config.outputName === "FileOutput";
  }
}
```  

<!-- LINKS -->

[TenXBaseObject]:#TenXBaseObject
[TenXInput]:#TenXInput
[TenXOutput]:#TenXOutput
[TenXUnit]:#TenXUnit
[input]:https://doc.log10x.com/run/input/stream
[TenXObject]:#TenXObject
[transforms]:https://doc.log10x.com/run/transform/
[TenXSummary]:#TenXSummary
[TenXTemplate]:#TenXTemplate
[TenXCollection]:#TenXCollection
[TenXString]:#TenXString
[TenXMap]:#TenXMap
[TenXLookup]:#TenXLookup
[TenXConsole]:#TenXConsole
[TenXDate]:#TenXDate
[TenXCounter]:#TenXCounter
[TenXMath]:#TenXMath
[TenXEnv]:#TenXEnv
[TenXLog]:#TenXLog
[TenXEngine]:#TenXEngine
[TenXTemplates]:https://doc.log10x.com/run/template
[aggregator]:https://doc.log10x.com/run/aggregate
[.text]:#tenxsummarytext
[.utf8Size]:#tenxsummaryutf8size
[.vars]:#tenxsummaryvars
[.isTemplate]:#tenxsummaryistemplate
[.isObject]:#tenxsummaryisobject
[.isEncoded]:#tenxsummaryisencoded
[.isSummary]:#tenxsummaryissummary
[.template]:#tenxsummarytemplate
[.templateHash]:#tenxsummarytemplatehash
[.timestamped]:#tenxsummarytimestamped
[.inputName]:#tenxsummaryinputname
[expanded]:https://doc.log10x.com/run/transform/#expand
[`TenXBaseObject`]:#tenxbaseobject
[text]:#TenXBaseObject+text
[extracted]:https://doc.log10x.com/run/input/extract/#outer-text
[ variable sequences]:https://doc.log10x.com/run/transform/structure
[length]:#TenXString.length
[templateHash]:#TenXBaseObject+templateHash
[timestamp]:#TenXObject+timestamp
[vars]:#TenXBaseObject+vars
[template]:#TenXBaseObject+template
[inputName]:https://doc.log10x.com/run/input/stream/#inputname
[Reflect.set]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set
[includes]:#TenXString.includes
[startsWith]:#TenXString.startsWith
[endsWith]:#TenXString.endsWith
[indexOf]:#TenXString.indexOf
[lastIndexOf]:#TenXString.lastIndexOf
[toLowerCase]:#TenXString.toLowerCase
[toUpperCase]:#TenXString.toUpperCase
[matchAll]:#TenXString.matchAll
[match]:#TenXString.match
[replace]:#TenXString.replace
[token delimiters]:https://doc.log10x.com/run/transform/structure/#delimiters
[timestamp extraction]:https://doc.log10x.com/run/transform/timestamp
[HTTP lookup]:https://github.com/log-10x/modules/blob/main/pipelines/run/modules/initialize/httpCode/http-object.js
[input configuration]:https://doc.log10x.com/run/input
[`TenXInput`]:#TenXinput
[inputs]:https://doc.log10x.com/run/input
[aggregators]:https://doc.log10x.com/run/aggregate
[decorated]:https://www.typescriptlang.org/docs/handbook/decorators.html
[ipAddress]:#TenXObject+ipAddress
[Embedded fields]:https://doc.log10x.com/run/transform/fields
[1]:#TenXBaseObject+get
[TenXTemplate]:https://doc.log10x.com/run/template
[metric output]:https://doc.log10x.com/run/output/metric
[origin]:https://doc.log10x.com/run/transform/symbol
[encode]:#TenXObject+encode
[Receiver compact-mode modules]:https://doc.log10x.com/run/input/forwarder/module.yaml
[reflective]:symbolSequence
[launch arguments]:#TenXEnv
[text/GeoIP Lookups]:#TenXLookup
[output]:https://doc.log10x.com/run/output
[counters]:#TenXCounter
[logical groups]:https://doc.log10x.com/run/transform/group
[.groupSize]:#tenxobjectgroupsize
[.extractorName]:#tenxobjectextractorname
[.extractorKey]:#tenxobjectextractorkey
[.source]:#tenxobjectsource
[.timestamp]:#tenxobjecttimestamp
[.ipAddress]:#tenxobjectipaddress
[.classes]:#tenxobjectclasses
[`TenXObject`]:#tenxobject
[input extractors]:https://doc.log10x.com/run/input/extract
[source pattern]:https://doc.log10x.com/run/input/stream/#inputsourcepattern
[timestamps]:https://doc.log10x.com/run/transform/timestamp
[symbol files]:https://doc.log10x.com/run/symbol
[symbols]:https://doc.log10x.com/run/transform/symbol
[output context]:https://doc.log10x.com/run/output/stream
[Receiver module]:https://doc.log10x.com/run/regulate
[outputStreamsFilter argument]:https://doc.log10x.com/run/output/filter
[Metric naming]:https://prometheus.io/docs/practices/naming
[symbol path]:https://doc.log10x.com/run/symbol
[symbolMaxOrigins]:https://doc.log10x.com/run/transform/symbol
[input stream]:https://doc.log10x.com/run/input/stream
[output streams]:https://doc.log10x.com/run/output/stream
[Aggregators]:https://doc.log10x.com/run/aggregate
[HTTP lookups]:https://github.com/log-10x/modules/blob/main/pipelines/run/modules/initialize/httpCode/http-object.js
[.summaryVolume]:#tenxsummarysummaryvolume
[.summaryBytes]:#tenxsummarysummarybytes
[.summaryValues]:#tenxsummarysummaryvalues
[.summaryValuesHash]:#tenxsummarysummaryvalueshash
[`TenXSummary`]:#tenxsummary
[summaryValues]:summaryValues
[2]:#TenXArray
[`TenXArray`]:#TenXArray
[`TenXString`]:#TenXString
[`TenXLookup`]:#TenXlookup
[lookup]:lookup
[Maxmind]:https://www.maxmind.com/en/geoip2-databases
[joinFields]:#TenXBaseObject+joinFields
[`TenXConsole`]:#TenXconsole
[3]:#tenxdate
[`TenXDate`]:#tenxdate
[`TenXCounter`]:#TenXCounter
[`TenXMath`]:#TenXMath
[JVM properties]:https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
[`TenXEnv`]:#TenXenv
[pipelines]:https://github.com/log-10x/config/tree/main/pipelines/
[TENX_CONFIG]:https://doc.log10x.com/run/launch/#configfolder
[messages]:https://logging.apache.org/log4j/2.x/manual/messages.html
[`TenXLog`]:#TenXLog
[debug]:#TenXLog.debug
[module file]:https://doc.log10x.com#Module
[`TenXEngine`]:#TenXEngine
[.set(field, value)]:#tenxsummarysetfield-value
[.joinFields(delimiter, ...fields)]:#tenxsummaryjoinfieldsdelimiter-fields
[.length()]:#tenxsummarylength
[.includes()]:#tenxsummaryincludes
[.startsWith()]:#tenxsummarystartswith
[.endsWith()]:#tenxsummaryendswith
[.indexOf()]:#tenxsummaryindexof
[.lastIndexOf()]:#tenxsummarylastindexof
[.toLowerCase()]:#tenxsummarytolowercase
[.toUpperCase()]:#tenxsummarytouppercase
[.matchAll()]:#tenxsummarymatchall
[.match()]:#tenxsummarymatch
[.replace()]:#tenxsummaryreplace
[.toString()]:#tenxsummarytostring
[.tokenSize()]:#tenxsummarytokensize
[.timestampStart(index)]:#tenxsummarytimestampstartindex
[.timestampEnd(index)]:#tenxsummarytimestampendindex
[load()]:#TenXLookup.load
[log()]:#TenXConsole.log
[lookupMatch()]:#TenXLookup.lookupMatch
[loadGeoIPDB()]:#TenXLookup.loadGeoIPDB
[4]:#TenXBaseObject+token
[5]:#TenXObject+symbolSequence
[6]:#TenXObject+drop
[.outputPath()]:#tenxobjectoutputpath
[.isNewTemplate()]:#tenxobjectisnewtemplate
[.length(list)]:#TenXStringlengthlist
[.includes(str, ...term)]:#TenXStringincludesstr-term
[.startsWith(str, prefix)]:#TenXStringstartswithstr-prefix
[.endsWith(str, suffix)]:#TenXStringendswithstr-suffix
[.indexOf(str, term, fromIndex)]:#TenXStringindexofstr-term-fromindex
[.lastIndexOf(str, term, fromIndex)]:#TenXStringlastindexofstr-term-fromindex
[.toLowerCase(str)]:#TenXStringtolowercasestr
[.toUpperCase(str)]:#TenXStringtouppercasestr
[.matchAll(str, pattern)]:#TenXStringmatchallstr-pattern
[.match(str, pattern)]:#TenXStringmatchstr-pattern
[.replace(str, target, replacement)]:#TenXStringreplacestr-target-replacement
[.substring(str, beginIndex, endIndex)]:#TenXStringsubstringstr-beginindex-endindex
[.join(delimiter, ...elements)]:#TenXStringjoindelimiter-elements
[.concat(...elements)]:#TenXStringconcatelements
[.stringify(...values)]:#TenXStringstringifyvalues
[JSON.stringify()]:https://www.w3schools.com/js/js_json_stringify.asp
[.loadGeoIPDB(fileName)]:#TenXlookuploadgeoipdbfilename
[lookup()]:lookup(
[get()]:#TenXLookup.get
[7]:#TenXLookup.loadGeoIPDB
[8]:#TenXLookup.lookupMatch
[.parse(str, pattern)]:#TenXdateparsestr-pattern
[.format(epoch, pattern)]:#TenXdateformatepoch-pattern
[.avg(...values)]:#TenXMathavgvalues
[.hashCode(value)]:#TenXMathhashcode
[.max(...values)]:#TenXMathmaxvalues
[.min(...values)]:#TenXMathminvalues
[.round(value)]:#TenXMathround
[.sum(...values)]:#TenXMathsumvalues
[.get(key)]:#TenXInputgetkey
[.set(key, value)]:#TenXInputsetkey-value
[.get(name, defValue)]:#TenXenvgetname-defvalue
[.path(path)]:#TenXenvpathpath
[.debug(message, ...params)]:#TenXLogdebugmessage-params
[.info()]:#TenXLoginfo
[.error()]:#TenXLogerror
[.throwError(message)]:#TenXLogthrowerrormessage
