@webiny/db-dynamodb 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7
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.d.ts +4 -8
- package/DynamoDbDriver.js +71 -102
- package/DynamoDbDriver.js.map +1 -1
- package/README.md +6 -142
- package/exports/api/db.d.ts +2 -0
- package/exports/api/db.js +4 -0
- package/exports/api/db.js.map +1 -0
- package/feature/FilterUtil/FilterUtil.d.ts +11 -0
- package/feature/FilterUtil/FilterUtil.js +28 -0
- package/feature/FilterUtil/FilterUtil.js.map +1 -0
- package/feature/FilterUtil/abstractions/FilterUtil.d.ts +17 -0
- package/feature/FilterUtil/abstractions/FilterUtil.js +4 -0
- package/feature/FilterUtil/abstractions/FilterUtil.js.map +1 -0
- package/feature/FilterUtil/createFilters.d.ts +22 -0
- package/{utils/filter.js → feature/FilterUtil/createFilters.js} +23 -74
- package/feature/FilterUtil/createFilters.js.map +1 -0
- package/feature/FilterUtil/extractWhereArgs.d.ts +7 -0
- package/feature/FilterUtil/extractWhereArgs.js +24 -0
- package/feature/FilterUtil/extractWhereArgs.js.map +1 -0
- package/feature/FilterUtil/feature.d.ts +4 -0
- package/feature/FilterUtil/feature.js +10 -0
- package/feature/FilterUtil/feature.js.map +1 -0
- package/feature/FilterUtil/index.d.ts +2 -0
- package/feature/FilterUtil/index.js +4 -0
- package/feature/FilterUtil/index.js.map +1 -0
- package/feature/ValueFilter/ValueFilterRegistry.d.ts +12 -0
- package/feature/ValueFilter/ValueFilterRegistry.js +23 -0
- package/feature/ValueFilter/ValueFilterRegistry.js.map +1 -0
- package/feature/ValueFilter/abstractions/ValueFilter.d.ts +22 -0
- package/feature/ValueFilter/abstractions/ValueFilter.js +4 -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 +4 -0
- package/feature/ValueFilter/abstractions/ValueFilterRegistry.js.map +1 -0
- package/feature/ValueFilter/feature.d.ts +4 -0
- package/feature/ValueFilter/feature.js +32 -0
- package/feature/ValueFilter/feature.js.map +1 -0
- package/feature/ValueFilter/filters/AndInFilter.d.ts +11 -0
- package/feature/ValueFilter/filters/AndInFilter.js +32 -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 +33 -0
- package/feature/ValueFilter/filters/BetweenFilter.js.map +1 -0
- package/feature/ValueFilter/filters/ContainsFilter.d.ts +11 -0
- package/{plugins/filters/contains.js → feature/ValueFilter/filters/ContainsFilter.js} +17 -15
- package/feature/ValueFilter/filters/ContainsFilter.js.map +1 -0
- package/feature/ValueFilter/filters/EqFilter.d.ts +11 -0
- package/{plugins/filters/eq.js → feature/ValueFilter/filters/EqFilter.js} +16 -14
- 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 +32 -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/{plugins/filters/startsWith.js → feature/ValueFilter/filters/StartsWithFilter.js} +22 -17
- package/feature/ValueFilter/filters/StartsWithFilter.js.map +1 -0
- package/feature/ValueFilter/index.d.ts +3 -0
- package/feature/ValueFilter/index.js +5 -0
- package/feature/ValueFilter/index.js.map +1 -0
- package/index.d.ts +5 -3
- package/index.js +12 -27
- package/index.js.map +1 -1
- package/package.json +26 -22
- package/plugins/definitions/DateTimeTransformPlugin.d.ts +2 -2
- package/plugins/definitions/DateTimeTransformPlugin.js +9 -14
- package/plugins/definitions/DateTimeTransformPlugin.js.map +1 -1
- package/plugins/definitions/FieldPlugin.d.ts +1 -1
- package/plugins/definitions/FieldPlugin.js +2 -9
- package/plugins/definitions/FieldPlugin.js.map +1 -1
- package/plugins/definitions/TimeTransformPlugin.d.ts +2 -2
- package/plugins/definitions/TimeTransformPlugin.js +7 -15
- package/plugins/definitions/TimeTransformPlugin.js.map +1 -1
- package/plugins/definitions/ValueTransformPlugin.d.ts +1 -6
- package/plugins/definitions/ValueTransformPlugin.js +6 -20
- package/plugins/definitions/ValueTransformPlugin.js.map +1 -1
- package/plugins/definitions/assignFields.js +4 -12
- package/plugins/definitions/assignFields.js.map +1 -1
- package/plugins/index.d.ts +5 -2
- package/plugins/index.js +5 -15
- package/plugins/index.js.map +1 -1
- package/store/entity.d.ts +4 -76
- package/store/entity.js +5 -35
- package/store/entity.js.map +1 -1
- package/store/keys.d.ts +1 -1
- package/store/keys.js +7 -13
- package/store/keys.js.map +1 -1
- package/store/types.d.ts +3 -4
- package/store/types.js +1 -5
- package/store/types.js.map +1 -1
- package/toolbox.d.ts +59 -2
- package/toolbox.js +3 -17
- package/toolbox.js.map +1 -1
- package/types.js +1 -5
- package/utils/batch/batchRead.d.ts +2 -2
- package/utils/batch/batchRead.js +5 -13
- package/utils/batch/batchRead.js.map +1 -1
- package/utils/batch/batchWrite.d.ts +2 -2
- package/utils/batch/batchWrite.js +3 -11
- package/utils/batch/batchWrite.js.map +1 -1
- package/utils/batch/index.d.ts +3 -3
- package/utils/batch/index.js +3 -38
- package/utils/batch/index.js.map +1 -1
- package/utils/batch/types.d.ts +7 -2
- package/utils/batch/types.js +1 -5
- package/utils/batch/types.js.map +1 -1
- package/utils/cleanup.d.ts +1 -1
- package/utils/cleanup.js +3 -10
- package/utils/cleanup.js.map +1 -1
- package/utils/count.d.ts +1 -1
- package/utils/count.js +2 -8
- package/utils/count.js.map +1 -1
- package/utils/createEntity.d.ts +36 -54
- package/utils/createEntity.js +75 -51
- package/utils/createEntity.js.map +1 -1
- package/utils/createTable.d.ts +10 -7
- package/utils/createTable.js +25 -15
- package/utils/createTable.js.map +1 -1
- package/utils/cursor.js +2 -10
- package/utils/cursor.js.map +1 -1
- package/utils/delete.d.ts +1 -1
- package/utils/delete.js +1 -8
- package/utils/delete.js.map +1 -1
- package/utils/entity/Entity.d.ts +24 -22
- package/utils/entity/Entity.js +57 -34
- package/utils/entity/Entity.js.map +1 -1
- package/utils/entity/EntityReadBatch.d.ts +9 -8
- package/utils/entity/EntityReadBatch.js +14 -16
- package/utils/entity/EntityReadBatch.js.map +1 -1
- package/utils/entity/EntityReadBatchBuilder.d.ts +4 -4
- package/utils/entity/EntityReadBatchBuilder.js +7 -15
- package/utils/entity/EntityReadBatchBuilder.js.map +1 -1
- package/utils/entity/EntityWriteBatch.d.ts +9 -8
- package/utils/entity/EntityWriteBatch.js +10 -18
- package/utils/entity/EntityWriteBatch.js.map +1 -1
- package/utils/entity/EntityWriteBatchBuilder.d.ts +4 -4
- package/utils/entity/EntityWriteBatchBuilder.js +4 -12
- package/utils/entity/EntityWriteBatchBuilder.js.map +1 -1
- package/utils/entity/getEntity.d.ts +2 -2
- package/utils/entity/getEntity.js +3 -10
- package/utils/entity/getEntity.js.map +1 -1
- package/utils/entity/index.d.ts +7 -7
- package/utils/entity/index.js +7 -82
- package/utils/entity/index.js.map +1 -1
- package/utils/entity/types.d.ts +46 -22
- package/utils/entity/types.js +2 -5
- package/utils/entity/types.js.map +1 -1
- package/utils/get.d.ts +1 -1
- package/utils/get.js +4 -12
- package/utils/get.js.map +1 -1
- package/utils/index.d.ts +13 -17
- package/utils/index.js +13 -192
- package/utils/index.js.map +1 -1
- package/utils/put.d.ts +2 -2
- package/utils/put.js +1 -8
- package/utils/put.js.map +1 -1
- package/utils/query.d.ts +5 -12
- package/utils/query.js +14 -27
- package/utils/query.js.map +1 -1
- package/utils/scan.d.ts +2 -2
- package/utils/scan.js +5 -13
- package/utils/scan.js.map +1 -1
- package/utils/sort.d.ts +1 -1
- package/utils/sort.js +7 -14
- package/utils/sort.js.map +1 -1
- package/utils/table/Table.d.ts +4 -5
- package/utils/table/Table.js +9 -20
- package/utils/table/Table.js.map +1 -1
- package/utils/table/TableReadBatch.d.ts +4 -4
- package/utils/table/TableReadBatch.js +8 -16
- package/utils/table/TableReadBatch.js.map +1 -1
- package/utils/table/TableWriteBatch.d.ts +3 -3
- package/utils/table/TableWriteBatch.js +6 -14
- package/utils/table/TableWriteBatch.js.map +1 -1
- package/utils/table/index.d.ts +4 -4
- package/utils/table/index.js +4 -49
- package/utils/table/index.js.map +1 -1
- package/utils/table/types.d.ts +8 -8
- package/utils/table/types.js +1 -5
- package/utils/table/types.js.map +1 -1
- package/plugins/definitions/AttributePlugin.d.ts +0 -18
- package/plugins/definitions/AttributePlugin.js +0 -46
- package/plugins/definitions/AttributePlugin.js.map +0 -1
- package/plugins/definitions/FieldPathPlugin.d.ts +0 -22
- package/plugins/definitions/FieldPathPlugin.js +0 -34
- package/plugins/definitions/FieldPathPlugin.js.map +0 -1
- package/plugins/definitions/ValueFilterPlugin.d.ts +0 -22
- package/plugins/definitions/ValueFilterPlugin.js +0 -43
- package/plugins/definitions/ValueFilterPlugin.js.map +0 -1
- package/plugins/filters/andIn.d.ts +0 -3
- package/plugins/filters/andIn.js +0 -31
- package/plugins/filters/andIn.js.map +0 -1
- package/plugins/filters/between.d.ts +0 -3
- package/plugins/filters/between.js +0 -32
- package/plugins/filters/between.js.map +0 -1
- package/plugins/filters/contains.d.ts +0 -3
- package/plugins/filters/contains.js.map +0 -1
- package/plugins/filters/eq.d.ts +0 -3
- package/plugins/filters/eq.js.map +0 -1
- package/plugins/filters/fuzzy.d.ts +0 -3
- package/plugins/filters/fuzzy.js +0 -36
- package/plugins/filters/fuzzy.js.map +0 -1
- package/plugins/filters/gt.d.ts +0 -3
- package/plugins/filters/gt.js +0 -20
- package/plugins/filters/gt.js.map +0 -1
- package/plugins/filters/gte.d.ts +0 -3
- package/plugins/filters/gte.js +0 -20
- package/plugins/filters/gte.js.map +0 -1
- package/plugins/filters/in.d.ts +0 -3
- package/plugins/filters/in.js +0 -31
- package/plugins/filters/in.js.map +0 -1
- package/plugins/filters/index.d.ts +0 -2
- package/plugins/filters/index.js +0 -22
- package/plugins/filters/index.js.map +0 -1
- package/plugins/filters/lt.d.ts +0 -3
- package/plugins/filters/lt.js +0 -20
- package/plugins/filters/lt.js.map +0 -1
- package/plugins/filters/lte.d.ts +0 -3
- package/plugins/filters/lte.js +0 -20
- package/plugins/filters/lte.js.map +0 -1
- package/plugins/filters/startsWith.d.ts +0 -3
- package/plugins/filters/startsWith.js.map +0 -1
- package/utils/attributes.d.ts +0 -10
- package/utils/attributes.js +0 -27
- package/utils/attributes.js.map +0 -1
- package/utils/filter.d.ts +0 -12
- package/utils/filter.js.map +0 -1
- package/utils/listResponse.d.ts +0 -13
- package/utils/listResponse.js +0 -31
- package/utils/listResponse.js.map +0 -1
- package/utils/update.d.ts +0 -12
- package/utils/update.js +0 -19
- package/utils/update.js.map +0 -1
|
@@ -1,59 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _dotProp = _interopRequireDefault(require("dot-prop"));
|
|
9
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
10
|
-
var _ValueFilterPlugin = require("../plugins/definitions/ValueFilterPlugin");
|
|
11
|
-
const getMappedPlugins = params => {
|
|
12
|
-
return params.plugins.byType(params.type).reduce((plugins, plugin) => {
|
|
13
|
-
/**
|
|
14
|
-
* We expect op to be a string, that is why we cast.
|
|
15
|
-
*/
|
|
16
|
-
const op = plugin[params.property];
|
|
17
|
-
plugins[op] = plugin;
|
|
18
|
-
return plugins;
|
|
19
|
-
}, {});
|
|
20
|
-
};
|
|
21
|
-
const extractWhereArgs = key => {
|
|
22
|
-
const result = key.split("_");
|
|
23
|
-
const field = result.shift();
|
|
24
|
-
const rawOp = result.length === 0 ? "eq" : result.join("_");
|
|
25
|
-
/**
|
|
26
|
-
* When rawOp is not, it means it is equal negated so just return that.
|
|
27
|
-
*/
|
|
28
|
-
if (rawOp === "not") {
|
|
29
|
-
return {
|
|
30
|
-
field,
|
|
31
|
-
operation: "eq",
|
|
32
|
-
negate: true
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
const negate = rawOp.match("not_") !== null;
|
|
36
|
-
const operation = rawOp.replace("not_", "");
|
|
37
|
-
return {
|
|
38
|
-
field,
|
|
39
|
-
operation,
|
|
40
|
-
negate
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
const findFilterPlugin = (plugins, operation) => {
|
|
44
|
-
if (plugins[operation]) {
|
|
45
|
-
return plugins[operation];
|
|
1
|
+
import * as dotProp from "dot-prop";
|
|
2
|
+
import { WebinyError } from "@webiny/error";
|
|
3
|
+
import { extractWhereArgs } from "./extractWhereArgs.js";
|
|
4
|
+
const findFilter = (registry, operation) => {
|
|
5
|
+
const filter = registry.get(operation);
|
|
6
|
+
if (filter) {
|
|
7
|
+
return filter;
|
|
46
8
|
}
|
|
47
|
-
throw new
|
|
9
|
+
throw new WebinyError(`Missing filter plugin definition.`, "FILTER_PLUGIN_ERROR", {
|
|
48
10
|
operation
|
|
49
11
|
});
|
|
50
12
|
};
|
|
51
13
|
const multiSearchFieldOperations = ["contains", "fuzzy"];
|
|
52
|
-
const createFilters = params => {
|
|
14
|
+
export const createFilters = params => {
|
|
53
15
|
const {
|
|
54
|
-
plugins,
|
|
55
16
|
where,
|
|
56
|
-
fields
|
|
17
|
+
fields,
|
|
18
|
+
filterRegistry
|
|
57
19
|
} = params;
|
|
58
20
|
const keys = Object.keys(where);
|
|
59
21
|
/**
|
|
@@ -62,11 +24,6 @@ const createFilters = params => {
|
|
|
62
24
|
if (keys.length === 0) {
|
|
63
25
|
return [];
|
|
64
26
|
}
|
|
65
|
-
const filterPlugins = getMappedPlugins({
|
|
66
|
-
plugins,
|
|
67
|
-
type: _ValueFilterPlugin.ValueFilterPlugin.type,
|
|
68
|
-
property: "operation"
|
|
69
|
-
});
|
|
70
27
|
return keys.reduce((filters, key) => {
|
|
71
28
|
const compareValue = where[key];
|
|
72
29
|
if (compareValue === undefined) {
|
|
@@ -88,11 +45,11 @@ const createFilters = params => {
|
|
|
88
45
|
}
|
|
89
46
|
return field;
|
|
90
47
|
});
|
|
91
|
-
const
|
|
48
|
+
const filter = findFilter(filterRegistry, key);
|
|
92
49
|
filters.push({
|
|
93
|
-
operation:
|
|
50
|
+
operation: filter.operation,
|
|
94
51
|
compareValue: data.value,
|
|
95
|
-
|
|
52
|
+
filter,
|
|
96
53
|
transformValue,
|
|
97
54
|
paths,
|
|
98
55
|
negate: false
|
|
@@ -104,7 +61,7 @@ const createFilters = params => {
|
|
|
104
61
|
operation,
|
|
105
62
|
negate
|
|
106
63
|
} = extractWhereArgs(key);
|
|
107
|
-
const
|
|
64
|
+
const filter = findFilter(filterRegistry, operation);
|
|
108
65
|
const fieldPlugin = fields.find(plugin => plugin.getField() === field);
|
|
109
66
|
let path = field;
|
|
110
67
|
let transformValue = undefined;
|
|
@@ -115,9 +72,9 @@ const createFilters = params => {
|
|
|
115
72
|
path = fieldPlugin.getPath();
|
|
116
73
|
}
|
|
117
74
|
filters.push({
|
|
118
|
-
operation:
|
|
75
|
+
operation: filter.operation,
|
|
119
76
|
compareValue,
|
|
120
|
-
|
|
77
|
+
filter,
|
|
121
78
|
transformValue,
|
|
122
79
|
paths: [path],
|
|
123
80
|
negate
|
|
@@ -125,6 +82,7 @@ const createFilters = params => {
|
|
|
125
82
|
return filters;
|
|
126
83
|
}, []);
|
|
127
84
|
};
|
|
85
|
+
|
|
128
86
|
/**
|
|
129
87
|
* Transforms the value with given transformer callable.
|
|
130
88
|
*/
|
|
@@ -137,10 +95,11 @@ const transform = (value, transformValue) => {
|
|
|
137
95
|
}
|
|
138
96
|
return transformValue(value);
|
|
139
97
|
};
|
|
98
|
+
|
|
140
99
|
/**
|
|
141
100
|
* Creates a filter callable that we can send to the .filter() method of the array.
|
|
142
101
|
*/
|
|
143
|
-
const createFilterCallable = params => {
|
|
102
|
+
export const createFilterCallable = params => {
|
|
144
103
|
const filters = createFilters(params);
|
|
145
104
|
/**
|
|
146
105
|
* Just return null so there are no filters to be applied.
|
|
@@ -152,9 +111,9 @@ const createFilterCallable = params => {
|
|
|
152
111
|
return item => {
|
|
153
112
|
for (const filter of filters) {
|
|
154
113
|
const result = filter.paths.some(path => {
|
|
155
|
-
const value = transform(
|
|
114
|
+
const value = transform(dotProp.getProperty(item, path), filter.transformValue);
|
|
156
115
|
const compareValue = transform(filter.compareValue, filter.transformValue);
|
|
157
|
-
const matched = filter.
|
|
116
|
+
const matched = filter.filter.matches({
|
|
158
117
|
value,
|
|
159
118
|
compareValue
|
|
160
119
|
});
|
|
@@ -167,15 +126,5 @@ const createFilterCallable = params => {
|
|
|
167
126
|
return true;
|
|
168
127
|
};
|
|
169
128
|
};
|
|
170
|
-
function filterItems(params) {
|
|
171
|
-
const filter = createFilterCallable(params);
|
|
172
|
-
/**
|
|
173
|
-
* No point in going through all the items when there are no filters to be applied.
|
|
174
|
-
*/
|
|
175
|
-
if (!filter) {
|
|
176
|
-
return params.items;
|
|
177
|
-
}
|
|
178
|
-
return params.items.filter(filter);
|
|
179
|
-
}
|
|
180
129
|
|
|
181
|
-
//# sourceMappingURL=
|
|
130
|
+
//# sourceMappingURL=createFilters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["dotProp","WebinyError","extractWhereArgs","findFilter","registry","operation","filter","get","multiSearchFieldOperations","createFilters","params","where","fields","filterRegistry","keys","Object","length","reduce","filters","key","compareValue","undefined","includes","data","transformValue","paths","map","field","fieldPlugin","find","plugin","getField","value","getPath","push","negate","path","transform","Array","isArray","v","createFilterCallable","item","result","some","getProperty","matched","matches"],"sources":["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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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const extractWhereArgs = key => {
|
|
2
|
+
const result = key.split("_");
|
|
3
|
+
const field = result.shift();
|
|
4
|
+
const rawOp = result.length === 0 ? "eq" : result.join("_");
|
|
5
|
+
/**
|
|
6
|
+
* When rawOp is not, it means it is equal negated so just return that.
|
|
7
|
+
*/
|
|
8
|
+
if (rawOp === "not") {
|
|
9
|
+
return {
|
|
10
|
+
field,
|
|
11
|
+
operation: "eq",
|
|
12
|
+
negate: true
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const negate = rawOp.match("not_") !== null;
|
|
16
|
+
const operation = rawOp.replace("not_", "");
|
|
17
|
+
return {
|
|
18
|
+
field,
|
|
19
|
+
operation,
|
|
20
|
+
negate
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=extractWhereArgs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["extractWhereArgs","key","result","split","field","shift","rawOp","length","join","operation","negate","match","replace"],"sources":["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"],"mappings":"AAMA,OAAO,MAAMA,gBAAgB,GAAIC,GAAW,IAA6B;EACrE,MAAMC,MAAM,GAAGD,GAAG,CAACE,KAAK,CAAC,GAAG,CAAC;EAC7B,MAAMC,KAAK,GAAGF,MAAM,CAACG,KAAK,CAAC,CAAW;EACtC,MAAMC,KAAK,GAAGJ,MAAM,CAACK,MAAM,KAAK,CAAC,GAAG,IAAI,GAAGL,MAAM,CAACM,IAAI,CAAC,GAAG,CAAC;EAC3D;AACJ;AACA;EACI,IAAIF,KAAK,KAAK,KAAK,EAAE;IACjB,OAAO;MACHF,KAAK;MACLK,SAAS,EAAE,IAAI;MACfC,MAAM,EAAE;IACZ,CAAC;EACL;EACA,MAAMA,MAAM,GAAGJ,KAAK,CAACK,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI;EAC3C,MAAMF,SAAS,GAAGH,KAAK,CAACM,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;EAC3C,OAAO;IACHR,KAAK;IACLK,SAAS;IACTC;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { FilterUtil } from "./FilterUtil.js";
|
|
3
|
+
export const FilterUtilFeature = createFeature({
|
|
4
|
+
name: "Db/DynamoDB/FilterUtilFeature",
|
|
5
|
+
register: container => {
|
|
6
|
+
container.register(FilterUtil);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","FilterUtil","FilterUtilFeature","name","register","container"],"sources":["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"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,UAAU;AAEnB,OAAO,MAAMC,iBAAiB,GAAGF,aAAa,CAAC;EAC3CG,IAAI,EAAE,+BAA+B;EACrCC,QAAQ,EAAEC,SAAS,IAAI;IACnBA,SAAS,CAACD,QAAQ,CAACH,UAAU,CAAC;EAClC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FilterUtil","FilterUtilFeature"],"sources":["index.ts"],"sourcesContent":["export { FilterUtil } from \"./abstractions/FilterUtil.js\";\nexport { FilterUtilFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,UAAU;AACnB,SAASC,iBAAiB","ignoreList":[]}
|
|
@@ -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,23 @@
|
|
|
1
|
+
import { ValueFilterRegistry as Abstraction } 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 => {
|
|
9
|
+
return filter.is(operation);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
getAll() {
|
|
13
|
+
return this.filters;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export const ValueFilterRegistry = Abstraction.createImplementation({
|
|
17
|
+
implementation: ValueFilterRegistryImpl,
|
|
18
|
+
dependencies: [[ValueFilter, {
|
|
19
|
+
multiple: true
|
|
20
|
+
}]]
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=ValueFilterRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ValueFilterRegistry","Abstraction","ValueFilter","ValueFilterRegistryImpl","constructor","filters","get","operation","find","filter","is","getAll","createImplementation","implementation","dependencies","multiple"],"sources":["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"],"mappings":"AAAA,SAASA,mBAAmB,IAAIC,WAAW;AAC3C,SAASC,WAAW;AAEpB,MAAMC,uBAAuB,CAAkC;EACpDC,WAAWA,CAAkBC,OAAgC,EAAE;IAAA,KAAlCA,OAAgC,GAAhCA,OAAgC;EAAG;EAEhEC,GAAGA,CAACC,SAAiB,EAAqC;IAC7D,OAAO,IAAI,CAACF,OAAO,CAACG,IAAI,CAACC,MAAM,IAAI;MAC/B,OAAOA,MAAM,CAACC,EAAE,CAACH,SAAS,CAAC;IAC/B,CAAC,CAAC;EACN;EAEOI,MAAMA,CAAA,EAA4B;IACrC,OAAO,IAAI,CAACN,OAAO;EACvB;AACJ;AAEA,OAAO,MAAML,mBAAmB,GAAGC,WAAW,CAACW,oBAAoB,CAAC;EAChEC,cAAc,EAAEV,uBAAuB;EACvCW,YAAY,EAAE,CAAC,CAACZ,WAAW,EAAE;IAAEa,QAAQ,EAAE;EAAK,CAAC,CAAC;AACpD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -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,"names":["createAbstraction","ValueFilter"],"sources":["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"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAqBvD,OAAO,MAAMC,WAAW,GAAGD,iBAAiB,CAAe,yBAAyB,CAAC","ignoreList":[]}
|
|
@@ -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,"names":["createAbstraction","ValueFilterRegistry"],"sources":["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"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAQvD,OAAO,MAAMC,mBAAmB,GAAGD,iBAAiB,CAChD,iCACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
export 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
|
+
|
|
32
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","EqFilter","GtFilter","GteFilter","LtFilter","LteFilter","BetweenFilter","InFilter","AndInFilter","ContainsFilter","FuzzyFilter","StartsWithFilter","ValueFilterRegistry","ValueFilterFeature","name","register","container"],"sources":["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"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,QAAQ;AACjB,SAASC,QAAQ;AACjB,SAASC,SAAS;AAClB,SAASC,QAAQ;AACjB,SAASC,SAAS;AAClB,SAASC,aAAa;AACtB,SAASC,QAAQ;AACjB,SAASC,WAAW;AACpB,SAASC,cAAc;AACvB,SAASC,WAAW;AACpB,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAE5B,OAAO,MAAMC,kBAAkB,GAAGb,aAAa,CAAC;EAC5Cc,IAAI,EAAE,gCAAgC;EACtCC,QAAQ,EAAEC,SAAS,IAAI;IACnBA,SAAS,CAACD,QAAQ,CAACd,QAAQ,CAAC;IAC5Be,SAAS,CAACD,QAAQ,CAACb,QAAQ,CAAC;IAC5Bc,SAAS,CAACD,QAAQ,CAACZ,SAAS,CAAC;IAC7Ba,SAAS,CAACD,QAAQ,CAACX,QAAQ,CAAC;IAC5BY,SAAS,CAACD,QAAQ,CAACV,SAAS,CAAC;IAC7BW,SAAS,CAACD,QAAQ,CAACT,aAAa,CAAC;IACjCU,SAAS,CAACD,QAAQ,CAACR,QAAQ,CAAC;IAC5BS,SAAS,CAACD,QAAQ,CAACP,WAAW,CAAC;IAC/BQ,SAAS,CAACD,QAAQ,CAACN,cAAc,CAAC;IAClCO,SAAS,CAACD,QAAQ,CAACL,WAAW,CAAC;IAC/BM,SAAS,CAACD,QAAQ,CAACJ,gBAAgB,CAAC;IACpCK,SAAS,CAACD,QAAQ,CAACH,mBAAmB,CAAC;EAC3C;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -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,32 @@
|
|
|
1
|
+
import { WebinyError } from "@webiny/error";
|
|
2
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
3
|
+
class AndInFilterImpl {
|
|
4
|
+
operation = "and_in";
|
|
5
|
+
is(operation) {
|
|
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
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(value) === true) {
|
|
22
|
+
return compareValue.every(c => value.includes(c));
|
|
23
|
+
}
|
|
24
|
+
return compareValue.includes(value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export const AndInFilter = ValueFilter.createImplementation({
|
|
28
|
+
implementation: AndInFilterImpl,
|
|
29
|
+
dependencies: []
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=AndInFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WebinyError","ValueFilter","AndInFilterImpl","operation","is","canUse","matches","value","compareValue","Array","isArray","every","c","includes","AndInFilter","createImplementation","implementation","dependencies"],"sources":["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"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe;AAC3C,SAASC,WAAW;AAEpB,MAAMC,eAAe,CAAkC;EACnCC,SAAS,GAAG,QAAQ;EAE7BC,EAAEA,CAACD,SAAiB,EAAW;IAClC,OAAO,IAAI,CAACA,SAAS,KAAKA,SAAS;EACvC;EAEOE,MAAMA,CAAA,EAAY;IACrB,OAAO,IAAI;EACf;EAEOC,OAAOA,CAAC;IAAEC,KAAK;IAAEC;EAAwC,CAAC,EAAsB;IACnF,IAAI,CAACA,YAAY,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,KAAK,KAAK,EAAE;MACxD,MAAM,IAAIR,WAAW,CACjB,qDAAqD,EACrD,qBAAqB,EACrB;QACIO,KAAK;QACLC;MACJ,CACJ,CAAC;IACL;IACA,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,KAAK,IAAI,EAAE;MAC/B,OAAOC,YAAY,CAACG,KAAK,CAAEC,CAAM,IAAKL,KAAK,CAACM,QAAQ,CAACD,CAAC,CAAC,CAAC;IAC5D;IACA,OAAOJ,YAAY,CAACK,QAAQ,CAACN,KAAK,CAAC;EACvC;AACJ;AAEA,OAAO,MAAMO,WAAW,GAAGb,WAAW,CAACc,oBAAoB,CAAC;EACxDC,cAAc,EAAEd,eAAe;EAC/Be,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -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,33 @@
|
|
|
1
|
+
import { WebinyError } from "@webiny/error";
|
|
2
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
3
|
+
class BetweenFilterImpl {
|
|
4
|
+
operation = "between";
|
|
5
|
+
is(operation) {
|
|
6
|
+
return this.operation === operation;
|
|
7
|
+
}
|
|
8
|
+
canUse() {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
matches({
|
|
12
|
+
value,
|
|
13
|
+
compareValue
|
|
14
|
+
}) {
|
|
15
|
+
if (Array.isArray(compareValue)) {
|
|
16
|
+
if (compareValue.length !== 2) {
|
|
17
|
+
throw new WebinyError("When comparing between and you give an array, there must be two items in it.", "FILTER_ERROR", {
|
|
18
|
+
value,
|
|
19
|
+
compareValue
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const [from, to] = compareValue;
|
|
23
|
+
return value >= from && value <= to;
|
|
24
|
+
}
|
|
25
|
+
return value >= compareValue && value <= compareValue;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export const BetweenFilter = ValueFilter.createImplementation({
|
|
29
|
+
implementation: BetweenFilterImpl,
|
|
30
|
+
dependencies: []
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=BetweenFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WebinyError","ValueFilter","BetweenFilterImpl","operation","is","canUse","matches","value","compareValue","Array","isArray","length","from","to","BetweenFilter","createImplementation","implementation","dependencies"],"sources":["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"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe;AAC3C,SAASC,WAAW;AAEpB,MAAMC,iBAAiB,CAAkC;EACrCC,SAAS,GAAG,SAAS;EAE9BC,EAAEA,CAACD,SAAiB,EAAW;IAClC,OAAO,IAAI,CAACA,SAAS,KAAKA,SAAS;EACvC;EAEOE,MAAMA,CAAA,EAAY;IACrB,OAAO,IAAI;EACf;EAEOC,OAAOA,CAAC;IAAEC,KAAK;IAAEC;EAAwC,CAAC,EAAsB;IACnF,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,EAAE;MAC7B,IAAIA,YAAY,CAACG,MAAM,KAAK,CAAC,EAAE;QAC3B,MAAM,IAAIX,WAAW,CACjB,8EAA8E,EAC9E,cAAc,EACd;UACIO,KAAK;UACLC;QACJ,CACJ,CAAC;MACL;MACA,MAAM,CAACI,IAAI,EAAEC,EAAE,CAAC,GAAGL,YAAY;MAC/B,OAAOD,KAAK,IAAIK,IAAI,IAAIL,KAAK,IAAIM,EAAE;IACvC;IACA,OAAON,KAAK,IAAIC,YAAY,IAAID,KAAK,IAAIC,YAAY;EACzD;AACJ;AAEA,OAAO,MAAMM,aAAa,GAAGb,WAAW,CAACc,oBAAoB,CAAC;EAC1DC,cAAc,EAAEd,iBAAiB;EACjCe,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -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 {};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _ValueFilterPlugin = require("../definitions/ValueFilterPlugin");
|
|
1
|
+
import { ValueFilter } from "../abstractions/ValueFilter.js";
|
|
8
2
|
const createValues = initialValue => {
|
|
9
3
|
if (typeof initialValue === "string") {
|
|
10
4
|
return [initialValue];
|
|
@@ -29,16 +23,22 @@ const createValues = initialValue => {
|
|
|
29
23
|
return result.filter(Boolean);
|
|
30
24
|
};
|
|
31
25
|
const createCompareValues = value => {
|
|
32
|
-
return value.replace(/\s+/g, " ").trim().replace(/\?/g, `\\?`).replace(/\//g, `\\/`).replace(/:/g, ``).replace(
|
|
26
|
+
return value.replace(/\s+/g, " ").trim().replace(/\?/g, `\\?`).replace(/\//g, `\\/`).replace(/:/g, ``).replace(/-/g, `\\-`).split(" ").filter(val => {
|
|
33
27
|
return val.length > 0;
|
|
34
28
|
});
|
|
35
29
|
};
|
|
36
|
-
|
|
37
|
-
operation
|
|
38
|
-
|
|
30
|
+
class ContainsFilterImpl {
|
|
31
|
+
operation = "contains";
|
|
32
|
+
is(operation) {
|
|
33
|
+
return this.operation === operation;
|
|
34
|
+
}
|
|
35
|
+
canUse() {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
matches({
|
|
39
39
|
value: initialValue,
|
|
40
40
|
compareValue: initialCompareValue
|
|
41
|
-
})
|
|
41
|
+
}) {
|
|
42
42
|
if (!initialValue || Array.isArray(initialValue) && initialValue.length === 0) {
|
|
43
43
|
return false;
|
|
44
44
|
} else if (initialCompareValue === undefined || initialCompareValue === null) {
|
|
@@ -52,8 +52,10 @@ const plugin = new _ValueFilterPlugin.ValueFilterPlugin({
|
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
+
}
|
|
56
|
+
export const ContainsFilter = ValueFilter.createImplementation({
|
|
57
|
+
implementation: ContainsFilterImpl,
|
|
58
|
+
dependencies: []
|
|
55
59
|
});
|
|
56
|
-
plugin.name = "dynamodb.value.filter.contains";
|
|
57
|
-
var _default = exports.default = plugin;
|
|
58
60
|
|
|
59
|
-
//# sourceMappingURL=
|
|
61
|
+
//# sourceMappingURL=ContainsFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ValueFilter","createValues","initialValue","Array","isArray","flat","map","v","toString","filter","Boolean","result","traverse","node","push","forEach","Object","values","createCompareValues","value","replace","trim","split","val","length","ContainsFilterImpl","operation","is","canUse","matches","compareValue","initialCompareValue","undefined","compareValues","some","target","every","match","RegExp","ContainsFilter","createImplementation","implementation","dependencies"],"sources":["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"],"mappings":"AAAA,SAASA,WAAW;AAEpB,MAAMC,YAAY,GAAIC,YAAwC,IAAe;EACzE,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;IAClC,OAAO,CAACA,YAAY,CAAC;EACzB;EAEA,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,EAAE;IAC7B,OAAOA,YAAY,CACdG,IAAI,CAAC,CAAC,CACNC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,QAAQ,CAAC,CAAC,CAAC,CACtBC,MAAM,CAACC,OAAO,CAAC;EACxB;EAEA,MAAMC,MAAgB,GAAG,EAAE;EAE3B,MAAMC,QAAQ,GAAIC,IAAS,IAAW;IAClC,IAAIA,IAAI,IAAI,IAAI,EAAE;MACd;IACJ;IACA,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACtDF,MAAM,CAACG,IAAI,CAACD,IAAI,CAACL,QAAQ,CAAC,CAAC,CAAC;IAChC,CAAC,MAA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AAID,mBAAmB,KAAK,IAAI,EAAE;MAC1E,OAAO,IAAI;IACf;IACA,MAAMd,MAAM,GAAGhB,YAAY,CAACC,YAAY,CAAC;IACzC,MAAM+B,aAAa,GAAGf,mBAAmB,CAACa,mBAAmB,CAAC;IAC9D,OAAOd,MAAM,CAACiB,IAAI,CAACC,MAAM,IAAI;MACzB,OAAOF,aAAa,CAACG,KAAK,CAACN,YAAY,IAAI;QACvC,OAAOK,MAAM,CAACE,KAAK,CAAC,IAAIC,MAAM,CAACR,YAAY,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI;MAChE,CAAC,CAAC;IACN,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAMS,cAAc,GAAGvC,WAAW,CAACwC,oBAAoB,CAAC;EAC3DC,cAAc,EAAEhB,kBAAkB;EAClCiB,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -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 {};
|