@digigov/text-search 1.1.3-rc.16 → 1.2.0-85c27c19

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.
Files changed (41) hide show
  1. package/cjs/hook/index.js +46 -46
  2. package/cjs/hook.js.map +7 -0
  3. package/cjs/index.js +39 -19
  4. package/cjs/index.js.map +7 -0
  5. package/cjs/search/index.js +24 -6
  6. package/cjs/search/index.js.map +7 -0
  7. package/cjs/search/lang/gr/encoder/index.js +35 -23
  8. package/cjs/search/lang/gr/encoder.js.map +7 -0
  9. package/cjs/search/lang/gr/normalization-map/index.js +126 -104
  10. package/cjs/search/lang/gr/normalization-map.js.map +7 -0
  11. package/cjs/search/search-index/index.js +86 -119
  12. package/cjs/search/search-index.js.map +7 -0
  13. package/cjs/search/utils/index.js +47 -63
  14. package/cjs/search/utils.js.map +7 -0
  15. package/cjs/types/index.js +16 -4
  16. package/cjs/types.js.map +7 -0
  17. package/hook/index.js +18 -41
  18. package/hook.js.map +7 -0
  19. package/index.js +7 -3
  20. package/index.js.map +7 -0
  21. package/package.json +3 -3
  22. package/search/index.js +5 -1
  23. package/search/index.js.map +7 -0
  24. package/search/lang/gr/encoder/index.js +13 -19
  25. package/search/lang/gr/encoder.js.map +7 -0
  26. package/search/lang/gr/normalization-map/index.js +104 -100
  27. package/search/lang/gr/normalization-map.js.map +7 -0
  28. package/search/search-index/index.js +59 -110
  29. package/search/search-index.js.map +7 -0
  30. package/search/utils/index.js +25 -58
  31. package/search/utils.js.map +7 -0
  32. package/types/index.js +1 -1
  33. package/types.js.map +7 -0
  34. package/cjs/hook.spec/index.js +0 -481
  35. package/cjs/search/__tests__/utils.spec/index.js +0 -83
  36. package/cjs/test-utils/data.json +0 -552
  37. package/hook.spec/index.js +0 -478
  38. package/hook.spec/package.json +0 -6
  39. package/search/__tests__/utils.spec/index.js +0 -81
  40. package/search/__tests__/utils.spec/package.json +0 -6
  41. package/test-utils/data.json +0 -552
@@ -1,20 +1,14 @@
1
1
  import { greekToGreeklishMap } from "./normalization-map";
