@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.
- package/cjs/hook/index.js +46 -46
- package/cjs/hook.js.map +7 -0
- package/cjs/index.js +39 -19
- package/cjs/index.js.map +7 -0
- package/cjs/search/index.js +24 -6
- package/cjs/search/index.js.map +7 -0
- package/cjs/search/lang/gr/encoder/index.js +35 -23
- package/cjs/search/lang/gr/encoder.js.map +7 -0
- package/cjs/search/lang/gr/normalization-map/index.js +126 -104
- package/cjs/search/lang/gr/normalization-map.js.map +7 -0
- package/cjs/search/search-index/index.js +86 -119
- package/cjs/search/search-index.js.map +7 -0
- package/cjs/search/utils/index.js +47 -63
- package/cjs/search/utils.js.map +7 -0
- package/cjs/types/index.js +16 -4
- package/cjs/types.js.map +7 -0
- package/hook/index.js +18 -41
- package/hook.js.map +7 -0
- package/index.js +7 -3
- package/index.js.map +7 -0
- package/package.json +3 -3
- package/search/index.js +5 -1
- package/search/index.js.map +7 -0
- package/search/lang/gr/encoder/index.js +13 -19
- package/search/lang/gr/encoder.js.map +7 -0
- package/search/lang/gr/normalization-map/index.js +104 -100
- package/search/lang/gr/normalization-map.js.map +7 -0
- package/search/search-index/index.js +59 -110
- package/search/search-index.js.map +7 -0
- package/search/utils/index.js +25 -58
- package/search/utils.js.map +7 -0
- package/types/index.js +1 -1
- package/types.js.map +7 -0
- package/cjs/hook.spec/index.js +0 -481
- package/cjs/search/__tests__/utils.spec/index.js +0 -83
- package/cjs/test-utils/data.json +0 -552
- package/hook.spec/index.js +0 -478
- package/hook.spec/package.json +0 -6
- package/search/__tests__/utils.spec/index.js +0 -81
- package/search/__tests__/utils.spec/package.json +0 -6
- package/test-utils/data.json +0 -552
|
@@ -1,139 +1,106 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
Object.
|
|
6
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var search_index_exports = {};
|
|
20
|
+
__export(search_index_exports, {
|
|
21
|
+
SearchIndex: () => SearchIndex
|
|
7
22
|
});
|
|
8
|
-
exports
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _utils = require("./utils");
|
|
16
|
-
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; }
|
|
17
|
-
/**
|
|
18
|
-
* Wrapper class around third party index and search library
|
|
19
|
-
*
|
|
20
|
-
* @typeParam T - The type of the data that will be indexed
|
|
21
|
-
*/
|
|
22
|
-
var SearchIndex = exports.SearchIndex = /*#__PURE__*/function () {
|
|
23
|
-
function SearchIndex(items, options) {
|
|
24
|
-
var _this = this;
|
|
25
|
-
(0, _classCallCheck2["default"])(this, SearchIndex);
|
|
26
|
-
/**
|
|
27
|
-
* Instance of the third party library's index
|
|
28
|
-
*/
|
|
29
|
-
this.index = void 0;
|
|
30
|
-
this.idKey = void 0;
|
|
31
|
-
this.idKey = 'id';
|
|
23
|
+
module.exports = __toCommonJS(search_index_exports);
|
|
24
|
+
var import_flexsearch = require("flexsearch");
|
|
25
|
+
var import_encoder = require("./lang/gr/encoder");
|
|
26
|
+
var import_utils = require("./utils");
|
|
27
|
+
class SearchIndex {
|
|
28
|
+
constructor(items, options) {
|
|
29
|
+
this.idKey = "id";
|
|
32
30
|
if (options && options.idKey) {
|
|
33
|
-
this.idKey = options.idKey.replace(
|
|
34
|
-
} else if (!(items[0] &&
|
|
35
|
-
items = items.map(
|
|
36
|
-
return (0, _extends2["default"])({}, item, {
|
|
37
|
-
id: index
|
|
38
|
-
});
|
|
39
|
-
});
|
|
31
|
+
this.idKey = options.idKey.replace(".", ":");
|
|
32
|
+
} else if (!(items[0] && "id" in items[0])) {
|
|
33
|
+
items = items.map((item, index) => ({ ...item, id: index }));
|
|
40
34
|
}
|
|
41
|
-
|
|
35
|
+
let fields = [];
|
|
42
36
|
if (options && options.fields) {
|
|
43
37
|
fields = options.fields;
|
|
44
38
|
} else if (items[0]) {
|
|
45
|
-
fields = (0,
|
|
39
|
+
fields = (0, import_utils.getAllItemKeys)(items[0]);
|
|
46
40
|
}
|
|
47
|
-
fields = fields.filter(
|
|
48
|
-
|
|
49
|
-
}).map(function (field) {
|
|
50
|
-
return field.replace('.', ':');
|
|
51
|
-
});
|
|
52
|
-
this.index = new _flexsearch.Document({
|
|
41
|
+
fields = fields.filter((field) => field !== this.idKey).map((field) => field.replace(".", ":"));
|
|
42
|
+
this.index = new import_flexsearch.Document({
|
|
53
43
|
document: {
|
|
54
44
|
id: this.idKey,
|
|
55
45
|
index: fields
|
|
56
46
|
},
|
|
57
|
-
tokenize:
|
|
58
|
-
worker: options
|
|
59
|
-
encode:
|
|
47
|
+
tokenize: "forward",
|
|
48
|
+
worker: options?.enableWorker,
|
|
49
|
+
encode: import_encoder.encodeGreek
|
|
60
50
|
});
|
|
61
51
|
this.addAll(items);
|
|
62
52
|
}
|
|
63
|
-
|
|
64
53
|
/**
|
|
65
54
|
* Add an item to the index
|
|
66
55
|
*
|
|
67
56
|
* @param item - The item to add to the index
|
|
68
57
|
*/
|
|
69
|
-
(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
119
|
-
while (1) switch (_context.prev = _context.next) {
|
|
120
|
-
case 0:
|
|
121
|
-
return _context.abrupt("return", this.index.searchAsync(searchTerm).then(function (res) {
|
|
122
|
-
return (0, _utils.getResultIds)(res);
|
|
123
|
-
}).then(function (res) {
|
|
124
|
-
return (0, _utils.findItemsByIds)(documents, res, _this3.idKey);
|
|
125
|
-
}));
|
|
126
|
-
case 1:
|
|
127
|
-
case "end":
|
|
128
|
-
return _context.stop();
|
|
129
|
-
}
|
|
130
|
-
}, _callee, this);
|
|
131
|
-
}));
|
|
132
|
-
function searchAsync(_x, _x2) {
|
|
133
|
-
return _searchAsync.apply(this, arguments);
|
|
134
|
-
}
|
|
135
|
-
return searchAsync;
|
|
136
|
-
}())
|
|
137
|
-
}]);
|
|
138
|
-
return SearchIndex;
|
|
139
|
-
}();
|
|
58
|
+
add(item) {
|
|
59
|
+
this.index.add(item);
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Add multiple items to the index
|
|
64
|
+
*
|
|
65
|
+
* @param items - The list of items to add to the index
|
|
66
|
+
*/
|
|
67
|
+
addAll(items) {
|
|
68
|
+
items.forEach((item) => this.index.add(item));
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Search the index for the given term
|
|
73
|
+
*
|
|
74
|
+
* @param documents - The list of documents to search
|
|
75
|
+
* @param searchTerm - The term to search for
|
|
76
|
+
* @returns The list of items that match the search term
|
|
77
|
+
*/
|
|
78
|
+
search(documents, searchTerm) {
|
|
79
|
+
const res = this.index.search(searchTerm);
|
|
80
|
+
const ids = (0, import_utils.getResultIds)(res);
|
|
81
|
+
return (0, import_utils.findItemsByIds)(
|
|
82
|
+
documents,
|
|
83
|
+
ids,
|
|
84
|
+
this.idKey
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Asynchronously search the index for the given term
|
|
89
|
+
*
|
|
90
|
+
* @param documents - The list of documents to search
|
|
91
|
+
* @param searchTerm - The term to search for
|
|
92
|
+
* @returns The list of items that match the search term
|
|
93
|
+
*/
|
|
94
|
+
async searchAsync(documents, searchTerm) {
|
|
95
|
+
return this.index.searchAsync(searchTerm).then((res) => {
|
|
96
|
+
return (0, import_utils.getResultIds)(res);
|
|
97
|
+
}).then(
|
|
98
|
+
(res) => (0, import_utils.findItemsByIds)(documents, res, this.idKey)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
SearchIndex
|
|
105
|
+
});
|
|
106
|
+
//# 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;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAyB;AAEzB,qBAA4B;AAC5B,mBAA6D;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,mBAAS,6BAAe,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,2BAAY;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,UAAM,2BAAa,GAAG;AAC5B,eAAO;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,iBAAO,2BAAa,GAAG;AAAA,IACzB,CAAC,EACA;AAAA,MAAK,CAAC,YACL,6BAAe,WAAW,KAAK,KAAK,KAAiC;AAAA,IACvE;AAAA,EACJ;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,79 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
findItemsByIds: () => findItemsByIds,
|
|
22
|
+
getAllItemKeys: () => getAllItemKeys,
|
|
23
|
+
getResultIds: () => getResultIds
|
|
6
24
|
});
|
|
7
|
-
exports
|
|
8
|
-
exports.getAllItemKeys = getAllItemKeys;
|
|
9
|
-
exports.getResultIds = getResultIds;
|
|
10
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
-
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; } } }; }
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
|
-
/**
|
|
15
|
-
* Extracts the unique item IDs from the result set
|
|
16
|
-
*
|
|
17
|
-
* @param result - The result set to extract the IDs from
|
|
18
|
-
*/
|
|
25
|
+
module.exports = __toCommonJS(utils_exports);
|
|
19
26
|
function getResultIds(result) {
|
|
20
|
-
|
|
21
|
-
result.forEach(
|
|
22
|
-
item.result.forEach(
|
|
23
|
-
return set.add(id);
|
|
24
|
-
});
|
|
27
|
+
const set = /* @__PURE__ */ new Set();
|
|
28
|
+
result.forEach((item) => {
|
|
29
|
+
item.result.forEach((id) => set.add(id));
|
|
25
30
|
});
|
|
26
31
|
return Array.from(set);
|
|
27
32
|
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get the items from the list that match the given IDs
|
|
31
|
-
*
|
|
32
|
-
* @param items - The list of items to search through
|
|
33
|
-
* @param ids - The list of IDs to search for
|
|
34
|
-
* @param idKey - The key to use to find the IDs in the items
|
|
35
|
-
*/
|
|
36
33
|
function findItemsByIds(items, ids, idKey) {
|
|
37
|
-
return items.filter(
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
return items.filter(
|
|
35
|
+
(item) => item && ids.includes(getValueFromNestedKey(item, idKey))
|
|
36
|
+
);
|
|
40
37
|
}
|
|
41
38
|
function getValueFromNestedKey(object, nestedKey) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
48
|
-
var keySegment = _step.value;
|
|
49
|
-
if (result.hasOwnProperty(keySegment)) {
|
|
50
|
-
result = result[keySegment];
|
|
51
|
-
}
|
|
39
|
+
const keys = nestedKey.split(":");
|
|
40
|
+
let result = object;
|
|
41
|
+
for (const keySegment of keys) {
|
|
42
|
+
if (result.hasOwnProperty(keySegment)) {
|
|
43
|
+
result = result[keySegment];
|
|
52
44
|
}
|
|
53
|
-
} catch (err) {
|
|
54
|
-
_iterator.e(err);
|
|
55
|
-
} finally {
|
|
56
|
-
_iterator.f();
|
|
57
45
|
}
|
|
58
46
|
return result;
|
|
59
47
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*
|
|
64
|
-
* The keys are returned in the format `parentKey.childKey` for nested objects
|
|
65
|
-
* and `key` for top level objects (objects that are not nested inside another object).
|
|
66
|
-
*
|
|
67
|
-
* @param object - The item to get the keys from
|
|
68
|
-
* @param parentKey - The parent key to which the current key should be appended
|
|
69
|
-
*/
|
|
70
|
-
function getAllItemKeys(object) {
|
|
71
|
-
var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
72
|
-
var keys = [];
|
|
73
|
-
for (var key in object) {
|
|
48
|
+
function getAllItemKeys(object, parentKey = "") {
|
|
49
|
+
let keys = [];
|
|
50
|
+
for (const key in object) {
|
|
74
51
|
if (object.hasOwnProperty(key)) {
|
|
75
|
-
|
|
76
|
-
if (
|
|
52
|
+
const currentKey = parentKey ? `${parentKey}.${key}` : key;
|
|
53
|
+
if (typeof object[key] === "object" && object[key] !== null) {
|
|
77
54
|
keys = keys.concat(getAllItemKeys(object[key], currentKey));
|
|
78
55
|
} else {
|
|
79
56
|
keys.push(currentKey);
|
|
@@ -81,4 +58,11 @@ function getAllItemKeys(object) {
|
|
|
81
58
|
}
|
|
82
59
|
}
|
|
83
60
|
return keys;
|
|
84
|
-
}
|
|
61
|
+
}
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
findItemsByIds,
|
|
65
|
+
getAllItemKeys,
|
|
66
|
+
getResultIds
|
|
67
|
+
});
|
|
68
|
+
//# 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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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
|
+
}
|
package/cjs/types/index.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
package/cjs/types.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/types.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Options for configuring the useSearch hook\n */\nexport interface UseSearchOptions<T extends Record<string, any>> {\n indexing: SearchIndexOptions<T>;\n}\n\n/**\n * Options for configuring the search index\n *\n * @typeParam T - The type of the data that will be indexed\n */\nexport interface SearchIndexOptions<T> {\n /**\n * Describes where to find the unique ID for each item in the data\n *\n * This can also be a nested key, e.g. `address.street`. If not specified, the search index will\n * create an 'id' field on each item, with the value being the index of the item in the array.\n */\n idKey?: NestedKeyOf<T>;\n /**\n * List of fields to index\n *\n * Contains a list of fields from the document, that should be indexed. The fields can be nested.\n *\n * @example Using nested keys\n * ```\n * {\n * id: 1,\n * name: 'John',\n * address: {\n * street: '123 Main St',\n * city: 'New York'\n * }\n * }\n * ```\n * To search against the `street` key, add `address.street` to the fields array.\n */\n fields?: NestedKeyOf<T>[];\n /**\n * Whether to use a web worker for indexing\n */\n enableWorker?: boolean;\n}\n\n/**\n * Any key of an object that has nested objects.\n *\n * This utility type is used to get all the primitive keys of an object, including the keys of any nested objects.\n *\n * @typeParam ObjectType - The type of the object to get the keys of\n */\nexport type NestedKeyOf<T> = T extends Primitive\n ? never\n :\n | (keyof T & string)\n | { [P in keyof T & string]: DeepSubKeys<T, P> }[keyof T & string];\n\ntype DeepSubKeys<T, P extends keyof T & string> = T[P] extends (infer Inner)[]\n ? `${P}.${NestedKeyOf<Inner>}`\n : T[P] extends object\n ? `${P}.${NestedKeyOf<T[P]>}`\n : never;\n\ntype Primitive = null | undefined | string | number | boolean | symbol | bigint;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/hook/index.js
CHANGED
|
@@ -1,51 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
1
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
2
|
import SearchIndex from "./search";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
* @typeParam T - The type of the data in the documents list
|
|
15
|
-
*/
|
|
16
|
-
export default function useSearch(documents, query, options) {
|
|
17
|
-
var _useState = useState(false),
|
|
18
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
-
loading = _useState2[0],
|
|
20
|
-
setLoading = _useState2[1];
|
|
21
|
-
var _useState3 = useState(documents),
|
|
22
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
23
|
-
data = _useState4[0],
|
|
24
|
-
setData = _useState4[1];
|
|
25
|
-
var indexing = options === null || options === void 0 ? void 0 : options.indexing;
|
|
26
|
-
var index = useMemo(function () {
|
|
27
|
-
return new SearchIndex(documents, indexing);
|
|
28
|
-
}, [documents, indexing]);
|
|
29
|
-
var search = useCallback(function () {
|
|
3
|
+
function useSearch(documents, query, options) {
|
|
4
|
+
const [loading, setLoading] = useState(false);
|
|
5
|
+
const [data, setData] = useState(documents);
|
|
6
|
+
const indexing = options?.indexing;
|
|
7
|
+
const index = useMemo(() => new SearchIndex(documents, indexing), [
|
|
8
|
+
documents,
|
|
9
|
+
indexing
|
|
10
|
+
]);
|
|
11
|
+
const search = useCallback(() => {
|
|
30
12
|
if (query) {
|
|
31
13
|
setLoading(true);
|
|
32
|
-
index.searchAsync(documents, query).then(
|
|
33
|
-
return setData(data);
|
|
34
|
-
})["finally"](function () {
|
|
35
|
-
return setLoading(false);
|
|
36
|
-
});
|
|
14
|
+
index.searchAsync(documents, query).then((data2) => setData(data2)).finally(() => setLoading(false));
|
|
37
15
|
} else {
|
|
38
16
|
setData(documents);
|
|
39
17
|
}
|
|
40
18
|
}, [query, index, documents]);
|
|
41
|
-
|
|
19
|
+
const reset = useCallback(() => {
|
|
42
20
|
setData(documents);
|
|
43
21
|
setLoading(false);
|
|
44
22
|
}, [documents]);
|
|
45
|
-
return {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
23
|
+
return { data, loading, search, reset };
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
useSearch as default
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=hook.js.map
|
package/hook.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/hook.ts"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useMemo, useState } from 'react';\nimport SearchIndex from './search';\nimport { UseSearchOptions } from './types';\n\n/**\n * Hook for searching through a list of documents\n *\n * Returns a list of documents that match the search query.\n * If no query is provided, it returns the original list of documents.\n *\n * @param documents - The list of documents to search through\n * @param options - Options for configuring the search index\n * @param query - The search query\n *\n * @typeParam T - The type of the data in the documents list\n */\nexport default function useSearch<T extends Record<string, any>>(\n documents: T[],\n query?: string,\n options?: UseSearchOptions<T>\n) {\n const [loading, setLoading] = useState(false);\n const [data, setData] = useState(documents);\n\n const indexing = options?.indexing;\n\n const index = useMemo(() => new SearchIndex(documents, indexing), [\n documents,\n indexing,\n ]);\n\n const search = useCallback(() => {\n if (query) {\n setLoading(true);\n index\n .searchAsync(documents, query)\n .then((data) => setData(data))\n .finally(() => setLoading(false));\n } else {\n setData(documents);\n }\n }, [query, index, documents]);\n\n const reset = useCallback(() => {\n setData(documents);\n setLoading(false);\n }, [documents]);\n\n return { data, loading, search, reset };\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,aAAa,SAAS,gBAAgB;AAC/C,OAAO,iBAAiB;AAeT,SAAR,UACL,WACA,OACA,SACA;AACA,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,SAAS;AAE1C,QAAM,WAAW,SAAS;AAE1B,QAAM,QAAQ,QAAQ,MAAM,IAAI,YAAY,WAAW,QAAQ,GAAG;AAAA,IAChE;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,SAAS,YAAY,MAAM;AAC/B,QAAI,OAAO;AACT,iBAAW,IAAI;AACf,YACG,YAAY,WAAW,KAAK,EAC5B,KAAK,CAACA,UAAS,QAAQA,KAAI,CAAC,EAC5B,QAAQ,MAAM,WAAW,KAAK,CAAC;AAAA,IACpC,OAAO;AACL,cAAQ,SAAS;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,OAAO,OAAO,SAAS,CAAC;AAE5B,QAAM,QAAQ,YAAY,MAAM;AAC9B,YAAQ,SAAS;AACjB,eAAW,KAAK;AAAA,EAClB,GAAG,CAAC,SAAS,CAAC;AAEd,SAAO,EAAE,MAAM,SAAS,QAAQ,MAAM;AACxC;",
|
|
6
|
+
"names": ["data"]
|
|
7
|
+
}
|
package/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
/** @license Digigov v1.
|
|
1
|
+
/** @license Digigov v1.2.0-85c27c19
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the BSD-2-Clause license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
5
5
|
*/
|
|
6
6
|
import useSearch from "./hook";
|
|
7
|
-
|
|
8
|
-
export * from "./search";
|
|
7
|
+
var src_default = useSearch;
|
|
8
|
+
export * from "./search";
|
|
9
|
+
export {
|
|
10
|
+
src_default as default
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/text-search",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-85c27c19",
|
|
4
4
|
"description": "@digigov text-search",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"flexsearch": "0.7.31"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"react": "
|
|
18
|
-
"react-dom": "
|
|
17
|
+
"react": ">=16.8.0 <19.0.0",
|
|
18
|
+
"react-dom": ">=16.8.0 <19.0.0"
|
|
19
19
|
},
|
|
20
20
|
"typings": "./index.d.ts"
|
|
21
21
|
}
|
package/search/index.js
CHANGED