@baselime/cdk
Version:
Define your observability as code using the AWS CDK
142 lines • 6.62 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.notExists = exports.exists = exports.notInArray = exports.inArray = exports.startsWith = exports.regex = exports.notIncludes = exports.includes = exports.lte = exports.lt = exports.gte = exports.gt = exports.neq = exports.eq = void 0;
/**
* Creates a filter operation object that narrows down the results where the key equals the value.
* @param {string} key The field in the data used for filtering.
* @param {string | number | boolean} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function eq(key, value) {
return { key, value, operation: "=" };
}
exports.eq = eq;
/**
* Creates a filter operation object that narrows down the results where the key does not equal the value.
* @param {string} key The field in the data used for filtering.
* @param {string | number | boolean} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function neq(key, value) {
return { key, value, operation: "!=" };
}
exports.neq = neq;
/**
* Creates a filter operation object that narrows down the results where the key is greater than the value.
* @param {string} key The field in the data used for filtering.
* @param {number} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function gt(key, value) {
return { key, value, operation: ">" };
}
exports.gt = gt;
/**
* Creates a filter operation object that narrows down the results where the key is greater than or equal to the value.
* @param {string} key The field in the data used for filtering.
* @param {number} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function gte(key, value) {
return { key, value, operation: ">=" };
}
exports.gte = gte;
/**
* Creates a filter operation object that narrows down the results where the key is less than the value.
* @param {string} key The field in the data used for filtering.
* @param {number} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function lt(key, value) {
return { key, value, operation: "<" };
}
exports.lt = lt;
/**
* Creates a filter operation object that narrows down the results where the key is less than or equal the value.
* @param {string} key The field in the data used for filtering.
* @param {number} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function lte(key, value) {
return { key, value, operation: "<=" };
}
exports.lte = lte;
/**
* Creates a filter operation object that narrows down the results where the key includes the value.
* @param {string} key The field in the data used for filtering.
* @param {string} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function includes(key, value) {
return { key, value, operation: "INCLUDES" };
}
exports.includes = includes;
/**
* Creates a filter operation object that narrows down the results where the key does not include the value.
* @param {string} key The field in the data used for filtering.
* @param {string} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function notIncludes(key, value) {
return { key, value, operation: "DOES_NOT_INCLUDE" };
}
exports.notIncludes = notIncludes;
/**
* Creates a filter operation object that narrows down the results where the key matches the regex.
* @param {string} key The field in the data used for filtering.
* @param {RegExp} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function regex(key, value) {
return { key, value: value.source, operation: "MATCH_REGEX" };
}
exports.regex = regex;
/**
* Creates a filter operation object that narrows down the results where the key starts with the value.
* @param {string} key The field in the data used for filtering.
* @param {string} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function startsWith(key, value) {
return { key, value: value, operation: "STARTS_WITH" };
}
exports.startsWith = startsWith;
/**
* Creates a filter operation object that narrows down the results where the key is one of the values
* @param {string} key The field in the data used for filtering.
* @param {string[]} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function inArray(key, value) {
return { key, value: value, operation: "IN" };
}
exports.inArray = inArray;
/**
* Creates a filter operation object that narrows down the results where the key is not one of the values
* @param {string} key The field in the data used for filtering.
* @param {string[]} value The value for the specified key used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function notInArray(key, value) {
return { key, value: value, operation: "NOT_IN" };
}
exports.notInArray = notInArray;
/**
* Creates a filter operation object that narrows down the results where the key exists
* @param {string} key The field in the data used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function exists(key) {
return { key, operation: "EXISTS" };
}
exports.exists = exists;
/**
* Creates a filter operation object that narrows down the results where the key does not exist
* @param {string} key The field in the data used for filtering.
* @returns {Object} A filter operation object with the key, value, and operation properties.
*/
function notExists(key) {
return { key, operation: "DOES_NOT_EXIST" };
}
exports.notExists = notExists;
//# sourceMappingURL=filter.js.map