@webiny/db-dynamodb 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7be00a75a9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DynamoDbDriver.js +204 -209
- package/DynamoDbDriver.js.map +1 -1
- package/exports/api/db.d.ts +2 -0
- package/exports/api/db.js +2 -0
- package/feature/FilterUtil/FilterUtil.d.ts +11 -0
- package/feature/FilterUtil/FilterUtil.js +26 -0
- package/feature/FilterUtil/FilterUtil.js.map +1 -0
- package/feature/FilterUtil/abstractions/FilterUtil.d.ts +17 -0
- package/feature/FilterUtil/abstractions/FilterUtil.js +5 -0
- package/feature/FilterUtil/abstractions/FilterUtil.js.map +1 -0
- package/feature/FilterUtil/createFilters.d.ts +22 -0
- package/feature/FilterUtil/createFilters.js +92 -0
- package/feature/FilterUtil/createFilters.js.map +1 -0
- package/feature/FilterUtil/extractWhereArgs.d.ts +7 -0
- package/feature/FilterUtil/extractWhereArgs.js +20 -0
- package/feature/FilterUtil/extractWhereArgs.js.map +1 -0
- package/feature/FilterUtil/feature.d.ts +4 -0
- package/feature/FilterUtil/feature.js +11 -0
- package/feature/FilterUtil/feature.js.map +1 -0
- package/feature/FilterUtil/index.d.ts +2 -0
- package/feature/FilterUtil/index.js +2 -0
- package/feature/ValueFilter/ValueFilterRegistry.d.ts +12 -0
- package/feature/ValueFilter/ValueFilterRegistry.js +27 -0
- package/feature/ValueFilter/ValueFilterRegistry.js.map +1 -0
- package/feature/ValueFilter/abstractions/ValueFilter.d.ts +22 -0
- package/feature/ValueFilter/abstractions/ValueFilter.js +5 -0
- package/feature/ValueFilter/abstractions/ValueFilter.js.map +1 -0
- package/feature/ValueFilter/abstractions/ValueFilterRegistry.d.ts +10 -0
- package/feature/ValueFilter/abstractions/ValueFilterRegistry.js +5 -0
- package/feature/ValueFilter/abstractions/ValueFilterRegistry.js.map +1 -0
- package/feature/ValueFilter/feature.d.ts +4 -0
- package/feature/ValueFilter/feature.js +33 -0
- package/feature/ValueFilter/feature.js.map +1 -0
- package/feature/ValueFilter/filters/AndInFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/AndInFilter.js +28 -0
- package/feature/ValueFilter/filters/AndInFilter.js.map +1 -0
- package/feature/ValueFilter/filters/BetweenFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/BetweenFilter.js +31 -0
- package/feature/ValueFilter/filters/BetweenFilter.js.map +1 -0
- package/feature/ValueFilter/filters/ContainsFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/ContainsFilter.js +42 -0
- package/feature/ValueFilter/filters/ContainsFilter.js.map +1 -0
- package/feature/ValueFilter/filters/EqFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/EqFilter.js +24 -0
- package/feature/ValueFilter/filters/EqFilter.js.map +1 -0
- package/feature/ValueFilter/filters/FuzzyFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/FuzzyFilter.js +37 -0
- package/feature/ValueFilter/filters/FuzzyFilter.js.map +1 -0
- package/feature/ValueFilter/filters/GtFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/GtFilter.js +22 -0
- package/feature/ValueFilter/filters/GtFilter.js.map +1 -0
- package/feature/ValueFilter/filters/GteFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/GteFilter.js +22 -0
- package/feature/ValueFilter/filters/GteFilter.js.map +1 -0
- package/feature/ValueFilter/filters/InFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/InFilter.js +28 -0
- package/feature/ValueFilter/filters/InFilter.js.map +1 -0
- package/feature/ValueFilter/filters/LtFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/LtFilter.js +22 -0
- package/feature/ValueFilter/filters/LtFilter.js.map +1 -0
- package/feature/ValueFilter/filters/LteFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/LteFilter.js +22 -0
- package/feature/ValueFilter/filters/LteFilter.js.map +1 -0
- package/feature/ValueFilter/filters/StartsWithFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/StartsWithFilter.js +29 -0
- package/feature/ValueFilter/filters/StartsWithFilter.js.map +1 -0
- package/feature/ValueFilter/index.d.ts +3 -0
- package/feature/ValueFilter/index.js +3 -0
- package/index.d.ts +1 -0
- package/index.js +9 -2
- package/index.js.map +1 -1
- package/package.json +28 -20
- package/plugins/definitions/DateTimeTransformPlugin.js +18 -27
- package/plugins/definitions/DateTimeTransformPlugin.js.map +1 -1
- package/plugins/definitions/FieldPlugin.js +34 -37
- package/plugins/definitions/FieldPlugin.js.map +1 -1
- package/plugins/definitions/TimeTransformPlugin.js +25 -37
- package/plugins/definitions/TimeTransformPlugin.js.map +1 -1
- package/plugins/definitions/ValueTransformPlugin.d.ts +1 -6
- package/plugins/definitions/ValueTransformPlugin.js +17 -22
- package/plugins/definitions/ValueTransformPlugin.js.map +1 -1
- package/plugins/definitions/assignFields.js +14 -18
- package/plugins/definitions/assignFields.js.map +1 -1
- package/plugins/index.d.ts +0 -5
- package/plugins/index.js +0 -12
- package/store/entity.js +6 -9
- package/store/entity.js.map +1 -1
- package/store/keys.js +6 -13
- package/store/keys.js.map +1 -1
- package/store/types.js +0 -3
- package/toolbox.d.ts +53 -1
- package/toolbox.js +0 -4
- package/types.js +0 -3
- package/utils/batch/batchRead.js +37 -56
- package/utils/batch/batchRead.js.map +1 -1
- package/utils/batch/batchWrite.js +33 -51
- package/utils/batch/batchWrite.js.map +1 -1
- package/utils/batch/index.js +0 -2
- package/utils/batch/types.js +0 -3
- package/utils/cleanup.js +35 -25
- package/utils/cleanup.js.map +1 -1
- package/utils/count.js +8 -13
- package/utils/count.js.map +1 -1
- package/utils/createEntity.d.ts +1 -1
- package/utils/createEntity.js +75 -78
- package/utils/createEntity.js.map +1 -1
- package/utils/createTable.js +25 -35
- package/utils/createTable.js.map +1 -1
- package/utils/cursor.js +7 -10
- package/utils/cursor.js.map +1 -1
- package/utils/delete.js +6 -8
- package/utils/delete.js.map +1 -1
- package/utils/entity/Entity.d.ts +1 -1
- package/utils/entity/Entity.js +85 -89
- package/utils/entity/Entity.js.map +1 -1
- package/utils/entity/EntityReadBatch.js +23 -31
- package/utils/entity/EntityReadBatch.js.map +1 -1
- package/utils/entity/EntityReadBatchBuilder.js +12 -15
- package/utils/entity/EntityReadBatchBuilder.js.map +1 -1
- package/utils/entity/EntityWriteBatch.js +34 -41
- package/utils/entity/EntityWriteBatch.js.map +1 -1
- package/utils/entity/EntityWriteBatchBuilder.js +15 -16
- package/utils/entity/EntityWriteBatchBuilder.js.map +1 -1
- package/utils/entity/getEntity.js +8 -9
- package/utils/entity/getEntity.js.map +1 -1
- package/utils/entity/index.js +0 -2
- package/utils/entity/types.js +0 -4
- package/utils/get.js +12 -26
- package/utils/get.js.map +1 -1
- package/utils/index.d.ts +1 -5
- package/utils/index.js +1 -7
- package/utils/put.js +7 -9
- package/utils/put.js.map +1 -1
- package/utils/query.js +77 -128
- package/utils/query.js.map +1 -1
- package/utils/scan.js +47 -73
- package/utils/scan.js.map +1 -1
- package/utils/sort.js +37 -61
- package/utils/sort.js.map +1 -1
- package/utils/table/Table.js +22 -21
- package/utils/table/Table.js.map +1 -1
- package/utils/table/TableReadBatch.js +37 -45
- package/utils/table/TableReadBatch.js.map +1 -1
- package/utils/table/TableWriteBatch.js +47 -56
- package/utils/table/TableWriteBatch.js.map +1 -1
- package/utils/table/index.js +0 -2
- package/utils/table/types.js +0 -3
- package/plugins/definitions/AttributePlugin.d.ts +0 -18
- package/plugins/definitions/AttributePlugin.js +0 -38
- package/plugins/definitions/AttributePlugin.js.map +0 -1
- package/plugins/definitions/FieldPathPlugin.d.ts +0 -22
- package/plugins/definitions/FieldPathPlugin.js +0 -26
- package/plugins/definitions/FieldPathPlugin.js.map +0 -1
- package/plugins/definitions/ValueFilterPlugin.d.ts +0 -22
- package/plugins/definitions/ValueFilterPlugin.js +0 -35
- package/plugins/definitions/ValueFilterPlugin.js.map +0 -1
- package/plugins/filters/andIn.d.ts +0 -3
- package/plugins/filters/andIn.js +0 -24
- package/plugins/filters/andIn.js.map +0 -1
- package/plugins/filters/between.d.ts +0 -3
- package/plugins/filters/between.js +0 -25
- package/plugins/filters/between.js.map +0 -1
- package/plugins/filters/contains.d.ts +0 -3
- package/plugins/filters/contains.js +0 -53
- package/plugins/filters/contains.js.map +0 -1
- package/plugins/filters/eq.d.ts +0 -3
- package/plugins/filters/eq.js +0 -26
- package/plugins/filters/eq.js.map +0 -1
- package/plugins/filters/fuzzy.d.ts +0 -3
- package/plugins/filters/fuzzy.js +0 -29
- package/plugins/filters/fuzzy.js.map +0 -1
- package/plugins/filters/gt.d.ts +0 -3
- package/plugins/filters/gt.js +0 -14
- package/plugins/filters/gt.js.map +0 -1
- package/plugins/filters/gte.d.ts +0 -3
- package/plugins/filters/gte.js +0 -14
- package/plugins/filters/gte.js.map +0 -1
- package/plugins/filters/in.d.ts +0 -3
- package/plugins/filters/in.js +0 -24
- package/plugins/filters/in.js.map +0 -1
- package/plugins/filters/index.d.ts +0 -2
- package/plugins/filters/index.js +0 -14
- package/plugins/filters/index.js.map +0 -1
- package/plugins/filters/lt.d.ts +0 -3
- package/plugins/filters/lt.js +0 -14
- package/plugins/filters/lt.js.map +0 -1
- package/plugins/filters/lte.d.ts +0 -3
- package/plugins/filters/lte.js +0 -14
- package/plugins/filters/lte.js.map +0 -1
- package/plugins/filters/startsWith.d.ts +0 -3
- package/plugins/filters/startsWith.js +0 -34
- package/plugins/filters/startsWith.js.map +0 -1
- package/plugins/index.js.map +0 -1
- package/store/types.js.map +0 -1
- package/toolbox.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/attributes.d.ts +0 -10
- package/utils/attributes.js +0 -19
- package/utils/attributes.js.map +0 -1
- package/utils/batch/index.js.map +0 -1
- package/utils/batch/types.js.map +0 -1
- package/utils/entity/index.js.map +0 -1
- package/utils/entity/types.js.map +0 -1
- package/utils/filter.d.ts +0 -12
- package/utils/filter.js +0 -174
- package/utils/filter.js.map +0 -1
- package/utils/index.js.map +0 -1
- package/utils/listResponse.d.ts +0 -13
- package/utils/listResponse.js +0 -25
- package/utils/listResponse.js.map +0 -1
- package/utils/table/index.js.map +0 -1
- package/utils/table/types.js.map +0 -1
- package/utils/update.d.ts +0 -12
- package/utils/update.js +0 -12
- package/utils/update.js.map +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { WebinyError } from "@webiny/error";
|
|
2
|
+
import { extractWhereArgs } from "./extractWhereArgs.js";
|
|
3
|
+
import * as __rspack_external_dot_prop_de53db47 from "dot-prop";
|
|
4
|
+
const findFilter = (registry, operation)=>{
|
|
5
|
+
const filter = registry.get(operation);
|
|
6
|
+
if (filter) return filter;
|
|
7
|
+
throw new WebinyError("Missing filter plugin definition.", "FILTER_PLUGIN_ERROR", {
|
|
8
|
+
operation
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
const multiSearchFieldOperations = [
|
|
12
|
+
"contains",
|
|
13
|
+
"fuzzy"
|
|
14
|
+
];
|
|
15
|
+
const createFilters = (params)=>{
|
|
16
|
+
const { where, fields, filterRegistry } = params;
|
|
17
|
+
const keys = Object.keys(where);
|
|
18
|
+
if (0 === keys.length) return [];
|
|
19
|
+
return keys.reduce((filters, key)=>{
|
|
20
|
+
const compareValue = where[key];
|
|
21
|
+
if (void 0 === compareValue) return filters;
|
|
22
|
+
if (true === multiSearchFieldOperations.includes(key)) {
|
|
23
|
+
const data = compareValue;
|
|
24
|
+
let transformValue;
|
|
25
|
+
const paths = data.fields.map((field)=>{
|
|
26
|
+
const fieldPlugin = fields.find((plugin)=>plugin.getField() === field);
|
|
27
|
+
if (fieldPlugin) {
|
|
28
|
+
transformValue = (value)=>fieldPlugin.transformValue(value);
|
|
29
|
+
return fieldPlugin.getPath();
|
|
30
|
+
}
|
|
31
|
+
return field;
|
|
32
|
+
});
|
|
33
|
+
const filter = findFilter(filterRegistry, key);
|
|
34
|
+
filters.push({
|
|
35
|
+
operation: filter.operation,
|
|
36
|
+
compareValue: data.value,
|
|
37
|
+
filter,
|
|
38
|
+
transformValue,
|
|
39
|
+
paths,
|
|
40
|
+
negate: false
|
|
41
|
+
});
|
|
42
|
+
return filters;
|
|
43
|
+
}
|
|
44
|
+
const { field, operation, negate } = extractWhereArgs(key);
|
|
45
|
+
const filter = findFilter(filterRegistry, operation);
|
|
46
|
+
const fieldPlugin = fields.find((plugin)=>plugin.getField() === field);
|
|
47
|
+
let path = field;
|
|
48
|
+
let transformValue;
|
|
49
|
+
if (fieldPlugin) {
|
|
50
|
+
transformValue = (value)=>fieldPlugin.transformValue(value);
|
|
51
|
+
path = fieldPlugin.getPath();
|
|
52
|
+
}
|
|
53
|
+
filters.push({
|
|
54
|
+
operation: filter.operation,
|
|
55
|
+
compareValue,
|
|
56
|
+
filter,
|
|
57
|
+
transformValue,
|
|
58
|
+
paths: [
|
|
59
|
+
path
|
|
60
|
+
],
|
|
61
|
+
negate
|
|
62
|
+
});
|
|
63
|
+
return filters;
|
|
64
|
+
}, []);
|
|
65
|
+
};
|
|
66
|
+
const transform = (value, transformValue)=>{
|
|
67
|
+
if (!transformValue) return value;
|
|
68
|
+
if (Array.isArray(value)) return value.map((v)=>transformValue(v));
|
|
69
|
+
return transformValue(value);
|
|
70
|
+
};
|
|
71
|
+
const createFilterCallable = (params)=>{
|
|
72
|
+
const filters = createFilters(params);
|
|
73
|
+
if (0 === filters.length) return null;
|
|
74
|
+
return (item)=>{
|
|
75
|
+
for (const filter of filters){
|
|
76
|
+
const result = filter.paths.some((path)=>{
|
|
77
|
+
const value = transform(__rspack_external_dot_prop_de53db47.getProperty(item, path), filter.transformValue);
|
|
78
|
+
const compareValue = transform(filter.compareValue, filter.transformValue);
|
|
79
|
+
const matched = filter.filter.matches({
|
|
80
|
+
value,
|
|
81
|
+
compareValue
|
|
82
|
+
});
|
|
83
|
+
return filter.negate ? !matched : matched;
|
|
84
|
+
});
|
|
85
|
+
if (false === result) return false;
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export { createFilterCallable, createFilters };
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=createFilters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/FilterUtil/createFilters.js","sources":["../../../src/feature/FilterUtil/createFilters.ts"],"sourcesContent":["import * as dotProp from \"dot-prop\";\nimport { WebinyError } from \"@webiny/error\";\nimport type { FieldPlugin } from \"~/plugins/definitions/FieldPlugin.js\";\nimport type { DynamoDbContainsFilter } from \"~/types.js\";\nimport type { ValueFilter, ValueFilterRegistry } from \"~/feature/ValueFilter/index.js\";\nimport { extractWhereArgs } from \"./extractWhereArgs.js\";\n\ntype TransformValue = (value: any) => any;\n\ninterface Filter {\n operation: string;\n compareValue: any;\n filter: ValueFilter.Interface;\n transformValue?: TransformValue;\n paths: string[];\n negate: boolean;\n}\n\ninterface CreateFiltersParams {\n filterRegistry: ValueFilterRegistry.Interface;\n where: Record<string, any>;\n fields: FieldPlugin[];\n}\n\nconst findFilter = (\n registry: ValueFilterRegistry.Interface,\n operation: string\n): ValueFilter.Interface => {\n const filter = registry.get(operation);\n if (filter) {\n return filter;\n }\n throw new WebinyError(`Missing filter plugin definition.`, \"FILTER_PLUGIN_ERROR\", {\n operation\n });\n};\n\nconst multiSearchFieldOperations = [\"contains\", \"fuzzy\"];\n\nexport const createFilters = (params: CreateFiltersParams): Filter[] => {\n const { where, fields, filterRegistry } = params;\n\n const keys = Object.keys(where);\n /**\n * Skip everything if there are no conditions to be applied.\n */\n if (keys.length === 0) {\n return [];\n }\n\n return keys.reduce((filters, key) => {\n const compareValue = where[key];\n if (compareValue === undefined) {\n return filters;\n }\n /**\n * @see DynamoDbContainsFilter\n */\n if (multiSearchFieldOperations.includes(key) === true) {\n const data: DynamoDbContainsFilter = compareValue;\n let transformValue: TransformValue | undefined = undefined;\n const paths = data.fields.map(field => {\n const fieldPlugin = fields.find(plugin => plugin.getField() === field);\n if (fieldPlugin) {\n transformValue = (value: any) => {\n return fieldPlugin.transformValue(value);\n };\n return fieldPlugin.getPath();\n }\n return field;\n });\n\n const filter = findFilter(filterRegistry, key);\n filters.push({\n operation: filter.operation,\n compareValue: data.value,\n filter,\n transformValue,\n paths,\n negate: false\n });\n return filters;\n }\n\n const { field, operation, negate } = extractWhereArgs(key);\n\n const filter = findFilter(filterRegistry, operation);\n\n const fieldPlugin = fields.find(plugin => plugin.getField() === field);\n let path: string = field;\n let transformValue: TransformValue | undefined = undefined;\n if (fieldPlugin) {\n transformValue = (value: any) => {\n return fieldPlugin.transformValue(value);\n };\n path = fieldPlugin.getPath();\n }\n\n filters.push({\n operation: filter.operation,\n compareValue,\n filter,\n transformValue,\n paths: [path],\n negate\n });\n\n return filters;\n }, [] as Filter[]);\n};\n\n/**\n * Transforms the value with given transformer callable.\n */\nconst transform = (value: any, transformValue?: TransformValue): any => {\n if (!transformValue) {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map(v => transformValue(v));\n }\n return transformValue(value);\n};\n\n/**\n * Creates a filter callable that we can send to the .filter() method of the array.\n */\nexport const createFilterCallable = (\n params: CreateFiltersParams\n): ((item: any) => boolean) | null => {\n const filters = createFilters(params);\n /**\n * Just return null so there are no filters to be applied.\n * Later in the code we check for null so we do not loop through the items.\n */\n if (filters.length === 0) {\n return null;\n }\n\n return (item: any) => {\n for (const filter of filters) {\n const result = filter.paths.some(path => {\n const value = transform(dotProp.getProperty(item, path), filter.transformValue);\n const compareValue = transform(filter.compareValue, filter.transformValue);\n const matched = filter.filter.matches({\n value,\n compareValue\n });\n\n return filter.negate ? !matched : matched;\n });\n if (result === false) {\n return false;\n }\n }\n return true;\n };\n};\n"],"names":["findFilter","registry","operation","filter","WebinyError","multiSearchFieldOperations","createFilters","params","where","fields","filterRegistry","keys","Object","filters","key","compareValue","undefined","data","transformValue","paths","field","fieldPlugin","plugin","value","negate","extractWhereArgs","path","transform","Array","v","createFilterCallable","item","result","dotProp","matched"],"mappings":";;;AAwBA,MAAMA,aAAa,CACfC,UACAC;IAEA,MAAMC,SAASF,SAAS,GAAG,CAACC;IAC5B,IAAIC,QACA,OAAOA;IAEX,MAAM,IAAIC,YAAY,qCAAqC,uBAAuB;QAC9EF;IACJ;AACJ;AAEA,MAAMG,6BAA6B;IAAC;IAAY;CAAQ;AAEjD,MAAMC,gBAAgB,CAACC;IAC1B,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,cAAc,EAAE,GAAGH;IAE1C,MAAMI,OAAOC,OAAO,IAAI,CAACJ;IAIzB,IAAIG,AAAgB,MAAhBA,KAAK,MAAM,EACX,OAAO,EAAE;IAGb,OAAOA,KAAK,MAAM,CAAC,CAACE,SAASC;QACzB,MAAMC,eAAeP,KAAK,CAACM,IAAI;QAC/B,IAAIC,AAAiBC,WAAjBD,cACA,OAAOF;QAKX,IAAIR,AAA6C,SAA7CA,2BAA2B,QAAQ,CAACS,MAAe;YACnD,MAAMG,OAA+BF;YACrC,IAAIG;YACJ,MAAMC,QAAQF,KAAK,MAAM,CAAC,GAAG,CAACG,CAAAA;gBAC1B,MAAMC,cAAcZ,OAAO,IAAI,CAACa,CAAAA,SAAUA,OAAO,QAAQ,OAAOF;gBAChE,IAAIC,aAAa;oBACbH,iBAAiB,CAACK,QACPF,YAAY,cAAc,CAACE;oBAEtC,OAAOF,YAAY,OAAO;gBAC9B;gBACA,OAAOD;YACX;YAEA,MAAMjB,SAASH,WAAWU,gBAAgBI;YAC1CD,QAAQ,IAAI,CAAC;gBACT,WAAWV,OAAO,SAAS;gBAC3B,cAAcc,KAAK,KAAK;gBACxBd;gBACAe;gBACAC;gBACA,QAAQ;YACZ;YACA,OAAON;QACX;QAEA,MAAM,EAAEO,KAAK,EAAElB,SAAS,EAAEsB,MAAM,EAAE,GAAGC,iBAAiBX;QAEtD,MAAMX,SAASH,WAAWU,gBAAgBR;QAE1C,MAAMmB,cAAcZ,OAAO,IAAI,CAACa,CAAAA,SAAUA,OAAO,QAAQ,OAAOF;QAChE,IAAIM,OAAeN;QACnB,IAAIF;QACJ,IAAIG,aAAa;YACbH,iBAAiB,CAACK,QACPF,YAAY,cAAc,CAACE;YAEtCG,OAAOL,YAAY,OAAO;QAC9B;QAEAR,QAAQ,IAAI,CAAC;YACT,WAAWV,OAAO,SAAS;YAC3BY;YACAZ;YACAe;YACA,OAAO;gBAACQ;aAAK;YACbF;QACJ;QAEA,OAAOX;IACX,GAAG,EAAE;AACT;AAKA,MAAMc,YAAY,CAACJ,OAAYL;IAC3B,IAAI,CAACA,gBACD,OAAOK;IAEX,IAAIK,MAAM,OAAO,CAACL,QACd,OAAOA,MAAM,GAAG,CAACM,CAAAA,IAAKX,eAAeW;IAEzC,OAAOX,eAAeK;AAC1B;AAKO,MAAMO,uBAAuB,CAChCvB;IAEA,MAAMM,UAAUP,cAAcC;IAK9B,IAAIM,AAAmB,MAAnBA,QAAQ,MAAM,EACd,OAAO;IAGX,OAAO,CAACkB;QACJ,KAAK,MAAM5B,UAAUU,QAAS;YAC1B,MAAMmB,SAAS7B,OAAO,KAAK,CAAC,IAAI,CAACuB,CAAAA;gBAC7B,MAAMH,QAAQI,UAAUM,oCAAAA,WAAmB,CAACF,MAAML,OAAOvB,OAAO,cAAc;gBAC9E,MAAMY,eAAeY,UAAUxB,OAAO,YAAY,EAAEA,OAAO,cAAc;gBACzE,MAAM+B,UAAU/B,OAAO,MAAM,CAAC,OAAO,CAAC;oBAClCoB;oBACAR;gBACJ;gBAEA,OAAOZ,OAAO,MAAM,GAAG,CAAC+B,UAAUA;YACtC;YACA,IAAIF,AAAW,UAAXA,QACA,OAAO;QAEf;QACA,OAAO;IACX;AACJ"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const extractWhereArgs = (key)=>{
|
|
2
|
+
const result = key.split("_");
|
|
3
|
+
const field = result.shift();
|
|
4
|
+
const rawOp = 0 === result.length ? "eq" : result.join("_");
|
|
5
|
+
if ("not" === rawOp) return {
|
|
6
|
+
field,
|
|
7
|
+
operation: "eq",
|
|
8
|
+
negate: true
|
|
9
|
+
};
|
|
10
|
+
const negate = null !== rawOp.match("not_");
|
|
11
|
+
const operation = rawOp.replace("not_", "");
|
|
12
|
+
return {
|
|
13
|
+
field,
|
|
14
|
+
operation,
|
|
15
|
+
negate
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export { extractWhereArgs };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=extractWhereArgs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/FilterUtil/extractWhereArgs.js","sources":["../../../src/feature/FilterUtil/extractWhereArgs.ts"],"sourcesContent":["interface ExtractWhereArgsResult {\n field: string;\n operation: string;\n negate: boolean;\n}\n\nexport const extractWhereArgs = (key: string): ExtractWhereArgsResult => {\n const result = key.split(\"_\");\n const field = result.shift() as string;\n const rawOp = result.length === 0 ? \"eq\" : result.join(\"_\");\n /**\n * When rawOp is not, it means it is equal negated so just return that.\n */\n if (rawOp === \"not\") {\n return {\n field,\n operation: \"eq\",\n negate: true\n };\n }\n const negate = rawOp.match(\"not_\") !== null;\n const operation = rawOp.replace(\"not_\", \"\");\n return {\n field,\n operation,\n negate\n };\n};\n"],"names":["extractWhereArgs","key","result","field","rawOp","negate","operation"],"mappings":"AAMO,MAAMA,mBAAmB,CAACC;IAC7B,MAAMC,SAASD,IAAI,KAAK,CAAC;IACzB,MAAME,QAAQD,OAAO,KAAK;IAC1B,MAAME,QAAQF,AAAkB,MAAlBA,OAAO,MAAM,GAAS,OAAOA,OAAO,IAAI,CAAC;IAIvD,IAAIE,AAAU,UAAVA,OACA,OAAO;QACHD;QACA,WAAW;QACX,QAAQ;IACZ;IAEJ,MAAME,SAASD,AAAwB,SAAxBA,MAAM,KAAK,CAAC;IAC3B,MAAME,YAAYF,MAAM,OAAO,CAAC,QAAQ;IACxC,OAAO;QACHD;QACAG;QACAD;IACJ;AACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { FilterUtil } from "./FilterUtil.js";
|
|
3
|
+
const FilterUtilFeature = createFeature({
|
|
4
|
+
name: "Db/DynamoDB/FilterUtilFeature",
|
|
5
|
+
register: (container)=>{
|
|
6
|
+
container.register(FilterUtil);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { FilterUtilFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/FilterUtil/feature.js","sources":["../../../src/feature/FilterUtil/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { FilterUtil } from \"./FilterUtil.js\";\n\nexport const FilterUtilFeature = createFeature({\n name: \"Db/DynamoDB/FilterUtilFeature\",\n register: container => {\n container.register(FilterUtil);\n }\n});\n"],"names":["FilterUtilFeature","createFeature","container","FilterUtil"],"mappings":";;AAGO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ValueFilterRegistry as Abstraction } from "./abstractions/ValueFilterRegistry.js";
|
|
2
|
+
import { ValueFilter } from "./abstractions/ValueFilter.js";
|
|
3
|
+
declare class ValueFilterRegistryImpl implements Abstraction.Interface {
|
|
4
|
+
private readonly filters;
|
|
5
|
+
constructor(filters: ValueFilter.Interface[]);
|
|
6
|
+
get(operation: string): ValueFilter.Interface | undefined;
|
|
7
|
+
getAll(): ValueFilter.Interface[];
|
|
8
|
+
}
|
|
9
|
+
export declare const ValueFilterRegistry: typeof ValueFilterRegistryImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions/ValueFilterRegistry.js").IValueFilterRegistry>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ValueFilterRegistry } from "./abstractions/ValueFilterRegistry.js";
|
|
2
|
+
import { ValueFilter } from "./abstractions/ValueFilter.js";
|
|
3
|
+
class ValueFilterRegistryImpl {
|
|
4
|
+
constructor(filters){
|
|
5
|
+
this.filters = filters;
|
|
6
|
+
}
|
|
7
|
+
get(operation) {
|
|
8
|
+
return this.filters.find((filter)=>filter.is(operation));
|
|
9
|
+
}
|
|
10
|
+
getAll() {
|
|
11
|
+
return this.filters;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const ValueFilterRegistry_ValueFilterRegistry = ValueFilterRegistry.createImplementation({
|
|
15
|
+
implementation: ValueFilterRegistryImpl,
|
|
16
|
+
dependencies: [
|
|
17
|
+
[
|
|
18
|
+
ValueFilter,
|
|
19
|
+
{
|
|
20
|
+
multiple: true
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
export { ValueFilterRegistry_ValueFilterRegistry as ValueFilterRegistry };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=ValueFilterRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/ValueFilterRegistry.js","sources":["../../../src/feature/ValueFilter/ValueFilterRegistry.ts"],"sourcesContent":["import { ValueFilterRegistry as Abstraction } from \"./abstractions/ValueFilterRegistry.js\";\nimport { ValueFilter } from \"./abstractions/ValueFilter.js\";\n\nclass ValueFilterRegistryImpl implements Abstraction.Interface {\n public constructor(private readonly filters: ValueFilter.Interface[]) {}\n\n public get(operation: string): ValueFilter.Interface | undefined {\n return this.filters.find(filter => {\n return filter.is(operation);\n });\n }\n\n public getAll(): ValueFilter.Interface[] {\n return this.filters;\n }\n}\n\nexport const ValueFilterRegistry = Abstraction.createImplementation({\n implementation: ValueFilterRegistryImpl,\n dependencies: [[ValueFilter, { multiple: true }]]\n});\n"],"names":["ValueFilterRegistryImpl","filters","operation","filter","ValueFilterRegistry","Abstraction","ValueFilter"],"mappings":";;AAGA,MAAMA;IACF,YAAoCC,OAAgC,CAAE;aAAlCA,OAAO,GAAPA;IAAmC;IAEhE,IAAIC,SAAiB,EAAqC;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAACC,CAAAA,SACdA,OAAO,EAAE,CAACD;IAEzB;IAEO,SAAkC;QACrC,OAAO,IAAI,CAAC,OAAO;IACvB;AACJ;AAEO,MAAME,0CAAsBC,oBAAAA,oBAAgC,CAAC;IAChE,gBAAgBL;IAChB,cAAc;QAAC;YAACM;YAAa;gBAAE,UAAU;YAAK;SAAE;KAAC;AACrD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface IValueFilterCanUseParams<TValue = any, TCompareValue = any> {
|
|
2
|
+
value: TValue;
|
|
3
|
+
compareValue: TCompareValue;
|
|
4
|
+
}
|
|
5
|
+
export interface IValueFilterMatchesParams<TValue = any, TCompareValue = any> {
|
|
6
|
+
value: TValue;
|
|
7
|
+
compareValue: TCompareValue;
|
|
8
|
+
}
|
|
9
|
+
export type IValueFilterMatchesResult = boolean;
|
|
10
|
+
export interface IValueFilter<TValue = any, TCompareValue = any> {
|
|
11
|
+
readonly operation: string;
|
|
12
|
+
is(operation: string): boolean;
|
|
13
|
+
canUse(params: IValueFilterCanUseParams): boolean;
|
|
14
|
+
matches(params: IValueFilterMatchesParams<TValue, TCompareValue>): IValueFilterMatchesResult;
|
|
15
|
+
}
|
|
16
|
+
export declare const ValueFilter: import("@webiny/di").Abstraction<IValueFilter<any, any>>;
|
|
17
|
+
export declare namespace ValueFilter {
|
|
18
|
+
type Interface<TValue = any, TCompareValue = any> = IValueFilter<TValue, TCompareValue>;
|
|
19
|
+
type CanUseParams = IValueFilterCanUseParams;
|
|
20
|
+
type MatchesParams = IValueFilterMatchesParams;
|
|
21
|
+
type Result = IValueFilterMatchesResult;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/abstractions/ValueFilter.js","sources":["../../../../src/feature/ValueFilter/abstractions/ValueFilter.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IValueFilterCanUseParams<TValue = any, TCompareValue = any> {\n value: TValue;\n compareValue: TCompareValue;\n}\n\nexport interface IValueFilterMatchesParams<TValue = any, TCompareValue = any> {\n value: TValue;\n compareValue: TCompareValue;\n}\n\nexport type IValueFilterMatchesResult = boolean;\n\nexport interface IValueFilter<TValue = any, TCompareValue = any> {\n readonly operation: string;\n is(operation: string): boolean;\n canUse(params: IValueFilterCanUseParams): boolean;\n matches(params: IValueFilterMatchesParams<TValue, TCompareValue>): IValueFilterMatchesResult;\n}\n\nexport const ValueFilter = createAbstraction<IValueFilter>(\"Db/DynamoDB/ValueFilter\");\n\nexport namespace ValueFilter {\n export type Interface<TValue = any, TCompareValue = any> = IValueFilter<TValue, TCompareValue>;\n export type CanUseParams = IValueFilterCanUseParams;\n export type MatchesParams = IValueFilterMatchesParams;\n export type Result = IValueFilterMatchesResult;\n}\n"],"names":["ValueFilter","createAbstraction"],"mappings":";AAqBO,MAAMA,cAAcC,kBAAgC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ValueFilter } from "./ValueFilter.js";
|
|
2
|
+
export interface IValueFilterRegistry {
|
|
3
|
+
get(operation: string): ValueFilter.Interface | undefined;
|
|
4
|
+
getAll(): ValueFilter.Interface[];
|
|
5
|
+
}
|
|
6
|
+
export declare const ValueFilterRegistry: import("@webiny/di").Abstraction<IValueFilterRegistry>;
|
|
7
|
+
export declare namespace ValueFilterRegistry {
|
|
8
|
+
type Interface = IValueFilterRegistry;
|
|
9
|
+
type Filter = ValueFilter.Interface;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/abstractions/ValueFilterRegistry.js","sources":["../../../../src/feature/ValueFilter/abstractions/ValueFilterRegistry.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { ValueFilter } from \"./ValueFilter.js\";\n\nexport interface IValueFilterRegistry {\n get(operation: string): ValueFilter.Interface | undefined;\n getAll(): ValueFilter.Interface[];\n}\n\nexport const ValueFilterRegistry = createAbstraction<IValueFilterRegistry>(\n \"Db/DynamoDB/ValueFilterRegistry\"\n);\n\nexport namespace ValueFilterRegistry {\n export type Interface = IValueFilterRegistry;\n export type Filter = ValueFilter.Interface;\n}\n"],"names":["ValueFilterRegistry","createAbstraction"],"mappings":";AAQO,MAAMA,sBAAsBC,kBAC/B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { EqFilter } from "./filters/EqFilter.js";
|
|
3
|
+
import { GtFilter } from "./filters/GtFilter.js";
|
|
4
|
+
import { GteFilter } from "./filters/GteFilter.js";
|
|
5
|
+
import { LtFilter } from "./filters/LtFilter.js";
|
|
6
|
+
import { LteFilter } from "./filters/LteFilter.js";
|
|
7
|
+
import { BetweenFilter } from "./filters/BetweenFilter.js";
|
|
8
|
+
import { InFilter } from "./filters/InFilter.js";
|
|
9
|
+
import { AndInFilter } from "./filters/AndInFilter.js";
|
|
10
|
+
import { ContainsFilter } from "./filters/ContainsFilter.js";
|
|
11
|
+
import { FuzzyFilter } from "./filters/FuzzyFilter.js";
|
|
12
|
+
import { StartsWithFilter } from "./filters/StartsWithFilter.js";
|
|
13
|
+
import { ValueFilterRegistry } from "./ValueFilterRegistry.js";
|
|
14
|
+
const ValueFilterFeature = createFeature({
|
|
15
|
+
name: "Db/DynamoDB/ValueFilterFeature",
|
|
16
|
+
register: (container)=>{
|
|
17
|
+
container.register(EqFilter);
|
|
18
|
+
container.register(GtFilter);
|
|
19
|
+
container.register(GteFilter);
|
|
20
|
+
container.register(LtFilter);
|
|
21
|
+
container.register(LteFilter);
|
|
22
|
+
container.register(BetweenFilter);
|
|
23
|
+
container.register(InFilter);
|
|
24
|
+
container.register(AndInFilter);
|
|
25
|
+
container.register(ContainsFilter);
|
|
26
|
+
container.register(FuzzyFilter);
|
|
27
|
+
container.register(StartsWithFilter);
|
|
28
|
+
container.register(ValueFilterRegistry);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export { ValueFilterFeature };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/feature.js","sources":["../../../src/feature/ValueFilter/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { EqFilter } from \"./filters/EqFilter.js\";\nimport { GtFilter } from \"./filters/GtFilter.js\";\nimport { GteFilter } from \"./filters/GteFilter.js\";\nimport { LtFilter } from \"./filters/LtFilter.js\";\nimport { LteFilter } from \"./filters/LteFilter.js\";\nimport { BetweenFilter } from \"./filters/BetweenFilter.js\";\nimport { InFilter } from \"./filters/InFilter.js\";\nimport { AndInFilter } from \"./filters/AndInFilter.js\";\nimport { ContainsFilter } from \"./filters/ContainsFilter.js\";\nimport { FuzzyFilter } from \"./filters/FuzzyFilter.js\";\nimport { StartsWithFilter } from \"./filters/StartsWithFilter.js\";\nimport { ValueFilterRegistry } from \"./ValueFilterRegistry.js\";\n\nexport const ValueFilterFeature = createFeature({\n name: \"Db/DynamoDB/ValueFilterFeature\",\n register: container => {\n container.register(EqFilter);\n container.register(GtFilter);\n container.register(GteFilter);\n container.register(LtFilter);\n container.register(LteFilter);\n container.register(BetweenFilter);\n container.register(InFilter);\n container.register(AndInFilter);\n container.register(ContainsFilter);\n container.register(FuzzyFilter);\n container.register(StartsWithFilter);\n container.register(ValueFilterRegistry);\n }\n});\n"],"names":["ValueFilterFeature","createFeature","container","EqFilter","GtFilter","GteFilter","LtFilter","LteFilter","BetweenFilter","InFilter","AndInFilter","ContainsFilter","FuzzyFilter","StartsWithFilter","ValueFilterRegistry"],"mappings":";;;;;;;;;;;;;AAcO,MAAMA,qBAAqBC,cAAc;IAC5C,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;QACnBL,UAAU,QAAQ,CAACM;QACnBN,UAAU,QAAQ,CAACO;QACnBP,UAAU,QAAQ,CAACQ;QACnBR,UAAU,QAAQ,CAACS;QACnBT,UAAU,QAAQ,CAACU;QACnBV,UAAU,QAAQ,CAACW;QACnBX,UAAU,QAAQ,CAACY;IACvB;AACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
|
+
declare class AndInFilterImpl implements ValueFilter.Interface {
|
|
3
|
+
readonly operation = "and_in";
|
|
4
|
+
is(operation: string): boolean;
|
|
5
|
+
canUse(): boolean;
|
|
6
|
+
matches({ value, compareValue }: ValueFilter.MatchesParams): ValueFilter.Result;
|
|
7
|
+
}
|
|
8
|
+
export declare const AndInFilter: typeof AndInFilterImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/ValueFilter.js").IValueFilter<any, any>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WebinyError } from "@webiny/error";
|
|
2
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
3
|
+
class AndInFilterImpl {
|
|
4
|
+
is(operation) {
|
|
5
|
+
return this.operation === operation;
|
|
6
|
+
}
|
|
7
|
+
canUse() {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
matches({ value, compareValue }) {
|
|
11
|
+
if (!compareValue || false === Array.isArray(compareValue)) throw new WebinyError('The value given as "compareValue" must be an array!', "COMPARE_VALUE_ERROR", {
|
|
12
|
+
value,
|
|
13
|
+
compareValue
|
|
14
|
+
});
|
|
15
|
+
if (true === Array.isArray(value)) return compareValue.every((c)=>value.includes(c));
|
|
16
|
+
return compareValue.includes(value);
|
|
17
|
+
}
|
|
18
|
+
constructor(){
|
|
19
|
+
this.operation = "and_in";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const AndInFilter = ValueFilter.createImplementation({
|
|
23
|
+
implementation: AndInFilterImpl,
|
|
24
|
+
dependencies: []
|
|
25
|
+
});
|
|
26
|
+
export { AndInFilter };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=AndInFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/filters/AndInFilter.js","sources":["../../../../src/feature/ValueFilter/filters/AndInFilter.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { ValueFilter } from \"../abstractions/ValueFilter.js\";\n\nclass AndInFilterImpl implements ValueFilter.Interface {\n public readonly operation = \"and_in\";\n\n public is(operation: string): boolean {\n return this.operation === operation;\n }\n\n public canUse(): boolean {\n return true;\n }\n\n public matches({ value, compareValue }: ValueFilter.MatchesParams): ValueFilter.Result {\n if (!compareValue || Array.isArray(compareValue) === false) {\n throw new WebinyError(\n `The value given as \"compareValue\" must be an array!`,\n \"COMPARE_VALUE_ERROR\",\n {\n value,\n compareValue\n }\n );\n }\n if (Array.isArray(value) === true) {\n return compareValue.every((c: any) => value.includes(c));\n }\n return compareValue.includes(value);\n }\n}\n\nexport const AndInFilter = ValueFilter.createImplementation({\n implementation: AndInFilterImpl,\n dependencies: []\n});\n"],"names":["AndInFilterImpl","operation","value","compareValue","Array","WebinyError","c","AndInFilter","ValueFilter"],"mappings":";;AAGA,MAAMA;IAGK,GAAGC,SAAiB,EAAW;QAClC,OAAO,IAAI,CAAC,SAAS,KAAKA;IAC9B;IAEO,SAAkB;QACrB,OAAO;IACX;IAEO,QAAQ,EAAEC,KAAK,EAAEC,YAAY,EAA6B,EAAsB;QACnF,IAAI,CAACA,gBAAgBC,AAAgC,UAAhCA,MAAM,OAAO,CAACD,eAC/B,MAAM,IAAIE,YACN,uDACA,uBACA;YACIH;YACAC;QACJ;QAGR,IAAIC,AAAyB,SAAzBA,MAAM,OAAO,CAACF,QACd,OAAOC,aAAa,KAAK,CAAC,CAACG,IAAWJ,MAAM,QAAQ,CAACI;QAEzD,OAAOH,aAAa,QAAQ,CAACD;IACjC;;aAzBgB,SAAS,GAAG;;AA0BhC;AAEO,MAAMK,cAAcC,YAAY,oBAAoB,CAAC;IACxD,gBAAgBR;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
|
+
declare class BetweenFilterImpl implements ValueFilter.Interface {
|
|
3
|
+
readonly operation = "between";
|
|
4
|
+
is(operation: string): boolean;
|
|
5
|
+
canUse(): boolean;
|
|
6
|
+
matches({ value, compareValue }: ValueFilter.MatchesParams): ValueFilter.Result;
|
|
7
|
+
}
|
|
8
|
+
export declare const BetweenFilter: typeof BetweenFilterImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/ValueFilter.js").IValueFilter<any, any>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { WebinyError } from "@webiny/error";
|
|
2
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
3
|
+
class BetweenFilterImpl {
|
|
4
|
+
is(operation) {
|
|
5
|
+
return this.operation === operation;
|
|
6
|
+
}
|
|
7
|
+
canUse() {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
matches({ value, compareValue }) {
|
|
11
|
+
if (Array.isArray(compareValue)) {
|
|
12
|
+
if (2 !== compareValue.length) throw new WebinyError("When comparing between and you give an array, there must be two items in it.", "FILTER_ERROR", {
|
|
13
|
+
value,
|
|
14
|
+
compareValue
|
|
15
|
+
});
|
|
16
|
+
const [from, to] = compareValue;
|
|
17
|
+
return value >= from && value <= to;
|
|
18
|
+
}
|
|
19
|
+
return value >= compareValue && value <= compareValue;
|
|
20
|
+
}
|
|
21
|
+
constructor(){
|
|
22
|
+
this.operation = "between";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const BetweenFilter = ValueFilter.createImplementation({
|
|
26
|
+
implementation: BetweenFilterImpl,
|
|
27
|
+
dependencies: []
|
|
28
|
+
});
|
|
29
|
+
export { BetweenFilter };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=BetweenFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/filters/BetweenFilter.js","sources":["../../../../src/feature/ValueFilter/filters/BetweenFilter.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { ValueFilter } from \"../abstractions/ValueFilter.js\";\n\nclass BetweenFilterImpl implements ValueFilter.Interface {\n public readonly operation = \"between\";\n\n public is(operation: string): boolean {\n return this.operation === operation;\n }\n\n public canUse(): boolean {\n return true;\n }\n\n public matches({ value, compareValue }: ValueFilter.MatchesParams): ValueFilter.Result {\n if (Array.isArray(compareValue)) {\n if (compareValue.length !== 2) {\n throw new WebinyError(\n \"When comparing between and you give an array, there must be two items in it.\",\n \"FILTER_ERROR\",\n {\n value,\n compareValue\n }\n );\n }\n const [from, to] = compareValue;\n return value >= from && value <= to;\n }\n return value >= compareValue && value <= compareValue;\n }\n}\n\nexport const BetweenFilter = ValueFilter.createImplementation({\n implementation: BetweenFilterImpl,\n dependencies: []\n});\n"],"names":["BetweenFilterImpl","operation","value","compareValue","Array","WebinyError","from","to","BetweenFilter","ValueFilter"],"mappings":";;AAGA,MAAMA;IAGK,GAAGC,SAAiB,EAAW;QAClC,OAAO,IAAI,CAAC,SAAS,KAAKA;IAC9B;IAEO,SAAkB;QACrB,OAAO;IACX;IAEO,QAAQ,EAAEC,KAAK,EAAEC,YAAY,EAA6B,EAAsB;QACnF,IAAIC,MAAM,OAAO,CAACD,eAAe;YAC7B,IAAIA,AAAwB,MAAxBA,aAAa,MAAM,EACnB,MAAM,IAAIE,YACN,gFACA,gBACA;gBACIH;gBACAC;YACJ;YAGR,MAAM,CAACG,MAAMC,GAAG,GAAGJ;YACnB,OAAOD,SAASI,QAAQJ,SAASK;QACrC;QACA,OAAOL,SAASC,gBAAgBD,SAASC;IAC7C;;aA1BgB,SAAS,GAAG;;AA2BhC;AAEO,MAAMK,gBAAgBC,YAAY,oBAAoB,CAAC;IAC1D,gBAAgBT;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
|
+
declare class ContainsFilterImpl implements ValueFilter.Interface {
|
|
3
|
+
readonly operation = "contains";
|
|
4
|
+
is(operation: string): boolean;
|
|
5
|
+
canUse(): boolean;
|
|
6
|
+
matches({ value: initialValue, compareValue: initialCompareValue }: ValueFilter.MatchesParams): ValueFilter.Result;
|
|
7
|
+
}
|
|
8
|
+
export declare const ContainsFilter: typeof ContainsFilterImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/ValueFilter.js").IValueFilter<any, any>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
|
+
const createValues = (initialValue)=>{
|
|
3
|
+
if ("string" == typeof initialValue) return [
|
|
4
|
+
initialValue
|
|
5
|
+
];
|
|
6
|
+
if (Array.isArray(initialValue)) return initialValue.flat().map((v)=>v.toString()).filter(Boolean);
|
|
7
|
+
const result = [];
|
|
8
|
+
const traverse = (node)=>{
|
|
9
|
+
if (null == node) return;
|
|
10
|
+
if ("string" == typeof node || "number" == typeof node) result.push(node.toString());
|
|
11
|
+
else if (Array.isArray(node)) node.forEach(traverse);
|
|
12
|
+
else if ("object" == typeof node) Object.values(node).forEach(traverse);
|
|
13
|
+
};
|
|
14
|
+
traverse(initialValue);
|
|
15
|
+
return result.filter(Boolean);
|
|
16
|
+
};
|
|
17
|
+
const createCompareValues = (value)=>value.replace(/\s+/g, " ").trim().replace(/\?/g, "\\?").replace(/\//g, "\\/").replace(/:/g, "").replace(/-/g, "\\-").split(" ").filter((val)=>val.length > 0);
|
|
18
|
+
class ContainsFilterImpl {
|
|
19
|
+
is(operation) {
|
|
20
|
+
return this.operation === operation;
|
|
21
|
+
}
|
|
22
|
+
canUse() {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
matches({ value: initialValue, compareValue: initialCompareValue }) {
|
|
26
|
+
if (!initialValue || Array.isArray(initialValue) && 0 === initialValue.length) return false;
|
|
27
|
+
if (null == initialCompareValue) return true;
|
|
28
|
+
const values = createValues(initialValue);
|
|
29
|
+
const compareValues = createCompareValues(initialCompareValue);
|
|
30
|
+
return values.some((target)=>compareValues.every((compareValue)=>null !== target.match(new RegExp(compareValue, "gi"))));
|
|
31
|
+
}
|
|
32
|
+
constructor(){
|
|
33
|
+
this.operation = "contains";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const ContainsFilter = ValueFilter.createImplementation({
|
|
37
|
+
implementation: ContainsFilterImpl,
|
|
38
|
+
dependencies: []
|
|
39
|
+
});
|
|
40
|
+
export { ContainsFilter };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=ContainsFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/filters/ContainsFilter.js","sources":["../../../../src/feature/ValueFilter/filters/ContainsFilter.ts"],"sourcesContent":["import { ValueFilter } from \"../abstractions/ValueFilter.js\";\n\nconst createValues = (initialValue: string | string[] | object): string[] => {\n if (typeof initialValue === \"string\") {\n return [initialValue];\n }\n\n if (Array.isArray(initialValue)) {\n return initialValue\n .flat()\n .map(v => v.toString())\n .filter(Boolean);\n }\n\n const result: string[] = [];\n\n const traverse = (node: any): void => {\n if (node == null) {\n return;\n }\n if (typeof node === \"string\" || typeof node === \"number\") {\n result.push(node.toString());\n } else if (Array.isArray(node)) {\n node.forEach(traverse);\n } else if (typeof node === \"object\") {\n Object.values(node).forEach(traverse);\n }\n };\n\n traverse(initialValue);\n\n return result.filter(Boolean);\n};\n\nconst createCompareValues = (value: string) => {\n return value\n .replace(/\\s+/g, \" \")\n .trim()\n .replace(/\\?/g, `\\\\?`)\n .replace(/\\//g, `\\\\/`)\n .replace(/:/g, ``)\n .replace(/-/g, `\\\\-`)\n .split(\" \")\n .filter(val => {\n return val.length > 0;\n });\n};\n\nclass ContainsFilterImpl implements ValueFilter.Interface {\n public readonly operation = \"contains\";\n\n public is(operation: string): boolean {\n return this.operation === operation;\n }\n\n public canUse(): boolean {\n return true;\n }\n\n public matches({\n value: initialValue,\n compareValue: initialCompareValue\n }: ValueFilter.MatchesParams): ValueFilter.Result {\n if (!initialValue || (Array.isArray(initialValue) && initialValue.length === 0)) {\n return false;\n } else if (initialCompareValue === undefined || initialCompareValue === null) {\n return true;\n }\n const values = createValues(initialValue);\n const compareValues = createCompareValues(initialCompareValue);\n return values.some(target => {\n return compareValues.every(compareValue => {\n return target.match(new RegExp(compareValue, \"gi\")) !== null;\n });\n });\n }\n}\n\nexport const ContainsFilter = ValueFilter.createImplementation({\n implementation: ContainsFilterImpl,\n dependencies: []\n});\n"],"names":["createValues","initialValue","Array","v","Boolean","result","traverse","node","Object","createCompareValues","value","val","ContainsFilterImpl","operation","initialCompareValue","values","compareValues","target","compareValue","RegExp","ContainsFilter","ValueFilter"],"mappings":";AAEA,MAAMA,eAAe,CAACC;IAClB,IAAI,AAAwB,YAAxB,OAAOA,cACP,OAAO;QAACA;KAAa;IAGzB,IAAIC,MAAM,OAAO,CAACD,eACd,OAAOA,aACF,IAAI,GACJ,GAAG,CAACE,CAAAA,IAAKA,EAAE,QAAQ,IACnB,MAAM,CAACC;IAGhB,MAAMC,SAAmB,EAAE;IAE3B,MAAMC,WAAW,CAACC;QACd,IAAIA,AAAQ,QAARA,MACA;QAEJ,IAAI,AAAgB,YAAhB,OAAOA,QAAqB,AAAgB,YAAhB,OAAOA,MACnCF,OAAO,IAAI,CAACE,KAAK,QAAQ;aACtB,IAAIL,MAAM,OAAO,CAACK,OACrBA,KAAK,OAAO,CAACD;aACV,IAAI,AAAgB,YAAhB,OAAOC,MACdC,OAAO,MAAM,CAACD,MAAM,OAAO,CAACD;IAEpC;IAEAA,SAASL;IAET,OAAOI,OAAO,MAAM,CAACD;AACzB;AAEA,MAAMK,sBAAsB,CAACC,QAClBA,MACF,OAAO,CAAC,QAAQ,KAChB,IAAI,GACJ,OAAO,CAAC,OAAO,OACf,OAAO,CAAC,OAAO,OACf,OAAO,CAAC,MAAM,IACd,OAAO,CAAC,MAAM,OACd,KAAK,CAAC,KACN,MAAM,CAACC,CAAAA,MACGA,IAAI,MAAM,GAAG;AAIhC,MAAMC;IAGK,GAAGC,SAAiB,EAAW;QAClC,OAAO,IAAI,CAAC,SAAS,KAAKA;IAC9B;IAEO,SAAkB;QACrB,OAAO;IACX;IAEO,QAAQ,EACX,OAAOZ,YAAY,EACnB,cAAca,mBAAmB,EACT,EAAsB;QAC9C,IAAI,CAACb,gBAAiBC,MAAM,OAAO,CAACD,iBAAiBA,AAAwB,MAAxBA,aAAa,MAAM,EACpE,OAAO;QACJ,IAAIa,QAAAA,qBACP,OAAO;QAEX,MAAMC,SAASf,aAAaC;QAC5B,MAAMe,gBAAgBP,oBAAoBK;QAC1C,OAAOC,OAAO,IAAI,CAACE,CAAAA,SACRD,cAAc,KAAK,CAACE,CAAAA,eAChBD,AAAiD,SAAjDA,OAAO,KAAK,CAAC,IAAIE,OAAOD,cAAc;IAGzD;;aA1BgB,SAAS,GAAG;;AA2BhC;AAEO,MAAME,iBAAiBC,YAAY,oBAAoB,CAAC;IAC3D,gBAAgBT;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
|
+
declare class EqFilterImpl implements ValueFilter.Interface {
|
|
3
|
+
readonly operation = "eq";
|
|
4
|
+
is(operation: string): boolean;
|
|
5
|
+
canUse(): boolean;
|
|
6
|
+
matches({ value, compareValue }: ValueFilter.MatchesParams): ValueFilter.Result;
|
|
7
|
+
}
|
|
8
|
+
export declare const EqFilter: typeof EqFilterImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/ValueFilter.js").IValueFilter<any, any>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
|
+
class EqFilterImpl {
|
|
3
|
+
is(operation) {
|
|
4
|
+
return this.operation === operation;
|
|
5
|
+
}
|
|
6
|
+
canUse() {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
matches({ value, compareValue }) {
|
|
10
|
+
if (true === Array.isArray(value)) return value.some((v)=>Array.isArray(compareValue) ? compareValue.includes(v) : compareValue === v);
|
|
11
|
+
if (true === Array.isArray(compareValue)) return compareValue.every((v)=>value == v);
|
|
12
|
+
return value == compareValue;
|
|
13
|
+
}
|
|
14
|
+
constructor(){
|
|
15
|
+
this.operation = "eq";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const EqFilter = ValueFilter.createImplementation({
|
|
19
|
+
implementation: EqFilterImpl,
|
|
20
|
+
dependencies: []
|
|
21
|
+
});
|
|
22
|
+
export { EqFilter };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=EqFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/filters/EqFilter.js","sources":["../../../../src/feature/ValueFilter/filters/EqFilter.ts"],"sourcesContent":["import { ValueFilter } from \"../abstractions/ValueFilter.js\";\n\nclass EqFilterImpl implements ValueFilter.Interface {\n public readonly operation = \"eq\";\n\n public is(operation: string): boolean {\n return this.operation === operation;\n }\n\n public canUse(): boolean {\n return true;\n }\n\n public matches({ value, compareValue }: ValueFilter.MatchesParams): ValueFilter.Result {\n /**\n * Possibility that either input value or one from the system is array.\n */\n if (Array.isArray(value) === true) {\n return value.some((v: string) => {\n return Array.isArray(compareValue) ? compareValue.includes(v) : compareValue === v;\n });\n } else if (Array.isArray(compareValue) === true) {\n return compareValue.every((v: string) => {\n return value == v;\n });\n }\n return value == compareValue;\n }\n}\n\nexport const EqFilter = ValueFilter.createImplementation({\n implementation: EqFilterImpl,\n dependencies: []\n});\n"],"names":["EqFilterImpl","operation","value","compareValue","Array","v","EqFilter","ValueFilter"],"mappings":";AAEA,MAAMA;IAGK,GAAGC,SAAiB,EAAW;QAClC,OAAO,IAAI,CAAC,SAAS,KAAKA;IAC9B;IAEO,SAAkB;QACrB,OAAO;IACX;IAEO,QAAQ,EAAEC,KAAK,EAAEC,YAAY,EAA6B,EAAsB;QAInF,IAAIC,AAAyB,SAAzBA,MAAM,OAAO,CAACF,QACd,OAAOA,MAAM,IAAI,CAAC,CAACG,IACRD,MAAM,OAAO,CAACD,gBAAgBA,aAAa,QAAQ,CAACE,KAAKF,iBAAiBE;QAElF,IAAID,AAAgC,SAAhCA,MAAM,OAAO,CAACD,eACrB,OAAOA,aAAa,KAAK,CAAC,CAACE,IAChBH,SAASG;QAGxB,OAAOH,SAASC;IACpB;;aAxBgB,SAAS,GAAG;;AAyBhC;AAEO,MAAMG,WAAWC,YAAY,oBAAoB,CAAC;IACrD,gBAAgBP;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
|
+
declare class FuzzyFilterImpl implements ValueFilter.Interface<string | null | undefined> {
|
|
3
|
+
readonly operation = "fuzzy";
|
|
4
|
+
is(operation: string): boolean;
|
|
5
|
+
canUse(): boolean;
|
|
6
|
+
matches({ value: initialValue, compareValue: initialCompareValue }: ValueFilter.MatchesParams): ValueFilter.Result;
|
|
7
|
+
}
|
|
8
|
+
export declare const FuzzyFilter: typeof FuzzyFilterImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/ValueFilter.js").IValueFilter<any, any>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import fuse from "fuse.js";
|
|
2
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
3
|
+
class FuzzyFilterImpl {
|
|
4
|
+
is(operation) {
|
|
5
|
+
return this.operation === operation;
|
|
6
|
+
}
|
|
7
|
+
canUse() {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
matches({ value: initialValue, compareValue: initialCompareValue }) {
|
|
11
|
+
if ("string" != typeof initialValue || "string" != typeof initialCompareValue) return false;
|
|
12
|
+
const value = initialValue.replaceAll("/", " ");
|
|
13
|
+
const compareValue = initialCompareValue.replaceAll("/", " ");
|
|
14
|
+
const f = new fuse([
|
|
15
|
+
value
|
|
16
|
+
], {
|
|
17
|
+
includeScore: true,
|
|
18
|
+
minMatchCharLength: 3,
|
|
19
|
+
threshold: 0.5,
|
|
20
|
+
isCaseSensitive: false,
|
|
21
|
+
findAllMatches: true,
|
|
22
|
+
ignoreLocation: true
|
|
23
|
+
});
|
|
24
|
+
const result = f.search(compareValue);
|
|
25
|
+
return result.length > 0;
|
|
26
|
+
}
|
|
27
|
+
constructor(){
|
|
28
|
+
this.operation = "fuzzy";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const FuzzyFilter = ValueFilter.createImplementation({
|
|
32
|
+
implementation: FuzzyFilterImpl,
|
|
33
|
+
dependencies: []
|
|
34
|
+
});
|
|
35
|
+
export { FuzzyFilter };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=FuzzyFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/filters/FuzzyFilter.js","sources":["../../../../src/feature/ValueFilter/filters/FuzzyFilter.ts"],"sourcesContent":["import Fuse from \"fuse.js\";\nimport { ValueFilter } from \"../abstractions/ValueFilter.js\";\n\nclass FuzzyFilterImpl implements ValueFilter.Interface<string | null | undefined> {\n public readonly operation = \"fuzzy\";\n\n public is(operation: string): boolean {\n return this.operation === operation;\n }\n\n public canUse(): boolean {\n return true;\n }\n\n public matches({\n value: initialValue,\n compareValue: initialCompareValue\n }: ValueFilter.MatchesParams): ValueFilter.Result {\n if (typeof initialValue !== \"string\" || typeof initialCompareValue !== \"string\") {\n return false;\n }\n const value = initialValue.replaceAll(\"/\", \" \");\n const compareValue = initialCompareValue.replaceAll(\"/\", \" \");\n\n const f = new Fuse([value], {\n includeScore: true,\n minMatchCharLength: 3,\n threshold: 0.5,\n isCaseSensitive: false,\n findAllMatches: true,\n ignoreLocation: true\n });\n const result = f.search(compareValue);\n\n return result.length > 0;\n }\n}\n\nexport const FuzzyFilter = ValueFilter.createImplementation({\n implementation: FuzzyFilterImpl,\n dependencies: []\n});\n"],"names":["FuzzyFilterImpl","operation","initialValue","initialCompareValue","value","compareValue","f","Fuse","result","FuzzyFilter","ValueFilter"],"mappings":";;AAGA,MAAMA;IAGK,GAAGC,SAAiB,EAAW;QAClC,OAAO,IAAI,CAAC,SAAS,KAAKA;IAC9B;IAEO,SAAkB;QACrB,OAAO;IACX;IAEO,QAAQ,EACX,OAAOC,YAAY,EACnB,cAAcC,mBAAmB,EACT,EAAsB;QAC9C,IAAI,AAAwB,YAAxB,OAAOD,gBAA6B,AAA+B,YAA/B,OAAOC,qBAC3C,OAAO;QAEX,MAAMC,QAAQF,aAAa,UAAU,CAAC,KAAK;QAC3C,MAAMG,eAAeF,oBAAoB,UAAU,CAAC,KAAK;QAEzD,MAAMG,IAAI,IAAIC,KAAK;YAACH;SAAM,EAAE;YACxB,cAAc;YACd,oBAAoB;YACpB,WAAW;YACX,iBAAiB;YACjB,gBAAgB;YAChB,gBAAgB;QACpB;QACA,MAAMI,SAASF,EAAE,MAAM,CAACD;QAExB,OAAOG,OAAO,MAAM,GAAG;IAC3B;;aA/BgB,SAAS,GAAG;;AAgChC;AAEO,MAAMC,cAAcC,YAAY,oBAAoB,CAAC;IACxD,gBAAgBV;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
|
+
declare class GtFilterImpl implements ValueFilter.Interface {
|
|
3
|
+
readonly operation = "gt";
|
|
4
|
+
is(operation: string): boolean;
|
|
5
|
+
canUse(): boolean;
|
|
6
|
+
matches({ value, compareValue }: ValueFilter.MatchesParams): ValueFilter.Result;
|
|
7
|
+
}
|
|
8
|
+
export declare const GtFilter: typeof GtFilterImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions/ValueFilter.js").IValueFilter<any, any>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|