@webiny/db-dynamodb 6.3.0-beta.4 → 6.4.0-beta.0
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.js +0 -2
- package/feature/FilterUtil/FilterUtil.js +18 -20
- package/feature/FilterUtil/FilterUtil.js.map +1 -1
- package/feature/FilterUtil/abstractions/FilterUtil.js +2 -1
- package/feature/FilterUtil/abstractions/FilterUtil.js.map +1 -1
- package/feature/FilterUtil/createFilters.js +82 -120
- package/feature/FilterUtil/createFilters.js.map +1 -1
- package/feature/FilterUtil/extractWhereArgs.js +15 -19
- package/feature/FilterUtil/extractWhereArgs.js.map +1 -1
- package/feature/FilterUtil/feature.js +6 -5
- package/feature/FilterUtil/feature.js.map +1 -1
- package/feature/FilterUtil/index.js +0 -2
- package/feature/ValueFilter/ValueFilterRegistry.js +21 -17
- package/feature/ValueFilter/ValueFilterRegistry.js.map +1 -1
- package/feature/ValueFilter/abstractions/ValueFilter.js +2 -1
- package/feature/ValueFilter/abstractions/ValueFilter.js.map +1 -1
- package/feature/ValueFilter/abstractions/ValueFilterRegistry.js +2 -1
- package/feature/ValueFilter/abstractions/ValueFilterRegistry.js.map +1 -1
- package/feature/ValueFilter/feature.js +17 -16
- package/feature/ValueFilter/feature.js.map +1 -1
- package/feature/ValueFilter/filters/AndInFilter.js +19 -23
- package/feature/ValueFilter/filters/AndInFilter.js.map +1 -1
- package/feature/ValueFilter/filters/BetweenFilter.js +23 -25
- package/feature/ValueFilter/filters/BetweenFilter.js.map +1 -1
- package/feature/ValueFilter/filters/ContainsFilter.js +34 -53
- package/feature/ValueFilter/filters/ContainsFilter.js.map +1 -1
- package/feature/ValueFilter/filters/EqFilter.js +17 -27
- package/feature/ValueFilter/filters/EqFilter.js.map +1 -1
- package/feature/ValueFilter/filters/FuzzyFilter.js +30 -30
- package/feature/ValueFilter/filters/FuzzyFilter.js.map +1 -1
- package/feature/ValueFilter/filters/GtFilter.js +16 -16
- package/feature/ValueFilter/filters/GtFilter.js.map +1 -1
- package/feature/ValueFilter/filters/GteFilter.js +16 -16
- package/feature/ValueFilter/filters/GteFilter.js.map +1 -1
- package/feature/ValueFilter/filters/InFilter.js +19 -23
- package/feature/ValueFilter/filters/InFilter.js.map +1 -1
- package/feature/ValueFilter/filters/LtFilter.js +16 -16
- package/feature/ValueFilter/filters/LtFilter.js.map +1 -1
- package/feature/ValueFilter/filters/LteFilter.js +16 -16
- package/feature/ValueFilter/filters/LteFilter.js.map +1 -1
- package/feature/ValueFilter/filters/StartsWithFilter.js +20 -36
- package/feature/ValueFilter/filters/StartsWithFilter.js.map +1 -1
- package/feature/ValueFilter/index.js +0 -2
- package/index.js +7 -9
- package/index.js.map +1 -1
- package/package.json +13 -13
- package/plugins/definitions/DateTimeTransformPlugin.js +18 -30
- 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.js +18 -17
- 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.js +0 -2
- 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.js +0 -5
- 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 -14
- 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.js +85 -90
- 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.js +1 -3
- package/utils/put.js +7 -9
- package/utils/put.js.map +1 -1
- package/utils/query.js +77 -129
- 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/exports/api/db.js.map +0 -1
- package/feature/FilterUtil/index.js.map +0 -1
- package/feature/ValueFilter/index.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/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/index.js.map +0 -1
- package/utils/table/index.js.map +0 -1
- package/utils/table/types.js.map +0 -1
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
import { WebinyError } from "@webiny/error";
|
|
2
2
|
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
3
3
|
class BetweenFilterImpl {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return value >= from && value <= to;
|
|
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";
|
|
24
23
|
}
|
|
25
|
-
return value >= compareValue && value <= compareValue;
|
|
26
|
-
}
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
const BetweenFilter = ValueFilter.createImplementation({
|
|
26
|
+
implementation: BetweenFilterImpl,
|
|
27
|
+
dependencies: []
|
|
31
28
|
});
|
|
29
|
+
export { BetweenFilter };
|
|
32
30
|
|
|
33
31
|
//# sourceMappingURL=BetweenFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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"}
|
|
@@ -1,61 +1,42 @@
|
|
|
1
1
|
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
|
-
const createValues = initialValue
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} else if (Array.isArray(node)) {
|
|
17
|
-
node.forEach(traverse);
|
|
18
|
-
} else if (typeof node === "object") {
|
|
19
|
-
Object.values(node).forEach(traverse);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
traverse(initialValue);
|
|
23
|
-
return result.filter(Boolean);
|
|
24
|
-
};
|
|
25
|
-
const createCompareValues = value => {
|
|
26
|
-
return value.replace(/\s+/g, " ").trim().replace(/\?/g, `\\?`).replace(/\//g, `\\/`).replace(/:/g, ``).replace(/-/g, `\\-`).split(" ").filter(val => {
|
|
27
|
-
return val.length > 0;
|
|
28
|
-
});
|
|
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);
|
|
29
16
|
};
|
|
17
|
+
const createCompareValues = (value)=>value.replace(/\s+/g, " ").trim().replace(/\?/g, "\\?").replace(/\//g, "\\/").replace(/:/g, "").replace(/-/g, "\\-").split(" ").filter((val)=>val.length > 0);
|
|
30
18
|
class ContainsFilterImpl {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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";
|
|
46
34
|
}
|
|
47
|
-
const values = createValues(initialValue);
|
|
48
|
-
const compareValues = createCompareValues(initialCompareValue);
|
|
49
|
-
return values.some(target => {
|
|
50
|
-
return compareValues.every(compareValue => {
|
|
51
|
-
return target.match(new RegExp(compareValue, "gi")) !== null;
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
35
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
36
|
+
const ContainsFilter = ValueFilter.createImplementation({
|
|
37
|
+
implementation: ContainsFilterImpl,
|
|
38
|
+
dependencies: []
|
|
59
39
|
});
|
|
40
|
+
export { ContainsFilter };
|
|
60
41
|
|
|
61
42
|
//# sourceMappingURL=ContainsFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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"}
|
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
2
|
class EqFilterImpl {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
if (Array.isArray(value) === true) {
|
|
18
|
-
return value.some(v => {
|
|
19
|
-
return Array.isArray(compareValue) ? compareValue.includes(v) : compareValue === v;
|
|
20
|
-
});
|
|
21
|
-
} else if (Array.isArray(compareValue) === true) {
|
|
22
|
-
return compareValue.every(v => {
|
|
23
|
-
return value == v;
|
|
24
|
-
});
|
|
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";
|
|
25
16
|
}
|
|
26
|
-
return value == compareValue;
|
|
27
|
-
}
|
|
28
17
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
const EqFilter = ValueFilter.createImplementation({
|
|
19
|
+
implementation: EqFilterImpl,
|
|
20
|
+
dependencies: []
|
|
32
21
|
});
|
|
22
|
+
export { EqFilter };
|
|
33
23
|
|
|
34
24
|
//# sourceMappingURL=EqFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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"}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fuse from "fuse.js";
|
|
2
2
|
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
3
3
|
class FuzzyFilterImpl {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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";
|
|
17
29
|
}
|
|
18
|
-
const value = initialValue.replaceAll("/", " ");
|
|
19
|
-
const compareValue = initialCompareValue.replaceAll("/", " ");
|
|
20
|
-
const f = new Fuse([value], {
|
|
21
|
-
includeScore: true,
|
|
22
|
-
minMatchCharLength: 3,
|
|
23
|
-
threshold: 0.5,
|
|
24
|
-
isCaseSensitive: false,
|
|
25
|
-
findAllMatches: true,
|
|
26
|
-
ignoreLocation: true
|
|
27
|
-
});
|
|
28
|
-
const result = f.search(compareValue);
|
|
29
|
-
return result.length > 0;
|
|
30
|
-
}
|
|
31
30
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const FuzzyFilter = ValueFilter.createImplementation({
|
|
32
|
+
implementation: FuzzyFilterImpl,
|
|
33
|
+
dependencies: []
|
|
35
34
|
});
|
|
35
|
+
export { FuzzyFilter };
|
|
36
36
|
|
|
37
37
|
//# sourceMappingURL=FuzzyFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
2
|
class GtFilterImpl {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
3
|
+
is(operation) {
|
|
4
|
+
return this.operation === operation;
|
|
5
|
+
}
|
|
6
|
+
canUse() {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
matches({ value, compareValue }) {
|
|
10
|
+
return value > compareValue;
|
|
11
|
+
}
|
|
12
|
+
constructor(){
|
|
13
|
+
this.operation = "gt";
|
|
14
|
+
}
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const GtFilter = ValueFilter.createImplementation({
|
|
17
|
+
implementation: GtFilterImpl,
|
|
18
|
+
dependencies: []
|
|
20
19
|
});
|
|
20
|
+
export { GtFilter };
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=GtFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/filters/GtFilter.js","sources":["../../../../src/feature/ValueFilter/filters/GtFilter.ts"],"sourcesContent":["import { ValueFilter } from \"../abstractions/ValueFilter.js\";\n\nclass GtFilterImpl implements ValueFilter.Interface {\n public readonly operation = \"gt\";\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 return value > compareValue;\n }\n}\n\nexport const GtFilter = ValueFilter.createImplementation({\n implementation: GtFilterImpl,\n dependencies: []\n});\n"],"names":["GtFilterImpl","operation","value","compareValue","GtFilter","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;QACnF,OAAOD,QAAQC;IACnB;;aAZgB,SAAS,GAAG;;AAahC;AAEO,MAAMC,WAAWC,YAAY,oBAAoB,CAAC;IACrD,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
2
|
class GteFilterImpl {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
3
|
+
is(operation) {
|
|
4
|
+
return this.operation === operation;
|
|
5
|
+
}
|
|
6
|
+
canUse() {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
matches({ value, compareValue }) {
|
|
10
|
+
return value >= compareValue;
|
|
11
|
+
}
|
|
12
|
+
constructor(){
|
|
13
|
+
this.operation = "gte";
|
|
14
|
+
}
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const GteFilter = ValueFilter.createImplementation({
|
|
17
|
+
implementation: GteFilterImpl,
|
|
18
|
+
dependencies: []
|
|
20
19
|
});
|
|
20
|
+
export { GteFilter };
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=GteFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/filters/GteFilter.js","sources":["../../../../src/feature/ValueFilter/filters/GteFilter.ts"],"sourcesContent":["import { ValueFilter } from \"../abstractions/ValueFilter.js\";\n\nclass GteFilterImpl implements ValueFilter.Interface {\n public readonly operation = \"gte\";\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 return value >= compareValue;\n }\n}\n\nexport const GteFilter = ValueFilter.createImplementation({\n implementation: GteFilterImpl,\n dependencies: []\n});\n"],"names":["GteFilterImpl","operation","value","compareValue","GteFilter","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;QACnF,OAAOD,SAASC;IACpB;;aAZgB,SAAS,GAAG;;AAahC;AAEO,MAAMC,YAAYC,YAAY,oBAAoB,CAAC;IACtD,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
import { WebinyError } from "@webiny/error";
|
|
2
2
|
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
3
3
|
class InFilterImpl {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return this.operation === operation;
|
|
7
|
-
}
|
|
8
|
-
canUse() {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
matches({
|
|
12
|
-
value,
|
|
13
|
-
compareValue
|
|
14
|
-
}) {
|
|
15
|
-
if (!compareValue || Array.isArray(compareValue) === false) {
|
|
16
|
-
throw new WebinyError(`The value given as "compareValue" must be an array!`, "COMPARE_VALUE_ERROR", {
|
|
17
|
-
value,
|
|
18
|
-
compareValue
|
|
19
|
-
});
|
|
4
|
+
is(operation) {
|
|
5
|
+
return this.operation === operation;
|
|
20
6
|
}
|
|
21
|
-
|
|
22
|
-
|
|
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.some((c)=>value.includes(c));
|
|
16
|
+
return compareValue.includes(value);
|
|
17
|
+
}
|
|
18
|
+
constructor(){
|
|
19
|
+
this.operation = "in";
|
|
23
20
|
}
|
|
24
|
-
return compareValue.includes(value);
|
|
25
|
-
}
|
|
26
21
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
const InFilter = ValueFilter.createImplementation({
|
|
23
|
+
implementation: InFilterImpl,
|
|
24
|
+
dependencies: []
|
|
30
25
|
});
|
|
26
|
+
export { InFilter };
|
|
31
27
|
|
|
32
28
|
//# sourceMappingURL=InFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/filters/InFilter.js","sources":["../../../../src/feature/ValueFilter/filters/InFilter.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { ValueFilter } from \"../abstractions/ValueFilter.js\";\n\nclass InFilterImpl implements ValueFilter.Interface {\n public readonly operation = \"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.some((c: any) => value.includes(c));\n }\n return compareValue.includes(value);\n }\n}\n\nexport const InFilter = ValueFilter.createImplementation({\n implementation: InFilterImpl,\n dependencies: []\n});\n"],"names":["InFilterImpl","operation","value","compareValue","Array","WebinyError","c","InFilter","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,IAAI,CAAC,CAACG,IAAWJ,MAAM,QAAQ,CAACI;QAExD,OAAOH,aAAa,QAAQ,CAACD;IACjC;;aAzBgB,SAAS,GAAG;;AA0BhC;AAEO,MAAMK,WAAWC,YAAY,oBAAoB,CAAC;IACrD,gBAAgBR;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
2
|
class LtFilterImpl {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
3
|
+
is(operation) {
|
|
4
|
+
return this.operation === operation;
|
|
5
|
+
}
|
|
6
|
+
canUse() {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
matches({ value, compareValue }) {
|
|
10
|
+
return value < compareValue;
|
|
11
|
+
}
|
|
12
|
+
constructor(){
|
|
13
|
+
this.operation = "lt";
|
|
14
|
+
}
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const LtFilter = ValueFilter.createImplementation({
|
|
17
|
+
implementation: LtFilterImpl,
|
|
18
|
+
dependencies: []
|
|
20
19
|
});
|
|
20
|
+
export { LtFilter };
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=LtFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"feature/ValueFilter/filters/LtFilter.js","sources":["../../../../src/feature/ValueFilter/filters/LtFilter.ts"],"sourcesContent":["import { ValueFilter } from \"../abstractions/ValueFilter.js\";\n\nclass LtFilterImpl implements ValueFilter.Interface {\n public readonly operation = \"lt\";\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 return value < compareValue;\n }\n}\n\nexport const LtFilter = ValueFilter.createImplementation({\n implementation: LtFilterImpl,\n dependencies: []\n});\n"],"names":["LtFilterImpl","operation","value","compareValue","LtFilter","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;QACnF,OAAOD,QAAQC;IACnB;;aAZgB,SAAS,GAAG;;AAahC;AAEO,MAAMC,WAAWC,YAAY,oBAAoB,CAAC;IACrD,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
2
2
|
class LteFilterImpl {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
3
|
+
is(operation) {
|
|
4
|
+
return this.operation === operation;
|
|
5
|
+
}
|
|
6
|
+
canUse() {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
matches({ value, compareValue }) {
|
|
10
|
+
return value <= compareValue;
|
|
11
|
+
}
|
|
12
|
+
constructor(){
|
|
13
|
+
this.operation = "lte";
|
|
14
|
+
}
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const LteFilter = ValueFilter.createImplementation({
|
|
17
|
+
implementation: LteFilterImpl,
|
|
18
|
+
dependencies: []
|
|
20
19
|
});
|
|
20
|
+
export { LteFilter };
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=LteFilter.js.map
|