
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@qrvey/utils
Advanced tools
Helper, Utils for all Qrvey Projects
Apply to the given date format to a date value
Name | Type | Description | |
---|---|---|---|
bytes | type number |
Void
Set convert Bytes into MB
Name | Type | Description | |
---|---|---|---|
bytes | type number |
Void
It returns true if the given string is a valid time string, and false otherwise
Name | Type | Description | |
---|---|---|---|
timeString | string | - The time string to validate. | Optional |
It takes a time string and a format string and returns a formatted time string
Name | Type | Description | |
---|---|---|---|
timeString | any | - The time string to be formatted. | |
format | string | - The format of the time string. |
Void
The function getCleanCustomTokens
takes an object customTokens
and returns a new object
cleanTokens
with filtered values based on certain conditions.
Name | Type | Description | |
---|---|---|---|
customTokens | ICustomTokensComplex | - The customTokens parameter is an object of type ICustomTokensComplex . |
The function getCustomTokenBoxParse
takes in an object of custom tokens and returns a formatted
list of tokens with aliases and labels.
Name | Type | Description | |
---|---|---|---|
customTokens | ICustomTokensComplex | - The customTokens parameter is an object that contains custom token groups and their corresponding tokens. Each custom token group is represented by a keyin the object, and the value is an array of tokens within that group. |
tokensList
.The function getCustomtonTokens
takes a configuration object and returns a parsed version of the
custom tokens, with keys and values appropriately formatted.
Name | Type | Description | |
---|---|---|---|
customtonTokensConfig | ICustomTokensSimple ICustomTokensComplex | - The customtonTokensConfig parameter is an object that can have two possible types:ICustomTokensSimple or ICustomTokensComplex . |
ICustomTokensComplex
.The function getCustomtonTokensWithKeys
takes an array of CustomTokens
objects and returns a new
array with each object having a key
property that is the camelized version of either the key
or
label
property.
Name | Type | Description | |
---|---|---|---|
customTokens | Array.<CustomTokens> | - An array of objects representing custom tokens. Each object should have properties such as "key" and "label". |
CustomTokens
objects. Each object in the array has an additional key
property, which is generated by camelizing the key
or label
property of the original
CustomTokens
object.Get a text and evaluate if it matchs with a token box label.
Name | Type | Description | |
---|---|---|---|
label | string to evaluate |
If data is truthy, return data.logic, otherwise return an empty array.
Name | Type | Description | |
---|---|---|---|
filters | - The data object that is passed to the component. |
Void
It takes a data object and returns a MetricValue object
Name | Type | Description | |
---|---|---|---|
data | - The data object that is passed to the component. |
If data is truthy and data.dateColumn is truthy, return true, otherwise return false.
Name | Type | Description | |
---|---|---|---|
data | - The data object that is passed to the component. |
Void
Given a time label and a custom range, return a relative date config or a metric custom range.
Name | Type | Description | |
---|---|---|---|
timeLabel | TIME_PERIOD | - TIME_PERIOD.CUSTOM_RANGE | |
range | CustomRangeConfig | - CustomRangeConfig |
It takes in a custom range config object and returns a custom range object
Name | Type | Description | |
---|---|---|---|
customRangeData | CustomRangeConfig | - CustomRangeConfig |
It takes in a metricData object and returns a CustomRangeConfig object
Name | Type | Description | |
---|---|---|---|
metricData | - The metric data object that is returned from the API. |
It takes in a metricData object and returns a CustomRangeConfig object
Name | Type | Description | |
---|---|---|---|
metricData | - The metric data object that is returned from the API. |
Void
[TODO: Finish the function] Get an string of the properties of the given column.
Name | Type | Description | |
---|---|---|---|
column | The column |
Gets the column from the dataset object Recieves a partial column object and returns a full column object from the Dataset
Name | Type | Description | |
---|---|---|---|
column | IColumn | a partial column info | |
dataset | IDataset | the dataset info to look for the column | |
getIndex | boolean | flag to get the index of the column array or the complete column info |
Validates the arguments
Name | Type | Description | |
---|---|---|---|
column | IColumn | a partial column info | |
dataset | IDataset | the dataset info |
Gets the column array
Name | Type | Description | |
---|---|---|---|
dataset | IDataset | the dataset info |
Get a model column by a partial column info.
Name | Type | Description | |
---|---|---|---|
column | IColumn | The partial column info | |
model | IModel | The model object |
Gets a column from a datasets collection. Recieves a partial column object and returns a full column object from the Dataset
Name | Type | Description | |
---|---|---|---|
column | IColumn | a partial column object | |
datasets | IDataset | the datasets collection to look for the column | |
getIndex | boolean | flag to get the index of the column array or the complete column info |
Validates the arguments
Name | Type | Description | |
---|---|---|---|
column | IColumn | a partial column info | |
dataset | IDataset | the datasets collection |
Get the model by Qrvey ID
Name | Type | Description | |
---|---|---|---|
qrveyid | The Qrvey ID |
Get a dataset list from a collection of Qrvey IDs
Name | Type | Description | |
---|---|---|---|
qrveyids | Collection of Qrvey IDs |
Get a promise with a preview of resulting data. Depending on the validator, the endpoint will change.
Name | Type | Description | |
---|---|---|---|
uFilter | The Filter Builder Filter | ||
filterLogic | Additional filter logic to apply in the preview | ||
chartSettings | |||
resetApi | flag to determine when the api should be reseted. |
Gets the available scopes and scope IDs
Set the config into the Filter Builder Api class
Name | Type | Description | |
---|---|---|---|
config | the config. |
Void
Gets a promise with a resulting data
Name | Type | Description | |
---|---|---|---|
config | the config | ||
uFilter | The filter Builder filter | ||
filterLogic | Additional filter logic to apply in the preview | ||
chartSettings | The settings of the chart. For Aggregate Columns. |
Gets the Data from preview Response
Name | Type | Description | |
---|---|---|---|
response | The preview presponse | ||
uFilter | The filter Builder filter |
Gets summaries from preview response
Name | Type | Description | |
---|---|---|---|
records | The data from preview response | ||
values | The values from the preview response |
Gets the filter object structure for the searching text
Name | Type | Description | |
---|---|---|---|
uFilter | IFUFlattenedFilter | The filter object |
Gets the filters from the chart settings
Name | Type | Description | |
---|---|---|---|
uFilter | IFUFlattenedFilter | The filter object | |
searchLogic | OLD_IFilterData | Additional filter object for the searching text | |
chartSettings | IFUChartSettings | The settings of the chart. For Aggregate Columns. |
Tranform response in array of object with value key Null or undefined values are avoided
Name | Type | Description | |
---|---|---|---|
records | The data from preview response |
Gets request body structure
Name | Type | Description | |
---|---|---|---|
uFilter | IFUFlattenedFilter | The filter object | |
filterLogic | Array.<IFBLogic> | Additional filter logic to apply in the preview | |
chartSettings | IFUChartSettings | The settings of the chart. For Aggregate Columns. |
Gets chart body structure
Name | Type | Description | |
---|---|---|---|
uFilter | The filter Builder filter | ||
chartSettings | The settings of the chart. For Aggregate Columns. |
Gets dimension body structure
Name | Type | Description | |
---|---|---|---|
uFilter | The filter Builder filter | ||
chartSettings | The settings of the chart. For Aggregate Columns. |
Gets max data point number
Name | Type | Description | |
---|---|---|---|
column | The column to filter | ||
chartSettings | The settings of the chart. For Aggregate Columns. |
Gets sort option structure
Name | Type | Description | |
---|---|---|---|
column | The column to filter |
Gets summaries body structure
Name | Type | Description | |
---|---|---|---|
uFilter | The filter Builder filter |
Refines the body structure
Name | Type | Description | |
---|---|---|---|
bodies | The body structure | ||
uFilter | The filter Builder filter |
Gets the validation type for the preview request
Name | Type | Description | |
---|---|---|---|
column | The column to filter | ||
vaildator | Validator Type |
Gets afterKey object
Gets a promise with a resulting data
Name | Type | Description | |
---|---|---|---|
config | the config | ||
uFilter | The filter Builder filter | ||
filterLogic | Additional filter logic to apply in the preview | ||
chartSettings | The settings of the chart. For Aggregate Columns. |
Gets the Data from preview Response
Name | Type | Description | |
---|---|---|---|
response | The preview presponse | ||
uFilter | The filter Builder filter |
Refines the afterKey object
Name | Type | Description | |
---|---|---|---|
props |
Void
Sets the afterKey object
Name | Type | Description | |
---|---|---|---|
afterKey | the afterKey object |
Void
Sets the Filter Builder Filter
Name | Type | Description | |
---|---|---|---|
uFilter |
Void
Gets the filter object structure for the searching text
Name | Type | Description | |
---|---|---|---|
uFilter | IFUFlattenedFilter | The filter object |
Gets the filters from the chart settings
Name | Type | Description | |
---|---|---|---|
uFilter | IFUFlattenedFilter | The filter object | |
searchLogic | OLD_IFilterData | Additional filter object for the searching text | |
chartSettings | IFUChartSettings | The settings of the chart. For Aggregate Columns. |
Tranform response in array of object with value key Null or undefined values are avoided
Name | Type | Description | |
---|---|---|---|
records | The data from preview response |
Gets request body structure
Name | Type | Description | |
---|---|---|---|
uFilter | IFUFlattenedFilter | The filter object | |
filterLogic | Array.<IFBLogic> | Additional filter logic to apply in the preview | |
chartSettings | IFUChartSettings | The settings of the chart. For Aggregate Columns. |
Gets dimension body structure
Name | Type | Description | |
---|---|---|---|
uFilter | The filter Builder filter |
Get a dimension body structure foor pagination endpoint
Name | Type | Description | |
---|---|---|---|
dimensions |
Gets max data point number
Name | Type | Description | |
---|---|---|---|
column | The column to filter | ||
chartSettings | The settings of the chart. For Aggregate Columns. |
Gets sort option structure
Name | Type | Description | |
---|---|---|---|
column | The column to filter |
Gets summaries body structure
Name | Type | Description | |
---|---|---|---|
uFilter | The filter Builder filter |
Refines the body structure
Name | Type | Description | |
---|---|---|---|
bodies | The body structure | ||
uFilter | The filter Builder filter |
Gets the validation type for the preview request
Name | Type | Description | |
---|---|---|---|
column | The column to filter | ||
vaildator | Validator Type |
Gets summaries from preview response
Name | Type | Description | |
---|---|---|---|
records | The data from preview response | ||
values | The values from the preview response |
Checks if two filter columns are the same.
Name | Type | Description | |
---|---|---|---|
column1 | |||
column2 |
Gets the numeric offset (minutes) from the ISO offset (string)
Name | Type | Description | |
---|---|---|---|
offset | number string | the timezone offset |
number
the offset in minutesName | Type | Description | |
---|---|---|---|
date | IDate | String, object or millisencond number of the date | |
settings | IDFDateToHmsSettings | the settings of the dateToHms function |
string
string of [HH:mm:ss] date formatGets the settings for this function.
Name | Type | Description | |
---|---|---|---|
settings | IDFDateToHmsSettings | the settings of the dateToHms function |
IDFDateToHmsSettings
a new object for the settingsGets the Hours
Name | Type | Description | |
---|---|---|---|
date | Date | the date object | |
settings | IDFDateToHmsSettings | the settings of the dateToHms function |
string
the hour stringGets the Minutes
Name | Type | Description | |
---|---|---|---|
date | Date | the date object | |
settings | IDFDateToHmsSettings | the settings of the dateToHms function |
string
the minute stringGets the Seconds
Name | Type | Description | |
---|---|---|---|
date | Date | the date object | |
settings | IDFDateToHmsSettings | the settings of the dateToHms function |
string
the seconds stringTransform a Date to [mm/dd/yyyy] date format.
Name | Type | Description | |
---|---|---|---|
date | IDate | String, object or millisencond number of the date | |
settings | IDateSettings | the configuration of dates |
string
string of [mm/dd/yyyy] date formatTransform a Date to [Month Year] date format.
Name | Type | Description | |
---|---|---|---|
date | IDate | String, object or millisencond number of the date | |
settings | IDateSettings | the configuration of dates |
string
string of [Month Year] date formatTransform a valid Date to [Quarter Year] date format.
Name | Type | Description | |
---|---|---|---|
date | IDate | String of a valid date, date object or millisencond number of the date | |
settings | IDateSettings | the configuration of dates |
string
string of [Quarter Year] date formatTransform a Date to [W# Year] date format.
Name | Type | Description | |
---|---|---|---|
date | IDate | String, object or millisencond number of the date | |
settings | IDateSettings | the configuration of dates |
string
string of [W# Year] date formatTransform a Date to [Year] date format.
Name | Type | Description | |
---|---|---|---|
date | IDate | String, object or millisencond number of the date | |
settings | IDateSettings | the configuration of dates |
string
string of [Year] date formatTransforms String time from a [H:m:s] format to Date object.
Name | Type | Description | |
---|---|---|---|
monthYearDate | string | String of [H:m:s] time | |
settings | IDateSettings | the configuration of dates |
IDate
The date object or the date in milliseconds. If the argument is an unexpected time, the function will return the same valueTransforms String Date from a [mm/dd/yyyy] format to Date object.
Name | Type | Description | |
---|---|---|---|
{string}monthYearDate | String of [mm/dd/yyyy] date | ||
settings | IDateSettings | the configuration of dates |
IDate
The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same valueTransforms String Date from a [Month Year] format to Date object.
Name | Type | Description | |
---|---|---|---|
monthYearDate | string | String of [Month Year] date | |
settings | IDateSettings | the configuration of dates |
IDate
The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same valueGets the ISO offset From the numeric offset (minutes)
Name | Type | Description | |
---|---|---|---|
offset | number string | the timezone offset |
string
the offset in minutesTransforms String Date from a [Quarter Year] format to Date object.
Name | Type | Description | |
---|---|---|---|
quarterYearDate | string | String of [Quarter Year] date | |
settings | IDateSettings | the configuration of dates |
IDate
The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value.Transforms String Date from a [Week Year] format to Date object.
Name | Type | Description | |
---|---|---|---|
date | string | String of [Week Year] date | |
settings | IDateSettings | the configuration of dates |
IDate
The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value.Transforms String Date from a [Year] format to Date object.
Name | Type | Description | |
---|---|---|---|
yearDate | string | String of [Year] date | |
settings | IDateSettings | the configuration of dates |
IDate
The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value.Determines if the given date has tokens. The date is splitted depending on date format. Undefined date is returning false.
Name | Type | Description | |
---|---|---|---|
{string }date | The string of the date. It may contain tokens. | ||
format | IDateFormat | The date format |
boolean
true: include tokens; false: otherwiseGets a Date Object instance by a Date format
Name | Type | Description | |
---|---|---|---|
date | string | String with a formatted date | |
format | IDateFormat | The date format | |
settings | IDateSettings | the configuration of dates |
IDate
a Date object, milisecond time or the same value if date format does not match.Gets a date value in the given timezone
Name | Type | Description | |
---|---|---|---|
date | IDate | the date | |
timezone | IDTimezone | the timezone object |
IDate
A transformed valueGets a Date with the given offset of the Timezone. No given an offset the default is going to be set by the browser
Name | Type | Description | |
---|---|---|---|
date | IDate | String, object or millisencond number of the date | |
offset | IDTimezoneOffset | the timezone offset |
IDate
the updated Date objectGets the date format by the given property
Name | Type | Description | |
---|---|---|---|
property | IColumnPropertyType | The Column Property |
IDateFormat
The date formatGets an array of regular expressions by the given date format. Day format is the default date format
Name | Type | Description | |
---|---|---|---|
dateFormat | IDateFormat | an string of the format |
Array.<string>
an array of regular expressionsGets the pick level number related to the Date picker element
Name | Type | Description | |
---|---|---|---|
format | IDateFormat | The date format |
number
A number of the pick level settingGet date range object from a string date value
Name | Type | Description | |
---|---|---|---|
value | String | string date value | |
dateGroupProperty | String | could be 'YEAR', 'QUARTER', 'MONTH' or 'DAY'. Deafult is 'DAY' | |
withTime | Boolean | determines if the date range will include time. Default is true |
// 1) Year:
getDateRange('2020', 'YEAR');
// Will return:
{
from: '01/01/2020 00:00:00',
to: '12/31/2020 23:59:59'
}
// 2) Quarter:
getDateRange('Q3 2020', 'QUARTER');
// Will return:
{
from: '07/01/2020 00:00:00',
to: '09/30/2020 23:59:59'
}
// 3) Month:
getDateRange('Oct 2020', 'MONTH');
// Will return:
{
from: '10/01/2020 00:00:00',
to: '10/31/2020 23:59:59'
}
Object
an object with the date range with two string date properties: from and toIt takes a Date object as an argument and returns a string in the format of MM/DD/YYYY
Name | Type | Description | |
---|---|---|---|
dt | Date | - Date - The date object to convert to a string |
Gets the default properties for Date Settings object
Name | Type | Description | |
---|---|---|---|
settings | IDateSettings | the configuration of dates |
IDateSettings
a new object with the date settings.A Date object, string or millisecond number are gotten in order to convert it in an formatted string date
Name | Type | Description | |
---|---|---|---|
date | IDate | String with a formatted date | |
format | IDateFormat | The date format | |
settings | IDateSettings | the configuration of dates |
IDate
a formmatted date or the same value if format does not matchGets the separator of the date format
Name | Type | Description | |
---|---|---|---|
format | IDateFormat | the date format |
string
a separator stringGets the timezone object by the given argument or the model object
Name | Type | Description | |
---|---|---|---|
timezone | IDTimezone | the timezone object | |
model | IModel IDataset | the info of the dataset (model) |
IDTimezone
a new timezone objectGets the offset of the timezone by the given objects
Name | Type | Description | |
---|---|---|---|
timezone | IDTimezone | The timezone object | |
model | IModel IDataset | The model info |
IDTimezoneOffset
the offset of the objectsGets the type of the timezone
Name | Type | Description | |
---|---|---|---|
timezone | IDTimezone | The timezone object | |
model | IModel IDataset | The model info | |
offset | IDTimezoneOffset | a default offset if the validation are not satisfied |
IDTimezoneType
the rigth type of the timezoneGets the type by a offset
Name | Type | Description | |
---|---|---|---|
offset | IDTimezoneOffset | a given offset |
IDTimezoneType
the right timezone type for the offsetGets the UTC string by the timezone object
Name | Type | Description | |
---|---|---|---|
timezone | IDTimezone | the timezone object |
string
the label of the UTC valueGets the timezone offset by the timezone type. For browser types, it is calculated by a Date instance Default types is UTC-0 Undefined or Fixed types is gotten by the offset property
Name | Type | Description | |
---|---|---|---|
type | IDTimezoneType | the timezone type | |
timezone | IDTimezone IBTimezone | the timezone object |
IDTimezoneOffset
the offset of the timezoneGets the week number of the year Additionally, the month and the year
Name | Type | Description | |
---|---|---|---|
date | Date | the date object |
IDateWeek
an object with the week, month and year or undefined if the date is not valid.Gets the UTC format dependeing on the given offset
Name | Type | Description | |
---|---|---|---|
timezone | IDTimezone | the timezone object | |
minified | boolean | Flag to reduce the Zeros |
string
an string with the UTC formatIf the date is a valid Date object, return true, otherwise return false.
Name | Type | Description | |
---|---|---|---|
date | Date | - The date object to check. |
boolean
True: The Date object is validValidate if offset uses a valid ISO 8601 offset specification
Name | Type | Description | |
---|---|---|---|
offset | IDTimezoneOffset | the timezone offset |
boolean
true if the given offset is validChecks if the given date is allowed to continue the process for adapting dates
Name | Type | Description | |
---|---|---|---|
date | IDate | String, object or millisencond number of the date |
Validates if the given date has tokens
Name | Type | Description | |
---|---|---|---|
date | IDate | String, object or millisencond number of the date |
boolean
true: the date has tokensValidates if the given date is a date instance
Name | Type | Description | |
---|---|---|---|
date | IDate | String, object or millisencond number of the date |
boolean
true: the date is a date instanceValidates if the given date is a string date
Name | Type | Description | |
---|---|---|---|
date | IDate | String, object or millisencond number of the date |
boolean
true: the date is a string dateValidates if the given param is a valid timezone offset
Name | Type | Description | |
---|---|---|---|
offset | IDTimezoneOffset | the timezone offset |
boolean
true: is valid timezone offset.Validates if the given offset is in the timezone range
Name | Type | Description | |
---|---|---|---|
offset | IDTimezoneOffset | the timezone offset |
boolean
true: the offset is in the timezone rangeValidate a string date depending on giving format
Name | Type | Description | |
---|---|---|---|
date | string | String of date | |
format | IDateFormat | String of the format to validate |
boolean
True if it is valid or not. Undefined if date is undefinedGenerates a Flattened UI filter structure from Filter Data structure.
Name | Type | Description | |
---|---|---|---|
filterData | The filter data object. | ||
datasetsInfo | Collection of datasets information |
Generates a Filter Builder Structure from the Filter Data structure v2.1
Name | Type | Description | |
---|---|---|---|
scopes | The filter scope section | ||
datasetsInfo | Collection of datasets information |
Generates a Filter Logic structure from Filter Data structure.
Name | Type | Description | |
---|---|---|---|
filterData | The filter data object. |
Gets the logic body
Name | Type | Description | |
---|---|---|---|
filterData | The filter data object |
Generates a UI filter structure from Filter Data structure.
Name | Type | Description | |
---|---|---|---|
filterData | The filter data object. | ||
datasetsInfo | Collection of datasets information |
Generates a UI filter Structure from the Filter Data structure v2.1
Name | Type | Description | |
---|---|---|---|
scopes | The filter scope section | ||
section | The filter section. | ||
version | The version of the filter structure | ||
datasetsInfo | Collection of datasets information |
Generates a Filter Data Structure structure from UI Filter Data structure.
Name | Type | Description | |
---|---|---|---|
filterData | The UI filter data object. |
Builds the Fitler Data structure from UI filter data
Name | Type | Description | |
---|---|---|---|
uFilterData | The UI filter Data object | ||
version | the version of the structure |
Generates a Flattened UI filter structure from UI Filter Data structure.
Name | Type | Description | |
---|---|---|---|
filterData | The UI filter data object. | ||
datasetsInfo | Collection of datasets information. Optional for updating the datasets info |
Generates a Flattened UI Filter Structure from the UI Filter Data structure v2.1
Name | Type | Description | |
---|---|---|---|
scopes | The filter scope section |
[TODO: For 2022, eliminate this adapter] Get the new property base on the old date grouping properties
Name | Type | Description | |
---|---|---|---|
property | the property to be adapted |
Checks and adapts the v2.0 Filter Data Structure to the v2.1
Name | Type | Description | |
---|---|---|---|
filterData | The filter data structure. Accepts both v2.1 or v2.0 | ||
getUIFilterData | Flag to get a Filter Data (False) or the UI Filter Data (True) | ||
datasetsInfo | Collection of datasets information. If getUIFilterData is true, the datasetsInfo should be mandatory |
[TODO: For 2022, eliminate this adapter] Gets an adapted filter value array. Validates the enabled property and sets
Name | Type | Description | |
---|---|---|---|
filter | The filter |
Generates a filter data structure from the flatttened UI filters.
Name | Type | Description | |
---|---|---|---|
uFilters | Array of flattened filters from UI | ||
version | Tag for the version of the filter data structure |
Gets an array of scopes structure for the filter data. The scopes is organized by scope types and scope IDs Also, adds and organizes filters by datasets
Name | Type | Description | |
---|---|---|---|
fbFilters | Array of flat filters from UI |
Gets an scope structure for the filter data
Name | Type | Description | |
---|---|---|---|
uFilter | UI structure filter |
Gets an dataset structure for the filter data
Name | Type | Description | |
---|---|---|---|
uFilter | a UI structure filter |
Gets an filter structure for the filter data
Name | Type | Description | |
---|---|---|---|
uFilter | a UI structure filter |
Generates a Logic structure from flattened UI filters
Name | Type | Description | |
---|---|---|---|
uFilter | Array of flat filters from UI |
Generates a Logic structure from flattened UI filters
Name | Type | Description | |
---|---|---|---|
uFilters | Array of flat filters from UI |
Generates a UI filter data structure from the flatttened UI filters.
Name | Type | Description | |
---|---|---|---|
uFilters | Array of flattened filters from UI | ||
version | Tag for the version of the filter data structure |
Gets an array of scopes structure for the UI filter data. The scopes is organized by scope types and scope IDs Also, adds and organizes filters by datasets
Name | Type | Description | |
---|---|---|---|
fbFilters | Array of flat filters from UI |
Gets an scope structure for the UI filter data
Name | Type | Description | |
---|---|---|---|
uFilter | UI structure filter |
Gets an dataset structure for the UI filter data
Name | Type | Description | |
---|---|---|---|
uFilter | a UI structure filter |
Gets an filter structure for the UI filter data
Name | Type | Description | |
---|---|---|---|
uFilter | a UI structure filter |
Generates a filter data structure from the old logic structure (v2.0).
Name | Type | Description | |
---|---|---|---|
filterData | The old filter data structure with logic (v2.0) | ||
version | Tag for the version of the filter data structure |
Adapts the Old logic structure (v2.0) to the flattened UI filter Structure.
Name | Type | Description | |
---|---|---|---|
logics | The old logic structure (v2.0) |
Get the filter or the index of the given array, validating an old filter structure.
Name | Type | Description | |
---|---|---|---|
filters | The array of UI filters | ||
filter | The old logic structure filter | ||
getIndex | Determines if the index or returns the UI filter object |
Refines the values of the Ranking column type.
Name | Type | Description | |
---|---|---|---|
values | the Array of Ranking values | ||
uiValues | Object with additional info about the values of the filter. |
Generates a UI filter structure from the old logic structure (v2.0).
Name | Type | Description | |
---|---|---|---|
uFilters | Array of filters from old logic structure | ||
datasetsInfo | Collection of datasets information |
Adapter for model answer to convert to recognizable values for Filter Builder
Name | Type | Description | |
---|---|---|---|
answers | Array of the qrvey model answers |
Resolves statement and returns statement value
AbsoluteRange
string
Resolves statement as an anchor
string
Convert verbal statement to range value
AbsoluteRange
Apply 'this' cursor logic to statement
AbsoluteStatement
Apply 'the last' cursor logic to statement
AbsoluteStatement
Apply 'the next' cursor logic to statement
AbsoluteStatement
Replace '@now' token inside a string
Name | Type | Description | |
---|---|---|---|
value | string | ||
now | Date |
string
Returns a range object (date) from a group of statement params
Name | Type | Description | |
---|---|---|---|
args | RelativeToAbsoluteStruct |
pivot = '2021-03-03T12:30:40'
unit = month
steps = 2
setTo = END
resolverAsCalendar: true
=> Returns '2021-05-31T23:59:59'
pivot = '2021-03-03T12:30:40'
unit = month
steps = -2
setTo = START
resolverAsCalendar: false
=> Returns '2021-01-03T00:00:00'
string
Resolve a list of relative statements according to operator
Name | Type | Description | |
---|---|---|---|
statements | - Raw statements/values | ||
clock | - Clock/time reference for relative date resolution |
Input:
{
"cursor": "the_next",
"unit": "year",
"number": 1,
"includeCurrent": false,
"isCalendarDate": false,
"anchor": "03/05/2021"
}
Output:
{ gte: "03/06/2021 00:00:00", lte: "03/05/2022 23:59:59" }
Name | Type | Description | |
---|---|---|---|
logics | |||
summaries |
Filters and gets the filters used for aggregate values.
Name | Type | Description | |
---|---|---|---|
logics | The filter logic structure | ||
formatToFilters | Flag to change de way of returning the filter structure. |
[TODO: Make a proper description for this function]
Name | Type | Description | |
---|---|---|---|
chartSettings | Chart Settings for the Filter Builder | ||
scopes | the pair id/label scopes | ||
currentScope | the scope to be validated |
It takes an array of tokens and returns a string
Name | Type | Description | |
---|---|---|---|
tokens | Array.<IFFilterTokens> | - IFFilterTokens[] - the tokens to convert to a string |
Name | Type | Description | |
---|---|---|---|
filterData | |||
_summaries |
Gets the Scopes IDS for the Available Scope function by any config
Name | Type | Description | |
---|---|---|---|
config | any config |
[TODO: Make a description for this]
Name | Type | Description | |
---|---|---|---|
scopes | the collection of Scopes/Scope IDs | ||
currentScope | Current scope type |
It takes a filter object and returns an array of tokens that represent the filter
Name | Type | Description | |
---|---|---|---|
filters | IFUData | - The filters object. | |
options | IFTokensFromFiltersSettings | - IFTokensFromFiltersSettings |
Array.<IFFilterTokens>
An array of tokens that represents the filters objectIt takes a set of filters and returns a string that describes the filters
Name | Type | Description | |
---|---|---|---|
filters | IFUData | - The filters object that you want to convert to a string. | |
options | IFTokensFromFiltersSettings | - IFTokensFromFiltersSettings |
Gets Scopes/Scope IDs by given IDs
Name | Type | Description | |
---|---|---|---|
config | given Differnts IDs in order set a available scope |
[TODO: The decimals dots are not working correctly, we need to reviewing (fractionDigits)] "Convert a number of seconds to a human readable string."
addDurationFormat
is a function that takes a number, a format, an optional locale, and an optional
number of fraction digits, and returns a string
Name | Type | Description | |
---|---|---|---|
number | number | - The number of milliseconds to format. | |
format | string | - The format string. | |
locale | string | - The locale to use for formatting. If not specified, the default locale is used. | Optional |
fractionDigits | number | - The number of digits to show after the decimal point. | Optional |
It sets the locale formatter for the number.
Void
It returns a new instance of the Intl.NumberFormat class, which is a built-in JavaScript class that formats numbers
Name | Type | Description | |
---|---|---|---|
locale | string Array.<string> | - string | string[] |
It takes a template string and sets the parts property to the result of calling the parseFormatTemplate function with the template string as an argument
Name | Type | Description | |
---|---|---|---|
template | string | - The format template string. |
Void
It replaces the H and D characters in the template with h and d respectively
Name | Type | Description | |
---|---|---|---|
template | string | - The template string to be used for the date format. |
It sets the numberFactor to the value of the duration part that matches the unit.
Void
It takes a string, splits it into an array of strings, then maps each string to a config object, then filters out any falsy values, then reverses the array
Name | Type | Description | |
---|---|---|---|
template | string | - string - the template string that we want to parse |
It takes a number, multiplies it by a factor, then uses the parts array to calculate the number of each part in the number, then uses the template to format the number
Name | Type | Description | |
---|---|---|---|
number | number | - The number of milliseconds to format. |
It takes a dictionary of values and a list of keys, and returns a formatted string
Name | Type | Description | |
---|---|---|---|
parts | - { [x: string]: any; } | ||
part | string `Array.<string | number>` | - This is the part of the date that we're formatting. |
This class allows to use the translation service of the i18next library
Void
Determines if the given column is belonging to static values questions. Static values questions are questions that do not need request an info from backend, instead the info is got from Model, Question/List object.
Name | Type | Description | |
---|---|---|---|
column | The question column |
Special function for Expression Columns. This function allows validating if expression columns have active category option. This is esential in order to display the asigned property for expression.
Name | Type | Description | |
---|---|---|---|
column | The column with info | ||
dataset | the dataset object to search the column |
Get answers located in model object. If column exists in the model, answers will be gotten depending on column type. For Rating columns, needs a number sequence (From 1 to 5). For Expression columns, needs a property type attribute for categorizable ones; for non-categorizable expressions is not required this attribute. For the others columns, answers is located in the property of the same name.
Name | Type | Description | |
---|---|---|---|
column | Info of the column | ||
model | The model object | ||
property | Optional Attribute, especially for expression columns. |
Gets a dataset by a given partial column
Name | Type | Description | |
---|---|---|---|
column | the partial column | ||
datasets | the collection of dataset to look for one. |
Get the answers of expression columns. Depends of the property attribute and if the column is categorizable.
Name | Type | Description | |
---|---|---|---|
column | The column located inside the model object. | ||
property | Optional Attribute, especially for expression columns. |
Get the answers of dropdown columns. Answers is a direct array of strings so it is necessary to format them.
Name | Type | Description | |
---|---|---|---|
question | The column located inside the model object. |
Get the answers of image columns.
Name | Type | Description | |
---|---|---|---|
column | The column located inside the model object. |
Special function for Image Upload This function returns if the current column has object or text analysis as property.
Name | Type | Description | |
---|---|---|---|
column | The column with info | ||
model | The model object |
Get the answers of rating columns.
Name | Type | Description | |
---|---|---|---|
_question | The column located inside the model object. |
Get the answers of slidebar columns. The quantity of answers depend on the steps chosen in maker.
Name | Type | Description | |
---|---|---|---|
_question | The column located inside the model object. |
Gets a string of the translate structure by the given column
Name | Type | Description | |
---|---|---|---|
column | the Info of the column |
Get a string value with suffixes if available. Add suffix into the value string. Prioritized for numeric values.
Name | Type | Description | |
---|---|---|---|
value | a number or string | ||
suffixes | An object with singular or plural suffix string. |
Get the answers of Yes/No columns. Yes/No answers from model object are capitalized but the filters need values in lowercase.
Name | Type | Description | |
---|---|---|---|
column | The column located inside the model object. |
Transforms a value depending of localization/globalization and extras settings.
Name | Type | Description | |
---|---|---|---|
value | A value to transform | ||
settings | The settings of the transformValue function |
Gets the default settings properties
Name | Type | Description | |
---|---|---|---|
settings | ITransformValueSettings | the given settings |
ITransformValueSettings
the settings with default propertiesGets the outputformat settings
Name | Type | Description | |
---|---|---|---|
settings | The settings of the transformValue function |
Gets the format config if the locale exists in i18n settings
Name | Type | Description | |
---|---|---|---|
settings | The settings of the transformValue function |
If the property is a day, return the date format without the time, otherwise return the original format.
Name | Type | Description | |
---|---|---|---|
settings | ITransformValueSettings | - ITransformValueSettings |
Get the format related to the columnn property. If the property is hour, minute, second, or undefined, return true.
Name | Type | Description | |
---|---|---|---|
property | IColumnPropertyType | - The property of the date to group by. |
boolean
A boolean value.Compares two objects to know if they are equals. Go across nested objects. Includes arrays in the comparison.
Name | Type | Description | |
---|---|---|---|
object1 | First Object to compare | ||
object2 | Second Object to compare |
Gets the toStringTag
of value
.
Name | Type | Description | |
---|---|---|---|
value | The value to query. |
string
Returns the toStringTag
.Import a set of external Scripts given the URL in both serie and cascade way
Name | Type | Description | |
---|---|---|---|
scripts | Array.<String> Array.<Object> | can be an array of string or an array of object with the follow structure: | |
scripts.url | String | CDN URL | |
scripts.namespace | String Function | (Optional) if is a String, that name is evaluated on Window[namespace] object otherwise the Function is invoked expecting a Thrutly value | |
scripts.type | String | (Optional) it could be module of text/javascript . Default text/javascript | |
scripts.noModule | Boolean | (Optional) add momodule attribute to script tag. Default false | |
scripts.dependencies | Array.<Object> | an array with the same structure to load in cascade mode |
// 1) Simple script (paralell loading)
importScripts(['http://myscript.js', 'http://another.js']);
// 2) Loading `.js` and `.esm.js` script (parallel loading)
importScripts([
{ url: 'http://myscript.esm.js', type: 'module' },
{ url: 'http://myscript.js', noModule: true }
]);
// 3) import dependent scripts (cascade)
importScripts([
{ url: 'http://myscript.js', dependencies: ['http://myscript.plugin.js'] }
]);
// 4) mix
importScripts([
{ url: 'http://myscript.js', dependencies: ['http://myscript.plugin.js'] },
{ url: 'http://another.esm.js', type: 'module' },
{ url: 'http://another.js', noModule: true },
'http://simplescript.js'
]);
Promise
Promise when all script have been loadedCreates the script element and appends to document.head return a Promise that is resolved when the script is loaded
Name | Type | Description | |
---|---|---|---|
url | String | Cdn Url | |
type | String | (Optional) it could be module of text/javascript . Default text/javascript | |
noModule | boolean | (Optional) add momodule attribute to script tag. Default false |
Void
Validates if the given argument is empty
Name | Type | Description | |
---|---|---|---|
variable | the given variable | ||
includeFalsy | flag to determine include the falsy variables into the validation |
Validates if the recieved number is NaN type.
Conditions:
Special case for isNaN
Name | Type | Description | |
---|---|---|---|
variable | the variable to validate |
return if a given variable is either null
or undefined
useful to avoid falsify validating Number Zero (0)
Name | Type | Description | |
---|---|---|---|
arg | any |
Boolean
Creates a random string
Name | Type | Description | |
---|---|---|---|
length | Number | size of the generated string. Default 8 | |
exclude | Array | collection of strings that is going to be excluded of the random string. |
String
Random stringGets the length of the given array.
null
or undefined
or else argument the returned value will be 0.Name | Type | Description | |
---|---|---|---|
obj | Any | Any object-type variable |
Number
the size of the given variableGets the numeric sign of a given number
Name | Type | Description | |
---|---|---|---|
num | number | the number |
string
an string with the signUpper case the first letter of a given text
Name | Type | Description | |
---|---|---|---|
text | String |
String
a capitalized textSets an amount of zeros as prefix of the given number by its length
Name | Type | Description | |
---|---|---|---|
num | number string | the number | |
size | number | the quantity of zeros to add | |
padding | number | True: to pad with missing zeros; depending on the num length. False: to fill zeros by the amount. |
num = 100
size = 2
padding = true
=> Returns "100"
num = 100
size = 5
padding = true
=> Returns "00100"
num = 100
size = 2
padding = false
=> Returns "00100"
num = 100
size = 5
padding = false
=> Returns "00000100"
Gets the absolute number of the giving parameters
Name | Type | Description | |
---|---|---|---|
num | number string | the number | |
sign | string | the sign of the number |
string
the absolute numberGets the number sign
Name | Type | Description | |
---|---|---|---|
num | number string | the number |
string
the number signIt takes an array of objects, adds a property to each object, and returns the new array.
Name | Type | Description | |
---|---|---|---|
info | Object | - Information needed to add property to the array of objects. | |
info.array | Array | - The array of objects you want to add a property to. | |
info.property | string | - The property you want to add to the object. | |
info.value | any | - - The value to be added to the array of objects. ---------------------------------------------------------------------------------------------- |
<caption>Example usage of addPropertyToArrayOfObjects.</caption> addPropertyToArrayOfObjects({
array: [{ name: "John", lastName: "Doe" }, { name: "Chris", lastName: "Musk" }],
property: "lastName",
value: 'Peck'
});
Inmutable Array Item deletion
Name | Type | Description | |
---|---|---|---|
array | Array | a collection of items to delete | |
index | Number | the position of the item to delete |
Filters a nested tree array by a custom condition on the last child node
Name | Type | Description | |
---|---|---|---|
arr | nested tree array | ||
childArrKey | property representing the children array on the nested tree | ||
condition | function callback that determines if the filter is applied on the last child node of the nested tree |
Flat deeply an array
Name | Type | Description | |
---|---|---|---|
arr | Array to flat deeply |
Gets a collection of object values by the given property
Name | Type | Description | |
---|---|---|---|
arr | An array | ||
property | the property to get the value collection |
Gets the first index from the array by a callback condition
Name | Type | Description | |
---|---|---|---|
array | |||
callback | function callback |
Gets the last index from the array by a callback condition
Name | Type | Description | |
---|---|---|---|
array | |||
callback | function callback |
Remove duplicated items from a given array by property name // 1. Store the keys of the unique objects // 2. Eliminate the dead keys & store unique objects
Name | Type | Description | |
---|---|---|---|
arr | The array | ||
prop | Property name to search duplicated values |
Transforms the date+times propertiesof the given object by the Timezone object
Name | Type | Description | |
---|---|---|---|
obj | any | the object | |
timezone | IDTimezone | the timezone object |
IFSData
IFUData
the new filter data with the transformed datetime valuesA simple Deep Cloning function. Valid only for primivite values and object with primitive values. Not to use this function with inner objects and functions
Name | Type | Description | |
---|---|---|---|
obj | The object |
Like lodash _.get. Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
Empty arrays and empty objects are returned but the defaultValue is not Undefined and null values will return the defaultValue.
Name | Type | Description | |
---|---|---|---|
baseObject | The object to query | ||
path | The string path or collection of string paths of the property to get. | ||
defaultValue | The value returned for undefined resolved values. |
// returns 'Hello'
_get({ item1: 'Hello', item2: 'World' }, 'item1')
// returns 'A simple Hello'
_get({ item1: 'Hello', item2: 'World' }, 'item3', 'A simple Hello')
// returns 'Hello Again'
_get({ item1: { item11: 'Hello Again' }, item2: {} }, 'item1.item11')
// returns 'Hello 2'
_get({ item1: ['Hello 1', 'Hello 2' }, item2: [] }, 'item1[1]')
// returns 'Hello Again'
_get({ item1: { item11: 'Hello Again' }, item2: {} }, ['item1', 'item11'])
Searchs for properties in different case styles such as: lower, upper, camel and pascal
Name | Type | Description | |
---|---|---|---|
obj | object | object to look for | |
key | string | String attribute in snake_case style |
getAttribute(obj, 'snake_case') //it search for: obj.snake_case || obj.snakeCase || obj.SnakeCase || obj.snakecase || obj.SNAKECASE
Void
Use the hasOwnProperty in order to verify if the given property exists in the object.
Name | Type | Description | |
---|---|---|---|
obj | object | an object | |
property | string | String to verify if exists in the object as property |
const prop = 'prop2'
const obj1 = { prop1: 'hello', prop2: 'world'}
_hasProperty(ob1, prop1) // true
const obj2 = { prop1: 'hello world' }
_hasProperty(ob1, prop2) // false
Checks if the given argument is an object type
Name | Type | Description | |
---|---|---|---|
obj | the variable to check |
Invoke iteratee (function) for each object key-value pair and return a mapped object
Name | Type | Description | |
---|---|---|---|
baseObject | Object | Base object. | |
iteratee | Function | The executed per iteration. |
Object
New mapped object.Merges two objects into a new one. The second given argument to the first given argument.
Name | Type | Description | |
---|---|---|---|
obj1 | The target object | ||
obj2 | The object to be merged | ||
settings | Object settings for this function |
Validates if the two arguments are objects
Name | Type | Description | |
---|---|---|---|
obj1 | The target object | ||
obj2 | The object to be merged |
Validates and gets the settings with all set parameters.
Name | Type | Description | |
---|---|---|---|
settings | the settings object |
Created a new reference of the given argument
Name | Type | Description | |
---|---|---|---|
entity | The variable to be copied | ||
cache |
return a new Object excluding attributes in props list
Name | Type | Description | |
---|---|---|---|
obj | Object | base object | |
props | Array.<String> | list of attribute to exclude |
Object
clean objectRemoves and returns the given object cleaning the undefined values
Name | Type | Description | |
---|---|---|---|
obj | an object |
return a new object just with attributes in keys list
Name | Type | Description | |
---|---|---|---|
baseObject | Object | base object | |
keys | Array.<String> | list of attributes to preserve |
Object
new object just with desired attributesserialize object to url param
Name | Type | Description | |
---|---|---|---|
obj | - Object to be serialized |
Void
Adapts the branches map from backend to the UI branches map
Name | Type | Description | |
---|---|---|---|
branchesMap | the backend branches map |
Transforms the backenc timezone structure to UI timezone structure
Name | Type | Description | |
---|---|---|---|
timezone | IBTimezone | the backend timezone object |
IDTimezone
the UI timezone objectGet a dataset list from a collection of Qrvey IDs Considerations for qrveyids second argument:
Name | Type | Description | |
---|---|---|---|
config | the widget config. Includes general configuration properties | ||
qrveyids | Collection of Qrvey IDs for returning a set of available datasets |
Request function for getting Qrveys such as Web Forms and Datasets. Use params for getting precise data
Name | Type | Description | |
---|---|---|---|
config | Configuration | ||
params | Object for getting precise data |
Void
Get a dataset by Qrvey ID
Name | Type | Description | |
---|---|---|---|
qrveyid | The Qrvey ID |
Get a dataset by Qrvey ID
Name | Type | Description | |
---|---|---|---|
qrveyid | The Qrvey ID |
Delays invoking fn until after time milliseconds have elapsed since the last time the debounced function was invoked.
Name | Type | Description | |
---|---|---|---|
fn | Function | original Function | |
time | Number | default 500ms |
Function
debounced functionsMake sure to only invokes fn at most once per every time milliseconds
Name | Type | Description | |
---|---|---|---|
fn | Function | original Function | |
time | Number | default 500ms |
Function
throttled functionCalculates the HSP Color Mode from the RGBA channels
Name | Type | Description | |
---|---|---|---|
rgbaChannel | the rgba channel object |
Gets CSS variables depending on the destination of them.
Name | Type | Description | |
---|---|---|---|
destination | the string of the destination. |
Gets the RGBA channels based on the given string Hexadecimal color
Name | Type | Description | |
---|---|---|---|
color | the Hexadecimal color |
Gets the RGBA channels based on the given string name color
Name | Type | Description | |
---|---|---|---|
color | the name color |
Gets the RGBA channels based on the given string RGBA color
Name | Type | Description | |
---|---|---|---|
color | the RGBA color |
Gets the Alpha channel (opacity) base on the hexadecimal color
Name | Type | Description | |
---|---|---|---|
hexadecimal | hexadecimal color |
Gets the Alpha channel (opacity) base on the RGBA color
Name | Type | Description | |
---|---|---|---|
hexadecimal | RGBA color |
Determines if the Color is dark or light. Uses the lightOrDark module.
Name | Type | Description | |
---|---|---|---|
color | the string of the color (RGBA, or Hexadecimal) |
Validates if the given color is an hexadecimal structure
Name | Type | Description | |
---|---|---|---|
color | the string of the color |
Validates if the given color is an RGBA structure
Name | Type | Description | |
---|---|---|---|
color | the string of the color |
Validates if the given color is light or dark The module extracts the rgba channels and calculate the brightness or darkness by a threshold
Name | Type | Description | |
---|---|---|---|
color | the string of the color. |
Sets CSS Variables into a given wrapper collection. For the Dark Theme feature.
Name | Type | Description | |
---|---|---|---|
colorType | the color type | ||
wrapperTags | the html elements to set the CSS variables |
Void
Sets CSS Variables into a given wrapper collection. For the Dark Theme feature.
Name | Type | Description | |
---|---|---|---|
colorType | the color type | ||
wrapper | the html element to set the CSS variables | ||
cssVariables | the CSS variables name to apply the style property |
Void
(Method Decorator) Debounce Class Method
Name | Type | Description | |
---|---|---|---|
time | (optional) deafult 500 |
Void
(Method Decorator) Throttled Class Method
Name | Type | Description | |
---|---|---|---|
time | (optional) deafult 500 |
Void
Stencil.js - Prop Decorator
Get and Parse the Widget Configuration Object and also provide the ability to get properties in different case styles such as: lower, upper, camel and pascal
But for this, is required ask for a property in snake_case
style
\ @Config() @Prop() settings;
someMethod() {
this.settings.snake_case //it search for: obj.snake_case || obj.snakeCase || obj.SnakeCase || obj.snakecase || obj.SNAKECASE
}
Void
lit implementation of React createRef (https://reactjs.org/docs/refs-and-the-dom.html)
verify the Config object type and try to return a parsed Object
Name | Type | Description | |
---|---|---|---|
cfg |
Void
Validates if both filters are the same
Name | Type | Description | |
---|---|---|---|
filter1 | filter 1 | ||
filter2 | filter 2 |
Excludes Aggregate Filters in the Filter Data. Excluding filters when the column.aggregate is included.
Name | Type | Description | |
---|---|---|---|
filterData | The filter data object |
Excludes filters from the given Filters. The validation to filter the stored filter is depending on:
Name | Type | Description | |
---|---|---|---|
filterData | The Filter Data or the UI Filter Data | ||
params | given parameters to validate the filter data |
Excludes and returns a filter data without filters by the given scopes
Name | Type | Description | |
---|---|---|---|
filterData | The Filter Data | ||
scopes | collection of scopes to be as filtering parameters |
Get an string of the properties of the given filter column.
Name | Type | Description | |
---|---|---|---|
column | The filter column |
Gets the Filter Label + Column label
Name | Type | Description | |
---|---|---|---|
filter | the UI filter |
Get the Filter ID by the filter structure The order of the epression ID is:
Name | Type | Description | |
---|---|---|---|
filter | the filter structure |
Gets Aggregate Filters in the Filter Data. Gets the filters when the column.aggregate is included.
Name | Type | Description | |
---|---|---|---|
filterData | The filter data object |
Filtering the filters by the columns of datasets. Module specially for CLS.
Name | Type | Description | |
---|---|---|---|
data | the filter data | ||
datasets | the collection of datasets and their columns |
Gets filters from the given params. The validation to filter the stored filter is depending on:
Name | Type | Description | |
---|---|---|---|
filterData | The Filter Data or the UI Filter Data | ||
params | given parameters to validate the dataset |
Filters and gets a Filter Data by the given scopes
Name | Type | Description | |
---|---|---|---|
filterData | The Filter Data | ||
scopes | collection of scopes types |
Gets and transforms the Filter Data by the Timezone object
Name | Type | Description | |
---|---|---|---|
filterData | IFSData IFUData | the filter data | |
timezone | IDTimezone | the timezone object |
IFSData
IFUData
the new filter data with the transformed datetime valuesGet a new Filter Data by filtering scopes/scope IDs and enabled flags
Name | Type | Description | |
---|---|---|---|
filterData | a Filter Data or UI Filter Data | ||
scopes | a Scopes/Scope IDs array |
Gets filters from Filter Data by Scopes/Scope IDs.
Name | Type | Description | |
---|---|---|---|
filterData | The filter data | ||
scopes | The collection of Scopes/Scope IDs |
Transforms the given MergeFilters settings object. Adds the missing properties if they do not exist.
Name | Type | Description | |
---|---|---|---|
settings | an object to the MergeFilters settings |
Transforms the given ParamsToGetFilter settings object. Adds the missing properties if they do not exist.
Name | Type | Description | |
---|---|---|---|
settings | an object to the ParamsToGetFilter settings |
Transforms the given MergeFilters settings object. Adds the missing properties if they do not exist.
Name | Type | Description | |
---|---|---|---|
settings | an object to the MergeFilters settings |
Gets the values from the model object that will be used to filter. Static values are values to belong from static values questions. Static values questions are questions that do not need request an info from backend, instead the info is got from Model object.
Name | Type | Description | |
---|---|---|---|
props | Configuration to get static values from the given dataset. |
Gets the values from the model object that will be used to filter. Static values are values to belong from static values questions. Static values questions are questions that do not need request an info from backend, instead the info is got from Model object.
Name | Type | Description | |
---|---|---|---|
props | Configuration to get static values from the given model. |
Gets an string that describes the filter datasets content
Name | Type | Description | |
---|---|---|---|
filters | Array.<IFUDataset> | The filter datasets to verbose | |
settings | IFFGetVerboseFilters | the settings to the function |
Gets the datasets by some conditions
Name | Type | Description | |
---|---|---|---|
filters | Array.<IFUDataset> | The filtered datasets to verbose | |
settings | IFFGetVerboseFilters | the settings to the function |
Array.<IFUDataset>
the collection of the datasetsGets the title of the filter dataset
Name | Type | Description | |
---|---|---|---|
dataset | IFUDataset | the filter dataset object | |
settings | IFFGetVerboseFilters | the settings to the function |
string
the title of the filter datasetGets the separators for the title. It would be
Name | Type | Description | |
---|---|---|---|
settings | IFFGetVerboseFilters | the settings of the module |
string
the string of the separatorGets the separators of each filter. It would be
Name | Type | Description | |
---|---|---|---|
settings | IFFGetVerboseFilters | the settings of the module |
string
the string of the separatorGets an string that describes the filter filters content
Name | Type | Description | |
---|---|---|---|
filters | Array.<IFUFilter> | The filter filters to verbose | |
settings | IFFGetVerboseFilters | the settings to the function |
Gets the filters by some conditions
Name | Type | Description | |
---|---|---|---|
filters | Array.<IFUFilter> | The filtered filters to verbose | |
settings | IFFGetVerboseFilters | the settings to the function |
Array.<IFUFilter>
the collection of the filtersGets the title of the filter
Name | Type | Description | |
---|---|---|---|
filter | IFUFilter | the filter object | |
settings | IFFGetVerboseFilters | the settings to the function |
string
the title of the filterGets the separators of each filter. It would be
Name | Type | Description | |
---|---|---|---|
currentIndex | number | the iteration index of the value | |
filter | IFUFilter | the filter object | |
settings | IFFGetVerboseFilters | the settings of the module |
string
the string of the separatorGets the separators for the title. It would be
Name | Type | Description | |
---|---|---|---|
settings | IFFGetVerboseFilters | the settings of the module |
string
the string of the separatorGets an string that describes the filter values content
Name | Type | Description | |
---|---|---|---|
filters | Array.<IFValue> | The filter values to verbose | |
settings | IFFGetVerboseFilters | the settings to the function |
Gets the value collection of the filter by some conditions
Name | Type | Description | |
---|---|---|---|
filter | IFValue | The filter to get the values | |
settings | IFFGetVerboseFilters | the settings to the function |
Array.<string>
the collection of the filter valuesGets the separators of each values. It would be
Name | Type | Description | |
---|---|---|---|
currentIndex | number | the iteration index of the value | |
values | Array.<IFUValue> | the collection of values | |
settings | IFFGetVerboseFilters | the settings of the module |
string
the string of the separatorGets the value according to the filter info
Name | Type | Description | |
---|---|---|---|
filter | IFUFilter | the filter object | |
value | IFUValue | the value item |
string
the resulting valueGets an string that describes the filter data content
Name | Type | Description | |
---|---|---|---|
filters | IFUData | The filters object to verbose | |
settings | IFFGetVerboseFilters | the settings for the function |
Gets the dataset settings by the given settings
Name | Type | Description | |
---|---|---|---|
settings | IFFGetVerboseFilters | the settings for the function |
Gets the filter settings by the given settings
Name | Type | Description | |
---|---|---|---|
settings | IFFGetVerboseFilters | the settings for the function |
Gets the scope settings by the given settings
Name | Type | Description | |
---|---|---|---|
settings | IFFGetVerboseFilters | the settings for the function |
Gets the value settings by the given settings
Name | Type | Description | |
---|---|---|---|
settings | IFFGetVerboseFilters | the settings for the function |
Validates if the filter data has filters by a dataset ID (Qrvey ID).
Name | Type | Description | |
---|---|---|---|
filterData | the filter data or the UI filter data. | ||
qrveyid | The Qrvey ID |
Validates if the given validator is a Between type
Name | Type | Description | |
---|---|---|---|
validator | The validator |
Gets an string that describes the filter scopes content
Name | Type | Description | |
---|---|---|---|
filters | Array.<IFUScope> | The filters scopes to verbose | |
settings | IFFGetVerboseFilters | the settings to the function |
Gets the scopes by some conditions
Name | Type | Description | |
---|---|---|---|
filters | Array.<IFUScope> | The filtered scopes to verbose | |
settings | IFFGetVerboseFilters | the settings to the function |
Array.<IFUScope>
the collection of the scopesGets the title of the filter scope
Name | Type | Description | |
---|---|---|---|
scope | IFUScope | the filter scope info | |
settings | IFFGetVerboseFilters | the settings of the function |
string
the title of the filter scopeGets the separators for the title. It would be
Name | Type | Description | |
---|---|---|---|
settings | IFFGetVerboseFilters | the settings of the module |
string
the string of the title separatorGets the separators of each filter. It would be
Name | Type | Description | |
---|---|---|---|
settings | IFFGetVerboseFilters | the settings of the module |
string
the string of the separatorDetermines if the filter column and property is a distinct group dates type
Name | Type | Description | |
---|---|---|---|
column | The filter column | ||
property | The filter property |
Validates if the given validator is a In type
Name | Type | Description | |
---|---|---|---|
validator | The validator |
Validates if the given validator is a Range type. Range type means the value has min and max values to filter
Name | Type | Description | |
---|---|---|---|
validator | The filter validator |
Validates if the given filter is considering a ranking filter type.
Name | Type | Description | |
---|---|---|---|
filter | The filter object |
Checks if the given validator is a Null type.
Name | Type | Description | |
---|---|---|---|
validator | The Filter Validator |
Validates if the given validator is a regular type. Regular type means the filter object has a value as string to filter
Name | Type | Description | |
---|---|---|---|
validator | The filter validator |
Gets a new value structure array by merging two value structures
Name | Type | Description | |
---|---|---|---|
filter1 | the target filter structure | ||
filter2 | the filter to be used to merge the values | ||
settings | configuration of the mergeFilter |
Merges the second filter data into the first one; the first Filter Data passed in the argument has the priority. Conditions:
Name | Type | Description | |
---|---|---|---|
filterData1 | IFUData | The target filter data | |
filterData2 | IFUData | the filter data to be merged | |
settings | IFFiltersMergeFilters | configuration of the mergeFilters |
IFUData
a new filter data structureGets a new scope array structure by merging both scope structures
Name | Type | Description | |
---|---|---|---|
scopes1 | Array.<IFUScope> | the target scope structure | |
scopes2 | Array.<IFUScope> | the scope to be merged | |
settings | IFFiltersMergeFilters | configuration of the mergeFilters |
Array.<IFUScope>
a new scope array structureGets a new dataset structure array by merging both dataset structures
Name | Type | Description | |
---|---|---|---|
datasets1 | Array.<IFUDataset> | the target dataset structure | |
datasets2 | Array.<IFUDataset> | the dataset to be merged | |
settings | IFFiltersMergeFilters | configuration of the mergeFilter |
Array.<IFUDataset>
a new dataset structure arrayGets a new filter structure array by merging two filter structures
Name | Type | Description | |
---|---|---|---|
filters1 | Array.<IFUFilter> | the target filter structure | |
filters2 | Array.<IFUFilter> | the filter to be merged | |
settings | IFFiltersMergeFilters | configuration of the mergeFilters |
Array.<IFUFilter>
a new filter structure arrayGets a new scope structure for the configured settings
Name | Type | Description | |
---|---|---|---|
scope1 | IFUScope | the target scope structure | |
scope2 | IFUScope | the scope to be used to merge the values | |
settings | IFFiltersMergeFilters | configuration of the mergeFilters |
IFUScope
a new filter structure with overwritted propsGets a new dataset structure for the configured settings
Name | Type | Description | |
---|---|---|---|
dataset1 | IFUDataset | the target dataset structure | |
dataset2 | IFUDataset | the dataset to be used to merge the values | |
settings | IFFiltersMergeFilters | configuration of the mergeFilters |
IFUDataset
a new filter structure with overwritted propsGets a new filter structure for the configured settings
Name | Type | Description | |
---|---|---|---|
filter1 | IFUFilter | the target filter structure | |
filter2 | IFUFilter | the filter to be used to merge the values | |
settings | IFFiltersMergeFilters | configuration of the mergeFilters |
Resolves the conditions by given params
Name | Type | Description | |
---|---|---|---|
filter | The dataset structure | ||
params | given parameters to validate the dataset | ||
letPassUndefinedProperties | Flag to avoid applying the condition when the filter properties are undefined | ||
letPassUndefinedParams | Flag to avoid applying the condition when the param properties are explicit undefined. |
Resolves the conditions by given params
Name | Type | Description | |
---|---|---|---|
filter | The filter | ||
params | given parameters to validate the filter | ||
letPassUndefinedProperties | Flag to avoid applying the condition when the filter properties are undefined | ||
letPassUndefinedParams | Flag to avoid applying the condition when the param properties are explicit undefined. |
Resolves the conditions by given params
Name | Type | Description | |
---|---|---|---|
filter | The filter scope structure | ||
params | given parameters to validate the filter | ||
letPassUndefinedProperties | Flag to avoid applying the condition when the properties of the properties are undefined | ||
letPassUndefinedParams | Flag to avoid applying the condition when the properties of the params are explicit undefined. |
Build a proper relative date statement type
Name | Type | Description | |
---|---|---|---|
statement | RelativeStatement |
RelativeStatement
Returns a number/constant that identifies a relative date case
Name | Type | Description | |
---|---|---|---|
includeCurrent | boolean | ||
isCalendarDate | boolean |
number
Parses a string date and returns a dayjs date
Name | Type | Description | |
---|---|---|---|
date | string Dayjs Date |
Dayjs
A dayjs dateReturns a filter builder config object by a any given config
Name | Type | Description | |
---|---|---|---|
config | any config object |
Builds filter expression by the filter data.
Name | Type | Description | |
---|---|---|---|
filter | The filter to transform |
Transform user Filters array into Filter Logic structure
Name | Type | Description | |
---|---|---|---|
userFilters | The filters that the user defined. |
Name | Type | Description | |
---|---|---|---|
aggFilters | The aggFilter Structure | ||
summaryIndex | an index |
Gets a group value for the backend logic structure
Name | Type | Description | |
---|---|---|---|
filter | The filter |
Gets a property for the logic structure
Name | Type | Description | |
---|---|---|---|
filter | The filter |
Gets the Validator that is used in requests
Name | Type | Description | |
---|---|---|---|
validator | Filter Validator used in UI |
Gets the expresion values in the logic format
Name | Type | Description | |
---|---|---|---|
filter | The filter structure |
Gets the expression values. Depending on the column type
Name | Type | Description | |
---|---|---|---|
values | a collection of filter values | ||
filter | The filter structure |
Gets the Ranking values.
Name | Type | Description | |
---|---|---|---|
values | a collection of filter values in the ranking structure | ||
rankingGroupIndex | determine the value by this index to build and return it |
[TODO: Add filterEmptyArrays to the filterNestedTree filter condition. Firstly, that function should accept this argument] Filters the logic by a qrveyids array If an qrveyid is not provided in the expression the filter passes normally
Name | Type | Description | |
---|---|---|---|
logic | The logic of the filter | ||
datasets | The collection of qrveyids |
Name | Type | Description | |
---|---|---|---|
logic | Array.<IFBLogic> | The logic of the filters | |
datasets | Array.<IDataset> | The collection of datasets |
Runs the function for the callback
Name | Type | Description | |
---|---|---|---|
settings | IFFGetLogicByDatasetsColumns | the settings for the helper | |
datasets | Array.<IDataset> | The dataset collection |
Gets the letQrveyidPass flag
Name | Type | Description | |
---|---|---|---|
expression | IFBExpression | the logic expression of the filter | |
settings | IFFGetLogicByDatasetsColumns | the settings for the helper |
boolean
true: the qrveyid will be passedGets the letQuestionidPass flag
Name | Type | Description | |
---|---|---|---|
expression | IFBExpression | the logic expression of the filter | |
settings | IFFGetLogicByDatasetsColumns | the settings for the helper |
boolean
true: the questionid will be passedGets the dataset related to the expression
Name | Type | Description | |
---|---|---|---|
expression | IFBExpression | the logic expression of the filter | |
letQrveyidPass | boolean | flag that allows perform the condition to compare the qrveyid with the datasets | |
datasets | Array.<IDataset> | The dataset collection |
IDataset
the dataset objectGets the default settings for the getLogicByDatasetsColumn function
Name | Type | Description | |
---|---|---|---|
settings | IFFGetLogicByDatasetsColumns | the settings for the helper given by the implementer |
IFFGetLogicByDatasetsColumns
an object with all properties setGets the filters from logic data by Scopes/Scope IDs.
Name | Type | Description | |
---|---|---|---|
logics | The logic array | ||
scopes | The collection of Scopes/Scope IDs |
Gets filters from the logic by the scopes hierarchy.
Name | Type | Description | |
---|---|---|---|
filterData | |||
scopes | |||
currentScope |
Validates if the scope settings is satisfied by properties in multiple scopes
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the filter setting | |
scopeProperties | string | the property or the string path of the scope settings | |
condition | string | validate with AND or OR condition |
Validates if the scope settings is satisfied the property in multiple scopes
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the filter setting | |
property | string | the property or the string path of the scope settings |
Gets a new filter settings object according to various conditions
Name | Type | Description | |
---|---|---|---|
filterSettings | IFSettings | the given filter settings | |
allowedScopes | Array.<IFScope> | a collection of scope types that are permitted | |
otherSettings | IFSettings | another filter settings object to be merged with the filterSettings param |
Gets the filter settings by multiple scopes conditions
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings | |
allowedScopes | Array.<IFScope> | a collection of scope types that are permitted |
Gets the filter settings when a single scope is permitted
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings | |
allowedScopes | Array.<IFScope> | a collection of scope types that are permitted |
Gets the filter settings when there is not scope to accept
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings |
Gets the filter settings when a general scope are only permitted The general scopes could be the GLOBAL, PAGE, TAB and PANEL types.
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings |
Gets the filter settings when there is not a default scope type
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings |
Gets the filter settings when there is only a default scope type
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings |
Gets the filter settings when there are a default scope and other single scope
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings |
Gets the filter settings when there is only the panel scope
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings |
Gets the filter settings when there is only the data scope
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings |
Gets the filter settings when there are not general scopes allowed The general scopes could be the GLOBAL, PAGE, TAB and PANEL types.
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings |
Gets the filter settings when there are no panel scopes and multiple scopes allowed.
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings |
Gets the filter settings when there are no panel scopes and multiple scopes allowed.
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the given filter settings |
Gets the scope settings by the scope type
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the filter settings | |
scope | IFScope | the scope type |
Gets the color of the scope in the settings object
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the filter settings | |
scope | IFScope | the scope type |
Gets the scopes settings as array
Name | Type | Description | |
---|---|---|---|
scopes | IFSettingsScopes | the scopes settings |
Gets the scope allowed to display
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the filter settings |
Validates if the scope settings is satisfied by properties at least in one scope
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the filter setting | |
scopeProperties | string | the property or the string path of the scope settings | |
condition | string | validate with AND or OR condition |
Validates if the scope settings is satisfied by a property at least in one scope
Name | Type | Description | |
---|---|---|---|
settings | IFSettings | the filter setting | |
property | string | the property or the string path of the scope settings |
Excludes Aggregate Filters in the Flattened UI Filters array
Name | Type | Description | |
---|---|---|---|
uFilters | Collection of Flat UI Filters |
Excludes and returns a UI Flat Filters without filters by the given scopes
Name | Type | Description | |
---|---|---|---|
uFilters | The Flatten UI Filters | ||
scopes | collection of scopes types |
Gets the label of the filter property
Name | Type | Description | |
---|---|---|---|
filter | The UI Filter |
Gets output format object from Datasets by the given column. Item of the datasets array must have outputformat item in order to be returned
Name | Type | Description | |
---|---|---|---|
column | The column | ||
datasets | array of datasets |
Gets a collection of Qrvey IDs in the UI Filter structure. Looks around all filter structure finding the qrveyid propertty in each dataset
Name | Type | Description | |
---|---|---|---|
uiFilter |
Void
Gets a filter from the given Flattened UI Filters by given params. Return a index of the array or an object The validation to filter the stored filter is depending on:
Gets a filter from the given Flattened UI Filters by given params. Return a index of the array or an object The validation to filter the stored filter is depending on:
Filters and gets a UI Flatten Filters by the given scopes
Name | Type | Description | |
---|---|---|---|
uFilters | The Flatten UI Filters | ||
scopes | collection of scopes types |
Gets the UI Values generated depending on the validator
Name | Type | Description | |
---|---|---|---|
filter | the filter structure | ||
settings | a settings for this function |
Gets a new UI Filter structure with a datasets/columns info updates
Name | Type | Description | |
---|---|---|---|
data | The UI Filter structure | ||
datasets | An array of datasets/column info used for updating the data |
Resolves conditions between UI flattened filter and given parameters
Name | Type | Description | |
---|---|---|---|
filter | UI Flatten Filter | ||
params | Parameters to validate |
Documentation generated with doxdox.
FAQs
Helper, Utils for all Qrvey Projects
The npm package @qrvey/utils receives a total of 1,407 weekly downloads. As such, @qrvey/utils popularity was classified as popular.
We found that @qrvey/utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.