@webiny/db-dynamodb 5.43.2-beta.0 → 6.0.0-alpha.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/db-dynamodb",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"author": "Webiny Ltd",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@webiny/api": "
|
|
14
|
-
"@webiny/aws-sdk": "
|
|
15
|
-
"@webiny/db": "
|
|
16
|
-
"@webiny/error": "
|
|
17
|
-
"@webiny/plugins": "
|
|
18
|
-
"@webiny/utils": "
|
|
13
|
+
"@webiny/api": "6.0.0-alpha.0",
|
|
14
|
+
"@webiny/aws-sdk": "6.0.0-alpha.0",
|
|
15
|
+
"@webiny/db": "6.0.0-alpha.0",
|
|
16
|
+
"@webiny/error": "6.0.0-alpha.0",
|
|
17
|
+
"@webiny/plugins": "6.0.0-alpha.0",
|
|
18
|
+
"@webiny/utils": "6.0.0-alpha.0",
|
|
19
19
|
"date-fns": "2.29.3",
|
|
20
20
|
"dot-prop": "6.0.1",
|
|
21
21
|
"dynamodb-toolbox": "0.9.2",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/is-number": "7.0.5",
|
|
27
|
-
"@webiny/project-utils": "
|
|
27
|
+
"@webiny/project-utils": "6.0.0-alpha.0",
|
|
28
28
|
"jest": "29.7.0",
|
|
29
29
|
"jest-dynalite": "3.6.1",
|
|
30
30
|
"rimraf": "6.0.1",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"build": "node ../cli/bin.js run build",
|
|
39
39
|
"watch": "node ../cli/bin.js run watch"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "a5b28fed7a242d8f56712197a8ea83aa6d2ed101"
|
|
42
42
|
}
|
|
@@ -6,8 +6,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _ValueFilterPlugin = require("../definitions/ValueFilterPlugin");
|
|
8
8
|
const createValues = initialValue => {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if (typeof initialValue === "string") {
|
|
10
|
+
return [initialValue];
|
|
11
|
+
}
|
|
12
|
+
if (Array.isArray(initialValue)) {
|
|
13
|
+
return initialValue.flat().map(v => v.toString()).filter(Boolean);
|
|
14
|
+
}
|
|
15
|
+
const result = [];
|
|
16
|
+
const traverse = node => {
|
|
17
|
+
if (node == null) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
21
|
+
result.push(node.toString());
|
|
22
|
+
} else if (Array.isArray(node)) {
|
|
23
|
+
node.forEach(traverse);
|
|
24
|
+
} else if (typeof node === "object") {
|
|
25
|
+
Object.values(node).forEach(traverse);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
traverse(initialValue);
|
|
29
|
+
return result.filter(Boolean);
|
|
11
30
|
};
|
|
12
31
|
const createCompareValues = value => {
|
|
13
32
|
return value.replace(/\s+/g, " ").trim().replace(/\?/g, `\\?`).replace(/\//g, `\\/`).replace(/:/g, ``).replace(/\-/g, `\\-`).split(" ").filter(val => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ValueFilterPlugin","require","createValues","initialValue","
|
|
1
|
+
{"version":3,"names":["_ValueFilterPlugin","require","createValues","initialValue","Array","isArray","flat","map","v","toString","filter","Boolean","result","traverse","node","push","forEach","Object","values","createCompareValues","value","replace","trim","split","val","length","plugin","ValueFilterPlugin","operation","matches","compareValue","initialCompareValue","undefined","compareValues","some","target","every","match","RegExp","name","_default","exports","default"],"sources":["contains.ts"],"sourcesContent":["import { ValueFilterPlugin } from \"../definitions/ValueFilterPlugin\";\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\nconst plugin = new ValueFilterPlugin({\n operation: \"contains\",\n matches: ({ value: initialValue, compareValue: initialCompareValue }) => {\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\nplugin.name = \"dynamodb.value.filter.contains\";\n\nexport default plugin;\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAEA,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,O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CAAiB,CAAC;EACjCC,SAAS,EAAE,UAAU;EACrBC,OAAO,EAAEA,CAAC;IAAET,KAAK,EAAEjB,YAAY;IAAE2B,YAAY,EAAEC;EAAoB,CAAC,KAAK;IACrE,IAAI,CAAC5B,YAAY,IAAKC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,IAAIA,YAAY,CAACsB,MAAM,KAAK,CAAE,EAAE;MAC7E,OAAO,KAAK;IAChB,CAAC,MAAM,IAAIM,mBAAmB,KAAKC,SAAS,IAAID,mBAAmB,KAAK,IAAI,EAAE;MAC1E,OAAO,IAAI;IACf;IACA,MAAMb,MAAM,GAAGhB,YAAY,CAACC,YAAY,CAAC;IACzC,MAAM8B,aAAa,GAAGd,mBAAmB,CAACY,mBAAmB,CAAC;IAC9D,OAAOb,MAAM,CAACgB,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,CAAC,CAAC;AAEFJ,MAAM,CAACa,IAAI,GAAG,gCAAgC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEhChB,MAAM","ignoreList":[]}
|
package/store/entity.d.ts
CHANGED
|
@@ -55,23 +55,23 @@ export declare const createEntity: ({ table }: ICreateEntityParams) => Entity<"W
|
|
|
55
55
|
type: "string";
|
|
56
56
|
};
|
|
57
57
|
}, true, "created", "modified", "entity", false>, {
|
|
58
|
-
TYPE?: string | undefined;
|
|
59
58
|
key?: string | undefined;
|
|
60
59
|
value?: string | undefined;
|
|
61
|
-
|
|
62
|
-
SK: any;
|
|
60
|
+
TYPE?: string | undefined;
|
|
63
61
|
created: string;
|
|
64
62
|
modified: string;
|
|
65
63
|
entity: string;
|
|
64
|
+
PK: any;
|
|
65
|
+
SK: any;
|
|
66
66
|
}, {
|
|
67
|
-
TYPE?: string | undefined;
|
|
68
67
|
key?: string | undefined;
|
|
69
68
|
value?: string | undefined;
|
|
70
|
-
|
|
71
|
-
SK: any;
|
|
69
|
+
TYPE?: string | undefined;
|
|
72
70
|
created: string;
|
|
73
71
|
modified: string;
|
|
74
72
|
entity: string;
|
|
73
|
+
PK: any;
|
|
74
|
+
SK: any;
|
|
75
75
|
}, {
|
|
76
76
|
PK: any;
|
|
77
77
|
SK: any;
|