2
- var whitespaceRegex = /(?:[\0-\/:-@\[-`\{-\xA9\xAB-\xB1\xB4\xB6-\xB8\xBB\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u086F\u0888\u088F-\u0897\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2\u09F3\u09FA\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF3-\u0BFF\u0C0D\u0C11\u0C29\u0C3A\u0C3B\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDC\u0CDF\u0CE4\u0CE5\u0CF0\u0CF4-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D64\u0D65\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u1368\u137D-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u1716-\u171E\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u17EF\u17FA-\u180A\u180E\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1ACF-\u1AFF\u1B4D-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u206F\u2072\u2073\u207A-\u207E\u208A-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A-\u245F\u249C-\u24E9\u2500-\u2775\u2794-\u2BFF\u2CE5-\u2CEA\u2CF4-\u2CFC\u2CFE\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u3191\u3196-\u319F\u31C0-\u31EF\u3200-\u321F\u322A-\u3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DC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDC2F\uDC6E-\uDC8E\uDC90-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDE8F\uDEAF-\uDEBF\uDEFA-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCFA-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5\uDCC6\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDC70\uDCAC\uDCB0\uDCB5-\uDD00\uDD2E\uDD3E-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFEF]|\uD87B[\uDE5E-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+/;
3
- var diacriticsRegex = /[\u0300-\u036f]/g;
4
- var greekCharsRegex = new RegExp(Object.keys(greekToGreeklishMap).join('|'), 'igu');
5
-
6
- /**
7
- * Encode a string containing greek characters to greeklish
8
- *
9
- * This function is used to encode and tokenize a string containing greek characters.
10
- * It replaces greek characters with their latin counterparts, while also removing
11
- * any diacritics.
12
- *
13
- * @param str - The string to encode
14
- * @returns An array of encoded words
15
- */
16
- export function encodeGreek(str) {
17
- return ('' + str).toLowerCase().normalize('NFD').replace(diacriticsRegex, '').replace(greekCharsRegex, function (match) {
18
- return greekToGreeklishMap[match];
19
- }).split(whitespaceRegex);
20
- }
2
+ const whitespaceRegex = /[\p{Z}\p{S}\p{P}\p{C}]+/u;
3
+ const diacriticsRegex = /[\u0300-\u036f]/g;
4
+ const greekCharsRegex = new RegExp(
5
+ Object.keys(greekToGreeklishMap).join("|"),
6
+ "igu"
7
+ );
8
+ function encodeGreek(str) {
9
+ return ("" + str).toLowerCase().normalize("NFD").replace(diacriticsRegex, "").replace(greekCharsRegex, (match) => greekToGreeklishMap[match]).split(whitespaceRegex);
10
+ }
11
+ export {
12
+ encodeGreek
13
+ };
14
+ //# sourceMappingURL=encoder.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/search/lang/gr/encoder.ts"],
4
+ "sourcesContent": ["import { greekToGreeklishMap } from './normalization-map';\n\nconst whitespaceRegex = /[\\p{Z}\\p{S}\\p{P}\\p{C}]+/u;\nconst diacriticsRegex = /[\\u0300-\\u036f]/g;\nconst greekCharsRegex = new RegExp(\n Object.keys(greekToGreeklishMap).join('|'),\n 'igu'\n);\n\n/**\n * Encode a string containing greek characters to greeklish\n *\n * This function is used to encode and tokenize a string containing greek characters.\n * It replaces greek characters with their latin counterparts, while also removing\n * any diacritics.\n *\n * @param str - The string to encode\n * @returns An array of encoded words\n */\nexport function encodeGreek(str: string) {\n return ('' + str)\n .toLowerCase()\n .normalize('NFD')\n .replace(diacriticsRegex, '')\n .replace(greekCharsRegex, (match) => (greekToGreeklishMap as any)[match])\n .split(whitespaceRegex);\n}\n"],
5
+ "mappings": "AAAA,SAAS,2BAA2B;AAEpC,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AACxB,MAAM,kBAAkB,IAAI;AAAA,EAC1B,OAAO,KAAK,mBAAmB,EAAE,KAAK,GAAG;AAAA,EACzC;AACF;AAYO,SAAS,YAAY,KAAa;AACvC,UAAQ,KAAK,KACV,YAAY,EACZ,UAAU,KAAK,EACf,QAAQ,iBAAiB,EAAE,EAC3B,QAAQ,iBAAiB,CAAC,UAAW,oBAA4B,KAAK,CAAC,EACvE,MAAM,eAAe;AAC1B;",
6
+ "names": []
7
+ }
@@ -1,100 +1,104 @@
1
- export var greekToGreeklishMap = {
2
- ΓΧ: 'GX',
3
- γχ: 'gx',
4
- ΤΘ: 'T8',
5
- τθ: 't8',
6
- θη: '8h',
7
- Θη: '8h',
8
- ΘΗ: '8H',
9
- αυ: 'au',
10
- Αυ: 'Au',
11
- ΑΥ: 'AY',
12
- ευ: 'eu',
13
- εύ: 'eu',
14
- εϋ: 'ey',
15
- εΰ: 'ey',
16
- Ευ: 'Eu',
17
- Εύ: 'Eu',
18
- Εϋ: 'Ey',
19
- Εΰ: 'Ey',
20
- ΕΥ: 'EY',
21
- ου: 'ou',
22
- ού: 'ou',
23
- οϋ: 'oy',
24
- οΰ: 'oy',
25
- Ου: 'Ou',
26
- Ού: 'Ou',
27
- Οϋ: 'Oy',
28
- Οΰ: 'Oy',
29
- ΟΥ: 'OY',
30
- Α: 'A',
31
- α: 'a',
32
- ά: 'a',
33
- Ά: 'A',
34
- Β: 'B',
35
- β: 'b',
36
- Γ: 'G',
37
- γ: 'g',
38
- Δ: 'D',
39
- δ: 'd',
40
- Ε: 'E',
41
- ε: 'e',
42
- έ: 'e',
43
- Έ: 'E',
44
- Ζ: 'Z',
45
- ζ: 'z',
46
- Η: 'H',
47
- η: 'h',
48
- ή: 'h',
49
- Ή: 'H',
50
- Θ: 'TH',
51
- θ: 'th',
52
- Ι: 'I',
53
- Ϊ: 'I',
54
- ι: 'i',
55
- ί: 'i',
56
- ΐ: 'i',
57
- ϊ: 'i',
58
- Ί: 'I',
59
- Κ: 'K',
60
- κ: 'k',
61
- Λ: 'L',
62
- λ: 'l',
63
- Μ: 'M',
64
- μ: 'm',
65
- Ν: 'N',
66
- ν: 'n',
67
- Ξ: 'KS',
68
- ξ: 'ks',
69
- Ο: 'O',
70
- ο: 'o',
71
- Ό: 'O',
72
- ό: 'o',
73
- Π: 'P',
74
- π: 'p',
75
- Ρ: 'R',
76
- ρ: 'r',
77
- Σ: 'S',
78
- σ: 's',
79
- Τ: 'T',
80
- τ: 't',
81
- Υ: 'Y',
82
- Ύ: 'Y',
83
- Ϋ: 'Y',
84
- ΰ: 'y',
85
- ύ: 'y',
86
- ϋ: 'y',
87
- υ: 'y',
88
- Φ: 'F',
89
- φ: 'f',
90
- Χ: 'X',
91
- χ: 'x',
92
- Ψ: 'Ps',
93
- ψ: 'ps',
94
- Ω: 'w',
95
- ω: 'w',
96
- Ώ: 'w',
97
- ώ: 'w',
98
- ς: 's',
99
- ';': '?'
100
- };
1
+ const greekToGreeklishMap = {
2
+ \u0393\u03A7: "GX",
3
+ \u03B3\u03C7: "gx",
4
+ \u03A4\u0398: "T8",
5
+ \u03C4\u03B8: "t8",
6
+ \u03B8\u03B7: "8h",
7
+ \u0398\u03B7: "8h",
8
+ \u0398\u0397: "8H",
9
+ \u03B1\u03C5: "au",
10
+ \u0391\u03C5: "Au",
11
+ \u0391\u03A5: "AY",
12
+ \u03B5\u03C5: "eu",
13
+ \u03B5\u03CD: "eu",
14
+ \u03B5\u03CB: "ey",
15
+ \u03B5\u03B0: "ey",
16
+ \u0395\u03C5: "Eu",
17
+ \u0395\u03CD: "Eu",
18
+ \u0395\u03CB: "Ey",
19
+ \u0395\u03B0: "Ey",
20
+ \u0395\u03A5: "EY",
21
+ \u03BF\u03C5: "ou",
22
+ \u03BF\u03CD: "ou",
23
+ \u03BF\u03CB: "oy",
24
+ \u03BF\u03B0: "oy",
25
+ \u039F\u03C5: "Ou",
26
+ \u039F\u03CD: "Ou",
27
+ \u039F\u03CB: "Oy",
28
+ \u039F\u03B0: "Oy",
29
+ \u039F\u03A5: "OY",
30
+ \u0391: "A",
31
+ \u03B1: "a",
32
+ \u03AC: "a",
33
+ \u0386: "A",
34
+ \u0392: "B",
35
+ \u03B2: "b",
36
+ \u0393: "G",
37
+ \u03B3: "g",
38
+ \u0394: "D",
39
+ \u03B4: "d",
40
+ \u0395: "E",
41
+ \u03B5: "e",
42
+ \u03AD: "e",
43
+ \u0388: "E",
44
+ \u0396: "Z",
45
+ \u03B6: "z",
46
+ \u0397: "H",
47
+ \u03B7: "h",
48
+ \u03AE: "h",
49
+ \u0389: "H",
50
+ \u0398: "TH",
51
+ \u03B8: "th",
52
+ \u0399: "I",
53
+ \u03AA: "I",
54
+ \u03B9: "i",
55
+ \u03AF: "i",
56
+ \u0390: "i",
57
+ \u03CA: "i",
58
+ \u038A: "I",
59
+ \u039A: "K",
60
+ \u03BA: "k",
61
+ \u039B: "L",
62
+ \u03BB: "l",
63
+ \u039C: "M",
64
+ \u03BC: "m",
65
+ \u039D: "N",
66
+ \u03BD: "n",
67
+ \u039E: "KS",
68
+ \u03BE: "ks",
69
+ \u039F: "O",
70
+ \u03BF: "o",
71
+ \u038C: "O",
72
+ \u03CC: "o",
73
+ \u03A0: "P",
74
+ \u03C0: "p",
75
+ \u03A1: "R",
76
+ \u03C1: "r",
77
+ \u03A3: "S",
78
+ \u03C3: "s",
79
+ \u03A4: "T",
80
+ \u03C4: "t",
81
+ \u03A5: "Y",
82
+ \u038E: "Y",
83
+ \u03AB: "Y",
84
+ \u03B0: "y",
85
+ \u03CD: "y",
86
+ \u03CB: "y",
87
+ \u03C5: "y",
88
+ \u03A6: "F",
89
+ \u03C6: "f",
90
+ \u03A7: "X",
91
+ \u03C7: "x",
92
+ \u03A8: "Ps",
93
+ \u03C8: "ps",
94
+ \u03A9: "w",
95
+ \u03C9: "w",
96
+ \u038F: "w",
97
+ \u03CE: "w",
98
+ \u03C2: "s",
99
+ ";": "?"
100
+ };
101
+ export {
102
+ greekToGreeklishMap
103
+ };
104
+ //# sourceMappingURL=normalization-map.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/search/lang/gr/normalization-map.ts"],
4
+ "sourcesContent": ["export const greekToGreeklishMap = {\n \u0393\u03A7: 'GX',\n \u03B3\u03C7: 'gx',\n \u03A4\u0398: 'T8',\n \u03C4\u03B8: 't8',\n \u03B8\u03B7: '8h',\n \u0398\u03B7: '8h',\n \u0398\u0397: '8H',\n \u03B1\u03C5: 'au',\n \u0391\u03C5: 'Au',\n \u0391\u03A5: 'AY',\n \u03B5\u03C5: 'eu',\n \u03B5\u03CD: 'eu',\n \u03B5\u03CB: 'ey',\n \u03B5\u03B0: 'ey',\n \u0395\u03C5: 'Eu',\n \u0395\u03CD: 'Eu',\n \u0395\u03CB: 'Ey',\n \u0395\u03B0: 'Ey',\n \u0395\u03A5: 'EY',\n \u03BF\u03C5: 'ou',\n \u03BF\u03CD: 'ou',\n \u03BF\u03CB: 'oy',\n \u03BF\u03B0: 'oy',\n \u039F\u03C5: 'Ou',\n \u039F\u03CD: 'Ou',\n \u039F\u03CB: 'Oy',\n \u039F\u03B0: 'Oy',\n \u039F\u03A5: 'OY',\n \u0391: 'A',\n \u03B1: 'a',\n \u03AC: 'a',\n \u0386: 'A',\n \u0392: 'B',\n \u03B2: 'b',\n \u0393: 'G',\n \u03B3: 'g',\n \u0394: 'D',\n \u03B4: 'd',\n \u0395: 'E',\n \u03B5: 'e',\n \u03AD: 'e',\n \u0388: 'E',\n \u0396: 'Z',\n \u03B6: 'z',\n \u0397: 'H',\n \u03B7: 'h',\n \u03AE: 'h',\n \u0389: 'H',\n \u0398: 'TH',\n \u03B8: 'th',\n \u0399: 'I',\n \u03AA: 'I',\n \u03B9: 'i',\n \u03AF: 'i',\n \u0390: 'i',\n \u03CA: 'i',\n \u038A: 'I',\n \u039A: 'K',\n \u03BA: 'k',\n \u039B: 'L',\n \u03BB: 'l',\n \u039C: 'M',\n \u03BC: 'm',\n \u039D: 'N',\n \u03BD: 'n',\n \u039E: 'KS',\n \u03BE: 'ks',\n \u039F: 'O',\n \u03BF: 'o',\n \u038C: 'O',\n \u03CC: 'o',\n \u03A0: 'P',\n \u03C0: 'p',\n \u03A1: 'R',\n \u03C1: 'r',\n \u03A3: 'S',\n \u03C3: 's',\n \u03A4: 'T',\n \u03C4: 't',\n \u03A5: 'Y',\n \u038E: 'Y',\n \u03AB: 'Y',\n \u03B0: 'y',\n \u03CD: 'y',\n \u03CB: 'y',\n \u03C5: 'y',\n \u03A6: 'F',\n \u03C6: 'f',\n \u03A7: 'X',\n \u03C7: 'x',\n \u03A8: 'Ps',\n \u03C8: 'ps',\n \u03A9: 'w',\n \u03C9: 'w',\n \u038F: 'w',\n \u03CE: 'w',\n \u03C2: 's',\n ';': '?',\n};\n"],
5
+ "mappings": "AAAO,MAAM,sBAAsB;AAAA,EACjC,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,cAAI;AAAA,EACJ,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,QAAG;AAAA,EACH,KAAK;AACP;",
6
+ "names": []
7
+ }
@@ -1,133 +1,82 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _extends from "@babel/runtime/helpers/extends";
4
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/createClass";
6
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
7
- import { Document } from 'flexsearch';
1
+ import { Document } from "flexsearch";
8
2
  import { encodeGreek } from "./lang/gr/encoder";
9
3
  import { findItemsByIds, getAllItemKeys, getResultIds } from "./utils";
10
-
11
- /**
12
- * Wrapper class around third party index and search library
13
- *
14
- * @typeParam T - The type of the data that will be indexed
15
- */
16
- export var SearchIndex = /*#__PURE__*/function () {
17
- function SearchIndex(items, options) {
18
- var _this = this;
19
- _classCallCheck(this, SearchIndex);
20
- /**
21
- * Instance of the third party library's index
22
- */
23
- this.index = void 0;
24
- this.idKey = void 0;
25
- this.idKey = 'id';
4
+ class SearchIndex {
5
+ constructor(items, options) {
6
+ this.idKey = "id";
26
7
  if (options && options.idKey) {
27
- this.idKey = options.idKey.replace('.', ':');
28
- } else if (!(items[0] && 'id' in items[0])) {
29
- items = items.map(function (item, index) {
30
- return _extends({}, item, {
31
- id: index
32
- });
33
- });
8
+ this.idKey = options.idKey.replace(".", ":");
9
+ } else if (!(items[0] && "id" in items[0])) {
10
+ items = items.map((item, index) => ({ ...item, id: index }));
34
11
  }
35
- var fields = [];
12
+ let fields = [];
36
13
  if (options && options.fields) {
37
14
  fields = options.fields;
38
15
  } else if (items[0]) {
39
16
  fields = getAllItemKeys(items[0]);
40
17
  }
41
- fields = fields.filter(function (field) {
42
- return field !== _this.idKey;
43
- }).map(function (field) {
44
- return field.replace('.', ':');
45
- });
18
+ fields = fields.filter((field) => field !== this.idKey).map((field) => field.replace(".", ":"));
46
19
  this.index = new Document({
47
20
  document: {
48
21
  id: this.idKey,
49
22
  index: fields
50
23
  },
51
- tokenize: 'forward',
52
- worker: options === null || options === void 0 ? void 0 : options.enableWorker,
24
+ tokenize: "forward",
25
+ worker: options?.enableWorker,
53
26
  encode: encodeGreek
54
27
  });
55
28
  this.addAll(items);
56
29
  }
57
-
58
30
  /**
59
31
  * Add an item to the index
60
32
  *
61
33
  * @param item - The item to add to the index
62
34
  */
63
- _createClass(SearchIndex, [{
64
- key: "add",
65
- value: function add(item) {
66
- this.index.add(item);
67
- return this;
68
- }
69
-
70
- /**
71
- * Add multiple items to the index
72
- *
73
- * @param items - The list of items to add to the index
74
- */
75
- }, {
76
- key: "addAll",
77
- value: function addAll(items) {
78
- var _this2 = this;
79
- items.forEach(function (item) {
80
- return _this2.index.add(item);
81
- });
82
- return this;
83
- }
84
-
85
- /**
86
- * Search the index for the given term
87
- *
88
- * @param documents - The list of documents to search
89
- * @param searchTerm - The term to search for
90
- * @returns The list of items that match the search term
91
- */
92
- }, {
93
- key: "search",
94
- value: function search(documents, searchTerm) {
95
- var res = this.index.search(searchTerm);
96
- var ids = getResultIds(res);
97
- return findItemsByIds(documents, ids, this.idKey);
98
- }
99
-
100
- /**
101
- * Asynchronously search the index for the given term
102
- *
103
- * @param documents - The list of documents to search
104
- * @param searchTerm - The term to search for
105
- * @returns The list of items that match the search term
106
- */
107
- }, {
108
- key: "searchAsync",
109
- value: (function () {
110
- var _searchAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(documents, searchTerm) {
111
- var _this3 = this;
112
- return _regeneratorRuntime().wrap(function _callee$(_context) {
113
- while (1) switch (_context.prev = _context.next) {
114
- case 0:
115
- return _context.abrupt("return", this.index.searchAsync(searchTerm).then(function (res) {
116
- return getResultIds(res);
117
- }).then(function (res) {
118
- return findItemsByIds(documents, res, _this3.idKey);
119
- }));
120
- case 1:
121
- case "end":
122
- return _context.stop();
123
- }
124
- }, _callee, this);
125
- }));
126
- function searchAsync(_x, _x2) {
127
- return _searchAsync.apply(this, arguments);
128
- }
129
- return searchAsync;
130
- }())
131
- }]);
132
- return SearchIndex;
133
- }();
35
+ add(item) {
36
+ this.index.add(item);
37
+ return this;
38
+ }
39
+ /**
40
+ * Add multiple items to the index
41
+ *
42
+ * @param items - The list of items to add to the index
43
+ */
44
+ addAll(items) {
45
+ items.forEach((item) => this.index.add(item));
46
+ return this;
47
+ }
48
+ /**
49
+ * Search the index for the given term
50
+ *
51
+ * @param documents - The list of documents to search
52
+ * @param searchTerm - The term to search for
53
+ * @returns The list of items that match the search term
54
+ */
55
+ search(documents, searchTerm) {
56
+ const res = this.index.search(searchTerm);
57
+ const ids = getResultIds(res);
58
+ return findItemsByIds(
59
+ documents,
60
+ ids,
61
+ this.idKey
62
+ );
63
+ }
64
+ /**
65
+ * Asynchronously search the index for the given term
66
+ *
67
+ * @param documents - The list of documents to search
68
+ * @param searchTerm - The term to search for
69
+ * @returns The list of items that match the search term
70
+ */
71
+ async searchAsync(documents, searchTerm) {
72
+ return this.index.searchAsync(searchTerm).then((res) => {
73
+ return getResultIds(res);
74
+ }).then(
75
+ (res) => findItemsByIds(documents, res, this.idKey)
76
+ );
77
+ }
78
+ }
79
+ export {
80
+ SearchIndex
81
+ };
82
+ //# sourceMappingURL=search-index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/search/search-index.ts"],
4
+ "sourcesContent": ["import { Document } from 'flexsearch';\nimport type { SearchIndexOptions } from '../types';\nimport { encodeGreek } from './lang/gr/encoder';\nimport { findItemsByIds, getAllItemKeys, getResultIds } from './utils';\n\n/**\n * Wrapper class around third party index and search library\n *\n * @typeParam T - The type of the data that will be indexed\n */\nexport class SearchIndex<T extends Record<string, any>> {\n /**\n * Instance of the third party library's index\n */\n private index: Document<T>;\n private idKey: string;\n\n constructor(items: T[], options?: SearchIndexOptions<T>) {\n this.idKey = 'id';\n if (options && options.idKey) {\n this.idKey = options.idKey.replace('.', ':');\n } else if (!(items[0] && 'id' in items[0])) {\n items = items.map((item, index) => ({ ...item, id: index }));\n }\n\n let fields: string[] = [];\n if (options && options.fields) {\n fields = options.fields;\n } else if (items[0]) {\n fields = getAllItemKeys(items[0]);\n }\n fields = fields\n .filter((field) => field !== this.idKey)\n .map((field) => field.replace('.', ':'));\n\n this.index = new Document<T>({\n document: {\n id: this.idKey,\n index: fields,\n },\n tokenize: 'forward',\n worker: options?.enableWorker,\n encode: encodeGreek,\n });\n\n this.addAll(items);\n }\n\n /**\n * Add an item to the index\n *\n * @param item - The item to add to the index\n */\n public add(item: T) {\n this.index.add(item);\n return this;\n }\n\n /**\n * Add multiple items to the index\n *\n * @param items - The list of items to add to the index\n */\n public addAll(items: T[]) {\n items.forEach((item) => this.index.add(item));\n return this;\n }\n\n /**\n * Search the index for the given term\n *\n * @param documents - The list of documents to search\n * @param searchTerm - The term to search for\n * @returns The list of items that match the search term\n */\n public search(documents: T[], searchTerm: string) {\n const res = this.index.search(searchTerm);\n const ids = getResultIds(res);\n return findItemsByIds(\n documents,\n ids,\n this.idKey as Extract<keyof T, string>\n );\n }\n\n /**\n * Asynchronously search the index for the given term\n *\n * @param documents - The list of documents to search\n * @param searchTerm - The term to search for\n * @returns The list of items that match the search term\n */\n public async searchAsync(documents: T[], searchTerm: string) {\n return this.index\n .searchAsync(searchTerm)\n .then((res) => {\n return getResultIds(res);\n })\n .then((res) =>\n findItemsByIds(documents, res, this.idKey as Extract<keyof T, string>)\n );\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,gBAAgB;AAEzB,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB,gBAAgB,oBAAoB;AAOtD,MAAM,YAA2C;AAAA,EAOtD,YAAY,OAAY,SAAiC;AACvD,SAAK,QAAQ;AACb,QAAI,WAAW,QAAQ,OAAO;AAC5B,WAAK,QAAQ,QAAQ,MAAM,QAAQ,KAAK,GAAG;AAAA,IAC7C,WAAW,EAAE,MAAM,CAAC,KAAK,QAAQ,MAAM,CAAC,IAAI;AAC1C,cAAQ,MAAM,IAAI,CAAC,MAAM,WAAW,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE;AAAA,IAC7D;AAEA,QAAI,SAAmB,CAAC;AACxB,QAAI,WAAW,QAAQ,QAAQ;AAC7B,eAAS,QAAQ;AAAA,IACnB,WAAW,MAAM,CAAC,GAAG;AACnB,eAAS,eAAe,MAAM,CAAC,CAAC;AAAA,IAClC;AACA,aAAS,OACN,OAAO,CAAC,UAAU,UAAU,KAAK,KAAK,EACtC,IAAI,CAAC,UAAU,MAAM,QAAQ,KAAK,GAAG,CAAC;AAEzC,SAAK,QAAQ,IAAI,SAAY;AAAA,MAC3B,UAAU;AAAA,QACR,IAAI,KAAK;AAAA,QACT,OAAO;AAAA,MACT;AAAA,MACA,UAAU;AAAA,MACV,QAAQ,SAAS;AAAA,MACjB,QAAQ;AAAA,IACV,CAAC;AAED,SAAK,OAAO,KAAK;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,IAAI,MAAS;AAClB,SAAK,MAAM,IAAI,IAAI;AACnB,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,OAAO,OAAY;AACxB,UAAM,QAAQ,CAAC,SAAS,KAAK,MAAM,IAAI,IAAI,CAAC;AAC5C,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,OAAO,WAAgB,YAAoB;AAChD,UAAM,MAAM,KAAK,MAAM,OAAO,UAAU;AACxC,UAAM,MAAM,aAAa,GAAG;AAC5B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,KAAK;AAAA,IACP;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAa,YAAY,WAAgB,YAAoB;AAC3D,WAAO,KAAK,MACT,YAAY,UAAU,EACtB,KAAK,CAAC,QAAQ;AACb,aAAO,aAAa,GAAG;AAAA,IACzB,CAAC,EACA;AAAA,MAAK,CAAC,QACL,eAAe,WAAW,KAAK,KAAK,KAAiC;AAAA,IACvE;AAAA,EACJ;AACF;",
6
+ "names": []
7
+ }
@@ -1,70 +1,31 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- /**
6
- * Extracts the unique item IDs from the result set
7
- *
8
- * @param result - The result set to extract the IDs from
9
- */
10
- export function getResultIds(result) {
11
- var set = new Set();
12
- result.forEach(function (item) {
13
- item.result.forEach(function (id) {
14
- return set.add(id);
15
- });
1
+ function getResultIds(result) {
2
+ const set = /* @__PURE__ */ new Set();
3
+ result.forEach((item) => {
4
+ item.result.forEach((id) => set.add(id));
16
5
  });
17
6
  return Array.from(set);
18
7
  }
19
-
20
- /**
21
- * Get the items from the list that match the given IDs
22
- *
23
- * @param items - The list of items to search through
24
- * @param ids - The list of IDs to search for
25
- * @param idKey - The key to use to find the IDs in the items
26
- */
27
- export function findItemsByIds(items, ids, idKey) {
28
- return items.filter(function (item) {
29
- return item && ids.includes(getValueFromNestedKey(item, idKey));
30
- });
8
+ function findItemsByIds(items, ids, idKey) {
9
+ return items.filter(
10
+ (item) => item && ids.includes(getValueFromNestedKey(item, idKey))
11
+ );
31
12
  }
32
13
  function getValueFromNestedKey(object, nestedKey) {
33
- var keys = nestedKey.split(':');
34
- var result = object;
35
- var _iterator = _createForOfIteratorHelper(keys),
36
- _step;
37
- try {
38
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
39
- var keySegment = _step.value;
40
- if (result.hasOwnProperty(keySegment)) {
41
- result = result[keySegment];
42
- }
14
+ const keys = nestedKey.split(":");
15
+ let result = object;
16
+ for (const keySegment of keys) {
17
+ if (result.hasOwnProperty(keySegment)) {
18
+ result = result[keySegment];
43
19
  }
44
- } catch (err) {
45
- _iterator.e(err);
46
- } finally {
47
- _iterator.f();
48
20
  }
49
21
  return result;
50
22
  }
51
-
52
- /**
53
- * Recursively get all the keys from an object
54
- *
55
- * The keys are returned in the format `parentKey.childKey` for nested objects
56
- * and `key` for top level objects (objects that are not nested inside another object).
57
- *
58
- * @param object - The item to get the keys from
59
- * @param parentKey - The parent key to which the current key should be appended
60
- */
61
- export function getAllItemKeys(object) {
62
- var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
63
- var keys = [];
64
- for (var key in object) {
23
+ function getAllItemKeys(object, parentKey = "") {
24
+ let keys = [];
25
+ for (const key in object) {
65
26
  if (object.hasOwnProperty(key)) {
66
- var currentKey = parentKey ? "".concat(parentKey, ".").concat(key) : key;
67
- if (_typeof(object[key]) === 'object' && object[key] !== null) {
27
+ const currentKey = parentKey ? `${parentKey}.${key}` : key;
28
+ if (typeof object[key] === "object" && object[key] !== null) {
68
29
  keys = keys.concat(getAllItemKeys(object[key], currentKey));
69
30
  } else {
70
31
  keys.push(currentKey);
@@ -72,4 +33,10 @@ export function getAllItemKeys(object) {
72
33
  }
73
34
  }
74
35
  return keys;
75
- }
36
+ }
37
+ export {
38
+ findItemsByIds,
39
+ getAllItemKeys,
40
+ getResultIds
41
+ };
42
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/search/utils.ts"],
4
+ "sourcesContent": ["import { SimpleDocumentSearchResultSetUnit } from 'flexsearch';\n\n/**\n * Extracts the unique item IDs from the result set\n *\n * @param result - The result set to extract the IDs from\n */\nexport function getResultIds(result: SimpleDocumentSearchResultSetUnit[]) {\n const set = new Set<number | string>();\n result.forEach((item) => {\n item.result.forEach((id) => set.add(id));\n });\n return Array.from(set);\n}\n\n/**\n * Get the items from the list that match the given IDs\n *\n * @param items - The list of items to search through\n * @param ids - The list of IDs to search for\n * @param idKey - The key to use to find the IDs in the items\n */\nexport function findItemsByIds<T extends Record<string, any>>(\n items: T[],\n ids: (string | number)[],\n idKey: Extract<keyof T, string>\n) {\n return items.filter(\n (item) => item && ids.includes(getValueFromNestedKey(item, idKey))\n );\n}\n\nfunction getValueFromNestedKey(object: Record<string, any>, nestedKey: string) {\n const keys = nestedKey.split(':');\n\n let result = object;\n for (const keySegment of keys) {\n if (result.hasOwnProperty(keySegment)) {\n result = result[keySegment];\n }\n }\n return (result as unknown) as string;\n}\n\n/**\n * Recursively get all the keys from an object\n *\n * The keys are returned in the format `parentKey.childKey` for nested objects\n * and `key` for top level objects (objects that are not nested inside another object).\n *\n * @param object - The item to get the keys from\n * @param parentKey - The parent key to which the current key should be appended\n */\nexport function getAllItemKeys(\n object: Record<string, any>,\n parentKey: string = ''\n): string[] {\n let keys: string[] = [];\n for (const key in object) {\n if (object.hasOwnProperty(key)) {\n const currentKey = parentKey ? `${parentKey}.${key}` : key;\n\n if (typeof object[key] === 'object' && object[key] !== null) {\n keys = keys.concat(getAllItemKeys(object[key], currentKey));\n } else {\n keys.push(currentKey);\n }\n }\n }\n\n return keys;\n}\n"],
5
+ "mappings": "AAOO,SAAS,aAAa,QAA6C;AACxE,QAAM,MAAM,oBAAI,IAAqB;AACrC,SAAO,QAAQ,CAAC,SAAS;AACvB,SAAK,OAAO,QAAQ,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;AAAA,EACzC,CAAC;AACD,SAAO,MAAM,KAAK,GAAG;AACvB;AASO,SAAS,eACd,OACA,KACA,OACA;AACA,SAAO,MAAM;AAAA,IACX,CAAC,SAAS,QAAQ,IAAI,SAAS,sBAAsB,MAAM,KAAK,CAAC;AAAA,EACnE;AACF;AAEA,SAAS,sBAAsB,QAA6B,WAAmB;AAC7E,QAAM,OAAO,UAAU,MAAM,GAAG;AAEhC,MAAI,SAAS;AACb,aAAW,cAAc,MAAM;AAC7B,QAAI,OAAO,eAAe,UAAU,GAAG;AACrC,eAAS,OAAO,UAAU;AAAA,IAC5B;AAAA,EACF;AACA,SAAQ;AACV;AAWO,SAAS,eACd,QACA,YAAoB,IACV;AACV,MAAI,OAAiB,CAAC;AACtB,aAAW,OAAO,QAAQ;AACxB,QAAI,OAAO,eAAe,GAAG,GAAG;AAC9B,YAAM,aAAa,YAAY,GAAG,SAAS,IAAI,GAAG,KAAK;AAEvD,UAAI,OAAO,OAAO,GAAG,MAAM,YAAY,OAAO,GAAG,MAAM,MAAM;AAC3D,eAAO,KAAK,OAAO,eAAe,OAAO,GAAG,GAAG,UAAU,CAAC;AAAA,MAC5D,OAAO;AACL,aAAK,KAAK,UAAU;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
6
+ "names": []
7
+ }