From ee614f6437e4190501043b6d14167b6e342cf0c9 Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Tue, 2 Jan 2018 21:25:09 +0000 Subject: [PATCH] Release 2.0.0-beta.5 --- CHANGELOG.md | 16 + dist/packages/fs-storage/lokijs.fs-storage.js | 9 +- .../fs-storage/lokijs.fs-storage.js.map | 2 +- .../fs-storage/lokijs.fs-storage.min.js | 2 +- .../fs-storage/types/common/types.d.ts | 14 +- .../types/fs-storage/src/fs_storage.d.ts | 3 +- .../types/fs-storage/src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../full-text-search-language/src/index.d.ts | 1 + .../src/full_text_search.d.ts | 6 +- .../types/full-text-search/src/index.d.ts | 7 +- .../full-text-search/src/index_searcher.d.ts | 6 +- .../full-text-search/src/query_builder.d.ts | 74 +- .../types/full-text-search/src/scorer.d.ts | 32 +- .../types/indexed-storage/src/index.d.ts | 3 + .../indexed-storage/src/indexed_storage.d.ts | 4 +- .../types/local-storage/src/index.d.ts | 3 + .../local-storage/src/local_storage.d.ts | 6 +- .../fs-storage/types/loki/src/clone.d.ts | 8 +- .../fs-storage/types/loki/src/collection.d.ts | 275 ++-- .../types/loki/src/dynamic_view.d.ts | 117 +- .../types/loki/src/event_emitter.d.ts | 3 +- .../fs-storage/types/loki/src/helper.d.ts | 36 +- .../fs-storage/types/loki/src/index.d.ts | 5 +- .../fs-storage/types/loki/src/loki.d.ts | 79 +- .../types/loki/src/result_set.d.ts} | 216 ++- .../types/loki/src/unique_index.d.ts | 10 +- .../types/memory-storage/src/index.d.ts | 3 + .../src/memory_storage.d.ts} | 35 +- .../types/partitioning-adapter/src/index.d.ts | 3 + .../src/partitioning_adapter.d.ts | 15 +- .../lokijs.full-text-search-language-de.js | 28 +- ...lokijs.full-text-search-language-de.js.map | 2 +- ...lokijs.full-text-search-language-de.min.js | 2 +- .../types/common/types.d.ts | 14 +- .../types/fs-storage/src/fs_storage.d.ts | 3 +- .../types/fs-storage/src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../full-text-search-language/src/index.d.ts | 1 + .../src/full_text_search.d.ts | 6 +- .../types/full-text-search/src/index.d.ts | 7 +- .../full-text-search/src/index_searcher.d.ts | 6 +- .../full-text-search/src/query_builder.d.ts | 74 +- .../types/full-text-search/src/scorer.d.ts | 32 +- .../types/indexed-storage/src/index.d.ts | 3 + .../indexed-storage/src/indexed_storage.d.ts | 4 +- .../types/local-storage/src/index.d.ts | 3 + .../local-storage/src/local_storage.d.ts | 6 +- .../types/loki/src/clone.d.ts | 8 +- .../types/loki/src/collection.d.ts | 275 ++-- .../types/loki/src/dynamic_view.d.ts | 117 +- .../types/loki/src/event_emitter.d.ts | 3 +- .../types/loki/src/helper.d.ts | 36 +- .../types/loki/src/index.d.ts | 5 +- .../types/loki/src/loki.d.ts | 79 +- .../types/loki/src/result_set.d.ts} | 216 ++- .../types/loki/src/unique_index.d.ts | 10 +- .../types/memory-storage/src/index.d.ts | 3 + .../memory-storage/src/memory_storage.d.ts} | 35 +- .../types/partitioning-adapter/src/index.d.ts | 3 + .../src/partitioning_adapter.d.ts | 15 +- .../lokijs.full-text-search-language-en.js | 30 +- ...lokijs.full-text-search-language-en.js.map | 2 +- ...lokijs.full-text-search-language-en.min.js | 2 +- .../types/common/types.d.ts | 14 +- .../types/fs-storage/src/fs_storage.d.ts | 3 +- .../types/fs-storage/src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../full-text-search-language/src/index.d.ts | 1 + .../src/full_text_search.d.ts | 6 +- .../types/full-text-search/src/index.d.ts | 7 +- .../full-text-search/src/index_searcher.d.ts | 6 +- .../full-text-search/src/query_builder.d.ts | 74 +- .../types/full-text-search/src/scorer.d.ts | 32 +- .../types/indexed-storage/src/index.d.ts | 3 + .../indexed-storage/src/indexed_storage.d.ts | 4 +- .../types/local-storage/src/index.d.ts | 3 + .../local-storage/src/local_storage.d.ts | 6 +- .../types/loki/src/clone.d.ts | 8 +- .../types/loki/src/collection.d.ts | 275 ++-- .../types/loki/src/dynamic_view.d.ts | 117 +- .../types/loki/src/event_emitter.d.ts | 3 +- .../types/loki/src/helper.d.ts | 36 +- .../types/loki/src/index.d.ts | 5 +- .../types/loki/src/loki.d.ts | 79 +- .../types/loki/src/result_set.d.ts} | 216 ++- .../types/loki/src/unique_index.d.ts | 10 +- .../types/memory-storage/src/index.d.ts | 3 + .../memory-storage/src/memory_storage.d.ts} | 35 +- .../types/partitioning-adapter/src/index.d.ts | 3 + .../src/partitioning_adapter.d.ts | 15 +- .../lokijs.full-text-search-language.js | 21 +- .../lokijs.full-text-search-language.js.map | 2 +- .../lokijs.full-text-search-language.min.js | 2 +- .../types/common/types.d.ts | 14 +- .../types/fs-storage/src/fs_storage.d.ts | 3 +- .../types/fs-storage/src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../full-text-search-language/src/index.d.ts | 1 + .../src/full_text_search.d.ts | 6 +- .../types/full-text-search/src/index.d.ts | 7 +- .../full-text-search/src/index_searcher.d.ts | 6 +- .../full-text-search/src/query_builder.d.ts | 74 +- .../types/full-text-search/src/scorer.d.ts | 32 +- .../types/indexed-storage/src/index.d.ts | 3 + .../indexed-storage/src/indexed_storage.d.ts | 4 +- .../types/local-storage/src/index.d.ts | 3 + .../local-storage/src/local_storage.d.ts | 6 +- .../types/loki/src/clone.d.ts | 8 +- .../types/loki/src/collection.d.ts | 275 ++-- .../types/loki/src/dynamic_view.d.ts | 117 +- .../types/loki/src/event_emitter.d.ts | 3 +- .../types/loki/src/helper.d.ts | 36 +- .../types/loki/src/index.d.ts | 5 +- .../types/loki/src/loki.d.ts | 79 +- .../types/loki/src/result_set.d.ts} | 216 ++- .../types/loki/src/unique_index.d.ts | 10 +- .../types/memory-storage/src/index.d.ts | 3 + .../src/memory_storage.d.ts} | 35 +- .../types/partitioning-adapter/src/index.d.ts | 3 + .../src/partitioning_adapter.d.ts | 15 +- .../lokijs.full-text-search.js | 341 ++-- .../lokijs.full-text-search.js.map | 2 +- .../lokijs.full-text-search.min.js | 2 +- .../full-text-search/types/common/types.d.ts | 14 +- .../types/fs-storage/src/fs_storage.d.ts | 3 +- .../types/fs-storage/src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../full-text-search-language/src/index.d.ts | 1 + .../src/full_text_search.d.ts | 6 +- .../types/full-text-search/src/index.d.ts | 7 +- .../full-text-search/src/index_searcher.d.ts | 6 +- .../full-text-search/src/query_builder.d.ts | 74 +- .../types/full-text-search/src/scorer.d.ts | 32 +- .../types/indexed-storage/src/index.d.ts | 3 + .../indexed-storage/src/indexed_storage.d.ts | 4 +- .../types/local-storage/src/index.d.ts | 3 + .../local-storage/src/local_storage.d.ts | 6 +- .../types/loki/src/clone.d.ts | 8 +- .../types/loki/src/collection.d.ts | 275 ++-- .../types/loki/src/dynamic_view.d.ts | 117 +- .../types/loki/src/event_emitter.d.ts | 3 +- .../types/loki/src/helper.d.ts | 36 +- .../types/loki/src/index.d.ts | 5 +- .../full-text-search/types/loki/src/loki.d.ts | 79 +- .../types/loki/src/memory_adapter.d.ts | 40 - .../types/loki/src/result_set.d.ts | 302 ++++ .../types/loki/src/resultset.d.ts | 262 --- .../types/loki/src/unique_index.d.ts | 10 +- .../types/memory-storage/src/index.d.ts | 3 + .../memory-storage/src/memory_storage.d.ts | 57 + .../types/partitioning-adapter/src/index.d.ts | 3 + .../src/partitioning_adapter.d.ts | 15 +- .../indexed-storage/lokijs.indexed-storage.js | 30 +- .../lokijs.indexed-storage.js.map | 2 +- .../lokijs.indexed-storage.min.js | 2 +- .../indexed-storage/types/common/types.d.ts | 14 +- .../types/fs-storage/src/fs_storage.d.ts | 3 +- .../types/fs-storage/src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../full-text-search-language/src/index.d.ts | 1 + .../src/full_text_search.d.ts | 6 +- .../types/full-text-search/src/index.d.ts | 7 +- .../full-text-search/src/index_searcher.d.ts | 6 +- .../full-text-search/src/query_builder.d.ts | 74 +- .../types/full-text-search/src/scorer.d.ts | 32 +- .../types/indexed-storage/src/index.d.ts | 3 + .../indexed-storage/src/indexed_storage.d.ts | 4 +- .../types/local-storage/src/index.d.ts | 3 + .../local-storage/src/local_storage.d.ts | 6 +- .../indexed-storage/types/loki/src/clone.d.ts | 8 +- .../types/loki/src/collection.d.ts | 275 ++-- .../types/loki/src/dynamic_view.d.ts | 117 +- .../types/loki/src/event_emitter.d.ts | 3 +- .../types/loki/src/helper.d.ts | 36 +- .../indexed-storage/types/loki/src/index.d.ts | 5 +- .../indexed-storage/types/loki/src/loki.d.ts | 79 +- .../types/loki/src/memory_adapter.d.ts | 40 - .../types/loki/src/result_set.d.ts | 302 ++++ .../types/loki/src/resultset.d.ts | 262 --- .../types/loki/src/unique_index.d.ts | 10 +- .../types/memory-storage/src/index.d.ts | 3 + .../memory-storage/src/memory_storage.d.ts | 57 + .../types/partitioning-adapter/src/index.d.ts | 3 + .../src/partitioning_adapter.d.ts | 15 +- .../local-storage/lokijs.local-storage.js | 32 +- .../local-storage/lokijs.local-storage.js.map | 2 +- .../local-storage/lokijs.local-storage.min.js | 2 +- .../local-storage/types/common/types.d.ts | 14 +- .../types/fs-storage/src/fs_storage.d.ts | 3 +- .../types/fs-storage/src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../full-text-search-language/src/index.d.ts | 1 + .../src/full_text_search.d.ts | 6 +- .../types/full-text-search/src/index.d.ts | 7 +- .../full-text-search/src/index_searcher.d.ts | 6 +- .../full-text-search/src/query_builder.d.ts | 74 +- .../types/full-text-search/src/scorer.d.ts | 32 +- .../types/indexed-storage/src/index.d.ts | 3 + .../indexed-storage/src/indexed_storage.d.ts | 4 +- .../types/local-storage/src/index.d.ts | 3 + .../local-storage/src/local_storage.d.ts | 6 +- .../local-storage/types/loki/src/clone.d.ts | 8 +- .../types/loki/src/collection.d.ts | 275 ++-- .../types/loki/src/dynamic_view.d.ts | 117 +- .../types/loki/src/event_emitter.d.ts | 3 +- .../local-storage/types/loki/src/helper.d.ts | 36 +- .../local-storage/types/loki/src/index.d.ts | 5 +- .../local-storage/types/loki/src/loki.d.ts | 79 +- .../types/loki/src/memory_adapter.d.ts | 40 - .../types/loki/src/result_set.d.ts | 302 ++++ .../types/loki/src/resultset.d.ts | 262 --- .../types/loki/src/unique_index.d.ts | 10 +- .../types/memory-storage/src/index.d.ts | 3 + .../memory-storage/src/memory_storage.d.ts | 57 + .../types/partitioning-adapter/src/index.d.ts | 3 + .../src/partitioning_adapter.d.ts | 15 +- dist/packages/loki/lokijs.loki.js | 1438 ++++++++--------- dist/packages/loki/lokijs.loki.js.map | 2 +- dist/packages/loki/lokijs.loki.min.js | 2 +- dist/packages/loki/types/common/types.d.ts | 14 +- .../loki/types/fs-storage/src/fs_storage.d.ts | 3 +- .../loki/types/fs-storage/src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../full-text-search-language/src/index.d.ts | 1 + .../src/full_text_search.d.ts | 6 +- .../types/full-text-search/src/index.d.ts | 7 +- .../full-text-search/src/index_searcher.d.ts | 6 +- .../full-text-search/src/query_builder.d.ts | 74 +- .../types/full-text-search/src/scorer.d.ts | 32 +- .../loki/types/indexed-storage/src/index.d.ts | 3 + .../indexed-storage/src/indexed_storage.d.ts | 4 +- .../loki/types/local-storage/src/index.d.ts | 3 + .../local-storage/src/local_storage.d.ts | 6 +- dist/packages/loki/types/loki/src/clone.d.ts | 8 +- .../loki/types/loki/src/collection.d.ts | 275 ++-- .../loki/types/loki/src/dynamic_view.d.ts | 117 +- .../loki/types/loki/src/event_emitter.d.ts | 3 +- dist/packages/loki/types/loki/src/helper.d.ts | 36 +- dist/packages/loki/types/loki/src/index.d.ts | 5 +- dist/packages/loki/types/loki/src/loki.d.ts | 79 +- .../loki/types/loki/src/memory_adapter.d.ts | 40 - .../loki/types/loki/src/result_set.d.ts | 302 ++++ .../loki/types/loki/src/resultset.d.ts | 262 --- .../loki/types/loki/src/unique_index.d.ts | 10 +- .../loki/types/memory-storage/src/index.d.ts | 3 + .../memory-storage/src/memory_storage.d.ts | 57 + .../types/partitioning-adapter/src/index.d.ts | 3 + .../src/partitioning_adapter.d.ts | 15 +- .../memory-storage/lokijs.memory-storage.js | 264 +++ .../lokijs.memory-storage.js.map | 1 + .../lokijs.memory-storage.min.js | 1 + .../memory-storage/types/common/plugin.d.ts | 4 + .../memory-storage/types/common/types.d.ts | 19 + .../types/fs-storage/src/fs_storage.d.ts | 34 + .../types/fs-storage/src/index.d.ts | 3 + .../full-text-search-language-de/src/de.d.ts | 2 + .../src/index.d.ts | 3 + .../full-text-search-language-en/src/en.d.ts | 2 + .../src/index.d.ts | 3 + .../full-text-search-language/src/index.d.ts | 1 + .../src/language.d.ts | 36 + .../src/full_text_search.d.ts | 43 + .../full-text-search/src/fuzzy/automaton.d.ts | 36 + .../fuzzy/lev1t_parametric_description.d.ts | 9 + .../fuzzy/lev2t_parametric_description.d.ts | 9 + .../src/fuzzy/levenshtein_automata.d.ts | 21 + .../full-text-search/src/fuzzy/long.d.ts | 33 + .../src/fuzzy/parametric_description.d.ts | 25 + .../src/fuzzy/run_automaton.d.ts | 15 + .../types/full-text-search/src/index.d.ts | 5 + .../full-text-search/src/index_searcher.d.ts | 21 + .../full-text-search/src/inverted_index.d.ts | 139 ++ .../full-text-search/src/query_builder.d.ts | 581 +++++++ .../types/full-text-search/src/scorer.d.ts | 61 + .../types/full-text-search/src/tokenizer.d.ts | 139 ++ .../types/indexed-storage/src/index.d.ts | 3 + .../indexed-storage/src/indexed_storage.d.ts | 101 ++ .../types/local-storage/src/index.d.ts | 3 + .../local-storage/src/local_storage.d.ts | 36 + .../memory-storage/types/loki/src/clone.d.ts | 5 + .../types/loki/src/collection.d.ts | 608 +++++++ .../types/loki/src/dynamic_view.d.ts | 279 ++++ .../types/loki/src/event_emitter.d.ts | 48 + .../memory-storage/types/loki/src/helper.d.ts | 39 + .../memory-storage/types/loki/src/index.d.ts | 4 + .../memory-storage/types/loki/src/loki.d.ts | 322 ++++ .../types/loki/src/result_set.d.ts | 302 ++++ .../types/loki/src/unique_index.d.ts | 37 + .../types/memory-storage/src/index.d.ts | 3 + .../memory-storage/src/memory_storage.d.ts | 57 + .../types/partitioning-adapter/src/index.d.ts | 3 + .../src/partitioning_adapter.d.ts | 85 + .../lokijs.partitioning-adapter.js | 69 +- .../lokijs.partitioning-adapter.js.map | 2 +- .../lokijs.partitioning-adapter.min.js | 2 +- .../types/common/types.d.ts | 14 +- .../types/fs-storage/src/fs_storage.d.ts | 3 +- .../types/fs-storage/src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../src/index.d.ts | 3 + .../full-text-search-language/src/index.d.ts | 1 + .../src/full_text_search.d.ts | 6 +- .../types/full-text-search/src/index.d.ts | 7 +- .../full-text-search/src/index_searcher.d.ts | 6 +- .../full-text-search/src/query_builder.d.ts | 74 +- .../types/full-text-search/src/scorer.d.ts | 32 +- .../types/indexed-storage/src/index.d.ts | 3 + .../indexed-storage/src/indexed_storage.d.ts | 4 +- .../types/local-storage/src/index.d.ts | 3 + .../local-storage/src/local_storage.d.ts | 6 +- .../types/loki/src/clone.d.ts | 8 +- .../types/loki/src/collection.d.ts | 275 ++-- .../types/loki/src/dynamic_view.d.ts | 117 +- .../types/loki/src/event_emitter.d.ts | 3 +- .../types/loki/src/helper.d.ts | 36 +- .../types/loki/src/index.d.ts | 5 +- .../types/loki/src/loki.d.ts | 79 +- .../types/loki/src/memory_adapter.d.ts | 40 - .../types/loki/src/result_set.d.ts | 302 ++++ .../types/loki/src/resultset.d.ts | 262 --- .../types/loki/src/unique_index.d.ts | 10 +- .../types/memory-storage/src/index.d.ts | 3 + .../memory-storage/src/memory_storage.d.ts | 57 + .../types/partitioning-adapter/src/index.d.ts | 3 + .../src/partitioning_adapter.d.ts | 15 +- docs/api/assets/js/search.js | 2 +- docs/api/classes/among.html | 12 +- docs/api/classes/collection.html | 698 ++++---- docs/api/classes/dynamicview.html | 252 +-- docs/api/classes/fulltextsearch.html | 29 +- docs/api/classes/loki.html | 221 ++- docs/api/classes/lokieventemitter.html | 18 +- docs/api/classes/lokifsstorage.html | 362 ----- docs/api/classes/lokiindexedstorage.html | 585 ------- docs/api/classes/lokilocalstorage.html | 367 ----- docs/api/classes/lokimemoryadapter.html | 352 ---- docs/api/classes/lokipartitioningadapter.html | 405 ----- docs/api/classes/querybuilder.html | 61 +- docs/api/classes/resultset.html | 398 +++-- docs/api/classes/snowballprogram.html | 48 +- docs/api/classes/tokenizer.html | 34 +- docs/api/classes/uniqueindex.html | 40 +- docs/api/enums/clonemethod.html | 243 --- docs/api/enums/dynamicview.sortpriority.html | 305 ---- docs/api/enums/loki.environment.html | 251 --- docs/api/enums/loki.persistencemethod.html | 251 --- docs/api/enums/loki.serializationmethod.html | 223 --- docs/api/globals.html | 93 +- docs/api/index.html | 43 +- .../interfaces/collection.binaryindex.html | 4 +- .../collection.deserializeoptions.html | 8 +- docs/api/interfaces/collection.options.html | 44 +- docs/api/interfaces/dynamicview.options.html | 22 +- docs/api/interfaces/entry.html | 6 +- docs/api/interfaces/filter.html | 231 --- .../fulltextsearch.fieldoptions.html | 8 +- docs/api/interfaces/loki.copyoptions.html | 2 +- .../loki.deserializecollectionoptions.html | 6 +- docs/api/interfaces/loki.options.html | 12 +- .../interfaces/loki.persistenceoptions.html | 16 +- .../loki.serializedestructuredoptions.html | 8 +- .../api/interfaces/loki.serializeoptions.html | 4 +- docs/api/interfaces/query.html | 22 +- .../api/interfaces/resultset.dataoptions.html | 24 +- docs/api/interfaces/storageadapter.html | 24 +- .../interfaces/tokenizer.serialization.html | 4 +- package-lock.json | 2 +- package.json | 2 +- 377 files changed, 11817 insertions(+), 10227 deletions(-) create mode 100644 dist/packages/fs-storage/types/fs-storage/src/index.d.ts create mode 100644 dist/packages/fs-storage/types/full-text-search-language-de/src/index.d.ts create mode 100644 dist/packages/fs-storage/types/full-text-search-language-en/src/index.d.ts create mode 100644 dist/packages/fs-storage/types/full-text-search-language/src/index.d.ts create mode 100644 dist/packages/fs-storage/types/indexed-storage/src/index.d.ts create mode 100644 dist/packages/fs-storage/types/local-storage/src/index.d.ts rename dist/packages/{full-text-search-language-en/types/loki/src/resultset.d.ts => fs-storage/types/loki/src/result_set.d.ts} (52%) create mode 100644 dist/packages/fs-storage/types/memory-storage/src/index.d.ts rename dist/packages/fs-storage/types/{loki/src/memory_adapter.d.ts => memory-storage/src/memory_storage.d.ts} (61%) create mode 100644 dist/packages/fs-storage/types/partitioning-adapter/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-de/types/fs-storage/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-de/types/full-text-search-language-de/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-de/types/full-text-search-language-en/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-de/types/full-text-search-language/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-de/types/indexed-storage/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-de/types/local-storage/src/index.d.ts rename dist/packages/{fs-storage/types/loki/src/resultset.d.ts => full-text-search-language-de/types/loki/src/result_set.d.ts} (52%) create mode 100644 dist/packages/full-text-search-language-de/types/memory-storage/src/index.d.ts rename dist/packages/{full-text-search-language-en/types/loki/src/memory_adapter.d.ts => full-text-search-language-de/types/memory-storage/src/memory_storage.d.ts} (61%) create mode 100644 dist/packages/full-text-search-language-de/types/partitioning-adapter/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-en/types/fs-storage/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-en/types/full-text-search-language-de/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-en/types/full-text-search-language-en/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-en/types/full-text-search-language/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-en/types/indexed-storage/src/index.d.ts create mode 100644 dist/packages/full-text-search-language-en/types/local-storage/src/index.d.ts rename dist/packages/{full-text-search-language/types/loki/src/resultset.d.ts => full-text-search-language-en/types/loki/src/result_set.d.ts} (52%) create mode 100644 dist/packages/full-text-search-language-en/types/memory-storage/src/index.d.ts rename dist/packages/{full-text-search-language-de/types/loki/src/memory_adapter.d.ts => full-text-search-language-en/types/memory-storage/src/memory_storage.d.ts} (61%) create mode 100644 dist/packages/full-text-search-language-en/types/partitioning-adapter/src/index.d.ts create mode 100644 dist/packages/full-text-search-language/types/fs-storage/src/index.d.ts create mode 100644 dist/packages/full-text-search-language/types/full-text-search-language-de/src/index.d.ts create mode 100644 dist/packages/full-text-search-language/types/full-text-search-language-en/src/index.d.ts create mode 100644 dist/packages/full-text-search-language/types/full-text-search-language/src/index.d.ts create mode 100644 dist/packages/full-text-search-language/types/indexed-storage/src/index.d.ts create mode 100644 dist/packages/full-text-search-language/types/local-storage/src/index.d.ts rename dist/packages/{full-text-search-language-de/types/loki/src/resultset.d.ts => full-text-search-language/types/loki/src/result_set.d.ts} (52%) create mode 100644 dist/packages/full-text-search-language/types/memory-storage/src/index.d.ts rename dist/packages/full-text-search-language/types/{loki/src/memory_adapter.d.ts => memory-storage/src/memory_storage.d.ts} (61%) create mode 100644 dist/packages/full-text-search-language/types/partitioning-adapter/src/index.d.ts create mode 100644 dist/packages/full-text-search/types/fs-storage/src/index.d.ts create mode 100644 dist/packages/full-text-search/types/full-text-search-language-de/src/index.d.ts create mode 100644 dist/packages/full-text-search/types/full-text-search-language-en/src/index.d.ts create mode 100644 dist/packages/full-text-search/types/full-text-search-language/src/index.d.ts create mode 100644 dist/packages/full-text-search/types/indexed-storage/src/index.d.ts create mode 100644 dist/packages/full-text-search/types/local-storage/src/index.d.ts delete mode 100644 dist/packages/full-text-search/types/loki/src/memory_adapter.d.ts create mode 100644 dist/packages/full-text-search/types/loki/src/result_set.d.ts delete mode 100644 dist/packages/full-text-search/types/loki/src/resultset.d.ts create mode 100644 dist/packages/full-text-search/types/memory-storage/src/index.d.ts create mode 100644 dist/packages/full-text-search/types/memory-storage/src/memory_storage.d.ts create mode 100644 dist/packages/full-text-search/types/partitioning-adapter/src/index.d.ts create mode 100644 dist/packages/indexed-storage/types/fs-storage/src/index.d.ts create mode 100644 dist/packages/indexed-storage/types/full-text-search-language-de/src/index.d.ts create mode 100644 dist/packages/indexed-storage/types/full-text-search-language-en/src/index.d.ts create mode 100644 dist/packages/indexed-storage/types/full-text-search-language/src/index.d.ts create mode 100644 dist/packages/indexed-storage/types/indexed-storage/src/index.d.ts create mode 100644 dist/packages/indexed-storage/types/local-storage/src/index.d.ts delete mode 100644 dist/packages/indexed-storage/types/loki/src/memory_adapter.d.ts create mode 100644 dist/packages/indexed-storage/types/loki/src/result_set.d.ts delete mode 100644 dist/packages/indexed-storage/types/loki/src/resultset.d.ts create mode 100644 dist/packages/indexed-storage/types/memory-storage/src/index.d.ts create mode 100644 dist/packages/indexed-storage/types/memory-storage/src/memory_storage.d.ts create mode 100644 dist/packages/indexed-storage/types/partitioning-adapter/src/index.d.ts create mode 100644 dist/packages/local-storage/types/fs-storage/src/index.d.ts create mode 100644 dist/packages/local-storage/types/full-text-search-language-de/src/index.d.ts create mode 100644 dist/packages/local-storage/types/full-text-search-language-en/src/index.d.ts create mode 100644 dist/packages/local-storage/types/full-text-search-language/src/index.d.ts create mode 100644 dist/packages/local-storage/types/indexed-storage/src/index.d.ts create mode 100644 dist/packages/local-storage/types/local-storage/src/index.d.ts delete mode 100644 dist/packages/local-storage/types/loki/src/memory_adapter.d.ts create mode 100644 dist/packages/local-storage/types/loki/src/result_set.d.ts delete mode 100644 dist/packages/local-storage/types/loki/src/resultset.d.ts create mode 100644 dist/packages/local-storage/types/memory-storage/src/index.d.ts create mode 100644 dist/packages/local-storage/types/memory-storage/src/memory_storage.d.ts create mode 100644 dist/packages/local-storage/types/partitioning-adapter/src/index.d.ts create mode 100644 dist/packages/loki/types/fs-storage/src/index.d.ts create mode 100644 dist/packages/loki/types/full-text-search-language-de/src/index.d.ts create mode 100644 dist/packages/loki/types/full-text-search-language-en/src/index.d.ts create mode 100644 dist/packages/loki/types/full-text-search-language/src/index.d.ts create mode 100644 dist/packages/loki/types/indexed-storage/src/index.d.ts create mode 100644 dist/packages/loki/types/local-storage/src/index.d.ts delete mode 100644 dist/packages/loki/types/loki/src/memory_adapter.d.ts create mode 100644 dist/packages/loki/types/loki/src/result_set.d.ts delete mode 100644 dist/packages/loki/types/loki/src/resultset.d.ts create mode 100644 dist/packages/loki/types/memory-storage/src/index.d.ts create mode 100644 dist/packages/loki/types/memory-storage/src/memory_storage.d.ts create mode 100644 dist/packages/loki/types/partitioning-adapter/src/index.d.ts create mode 100644 dist/packages/memory-storage/lokijs.memory-storage.js create mode 100644 dist/packages/memory-storage/lokijs.memory-storage.js.map create mode 100644 dist/packages/memory-storage/lokijs.memory-storage.min.js create mode 100644 dist/packages/memory-storage/types/common/plugin.d.ts create mode 100644 dist/packages/memory-storage/types/common/types.d.ts create mode 100644 dist/packages/memory-storage/types/fs-storage/src/fs_storage.d.ts create mode 100644 dist/packages/memory-storage/types/fs-storage/src/index.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search-language-de/src/de.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search-language-de/src/index.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search-language-en/src/en.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search-language-en/src/index.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search-language/src/index.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search-language/src/language.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/full_text_search.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/fuzzy/automaton.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/fuzzy/lev1t_parametric_description.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/fuzzy/lev2t_parametric_description.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/fuzzy/levenshtein_automata.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/fuzzy/long.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/fuzzy/parametric_description.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/fuzzy/run_automaton.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/index.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/index_searcher.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/inverted_index.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/query_builder.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/scorer.d.ts create mode 100644 dist/packages/memory-storage/types/full-text-search/src/tokenizer.d.ts create mode 100644 dist/packages/memory-storage/types/indexed-storage/src/index.d.ts create mode 100644 dist/packages/memory-storage/types/indexed-storage/src/indexed_storage.d.ts create mode 100644 dist/packages/memory-storage/types/local-storage/src/index.d.ts create mode 100644 dist/packages/memory-storage/types/local-storage/src/local_storage.d.ts create mode 100644 dist/packages/memory-storage/types/loki/src/clone.d.ts create mode 100644 dist/packages/memory-storage/types/loki/src/collection.d.ts create mode 100644 dist/packages/memory-storage/types/loki/src/dynamic_view.d.ts create mode 100644 dist/packages/memory-storage/types/loki/src/event_emitter.d.ts create mode 100644 dist/packages/memory-storage/types/loki/src/helper.d.ts create mode 100644 dist/packages/memory-storage/types/loki/src/index.d.ts create mode 100644 dist/packages/memory-storage/types/loki/src/loki.d.ts create mode 100644 dist/packages/memory-storage/types/loki/src/result_set.d.ts create mode 100644 dist/packages/memory-storage/types/loki/src/unique_index.d.ts create mode 100644 dist/packages/memory-storage/types/memory-storage/src/index.d.ts create mode 100644 dist/packages/memory-storage/types/memory-storage/src/memory_storage.d.ts create mode 100644 dist/packages/memory-storage/types/partitioning-adapter/src/index.d.ts create mode 100644 dist/packages/memory-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts create mode 100644 dist/packages/partitioning-adapter/types/fs-storage/src/index.d.ts create mode 100644 dist/packages/partitioning-adapter/types/full-text-search-language-de/src/index.d.ts create mode 100644 dist/packages/partitioning-adapter/types/full-text-search-language-en/src/index.d.ts create mode 100644 dist/packages/partitioning-adapter/types/full-text-search-language/src/index.d.ts create mode 100644 dist/packages/partitioning-adapter/types/indexed-storage/src/index.d.ts create mode 100644 dist/packages/partitioning-adapter/types/local-storage/src/index.d.ts delete mode 100644 dist/packages/partitioning-adapter/types/loki/src/memory_adapter.d.ts create mode 100644 dist/packages/partitioning-adapter/types/loki/src/result_set.d.ts delete mode 100644 dist/packages/partitioning-adapter/types/loki/src/resultset.d.ts create mode 100644 dist/packages/partitioning-adapter/types/memory-storage/src/index.d.ts create mode 100644 dist/packages/partitioning-adapter/types/memory-storage/src/memory_storage.d.ts create mode 100644 dist/packages/partitioning-adapter/types/partitioning-adapter/src/index.d.ts delete mode 100644 docs/api/classes/lokifsstorage.html delete mode 100644 docs/api/classes/lokiindexedstorage.html delete mode 100644 docs/api/classes/lokilocalstorage.html delete mode 100644 docs/api/classes/lokimemoryadapter.html delete mode 100644 docs/api/classes/lokipartitioningadapter.html delete mode 100644 docs/api/enums/clonemethod.html delete mode 100644 docs/api/enums/dynamicview.sortpriority.html delete mode 100644 docs/api/enums/loki.environment.html delete mode 100644 docs/api/enums/loki.persistencemethod.html delete mode 100644 docs/api/enums/loki.serializationmethod.html delete mode 100644 docs/api/interfaces/filter.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 37973d91..136974ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ + +# [2.0.0-beta.5](https://github.com/LokiJS-Forge/LokiJS2/compare/2.0.0-beta.4...2.0.0-beta.5) (2018-01-02) + + +### Bug Fixes + +* **full-text-search-language:** add missing function export ([#64](https://github.com/LokiJS-Forge/LokiJS2/issues/64)) ([9b926e2](https://github.com/LokiJS-Forge/LokiJS2/commit/9b926e2)) + + +### Features + +* improve typings ([#62](https://github.com/LokiJS-Forge/LokiJS2/issues/62)) ([b44f550](https://github.com/LokiJS-Forge/LokiJS2/commit/b44f550)) +* **full-text-search:** add an optional score explanation ([#65](https://github.com/LokiJS-Forge/LokiJS2/issues/65)) ([9fde195](https://github.com/LokiJS-Forge/LokiJS2/commit/9fde195)) +* **memory-storage:** move memory storage to a separate package ([#63](https://github.com/LokiJS-Forge/LokiJS2/issues/63)) ([7cea02a](https://github.com/LokiJS-Forge/LokiJS2/commit/7cea02a)) + + # [2.0.0-beta.4](https://github.com/LokiJS-Forge/LokiJS2/compare/2.0.0-beta.3...2.0.0-beta.4) (2017-12-01) diff --git a/dist/packages/fs-storage/lokijs.fs-storage.js b/dist/packages/fs-storage/lokijs.fs-storage.js index 2d5f934a..9c424f5c 100644 --- a/dist/packages/fs-storage/lokijs.fs-storage.js +++ b/dist/packages/fs-storage/lokijs.fs-storage.js @@ -87,18 +87,18 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /** * A loki persistence adapter which persists using node fs module. */ -class LokiFSStorage { +class FSStorage { /** * Registers the fs storage as plugin. */ static register() { - __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["LokiFSStorage"] = LokiFSStorage; + __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["FSStorage"] = FSStorage; } /** * Deregisters the fs storage as plugin. */ static deregister() { - delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["LokiFSStorage"]; + delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["FSStorage"]; } /** * Load data from file, will throw an error if the file does not exist @@ -171,9 +171,8 @@ class LokiFSStorage { }); } } -/* harmony export (immutable) */ __webpack_exports__["LokiFSStorage"] = LokiFSStorage; +/* harmony export (immutable) */ __webpack_exports__["FSStorage"] = FSStorage; -/* harmony default export */ __webpack_exports__["default"] = (LokiFSStorage); /***/ }), diff --git a/dist/packages/fs-storage/lokijs.fs-storage.js.map b/dist/packages/fs-storage/lokijs.fs-storage.js.map index 9155d56a..18dffc68 100644 --- a/dist/packages/fs-storage/lokijs.fs-storage.js.map +++ b/dist/packages/fs-storage/lokijs.fs-storage.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 9d03bbd0e4334eb500c3","webpack:///./packages/fs-storage/src/fs_storage.ts","webpack:///./packages/common/plugin.ts","webpack:///(webpack)/buildin/global.js","webpack:///external \"fs\""],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;AC7D4C;AAEnB;AAEzB;;GAEG;AACG;IACJ;;OAEG;IACH,MAAM,CAAC,QAAQ;QACb,+DAAO,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU;QACf,OAAO,+DAAO,CAAC,eAAe,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,MAAc;QACzB,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,wCAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;gBAC7B,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;oBAC3B,4CAAW,CAAC,MAAM,EAAE;wBAClB,QAAQ,EAAE,MAAM;qBACjB,EAAE,0BAA0B,GAAG,EAAE,IAAI;wBACpC,EAAE,CAAC,C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CAAC;gBACd,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACN,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAAA;AAAA;AAED,+DAAe,aAAa,EAAC;;;;;;;;AC3F7B;IACE,IAAI,IAAI,CAAC;IACT,CAAC,UAAU,MAAM;QACf,IAAI,GAAG,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,IAAI,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,IAAI,CAAC;AACd,CAAC;AAGD;IACE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAQ,CAAC;IACtC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,EACb,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACI,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAAA;AAAA;;;;;;;;ACtBhC;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;ACpBA,+C","file":"lokijs.fs-storage.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"fs\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"fs\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/fs-storage\"] = factory(require(\"fs\"));\n\telse\n\t\troot[\"@lokijs/fs-storage\"] = factory(root[\"fs\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_3__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 9d03bbd0e4334eb500c3","import {PLUGINS} from \"../../common/plugin\";\nimport {StorageAdapter} from \"../../common/types\";\nimport * as fs from \"fs\";\n\n/**\n * A loki persistence adapter which persists using node fs module.\n */\nexport class LokiFSStorage implements StorageAdapter {\n /**\n * Registers the fs storage as plugin.\n */\n static register(): void {\n PLUGINS[\"LokiFSStorage\"] = LokiFSStorage;\n }\n\n /**\n * Deregisters the fs storage as plugin.\n */\n static deregister(): void {\n delete PLUGINS[\"LokiFSStorage\"];\n }\n\n /**\n * Load data from file, will throw an error if the file does not exist\n * @param {string} dbname - the filename of the database to load\n * @returns {Promise} a Promise that resolves after the database was loaded\n */\n loadDatabase(dbname: string): Promise {\n return new Promise((resolve, reject) => {\n fs.stat(dbname, (err, stats) => {\n if (!err && stats.isFile()) {\n fs.readFile(dbname, {\n encoding: \"utf8\"\n }, function readFileCallback(err, data) {\n if (err) {\n reject(err);\n } else {\n resolve(data);\n }\n });\n } else {\n reject();\n }\n });\n });\n }\n\n /**\n * Save data to file, will throw an error if the file can't be saved\n * might want to expand this to avoid dataloss on partial save\n * @param {string} dbname - the filename of the database to load\n * @returns {Promise} a Promise that resolves after the database was persisted\n */\n saveDatabase(dbname: string, dbstring: string): Promise {\n const tmpdbname = dbname + \"~\";\n return new Promise((resolve, reject) => {\n fs.writeFile(tmpdbname, dbstring, (err) => {\n if (err) {\n reject(err);\n } else {\n fs.rename(tmpdbname, dbname, (err) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n }\n });\n }) as any as Promise;\n }\n\n /**\n * Delete the database file, will throw an error if the\n * file can't be deleted\n * @param {string} dbname - the filename of the database to delete\n * @returns {Promise} a Promise that resolves after the database was deleted\n */\n deleteDatabase(dbname: string): Promise {\n return new Promise((resolve, reject) => {\n fs.unlink(dbname, function deleteDatabaseCallback(err) {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n });\n }\n}\n\nexport default LokiFSStorage;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/fs-storage/src/fs_storage.ts","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 2\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"fs\"\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap e4a05a03c59d7c345954","webpack:///./packages/fs-storage/src/fs_storage.ts","webpack:///./packages/common/plugin.ts","webpack:///(webpack)/buildin/global.js","webpack:///external \"fs\""],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;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AAC,KAAK,SAAS,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,EACb,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACI,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAAA;AAAA;;;;;;;;ACtBhC;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;ACpBA,+C","file":"lokijs.fs-storage.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"fs\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"fs\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/fs-storage\"] = factory(require(\"fs\"));\n\telse\n\t\troot[\"@lokijs/fs-storage\"] = factory(root[\"fs\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_3__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e4a05a03c59d7c345954","import {PLUGINS} from \"../../common/plugin\";\nimport {StorageAdapter} from \"../../common/types\";\nimport * as fs from \"fs\";\n\n/**\n * A loki persistence adapter which persists using node fs module.\n */\nexport class FSStorage implements StorageAdapter {\n /**\n * Registers the fs storage as plugin.\n */\n static register(): void {\n PLUGINS[\"FSStorage\"] = FSStorage;\n }\n\n /**\n * Deregisters the fs storage as plugin.\n */\n static deregister(): void {\n delete PLUGINS[\"FSStorage\"];\n }\n\n /**\n * Load data from file, will throw an error if the file does not exist\n * @param {string} dbname - the filename of the database to load\n * @returns {Promise} a Promise that resolves after the database was loaded\n */\n loadDatabase(dbname: string): Promise {\n return new Promise((resolve, reject) => {\n fs.stat(dbname, (err, stats) => {\n if (!err && stats.isFile()) {\n fs.readFile(dbname, {\n encoding: \"utf8\"\n }, function readFileCallback(err, data) {\n if (err) {\n reject(err);\n } else {\n resolve(data);\n }\n });\n } else {\n reject();\n }\n });\n });\n }\n\n /**\n * Save data to file, will throw an error if the file can't be saved\n * might want to expand this to avoid dataloss on partial save\n * @param {string} dbname - the filename of the database to load\n * @returns {Promise} a Promise that resolves after the database was persisted\n */\n saveDatabase(dbname: string, dbstring: string): Promise {\n const tmpdbname = dbname + \"~\";\n return new Promise((resolve, reject) => {\n fs.writeFile(tmpdbname, dbstring, (err) => {\n if (err) {\n reject(err);\n } else {\n fs.rename(tmpdbname, dbname, (err) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n }\n });\n }) as any as Promise;\n }\n\n /**\n * Delete the database file, will throw an error if the\n * file can't be deleted\n * @param {string} dbname - the filename of the database to delete\n * @returns {Promise} a Promise that resolves after the database was deleted\n */\n deleteDatabase(dbname: string): Promise {\n return new Promise((resolve, reject) => {\n fs.unlink(dbname, function deleteDatabaseCallback(err) {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n });\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/fs-storage/src/fs_storage.ts","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 2\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"fs\"\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/packages/fs-storage/lokijs.fs-storage.min.js b/dist/packages/fs-storage/lokijs.fs-storage.min.js index 86e3d988..9eb85950 100644 --- a/dist/packages/fs-storage/lokijs.fs-storage.min.js +++ b/dist/packages/fs-storage/lokijs.fs-storage.min.js @@ -1 +1 @@ -(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory(require("fs"));else if(typeof define==="function"&&define.amd)define(["fs"],factory);else if(typeof exports==="object")exports["@lokijs/fs-storage"]=factory(require("fs"));else{root["@lokijs/fs-storage"]=factory(root["fs"]);root["LokiFsStorage"]=root["@lokijs/fs-storage"].default}})(typeof self!=="undefined"?self:this,function(__WEBPACK_EXTERNAL_MODULE_3__){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__common_plugin__=__webpack_require__(1);var __WEBPACK_IMPORTED_MODULE_1_fs__=__webpack_require__(3);var __WEBPACK_IMPORTED_MODULE_1_fs___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_fs__);class LokiFSStorage{static register(){__WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["LokiFSStorage"]=LokiFSStorage}static deregister(){delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["LokiFSStorage"]}loadDatabase(dbname){return new Promise((resolve,reject)=>{__WEBPACK_IMPORTED_MODULE_1_fs__["stat"](dbname,(err,stats)=>{if(!err&&stats.isFile()){__WEBPACK_IMPORTED_MODULE_1_fs__["readFile"](dbname,{encoding:"utf8"},function readFileCallback(err,data){if(err){reject(err)}else{resolve(data)}})}else{reject()}})})}saveDatabase(dbname,dbstring){const tmpdbname=dbname+"~";return new Promise((resolve,reject)=>{__WEBPACK_IMPORTED_MODULE_1_fs__["writeFile"](tmpdbname,dbstring,err=>{if(err){reject(err)}else{__WEBPACK_IMPORTED_MODULE_1_fs__["rename"](tmpdbname,dbname,err=>{if(err){reject(err)}else{resolve()}})}})})}deleteDatabase(dbname){return new Promise((resolve,reject)=>{__WEBPACK_IMPORTED_MODULE_1_fs__["unlink"](dbname,function deleteDatabaseCallback(err){if(err){reject(err)}else{resolve()}})})}}__webpack_exports__["LokiFSStorage"]=LokiFSStorage;__webpack_exports__["default"]=LokiFSStorage},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){function getGlobal(){let glob;(function(global){glob=global})(global!==undefined&&global||this);return glob}function create(){const global=getGlobal();const sym=Symbol.for("LOKI");if(global[sym]===undefined){global[sym]={}}return global[sym]}const PLUGINS=create();__webpack_exports__["a"]=PLUGINS}).call(__webpack_exports__,__webpack_require__(2))},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(1,eval)("this")}catch(e){if(typeof window==="object")g=window}module.exports=g},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE_3__}])}); \ No newline at end of file +(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory(require("fs"));else if(typeof define==="function"&&define.amd)define(["fs"],factory);else if(typeof exports==="object")exports["@lokijs/fs-storage"]=factory(require("fs"));else{root["@lokijs/fs-storage"]=factory(root["fs"]);root["LokiFsStorage"]=root["@lokijs/fs-storage"].default}})(typeof self!=="undefined"?self:this,function(__WEBPACK_EXTERNAL_MODULE_3__){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__common_plugin__=__webpack_require__(1);var __WEBPACK_IMPORTED_MODULE_1_fs__=__webpack_require__(3);var __WEBPACK_IMPORTED_MODULE_1_fs___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_fs__);class FSStorage{static register(){__WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["FSStorage"]=FSStorage}static deregister(){delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["FSStorage"]}loadDatabase(dbname){return new Promise((resolve,reject)=>{__WEBPACK_IMPORTED_MODULE_1_fs__["stat"](dbname,(err,stats)=>{if(!err&&stats.isFile()){__WEBPACK_IMPORTED_MODULE_1_fs__["readFile"](dbname,{encoding:"utf8"},function readFileCallback(err,data){if(err){reject(err)}else{resolve(data)}})}else{reject()}})})}saveDatabase(dbname,dbstring){const tmpdbname=dbname+"~";return new Promise((resolve,reject)=>{__WEBPACK_IMPORTED_MODULE_1_fs__["writeFile"](tmpdbname,dbstring,err=>{if(err){reject(err)}else{__WEBPACK_IMPORTED_MODULE_1_fs__["rename"](tmpdbname,dbname,err=>{if(err){reject(err)}else{resolve()}})}})})}deleteDatabase(dbname){return new Promise((resolve,reject)=>{__WEBPACK_IMPORTED_MODULE_1_fs__["unlink"](dbname,function deleteDatabaseCallback(err){if(err){reject(err)}else{resolve()}})})}}__webpack_exports__["FSStorage"]=FSStorage},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){function getGlobal(){let glob;(function(global){glob=global})(global!==undefined&&global||this);return glob}function create(){const global=getGlobal();const sym=Symbol.for("LOKI");if(global[sym]===undefined){global[sym]={}}return global[sym]}const PLUGINS=create();__webpack_exports__["a"]=PLUGINS}).call(__webpack_exports__,__webpack_require__(2))},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(1,eval)("this")}catch(e){if(typeof window==="object")g=window}module.exports=g},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE_3__}])}); \ No newline at end of file diff --git a/dist/packages/fs-storage/types/common/types.d.ts b/dist/packages/fs-storage/types/common/types.d.ts index 846847e6..b8a936c6 100644 --- a/dist/packages/fs-storage/types/common/types.d.ts +++ b/dist/packages/fs-storage/types/common/types.d.ts @@ -1,10 +1,13 @@ -export declare type ANY = any; +/** + * @hidden + */ +import { Loki } from "../loki/src"; export interface StorageAdapter { loadDatabase(dbname: string): Promise; saveDatabase?(dbname: string, serialization: string): Promise; deleteDatabase?(dbname: string): Promise; mode?: string; - exportDatabase?(dbname: string, dbref: ANY): Promise; + exportDatabase?(dbname: string, dbref: Loki): Promise; } export declare type Doc = T & { $loki: number; @@ -14,10 +17,3 @@ export interface Dict { [index: string]: T; [index: number]: T; } -export interface Query { -} -export interface Filter { - type: string; - val: Query | ((obj: E, index: number, array: E[]) => boolean); - uid: number | string; -} diff --git a/dist/packages/fs-storage/types/fs-storage/src/fs_storage.d.ts b/dist/packages/fs-storage/types/fs-storage/src/fs_storage.d.ts index a92567ea..9930c0d0 100644 --- a/dist/packages/fs-storage/types/fs-storage/src/fs_storage.d.ts +++ b/dist/packages/fs-storage/types/fs-storage/src/fs_storage.d.ts @@ -2,7 +2,7 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists using node fs module. */ -export declare class LokiFSStorage implements StorageAdapter { +export declare class FSStorage implements StorageAdapter { /** * Registers the fs storage as plugin. */ @@ -32,4 +32,3 @@ export declare class LokiFSStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiFSStorage; diff --git a/dist/packages/fs-storage/types/fs-storage/src/index.d.ts b/dist/packages/fs-storage/types/fs-storage/src/index.d.ts new file mode 100644 index 00000000..e6b33d6c --- /dev/null +++ b/dist/packages/fs-storage/types/fs-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { FSStorage } from "./fs_storage"; +export { FSStorage }; +export default FSStorage; diff --git a/dist/packages/fs-storage/types/full-text-search-language-de/src/index.d.ts b/dist/packages/fs-storage/types/full-text-search-language-de/src/index.d.ts new file mode 100644 index 00000000..a2665427 --- /dev/null +++ b/dist/packages/fs-storage/types/full-text-search-language-de/src/index.d.ts @@ -0,0 +1,3 @@ +import { DE } from "./de"; +export { DE }; +export default DE; diff --git a/dist/packages/fs-storage/types/full-text-search-language-en/src/index.d.ts b/dist/packages/fs-storage/types/full-text-search-language-en/src/index.d.ts new file mode 100644 index 00000000..8313cf98 --- /dev/null +++ b/dist/packages/fs-storage/types/full-text-search-language-en/src/index.d.ts @@ -0,0 +1,3 @@ +import { EN } from "./en"; +export { EN }; +export default EN; diff --git a/dist/packages/fs-storage/types/full-text-search-language/src/index.d.ts b/dist/packages/fs-storage/types/full-text-search-language/src/index.d.ts new file mode 100644 index 00000000..e52d1a42 --- /dev/null +++ b/dist/packages/fs-storage/types/full-text-search-language/src/index.d.ts @@ -0,0 +1 @@ +export { generateStopWordFilter, generateTrimmer, Among, SnowballProgram } from "./language"; diff --git a/dist/packages/fs-storage/types/full-text-search/src/full_text_search.d.ts b/dist/packages/fs-storage/types/full-text-search/src/full_text_search.d.ts index a4752c88..65a26bef 100644 --- a/dist/packages/fs-storage/types/full-text-search/src/full_text_search.d.ts +++ b/dist/packages/fs-storage/types/full-text-search/src/full_text_search.d.ts @@ -2,7 +2,7 @@ import { InvertedIndex } from "./inverted_index"; import { Tokenizer } from "./tokenizer"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; export declare class FullTextSearch { private _id; private _docs; @@ -21,14 +21,14 @@ export declare class FullTextSearch { * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized * (requires more memory but performs better) * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field - * @param {string=$loki} id - the property name of the document index + * @param {string} [id] - the property name of the document index */ constructor(fields?: FullTextSearch.FieldOptions[], id?: string); addDocument(doc: object, id?: number): void; removeDocument(doc: object, id?: number): void; updateDocument(doc: object, id?: number): void; clear(): void; - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; toJSON(): FullTextSearch.Serialization; static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers?: Dict): FullTextSearch; } diff --git a/dist/packages/fs-storage/types/full-text-search/src/index.d.ts b/dist/packages/fs-storage/types/full-text-search/src/index.d.ts index f03dde09..b901b108 100644 --- a/dist/packages/fs-storage/types/full-text-search/src/index.d.ts +++ b/dist/packages/fs-storage/types/full-text-search/src/index.d.ts @@ -1,6 +1,5 @@ import { FullTextSearch } from "./full_text_search"; -export { Tokenizer } from "./tokenizer"; -export { QueryBuilder } from "./query_builder"; -export { InvertedIndex } from "./inverted_index"; -export { FullTextSearch }; +import { Tokenizer } from "./tokenizer"; +import { QueryBuilder } from "./query_builder"; +export { FullTextSearch, Tokenizer, QueryBuilder }; export default FullTextSearch; diff --git a/dist/packages/fs-storage/types/full-text-search/src/index_searcher.d.ts b/dist/packages/fs-storage/types/full-text-search/src/index_searcher.d.ts index d3cf7f93..00b99f2f 100644 --- a/dist/packages/fs-storage/types/full-text-search/src/index_searcher.d.ts +++ b/dist/packages/fs-storage/types/full-text-search/src/index_searcher.d.ts @@ -1,4 +1,4 @@ -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; import { InvertedIndex } from "./inverted_index"; import { Query } from "./query_builder"; import { Dict } from "../../common/types"; @@ -13,9 +13,9 @@ export declare class IndexSearcher { * @param {object} invIdxs */ constructor(invIdxs: Dict, docs: Set); - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; setDirty(): void; private _recursive(query, doScoring); - private _getUnique(queries, doScoring, docResults); + private _getUnique(queries, doScoring, queryResults); private _getAll(queries, doScoring); } diff --git a/dist/packages/fs-storage/types/full-text-search/src/query_builder.d.ts b/dist/packages/fs-storage/types/full-text-search/src/query_builder.d.ts index 923317f6..6f324e15 100644 --- a/dist/packages/fs-storage/types/full-text-search/src/query_builder.d.ts +++ b/dist/packages/fs-storage/types/full-text-search/src/query_builder.d.ts @@ -24,8 +24,8 @@ export declare class BaseQueryBuilder { */ build(): any; } -export interface BaseQuery { - type: string; +export interface BaseQuery { + type: Type; boost?: number; } /** @@ -51,7 +51,7 @@ export declare class TermQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, term: string, data?: any); } -export interface TermQuery extends BaseQuery { +export interface TermQuery extends BaseQuery<"term"> { field: string; value: string; } @@ -78,7 +78,7 @@ export declare class TermsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, terms: Array, data?: any); } -export interface TermsQuery extends BaseQuery { +export interface TermsQuery extends BaseQuery<"terms"> { field: string; value: string[]; } @@ -119,7 +119,7 @@ export declare class WildcardQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface WildcardQuery extends BaseQuery { +export interface WildcardQuery extends BaseQuery<"wildcard"> { field: string; value: string; enable_scoring?: boolean; @@ -169,7 +169,7 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { * * @return {FuzzyQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the initial word length. * @param {number} prefixLength - the positive prefix length @@ -183,10 +183,10 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface FuzzyQuery extends BaseQuery { +export interface FuzzyQuery extends BaseQuery<"fuzzy"> { field: string; value: string; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -221,7 +221,7 @@ export declare class PrefixQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface PrefixQuery extends BaseQuery { +export interface PrefixQuery extends BaseQuery<"prefix"> { field: string; value: string; enable_scoring?: boolean; @@ -247,7 +247,7 @@ export declare class ExistsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, data?: any); } -export interface ExistsQuery extends BaseQuery { +export interface ExistsQuery extends BaseQuery<"exists"> { field: string; } /** @@ -315,7 +315,7 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { * * @return {MatchQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the starting word length which should not be considered for fuzziness. * @param {number} prefixLength - the positive prefix length @@ -329,12 +329,12 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface MatchQuery extends BaseQuery { +export interface MatchQuery extends BaseQuery<"match"> { field: string; value: string; minimum_should_match?: number; operator?: "and" | "or"; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -360,7 +360,7 @@ export interface MatchQuery extends BaseQuery { export declare class MatchAllQueryBuilder extends BaseQueryBuilder { constructor(data?: any); } -export interface MatchQueryAll extends BaseQuery { +export interface MatchQueryAll extends BaseQuery<"match_all"> { } /** * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter. @@ -388,9 +388,11 @@ export declare class ConstantScoreQueryBuilder extends BaseQueryBuilder { * Starts an array of queries. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): ConstantScoreQueryBuilder; + }; } -export interface ConstantScoreQuery extends BaseQuery { +export interface ConstantScoreQuery extends BaseQuery<"constant_score"> { filter: ArrayQuery; } /** @@ -442,22 +444,30 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { * Starts an array of queries for must clause. Use endMust() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginMust(): ArrayQueryBuilder; + beginMust(): ArrayQueryBuilder & { + endMust(): BoolQueryBuilder; + }; /** * Starts an array of queries for filter clause. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): BoolQueryBuilder; + }; /** * Starts an array of queries for should clause. Use endShould() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginShould(): ArrayQueryBuilder; + beginShould(): ArrayQueryBuilder & { + endShould(): BoolQueryBuilder; + }; /** * Starts an array of queries for not clause. Use endNot() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginNot(): ArrayQueryBuilder; + beginNot(): ArrayQueryBuilder & { + endNot(): BoolQueryBuilder; + }; /** * Controls the amount of minimum matching sub queries before a document will be considered. * @param {number} minShouldMatch - number of minimum matching sub queries @@ -472,7 +482,7 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { */ minimumShouldMatch(minShouldMatch: number): this; } -export interface BoolQuery extends BaseQuery { +export interface BoolQuery extends BaseQuery<"bool"> { must?: ArrayQuery; filter?: ArrayQuery; should?: ArrayQuery; @@ -497,8 +507,8 @@ export declare class ArrayQueryBuilder extends BaseQueryBuilder { prefix(field: string, prefix: string): any; exists(field: string): any; } -export interface ArrayQuery { - values: any[]; +export interface ArrayQuery extends BaseQuery<"array"> { + values: QueryTypes[]; } /** * This query builder is the root of each query search. @@ -525,9 +535,15 @@ export declare class QueryBuilder { /** * The query performs a final scoring over all scored sub queries. * @param {boolean} enable - flag to enable or disable final scoring - * @return {QueryBuilder} + * @return {this} */ enableFinalScoring(enable: boolean): this; + /** + * Adds an explanation of the scoring of each document for all matched terms. + * @param {boolean} enable -flag to enable or disable explanation + * @returns {this} + */ + explain(enable: boolean): this; /** * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model. * @@ -535,10 +551,10 @@ export declare class QueryBuilder { * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}. * * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation. - * Lower values result in quicker saturation, and higher values in slower saturation. + * Lower values result in quicker saturation, and higher values in slower saturation * @param {number} [b=0.75] - controls how much effect field-length normalization should have. - * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully. - * @return {QueryBuilder} + * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully + * @return {this} */ BM25Similarity(k1?: number, b?: number): this; bool(): BoolQueryBuilder; @@ -553,9 +569,11 @@ export declare class QueryBuilder { exists(field: string): ExistsQueryBuilder; private _prepare(queryType, ...args); } +export declare type QueryTypes = BoolQuery | ConstantScoreQuery | TermQuery | TermsQuery | WildcardQuery | FuzzyQuery | MatchQuery | MatchQueryAll | PrefixQuery | ExistsQuery; export interface Query { - query: any; + query: QueryTypes; final_scoring?: boolean; + explain?: boolean; bm25?: { k1: number; b: number; diff --git a/dist/packages/fs-storage/types/full-text-search/src/scorer.d.ts b/dist/packages/fs-storage/types/full-text-search/src/scorer.d.ts index aed3e619..dacdc753 100644 --- a/dist/packages/fs-storage/types/full-text-search/src/scorer.d.ts +++ b/dist/packages/fs-storage/types/full-text-search/src/scorer.d.ts @@ -1,7 +1,6 @@ import { InvertedIndex } from "./inverted_index"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -export declare type ScoreResult = Dict; /** * @hidden */ @@ -10,9 +9,9 @@ export declare class Scorer { private _cache; constructor(invIdxs: Dict); setDirty(): void; - score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, docResults: Scorer.DocResults, term: number[]): void; - scoreConstant(boost: number, docId: number, docResults: Scorer.DocResults): Map; - finalScore(query: Query, docResults: Scorer.DocResults): ScoreResult; + score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, queryResults: Scorer.QueryResults, term: number[]): void; + scoreConstant(boost: number, docId: number, queryResults: Scorer.QueryResults): Map; + finalScore(query: Query, queryResults: Scorer.QueryResults): Scorer.ScoreResult; private static _calculateFieldLength(fieldLength); private _getCache(fieldName); /** @@ -30,12 +29,33 @@ export declare namespace Scorer { idfs: Dict; avgFieldLength: number; } - interface DocResult { + interface QueryResult { tf?: number; idf?: number; boost: number; fieldName?: string; term?: number[]; } - type DocResults = Map; + type QueryResults = Map; + interface BM25Explanation { + boost: number; + score: number; + docID: number; + fieldName: string; + index: string; + idf: number; + tfNorm: number; + tf: number; + fieldLength: number; + avgFieldLength: number; + } + interface ConstantExplanation { + boost: number; + score: number; + } + type ScoreExplanation = BM25Explanation | ConstantExplanation; + type ScoreResult = Dict<{ + score: number; + explanation?: ScoreExplanation[]; + }>; } diff --git a/dist/packages/fs-storage/types/indexed-storage/src/index.d.ts b/dist/packages/fs-storage/types/indexed-storage/src/index.d.ts new file mode 100644 index 00000000..bf453632 --- /dev/null +++ b/dist/packages/fs-storage/types/indexed-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { IndexedStorage } from "./indexed_storage"; +export { IndexedStorage }; +export default IndexedStorage; diff --git a/dist/packages/fs-storage/types/indexed-storage/src/indexed_storage.d.ts b/dist/packages/fs-storage/types/indexed-storage/src/indexed_storage.d.ts index 457b01a0..adaeaef1 100644 --- a/dist/packages/fs-storage/types/indexed-storage/src/indexed_storage.d.ts +++ b/dist/packages/fs-storage/types/indexed-storage/src/indexed_storage.d.ts @@ -6,7 +6,7 @@ import { StorageAdapter } from "../../common/types"; * IndexedDb storage is provided per-domain, so we implement app/key/value database to * allow separate contexts for separate apps within a domain. */ -export declare class LokiIndexedStorage implements StorageAdapter { +export declare class IndexedStorage implements StorageAdapter { private _appname; private catalog; /** @@ -98,4 +98,4 @@ export interface Entry { key: string; size: number; } -export default LokiIndexedStorage; +export default IndexedStorage; diff --git a/dist/packages/fs-storage/types/local-storage/src/index.d.ts b/dist/packages/fs-storage/types/local-storage/src/index.d.ts new file mode 100644 index 00000000..2b74e8c0 --- /dev/null +++ b/dist/packages/fs-storage/types/local-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { LocalStorage } from "./local_storage"; +export { LocalStorage }; +export default LocalStorage; diff --git a/dist/packages/fs-storage/types/local-storage/src/local_storage.d.ts b/dist/packages/fs-storage/types/local-storage/src/local_storage.d.ts index 2337eb12..380d8be9 100644 --- a/dist/packages/fs-storage/types/local-storage/src/local_storage.d.ts +++ b/dist/packages/fs-storage/types/local-storage/src/local_storage.d.ts @@ -1,9 +1,9 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists to web browser's local storage object - * @constructor LokiLocalStorageAdapter + * @constructor LocalStorageAdapter */ -export declare class LokiLocalStorage implements StorageAdapter { +export declare class LocalStorage implements StorageAdapter { /** * Registers the local storage as plugin. */ @@ -33,4 +33,4 @@ export declare class LokiLocalStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiLocalStorage; +export default LocalStorage; diff --git a/dist/packages/fs-storage/types/loki/src/clone.d.ts b/dist/packages/fs-storage/types/loki/src/clone.d.ts index 03b650d7..c74a17bd 100644 --- a/dist/packages/fs-storage/types/loki/src/clone.d.ts +++ b/dist/packages/fs-storage/types/loki/src/clone.d.ts @@ -1,10 +1,4 @@ -export declare enum CloneMethod { - PARSE_STRINGIFY = 0, - DEEP = 1, - SHALLOW = 2, - SHALLOW_ASSIGN = 3, - SHALLOW_RECURSE_OBJECTS = 4, -} +export declare type CloneMethod = "parse-stringify" | "deep" | "shallow" | "shallow-recurse-objects"; /** * @hidden */ diff --git a/dist/packages/fs-storage/types/loki/src/collection.d.ts b/dist/packages/fs-storage/types/loki/src/collection.d.ts index 8b44c82f..9bd5e091 100644 --- a/dist/packages/fs-storage/types/loki/src/collection.d.ts +++ b/dist/packages/fs-storage/types/loki/src/collection.d.ts @@ -1,34 +1,39 @@ import { LokiEventEmitter } from "./event_emitter"; import { UniqueIndex } from "./unique_index"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { DynamicView } from "./dynamic_view"; import { CloneMethod } from "./clone"; -import { Doc, Dict, Query } from "../../common/types"; +import { Doc, Dict } from "../../common/types"; import { FullTextSearch } from "../../full-text-search/src/full_text_search"; import { Tokenizer } from "../../full-text-search/src/tokenizer"; -export declare type ANY = any; export { CloneMethod } from "./clone"; /** * Collection class that handles documents of same type * @extends LokiEventEmitter + * @param - the data type + * @param - nested properties of data type */ -export declare class Collection extends LokiEventEmitter { +export declare class Collection extends LokiEventEmitter { name: string; - data: Doc[]; + _data: Doc[]; private idIndex; - binaryIndices: Dict; + binaryIndices: { + [P in keyof TData]?: Collection.BinaryIndex; + }; /** - * Unique contraints contain duplicate object references, so they are not persisted. - * We will keep track of properties which have unique contraint applied here, and regenerate on load. + * Unique constraints contain duplicate object references, so they are not persisted. + * We will keep track of properties which have unique constraints applied here, and regenerate on load. */ constraints: { - unique: {}; + unique: { + [P in keyof TData]?: UniqueIndex; + }; }; /** * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along * with the database. */ - transforms: {}; + transforms: Dict[]>; /** * In autosave scenarios we will use collection level dirty flags to determine whether save is needed. * currently, if any collection is dirty we will autosave the whole database if autosave is configured. @@ -62,7 +67,7 @@ export declare class Collection extends LokiEventEmit /** * Disable delta update object style on changes. */ - disableDeltaChangesApi: ANY; + disableDeltaChangesApi: boolean; /** * By default, if you insert a document into a collection with binary indices, if those indexed properties contain * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the @@ -72,7 +77,7 @@ export declare class Collection extends LokiEventEmit /** * Option to activate a cleaner daemon - clears "aged" documents at set intervals. */ - ttl: ANY; + ttl: Collection.TTL; private maxId; private _dynamicViews; /** @@ -81,7 +86,15 @@ export declare class Collection extends LokiEventEmit private changes; private insertHandler; private updateHandler; - console: ANY; + console: { + log(...args: any[]): void; + warn(...args: any[]): void; + error(...args: any[]): void; + }; + /** + * stages: a map of uniquely identified 'stages', which hold copies of objects to be + * manipulated without affecting the data in the original collection + */ private stages; private commitLog; _fullTextSearch: FullTextSearch; @@ -97,69 +110,50 @@ export declare class Collection extends LokiEventEmit * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable - * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method + * @param {string} [options.cloneMethod="deep"] - the clone method * @param {number} [options.transactional=false] - ? * @param {number} options.ttl - ? * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @see {@link Loki#addCollection} for normal creation of collections */ - constructor(name: string, options?: Collection.Options); - toJSON(): { - name: string; - _dynamicViews: DynamicView[]; - uniqueNames: string[]; - transforms: {}; - binaryIndices: Dict; - data: Doc[]; - idIndex: number[]; - maxId: number; - dirty: boolean; - adaptiveBinaryIndices: boolean; - transactional: boolean; - asyncListeners: boolean; - disableChangesApi: boolean; - cloneObjects: boolean; - cloneMethod: CloneMethod; - changes: any[]; - _fullTextSearch: FullTextSearch; - }; - static fromJSONObject(obj: ANY, options?: Collection.DeserializeOptions): Collection; + constructor(name: string, options?: Collection.Options); + toJSON(): Collection.Serialized; + static fromJSONObject(obj: Collection.Serialized, options?: Collection.DeserializeOptions): Collection; /** * Adds a named collection transform to the collection * @param {string} name - name to associate with transform * @param {array} transform - an array of transformation 'step' objects to save into the collection */ - addTransform(name: string, transform: ANY[]): void; + addTransform(name: string, transform: Collection.Transform[]): void; /** * Retrieves a named transform from the collection. * @param {string} name - name of the transform to lookup. */ - getTransform(name: string): any; + getTransform(name: string): Collection.Transform[]; /** * Updates a named collection transform to the collection * @param {string} name - name to associate with transform * @param {object} transform - a transformation object to save into collection */ - setTransform(name: string, transform: ANY[]): void; + setTransform(name: string, transform: Collection.Transform[]): void; /** * Removes a named collection transform from the collection * @param {string} name - name of collection transform to remove */ removeTransform(name: string): void; - ttlDaemonFuncGen(): () => void; private setTTL(age, interval); /** * create a row filter that covers all documents in the collection */ - prepareFullDocIndex(): any[]; + _prepareFullDocIndex(): number[]; /** * Ensure binary index on a certain field * @param {string} property - name of property to create binary index on - * @param {boolean} force - (Optional) flag indicating whether to construct index immediately + * @param {boolean} [force=false] - flag indicating whether to construct index immediately */ - ensureIndex(property: string, force?: boolean): void; - getSequencedIndexValues(property: string): string; - ensureUniqueIndex(field: string): UniqueIndex; + ensureIndex(property: keyof TData, force?: boolean): void; + getSequencedIndexValues(property: keyof TData): string; + ensureUniqueIndex(field: keyof TData): UniqueIndex; /** * Ensure all binary indices */ @@ -171,11 +165,11 @@ export declare class Collection extends LokiEventEmit * @param {object} query - (optional) query object to count results of * @returns {number} number of documents in the collection */ - count(query?: object): number; + count(query?: ResultSet.Query & TNested>): number; /** * Rebuild idIndex */ - ensureId(): void; + private _ensureId(); /** * Add a dynamic view to the collection * @param {string} name - name of dynamic view to add @@ -185,7 +179,7 @@ export declare class Collection extends LokiEventEmit * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here) * @returns {DynamicView} reference to the dynamic view added **/ - addDynamicView(name: string, options?: DynamicView.Options): DynamicView; + addDynamicView(name: string, options?: DynamicView.Options): DynamicView; /** * Remove a dynamic view from the collection * @param {string} name - name of dynamic view to remove @@ -196,7 +190,7 @@ export declare class Collection extends LokiEventEmit * @param {string} name - name of dynamic view to retrieve reference of * @returns {DynamicView} A reference to the dynamic view with that name **/ - getDynamicView(name: string): DynamicView; + getDynamicView(name: string): DynamicView; /** * Applies a 'mongo-like' find query object and passes all results to an update function. * For filter function querying you should migrate to [ @@ -205,38 +199,39 @@ export declare class Collection extends LokiEventEmit * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode) * @param {function} updateFunction - update function to run against filtered documents */ - findAndUpdate(filterObject: Query | ((obj: E) => boolean), updateFunction: (obj: E) => E): void; + findAndUpdate(filterObject: ResultSet.Query & TNested> | ((obj: Doc) => boolean), updateFunction: (obj: Doc) => any): void; /** * Applies a 'mongo-like' find query object removes all documents which match that filter. * * @param {object} filterObject - 'mongo-like' query object */ - findAndRemove(filterObject: object): void; + findAndRemove(filterObject: ResultSet.Query & TNested>): void; /** * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc. * @param {(object|array)} doc - the document (or array of documents) to be inserted * @returns {(object|array)} document or documents inserted */ - insert(doc: E | E[]): Doc; - insert(doc: E[]): Doc[]; + insert(doc: TData): Doc; + insert(doc: TData[]): Doc[]; /** * Adds a single object, ensures it has meta properties, clone it if necessary, etc. * @param {object} doc - the document to be inserted * @param {boolean} bulkInsert - quiet pre-insert and insert event emits * @returns {object} document or 'undefined' if there was a problem inserting it */ - insertOne(doc: E, bulkInsert?: boolean): Doc; + insertOne(doc: TData, bulkInsert?: boolean): Doc; /** * Empties the collection. - * @param {object} options - configure clear behavior - * @param {boolean} options.removeIndices - (default: false) + * @param {boolean} [removeIndices=false] - remove indices */ - clear(options?: ANY): void; + clear({removeIndices: removeIndices}?: { + removeIndices?: boolean; + }): void; /** * Updates an object and notifies collection that the document has changed. * @param {object} doc - document to update within the collection */ - update(doc: ANY): any; + update(doc: Doc | Doc[]): void; /** * Add object to collection */ @@ -247,24 +242,24 @@ export declare class Collection extends LokiEventEmit * @param {function} filterFunction - filter function whose results will execute update * @param {function} updateFunction - update function to run against filtered documents */ - updateWhere(filterFunction: (obj: E) => boolean, updateFunction: (obj: E) => E): void; + updateWhere(filterFunction: (obj: Doc) => boolean, updateFunction: (obj: Doc) => any): void; /** * Remove all documents matching supplied filter function. * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}. * @param {function|object} query - query object to filter on */ - removeWhere(query: Query | ((obj: E) => boolean)): void; + removeWhere(query: ResultSet.Query & TNested> | ((obj: Doc) => boolean)): void; removeDataOnly(): void; /** * Remove a document from the collection - * @param {object} doc - document to remove from collection + * @param {number|object} doc - document to remove from collection */ - remove(doc: ANY): any; + remove(doc: number | Doc | Doc[]): void; /** * Returns all changes. - * @returns {ANY} + * @returns {Collection.Change[]} */ - getChanges(): any[]; + getChanges(): Collection.Change[]; /** * Enables/disables changes api. * @param {boolean} disableChangesApi @@ -301,34 +296,35 @@ export declare class Collection extends LokiEventEmit * @returns {(object|array|null)} Object reference if document was found, null if not, * or an array if 'returnPosition' was passed. */ - get(id: number): Doc; - get(id: number, returnPosition: boolean): Doc | [Doc, number]; + get(id: number): Doc; + get(id: number, returnPosition: boolean): Doc | [Doc, number]; /** * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value * Since multiple documents may contain the same value (which the index is sorted on), * we hone in on range and then linear scan range to find exact index array position. - * @param {int} dataPosition : coll.data array index/position + * @param {int} dataPosition : data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - getBinaryIndexPosition(dataPosition: number, binaryIndexName: string): number; + getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData): number; /** * Adaptively insert a selected item to the index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively update a selected item within an index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively remove a selected item from the index. - * @param {int} dataPosition : coll.data array index/position + * @param {number} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in + * @param {boolean} removedFromIndexOnly - remove from index only */ - adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: string, removedFromIndexOnly?: boolean): ANY; + adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly?: boolean): void; /** * Internal method used for index maintenance and indexed searching. * Calculates the beginning of an index range for a given value. @@ -351,7 +347,7 @@ export declare class Collection extends LokiEventEmit private _calculateRangeEnd(prop, val); /** * Binary Search utility method to find range/segment of values matching criteria. - * this is used for collection.find() and first find filter of resultset/dynview + * this is used for collection.find() and first find filter of ResultSet/dynview * slightly different than get() binary search in that get() hones in on 1 value, * but we have to hone in on many (range) * @param {string} op - operation, such as $eq @@ -359,29 +355,29 @@ export declare class Collection extends LokiEventEmit * @param {object} val - value to use for range calculation. * @returns {array} [start, end] index array positions */ - calculateRange(op: string, prop: string, val: ANY): [number, number]; + calculateRange(op: string, prop: keyof TData, val: any): [number, number]; /** * Retrieve doc by Unique index * @param {string} field - name of uniquely indexed property to use when doing lookup * @param {any} value - unique value to search for * @returns {object} document matching the value passed */ - by(field: string, value: ANY): Doc; + by(field: string, value: any): Doc; /** * Find one object by index property, by property equal to value * @param {object} query - query object used to perform search with * @returns {(object|null)} First matching document, or null if none */ - findOne(query: object): Doc; + findOne(query: ResultSet.Query & TNested>): Doc; /** * Chain method, used for beginning a series of chained find() and/or view() operations * on a collection. * * @param {array} transform - Ordered array of transform step objects similar to chain * @param {object} parameters - Object containing properties representing parameters to substitute - * @returns {Resultset} (this) resultset, or data array if any map or join functions where called + * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called */ - chain(transform?: string | ANY[], parameters?: ANY): Resultset; + chain(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** * Find method, api is similar to mongodb. * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}. @@ -389,20 +385,26 @@ export declare class Collection extends LokiEventEmit * @param {object} query - 'mongo-like' query object * @returns {array} Array of matching documents */ - find(query?: Query): Doc[]; + find(query?: ResultSet.Query & TNested>): Doc[]; /** * Find object by unindexed field by property equal to value, * simply iterates and returns the first element matching the query */ - findOneUnindexed(prop: string, value: ANY): Doc; + findOneUnindexed(prop: string, value: any): Doc; /** * Transaction methods */ - /** start the transation */ + /** + * start the transation + */ startTransaction(): void; - /** commit the transation */ + /** + * commit the transation + */ commit(): void; - /** roll back the transation */ + /** + * roll back the transation + */ rollback(): void; /** * Query the collection by supplying a javascript filter function. @@ -414,14 +416,14 @@ export declare class Collection extends LokiEventEmit * @param {function} fun - filter function to run against all collection docs * @returns {array} all documents which pass your filter function */ - where(fun: (obj: E) => boolean): Doc[]; + where(fun: (obj: Doc) => boolean): Doc[]; /** * Map Reduce operation * @param {function} mapFunction - function to use as map function * @param {function} reduceFunction - function to use as reduce function * @returns {data} The result of your mapReduce operation */ - mapReduce(mapFunction: (value: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (value: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Join two collections on specified properties * @@ -429,13 +431,13 @@ export declare class Collection extends LokiEventEmit * @param {string} leftJoinProp - property name in collection * @param {string} rightJoinProp - property name in joinData * @param {function} mapFun - (Optional) map function to use - * @returns {Resultset} Result of the mapping operation - */ - eqJoin(joinData: ANY[], leftJoinProp: string, rightJoinProp: string, mapFun?: Function): Resultset; - /** - * stages: a map of uniquely identified 'stages', which hold copies of objects to be - * manipulated without affecting the data in the original collection + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method + * @returns {ResultSet} Result of the mapping operation */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinProp: string | ((obj: any) => string), rightJoinProp: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * (Staging API) create a stage and/or retrieve it */ @@ -446,7 +448,7 @@ export declare class Collection extends LokiEventEmit /** * (Staging API) create a copy of an object and insert it into a stage */ - stage(stageName: string, obj: ANY): any; + stage(stageName: string, obj: Doc): F; /** * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt * then create a message to be inserted in the commitlog @@ -459,10 +461,10 @@ export declare class Collection extends LokiEventEmit extract(field: string): any[]; /** */ - max(field: string): any; + max(field: string): number; /** */ - min(field: string): any; + min(field: string): number; /** */ maxRecord(field: string): { @@ -500,9 +502,9 @@ export declare class Collection extends LokiEventEmit median(field: string): number; } export declare namespace Collection { - interface Options { - unique?: string[]; - indices?: string[]; + interface Options { + unique?: (keyof TData)[]; + indices?: (keyof TData)[]; adaptiveBinaryIndices?: boolean; asyncListeners?: boolean; disableChangesApi?: boolean; @@ -518,10 +520,89 @@ export declare namespace Collection { interface DeserializeOptions { retainDirtyFlags?: boolean; fullTextSearch?: Dict; + [collName: string]: any | { + proto?: any; + inflate?: (src: object, dest?: object) => void; + }; } interface BinaryIndex { dirty: boolean; values: any; } - type Change = any; + interface Change { + name: string; + operation: string; + obj: any; + } + interface Serialized { + name: string; + _dynamicViews: DynamicView[]; + uniqueNames: string[]; + transforms: Dict; + binaryIndices: Dict; + _data: Doc[]; + idIndex: number[]; + maxId: number; + dirty: boolean; + adaptiveBinaryIndices: boolean; + transactional: boolean; + asyncListeners: boolean; + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + cloneObjects: boolean; + cloneMethod: CloneMethod; + changes: any; + _fullTextSearch: FullTextSearch; + } + type Transform = { + type: "find"; + value: ResultSet.Query & TNested> | string; + } | { + type: "where"; + value: ((obj: Doc) => boolean) | string; + } | { + type: "simplesort"; + property: keyof (TData & TNested); + desc?: boolean; + } | { + type: "compoundsort"; + value: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]; + } | { + type: "sort"; + value: (a: Doc, b: Doc) => number; + } | { + type: "sortByScoring"; + desc?: boolean; + } | { + type: "limit"; + value: number; + } | { + type: "offset"; + value: number; + } | { + type: "map"; + value: (obj: TData, index: number, array: TData[]) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "eqJoin"; + joinData: Collection | ResultSet; + leftJoinKey: string | ((obj: any) => string); + rightJoinKey: string | ((obj: any) => string); + mapFun?: (left: any, right: any) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "mapReduce"; + mapFunction: (item: TData, index: number, array: TData[]) => any; + reduceFunction: (array: any[]) => any; + } | { + type: "update"; + value: (obj: Doc) => any; + } | { + type: "remove"; + }; + interface TTL { + age: number; + ttlInterval: number; + daemon: any; + } } diff --git a/dist/packages/fs-storage/types/loki/src/dynamic_view.d.ts b/dist/packages/fs-storage/types/loki/src/dynamic_view.d.ts index 1aeab3a4..5cda4b13 100644 --- a/dist/packages/fs-storage/types/loki/src/dynamic_view.d.ts +++ b/dist/packages/fs-storage/types/loki/src/dynamic_view.d.ts @@ -1,9 +1,8 @@ import { LokiEventEmitter } from "./event_emitter"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { Collection } from "./collection"; -import { Doc, Filter } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; /** * DynamicView class is a versatile 'live' view class which can have filters and sorts applied. * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it @@ -18,18 +17,21 @@ export declare type ANY = any; * @extends LokiEventEmitter * @see {@link Collection#addDynamicView} to construct instances of DynamicView + * + * @param - the data type + * @param - nested properties of data type */ -export declare class DynamicView extends LokiEventEmitter { +export declare class DynamicView extends LokiEventEmitter { private _collection; private _persistent; private _sortPriority; private _minRebuildInterval; name: string; private _rebuildPending; - private _resultset; - private _resultdata; - private _resultsdirty; - private _cachedresultset; + private _resultSet; + private _resultData; + private _resultDirty; + private _cachedResultSet; private _filterPipeline; private _sortFunction; private _sortCriteria; @@ -41,10 +43,10 @@ export declare class DynamicView extends LokiEventEmi * @param {string} name - the name of this dynamic view * @param {object} options - the options * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' - * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority + * @param {string} [options.sortPriority="passive"] - the sort priority * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here) */ - constructor(collection: Collection, name: string, options?: DynamicView.Options); + constructor(collection: Collection, name: string, options?: DynamicView.Options); /** * Internally used immediately after deserialization (loading) * This will clear out and reapply filterPipeline ops, recreating the view. @@ -57,34 +59,22 @@ export declare class DynamicView extends LokiEventEmi */ _rematerialize({removeWhereFilters}: { removeWhereFilters?: boolean; - }): DynamicView; + }): this; /** - * Makes a copy of the internal resultset for branched queries. - * Unlike this dynamic view, the branched resultset will not be 'live' updated, + * Makes a copy of the internal ResultSet for branched queries. + * Unlike this dynamic view, the branched ResultSet will not be 'live' updated, * so your branched query should be immediately resolved and not held for future evaluation. * * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps * @param {object} parameters - optional parameters (if optional transform requires them) - * @returns {Resultset} A copy of the internal resultset for branched queries. + * @returns {ResultSet} A copy of the internal ResultSet for branched queries. */ - branchResultset(transform: string | any[], parameters?: object): Resultset; + branchResultSet(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** - * toJSON() - Override of toJSON to avoid circular references - * + * Override of toJSON to avoid circular references. */ - toJSON(): { - name: string; - _persistent: boolean; - _sortPriority: DynamicView.SortPriority; - _minRebuildInterval: number; - _resultset: Resultset; - _resultsdirty: boolean; - _filterPipeline: Filter[]; - _sortCriteria: (string | [string, boolean])[]; - _sortByScoring: boolean; - _sortDirty: boolean; - }; - static fromJSONObject(collection: ANY, obj: ANY): DynamicView; + toJSON(): DynamicView.Serialized; + static fromJSONObject(collection: Collection, obj: DynamicView.Serialized): DynamicView; /** * Used to clear pipeline and reset dynamic view to initial state. * Existing options should be retained. @@ -105,7 +95,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} comparefun - a javascript compare function used for sorting * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySort(comparefun: (lhs: E, rhs: E) => number): DynamicView; + applySort(comparefun: (lhs: Doc, rhs: Doc) => number): this; /** * Used to specify a property used for view translation. * @example @@ -115,9 +105,9 @@ export declare class DynamicView extends LokiEventEmi * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySimpleSort(propname: string, isdesc?: boolean): DynamicView; + applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * dv.applySortCriteria(['age', 'name']); @@ -129,32 +119,32 @@ export declare class DynamicView extends LokiEventEmi * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations. */ - applySortCriteria(criteria: (string | [string, boolean])[]): DynamicView; + applySortCriteria(criteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Used to apply a sort by the latest full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending */ - applySortByScoring(ascending?: boolean): DynamicView; + applySortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** * Marks the beginning of a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - startTransaction(): DynamicView; + startTransaction(): this; /** * Commits a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - commit(): DynamicView; + commit(): this; /** * Rolls back a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - rollback(): DynamicView; + rollback(): this; /** * Find the index of a filter in the pipeline, by that filter's ID. * @@ -163,7 +153,7 @@ export declare class DynamicView extends LokiEventEmi */ private _indexOfFilterWithId(uid); /** - * Add the filter object to the end of view's filter pipeline and apply the filter to the resultset. + * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet. * * @param {object} filter - The filter object. Refer to applyFilter() for extra details. */ @@ -173,7 +163,7 @@ export declare class DynamicView extends LokiEventEmi * * @returns {DynamicView} this DynamicView object, for further chain ops. */ - reapplyFilters(): DynamicView; + reapplyFilters(): this; /** * Adds or updates a filter in the DynamicView filter pipeline * @@ -181,7 +171,7 @@ export declare class DynamicView extends LokiEventEmi * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id } * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFilter(filter: Filter): DynamicView; + applyFilter(filter: DynamicView.Filter): this; /** * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline * @@ -189,7 +179,7 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFind(query: object, uid?: string | number): DynamicView; + applyFind(query: object, uid?: string | number): this; /** * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline * @@ -197,14 +187,14 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyWhere(fun: (obj: E) => boolean, uid?: string | number): DynamicView; + applyWhere(fun: (obj: Doc) => boolean, uid?: string | number): this; /** * removeFilter() - Remove the specified filter from the DynamicView filter pipeline * * @param {(string|number)} uid - The unique ID of the filter to be removed. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - removeFilter(uid: string | number): DynamicView; + removeFilter(uid: string | number): this; /** * Returns the number of documents representing the current DynamicView contents. * @returns {number} The number of documents representing the current DynamicView contents. @@ -213,16 +203,16 @@ export declare class DynamicView extends LokiEventEmi /** * Resolves and pending filtering and sorting, then returns document array as result. * - * @param {object} options - optional parameters to pass to resultset.data() if non-persistent - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * * @returns {Array} An array of documents representing the current DynamicView contents. */ - data(options?: object): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** * When the view is not sorted we may still wish to be notified of rebuild events. * This event will throttle and queue a single rebuild event when batches of updates affect the view. @@ -257,7 +247,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; } export declare namespace DynamicView { interface Options { @@ -265,8 +255,25 @@ export declare namespace DynamicView { sortPriority?: SortPriority; minRebuildInterval?: number; } - enum SortPriority { - PASSIVE = 0, - ACTIVE = 1, + type SortPriority = "passive" | "active"; + interface Serialized { + name: string; + _persistent: boolean; + _sortPriority: SortPriority; + _minRebuildInterval: number; + _resultSet: ResultSet; + _filterPipeline: Filter[]; + _sortCriteria: (string | [string, boolean])[]; + _sortByScoring: boolean; + _sortDirty: boolean; } + type Filter = { + type: "find"; + val: ResultSet.Query & TNested>; + uid: number | string; + } | { + type: "where"; + val: (obj: Doc) => boolean; + uid: number | string; + }; } diff --git a/dist/packages/fs-storage/types/loki/src/event_emitter.d.ts b/dist/packages/fs-storage/types/loki/src/event_emitter.d.ts index f422ee35..e55515e9 100644 --- a/dist/packages/fs-storage/types/loki/src/event_emitter.d.ts +++ b/dist/packages/fs-storage/types/loki/src/event_emitter.d.ts @@ -1,4 +1,3 @@ -export declare type ANY = any; /** * LokiEventEmitter is a minimalist version of EventEmitter. It enables any * constructor that inherits EventEmitter to emit events and trigger @@ -31,7 +30,7 @@ export declare class LokiEventEmitter { * @param {string} eventName - the name of the event * @param {object} data - optional object passed with the event */ - emit(eventName: string, ...data: ANY[]): void; + emit(eventName: string, ...data: any[]): void; /** * Alias of LokiEventEmitter.prototype.on * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event diff --git a/dist/packages/fs-storage/types/loki/src/helper.d.ts b/dist/packages/fs-storage/types/loki/src/helper.d.ts index b187e0eb..44b72305 100644 --- a/dist/packages/fs-storage/types/loki/src/helper.d.ts +++ b/dist/packages/fs-storage/types/loki/src/helper.d.ts @@ -1,8 +1,5 @@ /** - * @hidden - */ -export declare type ANY = any; -/** Helper function for determining 'loki' abstract equality which is a little more abstract than == + * Helper function for determining 'loki' abstract equality which is a little more abstract than == * aeqHelper(5, '5') === true * aeqHelper(5.0, '5') === true * aeqHelper(new Date("1/1/2011"), new Date("1/1/2011")) === true @@ -10,34 +7,33 @@ export declare type ANY = any; * aeqHelper([1, 2, 3], [1, 3]) === false * aeqHelper([1, 2, 3], [1, 2, 3]) === true * aeqHelper(undefined, null) === true - */ -/** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @returns {boolean} + * @hidden */ -export declare function aeqHelper(prop1: ANY, prop2: ANY): boolean; -/** Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. +export declare function aeqHelper(prop1: any, prop2: any): boolean; +/** + * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. * In the future we might want $lt and $gt ops to use their own functionality/helper. * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another. * @hidden */ -export declare function ltHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function ltHelper(prop1: any, prop2: any, equal: boolean): boolean; /** * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @param {boolean} equal * @returns {boolean} */ -export declare function gtHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function gtHelper(prop1: any, prop2: any, equal: boolean): boolean; /** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 - * @param {ANY} desc + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} descending * @returns {number} + * @hidden */ -export declare function sortHelper(prop1: ANY, prop2: ANY, desc: ANY): 0 | 1 | -1; +export declare function sortHelper(prop1: any, prop2: any, descending: boolean): number; diff --git a/dist/packages/fs-storage/types/loki/src/index.d.ts b/dist/packages/fs-storage/types/loki/src/index.d.ts index dee82236..17ee6df4 100644 --- a/dist/packages/fs-storage/types/loki/src/index.d.ts +++ b/dist/packages/fs-storage/types/loki/src/index.d.ts @@ -1,7 +1,4 @@ import { Loki } from "./loki"; import { Collection } from "./collection"; export { Loki, Collection }; -declare const _default: { - Loki: typeof Loki; -}; -export default _default; +export default Loki; diff --git a/dist/packages/fs-storage/types/loki/src/loki.d.ts b/dist/packages/fs-storage/types/loki/src/loki.d.ts index 10e81b65..f2deafd2 100644 --- a/dist/packages/fs-storage/types/loki/src/loki.d.ts +++ b/dist/packages/fs-storage/types/loki/src/loki.d.ts @@ -1,7 +1,6 @@ import { LokiEventEmitter } from "./event_emitter"; import { Collection } from "./collection"; import { Doc, StorageAdapter } from "../../common/types"; -export declare type ANY = any; export declare class Loki extends LokiEventEmitter { private filename; private databaseVersion; @@ -23,7 +22,7 @@ export declare class Loki extends LokiEventEmitter { * Constructs the main database class. * @param {string} filename - name of the file to be saved to * @param {object} [options={}] - options - * @param {Loki.Environment} [options.env=auto] - overrides environment detection + * @param {Loki.Environment} [options.env] - the javascript environment * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method * @param {string} [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization * @param {boolean} [options.verbose=false] - enable console output @@ -64,21 +63,21 @@ export declare class Loki extends LokiEventEmitter { * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @returns {Collection} a reference to the collection which was just added */ - addCollection(name: string, options?: Collection.Options): Collection; + addCollection(name: string, options?: Collection.Options): Collection; loadCollection(collection: Collection): void; /** * Retrieves reference to a collection by name. * @param {string} collectionName - name of collection to look up * @returns {Collection} Reference to collection in database by that name, or null if not found */ - getCollection(collectionName: string): Collection; + getCollection(collectionName: string): Collection; /** * Renames an existing loki collection * @param {string} oldName - name of collection to rename * @param {string} newName - new name of collection * @returns {Collection} reference to the newly renamed collection */ - renameCollection(oldName: string, newName: string): Collection<{}>; + renameCollection(oldName: string, newName: string): Collection; listCollections(): { name: string; count: number; @@ -95,20 +94,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {string} Stringified representation of the loki database. */ serialize(options?: Loki.SerializeOptions): string | string[]; - toJSON(): { - _env: Loki.Environment; - _serializationMethod: Loki.SerializationMethod; - _autosave: boolean; - _autosaveInterval: number; - _collections: Collection[]; - databaseVersion: number; - engineVersion: number; - filename: string; - _persistenceAdapter: StorageAdapter; - _persistenceMethod: Loki.PersistenceMethod; - _throttledSaves: boolean; - _verbose: boolean; - }; + toJSON(): Loki.Serialized; /** * Database level destructured JSON serialization routine to allow alternate serialization methods. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -134,7 +120,11 @@ export declare class Loki extends LokiEventEmitter { * * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection. */ - serializeCollection(options?: ANY): string | string[]; + serializeCollection(options?: { + delimited?: boolean; + collectionIndex?: number; + delimiter?: string; + }): string | string[]; /** * Database level destructured JSON deserialization routine to minimize memory overhead. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -150,7 +140,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array */ - deserializeDestructured(destructuredSource: ANY, options?: Loki.SerializeDestructuredOptions): any; + deserializeDestructured(destructuredSource: string | string[], options?: Loki.SerializeDestructuredOptions): any; /** * Collection level utility function to deserializes a destructured collection. * @@ -161,7 +151,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {Array} an array of documents to attach to collection.data. */ - deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc; + deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc[]; /** * Inflates a loki database from a serialized JSON string * @@ -169,15 +159,16 @@ export declare class Loki extends LokiEventEmitter { * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSON(serializedDb: string | string[], options?: ANY): void; + loadJSON(serializedDb: string | string[], options?: Collection.DeserializeOptions): void; /** * Inflates a loki database from a JS object * - * @param {object} dbObject - a serialized loki database string + * @param {object} dbObject - a serialized loki database object * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSONObject(dbObject: ANY, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki.Serialized, options?: Collection.DeserializeOptions): void; /** * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer. * Does not actually destroy the db. @@ -201,7 +192,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {Array} array of changes * @see private method _createChange() in Collection */ - generateChangesNotification(arrayOfCollectionNames?: string[]): any[]; + generateChangesNotification(arrayOfCollectionNames?: string[]): Collection.Change[]; /** * (Changes API) - stringify changes for network transmission * @returns {string} string representation of the changes @@ -310,24 +301,22 @@ export declare namespace Loki { recursiveWaitLimitDuration?: number; started?: Date; } - type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; - enum SerializationMethod { - NORMAL = 0, - PRETTY = 1, - DESTRUCTURED = 2, - } - enum PersistenceMethod { - FS_STORAGE = 0, - LOCAL_STORAGE = 1, - INDEXED_STORAGE = 2, - MEMORY_STORAGE = 3, - ADAPTER = 4, - } - enum Environment { - NODE_JS = 0, - NATIVE_SCRIPT = 1, - BROWSER = 2, - CORDOVA = 3, - MEMORY = 4, + interface Serialized { + _env: Environment; + _serializationMethod: SerializationMethod; + _autosave: boolean; + _autosaveInterval: number; + _collections: Collection[]; + databaseVersion: number; + engineVersion: number; + filename: string; + _persistenceAdapter: StorageAdapter; + _persistenceMethod: PersistenceMethod; + _throttledSaves: boolean; + _verbose: boolean; } + type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; + type SerializationMethod = "normal" | "pretty" | "destructured"; + type PersistenceMethod = "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter"; + type Environment = "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "MEMORY"; } diff --git a/dist/packages/full-text-search-language-en/types/loki/src/resultset.d.ts b/dist/packages/fs-storage/types/loki/src/result_set.d.ts similarity index 52% rename from dist/packages/full-text-search-language-en/types/loki/src/resultset.d.ts rename to dist/packages/fs-storage/types/loki/src/result_set.d.ts index 8ee6b343..b29e3a52 100644 --- a/dist/packages/full-text-search-language-en/types/loki/src/resultset.d.ts +++ b/dist/packages/fs-storage/types/loki/src/result_set.d.ts @@ -1,8 +1,8 @@ import { Collection } from "./collection"; import { CloneMethod } from "./clone"; -import { Doc, Query } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; +import { Query as FullTextSearchQuery } from "../../full-text-search/src/query_builder"; /** * @hidden */ @@ -15,29 +15,29 @@ export declare const LokiOps: { $gte(a: any, b: any): boolean; $lt(a: any, b: any): boolean; $lte(a: any, b: any): boolean; - $between(a: any, vals: any): boolean; + $between(a: any, range: [any, any]): boolean; $in(a: any, b: any): boolean; $nin(a: any, b: any): boolean; - $keyin(a: any, b: any): boolean; - $nkeyin(a: any, b: any): boolean; - $definedin(a: any, b: any): boolean; - $undefinedin(a: any, b: any): boolean; - $regex(a: any, b: any): any; - $containsString(a: any, b: any): boolean; + $keyin(a: string, b: object): boolean; + $nkeyin(a: string, b: object): boolean; + $definedin(a: string, b: object): boolean; + $undefinedin(a: string, b: object): boolean; + $regex(a: string, b: RegExp): boolean; + $containsString(a: any, b: string): boolean; $containsNone(a: any, b: any): boolean; - $containsAny(a: any, b: any): any; - $contains(a: any, b: any): any; - $type(a: any, b: any): any; - $finite(a: any, b: any): boolean; - $size(a: any, b: any): any; - $len(a: any, b: any): any; + $containsAny(a: any, b: any): boolean; + $contains(a: any, b: any): boolean; + $type(a: any, b: any): boolean; + $finite(a: number, b: boolean): boolean; + $size(a: any, b: any): boolean; + $len(a: any, b: any): boolean; $where(a: any, b: any): boolean; $not(a: any, b: any): boolean; $and(a: any, b: any): boolean; $or(a: any, b: any): boolean; }; /** - * Resultset class allowing chainable queries. Intended to be instanced internally. + * ResultSet class allowing chainable queries. Intended to be instanced internally. * Collection.find(), Collection.where(), and Collection.chain() instantiate this. * * @example @@ -45,61 +45,64 @@ export declare const LokiOps: { * .find({ 'doors' : 4 }) * .where(function(obj) { return obj.name === 'Toyota' }) * .data(); + * + * @param - the data type + * @param - nested properties of data type */ -export declare class Resultset { - collection: Collection; - filteredrows: number[]; - filterInitialized: boolean; +export declare class ResultSet { + _collection: Collection; + _filteredRows: number[]; + _filterInitialized: boolean; private _scoring; /** * Constructor. - * @param {Collection} collection - the collection which this Resultset will query against + * @param {Collection} collection - the collection which this ResultSet will query against */ - constructor(collection: Collection); + constructor(collection: Collection); /** - * reset() - Reset the resultset to its initial state. + * reset() - Reset the ResultSet to its initial state. * - * @returns {Resultset} Reference to this resultset, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, for future chain operations. */ - reset(): Resultset; + reset(): this; /** - * toJSON() - Override of toJSON to avoid circular references + * Override of toJSON to avoid circular references * */ - toJSON(): Resultset; + toJSON(): ResultSet; /** * Allows you to limit the number of documents passed to next chain operation. - * A resultset copy() is made to avoid altering original resultset. + * A ResultSet copy() is made to avoid altering original ResultSet. * * @param {int} qty - The number of documents to return. - * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops. + * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops. */ - limit(qty: number): Resultset; + limit(qty: number): this; /** - * Used for skipping 'pos' number of documents in the resultset. + * Used for skipping 'pos' number of documents in the ResultSet. * * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. - * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. + * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops. */ - offset(pos: number): Resultset; + offset(pos: number): this; /** - * copy() - To support reuse of resultset in branched query situations. + * copy() - To support reuse of ResultSet in branched query situations. * - * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same. + * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same. */ - copy(): Resultset; + copy(): ResultSet; /** * Alias of copy() */ - branch(): Resultset; + branch(): ResultSet; /** - * Executes a named collection transform or raw array of transform steps against the resultset. + * Executes a named collection transform or raw array of transform steps against the ResultSet. * * @param {(string|array)} transform - name of collection transform or raw transform array * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. - * @returns {Resultset} either (this) resultset or a clone of of this resultset (depending on steps) + * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps) */ - transform(transform: string | any[], parameters?: object): Resultset; + transform(transform: string | Collection.Transform[], parameters?: object): this; /** * User supplied compare function is provided two documents to compare. (chainable) * @example @@ -110,20 +113,20 @@ export declare class Resultset { * }); * * @param {function} comparefun - A javascript compare function used for sorting. - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - sort(comparefun: (a: E, b: E) => number): Resultset; + sort(comparefun: (a: Doc, b: Doc) => number): this; /** * Simpler, loose evaluation for user to sort based on a property name. (chainable). * Sorting based on the same lt/gt helper functions used for binary indices. * * @param {string} propname - name of property to sort by. - * @param {boolean} isdesc - (Optional) If true, the property will be sorted in descending order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @param {boolean} [descending=false] - if true, the property will be sorted in descending order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - simplesort(propname: string, isdesc?: boolean): Resultset; + simplesort(propname: keyof (TData & TNested), descending?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * rs.compoundsort(['age', 'name']); @@ -131,9 +134,9 @@ export declare class Resultset { * rs.compoundsort(['age', ['name', true]); * * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - compoundsort(properties: (string | [string, boolean])[]): Resultset; + compoundsort(properties: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Helper function for compoundsort(), performing individual object comparisons * @@ -144,83 +147,83 @@ export declare class Resultset { */ private _compoundeval(properties, obj1, obj2); /** - * Sorts the resultset based on the last full-text-search scoring. + * Sorts the ResultSet based on the last full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending - * @returns {Resultset} + * @returns {ResultSet} */ - sortByScoring(ascending?: boolean): Resultset; + sortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** - * findOr() - oversee the operation of OR'ed query expressions. + * Oversee the operation of OR'ed query expressions. * OR'ed expression evaluation runs each expression individually against the full collection, * and finally does a set OR on each expression's results. * Each evaluation can utilize a binary index to prevent multiple linear array scans. * * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - findOr(expressionArray: Query[]): Resultset; - $or(expressionArray: Query[]): Resultset; + findOr(expressionArray: ResultSet.Query & TNested>[]): this; + $or(expressionArray: ResultSet.Query & TNested>[]): this; /** - * findAnd() - oversee the operation of AND'ed query expressions. + * Oversee the operation of AND'ed query expressions. * AND'ed expression evaluation runs each expression progressively against the full collection, - * internally utilizing existing chained resultset functionality. + * internally utilizing existing chained ResultSet functionality. * Only the first filter can utilize a binary index. * * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - findAnd(expressionArray: Query[]): Resultset; - $and(expressionArray: Query[]): Resultset; + findAnd(expressionArray: ResultSet.Query & TNested>[]): this; + $and(expressionArray: ResultSet.Query & TNested>[]): this; /** * Used for querying via a mongo-style query object. * * @param {object} query - A mongo-style query object used for filtering current results. * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - find(query?: Query, firstOnly?: boolean): Resultset; + find(query?: ResultSet.Query & TNested>, firstOnly?: boolean): this; /** * Used for filtering via a javascript filter function. * * @param {function} fun - A javascript function used for filtering current results by. - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - where(fun: (obj: E) => boolean): Resultset; + where(fun: (obj: Doc) => boolean): this; /** - * Returns the number of documents in the resultset. - * @returns {number} The number of documents in the resultset. + * Returns the number of documents in the ResultSet. + * @returns {number} The number of documents in the ResultSet. */ count(): number; /** * Terminates the chain and returns array of filtered documents * @param {object} options - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values 'parse-stringify', 'deep', and 'shallow' and + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * - * @returns {Array} Array of documents in the resultset + * @returns {Array} Array of documents in the ResultSet */ - data(options?: Resultset.DataOptions): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** - * Used to run an update operation on all documents currently in the resultset. + * Used to run an update operation on all documents currently in the ResultSet. * * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - update(updateFunction: (obj: E) => E): Resultset; + update(updateFunction: (obj: Doc) => TData): this; /** - * Removes all document objects which are currently in resultset from collection (as well as resultset) + * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet) * - * @returns {Resultset} this (empty) resultset for further chain ops. + * @returns {ResultSet} this (empty) ResultSet for further chain ops. */ - remove(): Resultset; + remove(): this; /** * data transformation via user supplied functions * @@ -228,35 +231,72 @@ export declare class Resultset { * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns {value} The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Left joining two sets of data. Join keys can be defined or calculated properties * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key - * @param {Array|Resultset|Collection} joinData - Data array to join to. + * @param {Array|ResultSet|Collection} joinData - Data array to join to. * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}] + * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method + * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}] */ - eqJoin(joinData: ANY, leftJoinKey: string | Function, rightJoinKey: string | Function, mapFun?: Function, dataOptions?: ANY): ANY; + eqJoin(joinData: Collection | ResultSet | any[], leftJoinKey: string | ((obj: any) => string), rightJoinKey: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * Applies a map function into a new collection for further chaining. * @param {function} mapFun - javascript map function * @param {object} [dataOptions=] - options to data() before input to your map function * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method + * @return {ResultSet} */ - map(mapFun: (obj: E, index: number, array: E[]) => U, dataOptions?: Resultset.DataOptions): Resultset; + map(mapFun: (obj: TData, index: number, array: TData[]) => U, dataOptions?: ResultSet.DataOptions): ResultSet; } -export declare namespace Resultset { +export declare namespace ResultSet { interface DataOptions { forceClones?: boolean; forceCloneMethod?: CloneMethod; removeMeta?: boolean; } + type LokiOps = { + $eq?: R; + $aeq?: R; + $ne?: R; + $dteq?: R; + $gt?: R; + $gte?: R; + $lt?: R; + $lte?: R; + $between?: [R, R]; + $in?: R[]; + $nin?: R[]; + $keyin?: object; + $nkeyin?: object; + $definedin?: object; + $undefinedin?: object; + $regex?: RegExp | string | [string, string]; + $containsString?: string; + $containsNone?: R[] | R; + $containsAny?: R[] | R; + $contains?: any; + $type?: string; + $finite?: boolean; + $size?: number; + $len?: number; + $where?: (val?: R) => boolean; + }; + type Query = { + [P in keyof TData]?: LokiOps | TData[P]; + } & { + $and?: Query[]; + } & { + $or?: Query[]; + } & { + $fts?: FullTextSearchQuery; + }; } diff --git a/dist/packages/fs-storage/types/loki/src/unique_index.d.ts b/dist/packages/fs-storage/types/loki/src/unique_index.d.ts index 40312618..55284c11 100644 --- a/dist/packages/fs-storage/types/loki/src/unique_index.d.ts +++ b/dist/packages/fs-storage/types/loki/src/unique_index.d.ts @@ -1,30 +1,30 @@ import { Doc } from "../../common/types"; -export declare class UniqueIndex { +export declare class UniqueIndex { private _field; private _keyMap; /** * Constructs an unique index object. * @param {number|string} propertyField - the property field to index */ - constructor(propertyField: number | string); + constructor(propertyField: keyof E); /** * Sets a document's unique index. * @param {Doc} doc - the document * @param {number} row - the data row of the document */ - set(doc: Doc, row: number): void; + set(doc: Doc, row: number): void; /** * Returns the data row of an unique index. * @param {number|string} index - the index * @returns {number | string} - the row */ - get(index: number | string): number; + get(index: keyof E): number; /** * Updates a document's unique index. * @param {Object} doc - the document * @param {number} row - the data row of the document */ - update(doc: Doc, row: number): void; + update(doc: Doc, row: number): void; /** * Removes an unique index. * @param {number|string} index - the unique index diff --git a/dist/packages/fs-storage/types/memory-storage/src/index.d.ts b/dist/packages/fs-storage/types/memory-storage/src/index.d.ts new file mode 100644 index 00000000..5330aa7d --- /dev/null +++ b/dist/packages/fs-storage/types/memory-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { MemoryStorage } from "./memory_storage"; +export { MemoryStorage }; +export default MemoryStorage; diff --git a/dist/packages/fs-storage/types/loki/src/memory_adapter.d.ts b/dist/packages/fs-storage/types/memory-storage/src/memory_storage.d.ts similarity index 61% rename from dist/packages/fs-storage/types/loki/src/memory_adapter.d.ts rename to dist/packages/fs-storage/types/memory-storage/src/memory_storage.d.ts index 7b97c7f7..0066a1de 100644 --- a/dist/packages/fs-storage/types/loki/src/memory_adapter.d.ts +++ b/dist/packages/fs-storage/types/memory-storage/src/memory_storage.d.ts @@ -1,19 +1,29 @@ -import { StorageAdapter } from "../../common/types"; -export declare type ANY = any; +import { Dict, StorageAdapter } from "../../common/types"; /** - * In in-memory persistence adapter for an in-memory database. + * An in-memory persistence adapter for an in-memory database. * This simple 'key/value' adapter is intended for unit testing and diagnostics. */ -export declare class LokiMemoryAdapter implements StorageAdapter { - private hashStore; - private options; +export declare class MemoryStorage implements StorageAdapter { + hashStore: Dict<{ + savecount: number; + lastsave: Date; + value: string; + }>; + options: MemoryStorage.Options; /** - * @param {object} options - memory adapter options + * Registers the local storage as plugin. + */ + static register(): void; + /** + * Deregisters the local storage as plugin. + */ + static deregister(): void; + /** + * @param {object} options - memory storage options * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) - * @param {ANY} options */ - constructor(options?: ANY); + constructor(options?: MemoryStorage.Options); /** * Loads a serialized database from its in-memory store. * (Loki persistence adapter interface function) @@ -27,6 +37,7 @@ export declare class LokiMemoryAdapter implements StorageAdapter { * (Loki persistence adapter interface function) * * @param {string} dbname - name of the database (filename/keyname) + * @param {string} dbstring - the database content * @returns {Promise} a Promise that resolves after the database was persisted */ saveDatabase(dbname: string, dbstring: string): Promise; @@ -38,3 +49,9 @@ export declare class LokiMemoryAdapter implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } +export declare namespace MemoryStorage { + interface Options { + asyncResponses?: boolean; + asyncTimeout?: number; + } +} diff --git a/dist/packages/fs-storage/types/partitioning-adapter/src/index.d.ts b/dist/packages/fs-storage/types/partitioning-adapter/src/index.d.ts new file mode 100644 index 00000000..bf49882f --- /dev/null +++ b/dist/packages/fs-storage/types/partitioning-adapter/src/index.d.ts @@ -0,0 +1,3 @@ +import { PartitioningAdapter } from "./partitioning_adapter"; +export { PartitioningAdapter }; +export default PartitioningAdapter; diff --git a/dist/packages/fs-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts b/dist/packages/fs-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts index ff9568cf..45e14850 100644 --- a/dist/packages/fs-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts +++ b/dist/packages/fs-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts @@ -1,4 +1,5 @@ -import { ANY, StorageAdapter } from "../../common/types"; +import { Loki } from "../../loki/src/loki"; +import { StorageAdapter } from "../../common/types"; /** * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and @@ -9,7 +10,7 @@ import { ANY, StorageAdapter } from "../../common/types"; * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all * of that collection's pages will be written on next save. */ -export declare class LokiPartitioningAdapter implements StorageAdapter { +export declare class PartitioningAdapter implements StorageAdapter { mode: string; private _adapter; private _dbref; @@ -68,7 +69,7 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { * @returns {Promise} a Promise that resolves after the database was deleted * */ - exportDatabase(dbname: string, dbref: ANY): Promise; + exportDatabase(dbname: string, dbref: Loki): Promise; /** * Helper method used internally to save each dirty collection, one at a time. * @@ -82,11 +83,3 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { */ private _saveNextPage(); } -declare namespace LokiPartitioningAdapter { - interface PageIterator { - collection?: ANY; - docIndex?: number; - pageIndex?: number; - } -} -export default LokiPartitioningAdapter; diff --git a/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.js b/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.js index a1e6ec75..fec1971a 100644 --- a/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.js +++ b/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.js @@ -7,7 +7,7 @@ exports["@lokijs/full-text-search-language-de"] = factory(require("@lokijs/full-text-search"), require("@lokijs/full-text-search-language")); else { root["@lokijs/full-text-search-language-de"] = factory(root["@lokijs/full-text-search"], root["@lokijs/full-text-search-language"]); root["LokiFullTextSearchLanguageDe"] = root["@lokijs/full-text-search-language-de"].default;} -})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_2__) { +})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -79,9 +79,21 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__de__ = __webpack_require__(1); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "DE", function() { return __WEBPACK_IMPORTED_MODULE_0__de__["a"]; }); + + +/* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__de__["a" /* DE */]); + + +/***/ }), +/* 1 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__ = __webpack_require__(2); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__); /* * From MihaiValentin/lunr-languages. @@ -390,7 +402,7 @@ const trimmer = Object(__WEBPACK_IMPORTED_MODULE_1__full_text_search_language_sr const stopWordFilter = Object(__WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["generateStopWordFilter"])(["aber", "alle", "allem", "allen", "aller", "alles", "als", "also", "am", "an", "ander", "andere", "anderem", "anderen", "anderer", "anderes", "anderm", "andern", "anderr", "anders", "auch", "auf", "aus", "bei", "bin", "bis", "bist", "da", "damit", "dann", "das", "dasselbe", "dazu", "daß", "dein", "deine", "deinem", "deinen", "deiner", "deines", "dem", "demselben", "den", "denn", "denselben", "der", "derer", "derselbe", "derselben", "des", "desselben", "dessen", "dich", "die", "dies", "diese", "dieselbe", "dieselben", "diesem", "diesen", "dieser", "dieses", "dir", "doch", "dort", "du", "durch", "ein", "eine", "einem", "einen", "einer", "eines", "einig", "einige", "einigem", "einigen", "einiger", "einiges", "einmal", "er", "es", "etwas", "euch", "euer", "eure", "eurem", "euren", "eurer", "eures", "für", "gegen", "gewesen", "hab", "habe", "haben", "hat", "hatte", "hatten", "hier", "hin", "hinter", "ich", "ihm", "ihn", "ihnen", "ihr", "ihre", "ihrem", "ihren", "ihrer", "ihres", "im", "in", "indem", "ins", "ist", "jede", "jedem", "jeden", "jeder", "jedes", "jene", "jenem", "jenen", "jener", "jenes", "jetzt", "kann", "kein", "keine", "keinem", "keinen", "keiner", "keines", "können", "könnte", "machen", "man", "manche", "manchem", "manchen", "mancher", "manches", "mein", "meine", "meinem", "meinen", "meiner", "meines", "mich", "mir", "mit", "muss", "musste", "nach", "nicht", "nichts", "noch", "nun", "nur", "ob", "oder", "ohne", "sehr", "sein", "seine", "seinem", "seinen", "seiner", "seines", "selbst", "sich", "sie", "sind", "so", "solche", "solchem", "solchen", "solcher", "solches", "soll", "sollte", "sondern", "sonst", "um", "und", "uns", "unse", "unsem", "unsen", "unser", "unses", "unter", "viel", "vom", "von", "vor", "war", "waren", "warst", "was", "weg", "weil", "weiter", "welche", "welchem", "welchen", "welcher", "welches", "wenn", "werde", "werden", "wie", "wieder", "will", "wir", "wird", "wirst", "wo", "wollen", "wollte", "während", "würde", "würden", "zu", "zum", "zur", "zwar", "zwischen", "über"]); // Create, configure and export the tokenizer. const DE = new __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__["Tokenizer"](); -/* harmony export (immutable) */ __webpack_exports__["DE"] = DE; +/* harmony export (immutable) */ __webpack_exports__["a"] = DE; DE.setSplitter("whitespace-splitter", splitter); DE.add("trimmer-de", trimmer); @@ -399,16 +411,16 @@ DE.add("stopWordFilter-de", stopWordFilter); /***/ }), -/* 1 */ +/* 2 */ /***/ (function(module, exports) { -module.exports = __WEBPACK_EXTERNAL_MODULE_1__; +module.exports = __WEBPACK_EXTERNAL_MODULE_2__; /***/ }), -/* 2 */ +/* 3 */ /***/ (function(module, exports) { -module.exports = __WEBPACK_EXTERNAL_MODULE_2__; +module.exports = __WEBPACK_EXTERNAL_MODULE_3__; /***/ }) /******/ ]); diff --git a/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.js.map b/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.js.map index a059e598..ed3025f2 100644 --- a/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.js.map +++ b/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap e19bfa4d60b404c09003","webpack:///./packages/full-text-search-language-de/src/de.ts","webpack:///external \"@lokijs/full-text-search\"","webpack:///external \"@lokijs/full-text-search-language\""],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yC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ACtV5C,+C;;;;;;ACAA,+C","file":"lokijs.full-text-search-language-de.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@lokijs/full-text-search\"), require(\"@lokijs/full-text-search-language\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@lokijs/full-text-search\", \"@lokijs/full-text-search-language\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/full-text-search-language-de\"] = factory(require(\"@lokijs/full-text-search\"), require(\"@lokijs/full-text-search-language\"));\n\telse\n\t\troot[\"@lokijs/full-text-search-language-de\"] = factory(root[\"@lokijs/full-text-search\"], root[\"@lokijs/full-text-search-language\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_2__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e19bfa4d60b404c09003","/*\n * From MihaiValentin/lunr-languages.\n * Last update from 2017/04/16 - 19af41fb9bd644d9081ad274f96f700b21464290\n */\nimport {Tokenizer} from \"../../full-text-search/src/index\";\nimport {\n generateTrimmer,\n generateStopWordFilter,\n Among,\n SnowballProgram\n} from \"../../full-text-search-language/src/language\";\n\nclass GermanStemmer {\n public getCurrent: () => string;\n public setCurrent: (word: string) => void;\n public stem: () => void;\n\n constructor() {\n // Write everything in the constructor to reduce code size and increase performance.\n // The original implementation uses a ES5 anonymous function class.\n let a_0 = [new Among(\"\", -1, 6), new Among(\"U\", 0, 2),\n new Among(\"Y\", 0, 1), new Among(\"\\u00E4\", 0, 3),\n new Among(\"\\u00F6\", 0, 4), new Among(\"\\u00FC\", 0, 5)\n ];\n\n let a_1 = [\n new Among(\"e\", -1, 2), new Among(\"em\", -1, 1),\n new Among(\"en\", -1, 2), new Among(\"ern\", -1, 1),\n new Among(\"er\", -1, 1), new Among(\"s\", -1, 3),\n new Among(\"es\", 5, 2)\n ];\n\n let a_2 = [new Among(\"en\", -1, 1),\n new Among(\"er\", -1, 1), new Among(\"st\", -1, 2),\n new Among(\"est\", 2, 1)\n ];\n\n let a_3 = [new Among(\"ig\", -1, 1),\n new Among(\"lich\", -1, 1)\n ];\n\n let a_4 = [new Among(\"end\", -1, 1),\n new Among(\"ig\", -1, 2), new Among(\"ung\", -1, 1),\n new Among(\"lich\", -1, 3), new Among(\"isch\", -1, 2),\n new Among(\"ik\", -1, 2), new Among(\"heit\", -1, 3),\n new Among(\"keit\", -1, 4)\n ];\n\n let g_v = [17, 65, 16, 1, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 8, 0, 32, 8\n ];\n\n let g_s_ending = [117, 30, 5];\n\n let g_st_ending = [\n 117, 30, 4\n ];\n\n let I_x: number;\n let I_p2: number;\n let I_p1: number;\n let sbp = new SnowballProgram();\n\n this.setCurrent = (word: string) => {\n sbp.setCurrent(word);\n };\n this.getCurrent = () => sbp.getCurrent();\n\n function habr1(c1: string, c2: string, v_1: number) {\n if (sbp.eq_s(1, c1)) {\n sbp.ket = sbp.cursor;\n if (sbp.in_grouping(g_v, 97, 252)) {\n sbp.slice_from(c2);\n sbp.cursor = v_1;\n return true;\n }\n }\n return false;\n }\n\n function r_prelude() {\n let v_1 = sbp.cursor;\n let v_2;\n let v_3;\n let v_4;\n let v_5;\n while (true) {\n v_2 = sbp.cursor;\n sbp.bra = v_2;\n if (sbp.eq_s(1, \"\\u00DF\")) {\n sbp.ket = sbp.cursor;\n sbp.slice_from(\"ss\");\n } else {\n if (v_2 >= sbp.limit)\n break;\n sbp.cursor = v_2 + 1;\n }\n }\n sbp.cursor = v_1;\n while (true) {\n v_3 = sbp.cursor;\n while (true) {\n v_4 = sbp.cursor;\n if (sbp.in_grouping(g_v, 97, 252)) {\n v_5 = sbp.cursor;\n sbp.bra = v_5;\n if (habr1(\"u\", \"U\", v_4))\n break;\n sbp.cursor = v_5;\n if (habr1(\"y\", \"Y\", v_4))\n break;\n }\n if (v_4 >= sbp.limit) {\n sbp.cursor = v_3;\n return;\n }\n sbp.cursor = v_4 + 1;\n }\n }\n }\n\n function habr2() {\n while (!sbp.in_grouping(g_v, 97, 252)) {\n if (sbp.cursor >= sbp.limit)\n return true;\n sbp.cursor++;\n }\n while (!sbp.out_grouping(g_v, 97, 252)) {\n if (sbp.cursor >= sbp.limit)\n return true;\n sbp.cursor++;\n }\n return false;\n }\n\n function r_mark_regions() {\n I_p1 = sbp.limit;\n I_p2 = I_p1;\n let c = sbp.cursor + 3;\n if (0 <= c && c <= sbp.limit) {\n I_x = c;\n if (!habr2()) {\n I_p1 = sbp.cursor;\n if (I_p1 < I_x)\n I_p1 = I_x;\n if (!habr2())\n I_p2 = sbp.cursor;\n }\n }\n }\n\n function r_postlude() {\n let among_var;\n let v_1;\n while (true) {\n v_1 = sbp.cursor;\n sbp.bra = v_1;\n among_var = sbp.find_among(a_0, 6);\n if (!among_var)\n return;\n sbp.ket = sbp.cursor;\n switch (among_var) {\n case 1:\n sbp.slice_from(\"y\");\n break;\n case 2:\n case 5:\n sbp.slice_from(\"u\");\n break;\n case 3:\n sbp.slice_from(\"a\");\n break;\n case 4:\n sbp.slice_from(\"o\");\n break;\n case 6:\n if (sbp.cursor >= sbp.limit)\n return;\n sbp.cursor++;\n break;\n }\n }\n }\n\n function r_R1() {\n return I_p1 <= sbp.cursor;\n }\n\n function r_R2() {\n return I_p2 <= sbp.cursor;\n }\n\n function r_standard_suffix() {\n let among_var;\n let v_1 = sbp.limit - sbp.cursor;\n let v_2;\n let v_3;\n let v_4;\n sbp.ket = sbp.cursor;\n among_var = sbp.find_among_b(a_1, 7);\n if (among_var) {\n sbp.bra = sbp.cursor;\n if (r_R1()) {\n switch (among_var) {\n case 1:\n sbp.slice_del();\n break;\n case 2:\n sbp.slice_del();\n sbp.ket = sbp.cursor;\n if (sbp.eq_s_b(1, \"s\")) {\n sbp.bra = sbp.cursor;\n if (sbp.eq_s_b(3, \"nis\"))\n sbp.slice_del();\n }\n break;\n case 3:\n if (sbp.in_grouping_b(g_s_ending, 98, 116))\n sbp.slice_del();\n break;\n }\n }\n }\n sbp.cursor = sbp.limit - v_1;\n sbp.ket = sbp.cursor;\n among_var = sbp.find_among_b(a_2, 4);\n if (among_var) {\n sbp.bra = sbp.cursor;\n if (r_R1()) {\n switch (among_var) {\n case 1:\n sbp.slice_del();\n break;\n case 2:\n if (sbp.in_grouping_b(g_st_ending, 98, 116)) {\n let c = sbp.cursor - 3;\n if (sbp.limit_backward <= c && c <= sbp.limit) {\n sbp.cursor = c;\n sbp.slice_del();\n }\n }\n break;\n }\n }\n }\n sbp.cursor = sbp.limit - v_1;\n sbp.ket = sbp.cursor;\n among_var = sbp.find_among_b(a_4, 8);\n if (among_var) {\n sbp.bra = sbp.cursor;\n if (r_R2()) {\n switch (among_var) {\n case 1:\n sbp.slice_del();\n sbp.ket = sbp.cursor;\n if (sbp.eq_s_b(2, \"ig\")) {\n sbp.bra = sbp.cursor;\n v_2 = sbp.limit - sbp.cursor;\n if (!sbp.eq_s_b(1, \"e\")) {\n sbp.cursor = sbp.limit - v_2;\n if (r_R2())\n sbp.slice_del();\n }\n }\n break;\n case 2:\n v_3 = sbp.limit - sbp.cursor;\n if (!sbp.eq_s_b(1, \"e\")) {\n sbp.cursor = sbp.limit - v_3;\n sbp.slice_del();\n }\n break;\n case 3:\n sbp.slice_del();\n sbp.ket = sbp.cursor;\n v_4 = sbp.limit - sbp.cursor;\n if (!sbp.eq_s_b(2, \"er\")) {\n sbp.cursor = sbp.limit - v_4;\n if (!sbp.eq_s_b(2, \"en\"))\n break;\n }\n sbp.bra = sbp.cursor;\n if (r_R1())\n sbp.slice_del();\n break;\n case 4:\n sbp.slice_del();\n sbp.ket = sbp.cursor;\n among_var = sbp.find_among_b(a_3, 2);\n if (among_var) {\n sbp.bra = sbp.cursor;\n if (r_R2() && among_var === 1)\n sbp.slice_del();\n }\n break;\n }\n }\n }\n }\n\n this.stem = () => {\n let v_1 = sbp.cursor;\n r_prelude();\n sbp.cursor = v_1;\n r_mark_regions();\n sbp.limit_backward = v_1;\n sbp.cursor = sbp.limit;\n r_standard_suffix();\n sbp.cursor = sbp.limit_backward;\n r_postlude();\n };\n }\n}\n\n// Split at whitespace and dashes.\nfunction splitter(str: string) {\n let trimmedTokens = [];\n let tokens = str.split(/[\\s-]+/);\n for (let i = 0; i < tokens.length; i++) {\n if (tokens[i] !== \"\") {\n trimmedTokens.push(tokens[i].toLowerCase());\n }\n }\n return trimmedTokens;\n}\n\nconst st = new GermanStemmer();\n\nfunction stemmer(token: string) {\n st.setCurrent(token);\n st.stem();\n return st.getCurrent();\n}\n\nconst trimmer = generateTrimmer(\"A-Za-z\\xAA\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02B8\\u02E0-\\u02E4\\u1D00-\\u1D25\\u1D2C-\\u1D5C\\u1D62-\\u1D65\\u1D6B-\\u1D77\\u1D79-\\u1DBE\\u1E00-\\u1EFF\\u2071\\u207F\\u2090-\\u209C\\u212A\\u212B\\u2132\\u214E\\u2160-\\u2188\\u2C60-\\u2C7F\\uA722-\\uA787\\uA78B-\\uA7AD\\uA7B0-\\uA7B7\\uA7F7-\\uA7FF\\uAB30-\\uAB5A\\uAB5C-\\uAB64\\uFB00-\\uFB06\\uFF21-\\uFF3A\\uFF41-\\uFF5A\");\nconst stopWordFilter = generateStopWordFilter([\"aber\", \"alle\", \"allem\", \"allen\", \"aller\", \"alles\", \"als\", \"also\", \"am\", \"an\", \"ander\", \"andere\", \"anderem\", \"anderen\", \"anderer\", \"anderes\", \"anderm\", \"andern\", \"anderr\", \"anders\", \"auch\", \"auf\", \"aus\", \"bei\", \"bin\", \"bis\", \"bist\", \"da\", \"damit\", \"dann\", \"das\", \"dasselbe\", \"dazu\", \"daß\", \"dein\", \"deine\", \"deinem\", \"deinen\", \"deiner\", \"deines\", \"dem\", \"demselben\", \"den\", \"denn\", \"denselben\", \"der\", \"derer\", \"derselbe\", \"derselben\", \"des\", \"desselben\", \"dessen\", \"dich\", \"die\", \"dies\", \"diese\", \"dieselbe\", \"dieselben\", \"diesem\", \"diesen\", \"dieser\", \"dieses\", \"dir\", \"doch\", \"dort\", \"du\", \"durch\", \"ein\", \"eine\", \"einem\", \"einen\", \"einer\", \"eines\", \"einig\", \"einige\", \"einigem\", \"einigen\", \"einiger\", \"einiges\", \"einmal\", \"er\", \"es\", \"etwas\", \"euch\", \"euer\", \"eure\", \"eurem\", \"euren\", \"eurer\", \"eures\", \"für\", \"gegen\", \"gewesen\", \"hab\", \"habe\", \"haben\", \"hat\", \"hatte\", \"hatten\", \"hier\", \"hin\", \"hinter\", \"ich\", \"ihm\", \"ihn\", \"ihnen\", \"ihr\", \"ihre\", \"ihrem\", \"ihren\", \"ihrer\", \"ihres\", \"im\", \"in\", \"indem\", \"ins\", \"ist\", \"jede\", \"jedem\", \"jeden\", \"jeder\", \"jedes\", \"jene\", \"jenem\", \"jenen\", \"jener\", \"jenes\", \"jetzt\", \"kann\", \"kein\", \"keine\", \"keinem\", \"keinen\", \"keiner\", \"keines\", \"können\", \"könnte\", \"machen\", \"man\", \"manche\", \"manchem\", \"manchen\", \"mancher\", \"manches\", \"mein\", \"meine\", \"meinem\", \"meinen\", \"meiner\", \"meines\", \"mich\", \"mir\", \"mit\", \"muss\", \"musste\", \"nach\", \"nicht\", \"nichts\", \"noch\", \"nun\", \"nur\", \"ob\", \"oder\", \"ohne\", \"sehr\", \"sein\", \"seine\", \"seinem\", \"seinen\", \"seiner\", \"seines\", \"selbst\", \"sich\", \"sie\", \"sind\", \"so\", \"solche\", \"solchem\", \"solchen\", \"solcher\", \"solches\", \"soll\", \"sollte\", \"sondern\", \"sonst\", \"um\", \"und\", \"uns\", \"unse\", \"unsem\", \"unsen\", \"unser\", \"unses\", \"unter\", \"viel\", \"vom\", \"von\", \"vor\", \"war\", \"waren\", \"warst\", \"was\", \"weg\", \"weil\", \"weiter\", \"welche\", \"welchem\", \"welchen\", \"welcher\", \"welches\", \"wenn\", \"werde\", \"werden\", \"wie\", \"wieder\", \"will\", \"wir\", \"wird\", \"wirst\", \"wo\", \"wollen\", \"wollte\", \"während\", \"würde\", \"würden\", \"zu\", \"zum\", \"zur\", \"zwar\", \"zwischen\", \"über\"]);\n\n// Create, configure and export the tokenizer.\nexport const DE: Tokenizer = new Tokenizer();\nDE.setSplitter(\"whitespace-splitter\", splitter);\nDE.add(\"trimmer-de\", trimmer);\nDE.add(\"stemmer-de\", stemmer);\nDE.add(\"stopWordFilter-de\", stopWordFilter);\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search-language-de/src/de.ts","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@lokijs/full-text-search\"\n// module id = 1\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@lokijs/full-text-search-language\"\n// module id = 2\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 8da2aec50f08a40df906","webpack:///./packages/full-text-search-language-de/src/index.ts","webpack:///./packages/full-text-search-language-de/src/de.ts","webpack:///external \"@lokijs/full-text-search\"","webpack:///external \"@lokijs/full-text-search-language\""],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;AC7DwB;AACZ;AACZ,+DAAe,+CAAE,EAAC;;;;;;;;;;ACFlB;AAAA;AAAA;;;GAGG;AACwD;AAML;AAEtD;IAKE;QACE,oFAAoF;QACpF,mEAA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,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEliE,8CAA8C;AACvC,MAAM,EAAE,GAAc,IAAI,sEAAS,EAAE,CAAC;AAAA;AAAA;AAC7C,EAAE,CAAC,WAAW,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AAChD,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAC9B,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAC9B,EAAE,CAAC,GAAG,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;;;;;;;ACtV5C,+C;;;;;;ACAA,+C","file":"lokijs.full-text-search-language-de.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@lokijs/full-text-search\"), require(\"@lokijs/full-text-search-language\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@lokijs/full-text-search\", \"@lokijs/full-text-search-language\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/full-text-search-language-de\"] = factory(require(\"@lokijs/full-text-search\"), require(\"@lokijs/full-text-search-language\"));\n\telse\n\t\troot[\"@lokijs/full-text-search-language-de\"] = factory(root[\"@lokijs/full-text-search\"], root[\"@lokijs/full-text-search-language\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 8da2aec50f08a40df906","import {DE} from \"./de\";\nexport {DE};\nexport default DE;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search-language-de/src/index.ts","/*\n * From MihaiValentin/lunr-languages.\n * Last update from 2017/04/16 - 19af41fb9bd644d9081ad274f96f700b21464290\n */\nimport {Tokenizer} from \"../../full-text-search/src/index\";\nimport {\n generateTrimmer,\n generateStopWordFilter,\n Among,\n SnowballProgram\n} from \"../../full-text-search-language/src/language\";\n\nclass GermanStemmer {\n public getCurrent: () => string;\n public setCurrent: (word: string) => void;\n public stem: () => void;\n\n constructor() {\n // Write everything in the constructor to reduce code size and increase performance.\n // The original implementation uses a ES5 anonymous function class.\n let a_0 = [new Among(\"\", -1, 6), new Among(\"U\", 0, 2),\n new Among(\"Y\", 0, 1), new Among(\"\\u00E4\", 0, 3),\n new Among(\"\\u00F6\", 0, 4), new Among(\"\\u00FC\", 0, 5)\n ];\n\n let a_1 = [\n new Among(\"e\", -1, 2), new Among(\"em\", -1, 1),\n new Among(\"en\", -1, 2), new Among(\"ern\", -1, 1),\n new Among(\"er\", -1, 1), new Among(\"s\", -1, 3),\n new Among(\"es\", 5, 2)\n ];\n\n let a_2 = [new Among(\"en\", -1, 1),\n new Among(\"er\", -1, 1), new Among(\"st\", -1, 2),\n new Among(\"est\", 2, 1)\n ];\n\n let a_3 = [new Among(\"ig\", -1, 1),\n new Among(\"lich\", -1, 1)\n ];\n\n let a_4 = [new Among(\"end\", -1, 1),\n new Among(\"ig\", -1, 2), new Among(\"ung\", -1, 1),\n new Among(\"lich\", -1, 3), new Among(\"isch\", -1, 2),\n new Among(\"ik\", -1, 2), new Among(\"heit\", -1, 3),\n new Among(\"keit\", -1, 4)\n ];\n\n let g_v = [17, 65, 16, 1, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 8, 0, 32, 8\n ];\n\n let g_s_ending = [117, 30, 5];\n\n let g_st_ending = [\n 117, 30, 4\n ];\n\n let I_x: number;\n let I_p2: number;\n let I_p1: number;\n let sbp = new SnowballProgram();\n\n this.setCurrent = (word: string) => {\n sbp.setCurrent(word);\n };\n this.getCurrent = () => sbp.getCurrent();\n\n function habr1(c1: string, c2: string, v_1: number) {\n if (sbp.eq_s(1, c1)) {\n sbp.ket = sbp.cursor;\n if (sbp.in_grouping(g_v, 97, 252)) {\n sbp.slice_from(c2);\n sbp.cursor = v_1;\n return true;\n }\n }\n return false;\n }\n\n function r_prelude() {\n let v_1 = sbp.cursor;\n let v_2;\n let v_3;\n let v_4;\n let v_5;\n while (true) {\n v_2 = sbp.cursor;\n sbp.bra = v_2;\n if (sbp.eq_s(1, \"\\u00DF\")) {\n sbp.ket = sbp.cursor;\n sbp.slice_from(\"ss\");\n } else {\n if (v_2 >= sbp.limit)\n break;\n sbp.cursor = v_2 + 1;\n }\n }\n sbp.cursor = v_1;\n while (true) {\n v_3 = sbp.cursor;\n while (true) {\n v_4 = sbp.cursor;\n if (sbp.in_grouping(g_v, 97, 252)) {\n v_5 = sbp.cursor;\n sbp.bra = v_5;\n if (habr1(\"u\", \"U\", v_4))\n break;\n sbp.cursor = v_5;\n if (habr1(\"y\", \"Y\", v_4))\n break;\n }\n if (v_4 >= sbp.limit) {\n sbp.cursor = v_3;\n return;\n }\n sbp.cursor = v_4 + 1;\n }\n }\n }\n\n function habr2() {\n while (!sbp.in_grouping(g_v, 97, 252)) {\n if (sbp.cursor >= sbp.limit)\n return true;\n sbp.cursor++;\n }\n while (!sbp.out_grouping(g_v, 97, 252)) {\n if (sbp.cursor >= sbp.limit)\n return true;\n sbp.cursor++;\n }\n return false;\n }\n\n function r_mark_regions() {\n I_p1 = sbp.limit;\n I_p2 = I_p1;\n let c = sbp.cursor + 3;\n if (0 <= c && c <= sbp.limit) {\n I_x = c;\n if (!habr2()) {\n I_p1 = sbp.cursor;\n if (I_p1 < I_x)\n I_p1 = I_x;\n if (!habr2())\n I_p2 = sbp.cursor;\n }\n }\n }\n\n function r_postlude() {\n let among_var;\n let v_1;\n while (true) {\n v_1 = sbp.cursor;\n sbp.bra = v_1;\n among_var = sbp.find_among(a_0, 6);\n if (!among_var)\n return;\n sbp.ket = sbp.cursor;\n switch (among_var) {\n case 1:\n sbp.slice_from(\"y\");\n break;\n case 2:\n case 5:\n sbp.slice_from(\"u\");\n break;\n case 3:\n sbp.slice_from(\"a\");\n break;\n case 4:\n sbp.slice_from(\"o\");\n break;\n case 6:\n if (sbp.cursor >= sbp.limit)\n return;\n sbp.cursor++;\n break;\n }\n }\n }\n\n function r_R1() {\n return I_p1 <= sbp.cursor;\n }\n\n function r_R2() {\n return I_p2 <= sbp.cursor;\n }\n\n function r_standard_suffix() {\n let among_var;\n let v_1 = sbp.limit - sbp.cursor;\n let v_2;\n let v_3;\n let v_4;\n sbp.ket = sbp.cursor;\n among_var = sbp.find_among_b(a_1, 7);\n if (among_var) {\n sbp.bra = sbp.cursor;\n if (r_R1()) {\n switch (among_var) {\n case 1:\n sbp.slice_del();\n break;\n case 2:\n sbp.slice_del();\n sbp.ket = sbp.cursor;\n if (sbp.eq_s_b(1, \"s\")) {\n sbp.bra = sbp.cursor;\n if (sbp.eq_s_b(3, \"nis\"))\n sbp.slice_del();\n }\n break;\n case 3:\n if (sbp.in_grouping_b(g_s_ending, 98, 116))\n sbp.slice_del();\n break;\n }\n }\n }\n sbp.cursor = sbp.limit - v_1;\n sbp.ket = sbp.cursor;\n among_var = sbp.find_among_b(a_2, 4);\n if (among_var) {\n sbp.bra = sbp.cursor;\n if (r_R1()) {\n switch (among_var) {\n case 1:\n sbp.slice_del();\n break;\n case 2:\n if (sbp.in_grouping_b(g_st_ending, 98, 116)) {\n let c = sbp.cursor - 3;\n if (sbp.limit_backward <= c && c <= sbp.limit) {\n sbp.cursor = c;\n sbp.slice_del();\n }\n }\n break;\n }\n }\n }\n sbp.cursor = sbp.limit - v_1;\n sbp.ket = sbp.cursor;\n among_var = sbp.find_among_b(a_4, 8);\n if (among_var) {\n sbp.bra = sbp.cursor;\n if (r_R2()) {\n switch (among_var) {\n case 1:\n sbp.slice_del();\n sbp.ket = sbp.cursor;\n if (sbp.eq_s_b(2, \"ig\")) {\n sbp.bra = sbp.cursor;\n v_2 = sbp.limit - sbp.cursor;\n if (!sbp.eq_s_b(1, \"e\")) {\n sbp.cursor = sbp.limit - v_2;\n if (r_R2())\n sbp.slice_del();\n }\n }\n break;\n case 2:\n v_3 = sbp.limit - sbp.cursor;\n if (!sbp.eq_s_b(1, \"e\")) {\n sbp.cursor = sbp.limit - v_3;\n sbp.slice_del();\n }\n break;\n case 3:\n sbp.slice_del();\n sbp.ket = sbp.cursor;\n v_4 = sbp.limit - sbp.cursor;\n if (!sbp.eq_s_b(2, \"er\")) {\n sbp.cursor = sbp.limit - v_4;\n if (!sbp.eq_s_b(2, \"en\"))\n break;\n }\n sbp.bra = sbp.cursor;\n if (r_R1())\n sbp.slice_del();\n break;\n case 4:\n sbp.slice_del();\n sbp.ket = sbp.cursor;\n among_var = sbp.find_among_b(a_3, 2);\n if (among_var) {\n sbp.bra = sbp.cursor;\n if (r_R2() && among_var === 1)\n sbp.slice_del();\n }\n break;\n }\n }\n }\n }\n\n this.stem = () => {\n let v_1 = sbp.cursor;\n r_prelude();\n sbp.cursor = v_1;\n r_mark_regions();\n sbp.limit_backward = v_1;\n sbp.cursor = sbp.limit;\n r_standard_suffix();\n sbp.cursor = sbp.limit_backward;\n r_postlude();\n };\n }\n}\n\n// Split at whitespace and dashes.\nfunction splitter(str: string) {\n let trimmedTokens = [];\n let tokens = str.split(/[\\s-]+/);\n for (let i = 0; i < tokens.length; i++) {\n if (tokens[i] !== \"\") {\n trimmedTokens.push(tokens[i].toLowerCase());\n }\n }\n return trimmedTokens;\n}\n\nconst st = new GermanStemmer();\n\nfunction stemmer(token: string) {\n st.setCurrent(token);\n st.stem();\n return st.getCurrent();\n}\n\nconst trimmer = generateTrimmer(\"A-Za-z\\xAA\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02B8\\u02E0-\\u02E4\\u1D00-\\u1D25\\u1D2C-\\u1D5C\\u1D62-\\u1D65\\u1D6B-\\u1D77\\u1D79-\\u1DBE\\u1E00-\\u1EFF\\u2071\\u207F\\u2090-\\u209C\\u212A\\u212B\\u2132\\u214E\\u2160-\\u2188\\u2C60-\\u2C7F\\uA722-\\uA787\\uA78B-\\uA7AD\\uA7B0-\\uA7B7\\uA7F7-\\uA7FF\\uAB30-\\uAB5A\\uAB5C-\\uAB64\\uFB00-\\uFB06\\uFF21-\\uFF3A\\uFF41-\\uFF5A\");\nconst stopWordFilter = generateStopWordFilter([\"aber\", \"alle\", \"allem\", \"allen\", \"aller\", \"alles\", \"als\", \"also\", \"am\", \"an\", \"ander\", \"andere\", \"anderem\", \"anderen\", \"anderer\", \"anderes\", \"anderm\", \"andern\", \"anderr\", \"anders\", \"auch\", \"auf\", \"aus\", \"bei\", \"bin\", \"bis\", \"bist\", \"da\", \"damit\", \"dann\", \"das\", \"dasselbe\", \"dazu\", \"daß\", \"dein\", \"deine\", \"deinem\", \"deinen\", \"deiner\", \"deines\", \"dem\", \"demselben\", \"den\", \"denn\", \"denselben\", \"der\", \"derer\", \"derselbe\", \"derselben\", \"des\", \"desselben\", \"dessen\", \"dich\", \"die\", \"dies\", \"diese\", \"dieselbe\", \"dieselben\", \"diesem\", \"diesen\", \"dieser\", \"dieses\", \"dir\", \"doch\", \"dort\", \"du\", \"durch\", \"ein\", \"eine\", \"einem\", \"einen\", \"einer\", \"eines\", \"einig\", \"einige\", \"einigem\", \"einigen\", \"einiger\", \"einiges\", \"einmal\", \"er\", \"es\", \"etwas\", \"euch\", \"euer\", \"eure\", \"eurem\", \"euren\", \"eurer\", \"eures\", \"für\", \"gegen\", \"gewesen\", \"hab\", \"habe\", \"haben\", \"hat\", \"hatte\", \"hatten\", \"hier\", \"hin\", \"hinter\", \"ich\", \"ihm\", \"ihn\", \"ihnen\", \"ihr\", \"ihre\", \"ihrem\", \"ihren\", \"ihrer\", \"ihres\", \"im\", \"in\", \"indem\", \"ins\", \"ist\", \"jede\", \"jedem\", \"jeden\", \"jeder\", \"jedes\", \"jene\", \"jenem\", \"jenen\", \"jener\", \"jenes\", \"jetzt\", \"kann\", \"kein\", \"keine\", \"keinem\", \"keinen\", \"keiner\", \"keines\", \"können\", \"könnte\", \"machen\", \"man\", \"manche\", \"manchem\", \"manchen\", \"mancher\", \"manches\", \"mein\", \"meine\", \"meinem\", \"meinen\", \"meiner\", \"meines\", \"mich\", \"mir\", \"mit\", \"muss\", \"musste\", \"nach\", \"nicht\", \"nichts\", \"noch\", \"nun\", \"nur\", \"ob\", \"oder\", \"ohne\", \"sehr\", \"sein\", \"seine\", \"seinem\", \"seinen\", \"seiner\", \"seines\", \"selbst\", \"sich\", \"sie\", \"sind\", \"so\", \"solche\", \"solchem\", \"solchen\", \"solcher\", \"solches\", \"soll\", \"sollte\", \"sondern\", \"sonst\", \"um\", \"und\", \"uns\", \"unse\", \"unsem\", \"unsen\", \"unser\", \"unses\", \"unter\", \"viel\", \"vom\", \"von\", \"vor\", \"war\", \"waren\", \"warst\", \"was\", \"weg\", \"weil\", \"weiter\", \"welche\", \"welchem\", \"welchen\", \"welcher\", \"welches\", \"wenn\", \"werde\", \"werden\", \"wie\", \"wieder\", \"will\", \"wir\", \"wird\", \"wirst\", \"wo\", \"wollen\", \"wollte\", \"während\", \"würde\", \"würden\", \"zu\", \"zum\", \"zur\", \"zwar\", \"zwischen\", \"über\"]);\n\n// Create, configure and export the tokenizer.\nexport const DE: Tokenizer = new Tokenizer();\nDE.setSplitter(\"whitespace-splitter\", splitter);\nDE.add(\"trimmer-de\", trimmer);\nDE.add(\"stemmer-de\", stemmer);\nDE.add(\"stopWordFilter-de\", stopWordFilter);\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search-language-de/src/de.ts","module.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@lokijs/full-text-search\"\n// module id = 2\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@lokijs/full-text-search-language\"\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.min.js b/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.min.js index 7113f25f..b5298b4b 100644 --- a/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.min.js +++ b/dist/packages/full-text-search-language-de/lokijs.full-text-search-language-de.min.js @@ -1 +1 @@ -(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory(require("@lokijs/full-text-search"),require("@lokijs/full-text-search-language"));else if(typeof define==="function"&&define.amd)define(["@lokijs/full-text-search","@lokijs/full-text-search-language"],factory);else if(typeof exports==="object")exports["@lokijs/full-text-search-language-de"]=factory(require("@lokijs/full-text-search"),require("@lokijs/full-text-search-language"));else{root["@lokijs/full-text-search-language-de"]=factory(root["@lokijs/full-text-search"],root["@lokijs/full-text-search-language"]);root["LokiFullTextSearchLanguageDe"]=root["@lokijs/full-text-search-language-de"].default}})(typeof self!=="undefined"?self:this,function(__WEBPACK_EXTERNAL_MODULE_1__,__WEBPACK_EXTERNAL_MODULE_2__){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__=__webpack_require__(1);var __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__);var __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__=__webpack_require__(2);var __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__);class GermanStemmer{constructor(){let a_0=[new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("",-1,6),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("U",0,2),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("Y",0,1),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("ä",0,3),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("ö",0,4),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("ü",0,5)];let a_1=[new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("e",-1,2),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("em",-1,1),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("en",-1,2),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("ern",-1,1),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("er",-1,1),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("s",-1,3),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("es",5,2)];let a_2=[new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("en",-1,1),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("er",-1,1),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("st",-1,2),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("est",2,1)];let a_3=[new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("ig",-1,1),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("lich",-1,1)];let a_4=[new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("end",-1,1),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("ig",-1,2),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("ung",-1,1),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("lich",-1,3),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("isch",-1,2),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("ik",-1,2),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("heit",-1,3),new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["Among"]("keit",-1,4)];let g_v=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,8,0,32,8];let g_s_ending=[117,30,5];let g_st_ending=[117,30,4];let I_x;let I_p2;let I_p1;let sbp=new __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["SnowballProgram"];this.setCurrent=(word=>{sbp.setCurrent(word)});this.getCurrent=(()=>sbp.getCurrent());function habr1(c1,c2,v_1){if(sbp.eq_s(1,c1)){sbp.ket=sbp.cursor;if(sbp.in_grouping(g_v,97,252)){sbp.slice_from(c2);sbp.cursor=v_1;return true}}return false}function r_prelude(){let v_1=sbp.cursor;let v_2;let v_3;let v_4;let v_5;while(true){v_2=sbp.cursor;sbp.bra=v_2;if(sbp.eq_s(1,"ß")){sbp.ket=sbp.cursor;sbp.slice_from("ss")}else{if(v_2>=sbp.limit)break;sbp.cursor=v_2+1}}sbp.cursor=v_1;while(true){v_3=sbp.cursor;while(true){v_4=sbp.cursor;if(sbp.in_grouping(g_v,97,252)){v_5=sbp.cursor;sbp.bra=v_5;if(habr1("u","U",v_4))break;sbp.cursor=v_5;if(habr1("y","Y",v_4))break}if(v_4>=sbp.limit){sbp.cursor=v_3;return}sbp.cursor=v_4+1}}}function habr2(){while(!sbp.in_grouping(g_v,97,252)){if(sbp.cursor>=sbp.limit)return true;sbp.cursor++}while(!sbp.out_grouping(g_v,97,252)){if(sbp.cursor>=sbp.limit)return true;sbp.cursor++}return false}function r_mark_regions(){I_p1=sbp.limit;I_p2=I_p1;let c=sbp.cursor+3;if(0<=c&&c<=sbp.limit){I_x=c;if(!habr2()){I_p1=sbp.cursor;if(I_p1=sbp.limit)return;sbp.cursor++;break}}}function r_R1(){return I_p1<=sbp.cursor}function r_R2(){return I_p2<=sbp.cursor}function r_standard_suffix(){let among_var;let v_1=sbp.limit-sbp.cursor;let v_2;let v_3;let v_4;sbp.ket=sbp.cursor;among_var=sbp.find_among_b(a_1,7);if(among_var){sbp.bra=sbp.cursor;if(r_R1()){switch(among_var){case 1:sbp.slice_del();break;case 2:sbp.slice_del();sbp.ket=sbp.cursor;if(sbp.eq_s_b(1,"s")){sbp.bra=sbp.cursor;if(sbp.eq_s_b(3,"nis"))sbp.slice_del()}break;case 3:if(sbp.in_grouping_b(g_s_ending,98,116))sbp.slice_del();break}}}sbp.cursor=sbp.limit-v_1;sbp.ket=sbp.cursor;among_var=sbp.find_among_b(a_2,4);if(among_var){sbp.bra=sbp.cursor;if(r_R1()){switch(among_var){case 1:sbp.slice_del();break;case 2:if(sbp.in_grouping_b(g_st_ending,98,116)){let c=sbp.cursor-3;if(sbp.limit_backward<=c&&c<=sbp.limit){sbp.cursor=c;sbp.slice_del()}}break}}}sbp.cursor=sbp.limit-v_1;sbp.ket=sbp.cursor;among_var=sbp.find_among_b(a_4,8);if(among_var){sbp.bra=sbp.cursor;if(r_R2()){switch(among_var){case 1:sbp.slice_del();sbp.ket=sbp.cursor;if(sbp.eq_s_b(2,"ig")){sbp.bra=sbp.cursor;v_2=sbp.limit-sbp.cursor;if(!sbp.eq_s_b(1,"e")){sbp.cursor=sbp.limit-v_2;if(r_R2())sbp.slice_del()}}break;case 2:v_3=sbp.limit-sbp.cursor;if(!sbp.eq_s_b(1,"e")){sbp.cursor=sbp.limit-v_3;sbp.slice_del()}break;case 3:sbp.slice_del();sbp.ket=sbp.cursor;v_4=sbp.limit-sbp.cursor;if(!sbp.eq_s_b(2,"er")){sbp.cursor=sbp.limit-v_4;if(!sbp.eq_s_b(2,"en"))break}sbp.bra=sbp.cursor;if(r_R1())sbp.slice_del();break;case 4:sbp.slice_del();sbp.ket=sbp.cursor;among_var=sbp.find_among_b(a_3,2);if(among_var){sbp.bra=sbp.cursor;if(r_R2()&&among_var===1)sbp.slice_del()}break}}}}this.stem=(()=>{let v_1=sbp.cursor;r_prelude();sbp.cursor=v_1;r_mark_regions();sbp.limit_backward=v_1;sbp.cursor=sbp.limit;r_standard_suffix();sbp.cursor=sbp.limit_backward;r_postlude()})}}function splitter(str){let trimmedTokens=[];let tokens=str.split(/[\s-]+/);for(let i=0;i{sbp.setCurrent(word)});this.getCurrent=(()=>sbp.getCurrent());function habr1(c1,c2,v_1){if(sbp.eq_s(1,c1)){sbp.ket=sbp.cursor;if(sbp.in_grouping(g_v,97,252)){sbp.slice_from(c2);sbp.cursor=v_1;return true}}return false}function r_prelude(){let v_1=sbp.cursor;let v_2;let v_3;let v_4;let v_5;while(true){v_2=sbp.cursor;sbp.bra=v_2;if(sbp.eq_s(1,"ß")){sbp.ket=sbp.cursor;sbp.slice_from("ss")}else{if(v_2>=sbp.limit)break;sbp.cursor=v_2+1}}sbp.cursor=v_1;while(true){v_3=sbp.cursor;while(true){v_4=sbp.cursor;if(sbp.in_grouping(g_v,97,252)){v_5=sbp.cursor;sbp.bra=v_5;if(habr1("u","U",v_4))break;sbp.cursor=v_5;if(habr1("y","Y",v_4))break}if(v_4>=sbp.limit){sbp.cursor=v_3;return}sbp.cursor=v_4+1}}}function habr2(){while(!sbp.in_grouping(g_v,97,252)){if(sbp.cursor>=sbp.limit)return true;sbp.cursor++}while(!sbp.out_grouping(g_v,97,252)){if(sbp.cursor>=sbp.limit)return true;sbp.cursor++}return false}function r_mark_regions(){I_p1=sbp.limit;I_p2=I_p1;let c=sbp.cursor+3;if(0<=c&&c<=sbp.limit){I_x=c;if(!habr2()){I_p1=sbp.cursor;if(I_p1=sbp.limit)return;sbp.cursor++;break}}}function r_R1(){return I_p1<=sbp.cursor}function r_R2(){return I_p2<=sbp.cursor}function r_standard_suffix(){let among_var;let v_1=sbp.limit-sbp.cursor;let v_2;let v_3;let v_4;sbp.ket=sbp.cursor;among_var=sbp.find_among_b(a_1,7);if(among_var){sbp.bra=sbp.cursor;if(r_R1()){switch(among_var){case 1:sbp.slice_del();break;case 2:sbp.slice_del();sbp.ket=sbp.cursor;if(sbp.eq_s_b(1,"s")){sbp.bra=sbp.cursor;if(sbp.eq_s_b(3,"nis"))sbp.slice_del()}break;case 3:if(sbp.in_grouping_b(g_s_ending,98,116))sbp.slice_del();break}}}sbp.cursor=sbp.limit-v_1;sbp.ket=sbp.cursor;among_var=sbp.find_among_b(a_2,4);if(among_var){sbp.bra=sbp.cursor;if(r_R1()){switch(among_var){case 1:sbp.slice_del();break;case 2:if(sbp.in_grouping_b(g_st_ending,98,116)){let c=sbp.cursor-3;if(sbp.limit_backward<=c&&c<=sbp.limit){sbp.cursor=c;sbp.slice_del()}}break}}}sbp.cursor=sbp.limit-v_1;sbp.ket=sbp.cursor;among_var=sbp.find_among_b(a_4,8);if(among_var){sbp.bra=sbp.cursor;if(r_R2()){switch(among_var){case 1:sbp.slice_del();sbp.ket=sbp.cursor;if(sbp.eq_s_b(2,"ig")){sbp.bra=sbp.cursor;v_2=sbp.limit-sbp.cursor;if(!sbp.eq_s_b(1,"e")){sbp.cursor=sbp.limit-v_2;if(r_R2())sbp.slice_del()}}break;case 2:v_3=sbp.limit-sbp.cursor;if(!sbp.eq_s_b(1,"e")){sbp.cursor=sbp.limit-v_3;sbp.slice_del()}break;case 3:sbp.slice_del();sbp.ket=sbp.cursor;v_4=sbp.limit-sbp.cursor;if(!sbp.eq_s_b(2,"er")){sbp.cursor=sbp.limit-v_4;if(!sbp.eq_s_b(2,"en"))break}sbp.bra=sbp.cursor;if(r_R1())sbp.slice_del();break;case 4:sbp.slice_del();sbp.ket=sbp.cursor;among_var=sbp.find_among_b(a_3,2);if(among_var){sbp.bra=sbp.cursor;if(r_R2()&&among_var===1)sbp.slice_del()}break}}}}this.stem=(()=>{let v_1=sbp.cursor;r_prelude();sbp.cursor=v_1;r_mark_regions();sbp.limit_backward=v_1;sbp.cursor=sbp.limit;r_standard_suffix();sbp.cursor=sbp.limit_backward;r_postlude()})}}function splitter(str){let trimmedTokens=[];let tokens=str.split(/[\s-]+/);for(let i=0;i; saveDatabase?(dbname: string, serialization: string): Promise; deleteDatabase?(dbname: string): Promise; mode?: string; - exportDatabase?(dbname: string, dbref: ANY): Promise; + exportDatabase?(dbname: string, dbref: Loki): Promise; } export declare type Doc = T & { $loki: number; @@ -14,10 +17,3 @@ export interface Dict { [index: string]: T; [index: number]: T; } -export interface Query { -} -export interface Filter { - type: string; - val: Query | ((obj: E, index: number, array: E[]) => boolean); - uid: number | string; -} diff --git a/dist/packages/full-text-search-language-de/types/fs-storage/src/fs_storage.d.ts b/dist/packages/full-text-search-language-de/types/fs-storage/src/fs_storage.d.ts index a92567ea..9930c0d0 100644 --- a/dist/packages/full-text-search-language-de/types/fs-storage/src/fs_storage.d.ts +++ b/dist/packages/full-text-search-language-de/types/fs-storage/src/fs_storage.d.ts @@ -2,7 +2,7 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists using node fs module. */ -export declare class LokiFSStorage implements StorageAdapter { +export declare class FSStorage implements StorageAdapter { /** * Registers the fs storage as plugin. */ @@ -32,4 +32,3 @@ export declare class LokiFSStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiFSStorage; diff --git a/dist/packages/full-text-search-language-de/types/fs-storage/src/index.d.ts b/dist/packages/full-text-search-language-de/types/fs-storage/src/index.d.ts new file mode 100644 index 00000000..e6b33d6c --- /dev/null +++ b/dist/packages/full-text-search-language-de/types/fs-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { FSStorage } from "./fs_storage"; +export { FSStorage }; +export default FSStorage; diff --git a/dist/packages/full-text-search-language-de/types/full-text-search-language-de/src/index.d.ts b/dist/packages/full-text-search-language-de/types/full-text-search-language-de/src/index.d.ts new file mode 100644 index 00000000..a2665427 --- /dev/null +++ b/dist/packages/full-text-search-language-de/types/full-text-search-language-de/src/index.d.ts @@ -0,0 +1,3 @@ +import { DE } from "./de"; +export { DE }; +export default DE; diff --git a/dist/packages/full-text-search-language-de/types/full-text-search-language-en/src/index.d.ts b/dist/packages/full-text-search-language-de/types/full-text-search-language-en/src/index.d.ts new file mode 100644 index 00000000..8313cf98 --- /dev/null +++ b/dist/packages/full-text-search-language-de/types/full-text-search-language-en/src/index.d.ts @@ -0,0 +1,3 @@ +import { EN } from "./en"; +export { EN }; +export default EN; diff --git a/dist/packages/full-text-search-language-de/types/full-text-search-language/src/index.d.ts b/dist/packages/full-text-search-language-de/types/full-text-search-language/src/index.d.ts new file mode 100644 index 00000000..e52d1a42 --- /dev/null +++ b/dist/packages/full-text-search-language-de/types/full-text-search-language/src/index.d.ts @@ -0,0 +1 @@ +export { generateStopWordFilter, generateTrimmer, Among, SnowballProgram } from "./language"; diff --git a/dist/packages/full-text-search-language-de/types/full-text-search/src/full_text_search.d.ts b/dist/packages/full-text-search-language-de/types/full-text-search/src/full_text_search.d.ts index a4752c88..65a26bef 100644 --- a/dist/packages/full-text-search-language-de/types/full-text-search/src/full_text_search.d.ts +++ b/dist/packages/full-text-search-language-de/types/full-text-search/src/full_text_search.d.ts @@ -2,7 +2,7 @@ import { InvertedIndex } from "./inverted_index"; import { Tokenizer } from "./tokenizer"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; export declare class FullTextSearch { private _id; private _docs; @@ -21,14 +21,14 @@ export declare class FullTextSearch { * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized * (requires more memory but performs better) * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field - * @param {string=$loki} id - the property name of the document index + * @param {string} [id] - the property name of the document index */ constructor(fields?: FullTextSearch.FieldOptions[], id?: string); addDocument(doc: object, id?: number): void; removeDocument(doc: object, id?: number): void; updateDocument(doc: object, id?: number): void; clear(): void; - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; toJSON(): FullTextSearch.Serialization; static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers?: Dict): FullTextSearch; } diff --git a/dist/packages/full-text-search-language-de/types/full-text-search/src/index.d.ts b/dist/packages/full-text-search-language-de/types/full-text-search/src/index.d.ts index f03dde09..b901b108 100644 --- a/dist/packages/full-text-search-language-de/types/full-text-search/src/index.d.ts +++ b/dist/packages/full-text-search-language-de/types/full-text-search/src/index.d.ts @@ -1,6 +1,5 @@ import { FullTextSearch } from "./full_text_search"; -export { Tokenizer } from "./tokenizer"; -export { QueryBuilder } from "./query_builder"; -export { InvertedIndex } from "./inverted_index"; -export { FullTextSearch }; +import { Tokenizer } from "./tokenizer"; +import { QueryBuilder } from "./query_builder"; +export { FullTextSearch, Tokenizer, QueryBuilder }; export default FullTextSearch; diff --git a/dist/packages/full-text-search-language-de/types/full-text-search/src/index_searcher.d.ts b/dist/packages/full-text-search-language-de/types/full-text-search/src/index_searcher.d.ts index d3cf7f93..00b99f2f 100644 --- a/dist/packages/full-text-search-language-de/types/full-text-search/src/index_searcher.d.ts +++ b/dist/packages/full-text-search-language-de/types/full-text-search/src/index_searcher.d.ts @@ -1,4 +1,4 @@ -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; import { InvertedIndex } from "./inverted_index"; import { Query } from "./query_builder"; import { Dict } from "../../common/types"; @@ -13,9 +13,9 @@ export declare class IndexSearcher { * @param {object} invIdxs */ constructor(invIdxs: Dict, docs: Set); - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; setDirty(): void; private _recursive(query, doScoring); - private _getUnique(queries, doScoring, docResults); + private _getUnique(queries, doScoring, queryResults); private _getAll(queries, doScoring); } diff --git a/dist/packages/full-text-search-language-de/types/full-text-search/src/query_builder.d.ts b/dist/packages/full-text-search-language-de/types/full-text-search/src/query_builder.d.ts index 923317f6..6f324e15 100644 --- a/dist/packages/full-text-search-language-de/types/full-text-search/src/query_builder.d.ts +++ b/dist/packages/full-text-search-language-de/types/full-text-search/src/query_builder.d.ts @@ -24,8 +24,8 @@ export declare class BaseQueryBuilder { */ build(): any; } -export interface BaseQuery { - type: string; +export interface BaseQuery { + type: Type; boost?: number; } /** @@ -51,7 +51,7 @@ export declare class TermQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, term: string, data?: any); } -export interface TermQuery extends BaseQuery { +export interface TermQuery extends BaseQuery<"term"> { field: string; value: string; } @@ -78,7 +78,7 @@ export declare class TermsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, terms: Array, data?: any); } -export interface TermsQuery extends BaseQuery { +export interface TermsQuery extends BaseQuery<"terms"> { field: string; value: string[]; } @@ -119,7 +119,7 @@ export declare class WildcardQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface WildcardQuery extends BaseQuery { +export interface WildcardQuery extends BaseQuery<"wildcard"> { field: string; value: string; enable_scoring?: boolean; @@ -169,7 +169,7 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { * * @return {FuzzyQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the initial word length. * @param {number} prefixLength - the positive prefix length @@ -183,10 +183,10 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface FuzzyQuery extends BaseQuery { +export interface FuzzyQuery extends BaseQuery<"fuzzy"> { field: string; value: string; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -221,7 +221,7 @@ export declare class PrefixQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface PrefixQuery extends BaseQuery { +export interface PrefixQuery extends BaseQuery<"prefix"> { field: string; value: string; enable_scoring?: boolean; @@ -247,7 +247,7 @@ export declare class ExistsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, data?: any); } -export interface ExistsQuery extends BaseQuery { +export interface ExistsQuery extends BaseQuery<"exists"> { field: string; } /** @@ -315,7 +315,7 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { * * @return {MatchQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the starting word length which should not be considered for fuzziness. * @param {number} prefixLength - the positive prefix length @@ -329,12 +329,12 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface MatchQuery extends BaseQuery { +export interface MatchQuery extends BaseQuery<"match"> { field: string; value: string; minimum_should_match?: number; operator?: "and" | "or"; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -360,7 +360,7 @@ export interface MatchQuery extends BaseQuery { export declare class MatchAllQueryBuilder extends BaseQueryBuilder { constructor(data?: any); } -export interface MatchQueryAll extends BaseQuery { +export interface MatchQueryAll extends BaseQuery<"match_all"> { } /** * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter. @@ -388,9 +388,11 @@ export declare class ConstantScoreQueryBuilder extends BaseQueryBuilder { * Starts an array of queries. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): ConstantScoreQueryBuilder; + }; } -export interface ConstantScoreQuery extends BaseQuery { +export interface ConstantScoreQuery extends BaseQuery<"constant_score"> { filter: ArrayQuery; } /** @@ -442,22 +444,30 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { * Starts an array of queries for must clause. Use endMust() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginMust(): ArrayQueryBuilder; + beginMust(): ArrayQueryBuilder & { + endMust(): BoolQueryBuilder; + }; /** * Starts an array of queries for filter clause. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): BoolQueryBuilder; + }; /** * Starts an array of queries for should clause. Use endShould() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginShould(): ArrayQueryBuilder; + beginShould(): ArrayQueryBuilder & { + endShould(): BoolQueryBuilder; + }; /** * Starts an array of queries for not clause. Use endNot() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginNot(): ArrayQueryBuilder; + beginNot(): ArrayQueryBuilder & { + endNot(): BoolQueryBuilder; + }; /** * Controls the amount of minimum matching sub queries before a document will be considered. * @param {number} minShouldMatch - number of minimum matching sub queries @@ -472,7 +482,7 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { */ minimumShouldMatch(minShouldMatch: number): this; } -export interface BoolQuery extends BaseQuery { +export interface BoolQuery extends BaseQuery<"bool"> { must?: ArrayQuery; filter?: ArrayQuery; should?: ArrayQuery; @@ -497,8 +507,8 @@ export declare class ArrayQueryBuilder extends BaseQueryBuilder { prefix(field: string, prefix: string): any; exists(field: string): any; } -export interface ArrayQuery { - values: any[]; +export interface ArrayQuery extends BaseQuery<"array"> { + values: QueryTypes[]; } /** * This query builder is the root of each query search. @@ -525,9 +535,15 @@ export declare class QueryBuilder { /** * The query performs a final scoring over all scored sub queries. * @param {boolean} enable - flag to enable or disable final scoring - * @return {QueryBuilder} + * @return {this} */ enableFinalScoring(enable: boolean): this; + /** + * Adds an explanation of the scoring of each document for all matched terms. + * @param {boolean} enable -flag to enable or disable explanation + * @returns {this} + */ + explain(enable: boolean): this; /** * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model. * @@ -535,10 +551,10 @@ export declare class QueryBuilder { * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}. * * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation. - * Lower values result in quicker saturation, and higher values in slower saturation. + * Lower values result in quicker saturation, and higher values in slower saturation * @param {number} [b=0.75] - controls how much effect field-length normalization should have. - * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully. - * @return {QueryBuilder} + * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully + * @return {this} */ BM25Similarity(k1?: number, b?: number): this; bool(): BoolQueryBuilder; @@ -553,9 +569,11 @@ export declare class QueryBuilder { exists(field: string): ExistsQueryBuilder; private _prepare(queryType, ...args); } +export declare type QueryTypes = BoolQuery | ConstantScoreQuery | TermQuery | TermsQuery | WildcardQuery | FuzzyQuery | MatchQuery | MatchQueryAll | PrefixQuery | ExistsQuery; export interface Query { - query: any; + query: QueryTypes; final_scoring?: boolean; + explain?: boolean; bm25?: { k1: number; b: number; diff --git a/dist/packages/full-text-search-language-de/types/full-text-search/src/scorer.d.ts b/dist/packages/full-text-search-language-de/types/full-text-search/src/scorer.d.ts index aed3e619..dacdc753 100644 --- a/dist/packages/full-text-search-language-de/types/full-text-search/src/scorer.d.ts +++ b/dist/packages/full-text-search-language-de/types/full-text-search/src/scorer.d.ts @@ -1,7 +1,6 @@ import { InvertedIndex } from "./inverted_index"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -export declare type ScoreResult = Dict; /** * @hidden */ @@ -10,9 +9,9 @@ export declare class Scorer { private _cache; constructor(invIdxs: Dict); setDirty(): void; - score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, docResults: Scorer.DocResults, term: number[]): void; - scoreConstant(boost: number, docId: number, docResults: Scorer.DocResults): Map; - finalScore(query: Query, docResults: Scorer.DocResults): ScoreResult; + score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, queryResults: Scorer.QueryResults, term: number[]): void; + scoreConstant(boost: number, docId: number, queryResults: Scorer.QueryResults): Map; + finalScore(query: Query, queryResults: Scorer.QueryResults): Scorer.ScoreResult; private static _calculateFieldLength(fieldLength); private _getCache(fieldName); /** @@ -30,12 +29,33 @@ export declare namespace Scorer { idfs: Dict; avgFieldLength: number; } - interface DocResult { + interface QueryResult { tf?: number; idf?: number; boost: number; fieldName?: string; term?: number[]; } - type DocResults = Map; + type QueryResults = Map; + interface BM25Explanation { + boost: number; + score: number; + docID: number; + fieldName: string; + index: string; + idf: number; + tfNorm: number; + tf: number; + fieldLength: number; + avgFieldLength: number; + } + interface ConstantExplanation { + boost: number; + score: number; + } + type ScoreExplanation = BM25Explanation | ConstantExplanation; + type ScoreResult = Dict<{ + score: number; + explanation?: ScoreExplanation[]; + }>; } diff --git a/dist/packages/full-text-search-language-de/types/indexed-storage/src/index.d.ts b/dist/packages/full-text-search-language-de/types/indexed-storage/src/index.d.ts new file mode 100644 index 00000000..bf453632 --- /dev/null +++ b/dist/packages/full-text-search-language-de/types/indexed-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { IndexedStorage } from "./indexed_storage"; +export { IndexedStorage }; +export default IndexedStorage; diff --git a/dist/packages/full-text-search-language-de/types/indexed-storage/src/indexed_storage.d.ts b/dist/packages/full-text-search-language-de/types/indexed-storage/src/indexed_storage.d.ts index 457b01a0..adaeaef1 100644 --- a/dist/packages/full-text-search-language-de/types/indexed-storage/src/indexed_storage.d.ts +++ b/dist/packages/full-text-search-language-de/types/indexed-storage/src/indexed_storage.d.ts @@ -6,7 +6,7 @@ import { StorageAdapter } from "../../common/types"; * IndexedDb storage is provided per-domain, so we implement app/key/value database to * allow separate contexts for separate apps within a domain. */ -export declare class LokiIndexedStorage implements StorageAdapter { +export declare class IndexedStorage implements StorageAdapter { private _appname; private catalog; /** @@ -98,4 +98,4 @@ export interface Entry { key: string; size: number; } -export default LokiIndexedStorage; +export default IndexedStorage; diff --git a/dist/packages/full-text-search-language-de/types/local-storage/src/index.d.ts b/dist/packages/full-text-search-language-de/types/local-storage/src/index.d.ts new file mode 100644 index 00000000..2b74e8c0 --- /dev/null +++ b/dist/packages/full-text-search-language-de/types/local-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { LocalStorage } from "./local_storage"; +export { LocalStorage }; +export default LocalStorage; diff --git a/dist/packages/full-text-search-language-de/types/local-storage/src/local_storage.d.ts b/dist/packages/full-text-search-language-de/types/local-storage/src/local_storage.d.ts index 2337eb12..380d8be9 100644 --- a/dist/packages/full-text-search-language-de/types/local-storage/src/local_storage.d.ts +++ b/dist/packages/full-text-search-language-de/types/local-storage/src/local_storage.d.ts @@ -1,9 +1,9 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists to web browser's local storage object - * @constructor LokiLocalStorageAdapter + * @constructor LocalStorageAdapter */ -export declare class LokiLocalStorage implements StorageAdapter { +export declare class LocalStorage implements StorageAdapter { /** * Registers the local storage as plugin. */ @@ -33,4 +33,4 @@ export declare class LokiLocalStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiLocalStorage; +export default LocalStorage; diff --git a/dist/packages/full-text-search-language-de/types/loki/src/clone.d.ts b/dist/packages/full-text-search-language-de/types/loki/src/clone.d.ts index 03b650d7..c74a17bd 100644 --- a/dist/packages/full-text-search-language-de/types/loki/src/clone.d.ts +++ b/dist/packages/full-text-search-language-de/types/loki/src/clone.d.ts @@ -1,10 +1,4 @@ -export declare enum CloneMethod { - PARSE_STRINGIFY = 0, - DEEP = 1, - SHALLOW = 2, - SHALLOW_ASSIGN = 3, - SHALLOW_RECURSE_OBJECTS = 4, -} +export declare type CloneMethod = "parse-stringify" | "deep" | "shallow" | "shallow-recurse-objects"; /** * @hidden */ diff --git a/dist/packages/full-text-search-language-de/types/loki/src/collection.d.ts b/dist/packages/full-text-search-language-de/types/loki/src/collection.d.ts index 8b44c82f..9bd5e091 100644 --- a/dist/packages/full-text-search-language-de/types/loki/src/collection.d.ts +++ b/dist/packages/full-text-search-language-de/types/loki/src/collection.d.ts @@ -1,34 +1,39 @@ import { LokiEventEmitter } from "./event_emitter"; import { UniqueIndex } from "./unique_index"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { DynamicView } from "./dynamic_view"; import { CloneMethod } from "./clone"; -import { Doc, Dict, Query } from "../../common/types"; +import { Doc, Dict } from "../../common/types"; import { FullTextSearch } from "../../full-text-search/src/full_text_search"; import { Tokenizer } from "../../full-text-search/src/tokenizer"; -export declare type ANY = any; export { CloneMethod } from "./clone"; /** * Collection class that handles documents of same type * @extends LokiEventEmitter + * @param - the data type + * @param - nested properties of data type */ -export declare class Collection extends LokiEventEmitter { +export declare class Collection extends LokiEventEmitter { name: string; - data: Doc[]; + _data: Doc[]; private idIndex; - binaryIndices: Dict; + binaryIndices: { + [P in keyof TData]?: Collection.BinaryIndex; + }; /** - * Unique contraints contain duplicate object references, so they are not persisted. - * We will keep track of properties which have unique contraint applied here, and regenerate on load. + * Unique constraints contain duplicate object references, so they are not persisted. + * We will keep track of properties which have unique constraints applied here, and regenerate on load. */ constraints: { - unique: {}; + unique: { + [P in keyof TData]?: UniqueIndex; + }; }; /** * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along * with the database. */ - transforms: {}; + transforms: Dict[]>; /** * In autosave scenarios we will use collection level dirty flags to determine whether save is needed. * currently, if any collection is dirty we will autosave the whole database if autosave is configured. @@ -62,7 +67,7 @@ export declare class Collection extends LokiEventEmit /** * Disable delta update object style on changes. */ - disableDeltaChangesApi: ANY; + disableDeltaChangesApi: boolean; /** * By default, if you insert a document into a collection with binary indices, if those indexed properties contain * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the @@ -72,7 +77,7 @@ export declare class Collection extends LokiEventEmit /** * Option to activate a cleaner daemon - clears "aged" documents at set intervals. */ - ttl: ANY; + ttl: Collection.TTL; private maxId; private _dynamicViews; /** @@ -81,7 +86,15 @@ export declare class Collection extends LokiEventEmit private changes; private insertHandler; private updateHandler; - console: ANY; + console: { + log(...args: any[]): void; + warn(...args: any[]): void; + error(...args: any[]): void; + }; + /** + * stages: a map of uniquely identified 'stages', which hold copies of objects to be + * manipulated without affecting the data in the original collection + */ private stages; private commitLog; _fullTextSearch: FullTextSearch; @@ -97,69 +110,50 @@ export declare class Collection extends LokiEventEmit * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable - * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method + * @param {string} [options.cloneMethod="deep"] - the clone method * @param {number} [options.transactional=false] - ? * @param {number} options.ttl - ? * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @see {@link Loki#addCollection} for normal creation of collections */ - constructor(name: string, options?: Collection.Options); - toJSON(): { - name: string; - _dynamicViews: DynamicView[]; - uniqueNames: string[]; - transforms: {}; - binaryIndices: Dict; - data: Doc[]; - idIndex: number[]; - maxId: number; - dirty: boolean; - adaptiveBinaryIndices: boolean; - transactional: boolean; - asyncListeners: boolean; - disableChangesApi: boolean; - cloneObjects: boolean; - cloneMethod: CloneMethod; - changes: any[]; - _fullTextSearch: FullTextSearch; - }; - static fromJSONObject(obj: ANY, options?: Collection.DeserializeOptions): Collection; + constructor(name: string, options?: Collection.Options); + toJSON(): Collection.Serialized; + static fromJSONObject(obj: Collection.Serialized, options?: Collection.DeserializeOptions): Collection; /** * Adds a named collection transform to the collection * @param {string} name - name to associate with transform * @param {array} transform - an array of transformation 'step' objects to save into the collection */ - addTransform(name: string, transform: ANY[]): void; + addTransform(name: string, transform: Collection.Transform[]): void; /** * Retrieves a named transform from the collection. * @param {string} name - name of the transform to lookup. */ - getTransform(name: string): any; + getTransform(name: string): Collection.Transform[]; /** * Updates a named collection transform to the collection * @param {string} name - name to associate with transform * @param {object} transform - a transformation object to save into collection */ - setTransform(name: string, transform: ANY[]): void; + setTransform(name: string, transform: Collection.Transform[]): void; /** * Removes a named collection transform from the collection * @param {string} name - name of collection transform to remove */ removeTransform(name: string): void; - ttlDaemonFuncGen(): () => void; private setTTL(age, interval); /** * create a row filter that covers all documents in the collection */ - prepareFullDocIndex(): any[]; + _prepareFullDocIndex(): number[]; /** * Ensure binary index on a certain field * @param {string} property - name of property to create binary index on - * @param {boolean} force - (Optional) flag indicating whether to construct index immediately + * @param {boolean} [force=false] - flag indicating whether to construct index immediately */ - ensureIndex(property: string, force?: boolean): void; - getSequencedIndexValues(property: string): string; - ensureUniqueIndex(field: string): UniqueIndex; + ensureIndex(property: keyof TData, force?: boolean): void; + getSequencedIndexValues(property: keyof TData): string; + ensureUniqueIndex(field: keyof TData): UniqueIndex; /** * Ensure all binary indices */ @@ -171,11 +165,11 @@ export declare class Collection extends LokiEventEmit * @param {object} query - (optional) query object to count results of * @returns {number} number of documents in the collection */ - count(query?: object): number; + count(query?: ResultSet.Query & TNested>): number; /** * Rebuild idIndex */ - ensureId(): void; + private _ensureId(); /** * Add a dynamic view to the collection * @param {string} name - name of dynamic view to add @@ -185,7 +179,7 @@ export declare class Collection extends LokiEventEmit * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here) * @returns {DynamicView} reference to the dynamic view added **/ - addDynamicView(name: string, options?: DynamicView.Options): DynamicView; + addDynamicView(name: string, options?: DynamicView.Options): DynamicView; /** * Remove a dynamic view from the collection * @param {string} name - name of dynamic view to remove @@ -196,7 +190,7 @@ export declare class Collection extends LokiEventEmit * @param {string} name - name of dynamic view to retrieve reference of * @returns {DynamicView} A reference to the dynamic view with that name **/ - getDynamicView(name: string): DynamicView; + getDynamicView(name: string): DynamicView; /** * Applies a 'mongo-like' find query object and passes all results to an update function. * For filter function querying you should migrate to [ @@ -205,38 +199,39 @@ export declare class Collection extends LokiEventEmit * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode) * @param {function} updateFunction - update function to run against filtered documents */ - findAndUpdate(filterObject: Query | ((obj: E) => boolean), updateFunction: (obj: E) => E): void; + findAndUpdate(filterObject: ResultSet.Query & TNested> | ((obj: Doc) => boolean), updateFunction: (obj: Doc) => any): void; /** * Applies a 'mongo-like' find query object removes all documents which match that filter. * * @param {object} filterObject - 'mongo-like' query object */ - findAndRemove(filterObject: object): void; + findAndRemove(filterObject: ResultSet.Query & TNested>): void; /** * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc. * @param {(object|array)} doc - the document (or array of documents) to be inserted * @returns {(object|array)} document or documents inserted */ - insert(doc: E | E[]): Doc; - insert(doc: E[]): Doc[]; + insert(doc: TData): Doc; + insert(doc: TData[]): Doc[]; /** * Adds a single object, ensures it has meta properties, clone it if necessary, etc. * @param {object} doc - the document to be inserted * @param {boolean} bulkInsert - quiet pre-insert and insert event emits * @returns {object} document or 'undefined' if there was a problem inserting it */ - insertOne(doc: E, bulkInsert?: boolean): Doc; + insertOne(doc: TData, bulkInsert?: boolean): Doc; /** * Empties the collection. - * @param {object} options - configure clear behavior - * @param {boolean} options.removeIndices - (default: false) + * @param {boolean} [removeIndices=false] - remove indices */ - clear(options?: ANY): void; + clear({removeIndices: removeIndices}?: { + removeIndices?: boolean; + }): void; /** * Updates an object and notifies collection that the document has changed. * @param {object} doc - document to update within the collection */ - update(doc: ANY): any; + update(doc: Doc | Doc[]): void; /** * Add object to collection */ @@ -247,24 +242,24 @@ export declare class Collection extends LokiEventEmit * @param {function} filterFunction - filter function whose results will execute update * @param {function} updateFunction - update function to run against filtered documents */ - updateWhere(filterFunction: (obj: E) => boolean, updateFunction: (obj: E) => E): void; + updateWhere(filterFunction: (obj: Doc) => boolean, updateFunction: (obj: Doc) => any): void; /** * Remove all documents matching supplied filter function. * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}. * @param {function|object} query - query object to filter on */ - removeWhere(query: Query | ((obj: E) => boolean)): void; + removeWhere(query: ResultSet.Query & TNested> | ((obj: Doc) => boolean)): void; removeDataOnly(): void; /** * Remove a document from the collection - * @param {object} doc - document to remove from collection + * @param {number|object} doc - document to remove from collection */ - remove(doc: ANY): any; + remove(doc: number | Doc | Doc[]): void; /** * Returns all changes. - * @returns {ANY} + * @returns {Collection.Change[]} */ - getChanges(): any[]; + getChanges(): Collection.Change[]; /** * Enables/disables changes api. * @param {boolean} disableChangesApi @@ -301,34 +296,35 @@ export declare class Collection extends LokiEventEmit * @returns {(object|array|null)} Object reference if document was found, null if not, * or an array if 'returnPosition' was passed. */ - get(id: number): Doc; - get(id: number, returnPosition: boolean): Doc | [Doc, number]; + get(id: number): Doc; + get(id: number, returnPosition: boolean): Doc | [Doc, number]; /** * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value * Since multiple documents may contain the same value (which the index is sorted on), * we hone in on range and then linear scan range to find exact index array position. - * @param {int} dataPosition : coll.data array index/position + * @param {int} dataPosition : data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - getBinaryIndexPosition(dataPosition: number, binaryIndexName: string): number; + getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData): number; /** * Adaptively insert a selected item to the index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively update a selected item within an index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively remove a selected item from the index. - * @param {int} dataPosition : coll.data array index/position + * @param {number} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in + * @param {boolean} removedFromIndexOnly - remove from index only */ - adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: string, removedFromIndexOnly?: boolean): ANY; + adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly?: boolean): void; /** * Internal method used for index maintenance and indexed searching. * Calculates the beginning of an index range for a given value. @@ -351,7 +347,7 @@ export declare class Collection extends LokiEventEmit private _calculateRangeEnd(prop, val); /** * Binary Search utility method to find range/segment of values matching criteria. - * this is used for collection.find() and first find filter of resultset/dynview + * this is used for collection.find() and first find filter of ResultSet/dynview * slightly different than get() binary search in that get() hones in on 1 value, * but we have to hone in on many (range) * @param {string} op - operation, such as $eq @@ -359,29 +355,29 @@ export declare class Collection extends LokiEventEmit * @param {object} val - value to use for range calculation. * @returns {array} [start, end] index array positions */ - calculateRange(op: string, prop: string, val: ANY): [number, number]; + calculateRange(op: string, prop: keyof TData, val: any): [number, number]; /** * Retrieve doc by Unique index * @param {string} field - name of uniquely indexed property to use when doing lookup * @param {any} value - unique value to search for * @returns {object} document matching the value passed */ - by(field: string, value: ANY): Doc; + by(field: string, value: any): Doc; /** * Find one object by index property, by property equal to value * @param {object} query - query object used to perform search with * @returns {(object|null)} First matching document, or null if none */ - findOne(query: object): Doc; + findOne(query: ResultSet.Query & TNested>): Doc; /** * Chain method, used for beginning a series of chained find() and/or view() operations * on a collection. * * @param {array} transform - Ordered array of transform step objects similar to chain * @param {object} parameters - Object containing properties representing parameters to substitute - * @returns {Resultset} (this) resultset, or data array if any map or join functions where called + * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called */ - chain(transform?: string | ANY[], parameters?: ANY): Resultset; + chain(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** * Find method, api is similar to mongodb. * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}. @@ -389,20 +385,26 @@ export declare class Collection extends LokiEventEmit * @param {object} query - 'mongo-like' query object * @returns {array} Array of matching documents */ - find(query?: Query): Doc[]; + find(query?: ResultSet.Query & TNested>): Doc[]; /** * Find object by unindexed field by property equal to value, * simply iterates and returns the first element matching the query */ - findOneUnindexed(prop: string, value: ANY): Doc; + findOneUnindexed(prop: string, value: any): Doc; /** * Transaction methods */ - /** start the transation */ + /** + * start the transation + */ startTransaction(): void; - /** commit the transation */ + /** + * commit the transation + */ commit(): void; - /** roll back the transation */ + /** + * roll back the transation + */ rollback(): void; /** * Query the collection by supplying a javascript filter function. @@ -414,14 +416,14 @@ export declare class Collection extends LokiEventEmit * @param {function} fun - filter function to run against all collection docs * @returns {array} all documents which pass your filter function */ - where(fun: (obj: E) => boolean): Doc[]; + where(fun: (obj: Doc) => boolean): Doc[]; /** * Map Reduce operation * @param {function} mapFunction - function to use as map function * @param {function} reduceFunction - function to use as reduce function * @returns {data} The result of your mapReduce operation */ - mapReduce(mapFunction: (value: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (value: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Join two collections on specified properties * @@ -429,13 +431,13 @@ export declare class Collection extends LokiEventEmit * @param {string} leftJoinProp - property name in collection * @param {string} rightJoinProp - property name in joinData * @param {function} mapFun - (Optional) map function to use - * @returns {Resultset} Result of the mapping operation - */ - eqJoin(joinData: ANY[], leftJoinProp: string, rightJoinProp: string, mapFun?: Function): Resultset; - /** - * stages: a map of uniquely identified 'stages', which hold copies of objects to be - * manipulated without affecting the data in the original collection + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method + * @returns {ResultSet} Result of the mapping operation */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinProp: string | ((obj: any) => string), rightJoinProp: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * (Staging API) create a stage and/or retrieve it */ @@ -446,7 +448,7 @@ export declare class Collection extends LokiEventEmit /** * (Staging API) create a copy of an object and insert it into a stage */ - stage(stageName: string, obj: ANY): any; + stage(stageName: string, obj: Doc): F; /** * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt * then create a message to be inserted in the commitlog @@ -459,10 +461,10 @@ export declare class Collection extends LokiEventEmit extract(field: string): any[]; /** */ - max(field: string): any; + max(field: string): number; /** */ - min(field: string): any; + min(field: string): number; /** */ maxRecord(field: string): { @@ -500,9 +502,9 @@ export declare class Collection extends LokiEventEmit median(field: string): number; } export declare namespace Collection { - interface Options { - unique?: string[]; - indices?: string[]; + interface Options { + unique?: (keyof TData)[]; + indices?: (keyof TData)[]; adaptiveBinaryIndices?: boolean; asyncListeners?: boolean; disableChangesApi?: boolean; @@ -518,10 +520,89 @@ export declare namespace Collection { interface DeserializeOptions { retainDirtyFlags?: boolean; fullTextSearch?: Dict; + [collName: string]: any | { + proto?: any; + inflate?: (src: object, dest?: object) => void; + }; } interface BinaryIndex { dirty: boolean; values: any; } - type Change = any; + interface Change { + name: string; + operation: string; + obj: any; + } + interface Serialized { + name: string; + _dynamicViews: DynamicView[]; + uniqueNames: string[]; + transforms: Dict; + binaryIndices: Dict; + _data: Doc[]; + idIndex: number[]; + maxId: number; + dirty: boolean; + adaptiveBinaryIndices: boolean; + transactional: boolean; + asyncListeners: boolean; + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + cloneObjects: boolean; + cloneMethod: CloneMethod; + changes: any; + _fullTextSearch: FullTextSearch; + } + type Transform = { + type: "find"; + value: ResultSet.Query & TNested> | string; + } | { + type: "where"; + value: ((obj: Doc) => boolean) | string; + } | { + type: "simplesort"; + property: keyof (TData & TNested); + desc?: boolean; + } | { + type: "compoundsort"; + value: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]; + } | { + type: "sort"; + value: (a: Doc, b: Doc) => number; + } | { + type: "sortByScoring"; + desc?: boolean; + } | { + type: "limit"; + value: number; + } | { + type: "offset"; + value: number; + } | { + type: "map"; + value: (obj: TData, index: number, array: TData[]) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "eqJoin"; + joinData: Collection | ResultSet; + leftJoinKey: string | ((obj: any) => string); + rightJoinKey: string | ((obj: any) => string); + mapFun?: (left: any, right: any) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "mapReduce"; + mapFunction: (item: TData, index: number, array: TData[]) => any; + reduceFunction: (array: any[]) => any; + } | { + type: "update"; + value: (obj: Doc) => any; + } | { + type: "remove"; + }; + interface TTL { + age: number; + ttlInterval: number; + daemon: any; + } } diff --git a/dist/packages/full-text-search-language-de/types/loki/src/dynamic_view.d.ts b/dist/packages/full-text-search-language-de/types/loki/src/dynamic_view.d.ts index 1aeab3a4..5cda4b13 100644 --- a/dist/packages/full-text-search-language-de/types/loki/src/dynamic_view.d.ts +++ b/dist/packages/full-text-search-language-de/types/loki/src/dynamic_view.d.ts @@ -1,9 +1,8 @@ import { LokiEventEmitter } from "./event_emitter"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { Collection } from "./collection"; -import { Doc, Filter } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; /** * DynamicView class is a versatile 'live' view class which can have filters and sorts applied. * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it @@ -18,18 +17,21 @@ export declare type ANY = any; * @extends LokiEventEmitter * @see {@link Collection#addDynamicView} to construct instances of DynamicView + * + * @param - the data type + * @param - nested properties of data type */ -export declare class DynamicView extends LokiEventEmitter { +export declare class DynamicView extends LokiEventEmitter { private _collection; private _persistent; private _sortPriority; private _minRebuildInterval; name: string; private _rebuildPending; - private _resultset; - private _resultdata; - private _resultsdirty; - private _cachedresultset; + private _resultSet; + private _resultData; + private _resultDirty; + private _cachedResultSet; private _filterPipeline; private _sortFunction; private _sortCriteria; @@ -41,10 +43,10 @@ export declare class DynamicView extends LokiEventEmi * @param {string} name - the name of this dynamic view * @param {object} options - the options * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' - * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority + * @param {string} [options.sortPriority="passive"] - the sort priority * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here) */ - constructor(collection: Collection, name: string, options?: DynamicView.Options); + constructor(collection: Collection, name: string, options?: DynamicView.Options); /** * Internally used immediately after deserialization (loading) * This will clear out and reapply filterPipeline ops, recreating the view. @@ -57,34 +59,22 @@ export declare class DynamicView extends LokiEventEmi */ _rematerialize({removeWhereFilters}: { removeWhereFilters?: boolean; - }): DynamicView; + }): this; /** - * Makes a copy of the internal resultset for branched queries. - * Unlike this dynamic view, the branched resultset will not be 'live' updated, + * Makes a copy of the internal ResultSet for branched queries. + * Unlike this dynamic view, the branched ResultSet will not be 'live' updated, * so your branched query should be immediately resolved and not held for future evaluation. * * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps * @param {object} parameters - optional parameters (if optional transform requires them) - * @returns {Resultset} A copy of the internal resultset for branched queries. + * @returns {ResultSet} A copy of the internal ResultSet for branched queries. */ - branchResultset(transform: string | any[], parameters?: object): Resultset; + branchResultSet(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** - * toJSON() - Override of toJSON to avoid circular references - * + * Override of toJSON to avoid circular references. */ - toJSON(): { - name: string; - _persistent: boolean; - _sortPriority: DynamicView.SortPriority; - _minRebuildInterval: number; - _resultset: Resultset; - _resultsdirty: boolean; - _filterPipeline: Filter[]; - _sortCriteria: (string | [string, boolean])[]; - _sortByScoring: boolean; - _sortDirty: boolean; - }; - static fromJSONObject(collection: ANY, obj: ANY): DynamicView; + toJSON(): DynamicView.Serialized; + static fromJSONObject(collection: Collection, obj: DynamicView.Serialized): DynamicView; /** * Used to clear pipeline and reset dynamic view to initial state. * Existing options should be retained. @@ -105,7 +95,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} comparefun - a javascript compare function used for sorting * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySort(comparefun: (lhs: E, rhs: E) => number): DynamicView; + applySort(comparefun: (lhs: Doc, rhs: Doc) => number): this; /** * Used to specify a property used for view translation. * @example @@ -115,9 +105,9 @@ export declare class DynamicView extends LokiEventEmi * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySimpleSort(propname: string, isdesc?: boolean): DynamicView; + applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * dv.applySortCriteria(['age', 'name']); @@ -129,32 +119,32 @@ export declare class DynamicView extends LokiEventEmi * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations. */ - applySortCriteria(criteria: (string | [string, boolean])[]): DynamicView; + applySortCriteria(criteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Used to apply a sort by the latest full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending */ - applySortByScoring(ascending?: boolean): DynamicView; + applySortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** * Marks the beginning of a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - startTransaction(): DynamicView; + startTransaction(): this; /** * Commits a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - commit(): DynamicView; + commit(): this; /** * Rolls back a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - rollback(): DynamicView; + rollback(): this; /** * Find the index of a filter in the pipeline, by that filter's ID. * @@ -163,7 +153,7 @@ export declare class DynamicView extends LokiEventEmi */ private _indexOfFilterWithId(uid); /** - * Add the filter object to the end of view's filter pipeline and apply the filter to the resultset. + * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet. * * @param {object} filter - The filter object. Refer to applyFilter() for extra details. */ @@ -173,7 +163,7 @@ export declare class DynamicView extends LokiEventEmi * * @returns {DynamicView} this DynamicView object, for further chain ops. */ - reapplyFilters(): DynamicView; + reapplyFilters(): this; /** * Adds or updates a filter in the DynamicView filter pipeline * @@ -181,7 +171,7 @@ export declare class DynamicView extends LokiEventEmi * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id } * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFilter(filter: Filter): DynamicView; + applyFilter(filter: DynamicView.Filter): this; /** * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline * @@ -189,7 +179,7 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFind(query: object, uid?: string | number): DynamicView; + applyFind(query: object, uid?: string | number): this; /** * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline * @@ -197,14 +187,14 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyWhere(fun: (obj: E) => boolean, uid?: string | number): DynamicView; + applyWhere(fun: (obj: Doc) => boolean, uid?: string | number): this; /** * removeFilter() - Remove the specified filter from the DynamicView filter pipeline * * @param {(string|number)} uid - The unique ID of the filter to be removed. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - removeFilter(uid: string | number): DynamicView; + removeFilter(uid: string | number): this; /** * Returns the number of documents representing the current DynamicView contents. * @returns {number} The number of documents representing the current DynamicView contents. @@ -213,16 +203,16 @@ export declare class DynamicView extends LokiEventEmi /** * Resolves and pending filtering and sorting, then returns document array as result. * - * @param {object} options - optional parameters to pass to resultset.data() if non-persistent - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * * @returns {Array} An array of documents representing the current DynamicView contents. */ - data(options?: object): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** * When the view is not sorted we may still wish to be notified of rebuild events. * This event will throttle and queue a single rebuild event when batches of updates affect the view. @@ -257,7 +247,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; } export declare namespace DynamicView { interface Options { @@ -265,8 +255,25 @@ export declare namespace DynamicView { sortPriority?: SortPriority; minRebuildInterval?: number; } - enum SortPriority { - PASSIVE = 0, - ACTIVE = 1, + type SortPriority = "passive" | "active"; + interface Serialized { + name: string; + _persistent: boolean; + _sortPriority: SortPriority; + _minRebuildInterval: number; + _resultSet: ResultSet; + _filterPipeline: Filter[]; + _sortCriteria: (string | [string, boolean])[]; + _sortByScoring: boolean; + _sortDirty: boolean; } + type Filter = { + type: "find"; + val: ResultSet.Query & TNested>; + uid: number | string; + } | { + type: "where"; + val: (obj: Doc) => boolean; + uid: number | string; + }; } diff --git a/dist/packages/full-text-search-language-de/types/loki/src/event_emitter.d.ts b/dist/packages/full-text-search-language-de/types/loki/src/event_emitter.d.ts index f422ee35..e55515e9 100644 --- a/dist/packages/full-text-search-language-de/types/loki/src/event_emitter.d.ts +++ b/dist/packages/full-text-search-language-de/types/loki/src/event_emitter.d.ts @@ -1,4 +1,3 @@ -export declare type ANY = any; /** * LokiEventEmitter is a minimalist version of EventEmitter. It enables any * constructor that inherits EventEmitter to emit events and trigger @@ -31,7 +30,7 @@ export declare class LokiEventEmitter { * @param {string} eventName - the name of the event * @param {object} data - optional object passed with the event */ - emit(eventName: string, ...data: ANY[]): void; + emit(eventName: string, ...data: any[]): void; /** * Alias of LokiEventEmitter.prototype.on * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event diff --git a/dist/packages/full-text-search-language-de/types/loki/src/helper.d.ts b/dist/packages/full-text-search-language-de/types/loki/src/helper.d.ts index 9a25de66..44b72305 100644 --- a/dist/packages/full-text-search-language-de/types/loki/src/helper.d.ts +++ b/dist/packages/full-text-search-language-de/types/loki/src/helper.d.ts @@ -1,8 +1,5 @@ /** - * @hidden - */ -export declare type ANY = any; -/** Helper function for determining 'loki' abstract equality which is a little more abstract than == + * Helper function for determining 'loki' abstract equality which is a little more abstract than == * aeqHelper(5, '5') === true * aeqHelper(5.0, '5') === true * aeqHelper(new Date("1/1/2011"), new Date("1/1/2011")) === true @@ -10,34 +7,33 @@ export declare type ANY = any; * aeqHelper([1, 2, 3], [1, 3]) === false * aeqHelper([1, 2, 3], [1, 2, 3]) === true * aeqHelper(undefined, null) === true - */ -/** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @returns {boolean} + * @hidden */ -export declare function aeqHelper(prop1: ANY, prop2: ANY): boolean; -/** Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. +export declare function aeqHelper(prop1: any, prop2: any): boolean; +/** + * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. * In the future we might want $lt and $gt ops to use their own functionality/helper. * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another. * @hidden */ -export declare function ltHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function ltHelper(prop1: any, prop2: any, equal: boolean): boolean; /** * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @param {boolean} equal * @returns {boolean} */ -export declare function gtHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function gtHelper(prop1: any, prop2: any, equal: boolean): boolean; /** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 - * @param {ANY} desc + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} descending * @returns {number} + * @hidden */ -export declare function sortHelper(prop1: ANY, prop2: ANY, desc: ANY): 1 | -1 | 0; +export declare function sortHelper(prop1: any, prop2: any, descending: boolean): number; diff --git a/dist/packages/full-text-search-language-de/types/loki/src/index.d.ts b/dist/packages/full-text-search-language-de/types/loki/src/index.d.ts index dee82236..17ee6df4 100644 --- a/dist/packages/full-text-search-language-de/types/loki/src/index.d.ts +++ b/dist/packages/full-text-search-language-de/types/loki/src/index.d.ts @@ -1,7 +1,4 @@ import { Loki } from "./loki"; import { Collection } from "./collection"; export { Loki, Collection }; -declare const _default: { - Loki: typeof Loki; -}; -export default _default; +export default Loki; diff --git a/dist/packages/full-text-search-language-de/types/loki/src/loki.d.ts b/dist/packages/full-text-search-language-de/types/loki/src/loki.d.ts index 10e81b65..f2deafd2 100644 --- a/dist/packages/full-text-search-language-de/types/loki/src/loki.d.ts +++ b/dist/packages/full-text-search-language-de/types/loki/src/loki.d.ts @@ -1,7 +1,6 @@ import { LokiEventEmitter } from "./event_emitter"; import { Collection } from "./collection"; import { Doc, StorageAdapter } from "../../common/types"; -export declare type ANY = any; export declare class Loki extends LokiEventEmitter { private filename; private databaseVersion; @@ -23,7 +22,7 @@ export declare class Loki extends LokiEventEmitter { * Constructs the main database class. * @param {string} filename - name of the file to be saved to * @param {object} [options={}] - options - * @param {Loki.Environment} [options.env=auto] - overrides environment detection + * @param {Loki.Environment} [options.env] - the javascript environment * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method * @param {string} [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization * @param {boolean} [options.verbose=false] - enable console output @@ -64,21 +63,21 @@ export declare class Loki extends LokiEventEmitter { * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @returns {Collection} a reference to the collection which was just added */ - addCollection(name: string, options?: Collection.Options): Collection; + addCollection(name: string, options?: Collection.Options): Collection; loadCollection(collection: Collection): void; /** * Retrieves reference to a collection by name. * @param {string} collectionName - name of collection to look up * @returns {Collection} Reference to collection in database by that name, or null if not found */ - getCollection(collectionName: string): Collection; + getCollection(collectionName: string): Collection; /** * Renames an existing loki collection * @param {string} oldName - name of collection to rename * @param {string} newName - new name of collection * @returns {Collection} reference to the newly renamed collection */ - renameCollection(oldName: string, newName: string): Collection<{}>; + renameCollection(oldName: string, newName: string): Collection; listCollections(): { name: string; count: number; @@ -95,20 +94,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {string} Stringified representation of the loki database. */ serialize(options?: Loki.SerializeOptions): string | string[]; - toJSON(): { - _env: Loki.Environment; - _serializationMethod: Loki.SerializationMethod; - _autosave: boolean; - _autosaveInterval: number; - _collections: Collection[]; - databaseVersion: number; - engineVersion: number; - filename: string; - _persistenceAdapter: StorageAdapter; - _persistenceMethod: Loki.PersistenceMethod; - _throttledSaves: boolean; - _verbose: boolean; - }; + toJSON(): Loki.Serialized; /** * Database level destructured JSON serialization routine to allow alternate serialization methods. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -134,7 +120,11 @@ export declare class Loki extends LokiEventEmitter { * * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection. */ - serializeCollection(options?: ANY): string | string[]; + serializeCollection(options?: { + delimited?: boolean; + collectionIndex?: number; + delimiter?: string; + }): string | string[]; /** * Database level destructured JSON deserialization routine to minimize memory overhead. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -150,7 +140,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array */ - deserializeDestructured(destructuredSource: ANY, options?: Loki.SerializeDestructuredOptions): any; + deserializeDestructured(destructuredSource: string | string[], options?: Loki.SerializeDestructuredOptions): any; /** * Collection level utility function to deserializes a destructured collection. * @@ -161,7 +151,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {Array} an array of documents to attach to collection.data. */ - deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc; + deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc[]; /** * Inflates a loki database from a serialized JSON string * @@ -169,15 +159,16 @@ export declare class Loki extends LokiEventEmitter { * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSON(serializedDb: string | string[], options?: ANY): void; + loadJSON(serializedDb: string | string[], options?: Collection.DeserializeOptions): void; /** * Inflates a loki database from a JS object * - * @param {object} dbObject - a serialized loki database string + * @param {object} dbObject - a serialized loki database object * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSONObject(dbObject: ANY, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki.Serialized, options?: Collection.DeserializeOptions): void; /** * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer. * Does not actually destroy the db. @@ -201,7 +192,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {Array} array of changes * @see private method _createChange() in Collection */ - generateChangesNotification(arrayOfCollectionNames?: string[]): any[]; + generateChangesNotification(arrayOfCollectionNames?: string[]): Collection.Change[]; /** * (Changes API) - stringify changes for network transmission * @returns {string} string representation of the changes @@ -310,24 +301,22 @@ export declare namespace Loki { recursiveWaitLimitDuration?: number; started?: Date; } - type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; - enum SerializationMethod { - NORMAL = 0, - PRETTY = 1, - DESTRUCTURED = 2, - } - enum PersistenceMethod { - FS_STORAGE = 0, - LOCAL_STORAGE = 1, - INDEXED_STORAGE = 2, - MEMORY_STORAGE = 3, - ADAPTER = 4, - } - enum Environment { - NODE_JS = 0, - NATIVE_SCRIPT = 1, - BROWSER = 2, - CORDOVA = 3, - MEMORY = 4, + interface Serialized { + _env: Environment; + _serializationMethod: SerializationMethod; + _autosave: boolean; + _autosaveInterval: number; + _collections: Collection[]; + databaseVersion: number; + engineVersion: number; + filename: string; + _persistenceAdapter: StorageAdapter; + _persistenceMethod: PersistenceMethod; + _throttledSaves: boolean; + _verbose: boolean; } + type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; + type SerializationMethod = "normal" | "pretty" | "destructured"; + type PersistenceMethod = "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter"; + type Environment = "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "MEMORY"; } diff --git a/dist/packages/fs-storage/types/loki/src/resultset.d.ts b/dist/packages/full-text-search-language-de/types/loki/src/result_set.d.ts similarity index 52% rename from dist/packages/fs-storage/types/loki/src/resultset.d.ts rename to dist/packages/full-text-search-language-de/types/loki/src/result_set.d.ts index 8ee6b343..b29e3a52 100644 --- a/dist/packages/fs-storage/types/loki/src/resultset.d.ts +++ b/dist/packages/full-text-search-language-de/types/loki/src/result_set.d.ts @@ -1,8 +1,8 @@ import { Collection } from "./collection"; import { CloneMethod } from "./clone"; -import { Doc, Query } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; +import { Query as FullTextSearchQuery } from "../../full-text-search/src/query_builder"; /** * @hidden */ @@ -15,29 +15,29 @@ export declare const LokiOps: { $gte(a: any, b: any): boolean; $lt(a: any, b: any): boolean; $lte(a: any, b: any): boolean; - $between(a: any, vals: any): boolean; + $between(a: any, range: [any, any]): boolean; $in(a: any, b: any): boolean; $nin(a: any, b: any): boolean; - $keyin(a: any, b: any): boolean; - $nkeyin(a: any, b: any): boolean; - $definedin(a: any, b: any): boolean; - $undefinedin(a: any, b: any): boolean; - $regex(a: any, b: any): any; - $containsString(a: any, b: any): boolean; + $keyin(a: string, b: object): boolean; + $nkeyin(a: string, b: object): boolean; + $definedin(a: string, b: object): boolean; + $undefinedin(a: string, b: object): boolean; + $regex(a: string, b: RegExp): boolean; + $containsString(a: any, b: string): boolean; $containsNone(a: any, b: any): boolean; - $containsAny(a: any, b: any): any; - $contains(a: any, b: any): any; - $type(a: any, b: any): any; - $finite(a: any, b: any): boolean; - $size(a: any, b: any): any; - $len(a: any, b: any): any; + $containsAny(a: any, b: any): boolean; + $contains(a: any, b: any): boolean; + $type(a: any, b: any): boolean; + $finite(a: number, b: boolean): boolean; + $size(a: any, b: any): boolean; + $len(a: any, b: any): boolean; $where(a: any, b: any): boolean; $not(a: any, b: any): boolean; $and(a: any, b: any): boolean; $or(a: any, b: any): boolean; }; /** - * Resultset class allowing chainable queries. Intended to be instanced internally. + * ResultSet class allowing chainable queries. Intended to be instanced internally. * Collection.find(), Collection.where(), and Collection.chain() instantiate this. * * @example @@ -45,61 +45,64 @@ export declare const LokiOps: { * .find({ 'doors' : 4 }) * .where(function(obj) { return obj.name === 'Toyota' }) * .data(); + * + * @param - the data type + * @param - nested properties of data type */ -export declare class Resultset { - collection: Collection; - filteredrows: number[]; - filterInitialized: boolean; +export declare class ResultSet { + _collection: Collection; + _filteredRows: number[]; + _filterInitialized: boolean; private _scoring; /** * Constructor. - * @param {Collection} collection - the collection which this Resultset will query against + * @param {Collection} collection - the collection which this ResultSet will query against */ - constructor(collection: Collection); + constructor(collection: Collection); /** - * reset() - Reset the resultset to its initial state. + * reset() - Reset the ResultSet to its initial state. * - * @returns {Resultset} Reference to this resultset, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, for future chain operations. */ - reset(): Resultset; + reset(): this; /** - * toJSON() - Override of toJSON to avoid circular references + * Override of toJSON to avoid circular references * */ - toJSON(): Resultset; + toJSON(): ResultSet; /** * Allows you to limit the number of documents passed to next chain operation. - * A resultset copy() is made to avoid altering original resultset. + * A ResultSet copy() is made to avoid altering original ResultSet. * * @param {int} qty - The number of documents to return. - * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops. + * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops. */ - limit(qty: number): Resultset; + limit(qty: number): this; /** - * Used for skipping 'pos' number of documents in the resultset. + * Used for skipping 'pos' number of documents in the ResultSet. * * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. - * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. + * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops. */ - offset(pos: number): Resultset; + offset(pos: number): this; /** - * copy() - To support reuse of resultset in branched query situations. + * copy() - To support reuse of ResultSet in branched query situations. * - * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same. + * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same. */ - copy(): Resultset; + copy(): ResultSet; /** * Alias of copy() */ - branch(): Resultset; + branch(): ResultSet; /** - * Executes a named collection transform or raw array of transform steps against the resultset. + * Executes a named collection transform or raw array of transform steps against the ResultSet. * * @param {(string|array)} transform - name of collection transform or raw transform array * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. - * @returns {Resultset} either (this) resultset or a clone of of this resultset (depending on steps) + * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps) */ - transform(transform: string | any[], parameters?: object): Resultset; + transform(transform: string | Collection.Transform[], parameters?: object): this; /** * User supplied compare function is provided two documents to compare. (chainable) * @example @@ -110,20 +113,20 @@ export declare class Resultset { * }); * * @param {function} comparefun - A javascript compare function used for sorting. - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - sort(comparefun: (a: E, b: E) => number): Resultset; + sort(comparefun: (a: Doc, b: Doc) => number): this; /** * Simpler, loose evaluation for user to sort based on a property name. (chainable). * Sorting based on the same lt/gt helper functions used for binary indices. * * @param {string} propname - name of property to sort by. - * @param {boolean} isdesc - (Optional) If true, the property will be sorted in descending order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @param {boolean} [descending=false] - if true, the property will be sorted in descending order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - simplesort(propname: string, isdesc?: boolean): Resultset; + simplesort(propname: keyof (TData & TNested), descending?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * rs.compoundsort(['age', 'name']); @@ -131,9 +134,9 @@ export declare class Resultset { * rs.compoundsort(['age', ['name', true]); * * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - compoundsort(properties: (string | [string, boolean])[]): Resultset; + compoundsort(properties: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Helper function for compoundsort(), performing individual object comparisons * @@ -144,83 +147,83 @@ export declare class Resultset { */ private _compoundeval(properties, obj1, obj2); /** - * Sorts the resultset based on the last full-text-search scoring. + * Sorts the ResultSet based on the last full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending - * @returns {Resultset} + * @returns {ResultSet} */ - sortByScoring(ascending?: boolean): Resultset; + sortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** - * findOr() - oversee the operation of OR'ed query expressions. + * Oversee the operation of OR'ed query expressions. * OR'ed expression evaluation runs each expression individually against the full collection, * and finally does a set OR on each expression's results. * Each evaluation can utilize a binary index to prevent multiple linear array scans. * * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - findOr(expressionArray: Query[]): Resultset; - $or(expressionArray: Query[]): Resultset; + findOr(expressionArray: ResultSet.Query & TNested>[]): this; + $or(expressionArray: ResultSet.Query & TNested>[]): this; /** - * findAnd() - oversee the operation of AND'ed query expressions. + * Oversee the operation of AND'ed query expressions. * AND'ed expression evaluation runs each expression progressively against the full collection, - * internally utilizing existing chained resultset functionality. + * internally utilizing existing chained ResultSet functionality. * Only the first filter can utilize a binary index. * * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - findAnd(expressionArray: Query[]): Resultset; - $and(expressionArray: Query[]): Resultset; + findAnd(expressionArray: ResultSet.Query & TNested>[]): this; + $and(expressionArray: ResultSet.Query & TNested>[]): this; /** * Used for querying via a mongo-style query object. * * @param {object} query - A mongo-style query object used for filtering current results. * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - find(query?: Query, firstOnly?: boolean): Resultset; + find(query?: ResultSet.Query & TNested>, firstOnly?: boolean): this; /** * Used for filtering via a javascript filter function. * * @param {function} fun - A javascript function used for filtering current results by. - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - where(fun: (obj: E) => boolean): Resultset; + where(fun: (obj: Doc) => boolean): this; /** - * Returns the number of documents in the resultset. - * @returns {number} The number of documents in the resultset. + * Returns the number of documents in the ResultSet. + * @returns {number} The number of documents in the ResultSet. */ count(): number; /** * Terminates the chain and returns array of filtered documents * @param {object} options - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values 'parse-stringify', 'deep', and 'shallow' and + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * - * @returns {Array} Array of documents in the resultset + * @returns {Array} Array of documents in the ResultSet */ - data(options?: Resultset.DataOptions): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** - * Used to run an update operation on all documents currently in the resultset. + * Used to run an update operation on all documents currently in the ResultSet. * * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - update(updateFunction: (obj: E) => E): Resultset; + update(updateFunction: (obj: Doc) => TData): this; /** - * Removes all document objects which are currently in resultset from collection (as well as resultset) + * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet) * - * @returns {Resultset} this (empty) resultset for further chain ops. + * @returns {ResultSet} this (empty) ResultSet for further chain ops. */ - remove(): Resultset; + remove(): this; /** * data transformation via user supplied functions * @@ -228,35 +231,72 @@ export declare class Resultset { * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns {value} The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Left joining two sets of data. Join keys can be defined or calculated properties * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key - * @param {Array|Resultset|Collection} joinData - Data array to join to. + * @param {Array|ResultSet|Collection} joinData - Data array to join to. * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}] + * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method + * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}] */ - eqJoin(joinData: ANY, leftJoinKey: string | Function, rightJoinKey: string | Function, mapFun?: Function, dataOptions?: ANY): ANY; + eqJoin(joinData: Collection | ResultSet | any[], leftJoinKey: string | ((obj: any) => string), rightJoinKey: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * Applies a map function into a new collection for further chaining. * @param {function} mapFun - javascript map function * @param {object} [dataOptions=] - options to data() before input to your map function * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method + * @return {ResultSet} */ - map(mapFun: (obj: E, index: number, array: E[]) => U, dataOptions?: Resultset.DataOptions): Resultset; + map(mapFun: (obj: TData, index: number, array: TData[]) => U, dataOptions?: ResultSet.DataOptions): ResultSet; } -export declare namespace Resultset { +export declare namespace ResultSet { interface DataOptions { forceClones?: boolean; forceCloneMethod?: CloneMethod; removeMeta?: boolean; } + type LokiOps = { + $eq?: R; + $aeq?: R; + $ne?: R; + $dteq?: R; + $gt?: R; + $gte?: R; + $lt?: R; + $lte?: R; + $between?: [R, R]; + $in?: R[]; + $nin?: R[]; + $keyin?: object; + $nkeyin?: object; + $definedin?: object; + $undefinedin?: object; + $regex?: RegExp | string | [string, string]; + $containsString?: string; + $containsNone?: R[] | R; + $containsAny?: R[] | R; + $contains?: any; + $type?: string; + $finite?: boolean; + $size?: number; + $len?: number; + $where?: (val?: R) => boolean; + }; + type Query = { + [P in keyof TData]?: LokiOps | TData[P]; + } & { + $and?: Query[]; + } & { + $or?: Query[]; + } & { + $fts?: FullTextSearchQuery; + }; } diff --git a/dist/packages/full-text-search-language-de/types/loki/src/unique_index.d.ts b/dist/packages/full-text-search-language-de/types/loki/src/unique_index.d.ts index 40312618..55284c11 100644 --- a/dist/packages/full-text-search-language-de/types/loki/src/unique_index.d.ts +++ b/dist/packages/full-text-search-language-de/types/loki/src/unique_index.d.ts @@ -1,30 +1,30 @@ import { Doc } from "../../common/types"; -export declare class UniqueIndex { +export declare class UniqueIndex { private _field; private _keyMap; /** * Constructs an unique index object. * @param {number|string} propertyField - the property field to index */ - constructor(propertyField: number | string); + constructor(propertyField: keyof E); /** * Sets a document's unique index. * @param {Doc} doc - the document * @param {number} row - the data row of the document */ - set(doc: Doc, row: number): void; + set(doc: Doc, row: number): void; /** * Returns the data row of an unique index. * @param {number|string} index - the index * @returns {number | string} - the row */ - get(index: number | string): number; + get(index: keyof E): number; /** * Updates a document's unique index. * @param {Object} doc - the document * @param {number} row - the data row of the document */ - update(doc: Doc, row: number): void; + update(doc: Doc, row: number): void; /** * Removes an unique index. * @param {number|string} index - the unique index diff --git a/dist/packages/full-text-search-language-de/types/memory-storage/src/index.d.ts b/dist/packages/full-text-search-language-de/types/memory-storage/src/index.d.ts new file mode 100644 index 00000000..5330aa7d --- /dev/null +++ b/dist/packages/full-text-search-language-de/types/memory-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { MemoryStorage } from "./memory_storage"; +export { MemoryStorage }; +export default MemoryStorage; diff --git a/dist/packages/full-text-search-language-en/types/loki/src/memory_adapter.d.ts b/dist/packages/full-text-search-language-de/types/memory-storage/src/memory_storage.d.ts similarity index 61% rename from dist/packages/full-text-search-language-en/types/loki/src/memory_adapter.d.ts rename to dist/packages/full-text-search-language-de/types/memory-storage/src/memory_storage.d.ts index 7b97c7f7..0066a1de 100644 --- a/dist/packages/full-text-search-language-en/types/loki/src/memory_adapter.d.ts +++ b/dist/packages/full-text-search-language-de/types/memory-storage/src/memory_storage.d.ts @@ -1,19 +1,29 @@ -import { StorageAdapter } from "../../common/types"; -export declare type ANY = any; +import { Dict, StorageAdapter } from "../../common/types"; /** - * In in-memory persistence adapter for an in-memory database. + * An in-memory persistence adapter for an in-memory database. * This simple 'key/value' adapter is intended for unit testing and diagnostics. */ -export declare class LokiMemoryAdapter implements StorageAdapter { - private hashStore; - private options; +export declare class MemoryStorage implements StorageAdapter { + hashStore: Dict<{ + savecount: number; + lastsave: Date; + value: string; + }>; + options: MemoryStorage.Options; /** - * @param {object} options - memory adapter options + * Registers the local storage as plugin. + */ + static register(): void; + /** + * Deregisters the local storage as plugin. + */ + static deregister(): void; + /** + * @param {object} options - memory storage options * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) - * @param {ANY} options */ - constructor(options?: ANY); + constructor(options?: MemoryStorage.Options); /** * Loads a serialized database from its in-memory store. * (Loki persistence adapter interface function) @@ -27,6 +37,7 @@ export declare class LokiMemoryAdapter implements StorageAdapter { * (Loki persistence adapter interface function) * * @param {string} dbname - name of the database (filename/keyname) + * @param {string} dbstring - the database content * @returns {Promise} a Promise that resolves after the database was persisted */ saveDatabase(dbname: string, dbstring: string): Promise; @@ -38,3 +49,9 @@ export declare class LokiMemoryAdapter implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } +export declare namespace MemoryStorage { + interface Options { + asyncResponses?: boolean; + asyncTimeout?: number; + } +} diff --git a/dist/packages/full-text-search-language-de/types/partitioning-adapter/src/index.d.ts b/dist/packages/full-text-search-language-de/types/partitioning-adapter/src/index.d.ts new file mode 100644 index 00000000..bf49882f --- /dev/null +++ b/dist/packages/full-text-search-language-de/types/partitioning-adapter/src/index.d.ts @@ -0,0 +1,3 @@ +import { PartitioningAdapter } from "./partitioning_adapter"; +export { PartitioningAdapter }; +export default PartitioningAdapter; diff --git a/dist/packages/full-text-search-language-de/types/partitioning-adapter/src/partitioning_adapter.d.ts b/dist/packages/full-text-search-language-de/types/partitioning-adapter/src/partitioning_adapter.d.ts index ff9568cf..45e14850 100644 --- a/dist/packages/full-text-search-language-de/types/partitioning-adapter/src/partitioning_adapter.d.ts +++ b/dist/packages/full-text-search-language-de/types/partitioning-adapter/src/partitioning_adapter.d.ts @@ -1,4 +1,5 @@ -import { ANY, StorageAdapter } from "../../common/types"; +import { Loki } from "../../loki/src/loki"; +import { StorageAdapter } from "../../common/types"; /** * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and @@ -9,7 +10,7 @@ import { ANY, StorageAdapter } from "../../common/types"; * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all * of that collection's pages will be written on next save. */ -export declare class LokiPartitioningAdapter implements StorageAdapter { +export declare class PartitioningAdapter implements StorageAdapter { mode: string; private _adapter; private _dbref; @@ -68,7 +69,7 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { * @returns {Promise} a Promise that resolves after the database was deleted * */ - exportDatabase(dbname: string, dbref: ANY): Promise; + exportDatabase(dbname: string, dbref: Loki): Promise; /** * Helper method used internally to save each dirty collection, one at a time. * @@ -82,11 +83,3 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { */ private _saveNextPage(); } -declare namespace LokiPartitioningAdapter { - interface PageIterator { - collection?: ANY; - docIndex?: number; - pageIndex?: number; - } -} -export default LokiPartitioningAdapter; diff --git a/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.js b/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.js index 72913b2d..abf1844e 100644 --- a/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.js +++ b/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.js @@ -7,7 +7,7 @@ exports["@lokijs/full-text-search-language-en"] = factory(require("@lokijs/full-text-search"), require("@lokijs/full-text-search-language")); else { root["@lokijs/full-text-search-language-en"] = factory(root["@lokijs/full-text-search"], root["@lokijs/full-text-search-language"]); root["LokiFullTextSearchLanguageEn"] = root["@lokijs/full-text-search-language-en"].default;} -})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_2__) { +})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -79,9 +79,21 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__en__ = __webpack_require__(1); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "EN", function() { return __WEBPACK_IMPORTED_MODULE_0__en__["a"]; }); + + +/* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__en__["a" /* EN */]); + + +/***/ }), +/* 1 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__ = __webpack_require__(2); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__); /* * From olivernn/lunr.js. @@ -149,7 +161,7 @@ class EnglishStemmer { const re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; const re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; const re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; - const re2_4 = /^(.+?)(s|t)(ion)$/; + const re2_4 = /^(.+?)([st])(ion)$/; const re_5 = /^(.+?)e$/; const re_5_1 = /ll$/; const re3_5 = new RegExp("^" + C + v + "[^aeiouwxy]$"); @@ -302,7 +314,7 @@ const trimmer = Object(__WEBPACK_IMPORTED_MODULE_1__full_text_search_language_sr const stopWordFilter = Object(__WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__["generateStopWordFilter"])(["a", "able", "about", "across", "after", "all", "almost", "also", "am", "among", "an", "and", "any", "are", "as", "at", "be", "because", "been", "but", "by", "can", "cannot", "could", "dear", "did", "do", "does", "either", "else", "ever", "every", "for", "from", "get", "got", "had", "has", "have", "he", "her", "hers", "him", "his", "how", "however", "i", "if", "in", "into", "is", "it", "its", "just", "least", "let", "like", "likely", "may", "me", "might", "most", "must", "my", "neither", "no", "nor", "not", "of", "off", "often", "on", "only", "or", "other", "our", "own", "rather", "said", "say", "says", "she", "should", "since", "so", "some", "than", "that", "the", "their", "them", "then", "there", "these", "they", "this", "tis", "to", "too", "twas", "us", "wants", "was", "we", "were", "what", "when", "where", "which", "while", "who", "whom", "why", "will", "with", "would", "yet", "you", "your"]); // Create, configure and export the tokenizer. const EN = new __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__["Tokenizer"](); -/* harmony export (immutable) */ __webpack_exports__["EN"] = EN; +/* harmony export (immutable) */ __webpack_exports__["a"] = EN; EN.setSplitter("whitespace-splitter", splitter); EN.add("trimmer-en", trimmer); @@ -311,16 +323,16 @@ EN.add("stopWordFilter-en", stopWordFilter); /***/ }), -/* 1 */ +/* 2 */ /***/ (function(module, exports) { -module.exports = __WEBPACK_EXTERNAL_MODULE_1__; +module.exports = __WEBPACK_EXTERNAL_MODULE_2__; /***/ }), -/* 2 */ +/* 3 */ /***/ (function(module, exports) { -module.exports = __WEBPACK_EXTERNAL_MODULE_2__; +module.exports = __WEBPACK_EXTERNAL_MODULE_3__; /***/ }) /******/ ]); diff --git a/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.js.map b/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.js.map index d77748c5..745ec93e 100644 --- a/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.js.map +++ b/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 7c514560f9a9ea635278","webpack:///./packages/full-text-search-language-en/src/en.ts","webpack:///external \"@lokijs/full-text-search\"","webpack:///external \"@lokijs/full-text-search-language\""],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;A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E,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAE77B,8CAA8C;AACvC,MAAM,EAAE,GAAc,IAAI,sEAAS,EAAE,CAAC;AAAA;AAAA;AAC7C,EAAE,CAAC,WAAW,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AAChD,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAC9B,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAC9B,EAAE,CAAC,GAAG,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;;;;;;;ACjQ5C,+C;;;;;;ACAA,+C","file":"lokijs.full-text-search-language-en.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@lokijs/full-text-search\"), require(\"@lokijs/full-text-search-language\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@lokijs/full-text-search\", \"@lokijs/full-text-search-language\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/full-text-search-language-en\"] = factory(require(\"@lokijs/full-text-search\"), require(\"@lokijs/full-text-search-language\"));\n\telse\n\t\troot[\"@lokijs/full-text-search-language-en\"] = factory(root[\"@lokijs/full-text-search\"], root[\"@lokijs/full-text-search-language\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_2__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7c514560f9a9ea635278","/*\n * From olivernn/lunr.js.\n * Last update from 2017/10/14 - 2dc9c6c6c41b1f5850f2bed0a82d8cd45835d166\n */\nimport {Tokenizer} from \"../../full-text-search/src/index\";\nimport {\n generateTrimmer,\n generateStopWordFilter,\n Among,\n SnowballProgram\n} from \"../../full-text-search-language/src/language\";\n\nclass EnglishStemmer {\n public porterStemmer: (token: string) => string;\n\n constructor() {\n // Write everything in the constructor to reduce code size and increase performance.\n // The original implementation uses a ES5 anonymous function class.\n const step2list = {\n \"ational\": \"ate\",\n \"tional\": \"tion\",\n \"enci\": \"ence\",\n \"anci\": \"ance\",\n \"izer\": \"ize\",\n \"bli\": \"ble\",\n \"alli\": \"al\",\n \"entli\": \"ent\",\n \"eli\": \"e\",\n \"ousli\": \"ous\",\n \"ization\": \"ize\",\n \"ation\": \"ate\",\n \"ator\": \"ate\",\n \"alism\": \"al\",\n \"iveness\": \"ive\",\n \"fulness\": \"ful\",\n \"ousness\": \"ous\",\n \"aliti\": \"al\",\n \"iviti\": \"ive\",\n \"biliti\": \"ble\",\n \"logi\": \"log\"\n };\n\n const step3list = {\n \"icate\": \"ic\",\n \"ative\": \"\",\n \"alize\": \"al\",\n \"iciti\": \"ic\",\n \"ical\": \"ic\",\n \"ful\": \"\",\n \"ness\": \"\"\n };\n\n const c = \"[^aeiou]\"; // consonant\n const v = \"[aeiouy]\"; // vowel\n const C = c + \"[^aeiouy]*\"; // consonant sequence\n const V = v + \"[aeiou]*\"; // vowel sequence\n\n const mgr0 = \"^(\" + C + \")?\" + V + C; // [C]VC... is m>0\n const meq1 = \"^(\" + C + \")?\" + V + C + \"(\" + V + \")?$\"; // [C]VC[V] is m=1\n const mgr1 = \"^(\" + C + \")?\" + V + C + V + C; // [C]VCVC... is m>1\n const s_v = \"^(\" + C + \")?\" + v; // vowel in stem\n\n const re_mgr0 = new RegExp(mgr0);\n const re_mgr1 = new RegExp(mgr1);\n const re_meq1 = new RegExp(meq1);\n const re_s_v = new RegExp(s_v);\n\n const re_1a = /^(.+?)(ss|i)es$/;\n const re2_1a = /^(.+?)([^s])s$/;\n const re_1b = /^(.+?)eed$/;\n const re2_1b = /^(.+?)(ed|ing)$/;\n const re_1b_2 = /.$/;\n const re2_1b_2 = /(at|bl|iz)$/;\n const re3_1b_2 = new RegExp(\"([^aeiouylsz])\\\\1$\");\n const re4_1b_2 = new RegExp(\"^\" + C + v + \"[^aeiouwxy]$\");\n\n const re_1c = /^(.+?[^aeiou])y$/;\n const re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;\n\n const re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;\n\n const re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;\n const re2_4 = /^(.+?)(s|t)(ion)$/;\n\n const re_5 = /^(.+?)e$/;\n const re_5_1 = /ll$/;\n const re3_5 = new RegExp(\"^\" + C + v + \"[^aeiouwxy]$\");\n\n this.porterStemmer = (w: string) => {\n let stem;\n let suffix;\n let firstch;\n let re;\n let re2;\n let re3;\n let re4;\n\n if (w.length < 3) {\n return w;\n }\n\n firstch = w.substr(0, 1);\n if (firstch === \"y\") {\n w = firstch.toUpperCase() + w.substr(1);\n }\n\n // Step 1a\n re = re_1a;\n re2 = re2_1a;\n\n if (re.test(w)) {\n w = w.replace(re, \"$1$2\");\n }\n else if (re2.test(w)) {\n w = w.replace(re2, \"$1$2\");\n }\n\n // Step 1b\n re = re_1b;\n re2 = re2_1b;\n if (re.test(w)) {\n const fp = re.exec(w);\n re = re_mgr0;\n if (re.test(fp[1])) {\n re = re_1b_2;\n w = w.replace(re, \"\");\n }\n } else if (re2.test(w)) {\n const fp = re2.exec(w);\n stem = fp[1];\n re2 = re_s_v;\n if (re2.test(stem)) {\n w = stem;\n re2 = re2_1b_2;\n re3 = re3_1b_2;\n re4 = re4_1b_2;\n if (re2.test(w)) {\n w = w + \"e\";\n }\n else if (re3.test(w)) {\n re = re_1b_2;\n w = w.replace(re, \"\");\n }\n else if (re4.test(w)) {\n w = w + \"e\";\n }\n }\n }\n\n // Step 1c - replace suffix y or Y by i if preceded by a non-vowel which is not the first letter of the word (so cry -> cri, by -> by, say -> say)\n re = re_1c;\n if (re.test(w)) {\n const fp = re.exec(w);\n stem = fp[1];\n w = stem + \"i\";\n }\n\n // Step 2\n re = re_2;\n if (re.test(w)) {\n const fp = re.exec(w);\n stem = fp[1];\n suffix = fp[2];\n re = re_mgr0;\n if (re.test(stem)) {\n w = stem + step2list[suffix];\n }\n }\n\n // Step 3\n re = re_3;\n if (re.test(w)) {\n const fp = re.exec(w);\n stem = fp[1];\n suffix = fp[2];\n re = re_mgr0;\n if (re.test(stem)) {\n w = stem + step3list[suffix];\n }\n }\n\n // Step 4\n re = re_4;\n re2 = re2_4;\n if (re.test(w)) {\n const fp = re.exec(w);\n stem = fp[1];\n re = re_mgr1;\n if (re.test(stem)) {\n w = stem;\n }\n } else if (re2.test(w)) {\n const fp = re2.exec(w);\n stem = fp[1] + fp[2];\n re2 = re_mgr1;\n if (re2.test(stem)) {\n w = stem;\n }\n }\n\n // Step 5\n re = re_5;\n if (re.test(w)) {\n const fp = re.exec(w);\n stem = fp[1];\n re = re_mgr1;\n re2 = re_meq1;\n re3 = re3_5;\n if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) {\n w = stem;\n }\n }\n\n re = re_5_1;\n re2 = re_mgr1;\n if (re.test(w) && re2.test(w)) {\n re = re_1b_2;\n w = w.replace(re, \"\");\n }\n\n // and turn initial Y back to y\n\n if (firstch === \"y\") {\n w = firstch.toLowerCase() + w.substr(1);\n }\n\n return w;\n };\n }\n}\n\n// Split at whitespace and dashes.\nfunction splitter(str: string) {\n let trimmedTokens = [];\n let tokens = str.split(/[\\s-]+/);\n for (let i = 0; i < tokens.length; i++) {\n if (tokens[i] !== \"\") {\n trimmedTokens.push(tokens[i].toLowerCase());\n }\n }\n return trimmedTokens;\n}\n\nconst st = new EnglishStemmer();\n\nfunction stemmer(token: string) {\n return st.porterStemmer(token);\n}\n\nconst trimmer = generateTrimmer(\"A-Za-z\\xAA\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02B8\\u02E0-\\u02E4\\u1D00-\\u1D25\\u1D2C-\\u1D5C\\u1D62-\\u1D65\\u1D6B-\\u1D77\\u1D79-\\u1DBE\\u1E00-\\u1EFF\\u2071\\u207F\\u2090-\\u209C\\u212A\\u212B\\u2132\\u214E\\u2160-\\u2188\\u2C60-\\u2C7F\\uA722-\\uA787\\uA78B-\\uA7AD\\uA7B0-\\uA7B7\\uA7F7-\\uA7FF\\uAB30-\\uAB5A\\uAB5C-\\uAB64\\uFB00-\\uFB06\\uFF21-\\uFF3A\\uFF41-\\uFF5A\");\nconst stopWordFilter = generateStopWordFilter([\"a\", \"able\", \"about\", \"across\", \"after\", \"all\", \"almost\", \"also\", \"am\", \"among\", \"an\", \"and\", \"any\", \"are\", \"as\", \"at\", \"be\", \"because\", \"been\", \"but\", \"by\", \"can\", \"cannot\", \"could\", \"dear\", \"did\", \"do\", \"does\", \"either\", \"else\", \"ever\", \"every\", \"for\", \"from\", \"get\", \"got\", \"had\", \"has\", \"have\", \"he\", \"her\", \"hers\", \"him\", \"his\", \"how\", \"however\", \"i\", \"if\", \"in\", \"into\", \"is\", \"it\", \"its\", \"just\", \"least\", \"let\", \"like\", \"likely\", \"may\", \"me\", \"might\", \"most\", \"must\", \"my\", \"neither\", \"no\", \"nor\", \"not\", \"of\", \"off\", \"often\", \"on\", \"only\", \"or\", \"other\", \"our\", \"own\", \"rather\", \"said\", \"say\", \"says\", \"she\", \"should\", \"since\", \"so\", \"some\", \"than\", \"that\", \"the\", \"their\", \"them\", \"then\", \"there\", \"these\", \"they\", \"this\", \"tis\", \"to\", \"too\", \"twas\", \"us\", \"wants\", \"was\", \"we\", \"were\", \"what\", \"when\", \"where\", \"which\", \"while\", \"who\", \"whom\", \"why\", \"will\", \"with\", \"would\", \"yet\", \"you\", \"your\"]);\n\n// Create, configure and export the tokenizer.\nexport const EN: Tokenizer = new Tokenizer();\nEN.setSplitter(\"whitespace-splitter\", splitter);\nEN.add(\"trimmer-en\", trimmer);\nEN.add(\"stemmer-en\", stemmer);\nEN.add(\"stopWordFilter-en\", stopWordFilter);\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search-language-en/src/en.ts","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@lokijs/full-text-search\"\n// module id = 1\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@lokijs/full-text-search-language\"\n// module id = 2\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap a44add364f34fa5e5a27","webpack:///./packages/full-text-search-language-en/src/index.ts","webpack:///./packages/full-text-search-language-en/src/en.ts","webpack:///external \"@lokijs/full-text-search\"","webpack:///external \"@lokijs/full-text-search-language\""],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;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AAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAE77B,8CAA8C;AACvC,MAAM,EAAE,GAAc,IAAI,sEAAS,EAAE,CAAC;AAAA;AAAA;AAC7C,EAAE,CAAC,WAAW,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AAChD,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAC9B,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAC9B,EAAE,CAAC,GAAG,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;;;;;;;ACjQ5C,+C;;;;;;ACAA,+C","file":"lokijs.full-text-search-language-en.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@lokijs/full-text-search\"), require(\"@lokijs/full-text-search-language\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@lokijs/full-text-search\", \"@lokijs/full-text-search-language\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/full-text-search-language-en\"] = factory(require(\"@lokijs/full-text-search\"), require(\"@lokijs/full-text-search-language\"));\n\telse\n\t\troot[\"@lokijs/full-text-search-language-en\"] = factory(root[\"@lokijs/full-text-search\"], root[\"@lokijs/full-text-search-language\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a44add364f34fa5e5a27","import {EN} from \"./en\";\nexport {EN};\nexport default EN;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search-language-en/src/index.ts","/*\n * From olivernn/lunr.js.\n * Last update from 2017/10/14 - 2dc9c6c6c41b1f5850f2bed0a82d8cd45835d166\n */\nimport {Tokenizer} from \"../../full-text-search/src/index\";\nimport {\n generateTrimmer,\n generateStopWordFilter,\n Among,\n SnowballProgram\n} from \"../../full-text-search-language/src/language\";\n\nclass EnglishStemmer {\n public porterStemmer: (token: string) => string;\n\n constructor() {\n // Write everything in the constructor to reduce code size and increase performance.\n // The original implementation uses a ES5 anonymous function class.\n const step2list = {\n \"ational\": \"ate\",\n \"tional\": \"tion\",\n \"enci\": \"ence\",\n \"anci\": \"ance\",\n \"izer\": \"ize\",\n \"bli\": \"ble\",\n \"alli\": \"al\",\n \"entli\": \"ent\",\n \"eli\": \"e\",\n \"ousli\": \"ous\",\n \"ization\": \"ize\",\n \"ation\": \"ate\",\n \"ator\": \"ate\",\n \"alism\": \"al\",\n \"iveness\": \"ive\",\n \"fulness\": \"ful\",\n \"ousness\": \"ous\",\n \"aliti\": \"al\",\n \"iviti\": \"ive\",\n \"biliti\": \"ble\",\n \"logi\": \"log\"\n };\n\n const step3list = {\n \"icate\": \"ic\",\n \"ative\": \"\",\n \"alize\": \"al\",\n \"iciti\": \"ic\",\n \"ical\": \"ic\",\n \"ful\": \"\",\n \"ness\": \"\"\n };\n\n const c = \"[^aeiou]\"; // consonant\n const v = \"[aeiouy]\"; // vowel\n const C = c + \"[^aeiouy]*\"; // consonant sequence\n const V = v + \"[aeiou]*\"; // vowel sequence\n\n const mgr0 = \"^(\" + C + \")?\" + V + C; // [C]VC... is m>0\n const meq1 = \"^(\" + C + \")?\" + V + C + \"(\" + V + \")?$\"; // [C]VC[V] is m=1\n const mgr1 = \"^(\" + C + \")?\" + V + C + V + C; // [C]VCVC... is m>1\n const s_v = \"^(\" + C + \")?\" + v; // vowel in stem\n\n const re_mgr0 = new RegExp(mgr0);\n const re_mgr1 = new RegExp(mgr1);\n const re_meq1 = new RegExp(meq1);\n const re_s_v = new RegExp(s_v);\n\n const re_1a = /^(.+?)(ss|i)es$/;\n const re2_1a = /^(.+?)([^s])s$/;\n const re_1b = /^(.+?)eed$/;\n const re2_1b = /^(.+?)(ed|ing)$/;\n const re_1b_2 = /.$/;\n const re2_1b_2 = /(at|bl|iz)$/;\n const re3_1b_2 = new RegExp(\"([^aeiouylsz])\\\\1$\");\n const re4_1b_2 = new RegExp(\"^\" + C + v + \"[^aeiouwxy]$\");\n\n const re_1c = /^(.+?[^aeiou])y$/;\n const re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;\n\n const re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;\n\n const re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;\n const re2_4 = /^(.+?)([st])(ion)$/;\n\n const re_5 = /^(.+?)e$/;\n const re_5_1 = /ll$/;\n const re3_5 = new RegExp(\"^\" + C + v + \"[^aeiouwxy]$\");\n\n this.porterStemmer = (w: string) => {\n let stem;\n let suffix;\n let firstch;\n let re;\n let re2;\n let re3;\n let re4;\n\n if (w.length < 3) {\n return w;\n }\n\n firstch = w.substr(0, 1);\n if (firstch === \"y\") {\n w = firstch.toUpperCase() + w.substr(1);\n }\n\n // Step 1a\n re = re_1a;\n re2 = re2_1a;\n\n if (re.test(w)) {\n w = w.replace(re, \"$1$2\");\n }\n else if (re2.test(w)) {\n w = w.replace(re2, \"$1$2\");\n }\n\n // Step 1b\n re = re_1b;\n re2 = re2_1b;\n if (re.test(w)) {\n const fp = re.exec(w);\n re = re_mgr0;\n if (re.test(fp[1])) {\n re = re_1b_2;\n w = w.replace(re, \"\");\n }\n } else if (re2.test(w)) {\n const fp = re2.exec(w);\n stem = fp[1];\n re2 = re_s_v;\n if (re2.test(stem)) {\n w = stem;\n re2 = re2_1b_2;\n re3 = re3_1b_2;\n re4 = re4_1b_2;\n if (re2.test(w)) {\n w = w + \"e\";\n }\n else if (re3.test(w)) {\n re = re_1b_2;\n w = w.replace(re, \"\");\n }\n else if (re4.test(w)) {\n w = w + \"e\";\n }\n }\n }\n\n // Step 1c - replace suffix y or Y by i if preceded by a non-vowel which is not the first letter of the word (so cry -> cri, by -> by, say -> say)\n re = re_1c;\n if (re.test(w)) {\n const fp = re.exec(w);\n stem = fp[1];\n w = stem + \"i\";\n }\n\n // Step 2\n re = re_2;\n if (re.test(w)) {\n const fp = re.exec(w);\n stem = fp[1];\n suffix = fp[2];\n re = re_mgr0;\n if (re.test(stem)) {\n w = stem + step2list[suffix];\n }\n }\n\n // Step 3\n re = re_3;\n if (re.test(w)) {\n const fp = re.exec(w);\n stem = fp[1];\n suffix = fp[2];\n re = re_mgr0;\n if (re.test(stem)) {\n w = stem + step3list[suffix];\n }\n }\n\n // Step 4\n re = re_4;\n re2 = re2_4;\n if (re.test(w)) {\n const fp = re.exec(w);\n stem = fp[1];\n re = re_mgr1;\n if (re.test(stem)) {\n w = stem;\n }\n } else if (re2.test(w)) {\n const fp = re2.exec(w);\n stem = fp[1] + fp[2];\n re2 = re_mgr1;\n if (re2.test(stem)) {\n w = stem;\n }\n }\n\n // Step 5\n re = re_5;\n if (re.test(w)) {\n const fp = re.exec(w);\n stem = fp[1];\n re = re_mgr1;\n re2 = re_meq1;\n re3 = re3_5;\n if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) {\n w = stem;\n }\n }\n\n re = re_5_1;\n re2 = re_mgr1;\n if (re.test(w) && re2.test(w)) {\n re = re_1b_2;\n w = w.replace(re, \"\");\n }\n\n // and turn initial Y back to y\n\n if (firstch === \"y\") {\n w = firstch.toLowerCase() + w.substr(1);\n }\n\n return w;\n };\n }\n}\n\n// Split at whitespace and dashes.\nfunction splitter(str: string) {\n let trimmedTokens = [];\n let tokens = str.split(/[\\s-]+/);\n for (let i = 0; i < tokens.length; i++) {\n if (tokens[i] !== \"\") {\n trimmedTokens.push(tokens[i].toLowerCase());\n }\n }\n return trimmedTokens;\n}\n\nconst st = new EnglishStemmer();\n\nfunction stemmer(token: string) {\n return st.porterStemmer(token);\n}\n\nconst trimmer = generateTrimmer(\"A-Za-z\\xAA\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02B8\\u02E0-\\u02E4\\u1D00-\\u1D25\\u1D2C-\\u1D5C\\u1D62-\\u1D65\\u1D6B-\\u1D77\\u1D79-\\u1DBE\\u1E00-\\u1EFF\\u2071\\u207F\\u2090-\\u209C\\u212A\\u212B\\u2132\\u214E\\u2160-\\u2188\\u2C60-\\u2C7F\\uA722-\\uA787\\uA78B-\\uA7AD\\uA7B0-\\uA7B7\\uA7F7-\\uA7FF\\uAB30-\\uAB5A\\uAB5C-\\uAB64\\uFB00-\\uFB06\\uFF21-\\uFF3A\\uFF41-\\uFF5A\");\nconst stopWordFilter = generateStopWordFilter([\"a\", \"able\", \"about\", \"across\", \"after\", \"all\", \"almost\", \"also\", \"am\", \"among\", \"an\", \"and\", \"any\", \"are\", \"as\", \"at\", \"be\", \"because\", \"been\", \"but\", \"by\", \"can\", \"cannot\", \"could\", \"dear\", \"did\", \"do\", \"does\", \"either\", \"else\", \"ever\", \"every\", \"for\", \"from\", \"get\", \"got\", \"had\", \"has\", \"have\", \"he\", \"her\", \"hers\", \"him\", \"his\", \"how\", \"however\", \"i\", \"if\", \"in\", \"into\", \"is\", \"it\", \"its\", \"just\", \"least\", \"let\", \"like\", \"likely\", \"may\", \"me\", \"might\", \"most\", \"must\", \"my\", \"neither\", \"no\", \"nor\", \"not\", \"of\", \"off\", \"often\", \"on\", \"only\", \"or\", \"other\", \"our\", \"own\", \"rather\", \"said\", \"say\", \"says\", \"she\", \"should\", \"since\", \"so\", \"some\", \"than\", \"that\", \"the\", \"their\", \"them\", \"then\", \"there\", \"these\", \"they\", \"this\", \"tis\", \"to\", \"too\", \"twas\", \"us\", \"wants\", \"was\", \"we\", \"were\", \"what\", \"when\", \"where\", \"which\", \"while\", \"who\", \"whom\", \"why\", \"will\", \"with\", \"would\", \"yet\", \"you\", \"your\"]);\n\n// Create, configure and export the tokenizer.\nexport const EN: Tokenizer = new Tokenizer();\nEN.setSplitter(\"whitespace-splitter\", splitter);\nEN.add(\"trimmer-en\", trimmer);\nEN.add(\"stemmer-en\", stemmer);\nEN.add(\"stopWordFilter-en\", stopWordFilter);\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search-language-en/src/en.ts","module.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@lokijs/full-text-search\"\n// module id = 2\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@lokijs/full-text-search-language\"\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.min.js b/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.min.js index b9018894..16990ed0 100644 --- a/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.min.js +++ b/dist/packages/full-text-search-language-en/lokijs.full-text-search-language-en.min.js @@ -1 +1 @@ -(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory(require("@lokijs/full-text-search"),require("@lokijs/full-text-search-language"));else if(typeof define==="function"&&define.amd)define(["@lokijs/full-text-search","@lokijs/full-text-search-language"],factory);else if(typeof exports==="object")exports["@lokijs/full-text-search-language-en"]=factory(require("@lokijs/full-text-search"),require("@lokijs/full-text-search-language"));else{root["@lokijs/full-text-search-language-en"]=factory(root["@lokijs/full-text-search"],root["@lokijs/full-text-search-language"]);root["LokiFullTextSearchLanguageEn"]=root["@lokijs/full-text-search-language-en"].default}})(typeof self!=="undefined"?self:this,function(__WEBPACK_EXTERNAL_MODULE_1__,__WEBPACK_EXTERNAL_MODULE_2__){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__=__webpack_require__(1);var __WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__full_text_search_src_index__);var __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__=__webpack_require__(2);var __WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__full_text_search_language_src_language__);class EnglishStemmer{constructor(){const step2list={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"};const step3list={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""};const c="[^aeiou]";const v="[aeiouy]";const C=c+"[^aeiouy]*";const V=v+"[aeiou]*";const mgr0="^("+C+")?"+V+C;const meq1="^("+C+")?"+V+C+"("+V+")?$";const mgr1="^("+C+")?"+V+C+V+C;const s_v="^("+C+")?"+v;const re_mgr0=new RegExp(mgr0);const re_mgr1=new RegExp(mgr1);const re_meq1=new RegExp(meq1);const re_s_v=new RegExp(s_v);const re_1a=/^(.+?)(ss|i)es$/;const re2_1a=/^(.+?)([^s])s$/;const re_1b=/^(.+?)eed$/;const re2_1b=/^(.+?)(ed|ing)$/;const re_1b_2=/.$/;const re2_1b_2=/(at|bl|iz)$/;const re3_1b_2=new RegExp("([^aeiouylsz])\\1$");const re4_1b_2=new RegExp("^"+C+v+"[^aeiouwxy]$");const re_1c=/^(.+?[^aeiou])y$/;const re_2=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;const re_3=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;const re_4=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;const re2_4=/^(.+?)(s|t)(ion)$/;const re_5=/^(.+?)e$/;const re_5_1=/ll$/;const re3_5=new RegExp("^"+C+v+"[^aeiouwxy]$");this.porterStemmer=(w=>{let stem;let suffix;let firstch;let re;let re2;let re3;let re4;if(w.length<3){return w}firstch=w.substr(0,1);if(firstch==="y"){w=firstch.toUpperCase()+w.substr(1)}re=re_1a;re2=re2_1a;if(re.test(w)){w=w.replace(re,"$1$2")}else if(re2.test(w)){w=w.replace(re2,"$1$2")}re=re_1b;re2=re2_1b;if(re.test(w)){const fp=re.exec(w);re=re_mgr0;if(re.test(fp[1])){re=re_1b_2;w=w.replace(re,"")}}else if(re2.test(w)){const fp=re2.exec(w);stem=fp[1];re2=re_s_v;if(re2.test(stem)){w=stem;re2=re2_1b_2;re3=re3_1b_2;re4=re4_1b_2;if(re2.test(w)){w=w+"e"}else if(re3.test(w)){re=re_1b_2;w=w.replace(re,"")}else if(re4.test(w)){w=w+"e"}}}re=re_1c;if(re.test(w)){const fp=re.exec(w);stem=fp[1];w=stem+"i"}re=re_2;if(re.test(w)){const fp=re.exec(w);stem=fp[1];suffix=fp[2];re=re_mgr0;if(re.test(stem)){w=stem+step2list[suffix]}}re=re_3;if(re.test(w)){const fp=re.exec(w);stem=fp[1];suffix=fp[2];re=re_mgr0;if(re.test(stem)){w=stem+step3list[suffix]}}re=re_4;re2=re2_4;if(re.test(w)){const fp=re.exec(w);stem=fp[1];re=re_mgr1;if(re.test(stem)){w=stem}}else if(re2.test(w)){const fp=re2.exec(w);stem=fp[1]+fp[2];re2=re_mgr1;if(re2.test(stem)){w=stem}}re=re_5;if(re.test(w)){const fp=re.exec(w);stem=fp[1];re=re_mgr1;re2=re_meq1;re3=re3_5;if(re.test(stem)||re2.test(stem)&&!re3.test(stem)){w=stem}}re=re_5_1;re2=re_mgr1;if(re.test(w)&&re2.test(w)){re=re_1b_2;w=w.replace(re,"")}if(firstch==="y"){w=firstch.toLowerCase()+w.substr(1)}return w})}}function splitter(str){let trimmedTokens=[];let tokens=str.split(/[\s-]+/);for(let i=0;i{let stem;let suffix;let firstch;let re;let re2;let re3;let re4;if(w.length<3){return w}firstch=w.substr(0,1);if(firstch==="y"){w=firstch.toUpperCase()+w.substr(1)}re=re_1a;re2=re2_1a;if(re.test(w)){w=w.replace(re,"$1$2")}else if(re2.test(w)){w=w.replace(re2,"$1$2")}re=re_1b;re2=re2_1b;if(re.test(w)){const fp=re.exec(w);re=re_mgr0;if(re.test(fp[1])){re=re_1b_2;w=w.replace(re,"")}}else if(re2.test(w)){const fp=re2.exec(w);stem=fp[1];re2=re_s_v;if(re2.test(stem)){w=stem;re2=re2_1b_2;re3=re3_1b_2;re4=re4_1b_2;if(re2.test(w)){w=w+"e"}else if(re3.test(w)){re=re_1b_2;w=w.replace(re,"")}else if(re4.test(w)){w=w+"e"}}}re=re_1c;if(re.test(w)){const fp=re.exec(w);stem=fp[1];w=stem+"i"}re=re_2;if(re.test(w)){const fp=re.exec(w);stem=fp[1];suffix=fp[2];re=re_mgr0;if(re.test(stem)){w=stem+step2list[suffix]}}re=re_3;if(re.test(w)){const fp=re.exec(w);stem=fp[1];suffix=fp[2];re=re_mgr0;if(re.test(stem)){w=stem+step3list[suffix]}}re=re_4;re2=re2_4;if(re.test(w)){const fp=re.exec(w);stem=fp[1];re=re_mgr1;if(re.test(stem)){w=stem}}else if(re2.test(w)){const fp=re2.exec(w);stem=fp[1]+fp[2];re2=re_mgr1;if(re2.test(stem)){w=stem}}re=re_5;if(re.test(w)){const fp=re.exec(w);stem=fp[1];re=re_mgr1;re2=re_meq1;re3=re3_5;if(re.test(stem)||re2.test(stem)&&!re3.test(stem)){w=stem}}re=re_5_1;re2=re_mgr1;if(re.test(w)&&re2.test(w)){re=re_1b_2;w=w.replace(re,"")}if(firstch==="y"){w=firstch.toLowerCase()+w.substr(1)}return w})}}function splitter(str){let trimmedTokens=[];let tokens=str.split(/[\s-]+/);for(let i=0;i; saveDatabase?(dbname: string, serialization: string): Promise; deleteDatabase?(dbname: string): Promise; mode?: string; - exportDatabase?(dbname: string, dbref: ANY): Promise; + exportDatabase?(dbname: string, dbref: Loki): Promise; } export declare type Doc = T & { $loki: number; @@ -14,10 +17,3 @@ export interface Dict { [index: string]: T; [index: number]: T; } -export interface Query { -} -export interface Filter { - type: string; - val: Query | ((obj: E, index: number, array: E[]) => boolean); - uid: number | string; -} diff --git a/dist/packages/full-text-search-language-en/types/fs-storage/src/fs_storage.d.ts b/dist/packages/full-text-search-language-en/types/fs-storage/src/fs_storage.d.ts index a92567ea..9930c0d0 100644 --- a/dist/packages/full-text-search-language-en/types/fs-storage/src/fs_storage.d.ts +++ b/dist/packages/full-text-search-language-en/types/fs-storage/src/fs_storage.d.ts @@ -2,7 +2,7 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists using node fs module. */ -export declare class LokiFSStorage implements StorageAdapter { +export declare class FSStorage implements StorageAdapter { /** * Registers the fs storage as plugin. */ @@ -32,4 +32,3 @@ export declare class LokiFSStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiFSStorage; diff --git a/dist/packages/full-text-search-language-en/types/fs-storage/src/index.d.ts b/dist/packages/full-text-search-language-en/types/fs-storage/src/index.d.ts new file mode 100644 index 00000000..e6b33d6c --- /dev/null +++ b/dist/packages/full-text-search-language-en/types/fs-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { FSStorage } from "./fs_storage"; +export { FSStorage }; +export default FSStorage; diff --git a/dist/packages/full-text-search-language-en/types/full-text-search-language-de/src/index.d.ts b/dist/packages/full-text-search-language-en/types/full-text-search-language-de/src/index.d.ts new file mode 100644 index 00000000..a2665427 --- /dev/null +++ b/dist/packages/full-text-search-language-en/types/full-text-search-language-de/src/index.d.ts @@ -0,0 +1,3 @@ +import { DE } from "./de"; +export { DE }; +export default DE; diff --git a/dist/packages/full-text-search-language-en/types/full-text-search-language-en/src/index.d.ts b/dist/packages/full-text-search-language-en/types/full-text-search-language-en/src/index.d.ts new file mode 100644 index 00000000..8313cf98 --- /dev/null +++ b/dist/packages/full-text-search-language-en/types/full-text-search-language-en/src/index.d.ts @@ -0,0 +1,3 @@ +import { EN } from "./en"; +export { EN }; +export default EN; diff --git a/dist/packages/full-text-search-language-en/types/full-text-search-language/src/index.d.ts b/dist/packages/full-text-search-language-en/types/full-text-search-language/src/index.d.ts new file mode 100644 index 00000000..e52d1a42 --- /dev/null +++ b/dist/packages/full-text-search-language-en/types/full-text-search-language/src/index.d.ts @@ -0,0 +1 @@ +export { generateStopWordFilter, generateTrimmer, Among, SnowballProgram } from "./language"; diff --git a/dist/packages/full-text-search-language-en/types/full-text-search/src/full_text_search.d.ts b/dist/packages/full-text-search-language-en/types/full-text-search/src/full_text_search.d.ts index a4752c88..65a26bef 100644 --- a/dist/packages/full-text-search-language-en/types/full-text-search/src/full_text_search.d.ts +++ b/dist/packages/full-text-search-language-en/types/full-text-search/src/full_text_search.d.ts @@ -2,7 +2,7 @@ import { InvertedIndex } from "./inverted_index"; import { Tokenizer } from "./tokenizer"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; export declare class FullTextSearch { private _id; private _docs; @@ -21,14 +21,14 @@ export declare class FullTextSearch { * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized * (requires more memory but performs better) * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field - * @param {string=$loki} id - the property name of the document index + * @param {string} [id] - the property name of the document index */ constructor(fields?: FullTextSearch.FieldOptions[], id?: string); addDocument(doc: object, id?: number): void; removeDocument(doc: object, id?: number): void; updateDocument(doc: object, id?: number): void; clear(): void; - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; toJSON(): FullTextSearch.Serialization; static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers?: Dict): FullTextSearch; } diff --git a/dist/packages/full-text-search-language-en/types/full-text-search/src/index.d.ts b/dist/packages/full-text-search-language-en/types/full-text-search/src/index.d.ts index f03dde09..b901b108 100644 --- a/dist/packages/full-text-search-language-en/types/full-text-search/src/index.d.ts +++ b/dist/packages/full-text-search-language-en/types/full-text-search/src/index.d.ts @@ -1,6 +1,5 @@ import { FullTextSearch } from "./full_text_search"; -export { Tokenizer } from "./tokenizer"; -export { QueryBuilder } from "./query_builder"; -export { InvertedIndex } from "./inverted_index"; -export { FullTextSearch }; +import { Tokenizer } from "./tokenizer"; +import { QueryBuilder } from "./query_builder"; +export { FullTextSearch, Tokenizer, QueryBuilder }; export default FullTextSearch; diff --git a/dist/packages/full-text-search-language-en/types/full-text-search/src/index_searcher.d.ts b/dist/packages/full-text-search-language-en/types/full-text-search/src/index_searcher.d.ts index d3cf7f93..00b99f2f 100644 --- a/dist/packages/full-text-search-language-en/types/full-text-search/src/index_searcher.d.ts +++ b/dist/packages/full-text-search-language-en/types/full-text-search/src/index_searcher.d.ts @@ -1,4 +1,4 @@ -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; import { InvertedIndex } from "./inverted_index"; import { Query } from "./query_builder"; import { Dict } from "../../common/types"; @@ -13,9 +13,9 @@ export declare class IndexSearcher { * @param {object} invIdxs */ constructor(invIdxs: Dict, docs: Set); - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; setDirty(): void; private _recursive(query, doScoring); - private _getUnique(queries, doScoring, docResults); + private _getUnique(queries, doScoring, queryResults); private _getAll(queries, doScoring); } diff --git a/dist/packages/full-text-search-language-en/types/full-text-search/src/query_builder.d.ts b/dist/packages/full-text-search-language-en/types/full-text-search/src/query_builder.d.ts index 923317f6..6f324e15 100644 --- a/dist/packages/full-text-search-language-en/types/full-text-search/src/query_builder.d.ts +++ b/dist/packages/full-text-search-language-en/types/full-text-search/src/query_builder.d.ts @@ -24,8 +24,8 @@ export declare class BaseQueryBuilder { */ build(): any; } -export interface BaseQuery { - type: string; +export interface BaseQuery { + type: Type; boost?: number; } /** @@ -51,7 +51,7 @@ export declare class TermQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, term: string, data?: any); } -export interface TermQuery extends BaseQuery { +export interface TermQuery extends BaseQuery<"term"> { field: string; value: string; } @@ -78,7 +78,7 @@ export declare class TermsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, terms: Array, data?: any); } -export interface TermsQuery extends BaseQuery { +export interface TermsQuery extends BaseQuery<"terms"> { field: string; value: string[]; } @@ -119,7 +119,7 @@ export declare class WildcardQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface WildcardQuery extends BaseQuery { +export interface WildcardQuery extends BaseQuery<"wildcard"> { field: string; value: string; enable_scoring?: boolean; @@ -169,7 +169,7 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { * * @return {FuzzyQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the initial word length. * @param {number} prefixLength - the positive prefix length @@ -183,10 +183,10 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface FuzzyQuery extends BaseQuery { +export interface FuzzyQuery extends BaseQuery<"fuzzy"> { field: string; value: string; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -221,7 +221,7 @@ export declare class PrefixQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface PrefixQuery extends BaseQuery { +export interface PrefixQuery extends BaseQuery<"prefix"> { field: string; value: string; enable_scoring?: boolean; @@ -247,7 +247,7 @@ export declare class ExistsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, data?: any); } -export interface ExistsQuery extends BaseQuery { +export interface ExistsQuery extends BaseQuery<"exists"> { field: string; } /** @@ -315,7 +315,7 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { * * @return {MatchQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the starting word length which should not be considered for fuzziness. * @param {number} prefixLength - the positive prefix length @@ -329,12 +329,12 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface MatchQuery extends BaseQuery { +export interface MatchQuery extends BaseQuery<"match"> { field: string; value: string; minimum_should_match?: number; operator?: "and" | "or"; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -360,7 +360,7 @@ export interface MatchQuery extends BaseQuery { export declare class MatchAllQueryBuilder extends BaseQueryBuilder { constructor(data?: any); } -export interface MatchQueryAll extends BaseQuery { +export interface MatchQueryAll extends BaseQuery<"match_all"> { } /** * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter. @@ -388,9 +388,11 @@ export declare class ConstantScoreQueryBuilder extends BaseQueryBuilder { * Starts an array of queries. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): ConstantScoreQueryBuilder; + }; } -export interface ConstantScoreQuery extends BaseQuery { +export interface ConstantScoreQuery extends BaseQuery<"constant_score"> { filter: ArrayQuery; } /** @@ -442,22 +444,30 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { * Starts an array of queries for must clause. Use endMust() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginMust(): ArrayQueryBuilder; + beginMust(): ArrayQueryBuilder & { + endMust(): BoolQueryBuilder; + }; /** * Starts an array of queries for filter clause. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): BoolQueryBuilder; + }; /** * Starts an array of queries for should clause. Use endShould() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginShould(): ArrayQueryBuilder; + beginShould(): ArrayQueryBuilder & { + endShould(): BoolQueryBuilder; + }; /** * Starts an array of queries for not clause. Use endNot() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginNot(): ArrayQueryBuilder; + beginNot(): ArrayQueryBuilder & { + endNot(): BoolQueryBuilder; + }; /** * Controls the amount of minimum matching sub queries before a document will be considered. * @param {number} minShouldMatch - number of minimum matching sub queries @@ -472,7 +482,7 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { */ minimumShouldMatch(minShouldMatch: number): this; } -export interface BoolQuery extends BaseQuery { +export interface BoolQuery extends BaseQuery<"bool"> { must?: ArrayQuery; filter?: ArrayQuery; should?: ArrayQuery; @@ -497,8 +507,8 @@ export declare class ArrayQueryBuilder extends BaseQueryBuilder { prefix(field: string, prefix: string): any; exists(field: string): any; } -export interface ArrayQuery { - values: any[]; +export interface ArrayQuery extends BaseQuery<"array"> { + values: QueryTypes[]; } /** * This query builder is the root of each query search. @@ -525,9 +535,15 @@ export declare class QueryBuilder { /** * The query performs a final scoring over all scored sub queries. * @param {boolean} enable - flag to enable or disable final scoring - * @return {QueryBuilder} + * @return {this} */ enableFinalScoring(enable: boolean): this; + /** + * Adds an explanation of the scoring of each document for all matched terms. + * @param {boolean} enable -flag to enable or disable explanation + * @returns {this} + */ + explain(enable: boolean): this; /** * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model. * @@ -535,10 +551,10 @@ export declare class QueryBuilder { * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}. * * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation. - * Lower values result in quicker saturation, and higher values in slower saturation. + * Lower values result in quicker saturation, and higher values in slower saturation * @param {number} [b=0.75] - controls how much effect field-length normalization should have. - * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully. - * @return {QueryBuilder} + * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully + * @return {this} */ BM25Similarity(k1?: number, b?: number): this; bool(): BoolQueryBuilder; @@ -553,9 +569,11 @@ export declare class QueryBuilder { exists(field: string): ExistsQueryBuilder; private _prepare(queryType, ...args); } +export declare type QueryTypes = BoolQuery | ConstantScoreQuery | TermQuery | TermsQuery | WildcardQuery | FuzzyQuery | MatchQuery | MatchQueryAll | PrefixQuery | ExistsQuery; export interface Query { - query: any; + query: QueryTypes; final_scoring?: boolean; + explain?: boolean; bm25?: { k1: number; b: number; diff --git a/dist/packages/full-text-search-language-en/types/full-text-search/src/scorer.d.ts b/dist/packages/full-text-search-language-en/types/full-text-search/src/scorer.d.ts index aed3e619..dacdc753 100644 --- a/dist/packages/full-text-search-language-en/types/full-text-search/src/scorer.d.ts +++ b/dist/packages/full-text-search-language-en/types/full-text-search/src/scorer.d.ts @@ -1,7 +1,6 @@ import { InvertedIndex } from "./inverted_index"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -export declare type ScoreResult = Dict; /** * @hidden */ @@ -10,9 +9,9 @@ export declare class Scorer { private _cache; constructor(invIdxs: Dict); setDirty(): void; - score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, docResults: Scorer.DocResults, term: number[]): void; - scoreConstant(boost: number, docId: number, docResults: Scorer.DocResults): Map; - finalScore(query: Query, docResults: Scorer.DocResults): ScoreResult; + score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, queryResults: Scorer.QueryResults, term: number[]): void; + scoreConstant(boost: number, docId: number, queryResults: Scorer.QueryResults): Map; + finalScore(query: Query, queryResults: Scorer.QueryResults): Scorer.ScoreResult; private static _calculateFieldLength(fieldLength); private _getCache(fieldName); /** @@ -30,12 +29,33 @@ export declare namespace Scorer { idfs: Dict; avgFieldLength: number; } - interface DocResult { + interface QueryResult { tf?: number; idf?: number; boost: number; fieldName?: string; term?: number[]; } - type DocResults = Map; + type QueryResults = Map; + interface BM25Explanation { + boost: number; + score: number; + docID: number; + fieldName: string; + index: string; + idf: number; + tfNorm: number; + tf: number; + fieldLength: number; + avgFieldLength: number; + } + interface ConstantExplanation { + boost: number; + score: number; + } + type ScoreExplanation = BM25Explanation | ConstantExplanation; + type ScoreResult = Dict<{ + score: number; + explanation?: ScoreExplanation[]; + }>; } diff --git a/dist/packages/full-text-search-language-en/types/indexed-storage/src/index.d.ts b/dist/packages/full-text-search-language-en/types/indexed-storage/src/index.d.ts new file mode 100644 index 00000000..bf453632 --- /dev/null +++ b/dist/packages/full-text-search-language-en/types/indexed-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { IndexedStorage } from "./indexed_storage"; +export { IndexedStorage }; +export default IndexedStorage; diff --git a/dist/packages/full-text-search-language-en/types/indexed-storage/src/indexed_storage.d.ts b/dist/packages/full-text-search-language-en/types/indexed-storage/src/indexed_storage.d.ts index 457b01a0..adaeaef1 100644 --- a/dist/packages/full-text-search-language-en/types/indexed-storage/src/indexed_storage.d.ts +++ b/dist/packages/full-text-search-language-en/types/indexed-storage/src/indexed_storage.d.ts @@ -6,7 +6,7 @@ import { StorageAdapter } from "../../common/types"; * IndexedDb storage is provided per-domain, so we implement app/key/value database to * allow separate contexts for separate apps within a domain. */ -export declare class LokiIndexedStorage implements StorageAdapter { +export declare class IndexedStorage implements StorageAdapter { private _appname; private catalog; /** @@ -98,4 +98,4 @@ export interface Entry { key: string; size: number; } -export default LokiIndexedStorage; +export default IndexedStorage; diff --git a/dist/packages/full-text-search-language-en/types/local-storage/src/index.d.ts b/dist/packages/full-text-search-language-en/types/local-storage/src/index.d.ts new file mode 100644 index 00000000..2b74e8c0 --- /dev/null +++ b/dist/packages/full-text-search-language-en/types/local-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { LocalStorage } from "./local_storage"; +export { LocalStorage }; +export default LocalStorage; diff --git a/dist/packages/full-text-search-language-en/types/local-storage/src/local_storage.d.ts b/dist/packages/full-text-search-language-en/types/local-storage/src/local_storage.d.ts index 2337eb12..380d8be9 100644 --- a/dist/packages/full-text-search-language-en/types/local-storage/src/local_storage.d.ts +++ b/dist/packages/full-text-search-language-en/types/local-storage/src/local_storage.d.ts @@ -1,9 +1,9 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists to web browser's local storage object - * @constructor LokiLocalStorageAdapter + * @constructor LocalStorageAdapter */ -export declare class LokiLocalStorage implements StorageAdapter { +export declare class LocalStorage implements StorageAdapter { /** * Registers the local storage as plugin. */ @@ -33,4 +33,4 @@ export declare class LokiLocalStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiLocalStorage; +export default LocalStorage; diff --git a/dist/packages/full-text-search-language-en/types/loki/src/clone.d.ts b/dist/packages/full-text-search-language-en/types/loki/src/clone.d.ts index 03b650d7..c74a17bd 100644 --- a/dist/packages/full-text-search-language-en/types/loki/src/clone.d.ts +++ b/dist/packages/full-text-search-language-en/types/loki/src/clone.d.ts @@ -1,10 +1,4 @@ -export declare enum CloneMethod { - PARSE_STRINGIFY = 0, - DEEP = 1, - SHALLOW = 2, - SHALLOW_ASSIGN = 3, - SHALLOW_RECURSE_OBJECTS = 4, -} +export declare type CloneMethod = "parse-stringify" | "deep" | "shallow" | "shallow-recurse-objects"; /** * @hidden */ diff --git a/dist/packages/full-text-search-language-en/types/loki/src/collection.d.ts b/dist/packages/full-text-search-language-en/types/loki/src/collection.d.ts index 8b44c82f..9bd5e091 100644 --- a/dist/packages/full-text-search-language-en/types/loki/src/collection.d.ts +++ b/dist/packages/full-text-search-language-en/types/loki/src/collection.d.ts @@ -1,34 +1,39 @@ import { LokiEventEmitter } from "./event_emitter"; import { UniqueIndex } from "./unique_index"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { DynamicView } from "./dynamic_view"; import { CloneMethod } from "./clone"; -import { Doc, Dict, Query } from "../../common/types"; +import { Doc, Dict } from "../../common/types"; import { FullTextSearch } from "../../full-text-search/src/full_text_search"; import { Tokenizer } from "../../full-text-search/src/tokenizer"; -export declare type ANY = any; export { CloneMethod } from "./clone"; /** * Collection class that handles documents of same type * @extends LokiEventEmitter + * @param - the data type + * @param - nested properties of data type */ -export declare class Collection extends LokiEventEmitter { +export declare class Collection extends LokiEventEmitter { name: string; - data: Doc[]; + _data: Doc[]; private idIndex; - binaryIndices: Dict; + binaryIndices: { + [P in keyof TData]?: Collection.BinaryIndex; + }; /** - * Unique contraints contain duplicate object references, so they are not persisted. - * We will keep track of properties which have unique contraint applied here, and regenerate on load. + * Unique constraints contain duplicate object references, so they are not persisted. + * We will keep track of properties which have unique constraints applied here, and regenerate on load. */ constraints: { - unique: {}; + unique: { + [P in keyof TData]?: UniqueIndex; + }; }; /** * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along * with the database. */ - transforms: {}; + transforms: Dict[]>; /** * In autosave scenarios we will use collection level dirty flags to determine whether save is needed. * currently, if any collection is dirty we will autosave the whole database if autosave is configured. @@ -62,7 +67,7 @@ export declare class Collection extends LokiEventEmit /** * Disable delta update object style on changes. */ - disableDeltaChangesApi: ANY; + disableDeltaChangesApi: boolean; /** * By default, if you insert a document into a collection with binary indices, if those indexed properties contain * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the @@ -72,7 +77,7 @@ export declare class Collection extends LokiEventEmit /** * Option to activate a cleaner daemon - clears "aged" documents at set intervals. */ - ttl: ANY; + ttl: Collection.TTL; private maxId; private _dynamicViews; /** @@ -81,7 +86,15 @@ export declare class Collection extends LokiEventEmit private changes; private insertHandler; private updateHandler; - console: ANY; + console: { + log(...args: any[]): void; + warn(...args: any[]): void; + error(...args: any[]): void; + }; + /** + * stages: a map of uniquely identified 'stages', which hold copies of objects to be + * manipulated without affecting the data in the original collection + */ private stages; private commitLog; _fullTextSearch: FullTextSearch; @@ -97,69 +110,50 @@ export declare class Collection extends LokiEventEmit * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable - * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method + * @param {string} [options.cloneMethod="deep"] - the clone method * @param {number} [options.transactional=false] - ? * @param {number} options.ttl - ? * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @see {@link Loki#addCollection} for normal creation of collections */ - constructor(name: string, options?: Collection.Options); - toJSON(): { - name: string; - _dynamicViews: DynamicView[]; - uniqueNames: string[]; - transforms: {}; - binaryIndices: Dict; - data: Doc[]; - idIndex: number[]; - maxId: number; - dirty: boolean; - adaptiveBinaryIndices: boolean; - transactional: boolean; - asyncListeners: boolean; - disableChangesApi: boolean; - cloneObjects: boolean; - cloneMethod: CloneMethod; - changes: any[]; - _fullTextSearch: FullTextSearch; - }; - static fromJSONObject(obj: ANY, options?: Collection.DeserializeOptions): Collection; + constructor(name: string, options?: Collection.Options); + toJSON(): Collection.Serialized; + static fromJSONObject(obj: Collection.Serialized, options?: Collection.DeserializeOptions): Collection; /** * Adds a named collection transform to the collection * @param {string} name - name to associate with transform * @param {array} transform - an array of transformation 'step' objects to save into the collection */ - addTransform(name: string, transform: ANY[]): void; + addTransform(name: string, transform: Collection.Transform[]): void; /** * Retrieves a named transform from the collection. * @param {string} name - name of the transform to lookup. */ - getTransform(name: string): any; + getTransform(name: string): Collection.Transform[]; /** * Updates a named collection transform to the collection * @param {string} name - name to associate with transform * @param {object} transform - a transformation object to save into collection */ - setTransform(name: string, transform: ANY[]): void; + setTransform(name: string, transform: Collection.Transform[]): void; /** * Removes a named collection transform from the collection * @param {string} name - name of collection transform to remove */ removeTransform(name: string): void; - ttlDaemonFuncGen(): () => void; private setTTL(age, interval); /** * create a row filter that covers all documents in the collection */ - prepareFullDocIndex(): any[]; + _prepareFullDocIndex(): number[]; /** * Ensure binary index on a certain field * @param {string} property - name of property to create binary index on - * @param {boolean} force - (Optional) flag indicating whether to construct index immediately + * @param {boolean} [force=false] - flag indicating whether to construct index immediately */ - ensureIndex(property: string, force?: boolean): void; - getSequencedIndexValues(property: string): string; - ensureUniqueIndex(field: string): UniqueIndex; + ensureIndex(property: keyof TData, force?: boolean): void; + getSequencedIndexValues(property: keyof TData): string; + ensureUniqueIndex(field: keyof TData): UniqueIndex; /** * Ensure all binary indices */ @@ -171,11 +165,11 @@ export declare class Collection extends LokiEventEmit * @param {object} query - (optional) query object to count results of * @returns {number} number of documents in the collection */ - count(query?: object): number; + count(query?: ResultSet.Query & TNested>): number; /** * Rebuild idIndex */ - ensureId(): void; + private _ensureId(); /** * Add a dynamic view to the collection * @param {string} name - name of dynamic view to add @@ -185,7 +179,7 @@ export declare class Collection extends LokiEventEmit * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here) * @returns {DynamicView} reference to the dynamic view added **/ - addDynamicView(name: string, options?: DynamicView.Options): DynamicView; + addDynamicView(name: string, options?: DynamicView.Options): DynamicView; /** * Remove a dynamic view from the collection * @param {string} name - name of dynamic view to remove @@ -196,7 +190,7 @@ export declare class Collection extends LokiEventEmit * @param {string} name - name of dynamic view to retrieve reference of * @returns {DynamicView} A reference to the dynamic view with that name **/ - getDynamicView(name: string): DynamicView; + getDynamicView(name: string): DynamicView; /** * Applies a 'mongo-like' find query object and passes all results to an update function. * For filter function querying you should migrate to [ @@ -205,38 +199,39 @@ export declare class Collection extends LokiEventEmit * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode) * @param {function} updateFunction - update function to run against filtered documents */ - findAndUpdate(filterObject: Query | ((obj: E) => boolean), updateFunction: (obj: E) => E): void; + findAndUpdate(filterObject: ResultSet.Query & TNested> | ((obj: Doc) => boolean), updateFunction: (obj: Doc) => any): void; /** * Applies a 'mongo-like' find query object removes all documents which match that filter. * * @param {object} filterObject - 'mongo-like' query object */ - findAndRemove(filterObject: object): void; + findAndRemove(filterObject: ResultSet.Query & TNested>): void; /** * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc. * @param {(object|array)} doc - the document (or array of documents) to be inserted * @returns {(object|array)} document or documents inserted */ - insert(doc: E | E[]): Doc; - insert(doc: E[]): Doc[]; + insert(doc: TData): Doc; + insert(doc: TData[]): Doc[]; /** * Adds a single object, ensures it has meta properties, clone it if necessary, etc. * @param {object} doc - the document to be inserted * @param {boolean} bulkInsert - quiet pre-insert and insert event emits * @returns {object} document or 'undefined' if there was a problem inserting it */ - insertOne(doc: E, bulkInsert?: boolean): Doc; + insertOne(doc: TData, bulkInsert?: boolean): Doc; /** * Empties the collection. - * @param {object} options - configure clear behavior - * @param {boolean} options.removeIndices - (default: false) + * @param {boolean} [removeIndices=false] - remove indices */ - clear(options?: ANY): void; + clear({removeIndices: removeIndices}?: { + removeIndices?: boolean; + }): void; /** * Updates an object and notifies collection that the document has changed. * @param {object} doc - document to update within the collection */ - update(doc: ANY): any; + update(doc: Doc | Doc[]): void; /** * Add object to collection */ @@ -247,24 +242,24 @@ export declare class Collection extends LokiEventEmit * @param {function} filterFunction - filter function whose results will execute update * @param {function} updateFunction - update function to run against filtered documents */ - updateWhere(filterFunction: (obj: E) => boolean, updateFunction: (obj: E) => E): void; + updateWhere(filterFunction: (obj: Doc) => boolean, updateFunction: (obj: Doc) => any): void; /** * Remove all documents matching supplied filter function. * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}. * @param {function|object} query - query object to filter on */ - removeWhere(query: Query | ((obj: E) => boolean)): void; + removeWhere(query: ResultSet.Query & TNested> | ((obj: Doc) => boolean)): void; removeDataOnly(): void; /** * Remove a document from the collection - * @param {object} doc - document to remove from collection + * @param {number|object} doc - document to remove from collection */ - remove(doc: ANY): any; + remove(doc: number | Doc | Doc[]): void; /** * Returns all changes. - * @returns {ANY} + * @returns {Collection.Change[]} */ - getChanges(): any[]; + getChanges(): Collection.Change[]; /** * Enables/disables changes api. * @param {boolean} disableChangesApi @@ -301,34 +296,35 @@ export declare class Collection extends LokiEventEmit * @returns {(object|array|null)} Object reference if document was found, null if not, * or an array if 'returnPosition' was passed. */ - get(id: number): Doc; - get(id: number, returnPosition: boolean): Doc | [Doc, number]; + get(id: number): Doc; + get(id: number, returnPosition: boolean): Doc | [Doc, number]; /** * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value * Since multiple documents may contain the same value (which the index is sorted on), * we hone in on range and then linear scan range to find exact index array position. - * @param {int} dataPosition : coll.data array index/position + * @param {int} dataPosition : data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - getBinaryIndexPosition(dataPosition: number, binaryIndexName: string): number; + getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData): number; /** * Adaptively insert a selected item to the index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively update a selected item within an index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively remove a selected item from the index. - * @param {int} dataPosition : coll.data array index/position + * @param {number} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in + * @param {boolean} removedFromIndexOnly - remove from index only */ - adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: string, removedFromIndexOnly?: boolean): ANY; + adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly?: boolean): void; /** * Internal method used for index maintenance and indexed searching. * Calculates the beginning of an index range for a given value. @@ -351,7 +347,7 @@ export declare class Collection extends LokiEventEmit private _calculateRangeEnd(prop, val); /** * Binary Search utility method to find range/segment of values matching criteria. - * this is used for collection.find() and first find filter of resultset/dynview + * this is used for collection.find() and first find filter of ResultSet/dynview * slightly different than get() binary search in that get() hones in on 1 value, * but we have to hone in on many (range) * @param {string} op - operation, such as $eq @@ -359,29 +355,29 @@ export declare class Collection extends LokiEventEmit * @param {object} val - value to use for range calculation. * @returns {array} [start, end] index array positions */ - calculateRange(op: string, prop: string, val: ANY): [number, number]; + calculateRange(op: string, prop: keyof TData, val: any): [number, number]; /** * Retrieve doc by Unique index * @param {string} field - name of uniquely indexed property to use when doing lookup * @param {any} value - unique value to search for * @returns {object} document matching the value passed */ - by(field: string, value: ANY): Doc; + by(field: string, value: any): Doc; /** * Find one object by index property, by property equal to value * @param {object} query - query object used to perform search with * @returns {(object|null)} First matching document, or null if none */ - findOne(query: object): Doc; + findOne(query: ResultSet.Query & TNested>): Doc; /** * Chain method, used for beginning a series of chained find() and/or view() operations * on a collection. * * @param {array} transform - Ordered array of transform step objects similar to chain * @param {object} parameters - Object containing properties representing parameters to substitute - * @returns {Resultset} (this) resultset, or data array if any map or join functions where called + * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called */ - chain(transform?: string | ANY[], parameters?: ANY): Resultset; + chain(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** * Find method, api is similar to mongodb. * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}. @@ -389,20 +385,26 @@ export declare class Collection extends LokiEventEmit * @param {object} query - 'mongo-like' query object * @returns {array} Array of matching documents */ - find(query?: Query): Doc[]; + find(query?: ResultSet.Query & TNested>): Doc[]; /** * Find object by unindexed field by property equal to value, * simply iterates and returns the first element matching the query */ - findOneUnindexed(prop: string, value: ANY): Doc; + findOneUnindexed(prop: string, value: any): Doc; /** * Transaction methods */ - /** start the transation */ + /** + * start the transation + */ startTransaction(): void; - /** commit the transation */ + /** + * commit the transation + */ commit(): void; - /** roll back the transation */ + /** + * roll back the transation + */ rollback(): void; /** * Query the collection by supplying a javascript filter function. @@ -414,14 +416,14 @@ export declare class Collection extends LokiEventEmit * @param {function} fun - filter function to run against all collection docs * @returns {array} all documents which pass your filter function */ - where(fun: (obj: E) => boolean): Doc[]; + where(fun: (obj: Doc) => boolean): Doc[]; /** * Map Reduce operation * @param {function} mapFunction - function to use as map function * @param {function} reduceFunction - function to use as reduce function * @returns {data} The result of your mapReduce operation */ - mapReduce(mapFunction: (value: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (value: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Join two collections on specified properties * @@ -429,13 +431,13 @@ export declare class Collection extends LokiEventEmit * @param {string} leftJoinProp - property name in collection * @param {string} rightJoinProp - property name in joinData * @param {function} mapFun - (Optional) map function to use - * @returns {Resultset} Result of the mapping operation - */ - eqJoin(joinData: ANY[], leftJoinProp: string, rightJoinProp: string, mapFun?: Function): Resultset; - /** - * stages: a map of uniquely identified 'stages', which hold copies of objects to be - * manipulated without affecting the data in the original collection + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method + * @returns {ResultSet} Result of the mapping operation */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinProp: string | ((obj: any) => string), rightJoinProp: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * (Staging API) create a stage and/or retrieve it */ @@ -446,7 +448,7 @@ export declare class Collection extends LokiEventEmit /** * (Staging API) create a copy of an object and insert it into a stage */ - stage(stageName: string, obj: ANY): any; + stage(stageName: string, obj: Doc): F; /** * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt * then create a message to be inserted in the commitlog @@ -459,10 +461,10 @@ export declare class Collection extends LokiEventEmit extract(field: string): any[]; /** */ - max(field: string): any; + max(field: string): number; /** */ - min(field: string): any; + min(field: string): number; /** */ maxRecord(field: string): { @@ -500,9 +502,9 @@ export declare class Collection extends LokiEventEmit median(field: string): number; } export declare namespace Collection { - interface Options { - unique?: string[]; - indices?: string[]; + interface Options { + unique?: (keyof TData)[]; + indices?: (keyof TData)[]; adaptiveBinaryIndices?: boolean; asyncListeners?: boolean; disableChangesApi?: boolean; @@ -518,10 +520,89 @@ export declare namespace Collection { interface DeserializeOptions { retainDirtyFlags?: boolean; fullTextSearch?: Dict; + [collName: string]: any | { + proto?: any; + inflate?: (src: object, dest?: object) => void; + }; } interface BinaryIndex { dirty: boolean; values: any; } - type Change = any; + interface Change { + name: string; + operation: string; + obj: any; + } + interface Serialized { + name: string; + _dynamicViews: DynamicView[]; + uniqueNames: string[]; + transforms: Dict; + binaryIndices: Dict; + _data: Doc[]; + idIndex: number[]; + maxId: number; + dirty: boolean; + adaptiveBinaryIndices: boolean; + transactional: boolean; + asyncListeners: boolean; + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + cloneObjects: boolean; + cloneMethod: CloneMethod; + changes: any; + _fullTextSearch: FullTextSearch; + } + type Transform = { + type: "find"; + value: ResultSet.Query & TNested> | string; + } | { + type: "where"; + value: ((obj: Doc) => boolean) | string; + } | { + type: "simplesort"; + property: keyof (TData & TNested); + desc?: boolean; + } | { + type: "compoundsort"; + value: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]; + } | { + type: "sort"; + value: (a: Doc, b: Doc) => number; + } | { + type: "sortByScoring"; + desc?: boolean; + } | { + type: "limit"; + value: number; + } | { + type: "offset"; + value: number; + } | { + type: "map"; + value: (obj: TData, index: number, array: TData[]) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "eqJoin"; + joinData: Collection | ResultSet; + leftJoinKey: string | ((obj: any) => string); + rightJoinKey: string | ((obj: any) => string); + mapFun?: (left: any, right: any) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "mapReduce"; + mapFunction: (item: TData, index: number, array: TData[]) => any; + reduceFunction: (array: any[]) => any; + } | { + type: "update"; + value: (obj: Doc) => any; + } | { + type: "remove"; + }; + interface TTL { + age: number; + ttlInterval: number; + daemon: any; + } } diff --git a/dist/packages/full-text-search-language-en/types/loki/src/dynamic_view.d.ts b/dist/packages/full-text-search-language-en/types/loki/src/dynamic_view.d.ts index 1aeab3a4..5cda4b13 100644 --- a/dist/packages/full-text-search-language-en/types/loki/src/dynamic_view.d.ts +++ b/dist/packages/full-text-search-language-en/types/loki/src/dynamic_view.d.ts @@ -1,9 +1,8 @@ import { LokiEventEmitter } from "./event_emitter"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { Collection } from "./collection"; -import { Doc, Filter } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; /** * DynamicView class is a versatile 'live' view class which can have filters and sorts applied. * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it @@ -18,18 +17,21 @@ export declare type ANY = any; * @extends LokiEventEmitter * @see {@link Collection#addDynamicView} to construct instances of DynamicView + * + * @param - the data type + * @param - nested properties of data type */ -export declare class DynamicView extends LokiEventEmitter { +export declare class DynamicView extends LokiEventEmitter { private _collection; private _persistent; private _sortPriority; private _minRebuildInterval; name: string; private _rebuildPending; - private _resultset; - private _resultdata; - private _resultsdirty; - private _cachedresultset; + private _resultSet; + private _resultData; + private _resultDirty; + private _cachedResultSet; private _filterPipeline; private _sortFunction; private _sortCriteria; @@ -41,10 +43,10 @@ export declare class DynamicView extends LokiEventEmi * @param {string} name - the name of this dynamic view * @param {object} options - the options * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' - * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority + * @param {string} [options.sortPriority="passive"] - the sort priority * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here) */ - constructor(collection: Collection, name: string, options?: DynamicView.Options); + constructor(collection: Collection, name: string, options?: DynamicView.Options); /** * Internally used immediately after deserialization (loading) * This will clear out and reapply filterPipeline ops, recreating the view. @@ -57,34 +59,22 @@ export declare class DynamicView extends LokiEventEmi */ _rematerialize({removeWhereFilters}: { removeWhereFilters?: boolean; - }): DynamicView; + }): this; /** - * Makes a copy of the internal resultset for branched queries. - * Unlike this dynamic view, the branched resultset will not be 'live' updated, + * Makes a copy of the internal ResultSet for branched queries. + * Unlike this dynamic view, the branched ResultSet will not be 'live' updated, * so your branched query should be immediately resolved and not held for future evaluation. * * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps * @param {object} parameters - optional parameters (if optional transform requires them) - * @returns {Resultset} A copy of the internal resultset for branched queries. + * @returns {ResultSet} A copy of the internal ResultSet for branched queries. */ - branchResultset(transform: string | any[], parameters?: object): Resultset; + branchResultSet(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** - * toJSON() - Override of toJSON to avoid circular references - * + * Override of toJSON to avoid circular references. */ - toJSON(): { - name: string; - _persistent: boolean; - _sortPriority: DynamicView.SortPriority; - _minRebuildInterval: number; - _resultset: Resultset; - _resultsdirty: boolean; - _filterPipeline: Filter[]; - _sortCriteria: (string | [string, boolean])[]; - _sortByScoring: boolean; - _sortDirty: boolean; - }; - static fromJSONObject(collection: ANY, obj: ANY): DynamicView; + toJSON(): DynamicView.Serialized; + static fromJSONObject(collection: Collection, obj: DynamicView.Serialized): DynamicView; /** * Used to clear pipeline and reset dynamic view to initial state. * Existing options should be retained. @@ -105,7 +95,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} comparefun - a javascript compare function used for sorting * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySort(comparefun: (lhs: E, rhs: E) => number): DynamicView; + applySort(comparefun: (lhs: Doc, rhs: Doc) => number): this; /** * Used to specify a property used for view translation. * @example @@ -115,9 +105,9 @@ export declare class DynamicView extends LokiEventEmi * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySimpleSort(propname: string, isdesc?: boolean): DynamicView; + applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * dv.applySortCriteria(['age', 'name']); @@ -129,32 +119,32 @@ export declare class DynamicView extends LokiEventEmi * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations. */ - applySortCriteria(criteria: (string | [string, boolean])[]): DynamicView; + applySortCriteria(criteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Used to apply a sort by the latest full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending */ - applySortByScoring(ascending?: boolean): DynamicView; + applySortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** * Marks the beginning of a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - startTransaction(): DynamicView; + startTransaction(): this; /** * Commits a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - commit(): DynamicView; + commit(): this; /** * Rolls back a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - rollback(): DynamicView; + rollback(): this; /** * Find the index of a filter in the pipeline, by that filter's ID. * @@ -163,7 +153,7 @@ export declare class DynamicView extends LokiEventEmi */ private _indexOfFilterWithId(uid); /** - * Add the filter object to the end of view's filter pipeline and apply the filter to the resultset. + * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet. * * @param {object} filter - The filter object. Refer to applyFilter() for extra details. */ @@ -173,7 +163,7 @@ export declare class DynamicView extends LokiEventEmi * * @returns {DynamicView} this DynamicView object, for further chain ops. */ - reapplyFilters(): DynamicView; + reapplyFilters(): this; /** * Adds or updates a filter in the DynamicView filter pipeline * @@ -181,7 +171,7 @@ export declare class DynamicView extends LokiEventEmi * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id } * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFilter(filter: Filter): DynamicView; + applyFilter(filter: DynamicView.Filter): this; /** * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline * @@ -189,7 +179,7 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFind(query: object, uid?: string | number): DynamicView; + applyFind(query: object, uid?: string | number): this; /** * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline * @@ -197,14 +187,14 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyWhere(fun: (obj: E) => boolean, uid?: string | number): DynamicView; + applyWhere(fun: (obj: Doc) => boolean, uid?: string | number): this; /** * removeFilter() - Remove the specified filter from the DynamicView filter pipeline * * @param {(string|number)} uid - The unique ID of the filter to be removed. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - removeFilter(uid: string | number): DynamicView; + removeFilter(uid: string | number): this; /** * Returns the number of documents representing the current DynamicView contents. * @returns {number} The number of documents representing the current DynamicView contents. @@ -213,16 +203,16 @@ export declare class DynamicView extends LokiEventEmi /** * Resolves and pending filtering and sorting, then returns document array as result. * - * @param {object} options - optional parameters to pass to resultset.data() if non-persistent - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * * @returns {Array} An array of documents representing the current DynamicView contents. */ - data(options?: object): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** * When the view is not sorted we may still wish to be notified of rebuild events. * This event will throttle and queue a single rebuild event when batches of updates affect the view. @@ -257,7 +247,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; } export declare namespace DynamicView { interface Options { @@ -265,8 +255,25 @@ export declare namespace DynamicView { sortPriority?: SortPriority; minRebuildInterval?: number; } - enum SortPriority { - PASSIVE = 0, - ACTIVE = 1, + type SortPriority = "passive" | "active"; + interface Serialized { + name: string; + _persistent: boolean; + _sortPriority: SortPriority; + _minRebuildInterval: number; + _resultSet: ResultSet; + _filterPipeline: Filter[]; + _sortCriteria: (string | [string, boolean])[]; + _sortByScoring: boolean; + _sortDirty: boolean; } + type Filter = { + type: "find"; + val: ResultSet.Query & TNested>; + uid: number | string; + } | { + type: "where"; + val: (obj: Doc) => boolean; + uid: number | string; + }; } diff --git a/dist/packages/full-text-search-language-en/types/loki/src/event_emitter.d.ts b/dist/packages/full-text-search-language-en/types/loki/src/event_emitter.d.ts index f422ee35..e55515e9 100644 --- a/dist/packages/full-text-search-language-en/types/loki/src/event_emitter.d.ts +++ b/dist/packages/full-text-search-language-en/types/loki/src/event_emitter.d.ts @@ -1,4 +1,3 @@ -export declare type ANY = any; /** * LokiEventEmitter is a minimalist version of EventEmitter. It enables any * constructor that inherits EventEmitter to emit events and trigger @@ -31,7 +30,7 @@ export declare class LokiEventEmitter { * @param {string} eventName - the name of the event * @param {object} data - optional object passed with the event */ - emit(eventName: string, ...data: ANY[]): void; + emit(eventName: string, ...data: any[]): void; /** * Alias of LokiEventEmitter.prototype.on * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event diff --git a/dist/packages/full-text-search-language-en/types/loki/src/helper.d.ts b/dist/packages/full-text-search-language-en/types/loki/src/helper.d.ts index b187e0eb..44b72305 100644 --- a/dist/packages/full-text-search-language-en/types/loki/src/helper.d.ts +++ b/dist/packages/full-text-search-language-en/types/loki/src/helper.d.ts @@ -1,8 +1,5 @@ /** - * @hidden - */ -export declare type ANY = any; -/** Helper function for determining 'loki' abstract equality which is a little more abstract than == + * Helper function for determining 'loki' abstract equality which is a little more abstract than == * aeqHelper(5, '5') === true * aeqHelper(5.0, '5') === true * aeqHelper(new Date("1/1/2011"), new Date("1/1/2011")) === true @@ -10,34 +7,33 @@ export declare type ANY = any; * aeqHelper([1, 2, 3], [1, 3]) === false * aeqHelper([1, 2, 3], [1, 2, 3]) === true * aeqHelper(undefined, null) === true - */ -/** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @returns {boolean} + * @hidden */ -export declare function aeqHelper(prop1: ANY, prop2: ANY): boolean; -/** Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. +export declare function aeqHelper(prop1: any, prop2: any): boolean; +/** + * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. * In the future we might want $lt and $gt ops to use their own functionality/helper. * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another. * @hidden */ -export declare function ltHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function ltHelper(prop1: any, prop2: any, equal: boolean): boolean; /** * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @param {boolean} equal * @returns {boolean} */ -export declare function gtHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function gtHelper(prop1: any, prop2: any, equal: boolean): boolean; /** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 - * @param {ANY} desc + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} descending * @returns {number} + * @hidden */ -export declare function sortHelper(prop1: ANY, prop2: ANY, desc: ANY): 0 | 1 | -1; +export declare function sortHelper(prop1: any, prop2: any, descending: boolean): number; diff --git a/dist/packages/full-text-search-language-en/types/loki/src/index.d.ts b/dist/packages/full-text-search-language-en/types/loki/src/index.d.ts index dee82236..17ee6df4 100644 --- a/dist/packages/full-text-search-language-en/types/loki/src/index.d.ts +++ b/dist/packages/full-text-search-language-en/types/loki/src/index.d.ts @@ -1,7 +1,4 @@ import { Loki } from "./loki"; import { Collection } from "./collection"; export { Loki, Collection }; -declare const _default: { - Loki: typeof Loki; -}; -export default _default; +export default Loki; diff --git a/dist/packages/full-text-search-language-en/types/loki/src/loki.d.ts b/dist/packages/full-text-search-language-en/types/loki/src/loki.d.ts index 10e81b65..f2deafd2 100644 --- a/dist/packages/full-text-search-language-en/types/loki/src/loki.d.ts +++ b/dist/packages/full-text-search-language-en/types/loki/src/loki.d.ts @@ -1,7 +1,6 @@ import { LokiEventEmitter } from "./event_emitter"; import { Collection } from "./collection"; import { Doc, StorageAdapter } from "../../common/types"; -export declare type ANY = any; export declare class Loki extends LokiEventEmitter { private filename; private databaseVersion; @@ -23,7 +22,7 @@ export declare class Loki extends LokiEventEmitter { * Constructs the main database class. * @param {string} filename - name of the file to be saved to * @param {object} [options={}] - options - * @param {Loki.Environment} [options.env=auto] - overrides environment detection + * @param {Loki.Environment} [options.env] - the javascript environment * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method * @param {string} [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization * @param {boolean} [options.verbose=false] - enable console output @@ -64,21 +63,21 @@ export declare class Loki extends LokiEventEmitter { * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @returns {Collection} a reference to the collection which was just added */ - addCollection(name: string, options?: Collection.Options): Collection; + addCollection(name: string, options?: Collection.Options): Collection; loadCollection(collection: Collection): void; /** * Retrieves reference to a collection by name. * @param {string} collectionName - name of collection to look up * @returns {Collection} Reference to collection in database by that name, or null if not found */ - getCollection(collectionName: string): Collection; + getCollection(collectionName: string): Collection; /** * Renames an existing loki collection * @param {string} oldName - name of collection to rename * @param {string} newName - new name of collection * @returns {Collection} reference to the newly renamed collection */ - renameCollection(oldName: string, newName: string): Collection<{}>; + renameCollection(oldName: string, newName: string): Collection; listCollections(): { name: string; count: number; @@ -95,20 +94,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {string} Stringified representation of the loki database. */ serialize(options?: Loki.SerializeOptions): string | string[]; - toJSON(): { - _env: Loki.Environment; - _serializationMethod: Loki.SerializationMethod; - _autosave: boolean; - _autosaveInterval: number; - _collections: Collection[]; - databaseVersion: number; - engineVersion: number; - filename: string; - _persistenceAdapter: StorageAdapter; - _persistenceMethod: Loki.PersistenceMethod; - _throttledSaves: boolean; - _verbose: boolean; - }; + toJSON(): Loki.Serialized; /** * Database level destructured JSON serialization routine to allow alternate serialization methods. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -134,7 +120,11 @@ export declare class Loki extends LokiEventEmitter { * * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection. */ - serializeCollection(options?: ANY): string | string[]; + serializeCollection(options?: { + delimited?: boolean; + collectionIndex?: number; + delimiter?: string; + }): string | string[]; /** * Database level destructured JSON deserialization routine to minimize memory overhead. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -150,7 +140,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array */ - deserializeDestructured(destructuredSource: ANY, options?: Loki.SerializeDestructuredOptions): any; + deserializeDestructured(destructuredSource: string | string[], options?: Loki.SerializeDestructuredOptions): any; /** * Collection level utility function to deserializes a destructured collection. * @@ -161,7 +151,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {Array} an array of documents to attach to collection.data. */ - deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc; + deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc[]; /** * Inflates a loki database from a serialized JSON string * @@ -169,15 +159,16 @@ export declare class Loki extends LokiEventEmitter { * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSON(serializedDb: string | string[], options?: ANY): void; + loadJSON(serializedDb: string | string[], options?: Collection.DeserializeOptions): void; /** * Inflates a loki database from a JS object * - * @param {object} dbObject - a serialized loki database string + * @param {object} dbObject - a serialized loki database object * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSONObject(dbObject: ANY, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki.Serialized, options?: Collection.DeserializeOptions): void; /** * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer. * Does not actually destroy the db. @@ -201,7 +192,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {Array} array of changes * @see private method _createChange() in Collection */ - generateChangesNotification(arrayOfCollectionNames?: string[]): any[]; + generateChangesNotification(arrayOfCollectionNames?: string[]): Collection.Change[]; /** * (Changes API) - stringify changes for network transmission * @returns {string} string representation of the changes @@ -310,24 +301,22 @@ export declare namespace Loki { recursiveWaitLimitDuration?: number; started?: Date; } - type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; - enum SerializationMethod { - NORMAL = 0, - PRETTY = 1, - DESTRUCTURED = 2, - } - enum PersistenceMethod { - FS_STORAGE = 0, - LOCAL_STORAGE = 1, - INDEXED_STORAGE = 2, - MEMORY_STORAGE = 3, - ADAPTER = 4, - } - enum Environment { - NODE_JS = 0, - NATIVE_SCRIPT = 1, - BROWSER = 2, - CORDOVA = 3, - MEMORY = 4, + interface Serialized { + _env: Environment; + _serializationMethod: SerializationMethod; + _autosave: boolean; + _autosaveInterval: number; + _collections: Collection[]; + databaseVersion: number; + engineVersion: number; + filename: string; + _persistenceAdapter: StorageAdapter; + _persistenceMethod: PersistenceMethod; + _throttledSaves: boolean; + _verbose: boolean; } + type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; + type SerializationMethod = "normal" | "pretty" | "destructured"; + type PersistenceMethod = "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter"; + type Environment = "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "MEMORY"; } diff --git a/dist/packages/full-text-search-language/types/loki/src/resultset.d.ts b/dist/packages/full-text-search-language-en/types/loki/src/result_set.d.ts similarity index 52% rename from dist/packages/full-text-search-language/types/loki/src/resultset.d.ts rename to dist/packages/full-text-search-language-en/types/loki/src/result_set.d.ts index 8ee6b343..b29e3a52 100644 --- a/dist/packages/full-text-search-language/types/loki/src/resultset.d.ts +++ b/dist/packages/full-text-search-language-en/types/loki/src/result_set.d.ts @@ -1,8 +1,8 @@ import { Collection } from "./collection"; import { CloneMethod } from "./clone"; -import { Doc, Query } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; +import { Query as FullTextSearchQuery } from "../../full-text-search/src/query_builder"; /** * @hidden */ @@ -15,29 +15,29 @@ export declare const LokiOps: { $gte(a: any, b: any): boolean; $lt(a: any, b: any): boolean; $lte(a: any, b: any): boolean; - $between(a: any, vals: any): boolean; + $between(a: any, range: [any, any]): boolean; $in(a: any, b: any): boolean; $nin(a: any, b: any): boolean; - $keyin(a: any, b: any): boolean; - $nkeyin(a: any, b: any): boolean; - $definedin(a: any, b: any): boolean; - $undefinedin(a: any, b: any): boolean; - $regex(a: any, b: any): any; - $containsString(a: any, b: any): boolean; + $keyin(a: string, b: object): boolean; + $nkeyin(a: string, b: object): boolean; + $definedin(a: string, b: object): boolean; + $undefinedin(a: string, b: object): boolean; + $regex(a: string, b: RegExp): boolean; + $containsString(a: any, b: string): boolean; $containsNone(a: any, b: any): boolean; - $containsAny(a: any, b: any): any; - $contains(a: any, b: any): any; - $type(a: any, b: any): any; - $finite(a: any, b: any): boolean; - $size(a: any, b: any): any; - $len(a: any, b: any): any; + $containsAny(a: any, b: any): boolean; + $contains(a: any, b: any): boolean; + $type(a: any, b: any): boolean; + $finite(a: number, b: boolean): boolean; + $size(a: any, b: any): boolean; + $len(a: any, b: any): boolean; $where(a: any, b: any): boolean; $not(a: any, b: any): boolean; $and(a: any, b: any): boolean; $or(a: any, b: any): boolean; }; /** - * Resultset class allowing chainable queries. Intended to be instanced internally. + * ResultSet class allowing chainable queries. Intended to be instanced internally. * Collection.find(), Collection.where(), and Collection.chain() instantiate this. * * @example @@ -45,61 +45,64 @@ export declare const LokiOps: { * .find({ 'doors' : 4 }) * .where(function(obj) { return obj.name === 'Toyota' }) * .data(); + * + * @param - the data type + * @param - nested properties of data type */ -export declare class Resultset { - collection: Collection; - filteredrows: number[]; - filterInitialized: boolean; +export declare class ResultSet { + _collection: Collection; + _filteredRows: number[]; + _filterInitialized: boolean; private _scoring; /** * Constructor. - * @param {Collection} collection - the collection which this Resultset will query against + * @param {Collection} collection - the collection which this ResultSet will query against */ - constructor(collection: Collection); + constructor(collection: Collection); /** - * reset() - Reset the resultset to its initial state. + * reset() - Reset the ResultSet to its initial state. * - * @returns {Resultset} Reference to this resultset, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, for future chain operations. */ - reset(): Resultset; + reset(): this; /** - * toJSON() - Override of toJSON to avoid circular references + * Override of toJSON to avoid circular references * */ - toJSON(): Resultset; + toJSON(): ResultSet; /** * Allows you to limit the number of documents passed to next chain operation. - * A resultset copy() is made to avoid altering original resultset. + * A ResultSet copy() is made to avoid altering original ResultSet. * * @param {int} qty - The number of documents to return. - * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops. + * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops. */ - limit(qty: number): Resultset; + limit(qty: number): this; /** - * Used for skipping 'pos' number of documents in the resultset. + * Used for skipping 'pos' number of documents in the ResultSet. * * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. - * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. + * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops. */ - offset(pos: number): Resultset; + offset(pos: number): this; /** - * copy() - To support reuse of resultset in branched query situations. + * copy() - To support reuse of ResultSet in branched query situations. * - * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same. + * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same. */ - copy(): Resultset; + copy(): ResultSet; /** * Alias of copy() */ - branch(): Resultset; + branch(): ResultSet; /** - * Executes a named collection transform or raw array of transform steps against the resultset. + * Executes a named collection transform or raw array of transform steps against the ResultSet. * * @param {(string|array)} transform - name of collection transform or raw transform array * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. - * @returns {Resultset} either (this) resultset or a clone of of this resultset (depending on steps) + * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps) */ - transform(transform: string | any[], parameters?: object): Resultset; + transform(transform: string | Collection.Transform[], parameters?: object): this; /** * User supplied compare function is provided two documents to compare. (chainable) * @example @@ -110,20 +113,20 @@ export declare class Resultset { * }); * * @param {function} comparefun - A javascript compare function used for sorting. - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - sort(comparefun: (a: E, b: E) => number): Resultset; + sort(comparefun: (a: Doc, b: Doc) => number): this; /** * Simpler, loose evaluation for user to sort based on a property name. (chainable). * Sorting based on the same lt/gt helper functions used for binary indices. * * @param {string} propname - name of property to sort by. - * @param {boolean} isdesc - (Optional) If true, the property will be sorted in descending order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @param {boolean} [descending=false] - if true, the property will be sorted in descending order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - simplesort(propname: string, isdesc?: boolean): Resultset; + simplesort(propname: keyof (TData & TNested), descending?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * rs.compoundsort(['age', 'name']); @@ -131,9 +134,9 @@ export declare class Resultset { * rs.compoundsort(['age', ['name', true]); * * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - compoundsort(properties: (string | [string, boolean])[]): Resultset; + compoundsort(properties: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Helper function for compoundsort(), performing individual object comparisons * @@ -144,83 +147,83 @@ export declare class Resultset { */ private _compoundeval(properties, obj1, obj2); /** - * Sorts the resultset based on the last full-text-search scoring. + * Sorts the ResultSet based on the last full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending - * @returns {Resultset} + * @returns {ResultSet} */ - sortByScoring(ascending?: boolean): Resultset; + sortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** - * findOr() - oversee the operation of OR'ed query expressions. + * Oversee the operation of OR'ed query expressions. * OR'ed expression evaluation runs each expression individually against the full collection, * and finally does a set OR on each expression's results. * Each evaluation can utilize a binary index to prevent multiple linear array scans. * * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - findOr(expressionArray: Query[]): Resultset; - $or(expressionArray: Query[]): Resultset; + findOr(expressionArray: ResultSet.Query & TNested>[]): this; + $or(expressionArray: ResultSet.Query & TNested>[]): this; /** - * findAnd() - oversee the operation of AND'ed query expressions. + * Oversee the operation of AND'ed query expressions. * AND'ed expression evaluation runs each expression progressively against the full collection, - * internally utilizing existing chained resultset functionality. + * internally utilizing existing chained ResultSet functionality. * Only the first filter can utilize a binary index. * * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - findAnd(expressionArray: Query[]): Resultset; - $and(expressionArray: Query[]): Resultset; + findAnd(expressionArray: ResultSet.Query & TNested>[]): this; + $and(expressionArray: ResultSet.Query & TNested>[]): this; /** * Used for querying via a mongo-style query object. * * @param {object} query - A mongo-style query object used for filtering current results. * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - find(query?: Query, firstOnly?: boolean): Resultset; + find(query?: ResultSet.Query & TNested>, firstOnly?: boolean): this; /** * Used for filtering via a javascript filter function. * * @param {function} fun - A javascript function used for filtering current results by. - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - where(fun: (obj: E) => boolean): Resultset; + where(fun: (obj: Doc) => boolean): this; /** - * Returns the number of documents in the resultset. - * @returns {number} The number of documents in the resultset. + * Returns the number of documents in the ResultSet. + * @returns {number} The number of documents in the ResultSet. */ count(): number; /** * Terminates the chain and returns array of filtered documents * @param {object} options - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values 'parse-stringify', 'deep', and 'shallow' and + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * - * @returns {Array} Array of documents in the resultset + * @returns {Array} Array of documents in the ResultSet */ - data(options?: Resultset.DataOptions): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** - * Used to run an update operation on all documents currently in the resultset. + * Used to run an update operation on all documents currently in the ResultSet. * * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - update(updateFunction: (obj: E) => E): Resultset; + update(updateFunction: (obj: Doc) => TData): this; /** - * Removes all document objects which are currently in resultset from collection (as well as resultset) + * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet) * - * @returns {Resultset} this (empty) resultset for further chain ops. + * @returns {ResultSet} this (empty) ResultSet for further chain ops. */ - remove(): Resultset; + remove(): this; /** * data transformation via user supplied functions * @@ -228,35 +231,72 @@ export declare class Resultset { * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns {value} The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Left joining two sets of data. Join keys can be defined or calculated properties * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key - * @param {Array|Resultset|Collection} joinData - Data array to join to. + * @param {Array|ResultSet|Collection} joinData - Data array to join to. * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}] + * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method + * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}] */ - eqJoin(joinData: ANY, leftJoinKey: string | Function, rightJoinKey: string | Function, mapFun?: Function, dataOptions?: ANY): ANY; + eqJoin(joinData: Collection | ResultSet | any[], leftJoinKey: string | ((obj: any) => string), rightJoinKey: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * Applies a map function into a new collection for further chaining. * @param {function} mapFun - javascript map function * @param {object} [dataOptions=] - options to data() before input to your map function * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method + * @return {ResultSet} */ - map(mapFun: (obj: E, index: number, array: E[]) => U, dataOptions?: Resultset.DataOptions): Resultset; + map(mapFun: (obj: TData, index: number, array: TData[]) => U, dataOptions?: ResultSet.DataOptions): ResultSet; } -export declare namespace Resultset { +export declare namespace ResultSet { interface DataOptions { forceClones?: boolean; forceCloneMethod?: CloneMethod; removeMeta?: boolean; } + type LokiOps = { + $eq?: R; + $aeq?: R; + $ne?: R; + $dteq?: R; + $gt?: R; + $gte?: R; + $lt?: R; + $lte?: R; + $between?: [R, R]; + $in?: R[]; + $nin?: R[]; + $keyin?: object; + $nkeyin?: object; + $definedin?: object; + $undefinedin?: object; + $regex?: RegExp | string | [string, string]; + $containsString?: string; + $containsNone?: R[] | R; + $containsAny?: R[] | R; + $contains?: any; + $type?: string; + $finite?: boolean; + $size?: number; + $len?: number; + $where?: (val?: R) => boolean; + }; + type Query = { + [P in keyof TData]?: LokiOps | TData[P]; + } & { + $and?: Query[]; + } & { + $or?: Query[]; + } & { + $fts?: FullTextSearchQuery; + }; } diff --git a/dist/packages/full-text-search-language-en/types/loki/src/unique_index.d.ts b/dist/packages/full-text-search-language-en/types/loki/src/unique_index.d.ts index 40312618..55284c11 100644 --- a/dist/packages/full-text-search-language-en/types/loki/src/unique_index.d.ts +++ b/dist/packages/full-text-search-language-en/types/loki/src/unique_index.d.ts @@ -1,30 +1,30 @@ import { Doc } from "../../common/types"; -export declare class UniqueIndex { +export declare class UniqueIndex { private _field; private _keyMap; /** * Constructs an unique index object. * @param {number|string} propertyField - the property field to index */ - constructor(propertyField: number | string); + constructor(propertyField: keyof E); /** * Sets a document's unique index. * @param {Doc} doc - the document * @param {number} row - the data row of the document */ - set(doc: Doc, row: number): void; + set(doc: Doc, row: number): void; /** * Returns the data row of an unique index. * @param {number|string} index - the index * @returns {number | string} - the row */ - get(index: number | string): number; + get(index: keyof E): number; /** * Updates a document's unique index. * @param {Object} doc - the document * @param {number} row - the data row of the document */ - update(doc: Doc, row: number): void; + update(doc: Doc, row: number): void; /** * Removes an unique index. * @param {number|string} index - the unique index diff --git a/dist/packages/full-text-search-language-en/types/memory-storage/src/index.d.ts b/dist/packages/full-text-search-language-en/types/memory-storage/src/index.d.ts new file mode 100644 index 00000000..5330aa7d --- /dev/null +++ b/dist/packages/full-text-search-language-en/types/memory-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { MemoryStorage } from "./memory_storage"; +export { MemoryStorage }; +export default MemoryStorage; diff --git a/dist/packages/full-text-search-language-de/types/loki/src/memory_adapter.d.ts b/dist/packages/full-text-search-language-en/types/memory-storage/src/memory_storage.d.ts similarity index 61% rename from dist/packages/full-text-search-language-de/types/loki/src/memory_adapter.d.ts rename to dist/packages/full-text-search-language-en/types/memory-storage/src/memory_storage.d.ts index 7b97c7f7..0066a1de 100644 --- a/dist/packages/full-text-search-language-de/types/loki/src/memory_adapter.d.ts +++ b/dist/packages/full-text-search-language-en/types/memory-storage/src/memory_storage.d.ts @@ -1,19 +1,29 @@ -import { StorageAdapter } from "../../common/types"; -export declare type ANY = any; +import { Dict, StorageAdapter } from "../../common/types"; /** - * In in-memory persistence adapter for an in-memory database. + * An in-memory persistence adapter for an in-memory database. * This simple 'key/value' adapter is intended for unit testing and diagnostics. */ -export declare class LokiMemoryAdapter implements StorageAdapter { - private hashStore; - private options; +export declare class MemoryStorage implements StorageAdapter { + hashStore: Dict<{ + savecount: number; + lastsave: Date; + value: string; + }>; + options: MemoryStorage.Options; /** - * @param {object} options - memory adapter options + * Registers the local storage as plugin. + */ + static register(): void; + /** + * Deregisters the local storage as plugin. + */ + static deregister(): void; + /** + * @param {object} options - memory storage options * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) - * @param {ANY} options */ - constructor(options?: ANY); + constructor(options?: MemoryStorage.Options); /** * Loads a serialized database from its in-memory store. * (Loki persistence adapter interface function) @@ -27,6 +37,7 @@ export declare class LokiMemoryAdapter implements StorageAdapter { * (Loki persistence adapter interface function) * * @param {string} dbname - name of the database (filename/keyname) + * @param {string} dbstring - the database content * @returns {Promise} a Promise that resolves after the database was persisted */ saveDatabase(dbname: string, dbstring: string): Promise; @@ -38,3 +49,9 @@ export declare class LokiMemoryAdapter implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } +export declare namespace MemoryStorage { + interface Options { + asyncResponses?: boolean; + asyncTimeout?: number; + } +} diff --git a/dist/packages/full-text-search-language-en/types/partitioning-adapter/src/index.d.ts b/dist/packages/full-text-search-language-en/types/partitioning-adapter/src/index.d.ts new file mode 100644 index 00000000..bf49882f --- /dev/null +++ b/dist/packages/full-text-search-language-en/types/partitioning-adapter/src/index.d.ts @@ -0,0 +1,3 @@ +import { PartitioningAdapter } from "./partitioning_adapter"; +export { PartitioningAdapter }; +export default PartitioningAdapter; diff --git a/dist/packages/full-text-search-language-en/types/partitioning-adapter/src/partitioning_adapter.d.ts b/dist/packages/full-text-search-language-en/types/partitioning-adapter/src/partitioning_adapter.d.ts index ff9568cf..45e14850 100644 --- a/dist/packages/full-text-search-language-en/types/partitioning-adapter/src/partitioning_adapter.d.ts +++ b/dist/packages/full-text-search-language-en/types/partitioning-adapter/src/partitioning_adapter.d.ts @@ -1,4 +1,5 @@ -import { ANY, StorageAdapter } from "../../common/types"; +import { Loki } from "../../loki/src/loki"; +import { StorageAdapter } from "../../common/types"; /** * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and @@ -9,7 +10,7 @@ import { ANY, StorageAdapter } from "../../common/types"; * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all * of that collection's pages will be written on next save. */ -export declare class LokiPartitioningAdapter implements StorageAdapter { +export declare class PartitioningAdapter implements StorageAdapter { mode: string; private _adapter; private _dbref; @@ -68,7 +69,7 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { * @returns {Promise} a Promise that resolves after the database was deleted * */ - exportDatabase(dbname: string, dbref: ANY): Promise; + exportDatabase(dbname: string, dbref: Loki): Promise; /** * Helper method used internally to save each dirty collection, one at a time. * @@ -82,11 +83,3 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { */ private _saveNextPage(); } -declare namespace LokiPartitioningAdapter { - interface PageIterator { - collection?: ANY; - docIndex?: number; - pageIndex?: number; - } -} -export default LokiPartitioningAdapter; diff --git a/dist/packages/full-text-search-language/lokijs.full-text-search-language.js b/dist/packages/full-text-search-language/lokijs.full-text-search-language.js index 4c2f36b9..9609ace5 100644 --- a/dist/packages/full-text-search-language/lokijs.full-text-search-language.js +++ b/dist/packages/full-text-search-language/lokijs.full-text-search-language.js @@ -79,8 +79,21 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony export (immutable) */ __webpack_exports__["generateTrimmer"] = generateTrimmer; -/* harmony export (immutable) */ __webpack_exports__["generateStopWordFilter"] = generateStopWordFilter; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__language__ = __webpack_require__(1); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "generateStopWordFilter", function() { return __WEBPACK_IMPORTED_MODULE_0__language__["c"]; }); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "generateTrimmer", function() { return __WEBPACK_IMPORTED_MODULE_0__language__["d"]; }); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Among", function() { return __WEBPACK_IMPORTED_MODULE_0__language__["a"]; }); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "SnowballProgram", function() { return __WEBPACK_IMPORTED_MODULE_0__language__["b"]; }); + + + +/***/ }), +/* 1 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["d"] = generateTrimmer; +/* harmony export (immutable) */ __webpack_exports__["c"] = generateStopWordFilter; /* * From MihaiValentin/lunr-languages. * Last update from 2017/04/16 - 19af41fb9bd644d9081ad274f96f700b21464290 @@ -109,7 +122,7 @@ class Among { } } } -/* harmony export (immutable) */ __webpack_exports__["Among"] = Among; +/* harmony export (immutable) */ __webpack_exports__["a"] = Among; class SnowballProgram { constructor() { @@ -367,7 +380,7 @@ class SnowballProgram { return this.eq_s_b(s.length, s); } } -/* harmony export (immutable) */ __webpack_exports__["SnowballProgram"] = SnowballProgram; +/* harmony export (immutable) */ __webpack_exports__["b"] = SnowballProgram; diff --git a/dist/packages/full-text-search-language/lokijs.full-text-search-language.js.map b/dist/packages/full-text-search-language/lokijs.full-text-search-language.js.map index f38b5eff..db09dbaf 100644 --- a/dist/packages/full-text-search-language/lokijs.full-text-search-language.js.map +++ b/dist/packages/full-text-search-language/lokijs.full-text-search-language.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 9ea5aa45f492df35daf9","webpack:///./packages/full-text-search-language/src/language.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;AC7DA;AAAA;;;GAGG;AACG,yBAA0B,cAAsB;IACpD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,GAAG,cAAc,GAAG,OAAO,GAAG,cAAc,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC;IACzF,MAAM,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACrD,CAAC;AAEK,gCAAiC,SAAmB;IACxD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1D,CAAC;AAEK;IAOJ,YAAY,CAAS,EAAE,WAAmB,EAAE,MAAc,EAAE,MAAY;QACtE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE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ED,SAAS;QACP,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,KAAa,EAAE,CAAS;QAC5C,IAAI,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QACjD,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC;YACpB,IAAI,CAAC,GAAG,IAAI,UAAU,CAAC;QACzB,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC;YACpB,IAAI,CAAC,GAAG,IAAI,UAAU,CAAC;IAC3B,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,CAAC,CAAS;QACd,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAClC,CAAC;CACF;AAAA;AAAA","file":"lokijs.full-text-search-language.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/full-text-search-language\"] = factory();\n\telse\n\t\troot[\"@lokijs/full-text-search-language\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 9ea5aa45f492df35daf9","/*\n * From MihaiValentin/lunr-languages.\n * Last update from 2017/04/16 - 19af41fb9bd644d9081ad274f96f700b21464290\n */\nexport function generateTrimmer(wordCharacters: string) {\n const regex = new RegExp(\"^[^\" + wordCharacters + \"]+|[^\" + wordCharacters + \"]+$\", \"g\");\n return (token: string) => token.replace(regex, \"\");\n}\n\nexport function generateStopWordFilter(stopWords: string[]) {\n const words = new Set(stopWords);\n return (token: string) => words.has(token) ? \"\" : token;\n}\n\nexport class Among {\n s_size: number;\n s: number[];\n substring_i: number;\n result: number;\n method: any;\n\n constructor(s: string, substring_i: number, result: number, method?: any) {\n if ((!s && s !== \"\") || (!substring_i && (substring_i !== 0)) || !result) {\n throw (\"Bad Among initialisation: s:\" + s + \", substring_i: \" + substring_i + \", result: \" + result);\n }\n\n this.s_size = s.length;\n this.substring_i = substring_i;\n this.result = result;\n this.method = method;\n\n // Split string into a numeric character array.\n this.s = new Array(this.s_size);\n for (let i = 0; i < this.s_size; i++) {\n this.s[i] = +s.charCodeAt(i);\n }\n }\n}\n\nexport class SnowballProgram {\n current: string;\n bra: number;\n ket: number;\n limit: number;\n cursor: number;\n limit_backward: number;\n\n constructor() {\n this.current = null;\n this.bra = 0;\n this.ket = 0;\n this.limit = 0;\n this.cursor = 0;\n this.limit_backward = 0;\n }\n\n setCurrent(word: string) {\n this.current = word;\n this.cursor = 0;\n this.limit = word.length;\n this.limit_backward = 0;\n this.bra = this.cursor;\n this.ket = this.limit;\n }\n\n getCurrent() {\n let result = this.current;\n this.current = null;\n return result;\n }\n\n in_grouping(s: number[], min: number, max: number) {\n if (this.cursor < this.limit) {\n let ch = this.current.charCodeAt(this.cursor);\n if (ch <= max && ch >= min) {\n ch -= min;\n if (s[ch >> 3] & (0X1 << (ch & 0X7))) {\n this.cursor++;\n return true;\n }\n }\n }\n return false;\n }\n\n in_grouping_b(s: number[], min: number, max: number) {\n if (this.cursor > this.limit_backward) {\n let ch = this.current.charCodeAt(this.cursor - 1);\n if (ch <= max && ch >= min) {\n ch -= min;\n if (s[ch >> 3] & (0X1 << (ch & 0X7))) {\n this.cursor--;\n return true;\n }\n }\n }\n return false;\n }\n\n out_grouping(s: number[], min: number, max: number) {\n if (this.cursor < this.limit) {\n let ch = this.current.charCodeAt(this.cursor);\n if (ch > max || ch < min) {\n this.cursor++;\n return true;\n }\n ch -= min;\n if (!(s[ch >> 3] & (0X1 << (ch & 0X7)))) {\n this.cursor++;\n return true;\n }\n }\n return false;\n }\n\n out_grouping_b(s: number[], min: number, max: number) {\n if (this.cursor > this.limit_backward) {\n let ch = this.current.charCodeAt(this.cursor - 1);\n if (ch > max || ch < min) {\n this.cursor--;\n return true;\n }\n ch -= min;\n if (!(s[ch >> 3] & (0X1 << (ch & 0X7)))) {\n this.cursor--;\n return true;\n }\n }\n return false;\n }\n\n eq_s(s_size: number, s: string) {\n if (this.limit - this.cursor < s_size) {\n return false;\n }\n for (let i = 0; i < s_size; i++) {\n if (this.current.charCodeAt(this.cursor + i) !== s.charCodeAt(i)) {\n return false;\n }\n }\n this.cursor += s_size;\n return true;\n }\n\n eq_s_b(s_size: number, s: string) {\n if (this.cursor - this.limit_backward < s_size) {\n return false;\n }\n for (let i = 0; i < s_size; i++) {\n if (this.current.charCodeAt(this.cursor - s_size + i) !== s.charCodeAt(i)) {\n return false;\n }\n }\n this.cursor -= s_size;\n return true;\n }\n\n find_among(v: Among[], v_size: number) {\n let i = 0;\n let j = v_size;\n let c = this.cursor;\n let l = this.limit;\n let common_i = 0;\n let common_j = 0;\n let first_key_inspected = false;\n while (true) {\n let k = i + ((j - i) >> 1);\n let diff = 0;\n let common = common_i < common_j ? common_i : common_j;\n\n let w = v[k];\n for (let i2 = common; i2 < w.s_size; i2++) {\n if (c + common === l) {\n diff = -1;\n break;\n }\n diff = this.current.charCodeAt(c + common) - w.s[i2];\n if (diff) {\n break;\n }\n common++;\n }\n if (diff < 0) {\n j = k;\n common_j = common;\n } else {\n i = k;\n common_i = common;\n }\n if (j - i <= 1) {\n if (i > 0 || j === i || first_key_inspected) {\n break;\n }\n first_key_inspected = true;\n }\n }\n while (true) {\n let w = v[i];\n if (common_i >= w.s_size) {\n this.cursor = c + w.s_size;\n if (!w.method) {\n return w.result;\n }\n let res = w.method();\n this.cursor = c + w.s_size;\n if (res) {\n return w.result;\n }\n }\n i = w.substring_i;\n if (i < 0) {\n return 0;\n }\n }\n }\n\n find_among_b(v: Among[], v_size: number) {\n let i = 0;\n let j = v_size;\n let c = this.cursor;\n let lb = this.limit_backward;\n let common_i = 0;\n let common_j = 0;\n let first_key_inspected = false;\n while (true) {\n let k = i + ((j - i) >> 1);\n let diff = 0;\n\n let common = common_i < common_j\n ? common_i\n : common_j;\n\n let w = v[k];\n for (let i2 = w.s_size - 1 - common; i2 >= 0; i2--) {\n if (c - common === lb) {\n diff = -1;\n break;\n }\n diff = this.current.charCodeAt(c - 1 - common) - w.s[i2];\n if (diff)\n break;\n common++;\n }\n if (diff < 0) {\n j = k;\n common_j = common;\n } else {\n i = k;\n common_i = common;\n }\n if (j - i <= 1) {\n if (i > 0 || j === i || first_key_inspected)\n break;\n first_key_inspected = true;\n }\n }\n while (true) {\n let w = v[i];\n if (common_i >= w.s_size) {\n this.cursor = c - w.s_size;\n if (!w.method)\n return w.result;\n let res = w.method();\n this.cursor = c - w.s_size;\n if (res)\n return w.result;\n }\n i = w.substring_i;\n if (i < 0)\n return 0;\n }\n }\n\n replace_s(c_bra: number, c_ket: number, s: string) {\n let adjustment = s.length - (c_ket - c_bra);\n\n let left = this.current\n .substring(0, c_bra);\n\n let right = this.current.substring(c_ket);\n this.current = left + s + right;\n this.limit += adjustment;\n if (this.cursor >= c_ket)\n this.cursor += adjustment;\n else if (this.cursor > c_bra)\n this.cursor = c_bra;\n return adjustment;\n }\n\n slice_check() {\n if (this.bra < 0 || this.bra > this.ket || this.ket > this.limit\n || this.limit > this.current.length) {\n throw (\"faulty slice operation\");\n }\n }\n\n slice_from(s: string) {\n this.slice_check();\n this.replace_s(this.bra, this.ket, s);\n }\n\n slice_del() {\n this.slice_from(\"\");\n }\n\n insert(c_bra: number, c_ket: number, s: string) {\n let adjustment = this.replace_s(c_bra, c_ket, s);\n if (c_bra <= this.bra)\n this.bra += adjustment;\n if (c_bra <= this.ket)\n this.ket += adjustment;\n }\n\n slice_to() {\n this.slice_check();\n return this.current.substring(this.bra, this.ket);\n }\n\n eq_v_b(s: string) {\n return this.eq_s_b(s.length, s);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search-language/src/language.ts"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 1a41cd6d41e6c34f5f3f","webpack:///./packages/full-text-search-language/src/index.ts","webpack:///./packages/full-text-search-language/src/language.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AC7D2F;;;;;;;;;ACA3F;AAAA;;;GAGG;AACG,yBAA0B,cAAsB;IACpD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,GAAG,cAAc,GAAG,OAAO,GAAG,cAAc,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC;IACzF,MAAM,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACrD,CAAC;AAEK,gCAAiC,SAAmB;IACxD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1D,CAAC;AAEK;IAOJ,YAAY,CAAS,EAAE,WAAmB,EAAE,MAAc,EAAE,MAAY;QACtE,EAAE,CAAC,CAAC,CAAC,CAA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AAC,CAAC,CAAC;IACxC,CAAC;IAED,SAAS;QACP,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,KAAa,EAAE,CAAS;QAC5C,IAAI,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QACjD,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC;YACpB,IAAI,CAAC,GAAG,IAAI,UAAU,CAAC;QACzB,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC;YACpB,IAAI,CAAC,GAAG,IAAI,UAAU,CAAC;IAC3B,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,CAAC,CAAS;QACd,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAClC,CAAC;CACF;AAAA;AAAA","file":"lokijs.full-text-search-language.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/full-text-search-language\"] = factory();\n\telse\n\t\troot[\"@lokijs/full-text-search-language\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1a41cd6d41e6c34f5f3f","export {generateStopWordFilter, generateTrimmer, Among, SnowballProgram} from \"./language\";\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search-language/src/index.ts","/*\n * From MihaiValentin/lunr-languages.\n * Last update from 2017/04/16 - 19af41fb9bd644d9081ad274f96f700b21464290\n */\nexport function generateTrimmer(wordCharacters: string) {\n const regex = new RegExp(\"^[^\" + wordCharacters + \"]+|[^\" + wordCharacters + \"]+$\", \"g\");\n return (token: string) => token.replace(regex, \"\");\n}\n\nexport function generateStopWordFilter(stopWords: string[]) {\n const words = new Set(stopWords);\n return (token: string) => words.has(token) ? \"\" : token;\n}\n\nexport class Among {\n s_size: number;\n s: number[];\n substring_i: number;\n result: number;\n method: any;\n\n constructor(s: string, substring_i: number, result: number, method?: any) {\n if ((!s && s !== \"\") || (!substring_i && (substring_i !== 0)) || !result) {\n throw (\"Bad Among initialisation: s:\" + s + \", substring_i: \" + substring_i + \", result: \" + result);\n }\n\n this.s_size = s.length;\n this.substring_i = substring_i;\n this.result = result;\n this.method = method;\n\n // Split string into a numeric character array.\n this.s = new Array(this.s_size);\n for (let i = 0; i < this.s_size; i++) {\n this.s[i] = +s.charCodeAt(i);\n }\n }\n}\n\nexport class SnowballProgram {\n current: string;\n bra: number;\n ket: number;\n limit: number;\n cursor: number;\n limit_backward: number;\n\n constructor() {\n this.current = null;\n this.bra = 0;\n this.ket = 0;\n this.limit = 0;\n this.cursor = 0;\n this.limit_backward = 0;\n }\n\n setCurrent(word: string) {\n this.current = word;\n this.cursor = 0;\n this.limit = word.length;\n this.limit_backward = 0;\n this.bra = this.cursor;\n this.ket = this.limit;\n }\n\n getCurrent() {\n let result = this.current;\n this.current = null;\n return result;\n }\n\n in_grouping(s: number[], min: number, max: number) {\n if (this.cursor < this.limit) {\n let ch = this.current.charCodeAt(this.cursor);\n if (ch <= max && ch >= min) {\n ch -= min;\n if (s[ch >> 3] & (0X1 << (ch & 0X7))) {\n this.cursor++;\n return true;\n }\n }\n }\n return false;\n }\n\n in_grouping_b(s: number[], min: number, max: number) {\n if (this.cursor > this.limit_backward) {\n let ch = this.current.charCodeAt(this.cursor - 1);\n if (ch <= max && ch >= min) {\n ch -= min;\n if (s[ch >> 3] & (0X1 << (ch & 0X7))) {\n this.cursor--;\n return true;\n }\n }\n }\n return false;\n }\n\n out_grouping(s: number[], min: number, max: number) {\n if (this.cursor < this.limit) {\n let ch = this.current.charCodeAt(this.cursor);\n if (ch > max || ch < min) {\n this.cursor++;\n return true;\n }\n ch -= min;\n if (!(s[ch >> 3] & (0X1 << (ch & 0X7)))) {\n this.cursor++;\n return true;\n }\n }\n return false;\n }\n\n out_grouping_b(s: number[], min: number, max: number) {\n if (this.cursor > this.limit_backward) {\n let ch = this.current.charCodeAt(this.cursor - 1);\n if (ch > max || ch < min) {\n this.cursor--;\n return true;\n }\n ch -= min;\n if (!(s[ch >> 3] & (0X1 << (ch & 0X7)))) {\n this.cursor--;\n return true;\n }\n }\n return false;\n }\n\n eq_s(s_size: number, s: string) {\n if (this.limit - this.cursor < s_size) {\n return false;\n }\n for (let i = 0; i < s_size; i++) {\n if (this.current.charCodeAt(this.cursor + i) !== s.charCodeAt(i)) {\n return false;\n }\n }\n this.cursor += s_size;\n return true;\n }\n\n eq_s_b(s_size: number, s: string) {\n if (this.cursor - this.limit_backward < s_size) {\n return false;\n }\n for (let i = 0; i < s_size; i++) {\n if (this.current.charCodeAt(this.cursor - s_size + i) !== s.charCodeAt(i)) {\n return false;\n }\n }\n this.cursor -= s_size;\n return true;\n }\n\n find_among(v: Among[], v_size: number) {\n let i = 0;\n let j = v_size;\n let c = this.cursor;\n let l = this.limit;\n let common_i = 0;\n let common_j = 0;\n let first_key_inspected = false;\n while (true) {\n let k = i + ((j - i) >> 1);\n let diff = 0;\n let common = common_i < common_j ? common_i : common_j;\n\n let w = v[k];\n for (let i2 = common; i2 < w.s_size; i2++) {\n if (c + common === l) {\n diff = -1;\n break;\n }\n diff = this.current.charCodeAt(c + common) - w.s[i2];\n if (diff) {\n break;\n }\n common++;\n }\n if (diff < 0) {\n j = k;\n common_j = common;\n } else {\n i = k;\n common_i = common;\n }\n if (j - i <= 1) {\n if (i > 0 || j === i || first_key_inspected) {\n break;\n }\n first_key_inspected = true;\n }\n }\n while (true) {\n let w = v[i];\n if (common_i >= w.s_size) {\n this.cursor = c + w.s_size;\n if (!w.method) {\n return w.result;\n }\n let res = w.method();\n this.cursor = c + w.s_size;\n if (res) {\n return w.result;\n }\n }\n i = w.substring_i;\n if (i < 0) {\n return 0;\n }\n }\n }\n\n find_among_b(v: Among[], v_size: number) {\n let i = 0;\n let j = v_size;\n let c = this.cursor;\n let lb = this.limit_backward;\n let common_i = 0;\n let common_j = 0;\n let first_key_inspected = false;\n while (true) {\n let k = i + ((j - i) >> 1);\n let diff = 0;\n\n let common = common_i < common_j\n ? common_i\n : common_j;\n\n let w = v[k];\n for (let i2 = w.s_size - 1 - common; i2 >= 0; i2--) {\n if (c - common === lb) {\n diff = -1;\n break;\n }\n diff = this.current.charCodeAt(c - 1 - common) - w.s[i2];\n if (diff)\n break;\n common++;\n }\n if (diff < 0) {\n j = k;\n common_j = common;\n } else {\n i = k;\n common_i = common;\n }\n if (j - i <= 1) {\n if (i > 0 || j === i || first_key_inspected)\n break;\n first_key_inspected = true;\n }\n }\n while (true) {\n let w = v[i];\n if (common_i >= w.s_size) {\n this.cursor = c - w.s_size;\n if (!w.method)\n return w.result;\n let res = w.method();\n this.cursor = c - w.s_size;\n if (res)\n return w.result;\n }\n i = w.substring_i;\n if (i < 0)\n return 0;\n }\n }\n\n replace_s(c_bra: number, c_ket: number, s: string) {\n let adjustment = s.length - (c_ket - c_bra);\n\n let left = this.current\n .substring(0, c_bra);\n\n let right = this.current.substring(c_ket);\n this.current = left + s + right;\n this.limit += adjustment;\n if (this.cursor >= c_ket)\n this.cursor += adjustment;\n else if (this.cursor > c_bra)\n this.cursor = c_bra;\n return adjustment;\n }\n\n slice_check() {\n if (this.bra < 0 || this.bra > this.ket || this.ket > this.limit\n || this.limit > this.current.length) {\n throw (\"faulty slice operation\");\n }\n }\n\n slice_from(s: string) {\n this.slice_check();\n this.replace_s(this.bra, this.ket, s);\n }\n\n slice_del() {\n this.slice_from(\"\");\n }\n\n insert(c_bra: number, c_ket: number, s: string) {\n let adjustment = this.replace_s(c_bra, c_ket, s);\n if (c_bra <= this.bra)\n this.bra += adjustment;\n if (c_bra <= this.ket)\n this.ket += adjustment;\n }\n\n slice_to() {\n this.slice_check();\n return this.current.substring(this.bra, this.ket);\n }\n\n eq_v_b(s: string) {\n return this.eq_s_b(s.length, s);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search-language/src/language.ts"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/packages/full-text-search-language/lokijs.full-text-search-language.min.js b/dist/packages/full-text-search-language/lokijs.full-text-search-language.min.js index 1f4ef580..83fb4d24 100644 --- a/dist/packages/full-text-search-language/lokijs.full-text-search-language.min.js +++ b/dist/packages/full-text-search-language/lokijs.full-text-search-language.min.js @@ -1 +1 @@ -(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["@lokijs/full-text-search-language"]=factory();else{root["@lokijs/full-text-search-language"]=factory();root["LokiFullTextSearchLanguage"]=root["@lokijs/full-text-search-language"].default}})(typeof self!=="undefined"?self:this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});__webpack_exports__["generateTrimmer"]=generateTrimmer;__webpack_exports__["generateStopWordFilter"]=generateStopWordFilter;function generateTrimmer(wordCharacters){const regex=new RegExp("^[^"+wordCharacters+"]+|[^"+wordCharacters+"]+$","g");return token=>token.replace(regex,"")}function generateStopWordFilter(stopWords){const words=new Set(stopWords);return token=>words.has(token)?"":token}class Among{constructor(s,substring_i,result,method){if(!s&&s!==""||!substring_i&&substring_i!==0||!result){throw"Bad Among initialisation: s:"+s+", substring_i: "+substring_i+", result: "+result}this.s_size=s.length;this.substring_i=substring_i;this.result=result;this.method=method;this.s=new Array(this.s_size);for(let i=0;i=min){ch-=min;if(s[ch>>3]&1<<(ch&7)){this.cursor++;return true}}}return false}in_grouping_b(s,min,max){if(this.cursor>this.limit_backward){let ch=this.current.charCodeAt(this.cursor-1);if(ch<=max&&ch>=min){ch-=min;if(s[ch>>3]&1<<(ch&7)){this.cursor--;return true}}}return false}out_grouping(s,min,max){if(this.cursormax||ch>3]&1<<(ch&7))){this.cursor++;return true}}return false}out_grouping_b(s,min,max){if(this.cursor>this.limit_backward){let ch=this.current.charCodeAt(this.cursor-1);if(ch>max||ch>3]&1<<(ch&7))){this.cursor--;return true}}return false}eq_s(s_size,s){if(this.limit-this.cursor>1);let diff=0;let common=common_i0||j===i||first_key_inspected){break}first_key_inspected=true}}while(true){let w=v[i];if(common_i>=w.s_size){this.cursor=c+w.s_size;if(!w.method){return w.result}let res=w.method();this.cursor=c+w.s_size;if(res){return w.result}}i=w.substring_i;if(i<0){return 0}}}find_among_b(v,v_size){let i=0;let j=v_size;let c=this.cursor;let lb=this.limit_backward;let common_i=0;let common_j=0;let first_key_inspected=false;while(true){let k=i+(j-i>>1);let diff=0;let common=common_i=0;i2--){if(c-common===lb){diff=-1;break}diff=this.current.charCodeAt(c-1-common)-w.s[i2];if(diff)break;common++}if(diff<0){j=k;common_j=common}else{i=k;common_i=common}if(j-i<=1){if(i>0||j===i||first_key_inspected)break;first_key_inspected=true}}while(true){let w=v[i];if(common_i>=w.s_size){this.cursor=c-w.s_size;if(!w.method)return w.result;let res=w.method();this.cursor=c-w.s_size;if(res)return w.result}i=w.substring_i;if(i<0)return 0}}replace_s(c_bra,c_ket,s){let adjustment=s.length-(c_ket-c_bra);let left=this.current.substring(0,c_bra);let right=this.current.substring(c_ket);this.current=left+s+right;this.limit+=adjustment;if(this.cursor>=c_ket)this.cursor+=adjustment;else if(this.cursor>c_bra)this.cursor=c_bra;return adjustment}slice_check(){if(this.bra<0||this.bra>this.ket||this.ket>this.limit||this.limit>this.current.length){throw"faulty slice operation"}}slice_from(s){this.slice_check();this.replace_s(this.bra,this.ket,s)}slice_del(){this.slice_from("")}insert(c_bra,c_ket,s){let adjustment=this.replace_s(c_bra,c_ket,s);if(c_bra<=this.bra)this.bra+=adjustment;if(c_bra<=this.ket)this.ket+=adjustment}slice_to(){this.slice_check();return this.current.substring(this.bra,this.ket)}eq_v_b(s){return this.eq_s_b(s.length,s)}}__webpack_exports__["SnowballProgram"]=SnowballProgram}])}); \ No newline at end of file +(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["@lokijs/full-text-search-language"]=factory();else{root["@lokijs/full-text-search-language"]=factory();root["LokiFullTextSearchLanguage"]=root["@lokijs/full-text-search-language"].default}})(typeof self!=="undefined"?self:this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__language__=__webpack_require__(1);__webpack_require__.d(__webpack_exports__,"generateStopWordFilter",function(){return __WEBPACK_IMPORTED_MODULE_0__language__["c"]});__webpack_require__.d(__webpack_exports__,"generateTrimmer",function(){return __WEBPACK_IMPORTED_MODULE_0__language__["d"]});__webpack_require__.d(__webpack_exports__,"Among",function(){return __WEBPACK_IMPORTED_MODULE_0__language__["a"]});__webpack_require__.d(__webpack_exports__,"SnowballProgram",function(){return __WEBPACK_IMPORTED_MODULE_0__language__["b"]})},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_exports__["d"]=generateTrimmer;__webpack_exports__["c"]=generateStopWordFilter;function generateTrimmer(wordCharacters){const regex=new RegExp("^[^"+wordCharacters+"]+|[^"+wordCharacters+"]+$","g");return token=>token.replace(regex,"")}function generateStopWordFilter(stopWords){const words=new Set(stopWords);return token=>words.has(token)?"":token}class Among{constructor(s,substring_i,result,method){if(!s&&s!==""||!substring_i&&substring_i!==0||!result){throw"Bad Among initialisation: s:"+s+", substring_i: "+substring_i+", result: "+result}this.s_size=s.length;this.substring_i=substring_i;this.result=result;this.method=method;this.s=new Array(this.s_size);for(let i=0;i=min){ch-=min;if(s[ch>>3]&1<<(ch&7)){this.cursor++;return true}}}return false}in_grouping_b(s,min,max){if(this.cursor>this.limit_backward){let ch=this.current.charCodeAt(this.cursor-1);if(ch<=max&&ch>=min){ch-=min;if(s[ch>>3]&1<<(ch&7)){this.cursor--;return true}}}return false}out_grouping(s,min,max){if(this.cursormax||ch>3]&1<<(ch&7))){this.cursor++;return true}}return false}out_grouping_b(s,min,max){if(this.cursor>this.limit_backward){let ch=this.current.charCodeAt(this.cursor-1);if(ch>max||ch>3]&1<<(ch&7))){this.cursor--;return true}}return false}eq_s(s_size,s){if(this.limit-this.cursor>1);let diff=0;let common=common_i0||j===i||first_key_inspected){break}first_key_inspected=true}}while(true){let w=v[i];if(common_i>=w.s_size){this.cursor=c+w.s_size;if(!w.method){return w.result}let res=w.method();this.cursor=c+w.s_size;if(res){return w.result}}i=w.substring_i;if(i<0){return 0}}}find_among_b(v,v_size){let i=0;let j=v_size;let c=this.cursor;let lb=this.limit_backward;let common_i=0;let common_j=0;let first_key_inspected=false;while(true){let k=i+(j-i>>1);let diff=0;let common=common_i=0;i2--){if(c-common===lb){diff=-1;break}diff=this.current.charCodeAt(c-1-common)-w.s[i2];if(diff)break;common++}if(diff<0){j=k;common_j=common}else{i=k;common_i=common}if(j-i<=1){if(i>0||j===i||first_key_inspected)break;first_key_inspected=true}}while(true){let w=v[i];if(common_i>=w.s_size){this.cursor=c-w.s_size;if(!w.method)return w.result;let res=w.method();this.cursor=c-w.s_size;if(res)return w.result}i=w.substring_i;if(i<0)return 0}}replace_s(c_bra,c_ket,s){let adjustment=s.length-(c_ket-c_bra);let left=this.current.substring(0,c_bra);let right=this.current.substring(c_ket);this.current=left+s+right;this.limit+=adjustment;if(this.cursor>=c_ket)this.cursor+=adjustment;else if(this.cursor>c_bra)this.cursor=c_bra;return adjustment}slice_check(){if(this.bra<0||this.bra>this.ket||this.ket>this.limit||this.limit>this.current.length){throw"faulty slice operation"}}slice_from(s){this.slice_check();this.replace_s(this.bra,this.ket,s)}slice_del(){this.slice_from("")}insert(c_bra,c_ket,s){let adjustment=this.replace_s(c_bra,c_ket,s);if(c_bra<=this.bra)this.bra+=adjustment;if(c_bra<=this.ket)this.ket+=adjustment}slice_to(){this.slice_check();return this.current.substring(this.bra,this.ket)}eq_v_b(s){return this.eq_s_b(s.length,s)}}__webpack_exports__["b"]=SnowballProgram}])}); \ No newline at end of file diff --git a/dist/packages/full-text-search-language/types/common/types.d.ts b/dist/packages/full-text-search-language/types/common/types.d.ts index 846847e6..b8a936c6 100644 --- a/dist/packages/full-text-search-language/types/common/types.d.ts +++ b/dist/packages/full-text-search-language/types/common/types.d.ts @@ -1,10 +1,13 @@ -export declare type ANY = any; +/** + * @hidden + */ +import { Loki } from "../loki/src"; export interface StorageAdapter { loadDatabase(dbname: string): Promise; saveDatabase?(dbname: string, serialization: string): Promise; deleteDatabase?(dbname: string): Promise; mode?: string; - exportDatabase?(dbname: string, dbref: ANY): Promise; + exportDatabase?(dbname: string, dbref: Loki): Promise; } export declare type Doc = T & { $loki: number; @@ -14,10 +17,3 @@ export interface Dict { [index: string]: T; [index: number]: T; } -export interface Query { -} -export interface Filter { - type: string; - val: Query | ((obj: E, index: number, array: E[]) => boolean); - uid: number | string; -} diff --git a/dist/packages/full-text-search-language/types/fs-storage/src/fs_storage.d.ts b/dist/packages/full-text-search-language/types/fs-storage/src/fs_storage.d.ts index a92567ea..9930c0d0 100644 --- a/dist/packages/full-text-search-language/types/fs-storage/src/fs_storage.d.ts +++ b/dist/packages/full-text-search-language/types/fs-storage/src/fs_storage.d.ts @@ -2,7 +2,7 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists using node fs module. */ -export declare class LokiFSStorage implements StorageAdapter { +export declare class FSStorage implements StorageAdapter { /** * Registers the fs storage as plugin. */ @@ -32,4 +32,3 @@ export declare class LokiFSStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiFSStorage; diff --git a/dist/packages/full-text-search-language/types/fs-storage/src/index.d.ts b/dist/packages/full-text-search-language/types/fs-storage/src/index.d.ts new file mode 100644 index 00000000..e6b33d6c --- /dev/null +++ b/dist/packages/full-text-search-language/types/fs-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { FSStorage } from "./fs_storage"; +export { FSStorage }; +export default FSStorage; diff --git a/dist/packages/full-text-search-language/types/full-text-search-language-de/src/index.d.ts b/dist/packages/full-text-search-language/types/full-text-search-language-de/src/index.d.ts new file mode 100644 index 00000000..a2665427 --- /dev/null +++ b/dist/packages/full-text-search-language/types/full-text-search-language-de/src/index.d.ts @@ -0,0 +1,3 @@ +import { DE } from "./de"; +export { DE }; +export default DE; diff --git a/dist/packages/full-text-search-language/types/full-text-search-language-en/src/index.d.ts b/dist/packages/full-text-search-language/types/full-text-search-language-en/src/index.d.ts new file mode 100644 index 00000000..8313cf98 --- /dev/null +++ b/dist/packages/full-text-search-language/types/full-text-search-language-en/src/index.d.ts @@ -0,0 +1,3 @@ +import { EN } from "./en"; +export { EN }; +export default EN; diff --git a/dist/packages/full-text-search-language/types/full-text-search-language/src/index.d.ts b/dist/packages/full-text-search-language/types/full-text-search-language/src/index.d.ts new file mode 100644 index 00000000..e52d1a42 --- /dev/null +++ b/dist/packages/full-text-search-language/types/full-text-search-language/src/index.d.ts @@ -0,0 +1 @@ +export { generateStopWordFilter, generateTrimmer, Among, SnowballProgram } from "./language"; diff --git a/dist/packages/full-text-search-language/types/full-text-search/src/full_text_search.d.ts b/dist/packages/full-text-search-language/types/full-text-search/src/full_text_search.d.ts index a4752c88..65a26bef 100644 --- a/dist/packages/full-text-search-language/types/full-text-search/src/full_text_search.d.ts +++ b/dist/packages/full-text-search-language/types/full-text-search/src/full_text_search.d.ts @@ -2,7 +2,7 @@ import { InvertedIndex } from "./inverted_index"; import { Tokenizer } from "./tokenizer"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; export declare class FullTextSearch { private _id; private _docs; @@ -21,14 +21,14 @@ export declare class FullTextSearch { * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized * (requires more memory but performs better) * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field - * @param {string=$loki} id - the property name of the document index + * @param {string} [id] - the property name of the document index */ constructor(fields?: FullTextSearch.FieldOptions[], id?: string); addDocument(doc: object, id?: number): void; removeDocument(doc: object, id?: number): void; updateDocument(doc: object, id?: number): void; clear(): void; - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; toJSON(): FullTextSearch.Serialization; static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers?: Dict): FullTextSearch; } diff --git a/dist/packages/full-text-search-language/types/full-text-search/src/index.d.ts b/dist/packages/full-text-search-language/types/full-text-search/src/index.d.ts index f03dde09..b901b108 100644 --- a/dist/packages/full-text-search-language/types/full-text-search/src/index.d.ts +++ b/dist/packages/full-text-search-language/types/full-text-search/src/index.d.ts @@ -1,6 +1,5 @@ import { FullTextSearch } from "./full_text_search"; -export { Tokenizer } from "./tokenizer"; -export { QueryBuilder } from "./query_builder"; -export { InvertedIndex } from "./inverted_index"; -export { FullTextSearch }; +import { Tokenizer } from "./tokenizer"; +import { QueryBuilder } from "./query_builder"; +export { FullTextSearch, Tokenizer, QueryBuilder }; export default FullTextSearch; diff --git a/dist/packages/full-text-search-language/types/full-text-search/src/index_searcher.d.ts b/dist/packages/full-text-search-language/types/full-text-search/src/index_searcher.d.ts index d3cf7f93..00b99f2f 100644 --- a/dist/packages/full-text-search-language/types/full-text-search/src/index_searcher.d.ts +++ b/dist/packages/full-text-search-language/types/full-text-search/src/index_searcher.d.ts @@ -1,4 +1,4 @@ -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; import { InvertedIndex } from "./inverted_index"; import { Query } from "./query_builder"; import { Dict } from "../../common/types"; @@ -13,9 +13,9 @@ export declare class IndexSearcher { * @param {object} invIdxs */ constructor(invIdxs: Dict, docs: Set); - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; setDirty(): void; private _recursive(query, doScoring); - private _getUnique(queries, doScoring, docResults); + private _getUnique(queries, doScoring, queryResults); private _getAll(queries, doScoring); } diff --git a/dist/packages/full-text-search-language/types/full-text-search/src/query_builder.d.ts b/dist/packages/full-text-search-language/types/full-text-search/src/query_builder.d.ts index 923317f6..6f324e15 100644 --- a/dist/packages/full-text-search-language/types/full-text-search/src/query_builder.d.ts +++ b/dist/packages/full-text-search-language/types/full-text-search/src/query_builder.d.ts @@ -24,8 +24,8 @@ export declare class BaseQueryBuilder { */ build(): any; } -export interface BaseQuery { - type: string; +export interface BaseQuery { + type: Type; boost?: number; } /** @@ -51,7 +51,7 @@ export declare class TermQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, term: string, data?: any); } -export interface TermQuery extends BaseQuery { +export interface TermQuery extends BaseQuery<"term"> { field: string; value: string; } @@ -78,7 +78,7 @@ export declare class TermsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, terms: Array, data?: any); } -export interface TermsQuery extends BaseQuery { +export interface TermsQuery extends BaseQuery<"terms"> { field: string; value: string[]; } @@ -119,7 +119,7 @@ export declare class WildcardQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface WildcardQuery extends BaseQuery { +export interface WildcardQuery extends BaseQuery<"wildcard"> { field: string; value: string; enable_scoring?: boolean; @@ -169,7 +169,7 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { * * @return {FuzzyQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the initial word length. * @param {number} prefixLength - the positive prefix length @@ -183,10 +183,10 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface FuzzyQuery extends BaseQuery { +export interface FuzzyQuery extends BaseQuery<"fuzzy"> { field: string; value: string; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -221,7 +221,7 @@ export declare class PrefixQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface PrefixQuery extends BaseQuery { +export interface PrefixQuery extends BaseQuery<"prefix"> { field: string; value: string; enable_scoring?: boolean; @@ -247,7 +247,7 @@ export declare class ExistsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, data?: any); } -export interface ExistsQuery extends BaseQuery { +export interface ExistsQuery extends BaseQuery<"exists"> { field: string; } /** @@ -315,7 +315,7 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { * * @return {MatchQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the starting word length which should not be considered for fuzziness. * @param {number} prefixLength - the positive prefix length @@ -329,12 +329,12 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface MatchQuery extends BaseQuery { +export interface MatchQuery extends BaseQuery<"match"> { field: string; value: string; minimum_should_match?: number; operator?: "and" | "or"; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -360,7 +360,7 @@ export interface MatchQuery extends BaseQuery { export declare class MatchAllQueryBuilder extends BaseQueryBuilder { constructor(data?: any); } -export interface MatchQueryAll extends BaseQuery { +export interface MatchQueryAll extends BaseQuery<"match_all"> { } /** * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter. @@ -388,9 +388,11 @@ export declare class ConstantScoreQueryBuilder extends BaseQueryBuilder { * Starts an array of queries. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): ConstantScoreQueryBuilder; + }; } -export interface ConstantScoreQuery extends BaseQuery { +export interface ConstantScoreQuery extends BaseQuery<"constant_score"> { filter: ArrayQuery; } /** @@ -442,22 +444,30 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { * Starts an array of queries for must clause. Use endMust() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginMust(): ArrayQueryBuilder; + beginMust(): ArrayQueryBuilder & { + endMust(): BoolQueryBuilder; + }; /** * Starts an array of queries for filter clause. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): BoolQueryBuilder; + }; /** * Starts an array of queries for should clause. Use endShould() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginShould(): ArrayQueryBuilder; + beginShould(): ArrayQueryBuilder & { + endShould(): BoolQueryBuilder; + }; /** * Starts an array of queries for not clause. Use endNot() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginNot(): ArrayQueryBuilder; + beginNot(): ArrayQueryBuilder & { + endNot(): BoolQueryBuilder; + }; /** * Controls the amount of minimum matching sub queries before a document will be considered. * @param {number} minShouldMatch - number of minimum matching sub queries @@ -472,7 +482,7 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { */ minimumShouldMatch(minShouldMatch: number): this; } -export interface BoolQuery extends BaseQuery { +export interface BoolQuery extends BaseQuery<"bool"> { must?: ArrayQuery; filter?: ArrayQuery; should?: ArrayQuery; @@ -497,8 +507,8 @@ export declare class ArrayQueryBuilder extends BaseQueryBuilder { prefix(field: string, prefix: string): any; exists(field: string): any; } -export interface ArrayQuery { - values: any[]; +export interface ArrayQuery extends BaseQuery<"array"> { + values: QueryTypes[]; } /** * This query builder is the root of each query search. @@ -525,9 +535,15 @@ export declare class QueryBuilder { /** * The query performs a final scoring over all scored sub queries. * @param {boolean} enable - flag to enable or disable final scoring - * @return {QueryBuilder} + * @return {this} */ enableFinalScoring(enable: boolean): this; + /** + * Adds an explanation of the scoring of each document for all matched terms. + * @param {boolean} enable -flag to enable or disable explanation + * @returns {this} + */ + explain(enable: boolean): this; /** * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model. * @@ -535,10 +551,10 @@ export declare class QueryBuilder { * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}. * * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation. - * Lower values result in quicker saturation, and higher values in slower saturation. + * Lower values result in quicker saturation, and higher values in slower saturation * @param {number} [b=0.75] - controls how much effect field-length normalization should have. - * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully. - * @return {QueryBuilder} + * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully + * @return {this} */ BM25Similarity(k1?: number, b?: number): this; bool(): BoolQueryBuilder; @@ -553,9 +569,11 @@ export declare class QueryBuilder { exists(field: string): ExistsQueryBuilder; private _prepare(queryType, ...args); } +export declare type QueryTypes = BoolQuery | ConstantScoreQuery | TermQuery | TermsQuery | WildcardQuery | FuzzyQuery | MatchQuery | MatchQueryAll | PrefixQuery | ExistsQuery; export interface Query { - query: any; + query: QueryTypes; final_scoring?: boolean; + explain?: boolean; bm25?: { k1: number; b: number; diff --git a/dist/packages/full-text-search-language/types/full-text-search/src/scorer.d.ts b/dist/packages/full-text-search-language/types/full-text-search/src/scorer.d.ts index aed3e619..dacdc753 100644 --- a/dist/packages/full-text-search-language/types/full-text-search/src/scorer.d.ts +++ b/dist/packages/full-text-search-language/types/full-text-search/src/scorer.d.ts @@ -1,7 +1,6 @@ import { InvertedIndex } from "./inverted_index"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -export declare type ScoreResult = Dict; /** * @hidden */ @@ -10,9 +9,9 @@ export declare class Scorer { private _cache; constructor(invIdxs: Dict); setDirty(): void; - score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, docResults: Scorer.DocResults, term: number[]): void; - scoreConstant(boost: number, docId: number, docResults: Scorer.DocResults): Map; - finalScore(query: Query, docResults: Scorer.DocResults): ScoreResult; + score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, queryResults: Scorer.QueryResults, term: number[]): void; + scoreConstant(boost: number, docId: number, queryResults: Scorer.QueryResults): Map; + finalScore(query: Query, queryResults: Scorer.QueryResults): Scorer.ScoreResult; private static _calculateFieldLength(fieldLength); private _getCache(fieldName); /** @@ -30,12 +29,33 @@ export declare namespace Scorer { idfs: Dict; avgFieldLength: number; } - interface DocResult { + interface QueryResult { tf?: number; idf?: number; boost: number; fieldName?: string; term?: number[]; } - type DocResults = Map; + type QueryResults = Map; + interface BM25Explanation { + boost: number; + score: number; + docID: number; + fieldName: string; + index: string; + idf: number; + tfNorm: number; + tf: number; + fieldLength: number; + avgFieldLength: number; + } + interface ConstantExplanation { + boost: number; + score: number; + } + type ScoreExplanation = BM25Explanation | ConstantExplanation; + type ScoreResult = Dict<{ + score: number; + explanation?: ScoreExplanation[]; + }>; } diff --git a/dist/packages/full-text-search-language/types/indexed-storage/src/index.d.ts b/dist/packages/full-text-search-language/types/indexed-storage/src/index.d.ts new file mode 100644 index 00000000..bf453632 --- /dev/null +++ b/dist/packages/full-text-search-language/types/indexed-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { IndexedStorage } from "./indexed_storage"; +export { IndexedStorage }; +export default IndexedStorage; diff --git a/dist/packages/full-text-search-language/types/indexed-storage/src/indexed_storage.d.ts b/dist/packages/full-text-search-language/types/indexed-storage/src/indexed_storage.d.ts index 457b01a0..adaeaef1 100644 --- a/dist/packages/full-text-search-language/types/indexed-storage/src/indexed_storage.d.ts +++ b/dist/packages/full-text-search-language/types/indexed-storage/src/indexed_storage.d.ts @@ -6,7 +6,7 @@ import { StorageAdapter } from "../../common/types"; * IndexedDb storage is provided per-domain, so we implement app/key/value database to * allow separate contexts for separate apps within a domain. */ -export declare class LokiIndexedStorage implements StorageAdapter { +export declare class IndexedStorage implements StorageAdapter { private _appname; private catalog; /** @@ -98,4 +98,4 @@ export interface Entry { key: string; size: number; } -export default LokiIndexedStorage; +export default IndexedStorage; diff --git a/dist/packages/full-text-search-language/types/local-storage/src/index.d.ts b/dist/packages/full-text-search-language/types/local-storage/src/index.d.ts new file mode 100644 index 00000000..2b74e8c0 --- /dev/null +++ b/dist/packages/full-text-search-language/types/local-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { LocalStorage } from "./local_storage"; +export { LocalStorage }; +export default LocalStorage; diff --git a/dist/packages/full-text-search-language/types/local-storage/src/local_storage.d.ts b/dist/packages/full-text-search-language/types/local-storage/src/local_storage.d.ts index 2337eb12..380d8be9 100644 --- a/dist/packages/full-text-search-language/types/local-storage/src/local_storage.d.ts +++ b/dist/packages/full-text-search-language/types/local-storage/src/local_storage.d.ts @@ -1,9 +1,9 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists to web browser's local storage object - * @constructor LokiLocalStorageAdapter + * @constructor LocalStorageAdapter */ -export declare class LokiLocalStorage implements StorageAdapter { +export declare class LocalStorage implements StorageAdapter { /** * Registers the local storage as plugin. */ @@ -33,4 +33,4 @@ export declare class LokiLocalStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiLocalStorage; +export default LocalStorage; diff --git a/dist/packages/full-text-search-language/types/loki/src/clone.d.ts b/dist/packages/full-text-search-language/types/loki/src/clone.d.ts index 03b650d7..c74a17bd 100644 --- a/dist/packages/full-text-search-language/types/loki/src/clone.d.ts +++ b/dist/packages/full-text-search-language/types/loki/src/clone.d.ts @@ -1,10 +1,4 @@ -export declare enum CloneMethod { - PARSE_STRINGIFY = 0, - DEEP = 1, - SHALLOW = 2, - SHALLOW_ASSIGN = 3, - SHALLOW_RECURSE_OBJECTS = 4, -} +export declare type CloneMethod = "parse-stringify" | "deep" | "shallow" | "shallow-recurse-objects"; /** * @hidden */ diff --git a/dist/packages/full-text-search-language/types/loki/src/collection.d.ts b/dist/packages/full-text-search-language/types/loki/src/collection.d.ts index 8b44c82f..9bd5e091 100644 --- a/dist/packages/full-text-search-language/types/loki/src/collection.d.ts +++ b/dist/packages/full-text-search-language/types/loki/src/collection.d.ts @@ -1,34 +1,39 @@ import { LokiEventEmitter } from "./event_emitter"; import { UniqueIndex } from "./unique_index"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { DynamicView } from "./dynamic_view"; import { CloneMethod } from "./clone"; -import { Doc, Dict, Query } from "../../common/types"; +import { Doc, Dict } from "../../common/types"; import { FullTextSearch } from "../../full-text-search/src/full_text_search"; import { Tokenizer } from "../../full-text-search/src/tokenizer"; -export declare type ANY = any; export { CloneMethod } from "./clone"; /** * Collection class that handles documents of same type * @extends LokiEventEmitter + * @param - the data type + * @param - nested properties of data type */ -export declare class Collection extends LokiEventEmitter { +export declare class Collection extends LokiEventEmitter { name: string; - data: Doc[]; + _data: Doc[]; private idIndex; - binaryIndices: Dict; + binaryIndices: { + [P in keyof TData]?: Collection.BinaryIndex; + }; /** - * Unique contraints contain duplicate object references, so they are not persisted. - * We will keep track of properties which have unique contraint applied here, and regenerate on load. + * Unique constraints contain duplicate object references, so they are not persisted. + * We will keep track of properties which have unique constraints applied here, and regenerate on load. */ constraints: { - unique: {}; + unique: { + [P in keyof TData]?: UniqueIndex; + }; }; /** * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along * with the database. */ - transforms: {}; + transforms: Dict[]>; /** * In autosave scenarios we will use collection level dirty flags to determine whether save is needed. * currently, if any collection is dirty we will autosave the whole database if autosave is configured. @@ -62,7 +67,7 @@ export declare class Collection extends LokiEventEmit /** * Disable delta update object style on changes. */ - disableDeltaChangesApi: ANY; + disableDeltaChangesApi: boolean; /** * By default, if you insert a document into a collection with binary indices, if those indexed properties contain * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the @@ -72,7 +77,7 @@ export declare class Collection extends LokiEventEmit /** * Option to activate a cleaner daemon - clears "aged" documents at set intervals. */ - ttl: ANY; + ttl: Collection.TTL; private maxId; private _dynamicViews; /** @@ -81,7 +86,15 @@ export declare class Collection extends LokiEventEmit private changes; private insertHandler; private updateHandler; - console: ANY; + console: { + log(...args: any[]): void; + warn(...args: any[]): void; + error(...args: any[]): void; + }; + /** + * stages: a map of uniquely identified 'stages', which hold copies of objects to be + * manipulated without affecting the data in the original collection + */ private stages; private commitLog; _fullTextSearch: FullTextSearch; @@ -97,69 +110,50 @@ export declare class Collection extends LokiEventEmit * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable - * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method + * @param {string} [options.cloneMethod="deep"] - the clone method * @param {number} [options.transactional=false] - ? * @param {number} options.ttl - ? * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @see {@link Loki#addCollection} for normal creation of collections */ - constructor(name: string, options?: Collection.Options); - toJSON(): { - name: string; - _dynamicViews: DynamicView[]; - uniqueNames: string[]; - transforms: {}; - binaryIndices: Dict; - data: Doc[]; - idIndex: number[]; - maxId: number; - dirty: boolean; - adaptiveBinaryIndices: boolean; - transactional: boolean; - asyncListeners: boolean; - disableChangesApi: boolean; - cloneObjects: boolean; - cloneMethod: CloneMethod; - changes: any[]; - _fullTextSearch: FullTextSearch; - }; - static fromJSONObject(obj: ANY, options?: Collection.DeserializeOptions): Collection; + constructor(name: string, options?: Collection.Options); + toJSON(): Collection.Serialized; + static fromJSONObject(obj: Collection.Serialized, options?: Collection.DeserializeOptions): Collection; /** * Adds a named collection transform to the collection * @param {string} name - name to associate with transform * @param {array} transform - an array of transformation 'step' objects to save into the collection */ - addTransform(name: string, transform: ANY[]): void; + addTransform(name: string, transform: Collection.Transform[]): void; /** * Retrieves a named transform from the collection. * @param {string} name - name of the transform to lookup. */ - getTransform(name: string): any; + getTransform(name: string): Collection.Transform[]; /** * Updates a named collection transform to the collection * @param {string} name - name to associate with transform * @param {object} transform - a transformation object to save into collection */ - setTransform(name: string, transform: ANY[]): void; + setTransform(name: string, transform: Collection.Transform[]): void; /** * Removes a named collection transform from the collection * @param {string} name - name of collection transform to remove */ removeTransform(name: string): void; - ttlDaemonFuncGen(): () => void; private setTTL(age, interval); /** * create a row filter that covers all documents in the collection */ - prepareFullDocIndex(): any[]; + _prepareFullDocIndex(): number[]; /** * Ensure binary index on a certain field * @param {string} property - name of property to create binary index on - * @param {boolean} force - (Optional) flag indicating whether to construct index immediately + * @param {boolean} [force=false] - flag indicating whether to construct index immediately */ - ensureIndex(property: string, force?: boolean): void; - getSequencedIndexValues(property: string): string; - ensureUniqueIndex(field: string): UniqueIndex; + ensureIndex(property: keyof TData, force?: boolean): void; + getSequencedIndexValues(property: keyof TData): string; + ensureUniqueIndex(field: keyof TData): UniqueIndex; /** * Ensure all binary indices */ @@ -171,11 +165,11 @@ export declare class Collection extends LokiEventEmit * @param {object} query - (optional) query object to count results of * @returns {number} number of documents in the collection */ - count(query?: object): number; + count(query?: ResultSet.Query & TNested>): number; /** * Rebuild idIndex */ - ensureId(): void; + private _ensureId(); /** * Add a dynamic view to the collection * @param {string} name - name of dynamic view to add @@ -185,7 +179,7 @@ export declare class Collection extends LokiEventEmit * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here) * @returns {DynamicView} reference to the dynamic view added **/ - addDynamicView(name: string, options?: DynamicView.Options): DynamicView; + addDynamicView(name: string, options?: DynamicView.Options): DynamicView; /** * Remove a dynamic view from the collection * @param {string} name - name of dynamic view to remove @@ -196,7 +190,7 @@ export declare class Collection extends LokiEventEmit * @param {string} name - name of dynamic view to retrieve reference of * @returns {DynamicView} A reference to the dynamic view with that name **/ - getDynamicView(name: string): DynamicView; + getDynamicView(name: string): DynamicView; /** * Applies a 'mongo-like' find query object and passes all results to an update function. * For filter function querying you should migrate to [ @@ -205,38 +199,39 @@ export declare class Collection extends LokiEventEmit * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode) * @param {function} updateFunction - update function to run against filtered documents */ - findAndUpdate(filterObject: Query | ((obj: E) => boolean), updateFunction: (obj: E) => E): void; + findAndUpdate(filterObject: ResultSet.Query & TNested> | ((obj: Doc) => boolean), updateFunction: (obj: Doc) => any): void; /** * Applies a 'mongo-like' find query object removes all documents which match that filter. * * @param {object} filterObject - 'mongo-like' query object */ - findAndRemove(filterObject: object): void; + findAndRemove(filterObject: ResultSet.Query & TNested>): void; /** * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc. * @param {(object|array)} doc - the document (or array of documents) to be inserted * @returns {(object|array)} document or documents inserted */ - insert(doc: E | E[]): Doc; - insert(doc: E[]): Doc[]; + insert(doc: TData): Doc; + insert(doc: TData[]): Doc[]; /** * Adds a single object, ensures it has meta properties, clone it if necessary, etc. * @param {object} doc - the document to be inserted * @param {boolean} bulkInsert - quiet pre-insert and insert event emits * @returns {object} document or 'undefined' if there was a problem inserting it */ - insertOne(doc: E, bulkInsert?: boolean): Doc; + insertOne(doc: TData, bulkInsert?: boolean): Doc; /** * Empties the collection. - * @param {object} options - configure clear behavior - * @param {boolean} options.removeIndices - (default: false) + * @param {boolean} [removeIndices=false] - remove indices */ - clear(options?: ANY): void; + clear({removeIndices: removeIndices}?: { + removeIndices?: boolean; + }): void; /** * Updates an object and notifies collection that the document has changed. * @param {object} doc - document to update within the collection */ - update(doc: ANY): any; + update(doc: Doc | Doc[]): void; /** * Add object to collection */ @@ -247,24 +242,24 @@ export declare class Collection extends LokiEventEmit * @param {function} filterFunction - filter function whose results will execute update * @param {function} updateFunction - update function to run against filtered documents */ - updateWhere(filterFunction: (obj: E) => boolean, updateFunction: (obj: E) => E): void; + updateWhere(filterFunction: (obj: Doc) => boolean, updateFunction: (obj: Doc) => any): void; /** * Remove all documents matching supplied filter function. * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}. * @param {function|object} query - query object to filter on */ - removeWhere(query: Query | ((obj: E) => boolean)): void; + removeWhere(query: ResultSet.Query & TNested> | ((obj: Doc) => boolean)): void; removeDataOnly(): void; /** * Remove a document from the collection - * @param {object} doc - document to remove from collection + * @param {number|object} doc - document to remove from collection */ - remove(doc: ANY): any; + remove(doc: number | Doc | Doc[]): void; /** * Returns all changes. - * @returns {ANY} + * @returns {Collection.Change[]} */ - getChanges(): any[]; + getChanges(): Collection.Change[]; /** * Enables/disables changes api. * @param {boolean} disableChangesApi @@ -301,34 +296,35 @@ export declare class Collection extends LokiEventEmit * @returns {(object|array|null)} Object reference if document was found, null if not, * or an array if 'returnPosition' was passed. */ - get(id: number): Doc; - get(id: number, returnPosition: boolean): Doc | [Doc, number]; + get(id: number): Doc; + get(id: number, returnPosition: boolean): Doc | [Doc, number]; /** * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value * Since multiple documents may contain the same value (which the index is sorted on), * we hone in on range and then linear scan range to find exact index array position. - * @param {int} dataPosition : coll.data array index/position + * @param {int} dataPosition : data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - getBinaryIndexPosition(dataPosition: number, binaryIndexName: string): number; + getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData): number; /** * Adaptively insert a selected item to the index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively update a selected item within an index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively remove a selected item from the index. - * @param {int} dataPosition : coll.data array index/position + * @param {number} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in + * @param {boolean} removedFromIndexOnly - remove from index only */ - adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: string, removedFromIndexOnly?: boolean): ANY; + adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly?: boolean): void; /** * Internal method used for index maintenance and indexed searching. * Calculates the beginning of an index range for a given value. @@ -351,7 +347,7 @@ export declare class Collection extends LokiEventEmit private _calculateRangeEnd(prop, val); /** * Binary Search utility method to find range/segment of values matching criteria. - * this is used for collection.find() and first find filter of resultset/dynview + * this is used for collection.find() and first find filter of ResultSet/dynview * slightly different than get() binary search in that get() hones in on 1 value, * but we have to hone in on many (range) * @param {string} op - operation, such as $eq @@ -359,29 +355,29 @@ export declare class Collection extends LokiEventEmit * @param {object} val - value to use for range calculation. * @returns {array} [start, end] index array positions */ - calculateRange(op: string, prop: string, val: ANY): [number, number]; + calculateRange(op: string, prop: keyof TData, val: any): [number, number]; /** * Retrieve doc by Unique index * @param {string} field - name of uniquely indexed property to use when doing lookup * @param {any} value - unique value to search for * @returns {object} document matching the value passed */ - by(field: string, value: ANY): Doc; + by(field: string, value: any): Doc; /** * Find one object by index property, by property equal to value * @param {object} query - query object used to perform search with * @returns {(object|null)} First matching document, or null if none */ - findOne(query: object): Doc; + findOne(query: ResultSet.Query & TNested>): Doc; /** * Chain method, used for beginning a series of chained find() and/or view() operations * on a collection. * * @param {array} transform - Ordered array of transform step objects similar to chain * @param {object} parameters - Object containing properties representing parameters to substitute - * @returns {Resultset} (this) resultset, or data array if any map or join functions where called + * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called */ - chain(transform?: string | ANY[], parameters?: ANY): Resultset; + chain(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** * Find method, api is similar to mongodb. * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}. @@ -389,20 +385,26 @@ export declare class Collection extends LokiEventEmit * @param {object} query - 'mongo-like' query object * @returns {array} Array of matching documents */ - find(query?: Query): Doc[]; + find(query?: ResultSet.Query & TNested>): Doc[]; /** * Find object by unindexed field by property equal to value, * simply iterates and returns the first element matching the query */ - findOneUnindexed(prop: string, value: ANY): Doc; + findOneUnindexed(prop: string, value: any): Doc; /** * Transaction methods */ - /** start the transation */ + /** + * start the transation + */ startTransaction(): void; - /** commit the transation */ + /** + * commit the transation + */ commit(): void; - /** roll back the transation */ + /** + * roll back the transation + */ rollback(): void; /** * Query the collection by supplying a javascript filter function. @@ -414,14 +416,14 @@ export declare class Collection extends LokiEventEmit * @param {function} fun - filter function to run against all collection docs * @returns {array} all documents which pass your filter function */ - where(fun: (obj: E) => boolean): Doc[]; + where(fun: (obj: Doc) => boolean): Doc[]; /** * Map Reduce operation * @param {function} mapFunction - function to use as map function * @param {function} reduceFunction - function to use as reduce function * @returns {data} The result of your mapReduce operation */ - mapReduce(mapFunction: (value: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (value: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Join two collections on specified properties * @@ -429,13 +431,13 @@ export declare class Collection extends LokiEventEmit * @param {string} leftJoinProp - property name in collection * @param {string} rightJoinProp - property name in joinData * @param {function} mapFun - (Optional) map function to use - * @returns {Resultset} Result of the mapping operation - */ - eqJoin(joinData: ANY[], leftJoinProp: string, rightJoinProp: string, mapFun?: Function): Resultset; - /** - * stages: a map of uniquely identified 'stages', which hold copies of objects to be - * manipulated without affecting the data in the original collection + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method + * @returns {ResultSet} Result of the mapping operation */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinProp: string | ((obj: any) => string), rightJoinProp: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * (Staging API) create a stage and/or retrieve it */ @@ -446,7 +448,7 @@ export declare class Collection extends LokiEventEmit /** * (Staging API) create a copy of an object and insert it into a stage */ - stage(stageName: string, obj: ANY): any; + stage(stageName: string, obj: Doc): F; /** * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt * then create a message to be inserted in the commitlog @@ -459,10 +461,10 @@ export declare class Collection extends LokiEventEmit extract(field: string): any[]; /** */ - max(field: string): any; + max(field: string): number; /** */ - min(field: string): any; + min(field: string): number; /** */ maxRecord(field: string): { @@ -500,9 +502,9 @@ export declare class Collection extends LokiEventEmit median(field: string): number; } export declare namespace Collection { - interface Options { - unique?: string[]; - indices?: string[]; + interface Options { + unique?: (keyof TData)[]; + indices?: (keyof TData)[]; adaptiveBinaryIndices?: boolean; asyncListeners?: boolean; disableChangesApi?: boolean; @@ -518,10 +520,89 @@ export declare namespace Collection { interface DeserializeOptions { retainDirtyFlags?: boolean; fullTextSearch?: Dict; + [collName: string]: any | { + proto?: any; + inflate?: (src: object, dest?: object) => void; + }; } interface BinaryIndex { dirty: boolean; values: any; } - type Change = any; + interface Change { + name: string; + operation: string; + obj: any; + } + interface Serialized { + name: string; + _dynamicViews: DynamicView[]; + uniqueNames: string[]; + transforms: Dict; + binaryIndices: Dict; + _data: Doc[]; + idIndex: number[]; + maxId: number; + dirty: boolean; + adaptiveBinaryIndices: boolean; + transactional: boolean; + asyncListeners: boolean; + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + cloneObjects: boolean; + cloneMethod: CloneMethod; + changes: any; + _fullTextSearch: FullTextSearch; + } + type Transform = { + type: "find"; + value: ResultSet.Query & TNested> | string; + } | { + type: "where"; + value: ((obj: Doc) => boolean) | string; + } | { + type: "simplesort"; + property: keyof (TData & TNested); + desc?: boolean; + } | { + type: "compoundsort"; + value: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]; + } | { + type: "sort"; + value: (a: Doc, b: Doc) => number; + } | { + type: "sortByScoring"; + desc?: boolean; + } | { + type: "limit"; + value: number; + } | { + type: "offset"; + value: number; + } | { + type: "map"; + value: (obj: TData, index: number, array: TData[]) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "eqJoin"; + joinData: Collection | ResultSet; + leftJoinKey: string | ((obj: any) => string); + rightJoinKey: string | ((obj: any) => string); + mapFun?: (left: any, right: any) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "mapReduce"; + mapFunction: (item: TData, index: number, array: TData[]) => any; + reduceFunction: (array: any[]) => any; + } | { + type: "update"; + value: (obj: Doc) => any; + } | { + type: "remove"; + }; + interface TTL { + age: number; + ttlInterval: number; + daemon: any; + } } diff --git a/dist/packages/full-text-search-language/types/loki/src/dynamic_view.d.ts b/dist/packages/full-text-search-language/types/loki/src/dynamic_view.d.ts index 1aeab3a4..5cda4b13 100644 --- a/dist/packages/full-text-search-language/types/loki/src/dynamic_view.d.ts +++ b/dist/packages/full-text-search-language/types/loki/src/dynamic_view.d.ts @@ -1,9 +1,8 @@ import { LokiEventEmitter } from "./event_emitter"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { Collection } from "./collection"; -import { Doc, Filter } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; /** * DynamicView class is a versatile 'live' view class which can have filters and sorts applied. * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it @@ -18,18 +17,21 @@ export declare type ANY = any; * @extends LokiEventEmitter * @see {@link Collection#addDynamicView} to construct instances of DynamicView + * + * @param - the data type + * @param - nested properties of data type */ -export declare class DynamicView extends LokiEventEmitter { +export declare class DynamicView extends LokiEventEmitter { private _collection; private _persistent; private _sortPriority; private _minRebuildInterval; name: string; private _rebuildPending; - private _resultset; - private _resultdata; - private _resultsdirty; - private _cachedresultset; + private _resultSet; + private _resultData; + private _resultDirty; + private _cachedResultSet; private _filterPipeline; private _sortFunction; private _sortCriteria; @@ -41,10 +43,10 @@ export declare class DynamicView extends LokiEventEmi * @param {string} name - the name of this dynamic view * @param {object} options - the options * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' - * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority + * @param {string} [options.sortPriority="passive"] - the sort priority * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here) */ - constructor(collection: Collection, name: string, options?: DynamicView.Options); + constructor(collection: Collection, name: string, options?: DynamicView.Options); /** * Internally used immediately after deserialization (loading) * This will clear out and reapply filterPipeline ops, recreating the view. @@ -57,34 +59,22 @@ export declare class DynamicView extends LokiEventEmi */ _rematerialize({removeWhereFilters}: { removeWhereFilters?: boolean; - }): DynamicView; + }): this; /** - * Makes a copy of the internal resultset for branched queries. - * Unlike this dynamic view, the branched resultset will not be 'live' updated, + * Makes a copy of the internal ResultSet for branched queries. + * Unlike this dynamic view, the branched ResultSet will not be 'live' updated, * so your branched query should be immediately resolved and not held for future evaluation. * * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps * @param {object} parameters - optional parameters (if optional transform requires them) - * @returns {Resultset} A copy of the internal resultset for branched queries. + * @returns {ResultSet} A copy of the internal ResultSet for branched queries. */ - branchResultset(transform: string | any[], parameters?: object): Resultset; + branchResultSet(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** - * toJSON() - Override of toJSON to avoid circular references - * + * Override of toJSON to avoid circular references. */ - toJSON(): { - name: string; - _persistent: boolean; - _sortPriority: DynamicView.SortPriority; - _minRebuildInterval: number; - _resultset: Resultset; - _resultsdirty: boolean; - _filterPipeline: Filter[]; - _sortCriteria: (string | [string, boolean])[]; - _sortByScoring: boolean; - _sortDirty: boolean; - }; - static fromJSONObject(collection: ANY, obj: ANY): DynamicView; + toJSON(): DynamicView.Serialized; + static fromJSONObject(collection: Collection, obj: DynamicView.Serialized): DynamicView; /** * Used to clear pipeline and reset dynamic view to initial state. * Existing options should be retained. @@ -105,7 +95,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} comparefun - a javascript compare function used for sorting * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySort(comparefun: (lhs: E, rhs: E) => number): DynamicView; + applySort(comparefun: (lhs: Doc, rhs: Doc) => number): this; /** * Used to specify a property used for view translation. * @example @@ -115,9 +105,9 @@ export declare class DynamicView extends LokiEventEmi * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySimpleSort(propname: string, isdesc?: boolean): DynamicView; + applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * dv.applySortCriteria(['age', 'name']); @@ -129,32 +119,32 @@ export declare class DynamicView extends LokiEventEmi * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations. */ - applySortCriteria(criteria: (string | [string, boolean])[]): DynamicView; + applySortCriteria(criteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Used to apply a sort by the latest full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending */ - applySortByScoring(ascending?: boolean): DynamicView; + applySortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** * Marks the beginning of a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - startTransaction(): DynamicView; + startTransaction(): this; /** * Commits a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - commit(): DynamicView; + commit(): this; /** * Rolls back a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - rollback(): DynamicView; + rollback(): this; /** * Find the index of a filter in the pipeline, by that filter's ID. * @@ -163,7 +153,7 @@ export declare class DynamicView extends LokiEventEmi */ private _indexOfFilterWithId(uid); /** - * Add the filter object to the end of view's filter pipeline and apply the filter to the resultset. + * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet. * * @param {object} filter - The filter object. Refer to applyFilter() for extra details. */ @@ -173,7 +163,7 @@ export declare class DynamicView extends LokiEventEmi * * @returns {DynamicView} this DynamicView object, for further chain ops. */ - reapplyFilters(): DynamicView; + reapplyFilters(): this; /** * Adds or updates a filter in the DynamicView filter pipeline * @@ -181,7 +171,7 @@ export declare class DynamicView extends LokiEventEmi * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id } * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFilter(filter: Filter): DynamicView; + applyFilter(filter: DynamicView.Filter): this; /** * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline * @@ -189,7 +179,7 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFind(query: object, uid?: string | number): DynamicView; + applyFind(query: object, uid?: string | number): this; /** * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline * @@ -197,14 +187,14 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyWhere(fun: (obj: E) => boolean, uid?: string | number): DynamicView; + applyWhere(fun: (obj: Doc) => boolean, uid?: string | number): this; /** * removeFilter() - Remove the specified filter from the DynamicView filter pipeline * * @param {(string|number)} uid - The unique ID of the filter to be removed. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - removeFilter(uid: string | number): DynamicView; + removeFilter(uid: string | number): this; /** * Returns the number of documents representing the current DynamicView contents. * @returns {number} The number of documents representing the current DynamicView contents. @@ -213,16 +203,16 @@ export declare class DynamicView extends LokiEventEmi /** * Resolves and pending filtering and sorting, then returns document array as result. * - * @param {object} options - optional parameters to pass to resultset.data() if non-persistent - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * * @returns {Array} An array of documents representing the current DynamicView contents. */ - data(options?: object): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** * When the view is not sorted we may still wish to be notified of rebuild events. * This event will throttle and queue a single rebuild event when batches of updates affect the view. @@ -257,7 +247,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; } export declare namespace DynamicView { interface Options { @@ -265,8 +255,25 @@ export declare namespace DynamicView { sortPriority?: SortPriority; minRebuildInterval?: number; } - enum SortPriority { - PASSIVE = 0, - ACTIVE = 1, + type SortPriority = "passive" | "active"; + interface Serialized { + name: string; + _persistent: boolean; + _sortPriority: SortPriority; + _minRebuildInterval: number; + _resultSet: ResultSet; + _filterPipeline: Filter[]; + _sortCriteria: (string | [string, boolean])[]; + _sortByScoring: boolean; + _sortDirty: boolean; } + type Filter = { + type: "find"; + val: ResultSet.Query & TNested>; + uid: number | string; + } | { + type: "where"; + val: (obj: Doc) => boolean; + uid: number | string; + }; } diff --git a/dist/packages/full-text-search-language/types/loki/src/event_emitter.d.ts b/dist/packages/full-text-search-language/types/loki/src/event_emitter.d.ts index f422ee35..e55515e9 100644 --- a/dist/packages/full-text-search-language/types/loki/src/event_emitter.d.ts +++ b/dist/packages/full-text-search-language/types/loki/src/event_emitter.d.ts @@ -1,4 +1,3 @@ -export declare type ANY = any; /** * LokiEventEmitter is a minimalist version of EventEmitter. It enables any * constructor that inherits EventEmitter to emit events and trigger @@ -31,7 +30,7 @@ export declare class LokiEventEmitter { * @param {string} eventName - the name of the event * @param {object} data - optional object passed with the event */ - emit(eventName: string, ...data: ANY[]): void; + emit(eventName: string, ...data: any[]): void; /** * Alias of LokiEventEmitter.prototype.on * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event diff --git a/dist/packages/full-text-search-language/types/loki/src/helper.d.ts b/dist/packages/full-text-search-language/types/loki/src/helper.d.ts index b187e0eb..44b72305 100644 --- a/dist/packages/full-text-search-language/types/loki/src/helper.d.ts +++ b/dist/packages/full-text-search-language/types/loki/src/helper.d.ts @@ -1,8 +1,5 @@ /** - * @hidden - */ -export declare type ANY = any; -/** Helper function for determining 'loki' abstract equality which is a little more abstract than == + * Helper function for determining 'loki' abstract equality which is a little more abstract than == * aeqHelper(5, '5') === true * aeqHelper(5.0, '5') === true * aeqHelper(new Date("1/1/2011"), new Date("1/1/2011")) === true @@ -10,34 +7,33 @@ export declare type ANY = any; * aeqHelper([1, 2, 3], [1, 3]) === false * aeqHelper([1, 2, 3], [1, 2, 3]) === true * aeqHelper(undefined, null) === true - */ -/** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @returns {boolean} + * @hidden */ -export declare function aeqHelper(prop1: ANY, prop2: ANY): boolean; -/** Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. +export declare function aeqHelper(prop1: any, prop2: any): boolean; +/** + * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. * In the future we might want $lt and $gt ops to use their own functionality/helper. * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another. * @hidden */ -export declare function ltHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function ltHelper(prop1: any, prop2: any, equal: boolean): boolean; /** * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @param {boolean} equal * @returns {boolean} */ -export declare function gtHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function gtHelper(prop1: any, prop2: any, equal: boolean): boolean; /** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 - * @param {ANY} desc + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} descending * @returns {number} + * @hidden */ -export declare function sortHelper(prop1: ANY, prop2: ANY, desc: ANY): 0 | 1 | -1; +export declare function sortHelper(prop1: any, prop2: any, descending: boolean): number; diff --git a/dist/packages/full-text-search-language/types/loki/src/index.d.ts b/dist/packages/full-text-search-language/types/loki/src/index.d.ts index dee82236..17ee6df4 100644 --- a/dist/packages/full-text-search-language/types/loki/src/index.d.ts +++ b/dist/packages/full-text-search-language/types/loki/src/index.d.ts @@ -1,7 +1,4 @@ import { Loki } from "./loki"; import { Collection } from "./collection"; export { Loki, Collection }; -declare const _default: { - Loki: typeof Loki; -}; -export default _default; +export default Loki; diff --git a/dist/packages/full-text-search-language/types/loki/src/loki.d.ts b/dist/packages/full-text-search-language/types/loki/src/loki.d.ts index 10e81b65..f2deafd2 100644 --- a/dist/packages/full-text-search-language/types/loki/src/loki.d.ts +++ b/dist/packages/full-text-search-language/types/loki/src/loki.d.ts @@ -1,7 +1,6 @@ import { LokiEventEmitter } from "./event_emitter"; import { Collection } from "./collection"; import { Doc, StorageAdapter } from "../../common/types"; -export declare type ANY = any; export declare class Loki extends LokiEventEmitter { private filename; private databaseVersion; @@ -23,7 +22,7 @@ export declare class Loki extends LokiEventEmitter { * Constructs the main database class. * @param {string} filename - name of the file to be saved to * @param {object} [options={}] - options - * @param {Loki.Environment} [options.env=auto] - overrides environment detection + * @param {Loki.Environment} [options.env] - the javascript environment * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method * @param {string} [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization * @param {boolean} [options.verbose=false] - enable console output @@ -64,21 +63,21 @@ export declare class Loki extends LokiEventEmitter { * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @returns {Collection} a reference to the collection which was just added */ - addCollection(name: string, options?: Collection.Options): Collection; + addCollection(name: string, options?: Collection.Options): Collection; loadCollection(collection: Collection): void; /** * Retrieves reference to a collection by name. * @param {string} collectionName - name of collection to look up * @returns {Collection} Reference to collection in database by that name, or null if not found */ - getCollection(collectionName: string): Collection; + getCollection(collectionName: string): Collection; /** * Renames an existing loki collection * @param {string} oldName - name of collection to rename * @param {string} newName - new name of collection * @returns {Collection} reference to the newly renamed collection */ - renameCollection(oldName: string, newName: string): Collection<{}>; + renameCollection(oldName: string, newName: string): Collection; listCollections(): { name: string; count: number; @@ -95,20 +94,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {string} Stringified representation of the loki database. */ serialize(options?: Loki.SerializeOptions): string | string[]; - toJSON(): { - _env: Loki.Environment; - _serializationMethod: Loki.SerializationMethod; - _autosave: boolean; - _autosaveInterval: number; - _collections: Collection[]; - databaseVersion: number; - engineVersion: number; - filename: string; - _persistenceAdapter: StorageAdapter; - _persistenceMethod: Loki.PersistenceMethod; - _throttledSaves: boolean; - _verbose: boolean; - }; + toJSON(): Loki.Serialized; /** * Database level destructured JSON serialization routine to allow alternate serialization methods. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -134,7 +120,11 @@ export declare class Loki extends LokiEventEmitter { * * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection. */ - serializeCollection(options?: ANY): string | string[]; + serializeCollection(options?: { + delimited?: boolean; + collectionIndex?: number; + delimiter?: string; + }): string | string[]; /** * Database level destructured JSON deserialization routine to minimize memory overhead. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -150,7 +140,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array */ - deserializeDestructured(destructuredSource: ANY, options?: Loki.SerializeDestructuredOptions): any; + deserializeDestructured(destructuredSource: string | string[], options?: Loki.SerializeDestructuredOptions): any; /** * Collection level utility function to deserializes a destructured collection. * @@ -161,7 +151,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {Array} an array of documents to attach to collection.data. */ - deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc; + deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc[]; /** * Inflates a loki database from a serialized JSON string * @@ -169,15 +159,16 @@ export declare class Loki extends LokiEventEmitter { * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSON(serializedDb: string | string[], options?: ANY): void; + loadJSON(serializedDb: string | string[], options?: Collection.DeserializeOptions): void; /** * Inflates a loki database from a JS object * - * @param {object} dbObject - a serialized loki database string + * @param {object} dbObject - a serialized loki database object * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSONObject(dbObject: ANY, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki.Serialized, options?: Collection.DeserializeOptions): void; /** * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer. * Does not actually destroy the db. @@ -201,7 +192,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {Array} array of changes * @see private method _createChange() in Collection */ - generateChangesNotification(arrayOfCollectionNames?: string[]): any[]; + generateChangesNotification(arrayOfCollectionNames?: string[]): Collection.Change[]; /** * (Changes API) - stringify changes for network transmission * @returns {string} string representation of the changes @@ -310,24 +301,22 @@ export declare namespace Loki { recursiveWaitLimitDuration?: number; started?: Date; } - type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; - enum SerializationMethod { - NORMAL = 0, - PRETTY = 1, - DESTRUCTURED = 2, - } - enum PersistenceMethod { - FS_STORAGE = 0, - LOCAL_STORAGE = 1, - INDEXED_STORAGE = 2, - MEMORY_STORAGE = 3, - ADAPTER = 4, - } - enum Environment { - NODE_JS = 0, - NATIVE_SCRIPT = 1, - BROWSER = 2, - CORDOVA = 3, - MEMORY = 4, + interface Serialized { + _env: Environment; + _serializationMethod: SerializationMethod; + _autosave: boolean; + _autosaveInterval: number; + _collections: Collection[]; + databaseVersion: number; + engineVersion: number; + filename: string; + _persistenceAdapter: StorageAdapter; + _persistenceMethod: PersistenceMethod; + _throttledSaves: boolean; + _verbose: boolean; } + type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; + type SerializationMethod = "normal" | "pretty" | "destructured"; + type PersistenceMethod = "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter"; + type Environment = "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "MEMORY"; } diff --git a/dist/packages/full-text-search-language-de/types/loki/src/resultset.d.ts b/dist/packages/full-text-search-language/types/loki/src/result_set.d.ts similarity index 52% rename from dist/packages/full-text-search-language-de/types/loki/src/resultset.d.ts rename to dist/packages/full-text-search-language/types/loki/src/result_set.d.ts index 8ee6b343..b29e3a52 100644 --- a/dist/packages/full-text-search-language-de/types/loki/src/resultset.d.ts +++ b/dist/packages/full-text-search-language/types/loki/src/result_set.d.ts @@ -1,8 +1,8 @@ import { Collection } from "./collection"; import { CloneMethod } from "./clone"; -import { Doc, Query } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; +import { Query as FullTextSearchQuery } from "../../full-text-search/src/query_builder"; /** * @hidden */ @@ -15,29 +15,29 @@ export declare const LokiOps: { $gte(a: any, b: any): boolean; $lt(a: any, b: any): boolean; $lte(a: any, b: any): boolean; - $between(a: any, vals: any): boolean; + $between(a: any, range: [any, any]): boolean; $in(a: any, b: any): boolean; $nin(a: any, b: any): boolean; - $keyin(a: any, b: any): boolean; - $nkeyin(a: any, b: any): boolean; - $definedin(a: any, b: any): boolean; - $undefinedin(a: any, b: any): boolean; - $regex(a: any, b: any): any; - $containsString(a: any, b: any): boolean; + $keyin(a: string, b: object): boolean; + $nkeyin(a: string, b: object): boolean; + $definedin(a: string, b: object): boolean; + $undefinedin(a: string, b: object): boolean; + $regex(a: string, b: RegExp): boolean; + $containsString(a: any, b: string): boolean; $containsNone(a: any, b: any): boolean; - $containsAny(a: any, b: any): any; - $contains(a: any, b: any): any; - $type(a: any, b: any): any; - $finite(a: any, b: any): boolean; - $size(a: any, b: any): any; - $len(a: any, b: any): any; + $containsAny(a: any, b: any): boolean; + $contains(a: any, b: any): boolean; + $type(a: any, b: any): boolean; + $finite(a: number, b: boolean): boolean; + $size(a: any, b: any): boolean; + $len(a: any, b: any): boolean; $where(a: any, b: any): boolean; $not(a: any, b: any): boolean; $and(a: any, b: any): boolean; $or(a: any, b: any): boolean; }; /** - * Resultset class allowing chainable queries. Intended to be instanced internally. + * ResultSet class allowing chainable queries. Intended to be instanced internally. * Collection.find(), Collection.where(), and Collection.chain() instantiate this. * * @example @@ -45,61 +45,64 @@ export declare const LokiOps: { * .find({ 'doors' : 4 }) * .where(function(obj) { return obj.name === 'Toyota' }) * .data(); + * + * @param - the data type + * @param - nested properties of data type */ -export declare class Resultset { - collection: Collection; - filteredrows: number[]; - filterInitialized: boolean; +export declare class ResultSet { + _collection: Collection; + _filteredRows: number[]; + _filterInitialized: boolean; private _scoring; /** * Constructor. - * @param {Collection} collection - the collection which this Resultset will query against + * @param {Collection} collection - the collection which this ResultSet will query against */ - constructor(collection: Collection); + constructor(collection: Collection); /** - * reset() - Reset the resultset to its initial state. + * reset() - Reset the ResultSet to its initial state. * - * @returns {Resultset} Reference to this resultset, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, for future chain operations. */ - reset(): Resultset; + reset(): this; /** - * toJSON() - Override of toJSON to avoid circular references + * Override of toJSON to avoid circular references * */ - toJSON(): Resultset; + toJSON(): ResultSet; /** * Allows you to limit the number of documents passed to next chain operation. - * A resultset copy() is made to avoid altering original resultset. + * A ResultSet copy() is made to avoid altering original ResultSet. * * @param {int} qty - The number of documents to return. - * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops. + * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops. */ - limit(qty: number): Resultset; + limit(qty: number): this; /** - * Used for skipping 'pos' number of documents in the resultset. + * Used for skipping 'pos' number of documents in the ResultSet. * * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. - * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. + * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops. */ - offset(pos: number): Resultset; + offset(pos: number): this; /** - * copy() - To support reuse of resultset in branched query situations. + * copy() - To support reuse of ResultSet in branched query situations. * - * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same. + * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same. */ - copy(): Resultset; + copy(): ResultSet; /** * Alias of copy() */ - branch(): Resultset; + branch(): ResultSet; /** - * Executes a named collection transform or raw array of transform steps against the resultset. + * Executes a named collection transform or raw array of transform steps against the ResultSet. * * @param {(string|array)} transform - name of collection transform or raw transform array * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. - * @returns {Resultset} either (this) resultset or a clone of of this resultset (depending on steps) + * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps) */ - transform(transform: string | any[], parameters?: object): Resultset; + transform(transform: string | Collection.Transform[], parameters?: object): this; /** * User supplied compare function is provided two documents to compare. (chainable) * @example @@ -110,20 +113,20 @@ export declare class Resultset { * }); * * @param {function} comparefun - A javascript compare function used for sorting. - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - sort(comparefun: (a: E, b: E) => number): Resultset; + sort(comparefun: (a: Doc, b: Doc) => number): this; /** * Simpler, loose evaluation for user to sort based on a property name. (chainable). * Sorting based on the same lt/gt helper functions used for binary indices. * * @param {string} propname - name of property to sort by. - * @param {boolean} isdesc - (Optional) If true, the property will be sorted in descending order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @param {boolean} [descending=false] - if true, the property will be sorted in descending order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - simplesort(propname: string, isdesc?: boolean): Resultset; + simplesort(propname: keyof (TData & TNested), descending?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * rs.compoundsort(['age', 'name']); @@ -131,9 +134,9 @@ export declare class Resultset { * rs.compoundsort(['age', ['name', true]); * * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - compoundsort(properties: (string | [string, boolean])[]): Resultset; + compoundsort(properties: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Helper function for compoundsort(), performing individual object comparisons * @@ -144,83 +147,83 @@ export declare class Resultset { */ private _compoundeval(properties, obj1, obj2); /** - * Sorts the resultset based on the last full-text-search scoring. + * Sorts the ResultSet based on the last full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending - * @returns {Resultset} + * @returns {ResultSet} */ - sortByScoring(ascending?: boolean): Resultset; + sortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** - * findOr() - oversee the operation of OR'ed query expressions. + * Oversee the operation of OR'ed query expressions. * OR'ed expression evaluation runs each expression individually against the full collection, * and finally does a set OR on each expression's results. * Each evaluation can utilize a binary index to prevent multiple linear array scans. * * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - findOr(expressionArray: Query[]): Resultset; - $or(expressionArray: Query[]): Resultset; + findOr(expressionArray: ResultSet.Query & TNested>[]): this; + $or(expressionArray: ResultSet.Query & TNested>[]): this; /** - * findAnd() - oversee the operation of AND'ed query expressions. + * Oversee the operation of AND'ed query expressions. * AND'ed expression evaluation runs each expression progressively against the full collection, - * internally utilizing existing chained resultset functionality. + * internally utilizing existing chained ResultSet functionality. * Only the first filter can utilize a binary index. * * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - findAnd(expressionArray: Query[]): Resultset; - $and(expressionArray: Query[]): Resultset; + findAnd(expressionArray: ResultSet.Query & TNested>[]): this; + $and(expressionArray: ResultSet.Query & TNested>[]): this; /** * Used for querying via a mongo-style query object. * * @param {object} query - A mongo-style query object used for filtering current results. * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - find(query?: Query, firstOnly?: boolean): Resultset; + find(query?: ResultSet.Query & TNested>, firstOnly?: boolean): this; /** * Used for filtering via a javascript filter function. * * @param {function} fun - A javascript function used for filtering current results by. - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - where(fun: (obj: E) => boolean): Resultset; + where(fun: (obj: Doc) => boolean): this; /** - * Returns the number of documents in the resultset. - * @returns {number} The number of documents in the resultset. + * Returns the number of documents in the ResultSet. + * @returns {number} The number of documents in the ResultSet. */ count(): number; /** * Terminates the chain and returns array of filtered documents * @param {object} options - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values 'parse-stringify', 'deep', and 'shallow' and + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * - * @returns {Array} Array of documents in the resultset + * @returns {Array} Array of documents in the ResultSet */ - data(options?: Resultset.DataOptions): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** - * Used to run an update operation on all documents currently in the resultset. + * Used to run an update operation on all documents currently in the ResultSet. * * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ - update(updateFunction: (obj: E) => E): Resultset; + update(updateFunction: (obj: Doc) => TData): this; /** - * Removes all document objects which are currently in resultset from collection (as well as resultset) + * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet) * - * @returns {Resultset} this (empty) resultset for further chain ops. + * @returns {ResultSet} this (empty) ResultSet for further chain ops. */ - remove(): Resultset; + remove(): this; /** * data transformation via user supplied functions * @@ -228,35 +231,72 @@ export declare class Resultset { * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns {value} The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Left joining two sets of data. Join keys can be defined or calculated properties * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key - * @param {Array|Resultset|Collection} joinData - Data array to join to. + * @param {Array|ResultSet|Collection} joinData - Data array to join to. * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}] + * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method + * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}] */ - eqJoin(joinData: ANY, leftJoinKey: string | Function, rightJoinKey: string | Function, mapFun?: Function, dataOptions?: ANY): ANY; + eqJoin(joinData: Collection | ResultSet | any[], leftJoinKey: string | ((obj: any) => string), rightJoinKey: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * Applies a map function into a new collection for further chaining. * @param {function} mapFun - javascript map function * @param {object} [dataOptions=] - options to data() before input to your map function * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method + * @return {ResultSet} */ - map(mapFun: (obj: E, index: number, array: E[]) => U, dataOptions?: Resultset.DataOptions): Resultset; + map(mapFun: (obj: TData, index: number, array: TData[]) => U, dataOptions?: ResultSet.DataOptions): ResultSet; } -export declare namespace Resultset { +export declare namespace ResultSet { interface DataOptions { forceClones?: boolean; forceCloneMethod?: CloneMethod; removeMeta?: boolean; } + type LokiOps = { + $eq?: R; + $aeq?: R; + $ne?: R; + $dteq?: R; + $gt?: R; + $gte?: R; + $lt?: R; + $lte?: R; + $between?: [R, R]; + $in?: R[]; + $nin?: R[]; + $keyin?: object; + $nkeyin?: object; + $definedin?: object; + $undefinedin?: object; + $regex?: RegExp | string | [string, string]; + $containsString?: string; + $containsNone?: R[] | R; + $containsAny?: R[] | R; + $contains?: any; + $type?: string; + $finite?: boolean; + $size?: number; + $len?: number; + $where?: (val?: R) => boolean; + }; + type Query = { + [P in keyof TData]?: LokiOps | TData[P]; + } & { + $and?: Query[]; + } & { + $or?: Query[]; + } & { + $fts?: FullTextSearchQuery; + }; } diff --git a/dist/packages/full-text-search-language/types/loki/src/unique_index.d.ts b/dist/packages/full-text-search-language/types/loki/src/unique_index.d.ts index 40312618..55284c11 100644 --- a/dist/packages/full-text-search-language/types/loki/src/unique_index.d.ts +++ b/dist/packages/full-text-search-language/types/loki/src/unique_index.d.ts @@ -1,30 +1,30 @@ import { Doc } from "../../common/types"; -export declare class UniqueIndex { +export declare class UniqueIndex { private _field; private _keyMap; /** * Constructs an unique index object. * @param {number|string} propertyField - the property field to index */ - constructor(propertyField: number | string); + constructor(propertyField: keyof E); /** * Sets a document's unique index. * @param {Doc} doc - the document * @param {number} row - the data row of the document */ - set(doc: Doc, row: number): void; + set(doc: Doc, row: number): void; /** * Returns the data row of an unique index. * @param {number|string} index - the index * @returns {number | string} - the row */ - get(index: number | string): number; + get(index: keyof E): number; /** * Updates a document's unique index. * @param {Object} doc - the document * @param {number} row - the data row of the document */ - update(doc: Doc, row: number): void; + update(doc: Doc, row: number): void; /** * Removes an unique index. * @param {number|string} index - the unique index diff --git a/dist/packages/full-text-search-language/types/memory-storage/src/index.d.ts b/dist/packages/full-text-search-language/types/memory-storage/src/index.d.ts new file mode 100644 index 00000000..5330aa7d --- /dev/null +++ b/dist/packages/full-text-search-language/types/memory-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { MemoryStorage } from "./memory_storage"; +export { MemoryStorage }; +export default MemoryStorage; diff --git a/dist/packages/full-text-search-language/types/loki/src/memory_adapter.d.ts b/dist/packages/full-text-search-language/types/memory-storage/src/memory_storage.d.ts similarity index 61% rename from dist/packages/full-text-search-language/types/loki/src/memory_adapter.d.ts rename to dist/packages/full-text-search-language/types/memory-storage/src/memory_storage.d.ts index 7b97c7f7..0066a1de 100644 --- a/dist/packages/full-text-search-language/types/loki/src/memory_adapter.d.ts +++ b/dist/packages/full-text-search-language/types/memory-storage/src/memory_storage.d.ts @@ -1,19 +1,29 @@ -import { StorageAdapter } from "../../common/types"; -export declare type ANY = any; +import { Dict, StorageAdapter } from "../../common/types"; /** - * In in-memory persistence adapter for an in-memory database. + * An in-memory persistence adapter for an in-memory database. * This simple 'key/value' adapter is intended for unit testing and diagnostics. */ -export declare class LokiMemoryAdapter implements StorageAdapter { - private hashStore; - private options; +export declare class MemoryStorage implements StorageAdapter { + hashStore: Dict<{ + savecount: number; + lastsave: Date; + value: string; + }>; + options: MemoryStorage.Options; /** - * @param {object} options - memory adapter options + * Registers the local storage as plugin. + */ + static register(): void; + /** + * Deregisters the local storage as plugin. + */ + static deregister(): void; + /** + * @param {object} options - memory storage options * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) - * @param {ANY} options */ - constructor(options?: ANY); + constructor(options?: MemoryStorage.Options); /** * Loads a serialized database from its in-memory store. * (Loki persistence adapter interface function) @@ -27,6 +37,7 @@ export declare class LokiMemoryAdapter implements StorageAdapter { * (Loki persistence adapter interface function) * * @param {string} dbname - name of the database (filename/keyname) + * @param {string} dbstring - the database content * @returns {Promise} a Promise that resolves after the database was persisted */ saveDatabase(dbname: string, dbstring: string): Promise; @@ -38,3 +49,9 @@ export declare class LokiMemoryAdapter implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } +export declare namespace MemoryStorage { + interface Options { + asyncResponses?: boolean; + asyncTimeout?: number; + } +} diff --git a/dist/packages/full-text-search-language/types/partitioning-adapter/src/index.d.ts b/dist/packages/full-text-search-language/types/partitioning-adapter/src/index.d.ts new file mode 100644 index 00000000..bf49882f --- /dev/null +++ b/dist/packages/full-text-search-language/types/partitioning-adapter/src/index.d.ts @@ -0,0 +1,3 @@ +import { PartitioningAdapter } from "./partitioning_adapter"; +export { PartitioningAdapter }; +export default PartitioningAdapter; diff --git a/dist/packages/full-text-search-language/types/partitioning-adapter/src/partitioning_adapter.d.ts b/dist/packages/full-text-search-language/types/partitioning-adapter/src/partitioning_adapter.d.ts index ff9568cf..45e14850 100644 --- a/dist/packages/full-text-search-language/types/partitioning-adapter/src/partitioning_adapter.d.ts +++ b/dist/packages/full-text-search-language/types/partitioning-adapter/src/partitioning_adapter.d.ts @@ -1,4 +1,5 @@ -import { ANY, StorageAdapter } from "../../common/types"; +import { Loki } from "../../loki/src/loki"; +import { StorageAdapter } from "../../common/types"; /** * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and @@ -9,7 +10,7 @@ import { ANY, StorageAdapter } from "../../common/types"; * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all * of that collection's pages will be written on next save. */ -export declare class LokiPartitioningAdapter implements StorageAdapter { +export declare class PartitioningAdapter implements StorageAdapter { mode: string; private _adapter; private _dbref; @@ -68,7 +69,7 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { * @returns {Promise} a Promise that resolves after the database was deleted * */ - exportDatabase(dbname: string, dbref: ANY): Promise; + exportDatabase(dbname: string, dbref: Loki): Promise; /** * Helper method used internally to save each dirty collection, one at a time. * @@ -82,11 +83,3 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { */ private _saveNextPage(); } -declare namespace LokiPartitioningAdapter { - interface PageIterator { - collection?: ANY; - docIndex?: number; - pageIndex?: number; - } -} -export default LokiPartitioningAdapter; diff --git a/dist/packages/full-text-search/lokijs.full-text-search.js b/dist/packages/full-text-search/lokijs.full-text-search.js index 89191e69..f1090162 100644 --- a/dist/packages/full-text-search/lokijs.full-text-search.js +++ b/dist/packages/full-text-search/lokijs.full-text-search.js @@ -77,6 +77,67 @@ return /******/ (function(modules) { // webpackBootstrap /* 0 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +/** + * Class supports 64Bit integer operations. + * A cut-down version of dcodeIO/long.js. + * @hidden + */ +class Long { + constructor(low = 0, high = 0) { + this._low = low; + this._high = high; + } + /** + * Returns this long with bits arithmetically shifted to the right by the given amount. + * @param {number} numBits - number of bits + * @returns {Long} the long + */ + shiftRight(numBits) { + if ((numBits &= 63) === 0) + return this; + else if (numBits < 32) + return new Long((this._low >>> numBits) | (this._high << (32 - numBits)), this._high >> numBits); + else + return new Long((this._high >> (numBits - 32)), this._high >= 0 ? 0 : -1); + } + /** + * Returns this long with bits arithmetically shifted to the left by the given amount. + * @param {number} numBits - number of bits + * @returns {Long} the long + */ + shiftLeft(numBits) { + if ((numBits &= 63) === 0) + return this; + else if (numBits < 32) + return new Long(this._low << numBits, (this._high << numBits) | (this._low >>> (32 - numBits))); + else + return new Long(0, this._low << (numBits - 32)); + } + /** + * Returns the bitwise AND of this Long and the specified. + * @param {Long} other - the other Long + * @returns {Long} the long + */ + and(other) { + return new Long(this._low & other._low, this._high & other._high); + } + /** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + * @returns {number} + */ + toInt() { + return this._low; + } +} +/* harmony export (immutable) */ __webpack_exports__["a"] = Long; + + + +/***/ }), +/* 1 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = toCodePoints; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tokenizer__ = __webpack_require__(2); @@ -185,9 +246,7 @@ class InvertedIndex { if (child === undefined) { child = new Map(); if (this._optimizeChanges) { - Object.defineProperties(child, { - pa: { enumerable: false, configurable: true, writable: true, value: branch } - }); + child.pa = branch; } branch.set(c, child); } @@ -381,9 +440,7 @@ class InvertedIndex { _regenerate(index, parent) { // Set parent. if (parent !== null) { - Object.defineProperties(index, { - pa: { enumerable: false, configurable: true, writable: false, value: parent } - }); + index.pa = parent; } // Iterate over subtree. for (const child of index.values()) { @@ -438,67 +495,6 @@ class InvertedIndex { -/***/ }), -/* 1 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/** - * Class supports 64Bit integer operations. - * A cut-down version of dcodeIO/long.js. - * @hidden - */ -class Long { - constructor(low = 0, high = 0) { - this._low = low; - this._high = high; - } - /** - * Returns this long with bits arithmetically shifted to the right by the given amount. - * @param {number} numBits - number of bits - * @returns {Long} the long - */ - shiftRight(numBits) { - if ((numBits &= 63) === 0) - return this; - else if (numBits < 32) - return new Long((this._low >>> numBits) | (this._high << (32 - numBits)), this._high >> numBits); - else - return new Long((this._high >> (numBits - 32)), this._high >= 0 ? 0 : -1); - } - /** - * Returns this long with bits arithmetically shifted to the left by the given amount. - * @param {number} numBits - number of bits - * @returns {Long} the long - */ - shiftLeft(numBits) { - if ((numBits &= 63) === 0) - return this; - else if (numBits < 32) - return new Long(this._low << numBits, (this._high << numBits) | (this._low >>> (32 - numBits))); - else - return new Long(0, this._low << (numBits - 32)); - } - /** - * Returns the bitwise AND of this Long and the specified. - * @param {Long} other - the other Long - * @returns {Long} the long - */ - and(other) { - return new Long(this._low & other._low, this._high & other._high); - } - /** - * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. - * @returns {number} - */ - toInt() { - return this._low; - } -} -/* harmony export (immutable) */ __webpack_exports__["a"] = Long; - - - /***/ }), /* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { @@ -1417,12 +1413,21 @@ class QueryBuilder { /** * The query performs a final scoring over all scored sub queries. * @param {boolean} enable - flag to enable or disable final scoring - * @return {QueryBuilder} + * @return {this} */ enableFinalScoring(enable) { this._data.final_scoring = enable; return this; } + /** + * Adds an explanation of the scoring of each document for all matched terms. + * @param {boolean} enable -flag to enable or disable explanation + * @returns {this} + */ + explain(enable) { + this._data.explain = enable; + return this; + } /** * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model. * @@ -1430,10 +1435,10 @@ class QueryBuilder { * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}. * * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation. - * Lower values result in quicker saturation, and higher values in slower saturation. + * Lower values result in quicker saturation, and higher values in slower saturation * @param {number} [b=0.75] - controls how much effect field-length normalization should have. - * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully. - * @return {QueryBuilder} + * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully + * @return {this} */ BM25Similarity(k1 = 1.2, b = 0.75) { if (k1 < 0) { @@ -1495,7 +1500,7 @@ class QueryBuilder { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__long__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__long__ = __webpack_require__(0); const MASKS = [new __WEBPACK_IMPORTED_MODULE_0__long__["a" /* Long */](0x1), new __WEBPACK_IMPORTED_MODULE_0__long__["a" /* Long */](0x3), new __WEBPACK_IMPORTED_MODULE_0__long__["a" /* Long */](0x7), new __WEBPACK_IMPORTED_MODULE_0__long__["a" /* Long */](0xf), new __WEBPACK_IMPORTED_MODULE_0__long__["a" /* Long */](0x1f), new __WEBPACK_IMPORTED_MODULE_0__long__["a" /* Long */](0x3f), new __WEBPACK_IMPORTED_MODULE_0__long__["a" /* Long */](0x7f), new __WEBPACK_IMPORTED_MODULE_0__long__["a" /* Long */](0xff), @@ -1574,16 +1579,15 @@ class ParametricDescription { Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__full_text_search__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tokenizer__ = __webpack_require__(2); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Tokenizer", function() { return __WEBPACK_IMPORTED_MODULE_1__tokenizer__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__query_builder__ = __webpack_require__(3); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "QueryBuilder", function() { return __WEBPACK_IMPORTED_MODULE_2__query_builder__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__inverted_index__ = __webpack_require__(0); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "InvertedIndex", function() { return __WEBPACK_IMPORTED_MODULE_3__inverted_index__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FullTextSearch", function() { return __WEBPACK_IMPORTED_MODULE_0__full_text_search__["a"]; }); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Tokenizer", function() { return __WEBPACK_IMPORTED_MODULE_1__tokenizer__["a"]; }); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "QueryBuilder", function() { return __WEBPACK_IMPORTED_MODULE_2__query_builder__["a"]; }); - +__WEBPACK_IMPORTED_MODULE_0__full_text_search__["a" /* FullTextSearch */]["Tokenizer"] = __WEBPACK_IMPORTED_MODULE_1__tokenizer__["a" /* Tokenizer */]; +__WEBPACK_IMPORTED_MODULE_0__full_text_search__["a" /* FullTextSearch */]["QueryBuilder"] = __WEBPACK_IMPORTED_MODULE_2__query_builder__["a" /* QueryBuilder */]; /* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__full_text_search__["a" /* FullTextSearch */]); @@ -1593,7 +1597,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__inverted_index__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__inverted_index__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index_searcher__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_plugin__ = __webpack_require__(14); @@ -1609,9 +1613,9 @@ class FullTextSearch { * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized * (requires more memory but performs better) * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field - * @param {string=$loki} id - the property name of the document index + * @param {string} [id] - the property name of the document index */ - constructor(fields = [], id = "$loki") { + constructor(fields = [], id) { this._invIdxs = {}; // Create inverted indices for each field. for (let i = 0; i < fields.length; i++) { @@ -1687,7 +1691,7 @@ class FullTextSearch { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__scorer__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__inverted_index__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__inverted_index__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__query_builder__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__fuzzy_run_automaton__ = __webpack_require__(9); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__fuzzy_levenshtein_automata__ = __webpack_require__(10); @@ -1709,14 +1713,14 @@ class IndexSearcher { this._scorer = new __WEBPACK_IMPORTED_MODULE_0__scorer__["a" /* Scorer */](this._invIdxs); } search(query) { - let docResults = this._recursive(query.query, true); + let queryResults = this._recursive(query.query, true); // Do final scoring. if (query.final_scoring !== undefined ? query.final_scoring : true) { - return this._scorer.finalScore(query, docResults); + return this._scorer.finalScore(query, queryResults); } const result = {}; - for (const key of docResults.keys()) { - result[key] = 1; + for (const key of queryResults.keys()) { + result[key] = { score: 1 }; } return result; } @@ -1724,7 +1728,7 @@ class IndexSearcher { this._scorer.setDirty(); } _recursive(query, doScoring) { - let docResults = new Map(); + let queryResults = new Map(); const boost = query.boost !== undefined ? query.boost : 1; const fieldName = query.field !== undefined ? query.field : null; let root = null; @@ -1735,18 +1739,18 @@ class IndexSearcher { } switch (query.type) { case "bool": { - docResults = null; + queryResults = null; if (query.must !== undefined) { - docResults = this._getUnique(query.must.values, doScoring, docResults); + queryResults = this._getUnique(query.must.values, doScoring, queryResults); } if (query.filter !== undefined) { - docResults = this._getUnique(query.filter.values, false, docResults); + queryResults = this._getUnique(query.filter.values, false, queryResults); } if (query.should !== undefined) { let shouldDocs = this._getAll(query.should.values, doScoring); let empty = false; - if (docResults === null) { - docResults = new Map(); + if (queryResults === null) { + queryResults = new Map(); empty = true; } let msm = 1; @@ -1767,14 +1771,14 @@ class IndexSearcher { // Remove all docs with fewer matches. for (const [docId, res] of shouldDocs) { if (res.length >= msm) { - if (docResults.has(docId)) { - docResults.get(docId).push(...res); + if (queryResults.has(docId)) { + queryResults.get(docId).push(...res); } else if (empty) { - docResults.set(docId, res); + queryResults.set(docId, res); } else { - docResults.delete(docId); + queryResults.delete(docId); } } } @@ -1783,8 +1787,8 @@ class IndexSearcher { let notDocs = this._getAll(query.not.values, false); // Remove all docs. for (const docId of notDocs.keys()) { - if (docResults.has(docId)) { - docResults.delete(docId); + if (queryResults.has(docId)) { + queryResults.delete(docId); } } } @@ -1793,21 +1797,21 @@ class IndexSearcher { case "term": { const cps = Object(__WEBPACK_IMPORTED_MODULE_1__inverted_index__["b" /* toCodePoints */])(query.value); let termIdx = __WEBPACK_IMPORTED_MODULE_1__inverted_index__["a" /* InvertedIndex */].getTermIndex(cps, root); - this._scorer.score(fieldName, boost, termIdx, doScoring, docResults, cps); + this._scorer.score(fieldName, boost, termIdx, doScoring, queryResults, cps); break; } case "terms": { for (let i = 0; i < query.value.length; i++) { const cps = Object(__WEBPACK_IMPORTED_MODULE_1__inverted_index__["b" /* toCodePoints */])(query.value[i]); let termIdx = __WEBPACK_IMPORTED_MODULE_1__inverted_index__["a" /* InvertedIndex */].getTermIndex(cps, root); - this._scorer.score(fieldName, boost, termIdx, doScoring, docResults, cps); + this._scorer.score(fieldName, boost, termIdx, doScoring, queryResults, cps); } break; } case "fuzzy": { const f = fuzzySearch(query, root); for (let i = 0; i < f.length; i++) { - this._scorer.score(fieldName, boost * f[i].boost, f[i].index, doScoring, docResults, f[i].term); + this._scorer.score(fieldName, boost * f[i].boost, f[i].index, doScoring, queryResults, f[i].term); } break; } @@ -1815,21 +1819,21 @@ class IndexSearcher { const enableScoring = query.enable_scoring !== undefined ? query.enable_scoring : false; const w = wildcardSearch(query, root); for (let i = 0; i < w.length; i++) { - this._scorer.score(fieldName, boost, w[i].index, doScoring && enableScoring, docResults, w[i].term); + this._scorer.score(fieldName, boost, w[i].index, doScoring && enableScoring, queryResults, w[i].term); } break; } case "match_all": { for (let docId of this._docs) { - this._scorer.scoreConstant(boost, docId, docResults); + this._scorer.scoreConstant(boost, docId, queryResults); } break; } case "constant_score": { - let tmpDocResults = this._getAll(query.filter.values, false); + let tmpQueryResults = this._getAll(query.filter.values, false); // Add to each document a constant score. - for (const docId of tmpDocResults.keys()) { - this._scorer.scoreConstant(boost, docId, docResults); + for (const docId of tmpQueryResults.keys()) { + this._scorer.scoreConstant(boost, docId, queryResults); } break; } @@ -1840,7 +1844,7 @@ class IndexSearcher { if (termIdx !== null) { const termIdxs = __WEBPACK_IMPORTED_MODULE_1__inverted_index__["a" /* InvertedIndex */].extendTermIndex(termIdx); for (let i = 0; i < termIdxs.length; i++) { - this._scorer.score(fieldName, boost, termIdxs[i].index, doScoring && enableScoring, docResults, [...cps, ...termIdxs[i].term]); + this._scorer.score(fieldName, boost, termIdxs[i].index, doScoring && enableScoring, queryResults, [...cps, ...termIdxs[i].term]); } } break; @@ -1848,7 +1852,7 @@ class IndexSearcher { case "exists": { if (root !== null) { for (const docId of this._invIdxs[fieldName].documentStore.keys()) { - this._scorer.scoreConstant(boost, docId, docResults); + this._scorer.scoreConstant(boost, docId, queryResults); } } break; @@ -1889,49 +1893,49 @@ class IndexSearcher { else { tmpQuery = tmpQuery.endMust(); } - docResults = this._recursive(tmpQuery.build().query, doScoring); + queryResults = this._recursive(tmpQuery.build().query, doScoring); break; } default: break; } - return docResults; + return queryResults; } - _getUnique(queries, doScoring, docResults) { + _getUnique(queries, doScoring, queryResults) { if (queries.length === 0) { - return docResults; + return queryResults; } for (let i = 0; i < queries.length; i++) { let currDocs = this._recursive(queries[i], doScoring); - if (docResults === null) { - docResults = this._recursive(queries[0], doScoring); + if (queryResults === null) { + queryResults = this._recursive(queries[0], doScoring); continue; } - for (const docId of docResults.keys()) { + for (const docId of queryResults.keys()) { if (!currDocs.has(docId)) { - docResults.delete(docId); + queryResults.delete(docId); } else { - docResults.get(docId).push(...currDocs.get(docId)); + queryResults.get(docId).push(...currDocs.get(docId)); } } } - return docResults; + return queryResults; } _getAll(queries, doScoring) { - let docResults = new Map(); + let queryResults = new Map(); for (let i = 0; i < queries.length; i++) { let currDocs = this._recursive(queries[i], doScoring); for (const docId of currDocs.keys()) { - if (!docResults.has(docId)) { - docResults.set(docId, currDocs.get(docId)); + if (!queryResults.has(docId)) { + queryResults.set(docId, currDocs.get(docId)); } else { - docResults.get(docId).push(...currDocs.get(docId)); + queryResults.get(docId).push(...currDocs.get(docId)); } } } - return docResults; + return queryResults; } } /* harmony export (immutable) */ __webpack_exports__["a"] = IndexSearcher; @@ -2117,70 +2121,89 @@ class Scorer { setDirty() { this._cache = {}; } - score(fieldName, boost, termIdx, doScoring, docResults, term) { + score(fieldName, boost, termIdx, doScoring, queryResults, term) { if (termIdx === null || termIdx.dc === undefined) { return; } const idf = this._idf(fieldName, termIdx.df); for (const [docId, tf] of termIdx.dc) { - if (!docResults.has(docId)) { - docResults.set(docId, []); + if (!queryResults.has(docId)) { + queryResults.set(docId, []); } if (doScoring) { // BM25 scoring. - docResults.get(docId).push({ tf, idf, boost, fieldName, term }); + queryResults.get(docId).push({ tf, idf, boost, fieldName, term }); } else { // Constant scoring. - docResults.set(docId, [{ boost }]); + queryResults.set(docId, [{ boost }]); } } } - scoreConstant(boost, docId, docResults) { - if (!docResults.has(docId)) { - docResults.set(docId, []); + scoreConstant(boost, docId, queryResults) { + if (!queryResults.has(docId)) { + queryResults.set(docId, []); } - docResults.get(docId).push({ boost }); - return docResults; + queryResults.get(docId).push({ boost }); + return queryResults; } - finalScore(query, docResults) { + finalScore(query, queryResults) { const result = {}; const k1 = query.bm25 !== undefined ? query.bm25.k1 : 1.2; const b = query.bm25 !== undefined ? query.bm25.b : 0.75; - for (const [docId, result1] of docResults) { + const explain = query.explain !== undefined ? query.explain : false; + for (const [docId, result1] of queryResults) { let docScore = 0; + let docExplanation = []; for (let j = 0; j < result1.length; j++) { - const docResult = result1[j]; - let res = 0; - if (docResult.tf !== undefined) { + const queryResult = result1[j]; + let score = 0; + if (queryResult.tf !== undefined) { // BM25 scoring. - const tf = docResult.tf; - const fieldLength = Scorer._calculateFieldLength(this._invIdxs[docResult.fieldName].documentStore.get(+docId) + const tf = queryResult.tf; + const fieldLength = Scorer._calculateFieldLength(this._invIdxs[queryResult.fieldName].documentStore.get(+docId) .fieldLength); - const avgFieldLength = this._avgFieldLength(docResult.fieldName); + const avgFieldLength = this._avgFieldLength(queryResult.fieldName); const tfNorm = (tf * (k1 + 1)) / (tf + k1 * (1 - b + b * (fieldLength / avgFieldLength))); - res = docResult.idf * tfNorm * docResult.boost; - // console.log( - // docId + ":" + docResult.fieldName + ":" + String.fromCharCode(...docResult.term) + " = " + res, - // "\n\ttype: BM25", - // "\n\tboost: " + docResult.boost, - // "\n\tidf : " + docResult.idf, - // "\n\ttfNorm : " + tfNorm, - // "\n\ttf : " + tf, - // "\n\tavg : " + avgFieldLength, - // "\n\tfl : " + fieldLength); + score = queryResult.idf * tfNorm * queryResult.boost; + if (explain) { + docExplanation.push({ + boost: queryResult.boost, + score: score, + docID: docId, + fieldName: queryResult.fieldName, + index: String.fromCharCode(...queryResult.term), + idf: queryResult.idf, + tfNorm: tfNorm, + tf: tf, + fieldLength: fieldLength, + avgFieldLength: avgFieldLength, + }); + } } else { // Constant scoring. - res = docResult.boost; - // console.log( - // "Constant: " + res, - // "\n\tboost: " + docResult.boost); + score = queryResult.boost; + if (explain) { + docExplanation.push({ + boost: queryResult.boost, + score: score + }); + } } - docScore += res; + docScore += score; + } + if (explain) { + result[docId] = { + score: docScore, + explanation: docExplanation + }; + } + else { + result[docId] = { + score: docScore + }; } - //console.log(docId, " === ", docScore); - result[docId] = docScore; } return result; } @@ -2588,7 +2611,7 @@ class Automaton { /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__long__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__long__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__parametric_description__ = __webpack_require__(4); @@ -2673,7 +2696,7 @@ class Lev1TParametricDescription extends __WEBPACK_IMPORTED_MODULE_1__parametric /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__long__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__long__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__parametric_description__ = __webpack_require__(4); diff --git a/dist/packages/full-text-search/lokijs.full-text-search.js.map b/dist/packages/full-text-search/lokijs.full-text-search.js.map index dd37f57d..1f21b6ec 100644 --- a/dist/packages/full-text-search/lokijs.full-text-search.js.map +++ b/dist/packages/full-text-search/lokijs.full-text-search.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 11ed40d7271a384186df","webpack:///./packages/full-text-search/src/inverted_index.ts","webpack:///./packages/full-text-search/src/fuzzy/long.ts","webpack:///./packages/full-text-search/src/tokenizer.ts","webpack:///./packages/full-text-search/src/query_builder.ts","webpack:///./packages/full-text-search/src/fuzzy/parametric_description.ts","webpack:///./packages/full-text-search/src/index.ts","webpack:///./packages/full-text-search/src/full_text_search.ts","webpack:///./packages/full-text-search/src/index_searcher.ts","webpack:///./packages/full-text-search/src/scorer.ts","webpack:///./packages/full-text-search/src/fuzzy/run_automaton.ts","webpack:///./packages/full-text-search/src/fuzzy/levenshtein_automata.ts","webpack:///./packages/full-text-search/src/fuzzy/automaton.ts","webpack:///./packages/full-text-search/src/fuzzy/lev1t_parametric_description.ts","webpack:///./packages/full-text-search/src/fuzzy/lev2t_parametric_description.ts","webpack:///./packages/common/plugin.ts","webpack:///(webpack)/buildin/global.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;AC7DsC;AAGtC;;;;;GAKG;AACG,sBAAuB,GAAW;IACtC,MAAM,CAAC,GAAG,EAAE,CAAC;IACb,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAA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IACD,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACI,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAAA;AAAA;;;;;;;;ACtBhC;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"lokijs.full-text-search.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/full-text-search\"] = factory();\n\telse\n\t\troot[\"@lokijs/full-text-search\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 11ed40d7271a384186df","import {Tokenizer} from \"./tokenizer\";\nimport Index = InvertedIndex.Index;\n\n/**\n * Converts a string into an array of code points.\n * @param str - the string\n * @returns {number[]} to code points\n * @hidden\n */\nexport function toCodePoints(str: string): number[] {\n const r = [];\n for (let i = 0; i < str.length;) {\n const chr = str.charCodeAt(i++);\n if (chr >= 0xD800 && chr <= 0xDBFF) {\n // surrogate pair\n const low = str.charCodeAt(i++);\n r.push(0x10000 + ((chr - 0xD800) << 10) | (low - 0xDC00));\n } else {\n // ordinary character\n r.push(chr);\n }\n }\n return r;\n}\n\n/**\n * Inverted index class handles featured text search for specific document fields.\n * @hidden\n */\nexport class InvertedIndex {\n private _store: boolean;\n private _optimizeChanges: boolean;\n private _tokenizer: Tokenizer;\n private _docCount: number = 0;\n private _docStore: Map = new Map();\n private _totalFieldLength: number = 0;\n private _root: Index = new Map();\n\n /**\n * @param {boolean} [options.store=true] - inverted index will be stored at serialization rather than rebuilt on load.\n * @param {boolean} optimizeChanges\n * @param {Tokenizer} tokenizer\n */\n constructor(options: InvertedIndex.FieldOptions = {}) {\n (\n {\n store: this._store = true,\n optimizeChanges: this._optimizeChanges = true,\n tokenizer: this._tokenizer = new Tokenizer()\n } = options\n );\n }\n\n get store() {\n return this._store;\n }\n\n set store(val: boolean) {\n this._store = val;\n }\n\n get tokenizer() {\n return this._tokenizer;\n }\n\n get documentCount() {\n return this._docCount;\n }\n\n get documentStore() {\n return this._docStore;\n }\n\n get totalFieldLength() {\n return this._totalFieldLength;\n }\n\n get root() {\n return this._root;\n }\n\n /**\n * Adds defined fields of a document to the inverted index.\n * @param {string} field - the field to add\n * @param {number} docId - the doc id of the field\n */\n insert(field: string, docId: number) {\n if (this._docStore.has(docId)) {\n throw Error(\"Field already added.\");\n }\n\n // Tokenize document field.\n const fieldTokens = this._tokenizer.tokenize(field);\n this._totalFieldLength += fieldTokens.length;\n this._docCount += 1;\n this._docStore.set(docId, {fieldLength: fieldTokens.length});\n\n // Holds references to each index of a document.\n const indexRef: Index[] = [];\n if (this._optimizeChanges) {\n Object.defineProperties(this._docStore.get(docId), {\n indexRef: {enumerable: false, configurable: true, writable: true, value: indexRef}\n });\n }\n\n // Iterate over all unique field terms.\n for (const token of new Set(fieldTokens)) {\n if (token === \"\") {\n continue;\n }\n // Calculate term frequency.\n let tf = 0;\n for (let j = 0; j < fieldTokens.length; j++) {\n if (fieldTokens[j] === token) {\n ++tf;\n }\n }\n\n // Add term to index tree.\n let branch = this._root;\n\n for (const c of toCodePoints(token)) {\n let child = branch.get(c);\n if (child === undefined) {\n child = new Map();\n if (this._optimizeChanges) {\n Object.defineProperties(child, {\n pa: {enumerable: false, configurable: true, writable: true, value: branch}\n });\n }\n branch.set(c, child);\n }\n branch = child;\n }\n // Add term info to index leaf.\n if (branch.dc === undefined) {\n branch.dc = new Map();\n branch.df = 0;\n }\n branch.dc.set(docId, tf);\n branch.df += 1;\n\n // Store index leaf for deletion.\n indexRef.push(branch);\n }\n }\n\n /**\n * Removes all relevant terms of a document from the inverted index.\n * @param {number} docId - the document.\n */\n remove(docId: number) {\n if (!this._docStore.has(docId)) {\n return;\n }\n const docStore = this._docStore.get(docId);\n // Remove document.\n this._docStore.delete(docId);\n this._docCount -= 1;\n\n // Reduce total field length.\n this._totalFieldLength -= docStore.fieldLength;\n\n if (this._optimizeChanges) {\n // Iterate over all term references.\n // Remove docId from docs and decrement document frequency.\n const indexRef = docStore.indexRef;\n for (let j = 0; j < indexRef.length; j++) {\n let index = indexRef[j];\n index.df -= 1;\n index.dc.delete(docId);\n\n // Check if no document is left for current tree.\n if (index.df === 0) {\n // Delete unused meta data of branch.\n delete index.df;\n delete index.dc;\n\n // Check for sub branches.\n if (index.size !== 0) {\n continue;\n }\n\n // Delete term branch if not used anymore.\n do {\n // Go tree upwards.\n const parent = index.pa;\n // Delete parent reference for preventing memory leak (cycle reference).\n delete index.pa;\n\n // Iterate over all children.\n for (const key of parent.keys()) {\n // Remove previous child form parent.\n if (parent.get(key) === index) {\n parent.delete(key);\n break;\n }\n }\n index = parent;\n } while (index.pa !== undefined && index.size === 0 && index.df === undefined);\n }\n }\n } else {\n this._remove(this._root, docId);\n }\n }\n\n /**\n * Gets the term index of a term.\n * @param {string} term - the term\n * @param {object} root - the term index to start from\n * @param {number} start - the position of the term string to start from\n * @return {object} - The term index or null if the term is not in the term tree.\n */\n static getTermIndex(term: number[], root: Index, start: number = 0) {\n if (start >= term.length) {\n return null;\n }\n for (let i = start; i < term.length; i++) {\n let child = root.get(term[i]);\n if (child === undefined) {\n return null;\n }\n root = child;\n }\n return root;\n }\n\n /**\n * Extends a term index to all available term leafs.\n * @param {object} idx - the term index to start from\n * @param {number[]} [term=[]] - the current term\n * @param {Array} termIndices - all extended indices with their term\n * @returns {Array} - Array with term indices and extension\n */\n static extendTermIndex(idx: Index, term: number[] = [], termIndices: InvertedIndex.IndexTerm[] = []): InvertedIndex.IndexTerm[] {\n if (idx.df !== undefined) {\n termIndices.push({index: idx, term: term.slice()});\n }\n\n term.push(0);\n for (const child of idx) {\n term[term.length - 1] = child[0];\n InvertedIndex.extendTermIndex(child[1], term, termIndices);\n }\n term.pop();\n return termIndices;\n }\n\n /**\n * Serialize the inverted index.\n * @returns {{docStore: *, _fields: *, index: *}}\n */\n public toJSON() {\n if (this._store) {\n return {\n _store: true,\n _optimizeChanges: this._optimizeChanges,\n _tokenizer: this._tokenizer,\n _docCount: this._docCount,\n _docStore: [...this._docStore],\n _totalFieldLength: this._totalFieldLength,\n _root: InvertedIndex.serializeIndex(this._root)\n };\n }\n return {\n _store: false,\n _optimizeChanges: this._optimizeChanges,\n _tokenizer: this._tokenizer\n };\n }\n\n /**\n * Deserialize the inverted index.\n * @param {{docStore: *, _fields: *, index: *}} serialized - The serialized inverted index.\n * @param {Object.|Tokenizer} funcTok[undefined] - the depending functions with labels\n * or an equivalent tokenizer\n */\n public static fromJSONObject(serialized: InvertedIndex.Serialization, funcTok?: Tokenizer.FunctionSerialization) {\n const invIdx = new InvertedIndex({\n store: serialized._store,\n optimizeChanges: serialized._optimizeChanges,\n tokenizer: Tokenizer.fromJSONObject(serialized._tokenizer, funcTok)\n });\n if (invIdx._store) {\n invIdx._docCount = serialized._docCount;\n invIdx._docStore = new Map(serialized._docStore);\n invIdx._totalFieldLength = serialized._totalFieldLength;\n invIdx._root = InvertedIndex.deserializeIndex(serialized._root);\n }\n\n if (invIdx._optimizeChanges) {\n invIdx._regenerate(invIdx._root, null);\n }\n\n return invIdx;\n }\n\n private static serializeIndex(idx: Index): InvertedIndex.SerializedIndex {\n const serialized: InvertedIndex.SerializedIndex = {};\n if (idx.dc !== undefined) {\n serialized.d = {df: idx.df, dc: [...idx.dc]};\n }\n\n if (idx.size === 0) {\n return serialized;\n }\n\n const keys = [];\n const values = [];\n for (const child of idx) {\n keys.push(child[0]);\n values.push(InvertedIndex.serializeIndex(child[1]));\n }\n serialized.k = keys;\n serialized.v = values;\n\n return serialized;\n }\n\n private static deserializeIndex(serialized: InvertedIndex.SerializedIndex): Index {\n const idx: Index = new Map();\n\n if (serialized.k !== undefined) {\n for (let i = 0; i < serialized.k.length; i++) {\n idx.set(serialized.k[i], InvertedIndex.deserializeIndex(serialized.v[i]));\n }\n }\n if (serialized.d !== undefined) {\n idx.df = serialized.d.df;\n idx.dc = new Map(serialized.d.dc);\n }\n return idx;\n }\n\n /**\n * Set parent of to each index and regenerate the indexRef.\n * @param {Index} index - the index\n * @param {Index} parent - the parent\n */\n private _regenerate(index: Index, parent: Index) {\n // Set parent.\n if (parent !== null) {\n Object.defineProperties(index, {\n pa: {enumerable: false, configurable: true, writable: false, value: parent}\n });\n }\n\n // Iterate over subtree.\n for (const child of index.values()) {\n this._regenerate(child, index);\n }\n\n if (index.dc !== undefined) {\n // Get documents of term.\n for (const docId of index.dc.keys()) {\n // Get document store at specific document/field.\n const ref = this._docStore.get(docId);\n if (ref.indexRef === undefined) {\n Object.defineProperties(ref, {\n indexRef: {enumerable: false, configurable: true, writable: true, value: []}\n });\n }\n // Set reference to term index.\n ref.indexRef.push(index);\n }\n }\n }\n\n /**\n * Iterate over the whole inverted index and remove the document.\n * Delete branch if not needed anymore.\n * Function is needed if index is used without optimization.\n * @param {Index} idx - the index\n * @param {number} docId - the doc id\n * @returns {boolean} true if index is empty\n */\n private _remove(idx: Index, docId: number) {\n for (const child of idx) {\n // Checkout branch.\n if (this._remove(child[1], docId)) {\n idx.delete(child[0]);\n }\n }\n // Remove docId from docs and decrement document frequency.\n if (idx.df !== undefined) {\n if (idx.dc.has(docId)) {\n idx.df -= 1;\n idx.dc.delete(docId);\n\n // Delete unused meta data of branch.\n if (idx.df === 0) {\n delete idx.df;\n delete idx.dc;\n }\n }\n }\n return idx.size === 0 && idx.dc === undefined;\n }\n}\n\nexport namespace InvertedIndex {\n export interface FieldOptions {\n store?: boolean;\n optimizeChanges?: boolean;\n tokenizer?: Tokenizer;\n }\n\n export type Index = Map & { dc?: Map, df?: number, pa?: Index };\n\n export type IndexTerm = { index: Index, term: number[] };\n\n export interface SerializedIndex {\n d?: {\n df: number;\n dc: [number, number][]\n };\n k?: number[];\n v?: SerializedIndex[];\n }\n\n export interface Serialization {\n _store: boolean;\n _optimizeChanges: boolean;\n _tokenizer: Tokenizer.Serialization;\n _docCount?: number;\n _docStore?: Map;\n _totalFieldLength?: number;\n _root?: SerializedIndex;\n }\n\n export interface DocStore {\n fieldLength?: number;\n indexRef?: Index[];\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/inverted_index.ts","/**\n * Class supports 64Bit integer operations.\n * A cut-down version of dcodeIO/long.js.\n * @hidden\n */\nexport class Long {\n private _low: number;\n private _high: number;\n\n constructor(low: number = 0, high: number = 0) {\n this._low = low;\n this._high = high;\n }\n\n /**\n * Returns this long with bits arithmetically shifted to the right by the given amount.\n * @param {number} numBits - number of bits\n * @returns {Long} the long\n */\n shiftRight(numBits: number): Long {\n if ((numBits &= 63) === 0)\n return this;\n else if (numBits < 32)\n return new Long((this._low >>> numBits) | (this._high << (32 - numBits)), this._high >> numBits);\n else\n return new Long((this._high >> (numBits - 32)), this._high >= 0 ? 0 : -1);\n }\n\n /**\n * Returns this long with bits arithmetically shifted to the left by the given amount.\n * @param {number} numBits - number of bits\n * @returns {Long} the long\n */\n shiftLeft(numBits: number): Long {\n if ((numBits &= 63) === 0)\n return this;\n else if (numBits < 32)\n return new Long(this._low << numBits, (this._high << numBits) | (this._low >>> (32 - numBits)));\n else\n return new Long(0, this._low << (numBits - 32));\n }\n\n /**\n * Returns the bitwise AND of this Long and the specified.\n * @param {Long} other - the other Long\n * @returns {Long} the long\n */\n and(other: Long): Long {\n return new Long(this._low & other._low, this._high & other._high);\n }\n\n /**\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\n * @returns {number}\n */\n toInt(): number {\n return this._low;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/long.ts","/**\n * Splits a string at non-alphanumeric characters into lower case tokens.\n * @param {string} str - the string\n * @returns {string[]} - the tokens\n * @private\n */\nimport {Dict} from \"../../common/types\";\n\nfunction defaultSplitter(str: string) {\n let tokens = str.split(/[^\\w]+/);\n for (let i = 0; i < tokens.length; i++) {\n tokens[i] = tokens[i].toLowerCase();\n }\n return tokens;\n}\n\n/**\n * The tokenizer is used to prepare the string content of a document field for the inverted index.\n * Firstly the string gets split into tokens.\n * After that the tokens will be trimmed/stemmed with defined functions from the queue.\n *\n * * To change the splitter function, use {@link Tokenizer#setSplitter}.\n * * To add functions to the queue, use {@link Tokenizer#add}, {@link Tokenizer#addBefore} and\n * {@link Tokenizer#addAfter}.\n * * To remove a function from the queue, use {@link Tokenizer#remove}.\n * * To reset the tokenizer, use {@link Tokenizer#reset}.\n */\nexport class Tokenizer {\n private _splitter: Tokenizer.SplitterFunction;\n private _queue: Tokenizer.TokinizeFunction[] = [];\n private _symbol: any = Symbol(\"label\");\n\n /**\n * Initializes the tokenizer with a splitter, which splits a string at non-alphanumeric characters.\n * The queue is empty.\n */\n constructor() {\n this.reset();\n }\n\n /**\n * Sets a function with defined label as the splitter function.\n * The function must take a string as argument and return an array of tokens.\n *\n * @param {string} label - the label\n * @param {function} func - the function\n */\n setSplitter(label: string, func: Tokenizer.SplitterFunction) {\n if (label === \"\") {\n throw Error(\"Label cannot be empty.\");\n }\n func[this._symbol] = label;\n this._splitter = func;\n }\n\n /**\n * Gets the splitter.\n * @return {Array.} - tuple with label and function\n */\n getSplitter() {\n return [this._splitter[this._symbol], this._splitter];\n }\n\n /**\n * Resets the splitter to default.\n */\n resetSplitter() {\n this._splitter = defaultSplitter;\n }\n\n /**\n * Checks if a function is inside the queue.\n * @param {string|function} labelFunc - an existing label or function\n * @returns {boolean} true if exists, otherwise false\n */\n has(labelFunc: string | Tokenizer.TokinizeFunction) {\n return this._getPosition(labelFunc) !== -1;\n }\n\n /**\n * Gets a function from the queue.\n * Only the first found function gets returned if a label or a function is multiple used.\n *\n * @param {string|function} labelFunc - an existing label or function\n * @return {Array.} - tuple with label and function\n */\n get(labelFunc: string | Tokenizer.TokinizeFunction) {\n let pos = this._getPosition(labelFunc);\n if (pos === -1) {\n throw Error(\"Cannot find existing function.\");\n }\n return [this._queue[pos][this._symbol], this._queue[pos]];\n }\n\n /**\n * Adds a function with defined label to the end of the queue.\n * The function must take a token string as argument and return a token.\n *\n * @param {string} label - the label\n * @param {function} func - the function\n */\n add(label: string, func: Tokenizer.TokinizeFunction) {\n this._addFunction(label, func, this._queue.length);\n }\n\n /**\n * Adds a function with defined label before an existing function to the queue.\n * The function must take a token string as argument and return a token.\n *\n * @param {string|function} labelFunc - an existing label or function\n * @param {string} label - the label\n * @param {function} func - the function\n */\n addBefore(labelFunc: string | Tokenizer.TokinizeFunction, label: string, func: Tokenizer.TokinizeFunction) {\n let pos = this._getPosition(labelFunc);\n if (pos === -1) {\n throw Error(\"Cannot find existing function.\");\n }\n this._addFunction(label, func, pos);\n }\n\n /**\n * Adds a function with defined label after an existing function to the queue.\n * The function must take a token string as argument and return a token.\n *\n * @param {string|function} labelFunc - an existing label or function\n * @param {string} label - the label\n * @param {function} func - the function\n */\n addAfter(labelFunc: string | Tokenizer.TokinizeFunction, label: string, func: Tokenizer.TokinizeFunction) {\n let pos = this._getPosition(labelFunc);\n if (pos === -1) {\n throw Error(\"Cannot find existing function.\");\n }\n this._addFunction(label, func, pos + 1);\n }\n\n /**\n * Removes a function from the queue.\n * @param {string|function} labelFunc - an existing label or function\n */\n remove(labelFunc: string | Tokenizer.TokinizeFunction) {\n let pos = this._getPosition(labelFunc);\n if (pos === -1) {\n throw Error(\"Cannot find existing function.\");\n }\n this._queue.splice(pos, 1);\n }\n\n /**\n * Resets the splitter and tokenize queue to default.\n */\n reset() {\n this._splitter = defaultSplitter;\n this._queue = [];\n }\n\n /**\n * Tokenizes a string into tokens.\n * @param {string} str - the string\n * @return {string[]} the tokens\n */\n tokenize(str: string) {\n let tokens = this._splitter(str);\n // Apply each token over the queue functions.\n for (let i = 0; i < this._queue.length; i++) {\n let newTokens: string[] = [];\n for (let j = 0; j < tokens.length; j++) {\n let token: string = this._queue[i](tokens[j]);\n if (token) {\n newTokens.push(token);\n }\n }\n tokens = newTokens;\n }\n return tokens;\n }\n\n /**\n * Serializes the tokenizer by returning the labels of the used functions.\n * @returns {{splitter: string?, tokenizers: string[]}} - the serialization\n */\n toJSON() {\n let serialized: Tokenizer.Serialization = {\n tokenizers: []\n };\n if (this._splitter !== defaultSplitter) {\n serialized.splitter = this._splitter[this._symbol];\n }\n for (let i = 0; i < this._queue.length; i++) {\n serialized.tokenizers.push(this._queue[i][this._symbol]);\n }\n return serialized;\n }\n\n /**\n * Deserializes the tokenizer by reassign the correct function to each label.\n * @param {{splitter: string, tokenizers: string[]}} serialized - the serialized labels\n * @param {Object.|Tokenizer} funcTok - the depending functions with labels\n * or an equivalent tokenizer\n */\n static fromJSONObject(serialized: Tokenizer.Serialization, funcTok?: Tokenizer.FunctionSerialization) {\n let tkz = new Tokenizer();\n if (funcTok instanceof Tokenizer) {\n if (serialized.splitter !== undefined) {\n let splitter = funcTok.getSplitter();\n if (serialized.splitter !== splitter[0]) {\n throw Error(\"Splitter function not found.\");\n }\n tkz.setSplitter(splitter[0], splitter[1]);\n }\n\n for (let i = 0; i < serialized.tokenizers.length; i++) {\n if (!funcTok.has(serialized.tokenizers[i])) {\n throw Error(\"Tokenizer function not found.\");\n }\n let labelFunc = funcTok.get(serialized.tokenizers[i]);\n tkz.add(labelFunc[0], labelFunc[1]);\n }\n } else {\n if (serialized.splitter !== undefined) {\n if (funcTok.splitters[serialized.splitter] === undefined) {\n throw Error(\"Splitter function not found.\");\n }\n tkz.setSplitter(serialized.splitter, funcTok.splitters[serialized.splitter]);\n }\n for (let i = 0; i < serialized.tokenizers.length; i++) {\n if (funcTok.tokenizers[serialized.tokenizers[i]] === undefined) {\n throw Error(\"Tokenizer function not found.\");\n }\n tkz.add(serialized.tokenizers[i], funcTok.tokenizers[serialized.tokenizers[i]]);\n }\n }\n return tkz;\n }\n\n /**\n * Returns the position of a function inside the queue.\n * @param {string|function} labelFunc - an existing label or function\n * @return {number} the position\n * @private\n */\n private _getPosition(labelFunc: string | Tokenizer.TokinizeFunction) {\n if (labelFunc instanceof Function) {\n return this._queue.indexOf(labelFunc);\n } else {\n for (let i = 0; i < this._queue.length; i++) {\n if (this._queue[i][this._symbol] === labelFunc) {\n return i;\n }\n }\n }\n return -1;\n }\n\n /**\n * Adds a function with defined label at a specific position to the queue.\n * @param {string} label - the label\n * @param {function} func - the function\n * @param {number} pos - the position\n * @private\n */\n private _addFunction(label: string, func: Tokenizer.TokinizeFunction, pos: number) {\n if (label === \"\") {\n throw Error(\"Label cannot be empty.\");\n }\n func[this._symbol] = label;\n this._queue.splice(pos, 0, func);\n }\n}\n\nexport namespace Tokenizer {\n export type SplitterFunction = (word: string) => string[];\n export type TokinizeFunction = (word: string) => string;\n\n export interface Serialization {\n splitter?: string;\n tokenizers: string[];\n }\n\n export type FunctionSerialization =\n { splitters: Dict, tokenizers: Dict }\n | Tokenizer;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/tokenizer.ts","/**\n * The base query class to enable boost to a query type.\n */\nexport class BaseQueryBuilder {\n protected _data: any;\n\n /**\n * @param {string} type - the type name of the query\n * @param data\n */\n constructor(type: string, data: any = {}) {\n this._data = data;\n this._data.type = type;\n }\n\n /**\n * Boosts the query result.\n *\n * See also [Lucene#BoostQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/BoostQuery.html}\n * and [Elasticsearch#boost]{@link https://www.elastic.co/guide/en/elasticsearch/reference/5.2/mapping-boost.html}.\n *\n * @param {number} value - the positive boost\n * @return {BaseQueryBuilder} object itself for cascading\n */\n boost(value: number) {\n if (value < 0) {\n throw TypeError(\"Boost must be a positive number.\");\n }\n this._data.boost = value;\n return this;\n }\n\n /**\n * Build the final query.\n * @return {Object} - the final query\n */\n build(): any {\n return this._data;\n }\n}\n\nexport interface BaseQuery {\n type: string;\n boost?: number;\n}\n\n/**\n * A query which finds documents where a document field contains a term.\n *\n * See also [Lucene#TermQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/TermQuery.html}\n * and [Elasticsearch#TermQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .term(\"name\", \"infinity\"])\n * .build();\n * // The resulting documents:\n * // contains the term infinity\n *\n * @extends BaseQueryBuilder\n */\nexport class TermQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string} term - the term\n * @param data\n */\n constructor(field: string, term: string, data: any = {}) {\n super(\"term\", data);\n this._data.field = field;\n this._data.value = term;\n }\n}\n\nexport interface TermQuery extends BaseQuery {\n field: string;\n value: string;\n}\n\n/**\n * A query which finds documents where a document field contains any of the terms.\n *\n * See also [Lucene#TermRangeQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/TermRangeQuery.html}\n * and [Elasticsearch#TermsQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .terms(\"quotes\", [\"infinity\", \"atom\", \"energy\"])\n * .build();\n * // The resulting documents:\n * // contains the terms infinity, atom or energy\n *\n * @extends BaseQueryBuilder\n */\nexport class TermsQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string[]} terms - the terms\n * @param data\n */\n constructor(field: string, terms: Array, data: any = {}) {\n super(\"terms\", data);\n this._data.field = field;\n this._data.value = terms;\n }\n}\n\nexport interface TermsQuery extends BaseQuery {\n field: string;\n value: string[];\n}\n\n/**\n * A query which finds documents where the wildcard term can be applied at an existing document field term.\n *\n * Wildcard | Description\n * -------- | ------------\n * ? (question mark) | Skips a single character.\n *\n * To escape a wildcard character, use _\\_ (backslash), e.g. \\?.\n *\n * * To enable scoring for wildcard queries, use {@link WildcardQueryBuilder#enableScoring}.\n *\n * See also [Lucene#WildcardQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/WildcardQuery.html}\n * and [Elasticsearch#WildcardQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .wildcard(\"question\", \"e?nst*n\\?\")\n * .build();\n * // The resulting documents:\n * // contains the wildcard surname e?nst*n\\? (like Einstein? or Eynsteyn? but not Einsteine or Ensten?)\n *\n * @extends BaseQueryBuilder\n */\nexport class WildcardQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string} wildcard - the wildcard term\n * @param data\n */\n constructor(field: string, wildcard: string, data: any = {}) {\n super(\"wildcard\", data);\n this._data.field = field;\n this._data.value = wildcard;\n }\n\n /**\n * This flag enables scoring for wildcard results, similar to {@link TermQueryBuilder}.\n * @param {boolean} enable - flag to enable or disable scoring\n * @return {WildcardQueryBuilder}\n */\n enableScoring(enable: boolean) {\n this._data.enable_scoring = enable;\n return this;\n }\n}\n\nexport interface WildcardQuery extends BaseQuery {\n field: string;\n value: string;\n enable_scoring?: boolean;\n}\n\n/**\n * A query which finds documents where the fuzzy term can be transformed into an existing document field term within a\n * given edit distance.\n * ([Damerau–Levenshtein distance]{@link https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance}).\n *\n * The edit distance is the minimum number of an insertion, deletion or substitution of a single character\n * or a transposition of two adjacent characters.\n *\n * * To set the maximal allowed edit distance, use {@link FuzzyQueryBuilder#fuzziness} (default is AUTO).\n * * To set the initial word length, which should ignored for fuzziness, use {@link FuzzyQueryBuilder#prefixLength}.\n * * To include longer document field terms than the fuzzy term and edit distance together, use\n * {@link FuzzyQueryBuilder#extended}.\n *\n * See also [Lucene#FuzzyQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/FuzzyQuery.html}\n * and [Elasticsearch#FuzzyQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .fuzzy(\"surname\", \"einsten\")\n * .fuzziness(2)\n * .prefixLength(3)\n * .build();\n * // The resulting documents:\n * // contains the fuzzy surname einstn (like Einstein or Einst but not Eisstein or Insten)\n *\n * @extends BaseQueryBuilder\n */\nexport class FuzzyQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string} fuzzy - the fuzzy term\n * @param data\n */\n constructor(field: string, fuzzy: string, data: any = {}) {\n super(\"fuzzy\", data);\n this._data.field = field;\n this._data.value = fuzzy;\n }\n\n /**\n * Sets the maximal allowed fuzziness.\n * @param {number|string} fuzziness - the edit distance 0, 1, 2 or AUTO\n *\n * AUTO generates an edit distance based on the length of the term:\n * * 0..2 -> must match exactly\n * * 3..5 -> one edit allowed\n * * >5 two edits allowed\n *\n * @return {FuzzyQueryBuilder} - object itself for cascading\n */\n fuzziness(fuzziness: number | \"AUTO\") {\n if (fuzziness !== \"AUTO\" && (fuzziness < 0 || fuzziness > 2)) {\n throw TypeError(\"Fuzziness must be 0, 1, 2 or AUTO.\");\n }\n this._data.fuzziness = fuzziness;\n return this;\n }\n\n /**\n * Sets the initial word length.\n * @param {number} prefixLength - the positive prefix length\n * @return {FuzzyQueryBuilder} object itself for cascading\n */\n prefixLength(prefixLength: number) {\n if (prefixLength < 0) {\n throw TypeError(\"Prefix length must be a positive number.\");\n }\n this._data.prefix_length = prefixLength;\n return this;\n }\n\n /**\n * This flag allows longer document field terms than the actual fuzzy.\n * @param {boolean} extended - flag to enable or disable extended search\n * @return {FuzzyQueryBuilder}\n */\n extended(extended: boolean) {\n this._data.extended = extended;\n return this;\n }\n}\n\nexport interface FuzzyQuery extends BaseQuery {\n field: string;\n value: string;\n fuzziness?: number | \"AUTO\";\n prefix_length?: number;\n extended?: boolean;\n}\n\n/**\n * A query which matches documents containing the prefix of a term inside a field.\n *\n * * To enable scoring for wildcard queries, use {@link WildcardQueryBuilder#enableScoring}.\n *\n * See also [Lucene#PrefixQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/PrefixQuery.html}\n * and [Elasticsearch#MatchQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-prefix-query.html}\n *\n * @example\n * new QueryBuilder()\n * .prefix(\"surname\", \"alb\")\n * .build()\n * // The resulting documents:\n * // contains the term prefix alb as surname\n *\n * @extends BaseQueryBuilder\n */\nexport class PrefixQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string} prefix - the prefix of a term\n * @param data\n */\n constructor(field: string, prefix: string, data: any = {}) {\n super(\"prefix\", data);\n this._data.field = field;\n this._data.value = prefix;\n }\n\n /**\n * This flag enables scoring for prefix results, similar to {@link TermQueryBuilder}.\n * @param {boolean} enable - flag to enable or disable scoring\n * @return {PrefixQueryBuilder}\n */\n enableScoring(enable: boolean) {\n this._data.enable_scoring = enable;\n return this;\n }\n}\n\nexport interface PrefixQuery extends BaseQuery {\n field: string;\n value: string;\n enable_scoring?: boolean;\n}\n\n/**\n * A query which matches all documents with a given field.\n *\n * See also [Elasticsearch#ExistsQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .exists(\"name\")\n * .build()\n * // The resulting documents:\n * // has the field \"name\"\n *\n * @extends BaseQueryBuilder\n */\nexport class ExistsQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param data\n */\n constructor(field: string, data: any = {}) {\n super(\"exists\", data);\n this._data.field = field;\n }\n}\n\nexport interface ExistsQuery extends BaseQuery {\n field: string;\n}\n\n\n/**\n * A query which tokenizes the given query text, performs a query foreach token and combines the results using a boolean\n * operator.\n *\n * Operator | Description\n * ------------- | -------------\n * or (default) | Finds documents which matches some tokens. The minimum amount of matches can be controlled with [minimumShouldMatch]{@link MatchQueryBuilder#minimumShouldMatch} (default is 1).\n * and | Finds documents which matches all tokens.\n *\n * To enable a [fuzzy query]{@link FuzzyQueryBuilder} for the tokens, use {@link MatchQueryBuilder#fuzziness},\n * {@link MatchQueryBuilder#prefixLength} and {@link MatchQueryBuilder#extended}\n *\n * See also [Lucene#?]{@link ?}\n * and [Elasticsearch#MatchQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .match(\"name\", \"albrt einsten\")\n * .boost(2.5)\n * .operator(\"and\")\n * .fuzziness(2)\n * .prefixLength(3)\n * .build();\n * // The resulting documents:\n * // contains the fuzzy name albrt einsten (like Albert Einstein) with a boost of 2.5\n *\n * @extends BaseQueryBuilder\n */\nexport class MatchQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string} query - the query text\n * @param data\n */\n constructor(field: string, query: string, data: any = {}) {\n super(\"match\", data);\n this._data.field = field;\n this._data.value = query;\n }\n\n /**\n * Controls the amount of minimum matching sub queries before a document will be considered.\n * @param {number} minShouldMatch - number of minimum matching sub queries\n * minShouldMatch >= 1: Indicates a fixed value regardless of the number of sub queries.\n * minShouldMatch <= -1: Indicates that the number of sub queries, minus this number should be mandatory.\n * minShouldMatch < 0: Indicates that this percent of the total number of sub queries can be missing.\n * The number computed from the percentage is rounded down, before being subtracted from the total to determine\n * the minimum.\n * minShouldMatch < 1: Indicates that this percent of the total number of sub queries are necessary.\n * The number computed from the percentage is rounded down and used as the minimum.\n * @return {MatchQueryBuilder} object itself for cascading\n */\n minimumShouldMatch(minShouldMatch: number) {\n if (this._data.operator !== undefined && this._data.operator === \"and\") {\n throw SyntaxError(\"Match query with \\\"and\\\" operator does not support minimum should match.\");\n }\n this._data.minimum_should_match = minShouldMatch;\n return this;\n }\n\n /**\n * Sets the boolean operator.\n * @param {string} op - the operator (\"or\" || \"and\")\n * @return {MatchQueryBuilder} object itself for cascading\n */\n operator(op: string) {\n if (op !== \"and\" && op !== \"or\") {\n throw SyntaxError(\"Unknown operator.\");\n }\n this._data.operator = op;\n if (this._data.minimum_should_match !== undefined && this._data.operator === \"and\") {\n throw SyntaxError(\"Match query with \\\"and\\\" operator does not support minimum should match.\");\n }\n return this;\n }\n\n /**\n * Sets the maximal allowed fuzziness.\n * @param {number|string} fuzziness - the edit distance 0, 1, 2 or AUTO\n *\n * AUTO generates an edit distance based on the length of the term:\n * * 0..2 -> must match exactly\n * * 3..5 -> one edit allowed\n * * >5 two edits allowed\n *\n * @return {MatchQueryBuilder} - object itself for cascading\n */\n fuzziness(fuzziness: number | \"AUTO\") {\n if (fuzziness !== \"AUTO\" && (fuzziness < 0 || fuzziness > 2)) {\n throw TypeError(\"Fuzziness must be 0, 1, 2 or AUTO.\");\n }\n this._data.fuzziness = fuzziness;\n return this;\n }\n\n /**\n * Sets the starting word length which should not be considered for fuzziness.\n * @param {number} prefixLength - the positive prefix length\n * @return {MatchQueryBuilder} - object itself for cascading\n */\n prefixLength(prefixLength: number) {\n if (prefixLength < 0) {\n throw TypeError(\"Prefix length must be a positive number.\");\n }\n this._data.prefix_length = prefixLength;\n return this;\n }\n\n /**\n * This flag allows longer document field terms than the actual fuzzy.\n * @param {boolean} extended - flag to enable or disable extended search\n * @return {MatchQueryBuilder}\n */\n extended(extended: boolean) {\n this._data.extended = extended;\n return this;\n }\n}\n\nexport interface MatchQuery extends BaseQuery {\n field: string;\n value: string;\n minimum_should_match?: number;\n operator?: \"and\" | \"or\";\n fuzziness?: number | \"AUTO\";\n prefix_length?: number;\n extended?: boolean;\n}\n\n/**\n * A query that matches all documents and giving them a constant score equal to the query boost.\n *\n * Typically used inside a must clause of a {@link BoolQueryBuilder} to subsequently reject non matching documents with the not\n * clause.\n *\n * See also [Lucene#MatchAllDocsQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/MatchAllDocsQuery.html}\n * and [Elasticsearch#MatchAllQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-all-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .matchAll()\n * .boost(2.5)\n * .build()\n * // The resulting documents:\n * // all documents and giving a score of 2.5\n *\n * @extends BaseQueryBuilder\n */\nexport class MatchAllQueryBuilder extends BaseQueryBuilder {\n constructor(data: any = {}) {\n super(\"match_all\", data);\n }\n}\n\nexport interface MatchQueryAll extends BaseQuery {\n}\n\n/**\n * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter.\n *\n * See also [Lucene#BooleanQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/ConstantScoreQuery.html}\n * and [Elasticsearch#ConstantScoreQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-constant-score-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .constantScore()\n * .boost(1.5)\n * .beginFilter()\n * .term(\"first_name\", \"albert\")\n * .term(\"surname\", \"einstein\")\n * .endFilter()\n * .build()\n * // The resulting documents:\n * // * contains albert as first name, einstein as surname and the document score is 42.\n *\n * @extends BaseQueryBuilder\n */\nexport class ConstantScoreQueryBuilder extends BaseQueryBuilder {\n constructor(data: any = {}) {\n super(\"constant_score\", data);\n }\n\n /**\n * Starts an array of queries. Use endFilter() to finish the array.\n * @return {ArrayQueryBuilder} array query for holding sub queries\n */\n beginFilter() {\n this._data.filter = {};\n return new ArrayQueryBuilder(\"endFilter\", () => {\n return this;\n }, this._data.filter);\n }\n}\n\nexport interface ConstantScoreQuery extends BaseQuery {\n filter: ArrayQuery;\n}\n\n/**\n * A query that matches documents matching boolean combinations of sub queries.\n *\n * This query consists of one or more boolean clauses with different behavior but interrelated to each other.\n *\n * Occur | Description\n * ------------- | -------------\n * must | Finds documents which matches all sub queries.\n * filter | Finds documents which matches all sub queries but these documents do not contribute to the score.\n * should | Finds documents which matches some sub queries. The minimum amount of matches can be controlled with [minimumShouldMatch]{@link BoolQueryBuilder#minimumShouldMatch} (default is 1).\n * not | Documents which match any sub query will be ignored.\n *\n * A sub query can be any other query type and also the bool query itself.\n *\n * See also [Lucene#BooleanQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/BooleanQuery.html}\n * and [Elasticsearch#BoolQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .bool()\n * .beginMust().boost(2)\n * .term(\"first_name\", \"albert\")\n * .endMust()\n * .beginFilter()\n * .term(\"birthplace\", \"ulm\")\n * .endFilter()\n * .beginShould().minimumShouldMatch(2)\n * .fuzzy(\"surname\", \"einstin\")\n * .wildcard(\"name\", \"geni?s\")\n * .term(\"quotes\", \"infinity\")\n * .endShould()\n * .beginNot()\n * .terms(\"research_field\", [\"biology\", \"geography\"])\n * .endNot()\n * .build();\n * // The resulting documents:\n * // contains the name albert (must: contribute to the score with a boost of 2)\n * // contains the birthplace ulm (filter: not contribute to the score)\n * // contains a minimum of two matches from the fuzzy, wildcard and/or term query (should: contribute to the score)\n * // do not contains biology or geography as research field (not: not contribute to the score)\n *\n * @extends BaseQueryBuilder\n */\nexport class BoolQueryBuilder extends BaseQueryBuilder {\n constructor(data: any = {}) {\n super(\"bool\", data);\n }\n\n /**\n * Starts an array of queries for must clause. Use endMust() to finish the array.\n * @return {ArrayQueryBuilder} array query for holding sub queries\n */\n beginMust() {\n this._data.must = {};\n return new ArrayQueryBuilder(\"endMust\", () => {\n return this;\n }, this._data.must);\n }\n\n /**\n * Starts an array of queries for filter clause. Use endFilter() to finish the array.\n * @return {ArrayQueryBuilder} array query for holding sub queries\n */\n beginFilter() {\n this._data.filter = {};\n return new ArrayQueryBuilder(\"endFilter\", () => {\n return this;\n }, this._data.filter);\n }\n\n /**\n * Starts an array of queries for should clause. Use endShould() to finish the array.\n * @return {ArrayQueryBuilder} array query for holding sub queries\n */\n beginShould() {\n this._data.should = {};\n return new ArrayQueryBuilder(\"endShould\", () => {\n return this;\n }, this._data.should);\n }\n\n /**\n * Starts an array of queries for not clause. Use endNot() to finish the array.\n * @return {ArrayQueryBuilder} array query for holding sub queries\n */\n beginNot() {\n this._data.not = {};\n return new ArrayQueryBuilder(\"endNot\", () => {\n return this;\n }, this._data.not);\n }\n\n /**\n * Controls the amount of minimum matching sub queries before a document will be considered.\n * @param {number} minShouldMatch - number of minimum matching sub queries\n * minShouldMatch >= 1: Indicates a fixed value regardless of the number of sub queries.\n * minShouldMatch <= -1: Indicates that the number of sub queries, minus this number should be mandatory.\n * minShouldMatch < 0: Indicates that this percent of the total number of sub queries can be missing.\n * The number computed from the percentage is rounded down, before being subtracted from the total to determine\n * the minimum.\n * minShouldMatch < 1: Indicates that this percent of the total number of sub queries are necessary.\n * The number computed from the percentage is rounded down and used as the minimum.\n * @return {BoolQueryBuilder} object itself for cascading\n */\n minimumShouldMatch(minShouldMatch: number) {\n this._data.minimum_should_match = minShouldMatch;\n return this;\n }\n}\n\nexport interface BoolQuery extends BaseQuery {\n must?: ArrayQuery;\n filter?: ArrayQuery;\n should?: ArrayQuery;\n not?: ArrayQuery;\n minimum_should_match?: number;\n}\n\n\n/**\n * A query which holds all sub queries like an array.\n */\nexport class ArrayQueryBuilder extends BaseQueryBuilder {\n private _callbackName: string;\n private _prepare: Function;\n\n constructor(callbackName: string, callback: Function, data: any = {}) {\n super(\"array\", data);\n this._data.values = [];\n this._callbackName = callbackName;\n this[callbackName] = callback;\n\n this._prepare = (queryType: any, ...args: any[]) => {\n const data = {};\n const query = new queryType(...args, data);\n this._data.values.push(data);\n query.bool = this.bool;\n query.constantScore = this.constantScore;\n query.term = this.term;\n query.terms = this.terms;\n query.wildcard = this.wildcard;\n query.fuzzy = this.fuzzy;\n query.match = this.match;\n query.matchAll = this.matchAll;\n query.prefix = this.prefix;\n query.exists = this.exists;\n query._prepare = this._prepare;\n query[this._callbackName] = this[this._callbackName];\n return query;\n };\n }\n\n bool() {\n return this._prepare(BoolQueryBuilder);\n }\n\n constantScore() {\n return this._prepare(ConstantScoreQueryBuilder);\n }\n\n term(field: string, term: string) {\n return this._prepare(TermQueryBuilder, field, term);\n }\n\n terms(field: string, terms: Array) {\n return this._prepare(TermsQueryBuilder, field, terms);\n }\n\n wildcard(field: string, wildcard: string) {\n return this._prepare(WildcardQueryBuilder, field, wildcard);\n }\n\n fuzzy(field: string, fuzzy: string) {\n return this._prepare(FuzzyQueryBuilder, field, fuzzy);\n }\n\n match(field: string, query: string) {\n return this._prepare(MatchQueryBuilder, field, query);\n }\n\n matchAll() {\n return this._prepare(MatchAllQueryBuilder);\n }\n\n prefix(field: string, prefix: string) {\n return this._prepare(PrefixQueryBuilder, field, prefix);\n }\n\n exists(field: string) {\n return this._prepare(ExistsQueryBuilder, field);\n }\n}\n\nexport interface ArrayQuery {\n values: any[];\n}\n\n/**\n * This query builder is the root of each query search.\n * The query contains a sub query and parameters for setup scoring and search options.\n *\n * Possible sub query types are:\n * {@link TermQueryBuilder}, {@link TermsQueryBuilder}, {@link FuzzyQueryBuilder}, {@link WildcardQueryBuilder},\n * {@link MatchQueryBuilder}, {@link MatchAllQueryBuilder}, {@link PrefixQueryBuilder}, {@link BoolQueryBuilder},\n * {@link ConstantScoreQueryBuilder}, {@link ExistsQueryBuilder}\n *\n * @example\n * new QueryBuilder()\n * .finalScoring(true)\n * .useBM25(1.5, 0.5)\n * .term(\"first_name\", \"albert\")\n * .build();\n * // The resulting documents:\n * // contains the first name albert\n * // are scored and ranked using BM25 with k1=1.5 and b=0.5\n */\nexport class QueryBuilder {\n private _data: any;\n\n constructor() {\n this._data = {query: {}};\n }\n\n /**\n * The query performs a final scoring over all scored sub queries.\n * @param {boolean} enable - flag to enable or disable final scoring\n * @return {QueryBuilder}\n */\n enableFinalScoring(enable: boolean) {\n this._data.final_scoring = enable;\n return this;\n }\n\n /**\n * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model.\n *\n * See also [Lucene#MatchAllDocsQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/similarities/BM25Similarity.html}\n * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}.\n *\n * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation.\n * Lower values result in quicker saturation, and higher values in slower saturation.\n * @param {number} [b=0.75] - controls how much effect field-length normalization should have.\n * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully.\n * @return {QueryBuilder}\n */\n BM25Similarity(k1: number = 1.2, b: number = 0.75) {\n if (k1 < 0) {\n throw TypeError(\"BM25s k1 must be a positive number.\");\n }\n if (b < 0 || b > 1) {\n throw TypeError(\"BM25s b must be a number between 0 and 1 inclusive.\");\n }\n\n this._data.bm25 = {\n k1,\n b\n };\n return this;\n }\n\n bool(): BoolQueryBuilder {\n return this._prepare(BoolQueryBuilder);\n }\n\n constantScore(): ConstantScoreQueryBuilder {\n return this._prepare(ConstantScoreQueryBuilder);\n }\n\n term(field: string, term: string): TermQueryBuilder {\n return this._prepare(TermQueryBuilder, field, term);\n }\n\n terms(field: string, terms: Array): TermsQueryBuilder {\n return this._prepare(TermsQueryBuilder, field, terms);\n }\n\n wildcard(field: string, wildcard: string): WildcardQueryBuilder {\n return this._prepare(WildcardQueryBuilder, field, wildcard);\n }\n\n fuzzy(field: string, fuzzy: string): FuzzyQueryBuilder {\n return this._prepare(FuzzyQueryBuilder, field, fuzzy);\n }\n\n match(field: string, query: string): MatchQueryBuilder {\n return this._prepare(MatchQueryBuilder, field, query);\n }\n\n matchAll(): MatchAllQueryBuilder {\n return this._prepare(MatchAllQueryBuilder);\n }\n\n prefix(field: string, prefix: string): PrefixQueryBuilder {\n return this._prepare(PrefixQueryBuilder, field, prefix);\n }\n\n exists(field: string): ExistsQueryBuilder {\n return this._prepare(ExistsQueryBuilder, field);\n }\n\n private _prepare(queryType: { new(...args: any[]): T }, ...args: any[]): T {\n const query = new queryType(...args, this._data.query);\n query.build = () => {\n return this._data;\n };\n return query;\n }\n}\n\nexport interface Query {\n query: any;\n final_scoring?: boolean;\n bm25?: {\n k1: number;\n b: number;\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/query_builder.ts","import {Long} from \"./long\";\n\nconst MASKS = [new Long(0x1), new Long(0x3), new Long(0x7), new Long(0xf),\n new Long(0x1f), new Long(0x3f), new Long(0x7f), new Long(0xff),\n new Long(0x1ff), new Long(0x3ff), new Long(0x7ff), new Long(0xfff),\n new Long(0x1fff), new Long(0x3fff), new Long(0x7fff), new Long(0xffff),\n new Long(0xf, 0x1fff), new Long(0xf, 0x3fff), new Long(0xf, 0x7fff), new Long(0xf, 0xffff),\n new Long(0xff, 0x1fff), new Long(0xff, 0x3fff), new Long(0xff, 0x7fff), new Long(0xff, 0xffff),\n new Long(0xfff, 0x1fff), new Long(0xfff, 0x3fff), new Long(0xfff, 0x7fff), new Long(0xfff, 0xffff),\n new Long(0xffff, 0x1fff), new Long(0xffff, 0x3fff), new Long(0xffff, 0x7fff), new Long(0xffff, 0xffff),\n new Long(0xfffff, 0x1fff), new Long(0xfffff, 0x3fff), new Long(0xfffff, 0x7fff), new Long(0xfffff, 0xffff),\n new Long(0xffffff, 0x1fff), new Long(0xffffff, 0x3fff), new Long(0xffffff, 0x7fff), new Long(0xffffff, 0xffff),\n new Long(0xfffffff, 0x1fff), new Long(0xfffffff, 0x3fff), new Long(0xfffffff, 0x7fff), new Long(0xfffffff, 0xffff),\n new Long(0xffffffff, 0x1fff), new Long(0xffffffff, 0x3fff), new Long(0xffffffff, 0x7fff), new Long(0xffffffff, 0xffff),\n new Long(0xfffffffff, 0x1fff), new Long(0xfffffffff, 0x3fff), new Long(0xfffffffff, 0x7fff), new Long(0xfffffffff, 0xffff),\n new Long(0xffffffffff, 0x1fff), new Long(0xffffffffff, 0x3fff), new Long(0xffffffffff, 0x7fff), new Long(0xffffffffff, 0xffff),\n new Long(0xfffffffffff, 0x1fff), new Long(0xfffffffffff, 0x3fff), new Long(0xfffffffffff, 0x7fff), new Long(0xfffffffffff, 0xffff),\n new Long(0xffffffffffff, 0x1fff), new Long(0xffffffffffff, 0x3fff), new Long(0xffffffffffff, 0x7fff)];\n\n/**\n * From org/apache/lucene/util/automaton/LevenshteinAutomata.java#ParametricDescription\n * @hidden\n */\nexport class ParametricDescription {\n protected _w: number;\n private _n: number;\n private _minErrors: number[];\n\n constructor(w: number, n: number, minErrors: number[]) {\n this._w = w;\n this._n = n;\n this._minErrors = minErrors;\n }\n\n /**\n * Return the number of states needed to compute a Levenshtein DFA\n */\n public size(): number {\n return this._minErrors.length * (this._w + 1);\n }\n\n /**\n * Returns true if the state in any Levenshtein DFA is an accept state (final state).\n */\n public isAccept(absState: number): boolean {\n // decode absState -> state, offset\n let state = Math.floor(absState / (this._w + 1));\n let offset = absState % (this._w + 1);\n //assert offset >= 0;\n return this._w - offset + this._minErrors[state] <= this._n;\n }\n\n /**\n * Returns the position in the input word for a given state.\n * This is the minimal boundary for the state.\n */\n public getPosition(absState: number): number {\n return absState % (this._w + 1);\n }\n\n public unpack(data: Long[], index: number, bitsPerValue: number): number {\n const bitLoc = bitsPerValue * index;\n const dataLoc = (bitLoc >> 6);\n const bitStart = (bitLoc & 63);\n\n if (bitStart + bitsPerValue <= 64) {\n // not split\n return data[dataLoc].shiftRight(bitStart).and(MASKS[bitsPerValue - 1]).toInt();\n } else {\n // split\n const part = 64 - bitStart;\n return (data[dataLoc].shiftRight(bitStart).and(MASKS[part - 1])).toInt()\n + (data[1 + dataLoc].and(MASKS[bitsPerValue - part - 1]).shiftLeft(part)).toInt();\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/parametric_description.ts","import {FullTextSearch} from \"./full_text_search\";\nexport {Tokenizer} from \"./tokenizer\";\nexport {QueryBuilder} from \"./query_builder\";\nexport {InvertedIndex} from \"./inverted_index\";\n\nexport {FullTextSearch};\nexport default FullTextSearch;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/index.ts","import {InvertedIndex} from \"./inverted_index\";\nimport {IndexSearcher} from \"./index_searcher\";\nimport {Tokenizer} from \"./tokenizer\";\nimport {Dict} from \"../../common/types\";\nimport {PLUGINS} from \"../../common/plugin\";\nimport {Query} from \"./query_builder\";\nimport {ScoreResult} from \"./scorer\";\n\nexport class FullTextSearch {\n private _id: string;\n private _docs: Set;\n private _idxSearcher: IndexSearcher;\n private _invIdxs: Dict = {};\n\n /**\n * Registers the full-text search as plugin.\n */\n public static register(): void {\n PLUGINS[\"FullTextSearch\"] = FullTextSearch;\n }\n\n /**\n * Initialize the full-text search for the given fields.\n * @param {object[]} fields - the field options\n * @param {string} fields.name - the name of the field\n * @param {boolean=true} fields.store - flag to indicate if the full-text search should be stored on serialization or\n * rebuild on deserialization\n * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized\n * (requires more memory but performs better)\n * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field\n * @param {string=$loki} id - the property name of the document index\n */\n constructor(fields: FullTextSearch.FieldOptions[] = [], id = \"$loki\") {\n // Create inverted indices for each field.\n for (let i = 0; i < fields.length; i++) {\n let field = fields[i];\n this._invIdxs[field.name] = new InvertedIndex(field);\n }\n this._id = id;\n this._docs = new Set();\n this._idxSearcher = new IndexSearcher(this._invIdxs, this._docs);\n }\n\n public addDocument(doc: object, id: number = doc[this._id]): void {\n let fieldNames = Object.keys(doc);\n for (let i = 0, fieldName; i < fieldNames.length, fieldName = fieldNames[i]; i++) {\n if (this._invIdxs[fieldName] !== undefined) {\n this._invIdxs[fieldName].insert(doc[fieldName], id);\n }\n }\n this._docs.add(id);\n this._idxSearcher.setDirty();\n }\n\n public removeDocument(doc: object, id: number = doc[this._id]): void {\n let fieldNames = Object.keys(this._invIdxs);\n for (let i = 0; i < fieldNames.length; i++) {\n this._invIdxs[fieldNames[i]].remove(id);\n }\n this._docs.delete(id);\n this._idxSearcher.setDirty();\n }\n\n public updateDocument(doc: object, id: number = doc[this._id]): void {\n this.removeDocument(doc, id);\n this.addDocument(doc, id);\n }\n\n public clear(): void {\n for (let id of this._docs) {\n this.removeDocument(null, id);\n }\n }\n\n public search(query: Query): ScoreResult {\n return this._idxSearcher.search(query);\n }\n\n public toJSON(): FullTextSearch.Serialization {\n let serialized = {id: this._id, ii: {}};\n let fieldNames = Object.keys(this._invIdxs);\n for (let i = 0; i < fieldNames.length; i++) {\n const fieldName = fieldNames[i];\n serialized.ii[fieldName] = this._invIdxs[fieldName].toJSON();\n }\n return serialized;\n }\n\n public static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers: Dict = {}): FullTextSearch {\n let fts = new FullTextSearch([], serialized.id);\n let fieldNames = Object.keys(serialized.ii);\n for (let i = 0; i < fieldNames.length; i++) {\n const fieldName = fieldNames[i];\n fts._invIdxs[fieldName] = InvertedIndex.fromJSONObject(serialized.ii[fieldName], tokenizers[fieldName]);\n }\n return fts;\n }\n}\n\nexport namespace FullTextSearch {\n export interface FieldOptions extends InvertedIndex.FieldOptions {\n name: string;\n }\n\n export interface Serialization {\n id: string;\n ii: Dict;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/full_text_search.ts","import {Scorer, ScoreResult} from \"./scorer\";\nimport {InvertedIndex, toCodePoints} from \"./inverted_index\";\nimport {FuzzyQuery, Query, QueryBuilder, WildcardQuery} from \"./query_builder\";\nimport {Dict} from \"../../common/types\";\nimport {RunAutomaton} from \"./fuzzy/run_automaton\";\nimport {LevenshteinAutomata} from \"./fuzzy/levenshtein_automata\";\nimport DocResults = Scorer.DocResults;\nimport Index = InvertedIndex.Index;\n\n\n\n/**\n * @hidden\n */\nexport class IndexSearcher {\n private _invIdxs: Dict;\n private _docs: Set;\n private _scorer: Scorer;\n\n /**\n * @param {object} invIdxs\n */\n constructor(invIdxs: Dict, docs: Set) {\n this._invIdxs = invIdxs;\n this._docs = docs;\n this._scorer = new Scorer(this._invIdxs);\n }\n\n public search(query: Query): ScoreResult {\n let docResults = this._recursive(query.query, true);\n\n // Do final scoring.\n if (query.final_scoring !== undefined ? query.final_scoring : true) {\n return this._scorer.finalScore(query, docResults);\n }\n\n const result: ScoreResult = {};\n for (const key of docResults.keys()) {\n result[key] = 1;\n }\n return result;\n }\n\n public setDirty() {\n this._scorer.setDirty();\n }\n\n private _recursive(query: any, doScoring: boolean) {\n let docResults: DocResults = new Map();\n const boost = query.boost !== undefined ? query.boost : 1;\n const fieldName = query.field !== undefined ? query.field : null;\n\n let root = null;\n let tokenizer = null;\n if (this._invIdxs[fieldName] !== undefined) {\n root = this._invIdxs[fieldName].root;\n tokenizer = this._invIdxs[fieldName].tokenizer;\n }\n\n switch (query.type) {\n case \"bool\": {\n docResults = null;\n if (query.must !== undefined) {\n docResults = this._getUnique(query.must.values, doScoring, docResults);\n }\n if (query.filter !== undefined) {\n docResults = this._getUnique(query.filter.values, false, docResults);\n }\n if (query.should !== undefined) {\n let shouldDocs = this._getAll(query.should.values, doScoring);\n\n let empty = false;\n if (docResults === null) {\n docResults = new Map();\n empty = true;\n }\n\n let msm = 1;\n // TODO: Enable percent and ranges.\n if (query.minimum_should_match !== undefined) {\n msm = query.minimum_should_match;\n let shouldLength = query.should.values.length;\n if (msm <= -1) {\n msm = shouldLength + msm;\n } else if (msm < 0) {\n msm = shouldLength - Math.floor(shouldLength * -msm);\n } else if (msm < 1) {\n msm = Math.floor(shouldLength * msm);\n }\n }\n // Remove all docs with fewer matches.\n for (const [docId, res] of shouldDocs) {\n if (res.length >= msm) {\n if (docResults.has(docId)) {\n docResults.get(docId).push(...res);\n } else if (empty) {\n docResults.set(docId, res);\n } else {\n docResults.delete(docId);\n }\n }\n }\n }\n if (query.not !== undefined) {\n let notDocs = this._getAll(query.not.values, false);\n // Remove all docs.\n for (const docId of notDocs.keys()) {\n if (docResults.has(docId)) {\n docResults.delete(docId);\n }\n }\n }\n break;\n }\n case \"term\": {\n const cps = toCodePoints(query.value);\n let termIdx = InvertedIndex.getTermIndex(cps, root);\n this._scorer.score(fieldName, boost, termIdx, doScoring, docResults, cps);\n break;\n }\n case \"terms\": {\n for (let i = 0; i < query.value.length; i++) {\n const cps = toCodePoints(query.value[i]);\n let termIdx = InvertedIndex.getTermIndex(cps, root);\n this._scorer.score(fieldName, boost, termIdx, doScoring, docResults, cps);\n }\n break;\n }\n case \"fuzzy\": {\n const f = fuzzySearch(query, root);\n for (let i = 0; i < f.length; i++) {\n this._scorer.score(fieldName, boost * f[i].boost, f[i].index, doScoring, docResults, f[i].term);\n }\n break;\n }\n case \"wildcard\": {\n const enableScoring = query.enable_scoring !== undefined ? query.enable_scoring : false;\n const w = wildcardSearch(query, root);\n for (let i = 0; i < w.length; i++) {\n this._scorer.score(fieldName, boost, w[i].index, doScoring && enableScoring, docResults, w[i].term);\n }\n break;\n }\n case \"match_all\": {\n for (let docId of this._docs) {\n this._scorer.scoreConstant(boost, docId, docResults);\n }\n break;\n }\n case \"constant_score\": {\n let tmpDocResults = this._getAll(query.filter.values, false);\n // Add to each document a constant score.\n for (const docId of tmpDocResults.keys()) {\n this._scorer.scoreConstant(boost, docId, docResults);\n }\n break;\n }\n case \"prefix\": {\n const enableScoring = query.enable_scoring !== undefined ? query.enable_scoring : false;\n const cps = toCodePoints(query.value);\n const termIdx = InvertedIndex.getTermIndex(cps, root);\n if (termIdx !== null) {\n const termIdxs = InvertedIndex.extendTermIndex(termIdx);\n for (let i = 0; i < termIdxs.length; i++) {\n this._scorer.score(fieldName, boost, termIdxs[i].index, doScoring && enableScoring, docResults, [...cps, ...termIdxs[i].term]);\n }\n }\n break;\n }\n case \"exists\": {\n if (root !== null) {\n for (const docId of this._invIdxs[fieldName].documentStore.keys()) {\n this._scorer.scoreConstant(boost, docId, docResults);\n }\n }\n break;\n }\n case \"match\": {\n let terms = tokenizer.tokenize(query.value);\n let operator = query.operator !== undefined ? query.operator : \"or\";\n\n let tmpQuery: any = new QueryBuilder().bool();\n if (operator === \"or\") {\n if (query.minimum_should_match !== undefined) {\n tmpQuery = tmpQuery.minimumShouldMatch(query.minimum_should_match);\n }\n // Build a should query.\n tmpQuery = tmpQuery.beginShould();\n } else {\n // Build a must query.\n tmpQuery = tmpQuery.beginMust();\n }\n tmpQuery = tmpQuery.boost(boost);\n\n if (query.fuzziness !== undefined) {\n let prefixLength = query.prefix_length !== undefined ? query.prefix_length : 2;\n let extended = query.extended !== undefined ? query.extended : false;\n // Add each fuzzy.\n for (let i = 0; i < terms.length; i++) {\n tmpQuery = tmpQuery.fuzzy(fieldName, terms[i]).fuzziness(query.fuzziness).prefixLength(prefixLength).extended(extended);\n }\n } else {\n // Add each term.\n for (let i = 0; i < terms.length; i++) {\n tmpQuery = tmpQuery.term(fieldName, terms[i]);\n }\n }\n if (operator === \"or\") {\n tmpQuery = tmpQuery.endShould();\n } else {\n tmpQuery = tmpQuery.endMust();\n }\n docResults = this._recursive(tmpQuery.build().query, doScoring);\n\n break;\n }\n default:\n break;\n }\n return docResults;\n }\n\n private _getUnique(queries: any[], doScoring: boolean, docResults: DocResults) {\n if (queries.length === 0) {\n return docResults;\n }\n\n for (let i = 0; i < queries.length; i++) {\n let currDocs = this._recursive(queries[i], doScoring);\n if (docResults === null) {\n docResults = this._recursive(queries[0], doScoring);\n continue;\n }\n\n for (const docId of docResults.keys()) {\n if (!currDocs.has(docId)) {\n docResults.delete(docId);\n } else {\n docResults.get(docId).push(...currDocs.get(docId));\n }\n }\n }\n return docResults;\n }\n\n private _getAll(queries: any[], doScoring: boolean) {\n let docResults: DocResults = new Map();\n for (let i = 0; i < queries.length; i++) {\n let currDocs = this._recursive(queries[i], doScoring);\n for (const docId of currDocs.keys()) {\n if (!docResults.has(docId)) {\n docResults.set(docId, currDocs.get(docId));\n } else {\n docResults.get(docId).push(...currDocs.get(docId));\n }\n }\n }\n return docResults;\n }\n}\n\ntype FuzzyResult = {index: Index, term: number[], boost: number};\n\n/**\n * Performs a fuzzy search.\n * @param {FuzzyQuery} query - the fuzzy query\n * @param {Index} root - the root index\n * @returns {FuzzyResult} - the results\n */\nfunction fuzzySearch(query: FuzzyQuery, root: Index): FuzzyResult[] {\n let value = toCodePoints(query.value);\n let fuzziness = query.fuzziness !== undefined ? query.fuzziness : \"AUTO\";\n if (fuzziness === \"AUTO\") {\n if (value.length <= 2) {\n fuzziness = 0;\n } else if (value.length <= 5) {\n fuzziness = 1;\n } else {\n fuzziness = 2;\n }\n }\n let prefixLength = query.prefix_length !== undefined ? query.prefix_length : 2;\n let extended = query.extended !== undefined ? query.extended : false;\n\n // Do just a prefix search if zero fuzziness.\n if (fuzziness === 0) {\n prefixLength = value.length;\n }\n\n let result: FuzzyResult[] = [];\n let startIdx = root;\n let prefix = value.slice(0, prefixLength);\n let fuzzy = value;\n\n // Perform a prefix search.\n if (prefixLength !== 0) {\n startIdx = InvertedIndex.getTermIndex(prefix, startIdx);\n fuzzy = fuzzy.slice(prefixLength);\n }\n\n // No startIdx found.\n if (startIdx === null) {\n return result;\n }\n\n // Fuzzy is not necessary anymore, because prefix search includes the whole query value.\n if (fuzzy.length === 0) {\n if (extended) {\n // Add all terms down the index.\n const all = InvertedIndex.extendTermIndex(startIdx);\n for (let i = 0; i < all.length; i++) {\n result.push({index: all[i].index, term: all[i].term, boost: 1});\n }\n } else if (startIdx.dc !== undefined) {\n // Add prefix search result.\n result.push({index: startIdx, term: value, boost: 1});\n }\n return result;\n }\n\n // The matching term.\n const term = [0];\n // Create an automaton from the fuzzy.\n const automaton = new RunAutomaton(new LevenshteinAutomata(fuzzy, fuzziness).toAutomaton());\n\n function determineEditDistance(state: number, termLength: number, fuzzyLength: number): number {\n // Check how many edits this fuzzy can still do.\n let ed = 0;\n state = automaton.step(state, 0);\n if (state !== -1 && automaton.isAccept(state)) {\n ed++;\n state = automaton.step(state, 0);\n if (state !== -1 && automaton.isAccept(state)) {\n ed++;\n }\n }\n // Include the term and fuzzy length.\n ed -= Math.abs(termLength - fuzzyLength);\n return fuzziness as number - ed;\n }\n\n function recursive(state: number, key: number, idx: Index) {\n term[term.length - 1] = key;\n\n // Check the current key of term with the automaton.\n state = automaton.step(state, key);\n if (state === -1) {\n return;\n }\n\n if (automaton.isAccept(state)) {\n if (extended) {\n // Add all terms down the index.\n let all = InvertedIndex.extendTermIndex(idx);\n for (let i = 0; i < all.length; i++) {\n result.push({index: all[i].index, term: all[i].term, boost: 1});\n }\n return;\n } else if (idx.df !== undefined) {\n // Calculate boost.\n let distance = determineEditDistance(state, term.length, fuzzy.length);\n let boost = 1 - distance / Math.min(prefix.length + term.length, value.length);\n result.push({index: idx, term: [...prefix, ...term], boost});\n }\n }\n\n term.push(0);\n for (const child of idx) {\n recursive(state, child[0], child[1]);\n }\n term.pop();\n }\n\n for (const child of startIdx) {\n recursive(0, child[0], child[1]);\n }\n\n return result;\n}\n\ntype WildcardResult = {index: Index, term: number[]};\n\n/**\n * Performs a wildcard search.\n * @param {WildcardQuery} query - the wildcard query\n * @param {Index} root - the root index\n * @returns {Array} - the results\n */\nfunction wildcardSearch(query: WildcardQuery, root: Index): WildcardResult[] {\n let wildcard = toCodePoints(query.value);\n let result: WildcardResult[] = [];\n\n function recursive(index: Index, idx: number = 0, term: number[] = [], escaped: boolean = false) {\n if (index === null) {\n return;\n }\n\n if (idx === wildcard.length) {\n if (index.df !== undefined) {\n result.push({index: index, term: term.slice()});\n }\n return;\n }\n\n // Escaped character.\n if (!escaped && wildcard[idx] === 92 /* \\ */) {\n recursive(index, idx + 1, term, true);\n } else if (!escaped && wildcard[idx] === 63 /* ? */) {\n for (const child of index) {\n recursive(child[1], idx + 1, [...term, child[0]]);\n }\n } else if (!escaped && wildcard[idx] === 42 /* * */) {\n // Check if asterisk is last wildcard character\n if (idx + 1 === wildcard.length) {\n const all = InvertedIndex.extendTermIndex(index);\n for (let i = 0; i < all.length; i++) {\n recursive(all[i].index, idx + 1, [...term, ...all[i].term]);\n }\n } else {\n // Iterate over the whole tree.\n recursive(index, idx + 1, term, false);\n const indices: InvertedIndex.IndexTerm[] = [{index: index, term: []}];\n do {\n const index = indices.pop();\n for (const child of index.index) {\n recursive(child[1], idx + 1, [...term, ...index.term, child[0]]);\n indices.push({index: child[1], term: [...index.term, child[0]]});\n }\n } while (indices.length !== 0);\n }\n } else {\n recursive(InvertedIndex.getTermIndex([wildcard[idx]], index), idx + 1, [...term, wildcard[idx]]);\n }\n }\n\n recursive(root);\n\n return result;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/index_searcher.ts","import {InvertedIndex} from \"./inverted_index\";\nimport {Dict} from \"../../common/types\";\nimport {Query} from \"./query_builder\";\n\nexport type ScoreResult = Dict;\n\n/**\n * @hidden\n */\nexport class Scorer {\n private _invIdxs: Dict;\n private _cache: Dict;\n\n constructor(invIdxs: Dict) {\n this._invIdxs = invIdxs;\n this._cache = {};\n }\n\n public setDirty(): void {\n this._cache = {};\n }\n\n public score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, docResults: Scorer.DocResults, term: number[]): void {\n if (termIdx === null || termIdx.dc === undefined) {\n return;\n }\n\n const idf = this._idf(fieldName, termIdx.df);\n for (const [docId, tf] of termIdx.dc) {\n if (!docResults.has(docId)) {\n docResults.set(docId, []);\n }\n\n if (doScoring) {\n // BM25 scoring.\n docResults.get(docId).push({tf, idf, boost, fieldName, term});\n } else {\n // Constant scoring.\n docResults.set(docId, [{boost}]);\n }\n }\n }\n\n public scoreConstant(boost: number, docId: number, docResults: Scorer.DocResults) {\n if (!docResults.has(docId)) {\n docResults.set(docId, []);\n }\n docResults.get(docId).push({boost});\n return docResults;\n }\n\n public finalScore(query: Query, docResults: Scorer.DocResults): ScoreResult {\n const result: ScoreResult = {};\n const k1 = query.bm25 !== undefined ? query.bm25.k1 : 1.2;\n const b = query.bm25 !== undefined ? query.bm25.b : 0.75;\n\n for (const [docId, result1] of docResults) {\n let docScore = 0;\n for (let j = 0; j < result1.length; j++) {\n const docResult = result1[j];\n let res = 0;\n if (docResult.tf !== undefined) {\n // BM25 scoring.\n const tf = docResult.tf;\n const fieldLength = Scorer._calculateFieldLength(this._invIdxs[docResult.fieldName].documentStore.get(+docId)\n .fieldLength);\n const avgFieldLength = this._avgFieldLength(docResult.fieldName);\n const tfNorm = (tf * (k1 + 1)) / (tf + k1 * (1 - b + b * (fieldLength / avgFieldLength)));\n res = docResult.idf * tfNorm * docResult.boost;\n // console.log(\n // \tdocId + \":\" + docResult.fieldName + \":\" + String.fromCharCode(...docResult.term) + \" = \" + res,\n // \t\"\\n\\ttype: BM25\",\n // \t\"\\n\\tboost: \" + docResult.boost,\n // \t\"\\n\\tidf : \" + docResult.idf,\n // \t\"\\n\\ttfNorm : \" + tfNorm,\n // \t\"\\n\\ttf : \" + tf,\n // \t\"\\n\\tavg : \" + avgFieldLength,\n // \t\"\\n\\tfl : \" + fieldLength);\n } else {\n // Constant scoring.\n res = docResult.boost;\n // console.log(\n // \"Constant: \" + res,\n // \"\\n\\tboost: \" + docResult.boost);\n }\n docScore += res;\n }\n //console.log(docId, \" === \", docScore);\n result[docId] = docScore;\n }\n return result;\n }\n\n private static _calculateFieldLength(fieldLength: number): number {\n // Dummy function to be compatible to lucene in unit tests.\n return fieldLength;\n }\n\n private _getCache(fieldName: string): Scorer.IDFCache {\n if (this._cache[fieldName] === undefined) {\n const avgFieldLength = this._invIdxs[fieldName].totalFieldLength / this._invIdxs[fieldName].documentCount;\n this._cache[fieldName] = {idfs: {}, avgFieldLength};\n }\n return this._cache[fieldName];\n }\n\n /**\n * Returns the idf by either calculate it or use a cached one.\n * @param {string} fieldName - the name of the field\n * @param {number} docFreq - the doc frequency of the term\n * @returns {number} the idf\n * @private\n */\n private _idf(fieldName: string, docFreq: number): number {\n const cache = this._getCache(fieldName);\n if (cache.idfs[docFreq] !== undefined) {\n return cache.idfs[docFreq];\n }\n return cache.idfs[docFreq] = Math.log(1 + (this._invIdxs[fieldName].documentCount - docFreq + 0.5) / (docFreq + 0.5));\n }\n\n private _avgFieldLength(fieldName: string): number {\n return this._getCache(fieldName).avgFieldLength;\n }\n}\n\nexport namespace Scorer {\n export interface IDFCache {\n idfs: Dict;\n avgFieldLength: number;\n }\n\n export interface DocResult {\n tf?: number; // Term frequency.\n idf?: number; // Inverse document frequency\n boost: number;\n fieldName?: string;\n term?: number[];\n }\n\n export type DocResults = Map;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/scorer.ts","import {Automaton} from \"./automaton\";\n\n/**\n * From org/apache/lucene/util/automaton/RunAutomaton.java\n * @hidden\n */\nexport class RunAutomaton {\n private _points: number[];\n private _accept: boolean[];\n private _transitions: number[];\n private _classmap: number[];\n\n constructor(automaton: Automaton) {\n const size = automaton.getNumStates();\n this._points = automaton.getStartPoints();\n this._accept = new Array(size);\n this._transitions = new Array(size * this._points.length);\n\n for (let n = 0; n < size; n++) {\n this._accept[n] = automaton.isAccept(n);\n for (let c = 0; c < this._points.length; c++) {\n // assert dest === -1 || dest < size;\n this._transitions[n * this._points.length + c] = automaton.step(n, this._points[c]);\n }\n }\n\n this._classmap = new Array(256 /* alphaSize */);\n for (let i = 0, j = 0; j < this._classmap.length; j++) {\n if (i + 1 < this._points.length && j === this._points[i + 1]) {\n i++;\n }\n this._classmap[j] = i;\n }\n }\n\n getCharClass(c: number): number {\n // binary search\n let a = 0;\n let b = this._points.length;\n while (b - a > 1) {\n const d = (a + b) >>> 1;\n if (this._points[d] > c) {\n b = d;\n } else if (this._points[d] < c) {\n a = d;\n } else {\n return d;\n }\n }\n return a;\n }\n\n step(state: number, c: number): number {\n if (c >= this._classmap.length) {\n return this._transitions[state * this._points.length + this.getCharClass(c)];\n } else {\n return this._transitions[state * this._points.length + this._classmap[c]];\n }\n }\n\n isAccept(state: number): boolean {\n return this._accept[state];\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/run_automaton.ts","import {Automaton, MAX_CODE_POINT} from \"./automaton\";\nimport {Lev1TParametricDescription} from \"./lev1t_parametric_description\";\nimport {Lev2TParametricDescription} from \"./lev2t_parametric_description\";\n\n/**\n * From org/apache/lucene/util/automaton/LevenshteinAutomata.java\n * @hidden\n */\nexport class LevenshteinAutomata {\n private _word: number[];\n private _numRanges: number;\n private _rangeLower: number[];\n private _rangeUpper: number[];\n private _description: Lev1TParametricDescription;\n private _alphabet: number[];\n private _editDistance: number;\n\n constructor(input: number[], editDistance: number) {\n this._word = input;\n this._editDistance = editDistance;\n this._alphabet = [...new Set(this._word)].sort((a, b) => a - b) as any;\n\n this._numRanges = 0;\n this._rangeLower = new Array(this._alphabet.length + 2);\n this._rangeUpper = new Array(this._alphabet.length + 2);\n // calculate the unicode range intervals that exclude the alphabet\n // these are the ranges for all unicode characters not in the alphabet\n let lower = 0;\n for (let i = 0; i < this._alphabet.length; i++) {\n const higher = this._alphabet[i];\n if (higher > lower) {\n this._rangeLower[this._numRanges] = lower;\n this._rangeUpper[this._numRanges] = higher - 1;\n this._numRanges++;\n }\n lower = higher + 1;\n }\n /* add the final endpoint */\n if (lower <= MAX_CODE_POINT) {\n this._rangeLower[this._numRanges] = lower;\n this._rangeUpper[this._numRanges] = MAX_CODE_POINT;\n this._numRanges++;\n }\n\n if (editDistance === 1) {\n this._description = new Lev1TParametricDescription(input.length);\n } else {\n this._description = new Lev2TParametricDescription(input.length);\n }\n }\n\n /**\n * Transforms the NDFA to a DFA.\n * @returns {Automaton}\n */\n public toAutomaton() {\n let automat = new Automaton();\n const range = 2 * this._editDistance + 1;\n\n // the number of states is based on the length of the word and the edit distance\n const numStates = this._description.size();\n\n // Prefix is not needed to be handled by the automaton.\n // stateOffset = 0;\n automat.createState();\n\n // create all states, and mark as accept states if appropriate\n for (let i = 1; i < numStates; i++) {\n let state = automat.createState();\n automat.setAccept(state, this._description.isAccept(i));\n }\n\n for (let k = 0; k < numStates; k++) {\n const xpos = this._description.getPosition(k);\n\n if (xpos < 0) {\n continue;\n }\n\n const end = xpos + Math.min(this._word.length - xpos, range);\n for (let x = 0; x < this._alphabet.length; x++) {\n const ch = this._alphabet[x];\n const cvec = this.getVector(ch, xpos, end);\n const dest = this._description.transition(k, xpos, cvec);\n\n if (dest >= 0) {\n automat.addTransition(k, dest, ch, ch);\n }\n }\n\n const dest = this._description.transition(k, xpos, 0);\n if (dest >= 0) {\n for (let r = 0; r < this._numRanges; r++) {\n automat.addTransition(k, dest, this._rangeLower[r], this._rangeUpper[r]);\n }\n }\n }\n\n // assert automat.deterministic;\n automat.finishState();\n\n return automat;\n }\n\n private getVector(x: number, pos: number, end: number) {\n let vector = 0;\n for (let i = pos; i < end; i++) {\n vector <<= 1;\n if (this._word[i] === x) {\n vector |= 1;\n }\n }\n return vector;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/levenshtein_automata.ts","/**\n * Transition with dest, min and max.\n * @hidden\n */\nexport declare type Transition = [number, number, number];\n\n/**\n * @type {number}\n * @hidden\n */\nexport const MIN_CODE_POINT = 0;\n/**\n * @type {number}\n * @hidden\n */\nexport const MAX_CODE_POINT = 1114111;\n\nfunction sortByDestMinMax(a: Transition, b: Transition) {\n if (a[0] < b[0]) {\n return -1;\n } else if (a[0] > b[0]) {\n return 1;\n }\n if (a[1] < b[1]) {\n return -1;\n } else if (a[1] > b[1]) {\n return 1;\n }\n if (a[2] < b[2]) {\n return -1;\n } else if (a[2] > b[2]) {\n return 1;\n }\n return 0;\n}\n\nfunction sortByMinMaxDest(a: Transition, b: Transition) {\n if (a[1] < b[1]) {\n return -1;\n } else if (a[1] > b[1]) {\n return 1;\n }\n if (a[2] < b[2]) {\n return -1;\n } else if (a[2] > b[2]) {\n return 1;\n }\n if (a[0] < b[0]) {\n return -1;\n } else if (a[0] > b[0]) {\n return 1;\n }\n return 0;\n}\n\n/**\n * From org/apache/lucene/util/automaton/Automaton.java\n * @hidden\n */\nexport class Automaton {\n private _stateTransitions: Transition[] = [];\n private _accept: Set;\n private _nextState: number;\n private _currState: number;\n // public deterministic: boolean;\n private _transitions: object;\n\n constructor() {\n this._stateTransitions = [];\n this._accept = new Set();\n this._nextState = 0;\n this._currState = -1;\n // this.deterministic = true;\n this._transitions = {};\n }\n\n public isAccept(n: number): boolean {\n return this._accept.has(n);\n }\n\n public createState(): number {\n return this._nextState++;\n }\n\n public setAccept(state: number, accept: boolean): void {\n if (accept) {\n this._accept.add(state);\n } else {\n this._accept.delete(state);\n }\n }\n\n public finishState(): void {\n if (this._currState !== -1) {\n this._finishCurrentState();\n this._currState = -1;\n }\n }\n\n private _finishCurrentState(): void {\n // Sort all transitions.\n this._stateTransitions.sort(sortByDestMinMax);\n\n let upto = 0;\n let p: Transition = [-1, -1, -1];\n\n for (let i = 0, len = this._stateTransitions.length; i < len; i++) {\n let t = this._stateTransitions[i];\n if (p[0] === t[0]) {\n if (t[1] <= p[2] + 1) {\n if (t[2] > p[2]) {\n p[2] = t[2];\n }\n } else {\n if (p[0] !== -1) {\n this._stateTransitions[upto][0] = p[0];\n this._stateTransitions[upto][1] = p[1];\n this._stateTransitions[upto][2] = p[2];\n upto++;\n }\n p[1] = t[1];\n p[2] = t[2];\n }\n } else {\n if (p[0] !== -1) {\n this._stateTransitions[upto][0] = p[0];\n this._stateTransitions[upto][1] = p[1];\n this._stateTransitions[upto][2] = p[2];\n upto++;\n }\n p[0] = t[0];\n p[1] = t[1];\n p[2] = t[2];\n }\n }\n\n if (p[0] !== -1) {\n // Last transition\n this._stateTransitions[upto][0] = p[0];\n this._stateTransitions[upto][1] = p[1];\n this._stateTransitions[upto][2] = p[2];\n upto++;\n }\n\n this._transitions[this._currState] = this._stateTransitions.slice(0, upto).sort(sortByMinMaxDest);\n\n // if (this.deterministic && upto > 1) {\n // let lastMax = this.stateTransitions[0][2];\n // for (let i = 1; i < upto; i++) {\n // let min = this.stateTransitions[i][1];\n // if (min <= lastMax) {\n // this.deterministic = false;\n // break;\n // }\n // lastMax = this.stateTransitions[i][2];\n // }\n // }\n\n this._stateTransitions = [];\n }\n\n public getStartPoints(): number[] {\n const pointset = new Set();\n pointset.add(MIN_CODE_POINT);\n\n const states = Object.keys(this._transitions);\n for (let i = 0; i < states.length; i++) {\n let trans = this._transitions[states[i]];\n for (let j = 0; j < trans.length; j++) {\n let tran = trans[j];\n pointset.add(tran[1]);\n if (tran[2] < MAX_CODE_POINT) {\n pointset.add(tran[2] + 1);\n }\n }\n }\n return Array.from(pointset).sort((a, b) => a - b);\n }\n\n public step(state: number, label: number): number {\n let trans = this._transitions[state];\n if (trans) {\n for (let i = 0; i < trans.length; i++) {\n let tran = trans[i];\n if (tran[1] <= label && label <= tran[2]) {\n return tran[0];\n }\n }\n }\n return -1;\n }\n\n public getNumStates(): number {\n return this._nextState;\n }\n\n public addTransition(source: number, dest: number, min: number, max: number): void {\n if (this._currState !== source) {\n if (this._currState !== -1) {\n this._finishCurrentState();\n }\n this._currState = source;\n }\n this._stateTransitions.push([dest, min, max]);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/automaton.ts","import {Long} from \"./long\";\nimport {ParametricDescription} from \"./parametric_description\";\n\n// 1 vectors; 2 states per vector; array length = 2\nconst toStates0 = [new Long(0x2)];\nconst offsetIncrs0 = [new Long(0x0)];\n\n// 2 vectors; 3 states per vector; array length = 6\nconst toStates1 = [new Long(0xa43)];\n\nconst offsetIncrs1 = [new Long(0x38)];\n\n// 4 vectors; 6 states per vector; array length = 24\nconst toStates2 = [new Long(0x82140003, 0x34534914), new Long(0x6d)];\nconst offsetIncrs2 = [new Long(0x55a20000, 0x5555)];\n\n// 8 vectors; 6 states per vector; array length = 48\nconst toStates3 = [new Long(0x900C0003, 0x21520854), new Long(0x4534916d, 0x5b4d19a2), new Long(0xda34)];\nconst offsetIncrs3 = [new Long(0x20fc0000, 0x5555ae0a), new Long(0x55555555)];\n\n// state map\n// 0 -> [(0, 0)]\n// 1 -> [(0, 1)]\n// 2 -> [(0, 1), (1, 1)]\n// 3 -> [(0, 1), (2, 1)]\n// 4 -> [t(0, 1), (0, 1), (1, 1), (2, 1)]\n// 5 -> [(0, 1), (1, 1), (2, 1)]\n\n/**\n * From org/apache/lucene/util/automaton/Lev1TParametricDescription.java\n * @hidden\n */\nexport class Lev1TParametricDescription extends ParametricDescription {\n constructor(w: number) {\n super(w, 1, [0, 1, 0, -1, -1, -1]);\n }\n\n public transition(absState: number, position: number, vector: number): number {\n // null absState should never be passed in\n //assert absState != -1;\n\n // decode absState -> state, offset\n let state = Math.floor(absState / (this._w + 1));\n let offset = absState % (this._w + 1);\n //assert offset >= 0;\n\n if (position === this._w) {\n if (state < 2) {\n const loc = vector * 2 + state;\n offset += this.unpack(offsetIncrs0, loc, 1);\n state = this.unpack(toStates0, loc, 2) - 1;\n }\n } else if (position === this._w - 1) {\n if (state < 3) {\n const loc = vector * 3 + state;\n offset += this.unpack(offsetIncrs1, loc, 1);\n state = this.unpack(toStates1, loc, 2) - 1;\n }\n } else if (position === this._w - 2) {\n if (state < 6) {\n const loc = vector * 6 + state;\n offset += this.unpack(offsetIncrs2, loc, 2);\n state = this.unpack(toStates2, loc, 3) - 1;\n }\n } else {\n if (state < 6) {\n const loc = vector * 6 + state;\n offset += this.unpack(offsetIncrs3, loc, 2);\n state = this.unpack(toStates3, loc, 3) - 1;\n }\n }\n\n if (state === -1) {\n // null state\n return -1;\n } else {\n // translate back to abs\n return state * (this._w + 1) + offset;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/lev1t_parametric_description.ts","import {Long} from \"./long\";\nimport {ParametricDescription} from \"./parametric_description\";\n\n// 1 vectors; 3 states per vector; array length = 3\nconst toStates0 = /*2 bits per value */ [\n new Long(0x23)\n];\nconst offsetIncrs0 = /*1 bits per value */ [\n new Long(0x0)\n];\n\n// 2 vectors; 5 states per vector; array length = 10\nconst toStates1 = /*3 bits per value */ [\n new Long(0x13688b44)\n];\nconst offsetIncrs1 = /*1 bits per value */ [\n new Long(0x3e0)\n];\n\n// 4 vectors; 13 states per vector; array length = 52\nconst toStates2 = /*4 bits per value */ [\n new Long(0x5200b504, 0x60dbb0b0), new Long(0x27062227, 0x52332176), new Long(0x14323235, 0x23555432), new Long(0x4354)\n];\nconst offsetIncrs2 = /*2 bits per value */ [\n new Long(0x00002000, 0x555080a8), new Long(0x55555555, 0x55)\n];\n\n// 8 vectors; 28 states per vector; array length = 224\nconst toStates3 = /*5 bits per value */ [\n new Long(0x40059404, 0xe701c029), new Long(0x00a50000, 0xa0101620), new Long(0xa1416288, 0xb02c8c40), new Long(0x310858c0, 0xa821032),\n new Long(0x0d28b201, 0x31442398), new Long(0x847788e0, 0x5281e528), new Long(0x08c2280e, 0xa23980d3), new Long(0xa962278c, 0x1e3294b1),\n new Long(0x2288e528, 0x8c41309e), new Long(0x021aca21, 0x11444409), new Long(0x86b1086b, 0x11a46248), new Long(0x1d6240c4, 0x2a625894),\n new Long(0x489074ad, 0x5024a50b), new Long(0x520c411a, 0x14821aca), new Long(0x0b594a44, 0x5888b589), new Long(0xc411a465, 0x941d6520),\n new Long(0xad6a62d4, 0x8b589075), new Long(0x1a5055a4)\n];\nconst offsetIncrs3 = /*2 bits per value */ [\n new Long(0x00002000, 0x30c302), new Long(0xc3fc333c, 0x2a0030f3), new Long(0x8282a820, 0x233a0032), new Long(0x32b283a8, 0x55555555),\n new Long(0x55555555, 0x55555555), new Long(0x55555555, 0x55555555), new Long(0x55555555, 0x55555555)\n];\n\n// 16 vectors; 45 states per vector; array length = 720\nconst toStates4 = /*6 bits per value */ [\n new Long(0x002c5004, 0x3801450), new Long(0x00000e38, 0xc500014b), new Long(0x51401402, 0x514), new Long(0x0),\n new Long(0x14010000, 0x518000b), new Long(0x28e20230, 0x9f1c208), new Long(0x830a70c2, 0x219f0df0), new Long(0x08208200, 0x82000082),\n new Long(0x60800800, 0x8050501), new Long(0x02602643, 0x30820986), new Long(0x50508064, 0x45640142), new Long(0x20000831, 0x8500514),\n new Long(0x85002082, 0x41405820), new Long(0x0990c201, 0x45618098), new Long(0x50a01051, 0x8316d0c), new Long(0x050df0e0, 0x21451420),\n new Long(0x14508214, 0xd142140), new Long(0x50821c60, 0x3c21c018), new Long(0xcb142087, 0x1cb1403), new Long(0x1851822c, 0x80082145),\n new Long(0x20800020, 0x200208), new Long(0x87180345, 0xd0061820), new Long(0x24976b09, 0xcb0a81cb), new Long(0x624709d1, 0x8b1a60e),\n new Long(0x82249089, 0x2490820), new Long(0x00d2c024, 0xc31421c6), new Long(0x15454423, 0x3c314515), new Long(0xc21cb140, 0x31853c22),\n new Long(0x2c208214, 0x4514500b), new Long(0x508b0051, 0x8718034), new Long(0x5108f0c5, 0xb2cb4551), new Long(0x1cb0a810, 0xe824715d),\n new Long(0x908b0e60, 0x1422cb14), new Long(0xc02cb145, 0x30812c22), new Long(0x0cb1420c, 0x84202202), new Long(0x20ce0850, 0x5c20ce08),\n new Long(0x8b0d70c2, 0x20820820), new Long(0x14214208, 0x42085082), new Long(0x50830c20, 0x9208340), new Long(0x13653592, 0xc6134dc6),\n new Long(0x6dc4db4d, 0xd309341c), new Long(0x54d34d34, 0x6424d908), new Long(0x030814c2, 0x92072c22), new Long(0x24a30930, 0x4220724b),\n new Long(0x25c920e2, 0x2470d720), new Long(0x975c9082, 0x92c92d70), new Long(0x04924e08, 0xcb0880c2), new Long(0xc24c2481, 0x45739728),\n new Long(0xda6174da, 0xc6da4db5), new Long(0x5d30971d, 0x4b5d35d7), new Long(0x93825ce2, 0x1030815c), new Long(0x020cb145, 0x51442051),\n new Long(0x2c220e2c, 0xc538210e), new Long(0x52cb0d70, 0x8514214), new Long(0x85145142, 0x204b0850), new Long(0x4051440c, 0x92156083),\n new Long(0xa60e6595, 0x4d660e4d), new Long(0x1c6dc658, 0x94d914e4), new Long(0x1454d365, 0x82642659), new Long(0x51030813, 0x2892072c),\n new Long(0xcb2ca30b, 0xe2c22072), new Long(0x20538910, 0x452c70d7), new Long(0x708e3891, 0x8b2cb2d), new Long(0xc204b24e, 0x81cb1440),\n new Long(0x28c2ca24, 0xda44e38e), new Long(0x85d660e4, 0x1dc6da65), new Long(0x8e5d914e, 0xe2cb5d33), new Long(0x38938238)\n];\nconst offsetIncrs4 = /*3 bits per value */ [\n new Long(0x00080000, 0x30020000), new Long(0x20c060), new Long(0x04000000, 0x81490000), new Long(0x10824824, 0x40249241),\n new Long(0x60002082, 0xdb6030c3), new Long(0x301b0d80, 0x6c36c06c), new Long(0x000db0db, 0xb01861b0), new Long(0x9188e06d, 0x1b703620),\n new Long(0x06d86db7, 0x8009200), new Long(0x02402490, 0x4920c24), new Long(0x08249009, 0x490002), new Long(0x28124804, 0x49081281),\n new Long(0x124a44a2, 0x34800104), new Long(0x0d24020c, 0xc3093090), new Long(0x24c24d24, 0x40009a09), new Long(0x9201061a, 0x4984a06),\n new Long(0x71269262, 0x494d0492), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249),\n new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924),\n new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492),\n new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249),\n new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x2492)\n];\n\n// 32 vectors; 45 states per vector; array length = 1440\nconst toStates5 = /*6 bits per value */ [\n new Long(0x002c5004, 0x3801450), new Long(0x00000e38, 0xc500014b), new Long(0x51401402, 0x514), new Long(0x0),\n new Long(0x14010000, 0x514000b), new Long(0x038e00e0, 0x550000), new Long(0x0600b180, 0x26451850), new Long(0x08208208, 0x82082082),\n new Long(0x40820820, 0x2c500), new Long(0x808c0146, 0x70820a38), new Long(0x9c30827c, 0xc37c20c2), new Long(0x20800867, 0x208208),\n new Long(0x02002080, 0xb1401020), new Long(0x00518000, 0x828e2023), new Long(0x209f1c20, 0x830a70c), new Long(0x853df0df, 0x51451450),\n new Long(0x14508214, 0x16142142), new Long(0x30805050, 0x60260264), new Long(0x43082098, 0x25050806), new Long(0x14564014, 0x42000083),\n new Long(0x20850051, 0x8500208), new Long(0x14140582, 0x80990c20), new Long(0x08261809, 0x82019202), new Long(0x90060941, 0x8920519),\n new Long(0xc22cb242, 0x22492492), new Long(0x0162492c, 0x43080505), new Long(0x86026026, 0x80414515), new Long(0xc5b43142, 0x37c38020),\n new Long(0x14508014, 0x42085085), new Long(0x50850051, 0x1414058), new Long(0x980990c2, 0x51456180), new Long(0x0c50a010, 0xe008316d),\n new Long(0x508b21f0, 0x2c52cb2c), new Long(0xc22cb249, 0x600d2c92), new Long(0x1850821c, 0x873c21c0), new Long(0x03cb1420, 0x2c01cb14),\n new Long(0x45185182, 0x20800821), new Long(0x08208000, 0x45002002), new Long(0x20871803, 0x8700614), new Long(0x050821cf, 0x740500f5),\n new Long(0x18609000, 0x934d9646), new Long(0x30824d30, 0x4c24d34d), new Long(0xc600d642, 0x1860821), new Long(0x25dac274, 0xc2a072c9),\n new Long(0x91c27472, 0x2c698398), new Long(0x89242242, 0x92420820), new Long(0x34b00900, 0x82087180), new Long(0xb09d0061, 0x1cb24976),\n new Long(0x9d1cb0a8, 0x60e62470), new Long(0x1574ce3e, 0xd31455d7), new Long(0x25c25d74, 0x1c600d38), new Long(0x423c3142, 0x51515454),\n new Long(0x1403c314, 0xc22c21cb), new Long(0x21431853, 0xb2c208), new Long(0x05145145, 0x34508b0), new Long(0x0c508718, 0x5515108f),\n new Long(0xf2051454, 0x8740500), new Long(0x0618f090, 0xe2534d92), new Long(0x6592c238, 0x49382659), new Long(0x21c600d6, 0x4423c314),\n new Long(0xcb2d1545, 0x72c2a042), new Long(0xa091c574, 0x422c3983), new Long(0x508b2c52, 0xb2c514), new Long(0x8034b08b, 0xf0c50871),\n new Long(0x45515108, 0xa810b2cb), new Long(0x715d1cb0, 0x2260e824), new Long(0x8e2d74ce, 0xe6592c53), new Long(0x38938238, 0x420c3081),\n new Long(0x22020cb1, 0x8508420), new Long(0xce0820ce, 0x70c25c20), new Long(0x08208b0d, 0x42082082), new Long(0x50821421, 0xc204208),\n new Long(0x832c5083, 0x21080880), new Long(0x0838c214, 0xa5083882), new Long(0xa9c39430, 0xaaaaaaaa), new Long(0x9fa9faaa, 0x1aaa7eaa),\n new Long(0x1420c308, 0x824820d0), new Long(0x84d94d64, 0x7184d371), new Long(0x1b7136d3, 0x34c24d07), new Long(0x1534d34d, 0x99093642),\n new Long(0x30c20530, 0x8340508), new Long(0x53592092, 0x34dc6136), new Long(0x4db4dc61, 0xa479c6dc), new Long(0x4924924a, 0x920a9f92),\n new Long(0x8192a82a, 0x72c22030), new Long(0x30930920, 0x724b24a), new Long(0x920e2422, 0xd72025c), new Long(0xc9082247, 0x92d70975),\n new Long(0x24e0892c, 0x880c2049), new Long(0xc2481cb0, 0x2c928c24), new Long(0x89088749, 0x80a52488), new Long(0xaac74394, 0x6a861b2a),\n new Long(0xab27b278, 0x81b2ca6), new Long(0x072c2203, 0xa3093092), new Long(0x6915ce5c, 0xd76985d3), new Long(0x771b6936, 0x5d74c25c),\n new Long(0x892d74d7, 0x724e0973), new Long(0x0880c205, 0x4c2481cb), new Long(0x739728c2, 0x6174da45), new Long(0xda4db5da, 0x4aa175c6),\n new Long(0x86486186, 0x6a869b27), new Long(0x308186ca, 0xcb14510), new Long(0x44205102, 0x220e2c51), new Long(0x38210e2c, 0xcb0d70c5),\n new Long(0x51421452, 0x14514208), new Long(0x4b085085, 0x51440c20), new Long(0x1440832c, 0xcb145108), new Long(0x488b0888, 0x94316208),\n new Long(0x9f7e79c3, 0xfaaa7dfa), new Long(0x7ea7df7d, 0x30819ea), new Long(0x20d01451, 0x65648558), new Long(0x93698399, 0x96135983),\n new Long(0x39071b71, 0xd9653645), new Long(0x96451534, 0x4e09909), new Long(0x051440c2, 0x21560834), new Long(0x60e65959, 0xd660e4da),\n new Long(0xc6dc6584, 0x9207e979), new Long(0xdf924820, 0xa82a8207), new Long(0x103081a6, 0x892072c5), new Long(0xb2ca30b2, 0x2c22072c),\n new Long(0x0538910e, 0x52c70d72), new Long(0x08e38914, 0x8b2cb2d7), new Long(0x204b24e0, 0x1cb1440c), new Long(0x8c2ca248, 0x874b2cb2),\n new Long(0x24488b08, 0x43948162), new Long(0x9b1f7e77, 0x9e786aa6), new Long(0xeca6a9e7, 0x51030819), new Long(0x2892072c, 0x8e38a30b),\n new Long(0x83936913, 0x69961759), new Long(0x4538771b, 0x74ce3976), new Long(0x08e38b2d, 0xc204e24e), new Long(0x81cb1440, 0x28c2ca24),\n new Long(0xda44e38e, 0x85d660e4), new Long(0x75c6da65, 0x698607e9), new Long(0x99e7864a, 0xa6ca6aa6)\n];\nconst offsetIncrs5 = /*3 bits per value */ [\n new Long(0x00080000, 0x30020000), new Long(0x20c060), new Long(0x04000000, 0x1000000), new Long(0x50603018, 0xdb6db6db),\n new Long(0x00002db6, 0xa4800002), new Long(0x41241240, 0x12492088), new Long(0x00104120, 0x40000100), new Long(0x92092052, 0x2492c420),\n new Long(0x096592d9, 0xc30d800), new Long(0xc36036d8, 0xb01b0c06), new Long(0x6c36db0d, 0x186c0003), new Long(0xb01b6c06, 0xad860361),\n new Long(0x5b6dd6dd, 0x360001b7), new Long(0x0db6030c, 0xc412311c), new Long(0xb6e36e06, 0xdb0d), new Long(0xdb01861b, 0x9188e06),\n new Long(0x71b72b62, 0x6dd6db), new Long(0x00800920, 0x40240249), new Long(0x904920c2, 0x20824900), new Long(0x40049000, 0x12012480),\n new Long(0xa4906120, 0x5524ad4a), new Long(0x02480015, 0x40924020), new Long(0x48409409, 0x92522512), new Long(0x24000820, 0x49201001),\n new Long(0x204a04a0, 0x29128924), new Long(0x00055549, 0x900830d2), new Long(0x24c24034, 0x934930c), new Long(0x02682493, 0x4186900),\n new Long(0x61201a48, 0x9a498612), new Long(0x355249d4, 0xc348001), new Long(0x940d2402, 0x24c40930), new Long(0x0924e24d, 0x1a40009a),\n new Long(0x06920106, 0x6204984a), new Long(0x92712692, 0x92494d54), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924),\n new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492),\n new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249),\n new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924),\n new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492),\n new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249),\n new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924),\n new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492),\n new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924)\n];\n\n// state map\n// 0 -> [(0, 0)]\n// 1 -> [(0, 2)]\n// 2 -> [(0, 1)]\n// 3 -> [(0, 1), (1, 1)]\n// 4 -> [(0, 2), (1, 2)]\n// 5 -> [t(0, 2), (0, 2), (1, 2), (2, 2)]\n// 6 -> [(0, 2), (2, 1)]\n// 7 -> [(0, 1), (2, 2)]\n// 8 -> [(0, 2), (2, 2)]\n// 9 -> [(0, 1), (1, 1), (2, 1)]\n// 10 -> [(0, 2), (1, 2), (2, 2)]\n// 11 -> [(0, 1), (2, 1)]\n// 12 -> [t(0, 1), (0, 1), (1, 1), (2, 1)]\n// 13 -> [(0, 2), (1, 2), (2, 2), (3, 2)]\n// 14 -> [t(0, 2), (0, 2), (1, 2), (2, 2), (3, 2)]\n// 15 -> [(0, 2), t(1, 2), (1, 2), (2, 2), (3, 2)]\n// 16 -> [(0, 2), (2, 1), (3, 1)]\n// 17 -> [(0, 1), t(1, 2), (2, 2), (3, 2)]\n// 18 -> [(0, 2), (3, 2)]\n// 19 -> [(0, 2), (1, 2), t(1, 2), (2, 2), (3, 2)]\n// 20 -> [t(0, 2), (0, 2), (1, 2), (3, 1)]\n// 21 -> [(0, 1), (1, 1), (3, 2)]\n// 22 -> [(0, 2), (2, 2), (3, 2)]\n// 23 -> [(0, 2), (1, 2), (3, 1)]\n// 24 -> [(0, 2), (1, 2), (3, 2)]\n// 25 -> [(0, 1), (2, 2), (3, 2)]\n// 26 -> [(0, 2), (3, 1)]\n// 27 -> [(0, 1), (3, 2)]\n// 28 -> [(0, 2), (2, 1), (4, 2)]\n// 29 -> [(0, 2), t(1, 2), (1, 2), (2, 2), (3, 2), (4, 2)]\n// 30 -> [(0, 2), (1, 2), (4, 2)]\n// 31 -> [(0, 2), (1, 2), (3, 2), (4, 2)]\n// 32 -> [(0, 2), (2, 2), (3, 2), (4, 2)]\n// 33 -> [(0, 2), (1, 2), t(2, 2), (2, 2), (3, 2), (4, 2)]\n// 34 -> [(0, 2), (1, 2), (2, 2), t(2, 2), (3, 2), (4, 2)]\n// 35 -> [(0, 2), (3, 2), (4, 2)]\n// 36 -> [(0, 2), t(2, 2), (2, 2), (3, 2), (4, 2)]\n// 37 -> [t(0, 2), (0, 2), (1, 2), (2, 2), (4, 2)]\n// 38 -> [(0, 2), (1, 2), (2, 2), (4, 2)]\n// 39 -> [t(0, 2), (0, 2), (1, 2), (2, 2), (3, 2), (4, 2)]\n// 40 -> [(0, 2), (1, 2), (2, 2), (3, 2), (4, 2)]\n// 41 -> [(0, 2), (4, 2)]\n// 42 -> [t(0, 2), (0, 2), (1, 2), (2, 2), t(2, 2), (3, 2), (4, 2)]\n// 43 -> [(0, 2), (2, 2), (4, 2)]\n// 44 -> [(0, 2), (1, 2), t(1, 2), (2, 2), (3, 2), (4, 2)]\n\n/**\n * From org/apache/lucene/util/automaton/Lev2TParametricDescription.java\n * @hidden\n */\nexport class Lev2TParametricDescription extends ParametricDescription {\n constructor(w: number) {\n super(w, 2, [0, 2, 1, 0, 1, 0, -1, 0, 0, -1, 0, -1, -1, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2]);\n }\n\n public transition(absState: number, position: number, vector: number): number {\n // null absState should never be passed in\n // assert absState != -1;\n\n // decode absState -> state, offset\n let state = Math.floor(absState / (this._w + 1));\n let offset = absState % (this._w + 1);\n // assert offset >= 0;\n\n if (position === this._w) {\n if (state < 3) {\n const loc = vector * 3 + state;\n offset += this.unpack(offsetIncrs0, loc, 1);\n state = this.unpack(toStates0, loc, 2) - 1;\n }\n } else if (position === this._w - 1) {\n if (state < 5) {\n const loc = vector * 5 + state;\n offset += this.unpack(offsetIncrs1, loc, 1);\n state = this.unpack(toStates1, loc, 3) - 1;\n }\n } else if (position === this._w - 2) {\n if (state < 13) {\n const loc = vector * 13 + state;\n offset += this.unpack(offsetIncrs2, loc, 2);\n state = this.unpack(toStates2, loc, 4) - 1;\n }\n } else if (position === this._w - 3) {\n if (state < 28) {\n const loc = vector * 28 + state;\n offset += this.unpack(offsetIncrs3, loc, 2);\n state = this.unpack(toStates3, loc, 5) - 1;\n }\n } else if (position === this._w - 4) {\n if (state < 45) {\n const loc = vector * 45 + state;\n offset += this.unpack(offsetIncrs4, loc, 3);\n state = this.unpack(toStates4, loc, 6) - 1;\n }\n } else {\n if (state < 45) {\n const loc = vector * 45 + state;\n offset += this.unpack(offsetIncrs5, loc, 3);\n state = this.unpack(toStates5, loc, 6) - 1;\n }\n }\n\n if (state === -1) {\n // null state\n return -1;\n } else {\n // translate back to abs\n return state * (this._w + 1) + offset;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/lev2t_parametric_description.ts","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 15\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 6890e7455160ade4fbc5","webpack:///./packages/full-text-search/src/fuzzy/long.ts","webpack:///./packages/full-text-search/src/inverted_index.ts","webpack:///./packages/full-text-search/src/tokenizer.ts","webpack:///./packages/full-text-search/src/query_builder.ts","webpack:///./packages/full-text-search/src/fuzzy/parametric_description.ts","webpack:///./packages/full-text-search/src/index.ts","webpack:///./packages/full-text-search/src/full_text_search.ts","webpack:///./packages/full-text-search/src/index_searcher.ts","webpack:///./packages/full-text-search/src/scorer.ts","webpack:///./packages/full-text-search/src/fuzzy/run_automaton.ts","webpack:///./packages/full-text-search/src/fuzzy/levenshtein_automata.ts","webpack:///./packages/full-text-search/src/fuzzy/automaton.ts","webpack:///./packages/full-text-search/src/fuzzy/lev1t_parametric_description.ts","webpack:///./packages/full-text-search/src/fuzzy/lev2t_parametric_description.ts","webpack:///./packages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tC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,EACb,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACI,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAAA;AAAA;;;;;;;;ACtBhC;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"lokijs.full-text-search.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/full-text-search\"] = factory();\n\telse\n\t\troot[\"@lokijs/full-text-search\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 6890e7455160ade4fbc5","/**\n * Class supports 64Bit integer operations.\n * A cut-down version of dcodeIO/long.js.\n * @hidden\n */\nexport class Long {\n private _low: number;\n private _high: number;\n\n constructor(low: number = 0, high: number = 0) {\n this._low = low;\n this._high = high;\n }\n\n /**\n * Returns this long with bits arithmetically shifted to the right by the given amount.\n * @param {number} numBits - number of bits\n * @returns {Long} the long\n */\n shiftRight(numBits: number): Long {\n if ((numBits &= 63) === 0)\n return this;\n else if (numBits < 32)\n return new Long((this._low >>> numBits) | (this._high << (32 - numBits)), this._high >> numBits);\n else\n return new Long((this._high >> (numBits - 32)), this._high >= 0 ? 0 : -1);\n }\n\n /**\n * Returns this long with bits arithmetically shifted to the left by the given amount.\n * @param {number} numBits - number of bits\n * @returns {Long} the long\n */\n shiftLeft(numBits: number): Long {\n if ((numBits &= 63) === 0)\n return this;\n else if (numBits < 32)\n return new Long(this._low << numBits, (this._high << numBits) | (this._low >>> (32 - numBits)));\n else\n return new Long(0, this._low << (numBits - 32));\n }\n\n /**\n * Returns the bitwise AND of this Long and the specified.\n * @param {Long} other - the other Long\n * @returns {Long} the long\n */\n and(other: Long): Long {\n return new Long(this._low & other._low, this._high & other._high);\n }\n\n /**\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\n * @returns {number}\n */\n toInt(): number {\n return this._low;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/long.ts","import {Tokenizer} from \"./tokenizer\";\nimport Index = InvertedIndex.Index;\n\n/**\n * Converts a string into an array of code points.\n * @param str - the string\n * @returns {number[]} to code points\n * @hidden\n */\nexport function toCodePoints(str: string): number[] {\n const r = [];\n for (let i = 0; i < str.length;) {\n const chr = str.charCodeAt(i++);\n if (chr >= 0xD800 && chr <= 0xDBFF) {\n // surrogate pair\n const low = str.charCodeAt(i++);\n r.push(0x10000 + ((chr - 0xD800) << 10) | (low - 0xDC00));\n } else {\n // ordinary character\n r.push(chr);\n }\n }\n return r;\n}\n\n/**\n * Inverted index class handles featured text search for specific document fields.\n * @hidden\n */\nexport class InvertedIndex {\n private _store: boolean;\n private _optimizeChanges: boolean;\n private _tokenizer: Tokenizer;\n private _docCount: number = 0;\n private _docStore: Map = new Map();\n private _totalFieldLength: number = 0;\n private _root: Index = new Map();\n\n /**\n * @param {boolean} [options.store=true] - inverted index will be stored at serialization rather than rebuilt on load.\n * @param {boolean} optimizeChanges\n * @param {Tokenizer} tokenizer\n */\n constructor(options: InvertedIndex.FieldOptions = {}) {\n (\n {\n store: this._store = true,\n optimizeChanges: this._optimizeChanges = true,\n tokenizer: this._tokenizer = new Tokenizer()\n } = options\n );\n }\n\n get store() {\n return this._store;\n }\n\n set store(val: boolean) {\n this._store = val;\n }\n\n get tokenizer() {\n return this._tokenizer;\n }\n\n get documentCount() {\n return this._docCount;\n }\n\n get documentStore() {\n return this._docStore;\n }\n\n get totalFieldLength() {\n return this._totalFieldLength;\n }\n\n get root() {\n return this._root;\n }\n\n /**\n * Adds defined fields of a document to the inverted index.\n * @param {string} field - the field to add\n * @param {number} docId - the doc id of the field\n */\n insert(field: string, docId: number) {\n if (this._docStore.has(docId)) {\n throw Error(\"Field already added.\");\n }\n\n // Tokenize document field.\n const fieldTokens = this._tokenizer.tokenize(field);\n this._totalFieldLength += fieldTokens.length;\n this._docCount += 1;\n this._docStore.set(docId, {fieldLength: fieldTokens.length});\n\n // Holds references to each index of a document.\n const indexRef: Index[] = [];\n if (this._optimizeChanges) {\n Object.defineProperties(this._docStore.get(docId), {\n indexRef: {enumerable: false, configurable: true, writable: true, value: indexRef}\n });\n }\n\n // Iterate over all unique field terms.\n for (const token of new Set(fieldTokens)) {\n if (token === \"\") {\n continue;\n }\n // Calculate term frequency.\n let tf = 0;\n for (let j = 0; j < fieldTokens.length; j++) {\n if (fieldTokens[j] === token) {\n ++tf;\n }\n }\n\n // Add term to index tree.\n let branch = this._root;\n\n for (const c of toCodePoints(token)) {\n let child = branch.get(c);\n if (child === undefined) {\n child = new Map();\n if (this._optimizeChanges) {\n child.pa = branch;\n }\n branch.set(c, child);\n }\n branch = child;\n }\n // Add term info to index leaf.\n if (branch.dc === undefined) {\n branch.dc = new Map();\n branch.df = 0;\n }\n branch.dc.set(docId, tf);\n branch.df += 1;\n\n // Store index leaf for deletion.\n indexRef.push(branch);\n }\n }\n\n /**\n * Removes all relevant terms of a document from the inverted index.\n * @param {number} docId - the document.\n */\n remove(docId: number) {\n if (!this._docStore.has(docId)) {\n return;\n }\n const docStore = this._docStore.get(docId);\n // Remove document.\n this._docStore.delete(docId);\n this._docCount -= 1;\n\n // Reduce total field length.\n this._totalFieldLength -= docStore.fieldLength;\n\n if (this._optimizeChanges) {\n // Iterate over all term references.\n // Remove docId from docs and decrement document frequency.\n const indexRef = docStore.indexRef;\n for (let j = 0; j < indexRef.length; j++) {\n let index = indexRef[j];\n index.df -= 1;\n index.dc.delete(docId);\n\n // Check if no document is left for current tree.\n if (index.df === 0) {\n // Delete unused meta data of branch.\n delete index.df;\n delete index.dc;\n\n // Check for sub branches.\n if (index.size !== 0) {\n continue;\n }\n\n // Delete term branch if not used anymore.\n do {\n // Go tree upwards.\n const parent = index.pa;\n // Delete parent reference for preventing memory leak (cycle reference).\n delete index.pa;\n\n // Iterate over all children.\n for (const key of parent.keys()) {\n // Remove previous child form parent.\n if (parent.get(key) === index) {\n parent.delete(key);\n break;\n }\n }\n index = parent;\n } while (index.pa !== undefined && index.size === 0 && index.df === undefined);\n }\n }\n } else {\n this._remove(this._root, docId);\n }\n }\n\n /**\n * Gets the term index of a term.\n * @param {string} term - the term\n * @param {object} root - the term index to start from\n * @param {number} start - the position of the term string to start from\n * @return {object} - The term index or null if the term is not in the term tree.\n */\n static getTermIndex(term: number[], root: Index, start: number = 0) {\n if (start >= term.length) {\n return null;\n }\n for (let i = start; i < term.length; i++) {\n let child = root.get(term[i]);\n if (child === undefined) {\n return null;\n }\n root = child;\n }\n return root;\n }\n\n /**\n * Extends a term index to all available term leafs.\n * @param {object} idx - the term index to start from\n * @param {number[]} [term=[]] - the current term\n * @param {Array} termIndices - all extended indices with their term\n * @returns {Array} - Array with term indices and extension\n */\n static extendTermIndex(idx: Index, term: number[] = [], termIndices: InvertedIndex.IndexTerm[] = []): InvertedIndex.IndexTerm[] {\n if (idx.df !== undefined) {\n termIndices.push({index: idx, term: term.slice()});\n }\n\n term.push(0);\n for (const child of idx) {\n term[term.length - 1] = child[0];\n InvertedIndex.extendTermIndex(child[1], term, termIndices);\n }\n term.pop();\n return termIndices;\n }\n\n /**\n * Serialize the inverted index.\n * @returns {{docStore: *, _fields: *, index: *}}\n */\n public toJSON() {\n if (this._store) {\n return {\n _store: true,\n _optimizeChanges: this._optimizeChanges,\n _tokenizer: this._tokenizer,\n _docCount: this._docCount,\n _docStore: [...this._docStore],\n _totalFieldLength: this._totalFieldLength,\n _root: InvertedIndex.serializeIndex(this._root)\n };\n }\n return {\n _store: false,\n _optimizeChanges: this._optimizeChanges,\n _tokenizer: this._tokenizer\n };\n }\n\n /**\n * Deserialize the inverted index.\n * @param {{docStore: *, _fields: *, index: *}} serialized - The serialized inverted index.\n * @param {Object.|Tokenizer} funcTok[undefined] - the depending functions with labels\n * or an equivalent tokenizer\n */\n public static fromJSONObject(serialized: InvertedIndex.Serialization, funcTok?: Tokenizer.FunctionSerialization) {\n const invIdx = new InvertedIndex({\n store: serialized._store,\n optimizeChanges: serialized._optimizeChanges,\n tokenizer: Tokenizer.fromJSONObject(serialized._tokenizer, funcTok)\n });\n if (invIdx._store) {\n invIdx._docCount = serialized._docCount;\n invIdx._docStore = new Map(serialized._docStore);\n invIdx._totalFieldLength = serialized._totalFieldLength;\n invIdx._root = InvertedIndex.deserializeIndex(serialized._root);\n }\n\n if (invIdx._optimizeChanges) {\n invIdx._regenerate(invIdx._root, null);\n }\n\n return invIdx;\n }\n\n private static serializeIndex(idx: Index): InvertedIndex.SerializedIndex {\n const serialized: InvertedIndex.SerializedIndex = {};\n if (idx.dc !== undefined) {\n serialized.d = {df: idx.df, dc: [...idx.dc]};\n }\n\n if (idx.size === 0) {\n return serialized;\n }\n\n const keys = [];\n const values = [];\n for (const child of idx) {\n keys.push(child[0]);\n values.push(InvertedIndex.serializeIndex(child[1]));\n }\n serialized.k = keys;\n serialized.v = values;\n\n return serialized;\n }\n\n private static deserializeIndex(serialized: InvertedIndex.SerializedIndex): Index {\n const idx: Index = new Map();\n\n if (serialized.k !== undefined) {\n for (let i = 0; i < serialized.k.length; i++) {\n idx.set(serialized.k[i], InvertedIndex.deserializeIndex(serialized.v[i]));\n }\n }\n if (serialized.d !== undefined) {\n idx.df = serialized.d.df;\n idx.dc = new Map(serialized.d.dc);\n }\n return idx;\n }\n\n /**\n * Set parent of to each index and regenerate the indexRef.\n * @param {Index} index - the index\n * @param {Index} parent - the parent\n */\n private _regenerate(index: Index, parent: Index) {\n // Set parent.\n if (parent !== null) {\n index.pa = parent;\n }\n\n // Iterate over subtree.\n for (const child of index.values()) {\n this._regenerate(child, index);\n }\n\n if (index.dc !== undefined) {\n // Get documents of term.\n for (const docId of index.dc.keys()) {\n // Get document store at specific document/field.\n const ref = this._docStore.get(docId);\n if (ref.indexRef === undefined) {\n Object.defineProperties(ref, {\n indexRef: {enumerable: false, configurable: true, writable: true, value: []}\n });\n }\n // Set reference to term index.\n ref.indexRef.push(index);\n }\n }\n }\n\n /**\n * Iterate over the whole inverted index and remove the document.\n * Delete branch if not needed anymore.\n * Function is needed if index is used without optimization.\n * @param {Index} idx - the index\n * @param {number} docId - the doc id\n * @returns {boolean} true if index is empty\n */\n private _remove(idx: Index, docId: number) {\n for (const child of idx) {\n // Checkout branch.\n if (this._remove(child[1], docId)) {\n idx.delete(child[0]);\n }\n }\n // Remove docId from docs and decrement document frequency.\n if (idx.df !== undefined) {\n if (idx.dc.has(docId)) {\n idx.df -= 1;\n idx.dc.delete(docId);\n\n // Delete unused meta data of branch.\n if (idx.df === 0) {\n delete idx.df;\n delete idx.dc;\n }\n }\n }\n return idx.size === 0 && idx.dc === undefined;\n }\n}\n\nexport namespace InvertedIndex {\n export interface FieldOptions {\n store?: boolean;\n optimizeChanges?: boolean;\n tokenizer?: Tokenizer;\n }\n\n export type Index = Map & { dc?: Map, df?: number, pa?: Index };\n\n export type IndexTerm = { index: Index, term: number[] };\n\n export interface SerializedIndex {\n d?: {\n df: number;\n dc: [number, number][]\n };\n k?: number[];\n v?: SerializedIndex[];\n }\n\n export interface Serialization {\n _store: boolean;\n _optimizeChanges: boolean;\n _tokenizer: Tokenizer.Serialization;\n _docCount?: number;\n _docStore?: Map;\n _totalFieldLength?: number;\n _root?: SerializedIndex;\n }\n\n export interface DocStore {\n fieldLength?: number;\n indexRef?: Index[];\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/inverted_index.ts","/**\n * Splits a string at non-alphanumeric characters into lower case tokens.\n * @param {string} str - the string\n * @returns {string[]} - the tokens\n * @private\n */\nimport {Dict} from \"../../common/types\";\n\nfunction defaultSplitter(str: string) {\n let tokens = str.split(/[^\\w]+/);\n for (let i = 0; i < tokens.length; i++) {\n tokens[i] = tokens[i].toLowerCase();\n }\n return tokens;\n}\n\n/**\n * The tokenizer is used to prepare the string content of a document field for the inverted index.\n * Firstly the string gets split into tokens.\n * After that the tokens will be trimmed/stemmed with defined functions from the queue.\n *\n * * To change the splitter function, use {@link Tokenizer#setSplitter}.\n * * To add functions to the queue, use {@link Tokenizer#add}, {@link Tokenizer#addBefore} and\n * {@link Tokenizer#addAfter}.\n * * To remove a function from the queue, use {@link Tokenizer#remove}.\n * * To reset the tokenizer, use {@link Tokenizer#reset}.\n */\nexport class Tokenizer {\n private _splitter: Tokenizer.SplitterFunction;\n private _queue: Tokenizer.TokinizeFunction[] = [];\n private _symbol: any = Symbol(\"label\");\n\n /**\n * Initializes the tokenizer with a splitter, which splits a string at non-alphanumeric characters.\n * The queue is empty.\n */\n constructor() {\n this.reset();\n }\n\n /**\n * Sets a function with defined label as the splitter function.\n * The function must take a string as argument and return an array of tokens.\n *\n * @param {string} label - the label\n * @param {function} func - the function\n */\n setSplitter(label: string, func: Tokenizer.SplitterFunction) {\n if (label === \"\") {\n throw Error(\"Label cannot be empty.\");\n }\n func[this._symbol] = label;\n this._splitter = func;\n }\n\n /**\n * Gets the splitter.\n * @return {Array.} - tuple with label and function\n */\n getSplitter() {\n return [this._splitter[this._symbol], this._splitter];\n }\n\n /**\n * Resets the splitter to default.\n */\n resetSplitter() {\n this._splitter = defaultSplitter;\n }\n\n /**\n * Checks if a function is inside the queue.\n * @param {string|function} labelFunc - an existing label or function\n * @returns {boolean} true if exists, otherwise false\n */\n has(labelFunc: string | Tokenizer.TokinizeFunction) {\n return this._getPosition(labelFunc) !== -1;\n }\n\n /**\n * Gets a function from the queue.\n * Only the first found function gets returned if a label or a function is multiple used.\n *\n * @param {string|function} labelFunc - an existing label or function\n * @return {Array.} - tuple with label and function\n */\n get(labelFunc: string | Tokenizer.TokinizeFunction) {\n let pos = this._getPosition(labelFunc);\n if (pos === -1) {\n throw Error(\"Cannot find existing function.\");\n }\n return [this._queue[pos][this._symbol], this._queue[pos]];\n }\n\n /**\n * Adds a function with defined label to the end of the queue.\n * The function must take a token string as argument and return a token.\n *\n * @param {string} label - the label\n * @param {function} func - the function\n */\n add(label: string, func: Tokenizer.TokinizeFunction) {\n this._addFunction(label, func, this._queue.length);\n }\n\n /**\n * Adds a function with defined label before an existing function to the queue.\n * The function must take a token string as argument and return a token.\n *\n * @param {string|function} labelFunc - an existing label or function\n * @param {string} label - the label\n * @param {function} func - the function\n */\n addBefore(labelFunc: string | Tokenizer.TokinizeFunction, label: string, func: Tokenizer.TokinizeFunction) {\n let pos = this._getPosition(labelFunc);\n if (pos === -1) {\n throw Error(\"Cannot find existing function.\");\n }\n this._addFunction(label, func, pos);\n }\n\n /**\n * Adds a function with defined label after an existing function to the queue.\n * The function must take a token string as argument and return a token.\n *\n * @param {string|function} labelFunc - an existing label or function\n * @param {string} label - the label\n * @param {function} func - the function\n */\n addAfter(labelFunc: string | Tokenizer.TokinizeFunction, label: string, func: Tokenizer.TokinizeFunction) {\n let pos = this._getPosition(labelFunc);\n if (pos === -1) {\n throw Error(\"Cannot find existing function.\");\n }\n this._addFunction(label, func, pos + 1);\n }\n\n /**\n * Removes a function from the queue.\n * @param {string|function} labelFunc - an existing label or function\n */\n remove(labelFunc: string | Tokenizer.TokinizeFunction) {\n let pos = this._getPosition(labelFunc);\n if (pos === -1) {\n throw Error(\"Cannot find existing function.\");\n }\n this._queue.splice(pos, 1);\n }\n\n /**\n * Resets the splitter and tokenize queue to default.\n */\n reset() {\n this._splitter = defaultSplitter;\n this._queue = [];\n }\n\n /**\n * Tokenizes a string into tokens.\n * @param {string} str - the string\n * @return {string[]} the tokens\n */\n tokenize(str: string) {\n let tokens = this._splitter(str);\n // Apply each token over the queue functions.\n for (let i = 0; i < this._queue.length; i++) {\n let newTokens: string[] = [];\n for (let j = 0; j < tokens.length; j++) {\n let token: string = this._queue[i](tokens[j]);\n if (token) {\n newTokens.push(token);\n }\n }\n tokens = newTokens;\n }\n return tokens;\n }\n\n /**\n * Serializes the tokenizer by returning the labels of the used functions.\n * @returns {{splitter: string?, tokenizers: string[]}} - the serialization\n */\n toJSON() {\n let serialized: Tokenizer.Serialization = {\n tokenizers: []\n };\n if (this._splitter !== defaultSplitter) {\n serialized.splitter = this._splitter[this._symbol];\n }\n for (let i = 0; i < this._queue.length; i++) {\n serialized.tokenizers.push(this._queue[i][this._symbol]);\n }\n return serialized;\n }\n\n /**\n * Deserializes the tokenizer by reassign the correct function to each label.\n * @param {{splitter: string, tokenizers: string[]}} serialized - the serialized labels\n * @param {Object.|Tokenizer} funcTok - the depending functions with labels\n * or an equivalent tokenizer\n */\n static fromJSONObject(serialized: Tokenizer.Serialization, funcTok?: Tokenizer.FunctionSerialization) {\n let tkz = new Tokenizer();\n if (funcTok instanceof Tokenizer) {\n if (serialized.splitter !== undefined) {\n let splitter = funcTok.getSplitter();\n if (serialized.splitter !== splitter[0]) {\n throw Error(\"Splitter function not found.\");\n }\n tkz.setSplitter(splitter[0], splitter[1]);\n }\n\n for (let i = 0; i < serialized.tokenizers.length; i++) {\n if (!funcTok.has(serialized.tokenizers[i])) {\n throw Error(\"Tokenizer function not found.\");\n }\n let labelFunc = funcTok.get(serialized.tokenizers[i]);\n tkz.add(labelFunc[0], labelFunc[1]);\n }\n } else {\n if (serialized.splitter !== undefined) {\n if (funcTok.splitters[serialized.splitter] === undefined) {\n throw Error(\"Splitter function not found.\");\n }\n tkz.setSplitter(serialized.splitter, funcTok.splitters[serialized.splitter]);\n }\n for (let i = 0; i < serialized.tokenizers.length; i++) {\n if (funcTok.tokenizers[serialized.tokenizers[i]] === undefined) {\n throw Error(\"Tokenizer function not found.\");\n }\n tkz.add(serialized.tokenizers[i], funcTok.tokenizers[serialized.tokenizers[i]]);\n }\n }\n return tkz;\n }\n\n /**\n * Returns the position of a function inside the queue.\n * @param {string|function} labelFunc - an existing label or function\n * @return {number} the position\n * @private\n */\n private _getPosition(labelFunc: string | Tokenizer.TokinizeFunction) {\n if (labelFunc instanceof Function) {\n return this._queue.indexOf(labelFunc);\n } else {\n for (let i = 0; i < this._queue.length; i++) {\n if (this._queue[i][this._symbol] === labelFunc) {\n return i;\n }\n }\n }\n return -1;\n }\n\n /**\n * Adds a function with defined label at a specific position to the queue.\n * @param {string} label - the label\n * @param {function} func - the function\n * @param {number} pos - the position\n * @private\n */\n private _addFunction(label: string, func: Tokenizer.TokinizeFunction, pos: number) {\n if (label === \"\") {\n throw Error(\"Label cannot be empty.\");\n }\n func[this._symbol] = label;\n this._queue.splice(pos, 0, func);\n }\n}\n\nexport namespace Tokenizer {\n export type SplitterFunction = (word: string) => string[];\n export type TokinizeFunction = (word: string) => string;\n\n export interface Serialization {\n splitter?: string;\n tokenizers: string[];\n }\n\n export type FunctionSerialization =\n { splitters: Dict, tokenizers: Dict }\n | Tokenizer;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/tokenizer.ts","/**\n * The base query class to enable boost to a query type.\n */\nexport class BaseQueryBuilder {\n protected _data: any;\n\n /**\n * @param {string} type - the type name of the query\n * @param data\n */\n constructor(type: string, data: any = {}) {\n this._data = data;\n this._data.type = type;\n }\n\n /**\n * Boosts the query result.\n *\n * See also [Lucene#BoostQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/BoostQuery.html}\n * and [Elasticsearch#boost]{@link https://www.elastic.co/guide/en/elasticsearch/reference/5.2/mapping-boost.html}.\n *\n * @param {number} value - the positive boost\n * @return {BaseQueryBuilder} object itself for cascading\n */\n boost(value: number) {\n if (value < 0) {\n throw TypeError(\"Boost must be a positive number.\");\n }\n this._data.boost = value;\n return this;\n }\n\n /**\n * Build the final query.\n * @return {Object} - the final query\n */\n build(): any {\n return this._data;\n }\n}\n\nexport interface BaseQuery {\n type: Type;\n boost?: number;\n}\n\n/**\n * A query which finds documents where a document field contains a term.\n *\n * See also [Lucene#TermQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/TermQuery.html}\n * and [Elasticsearch#TermQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .term(\"name\", \"infinity\"])\n * .build();\n * // The resulting documents:\n * // contains the term infinity\n *\n * @extends BaseQueryBuilder\n */\nexport class TermQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string} term - the term\n * @param data\n */\n constructor(field: string, term: string, data: any = {}) {\n super(\"term\", data);\n this._data.field = field;\n this._data.value = term;\n }\n}\n\nexport interface TermQuery extends BaseQuery<\"term\"> {\n field: string;\n value: string;\n}\n\n/**\n * A query which finds documents where a document field contains any of the terms.\n *\n * See also [Lucene#TermRangeQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/TermRangeQuery.html}\n * and [Elasticsearch#TermsQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .terms(\"quotes\", [\"infinity\", \"atom\", \"energy\"])\n * .build();\n * // The resulting documents:\n * // contains the terms infinity, atom or energy\n *\n * @extends BaseQueryBuilder\n */\nexport class TermsQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string[]} terms - the terms\n * @param data\n */\n constructor(field: string, terms: Array, data: any = {}) {\n super(\"terms\", data);\n this._data.field = field;\n this._data.value = terms;\n }\n}\n\nexport interface TermsQuery extends BaseQuery<\"terms\"> {\n field: string;\n value: string[];\n}\n\n/**\n * A query which finds documents where the wildcard term can be applied at an existing document field term.\n *\n * Wildcard | Description\n * -------- | ------------\n * ? (question mark) | Skips a single character.\n *\n * To escape a wildcard character, use _\\_ (backslash), e.g. \\?.\n *\n * * To enable scoring for wildcard queries, use {@link WildcardQueryBuilder#enableScoring}.\n *\n * See also [Lucene#WildcardQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/WildcardQuery.html}\n * and [Elasticsearch#WildcardQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .wildcard(\"question\", \"e?nst*n\\?\")\n * .build();\n * // The resulting documents:\n * // contains the wildcard surname e?nst*n\\? (like Einstein? or Eynsteyn? but not Einsteine or Ensten?)\n *\n * @extends BaseQueryBuilder\n */\nexport class WildcardQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string} wildcard - the wildcard term\n * @param data\n */\n constructor(field: string, wildcard: string, data: any = {}) {\n super(\"wildcard\", data);\n this._data.field = field;\n this._data.value = wildcard;\n }\n\n /**\n * This flag enables scoring for wildcard results, similar to {@link TermQueryBuilder}.\n * @param {boolean} enable - flag to enable or disable scoring\n * @return {WildcardQueryBuilder}\n */\n enableScoring(enable: boolean) {\n this._data.enable_scoring = enable;\n return this;\n }\n}\n\nexport interface WildcardQuery extends BaseQuery<\"wildcard\"> {\n field: string;\n value: string;\n enable_scoring?: boolean;\n}\n\n/**\n * A query which finds documents where the fuzzy term can be transformed into an existing document field term within a\n * given edit distance.\n * ([Damerau–Levenshtein distance]{@link https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance}).\n *\n * The edit distance is the minimum number of an insertion, deletion or substitution of a single character\n * or a transposition of two adjacent characters.\n *\n * * To set the maximal allowed edit distance, use {@link FuzzyQueryBuilder#fuzziness} (default is AUTO).\n * * To set the initial word length, which should ignored for fuzziness, use {@link FuzzyQueryBuilder#prefixLength}.\n * * To include longer document field terms than the fuzzy term and edit distance together, use\n * {@link FuzzyQueryBuilder#extended}.\n *\n * See also [Lucene#FuzzyQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/FuzzyQuery.html}\n * and [Elasticsearch#FuzzyQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .fuzzy(\"surname\", \"einsten\")\n * .fuzziness(2)\n * .prefixLength(3)\n * .build();\n * // The resulting documents:\n * // contains the fuzzy surname einstn (like Einstein or Einst but not Eisstein or Insten)\n *\n * @extends BaseQueryBuilder\n */\nexport class FuzzyQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string} fuzzy - the fuzzy term\n * @param data\n */\n constructor(field: string, fuzzy: string, data: any = {}) {\n super(\"fuzzy\", data);\n this._data.field = field;\n this._data.value = fuzzy;\n }\n\n /**\n * Sets the maximal allowed fuzziness.\n * @param {number|string} fuzziness - the edit distance 0, 1, 2 or AUTO\n *\n * AUTO generates an edit distance based on the length of the term:\n * * 0..2 -> must match exactly\n * * 3..5 -> one edit allowed\n * * >5 two edits allowed\n *\n * @return {FuzzyQueryBuilder} - object itself for cascading\n */\n fuzziness(fuzziness: 0 | 1 | 2 | \"AUTO\") {\n if (fuzziness !== \"AUTO\" && (fuzziness < 0 || fuzziness > 2)) {\n throw TypeError(\"Fuzziness must be 0, 1, 2 or AUTO.\");\n }\n this._data.fuzziness = fuzziness;\n return this;\n }\n\n /**\n * Sets the initial word length.\n * @param {number} prefixLength - the positive prefix length\n * @return {FuzzyQueryBuilder} object itself for cascading\n */\n prefixLength(prefixLength: number) {\n if (prefixLength < 0) {\n throw TypeError(\"Prefix length must be a positive number.\");\n }\n this._data.prefix_length = prefixLength;\n return this;\n }\n\n /**\n * This flag allows longer document field terms than the actual fuzzy.\n * @param {boolean} extended - flag to enable or disable extended search\n * @return {FuzzyQueryBuilder}\n */\n extended(extended: boolean) {\n this._data.extended = extended;\n return this;\n }\n}\n\nexport interface FuzzyQuery extends BaseQuery<\"fuzzy\"> {\n field: string;\n value: string;\n fuzziness?: 0 | 1 | 2 | \"AUTO\";\n prefix_length?: number;\n extended?: boolean;\n}\n\n/**\n * A query which matches documents containing the prefix of a term inside a field.\n *\n * * To enable scoring for wildcard queries, use {@link WildcardQueryBuilder#enableScoring}.\n *\n * See also [Lucene#PrefixQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/PrefixQuery.html}\n * and [Elasticsearch#MatchQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-prefix-query.html}\n *\n * @example\n * new QueryBuilder()\n * .prefix(\"surname\", \"alb\")\n * .build()\n * // The resulting documents:\n * // contains the term prefix alb as surname\n *\n * @extends BaseQueryBuilder\n */\nexport class PrefixQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string} prefix - the prefix of a term\n * @param data\n */\n constructor(field: string, prefix: string, data: any = {}) {\n super(\"prefix\", data);\n this._data.field = field;\n this._data.value = prefix;\n }\n\n /**\n * This flag enables scoring for prefix results, similar to {@link TermQueryBuilder}.\n * @param {boolean} enable - flag to enable or disable scoring\n * @return {PrefixQueryBuilder}\n */\n enableScoring(enable: boolean) {\n this._data.enable_scoring = enable;\n return this;\n }\n}\n\nexport interface PrefixQuery extends BaseQuery<\"prefix\"> {\n field: string;\n value: string;\n enable_scoring?: boolean;\n}\n\n/**\n * A query which matches all documents with a given field.\n *\n * See also [Elasticsearch#ExistsQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .exists(\"name\")\n * .build()\n * // The resulting documents:\n * // has the field \"name\"\n *\n * @extends BaseQueryBuilder\n */\nexport class ExistsQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param data\n */\n constructor(field: string, data: any = {}) {\n super(\"exists\", data);\n this._data.field = field;\n }\n}\n\nexport interface ExistsQuery extends BaseQuery<\"exists\"> {\n field: string;\n}\n\n\n/**\n * A query which tokenizes the given query text, performs a query foreach token and combines the results using a boolean\n * operator.\n *\n * Operator | Description\n * ------------- | -------------\n * or (default) | Finds documents which matches some tokens. The minimum amount of matches can be controlled with [minimumShouldMatch]{@link MatchQueryBuilder#minimumShouldMatch} (default is 1).\n * and | Finds documents which matches all tokens.\n *\n * To enable a [fuzzy query]{@link FuzzyQueryBuilder} for the tokens, use {@link MatchQueryBuilder#fuzziness},\n * {@link MatchQueryBuilder#prefixLength} and {@link MatchQueryBuilder#extended}\n *\n * See also [Lucene#?]{@link ?}\n * and [Elasticsearch#MatchQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .match(\"name\", \"albrt einsten\")\n * .boost(2.5)\n * .operator(\"and\")\n * .fuzziness(2)\n * .prefixLength(3)\n * .build();\n * // The resulting documents:\n * // contains the fuzzy name albrt einsten (like Albert Einstein) with a boost of 2.5\n *\n * @extends BaseQueryBuilder\n */\nexport class MatchQueryBuilder extends BaseQueryBuilder {\n /**\n * @param {string} field - the field name of the document\n * @param {string} query - the query text\n * @param data\n */\n constructor(field: string, query: string, data: any = {}) {\n super(\"match\", data);\n this._data.field = field;\n this._data.value = query;\n }\n\n /**\n * Controls the amount of minimum matching sub queries before a document will be considered.\n * @param {number} minShouldMatch - number of minimum matching sub queries\n * minShouldMatch >= 1: Indicates a fixed value regardless of the number of sub queries.\n * minShouldMatch <= -1: Indicates that the number of sub queries, minus this number should be mandatory.\n * minShouldMatch < 0: Indicates that this percent of the total number of sub queries can be missing.\n * The number computed from the percentage is rounded down, before being subtracted from the total to determine\n * the minimum.\n * minShouldMatch < 1: Indicates that this percent of the total number of sub queries are necessary.\n * The number computed from the percentage is rounded down and used as the minimum.\n * @return {MatchQueryBuilder} object itself for cascading\n */\n minimumShouldMatch(minShouldMatch: number) {\n if (this._data.operator !== undefined && this._data.operator === \"and\") {\n throw SyntaxError(\"Match query with \\\"and\\\" operator does not support minimum should match.\");\n }\n this._data.minimum_should_match = minShouldMatch;\n return this;\n }\n\n /**\n * Sets the boolean operator.\n * @param {string} op - the operator (\"or\" || \"and\")\n * @return {MatchQueryBuilder} object itself for cascading\n */\n operator(op: string) {\n if (op !== \"and\" && op !== \"or\") {\n throw SyntaxError(\"Unknown operator.\");\n }\n this._data.operator = op;\n if (this._data.minimum_should_match !== undefined && this._data.operator === \"and\") {\n throw SyntaxError(\"Match query with \\\"and\\\" operator does not support minimum should match.\");\n }\n return this;\n }\n\n /**\n * Sets the maximal allowed fuzziness.\n * @param {number|string} fuzziness - the edit distance 0, 1, 2 or AUTO\n *\n * AUTO generates an edit distance based on the length of the term:\n * * 0..2 -> must match exactly\n * * 3..5 -> one edit allowed\n * * >5 two edits allowed\n *\n * @return {MatchQueryBuilder} - object itself for cascading\n */\n fuzziness(fuzziness: 0 | 1 | 2 | \"AUTO\") {\n if (fuzziness !== \"AUTO\" && (fuzziness < 0 || fuzziness > 2)) {\n throw TypeError(\"Fuzziness must be 0, 1, 2 or AUTO.\");\n }\n this._data.fuzziness = fuzziness;\n return this;\n }\n\n /**\n * Sets the starting word length which should not be considered for fuzziness.\n * @param {number} prefixLength - the positive prefix length\n * @return {MatchQueryBuilder} - object itself for cascading\n */\n prefixLength(prefixLength: number) {\n if (prefixLength < 0) {\n throw TypeError(\"Prefix length must be a positive number.\");\n }\n this._data.prefix_length = prefixLength;\n return this;\n }\n\n /**\n * This flag allows longer document field terms than the actual fuzzy.\n * @param {boolean} extended - flag to enable or disable extended search\n * @return {MatchQueryBuilder}\n */\n extended(extended: boolean) {\n this._data.extended = extended;\n return this;\n }\n}\n\nexport interface MatchQuery extends BaseQuery<\"match\"> {\n field: string;\n value: string;\n minimum_should_match?: number;\n operator?: \"and\" | \"or\";\n fuzziness?: 0 | 1 | 2 | \"AUTO\";\n prefix_length?: number;\n extended?: boolean;\n}\n\n/**\n * A query that matches all documents and giving them a constant score equal to the query boost.\n *\n * Typically used inside a must clause of a {@link BoolQueryBuilder} to subsequently reject non matching documents with the not\n * clause.\n *\n * See also [Lucene#MatchAllDocsQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/MatchAllDocsQuery.html}\n * and [Elasticsearch#MatchAllQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-all-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .matchAll()\n * .boost(2.5)\n * .build()\n * // The resulting documents:\n * // all documents and giving a score of 2.5\n *\n * @extends BaseQueryBuilder\n */\nexport class MatchAllQueryBuilder extends BaseQueryBuilder {\n constructor(data: any = {}) {\n super(\"match_all\", data);\n }\n}\n\nexport interface MatchQueryAll extends BaseQuery<\"match_all\"> {\n}\n\n/**\n * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter.\n *\n * See also [Lucene#BooleanQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/ConstantScoreQuery.html}\n * and [Elasticsearch#ConstantScoreQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-constant-score-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .constantScore()\n * .boost(1.5)\n * .beginFilter()\n * .term(\"first_name\", \"albert\")\n * .term(\"surname\", \"einstein\")\n * .endFilter()\n * .build()\n * // The resulting documents:\n * // * contains albert as first name, einstein as surname and the document score is 42.\n *\n * @extends BaseQueryBuilder\n */\nexport class ConstantScoreQueryBuilder extends BaseQueryBuilder {\n constructor(data: any = {}) {\n super(\"constant_score\", data);\n }\n\n /**\n * Starts an array of queries. Use endFilter() to finish the array.\n * @return {ArrayQueryBuilder} array query for holding sub queries\n */\n beginFilter(): ArrayQueryBuilder & { endFilter(): ConstantScoreQueryBuilder } {\n this._data.filter = {};\n return new ArrayQueryBuilder(\"endFilter\", () => {\n return this;\n }, this._data.filter) as any;\n }\n}\n\nexport interface ConstantScoreQuery extends BaseQuery<\"constant_score\"> {\n filter: ArrayQuery;\n}\n\n/**\n * A query that matches documents matching boolean combinations of sub queries.\n *\n * This query consists of one or more boolean clauses with different behavior but interrelated to each other.\n *\n * Occur | Description\n * ------------- | -------------\n * must | Finds documents which matches all sub queries.\n * filter | Finds documents which matches all sub queries but these documents do not contribute to the score.\n * should | Finds documents which matches some sub queries. The minimum amount of matches can be controlled with [minimumShouldMatch]{@link BoolQueryBuilder#minimumShouldMatch} (default is 1).\n * not | Documents which match any sub query will be ignored.\n *\n * A sub query can be any other query type and also the bool query itself.\n *\n * See also [Lucene#BooleanQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/BooleanQuery.html}\n * and [Elasticsearch#BoolQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html}.\n *\n * @example\n * new QueryBuilder()\n * .bool()\n * .beginMust().boost(2)\n * .term(\"first_name\", \"albert\")\n * .endMust()\n * .beginFilter()\n * .term(\"birthplace\", \"ulm\")\n * .endFilter()\n * .beginShould().minimumShouldMatch(2)\n * .fuzzy(\"surname\", \"einstin\")\n * .wildcard(\"name\", \"geni?s\")\n * .term(\"quotes\", \"infinity\")\n * .endShould()\n * .beginNot()\n * .terms(\"research_field\", [\"biology\", \"geography\"])\n * .endNot()\n * .build();\n * // The resulting documents:\n * // contains the name albert (must: contribute to the score with a boost of 2)\n * // contains the birthplace ulm (filter: not contribute to the score)\n * // contains a minimum of two matches from the fuzzy, wildcard and/or term query (should: contribute to the score)\n * // do not contains biology or geography as research field (not: not contribute to the score)\n *\n * @extends BaseQueryBuilder\n */\nexport class BoolQueryBuilder extends BaseQueryBuilder {\n constructor(data: any = {}) {\n super(\"bool\", data);\n }\n\n /**\n * Starts an array of queries for must clause. Use endMust() to finish the array.\n * @return {ArrayQueryBuilder} array query for holding sub queries\n */\n beginMust(): ArrayQueryBuilder & { endMust(): BoolQueryBuilder } {\n this._data.must = {};\n return new ArrayQueryBuilder(\"endMust\", () => {\n return this;\n }, this._data.must) as any;\n }\n\n /**\n * Starts an array of queries for filter clause. Use endFilter() to finish the array.\n * @return {ArrayQueryBuilder} array query for holding sub queries\n */\n beginFilter(): ArrayQueryBuilder & { endFilter(): BoolQueryBuilder } {\n this._data.filter = {};\n return new ArrayQueryBuilder(\"endFilter\", () => {\n return this;\n }, this._data.filter) as any;\n }\n\n /**\n * Starts an array of queries for should clause. Use endShould() to finish the array.\n * @return {ArrayQueryBuilder} array query for holding sub queries\n */\n beginShould(): ArrayQueryBuilder & { endShould(): BoolQueryBuilder } {\n this._data.should = {};\n return new ArrayQueryBuilder(\"endShould\", () => {\n return this;\n }, this._data.should) as any;\n }\n\n /**\n * Starts an array of queries for not clause. Use endNot() to finish the array.\n * @return {ArrayQueryBuilder} array query for holding sub queries\n */\n beginNot(): ArrayQueryBuilder & { endNot(): BoolQueryBuilder } {\n this._data.not = {};\n return new ArrayQueryBuilder(\"endNot\", () => {\n return this;\n }, this._data.not) as any;\n }\n\n /**\n * Controls the amount of minimum matching sub queries before a document will be considered.\n * @param {number} minShouldMatch - number of minimum matching sub queries\n * minShouldMatch >= 1: Indicates a fixed value regardless of the number of sub queries.\n * minShouldMatch <= -1: Indicates that the number of sub queries, minus this number should be mandatory.\n * minShouldMatch < 0: Indicates that this percent of the total number of sub queries can be missing.\n * The number computed from the percentage is rounded down, before being subtracted from the total to determine\n * the minimum.\n * minShouldMatch < 1: Indicates that this percent of the total number of sub queries are necessary.\n * The number computed from the percentage is rounded down and used as the minimum.\n * @return {BoolQueryBuilder} object itself for cascading\n */\n minimumShouldMatch(minShouldMatch: number) {\n this._data.minimum_should_match = minShouldMatch;\n return this;\n }\n}\n\nexport interface BoolQuery extends BaseQuery<\"bool\"> {\n must?: ArrayQuery;\n filter?: ArrayQuery;\n should?: ArrayQuery;\n not?: ArrayQuery;\n minimum_should_match?: number;\n}\n\n\n/**\n * A query which holds all sub queries like an array.\n */\nexport class ArrayQueryBuilder extends BaseQueryBuilder {\n private _callbackName: string;\n private _prepare: (queryType: { new(...args: any[]): any }, ...args: any[]) => any;\n\n constructor(callbackName: string, callback: Function, data: any = {}) {\n super(\"array\", data);\n this._data.values = [];\n this._callbackName = callbackName;\n this[callbackName] = callback;\n\n this._prepare = (queryType: any, ...args: any[]) => {\n const data = {};\n const query = new queryType(...args, data);\n this._data.values.push(data);\n query.bool = this.bool;\n query.constantScore = this.constantScore;\n query.term = this.term;\n query.terms = this.terms;\n query.wildcard = this.wildcard;\n query.fuzzy = this.fuzzy;\n query.match = this.match;\n query.matchAll = this.matchAll;\n query.prefix = this.prefix;\n query.exists = this.exists;\n query._prepare = this._prepare;\n query[this._callbackName] = this[this._callbackName];\n return query;\n };\n }\n\n bool() {\n return this._prepare(BoolQueryBuilder);\n }\n\n constantScore() {\n return this._prepare(ConstantScoreQueryBuilder);\n }\n\n term(field: string, term: string) {\n return this._prepare(TermQueryBuilder, field, term);\n }\n\n terms(field: string, terms: Array) {\n return this._prepare(TermsQueryBuilder, field, terms);\n }\n\n wildcard(field: string, wildcard: string) {\n return this._prepare(WildcardQueryBuilder, field, wildcard);\n }\n\n fuzzy(field: string, fuzzy: string) {\n return this._prepare(FuzzyQueryBuilder, field, fuzzy);\n }\n\n match(field: string, query: string) {\n return this._prepare(MatchQueryBuilder, field, query);\n }\n\n matchAll() {\n return this._prepare(MatchAllQueryBuilder);\n }\n\n prefix(field: string, prefix: string) {\n return this._prepare(PrefixQueryBuilder, field, prefix);\n }\n\n exists(field: string) {\n return this._prepare(ExistsQueryBuilder, field);\n }\n}\n\nexport interface ArrayQuery extends BaseQuery<\"array\"> {\n values: QueryTypes[];\n}\n\n/**\n * This query builder is the root of each query search.\n * The query contains a sub query and parameters for setup scoring and search options.\n *\n * Possible sub query types are:\n * {@link TermQueryBuilder}, {@link TermsQueryBuilder}, {@link FuzzyQueryBuilder}, {@link WildcardQueryBuilder},\n * {@link MatchQueryBuilder}, {@link MatchAllQueryBuilder}, {@link PrefixQueryBuilder}, {@link BoolQueryBuilder},\n * {@link ConstantScoreQueryBuilder}, {@link ExistsQueryBuilder}\n *\n * @example\n * new QueryBuilder()\n * .finalScoring(true)\n * .useBM25(1.5, 0.5)\n * .term(\"first_name\", \"albert\")\n * .build();\n * // The resulting documents:\n * // contains the first name albert\n * // are scored and ranked using BM25 with k1=1.5 and b=0.5\n */\nexport class QueryBuilder {\n private _data: any;\n\n constructor() {\n this._data = {query: {}};\n }\n\n /**\n * The query performs a final scoring over all scored sub queries.\n * @param {boolean} enable - flag to enable or disable final scoring\n * @return {this}\n */\n enableFinalScoring(enable: boolean) {\n this._data.final_scoring = enable;\n return this;\n }\n\n /**\n * Adds an explanation of the scoring of each document for all matched terms.\n * @param {boolean} enable -flag to enable or disable explanation\n * @returns {this}\n */\n explain(enable: boolean) {\n this._data.explain = enable;\n return this;\n }\n\n /**\n * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model.\n *\n * See also [Lucene#MatchAllDocsQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/similarities/BM25Similarity.html}\n * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}.\n *\n * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation.\n * Lower values result in quicker saturation, and higher values in slower saturation\n * @param {number} [b=0.75] - controls how much effect field-length normalization should have.\n * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully\n * @return {this}\n */\n BM25Similarity(k1: number = 1.2, b: number = 0.75) {\n if (k1 < 0) {\n throw TypeError(\"BM25s k1 must be a positive number.\");\n }\n if (b < 0 || b > 1) {\n throw TypeError(\"BM25s b must be a number between 0 and 1 inclusive.\");\n }\n\n this._data.bm25 = {\n k1,\n b\n };\n return this;\n }\n\n bool(): BoolQueryBuilder {\n return this._prepare(BoolQueryBuilder);\n }\n\n constantScore(): ConstantScoreQueryBuilder {\n return this._prepare(ConstantScoreQueryBuilder);\n }\n\n term(field: string, term: string): TermQueryBuilder {\n return this._prepare(TermQueryBuilder, field, term);\n }\n\n terms(field: string, terms: Array): TermsQueryBuilder {\n return this._prepare(TermsQueryBuilder, field, terms);\n }\n\n wildcard(field: string, wildcard: string): WildcardQueryBuilder {\n return this._prepare(WildcardQueryBuilder, field, wildcard);\n }\n\n fuzzy(field: string, fuzzy: string): FuzzyQueryBuilder {\n return this._prepare(FuzzyQueryBuilder, field, fuzzy);\n }\n\n match(field: string, query: string): MatchQueryBuilder {\n return this._prepare(MatchQueryBuilder, field, query);\n }\n\n matchAll(): MatchAllQueryBuilder {\n return this._prepare(MatchAllQueryBuilder);\n }\n\n prefix(field: string, prefix: string): PrefixQueryBuilder {\n return this._prepare(PrefixQueryBuilder, field, prefix);\n }\n\n exists(field: string): ExistsQueryBuilder {\n return this._prepare(ExistsQueryBuilder, field);\n }\n\n private _prepare(queryType: { new(...args: any[]): T }, ...args: any[]): T {\n const query = new queryType(...args, this._data.query);\n query.build = () => {\n return this._data;\n };\n return query;\n }\n}\n\nexport type QueryTypes = BoolQuery | ConstantScoreQuery | TermQuery | TermsQuery | WildcardQuery | FuzzyQuery\n | MatchQuery | MatchQueryAll | PrefixQuery | ExistsQuery;\n\nexport interface Query {\n query: QueryTypes;\n final_scoring?: boolean;\n explain?: boolean;\n bm25?: {\n k1: number;\n b: number;\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/query_builder.ts","import {Long} from \"./long\";\n\nconst MASKS = [new Long(0x1), new Long(0x3), new Long(0x7), new Long(0xf),\n new Long(0x1f), new Long(0x3f), new Long(0x7f), new Long(0xff),\n new Long(0x1ff), new Long(0x3ff), new Long(0x7ff), new Long(0xfff),\n new Long(0x1fff), new Long(0x3fff), new Long(0x7fff), new Long(0xffff),\n new Long(0xf, 0x1fff), new Long(0xf, 0x3fff), new Long(0xf, 0x7fff), new Long(0xf, 0xffff),\n new Long(0xff, 0x1fff), new Long(0xff, 0x3fff), new Long(0xff, 0x7fff), new Long(0xff, 0xffff),\n new Long(0xfff, 0x1fff), new Long(0xfff, 0x3fff), new Long(0xfff, 0x7fff), new Long(0xfff, 0xffff),\n new Long(0xffff, 0x1fff), new Long(0xffff, 0x3fff), new Long(0xffff, 0x7fff), new Long(0xffff, 0xffff),\n new Long(0xfffff, 0x1fff), new Long(0xfffff, 0x3fff), new Long(0xfffff, 0x7fff), new Long(0xfffff, 0xffff),\n new Long(0xffffff, 0x1fff), new Long(0xffffff, 0x3fff), new Long(0xffffff, 0x7fff), new Long(0xffffff, 0xffff),\n new Long(0xfffffff, 0x1fff), new Long(0xfffffff, 0x3fff), new Long(0xfffffff, 0x7fff), new Long(0xfffffff, 0xffff),\n new Long(0xffffffff, 0x1fff), new Long(0xffffffff, 0x3fff), new Long(0xffffffff, 0x7fff), new Long(0xffffffff, 0xffff),\n new Long(0xfffffffff, 0x1fff), new Long(0xfffffffff, 0x3fff), new Long(0xfffffffff, 0x7fff), new Long(0xfffffffff, 0xffff),\n new Long(0xffffffffff, 0x1fff), new Long(0xffffffffff, 0x3fff), new Long(0xffffffffff, 0x7fff), new Long(0xffffffffff, 0xffff),\n new Long(0xfffffffffff, 0x1fff), new Long(0xfffffffffff, 0x3fff), new Long(0xfffffffffff, 0x7fff), new Long(0xfffffffffff, 0xffff),\n new Long(0xffffffffffff, 0x1fff), new Long(0xffffffffffff, 0x3fff), new Long(0xffffffffffff, 0x7fff)];\n\n/**\n * From org/apache/lucene/util/automaton/LevenshteinAutomata.java#ParametricDescription\n * @hidden\n */\nexport class ParametricDescription {\n protected _w: number;\n private _n: number;\n private _minErrors: number[];\n\n constructor(w: number, n: number, minErrors: number[]) {\n this._w = w;\n this._n = n;\n this._minErrors = minErrors;\n }\n\n /**\n * Return the number of states needed to compute a Levenshtein DFA\n */\n public size(): number {\n return this._minErrors.length * (this._w + 1);\n }\n\n /**\n * Returns true if the state in any Levenshtein DFA is an accept state (final state).\n */\n public isAccept(absState: number): boolean {\n // decode absState -> state, offset\n let state = Math.floor(absState / (this._w + 1));\n let offset = absState % (this._w + 1);\n //assert offset >= 0;\n return this._w - offset + this._minErrors[state] <= this._n;\n }\n\n /**\n * Returns the position in the input word for a given state.\n * This is the minimal boundary for the state.\n */\n public getPosition(absState: number): number {\n return absState % (this._w + 1);\n }\n\n public unpack(data: Long[], index: number, bitsPerValue: number): number {\n const bitLoc = bitsPerValue * index;\n const dataLoc = (bitLoc >> 6);\n const bitStart = (bitLoc & 63);\n\n if (bitStart + bitsPerValue <= 64) {\n // not split\n return data[dataLoc].shiftRight(bitStart).and(MASKS[bitsPerValue - 1]).toInt();\n } else {\n // split\n const part = 64 - bitStart;\n return (data[dataLoc].shiftRight(bitStart).and(MASKS[part - 1])).toInt()\n + (data[1 + dataLoc].and(MASKS[bitsPerValue - part - 1]).shiftLeft(part)).toInt();\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/parametric_description.ts","import {FullTextSearch} from \"./full_text_search\";\nimport {Tokenizer} from \"./tokenizer\";\nimport {QueryBuilder} from \"./query_builder\";\n\nFullTextSearch[\"Tokenizer\"] = Tokenizer;\nFullTextSearch[\"QueryBuilder\"] = QueryBuilder;\n\nexport {FullTextSearch, Tokenizer, QueryBuilder};\nexport default FullTextSearch;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/index.ts","import {InvertedIndex} from \"./inverted_index\";\nimport {IndexSearcher} from \"./index_searcher\";\nimport {Tokenizer} from \"./tokenizer\";\nimport {Dict} from \"../../common/types\";\nimport {PLUGINS} from \"../../common/plugin\";\nimport {Query} from \"./query_builder\";\nimport {Scorer} from \"./scorer\";\n\nexport class FullTextSearch {\n private _id: string;\n private _docs: Set;\n private _idxSearcher: IndexSearcher;\n private _invIdxs: Dict = {};\n\n /**\n * Registers the full-text search as plugin.\n */\n public static register(): void {\n PLUGINS[\"FullTextSearch\"] = FullTextSearch;\n }\n\n /**\n * Initialize the full-text search for the given fields.\n * @param {object[]} fields - the field options\n * @param {string} fields.name - the name of the field\n * @param {boolean=true} fields.store - flag to indicate if the full-text search should be stored on serialization or\n * rebuild on deserialization\n * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized\n * (requires more memory but performs better)\n * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field\n * @param {string} [id] - the property name of the document index\n */\n constructor(fields: FullTextSearch.FieldOptions[] = [], id?: string) {\n // Create inverted indices for each field.\n for (let i = 0; i < fields.length; i++) {\n let field = fields[i];\n this._invIdxs[field.name] = new InvertedIndex(field);\n }\n this._id = id;\n this._docs = new Set();\n this._idxSearcher = new IndexSearcher(this._invIdxs, this._docs);\n }\n\n public addDocument(doc: object, id: number = doc[this._id]): void {\n let fieldNames = Object.keys(doc);\n for (let i = 0, fieldName; i < fieldNames.length, fieldName = fieldNames[i]; i++) {\n if (this._invIdxs[fieldName] !== undefined) {\n this._invIdxs[fieldName].insert(doc[fieldName], id);\n }\n }\n this._docs.add(id);\n this._idxSearcher.setDirty();\n }\n\n public removeDocument(doc: object, id: number = doc[this._id]): void {\n let fieldNames = Object.keys(this._invIdxs);\n for (let i = 0; i < fieldNames.length; i++) {\n this._invIdxs[fieldNames[i]].remove(id);\n }\n this._docs.delete(id);\n this._idxSearcher.setDirty();\n }\n\n public updateDocument(doc: object, id: number = doc[this._id]): void {\n this.removeDocument(doc, id);\n this.addDocument(doc, id);\n }\n\n public clear(): void {\n for (let id of this._docs) {\n this.removeDocument(null, id);\n }\n }\n\n public search(query: Query): Scorer.ScoreResult {\n return this._idxSearcher.search(query);\n }\n\n public toJSON(): FullTextSearch.Serialization {\n let serialized = {id: this._id, ii: {}};\n let fieldNames = Object.keys(this._invIdxs);\n for (let i = 0; i < fieldNames.length; i++) {\n const fieldName = fieldNames[i];\n serialized.ii[fieldName] = this._invIdxs[fieldName].toJSON();\n }\n return serialized;\n }\n\n public static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers: Dict = {}): FullTextSearch {\n let fts = new FullTextSearch([], serialized.id);\n let fieldNames = Object.keys(serialized.ii);\n for (let i = 0; i < fieldNames.length; i++) {\n const fieldName = fieldNames[i];\n fts._invIdxs[fieldName] = InvertedIndex.fromJSONObject(serialized.ii[fieldName], tokenizers[fieldName]);\n }\n return fts;\n }\n}\n\nexport namespace FullTextSearch {\n export interface FieldOptions extends InvertedIndex.FieldOptions {\n name: string;\n }\n\n export interface Serialization {\n id: string;\n ii: Dict;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/full_text_search.ts","import {Scorer} from \"./scorer\";\nimport {InvertedIndex, toCodePoints} from \"./inverted_index\";\nimport {FuzzyQuery, Query, QueryBuilder, WildcardQuery} from \"./query_builder\";\nimport {Dict} from \"../../common/types\";\nimport {RunAutomaton} from \"./fuzzy/run_automaton\";\nimport {LevenshteinAutomata} from \"./fuzzy/levenshtein_automata\";\nimport QueryResults = Scorer.QueryResults;\nimport Index = InvertedIndex.Index;\n\n\n/**\n * @hidden\n */\nexport class IndexSearcher {\n private _invIdxs: Dict;\n private _docs: Set;\n private _scorer: Scorer;\n\n /**\n * @param {object} invIdxs\n */\n constructor(invIdxs: Dict, docs: Set) {\n this._invIdxs = invIdxs;\n this._docs = docs;\n this._scorer = new Scorer(this._invIdxs);\n }\n\n public search(query: Query): Scorer.ScoreResult {\n let queryResults = this._recursive(query.query, true);\n\n // Do final scoring.\n if (query.final_scoring !== undefined ? query.final_scoring : true) {\n return this._scorer.finalScore(query, queryResults);\n }\n\n const result: Scorer.ScoreResult = {};\n for (const key of queryResults.keys()) {\n result[key] = {score: 1};\n }\n return result;\n }\n\n public setDirty() {\n this._scorer.setDirty();\n }\n\n private _recursive(query: any, doScoring: boolean) {\n let queryResults: QueryResults = new Map();\n const boost = query.boost !== undefined ? query.boost : 1;\n const fieldName = query.field !== undefined ? query.field : null;\n\n let root = null;\n let tokenizer = null;\n if (this._invIdxs[fieldName] !== undefined) {\n root = this._invIdxs[fieldName].root;\n tokenizer = this._invIdxs[fieldName].tokenizer;\n }\n\n switch (query.type) {\n case \"bool\": {\n queryResults = null;\n if (query.must !== undefined) {\n queryResults = this._getUnique(query.must.values, doScoring, queryResults);\n }\n if (query.filter !== undefined) {\n queryResults = this._getUnique(query.filter.values, false, queryResults);\n }\n if (query.should !== undefined) {\n let shouldDocs = this._getAll(query.should.values, doScoring);\n\n let empty = false;\n if (queryResults === null) {\n queryResults = new Map();\n empty = true;\n }\n\n let msm = 1;\n // TODO: Enable percent and ranges.\n if (query.minimum_should_match !== undefined) {\n msm = query.minimum_should_match;\n let shouldLength = query.should.values.length;\n if (msm <= -1) {\n msm = shouldLength + msm;\n } else if (msm < 0) {\n msm = shouldLength - Math.floor(shouldLength * -msm);\n } else if (msm < 1) {\n msm = Math.floor(shouldLength * msm);\n }\n }\n // Remove all docs with fewer matches.\n for (const [docId, res] of shouldDocs) {\n if (res.length >= msm) {\n if (queryResults.has(docId)) {\n queryResults.get(docId).push(...res);\n } else if (empty) {\n queryResults.set(docId, res);\n } else {\n queryResults.delete(docId);\n }\n }\n }\n }\n if (query.not !== undefined) {\n let notDocs = this._getAll(query.not.values, false);\n // Remove all docs.\n for (const docId of notDocs.keys()) {\n if (queryResults.has(docId)) {\n queryResults.delete(docId);\n }\n }\n }\n break;\n }\n case \"term\": {\n const cps = toCodePoints(query.value);\n let termIdx = InvertedIndex.getTermIndex(cps, root);\n this._scorer.score(fieldName, boost, termIdx, doScoring, queryResults, cps);\n break;\n }\n case \"terms\": {\n for (let i = 0; i < query.value.length; i++) {\n const cps = toCodePoints(query.value[i]);\n let termIdx = InvertedIndex.getTermIndex(cps, root);\n this._scorer.score(fieldName, boost, termIdx, doScoring, queryResults, cps);\n }\n break;\n }\n case \"fuzzy\": {\n const f = fuzzySearch(query, root);\n for (let i = 0; i < f.length; i++) {\n this._scorer.score(fieldName, boost * f[i].boost, f[i].index, doScoring, queryResults, f[i].term);\n }\n break;\n }\n case \"wildcard\": {\n const enableScoring = query.enable_scoring !== undefined ? query.enable_scoring : false;\n const w = wildcardSearch(query, root);\n for (let i = 0; i < w.length; i++) {\n this._scorer.score(fieldName, boost, w[i].index, doScoring && enableScoring, queryResults, w[i].term);\n }\n break;\n }\n case \"match_all\": {\n for (let docId of this._docs) {\n this._scorer.scoreConstant(boost, docId, queryResults);\n }\n break;\n }\n case \"constant_score\": {\n let tmpQueryResults = this._getAll(query.filter.values, false);\n // Add to each document a constant score.\n for (const docId of tmpQueryResults.keys()) {\n this._scorer.scoreConstant(boost, docId, queryResults);\n }\n break;\n }\n case \"prefix\": {\n const enableScoring = query.enable_scoring !== undefined ? query.enable_scoring : false;\n const cps = toCodePoints(query.value);\n const termIdx = InvertedIndex.getTermIndex(cps, root);\n if (termIdx !== null) {\n const termIdxs = InvertedIndex.extendTermIndex(termIdx);\n for (let i = 0; i < termIdxs.length; i++) {\n this._scorer.score(fieldName, boost, termIdxs[i].index, doScoring && enableScoring, queryResults, [...cps, ...termIdxs[i].term]);\n }\n }\n break;\n }\n case \"exists\": {\n if (root !== null) {\n for (const docId of this._invIdxs[fieldName].documentStore.keys()) {\n this._scorer.scoreConstant(boost, docId, queryResults);\n }\n }\n break;\n }\n case \"match\": {\n let terms = tokenizer.tokenize(query.value);\n let operator = query.operator !== undefined ? query.operator : \"or\";\n\n let tmpQuery: any = new QueryBuilder().bool();\n if (operator === \"or\") {\n if (query.minimum_should_match !== undefined) {\n tmpQuery = tmpQuery.minimumShouldMatch(query.minimum_should_match);\n }\n // Build a should query.\n tmpQuery = tmpQuery.beginShould();\n } else {\n // Build a must query.\n tmpQuery = tmpQuery.beginMust();\n }\n tmpQuery = tmpQuery.boost(boost);\n\n if (query.fuzziness !== undefined) {\n let prefixLength = query.prefix_length !== undefined ? query.prefix_length : 2;\n let extended = query.extended !== undefined ? query.extended : false;\n // Add each fuzzy.\n for (let i = 0; i < terms.length; i++) {\n tmpQuery = tmpQuery.fuzzy(fieldName, terms[i]).fuzziness(query.fuzziness).prefixLength(prefixLength).extended(extended);\n }\n } else {\n // Add each term.\n for (let i = 0; i < terms.length; i++) {\n tmpQuery = tmpQuery.term(fieldName, terms[i]);\n }\n }\n if (operator === \"or\") {\n tmpQuery = tmpQuery.endShould();\n } else {\n tmpQuery = tmpQuery.endMust();\n }\n queryResults = this._recursive(tmpQuery.build().query, doScoring);\n\n break;\n }\n default:\n break;\n }\n return queryResults;\n }\n\n private _getUnique(queries: any[], doScoring: boolean, queryResults: QueryResults) {\n if (queries.length === 0) {\n return queryResults;\n }\n\n for (let i = 0; i < queries.length; i++) {\n let currDocs = this._recursive(queries[i], doScoring);\n if (queryResults === null) {\n queryResults = this._recursive(queries[0], doScoring);\n continue;\n }\n\n for (const docId of queryResults.keys()) {\n if (!currDocs.has(docId)) {\n queryResults.delete(docId);\n } else {\n queryResults.get(docId).push(...currDocs.get(docId));\n }\n }\n }\n return queryResults;\n }\n\n private _getAll(queries: any[], doScoring: boolean) {\n let queryResults: QueryResults = new Map();\n for (let i = 0; i < queries.length; i++) {\n let currDocs = this._recursive(queries[i], doScoring);\n for (const docId of currDocs.keys()) {\n if (!queryResults.has(docId)) {\n queryResults.set(docId, currDocs.get(docId));\n } else {\n queryResults.get(docId).push(...currDocs.get(docId));\n }\n }\n }\n return queryResults;\n }\n}\n\ntype FuzzyResult = { index: Index, term: number[], boost: number };\n\n/**\n * Performs a fuzzy search.\n * @param {FuzzyQuery} query - the fuzzy query\n * @param {Index} root - the root index\n * @returns {FuzzyResult} - the results\n */\nfunction fuzzySearch(query: FuzzyQuery, root: Index): FuzzyResult[] {\n let value = toCodePoints(query.value);\n let fuzziness = query.fuzziness !== undefined ? query.fuzziness : \"AUTO\";\n if (fuzziness === \"AUTO\") {\n if (value.length <= 2) {\n fuzziness = 0;\n } else if (value.length <= 5) {\n fuzziness = 1;\n } else {\n fuzziness = 2;\n }\n }\n let prefixLength = query.prefix_length !== undefined ? query.prefix_length : 2;\n let extended = query.extended !== undefined ? query.extended : false;\n\n // Do just a prefix search if zero fuzziness.\n if (fuzziness === 0) {\n prefixLength = value.length;\n }\n\n let result: FuzzyResult[] = [];\n let startIdx = root;\n let prefix = value.slice(0, prefixLength);\n let fuzzy = value;\n\n // Perform a prefix search.\n if (prefixLength !== 0) {\n startIdx = InvertedIndex.getTermIndex(prefix, startIdx);\n fuzzy = fuzzy.slice(prefixLength);\n }\n\n // No startIdx found.\n if (startIdx === null) {\n return result;\n }\n\n // Fuzzy is not necessary anymore, because prefix search includes the whole query value.\n if (fuzzy.length === 0) {\n if (extended) {\n // Add all terms down the index.\n const all = InvertedIndex.extendTermIndex(startIdx);\n for (let i = 0; i < all.length; i++) {\n result.push({index: all[i].index, term: all[i].term, boost: 1});\n }\n } else if (startIdx.dc !== undefined) {\n // Add prefix search result.\n result.push({index: startIdx, term: value, boost: 1});\n }\n return result;\n }\n\n // The matching term.\n const term = [0];\n // Create an automaton from the fuzzy.\n const automaton = new RunAutomaton(new LevenshteinAutomata(fuzzy, fuzziness).toAutomaton());\n\n function determineEditDistance(state: number, termLength: number, fuzzyLength: number): number {\n // Check how many edits this fuzzy can still do.\n let ed = 0;\n state = automaton.step(state, 0);\n if (state !== -1 && automaton.isAccept(state)) {\n ed++;\n state = automaton.step(state, 0);\n if (state !== -1 && automaton.isAccept(state)) {\n ed++;\n }\n }\n // Include the term and fuzzy length.\n ed -= Math.abs(termLength - fuzzyLength);\n return fuzziness as number - ed;\n }\n\n function recursive(state: number, key: number, idx: Index) {\n term[term.length - 1] = key;\n\n // Check the current key of term with the automaton.\n state = automaton.step(state, key);\n if (state === -1) {\n return;\n }\n\n if (automaton.isAccept(state)) {\n if (extended) {\n // Add all terms down the index.\n let all = InvertedIndex.extendTermIndex(idx);\n for (let i = 0; i < all.length; i++) {\n result.push({index: all[i].index, term: all[i].term, boost: 1});\n }\n return;\n } else if (idx.df !== undefined) {\n // Calculate boost.\n let distance = determineEditDistance(state, term.length, fuzzy.length);\n let boost = 1 - distance / Math.min(prefix.length + term.length, value.length);\n result.push({index: idx, term: [...prefix, ...term], boost});\n }\n }\n\n term.push(0);\n for (const child of idx) {\n recursive(state, child[0], child[1]);\n }\n term.pop();\n }\n\n for (const child of startIdx) {\n recursive(0, child[0], child[1]);\n }\n\n return result;\n}\n\ntype WildcardResult = { index: Index, term: number[] };\n\n/**\n * Performs a wildcard search.\n * @param {WildcardQuery} query - the wildcard query\n * @param {Index} root - the root index\n * @returns {Array} - the results\n */\nfunction wildcardSearch(query: WildcardQuery, root: Index): WildcardResult[] {\n let wildcard = toCodePoints(query.value);\n let result: WildcardResult[] = [];\n\n function recursive(index: Index, idx: number = 0, term: number[] = [], escaped: boolean = false) {\n if (index === null) {\n return;\n }\n\n if (idx === wildcard.length) {\n if (index.df !== undefined) {\n result.push({index: index, term: term.slice()});\n }\n return;\n }\n\n // Escaped character.\n if (!escaped && wildcard[idx] === 92 /* \\ */) {\n recursive(index, idx + 1, term, true);\n } else if (!escaped && wildcard[idx] === 63 /* ? */) {\n for (const child of index) {\n recursive(child[1], idx + 1, [...term, child[0]]);\n }\n } else if (!escaped && wildcard[idx] === 42 /* * */) {\n // Check if asterisk is last wildcard character\n if (idx + 1 === wildcard.length) {\n const all = InvertedIndex.extendTermIndex(index);\n for (let i = 0; i < all.length; i++) {\n recursive(all[i].index, idx + 1, [...term, ...all[i].term]);\n }\n } else {\n // Iterate over the whole tree.\n recursive(index, idx + 1, term, false);\n const indices: InvertedIndex.IndexTerm[] = [{index: index, term: []}];\n do {\n const index = indices.pop();\n for (const child of index.index) {\n recursive(child[1], idx + 1, [...term, ...index.term, child[0]]);\n indices.push({index: child[1], term: [...index.term, child[0]]});\n }\n } while (indices.length !== 0);\n }\n } else {\n recursive(InvertedIndex.getTermIndex([wildcard[idx]], index), idx + 1, [...term, wildcard[idx]]);\n }\n }\n\n recursive(root);\n\n return result;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/index_searcher.ts","import {InvertedIndex} from \"./inverted_index\";\nimport {Dict} from \"../../common/types\";\nimport {Query} from \"./query_builder\";\n\n/**\n * @hidden\n */\nexport class Scorer {\n private _invIdxs: Dict;\n private _cache: Dict;\n\n constructor(invIdxs: Dict) {\n this._invIdxs = invIdxs;\n this._cache = {};\n }\n\n public setDirty(): void {\n this._cache = {};\n }\n\n public score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean,\n queryResults: Scorer.QueryResults, term: number[]): void {\n if (termIdx === null || termIdx.dc === undefined) {\n return;\n }\n\n const idf = this._idf(fieldName, termIdx.df);\n for (const [docId, tf] of termIdx.dc) {\n if (!queryResults.has(docId)) {\n queryResults.set(docId, []);\n }\n\n if (doScoring) {\n // BM25 scoring.\n queryResults.get(docId).push({tf, idf, boost, fieldName, term});\n } else {\n // Constant scoring.\n queryResults.set(docId, [{boost}]);\n }\n }\n }\n\n public scoreConstant(boost: number, docId: number, queryResults: Scorer.QueryResults) {\n if (!queryResults.has(docId)) {\n queryResults.set(docId, []);\n }\n queryResults.get(docId).push({boost});\n return queryResults;\n }\n\n public finalScore(query: Query, queryResults: Scorer.QueryResults): Scorer.ScoreResult {\n const result: Scorer.ScoreResult = {};\n const k1 = query.bm25 !== undefined ? query.bm25.k1 : 1.2;\n const b = query.bm25 !== undefined ? query.bm25.b : 0.75;\n const explain = query.explain !== undefined ? query.explain : false;\n\n for (const [docId, result1] of queryResults) {\n let docScore = 0;\n let docExplanation: Scorer.ScoreExplanation[] = [];\n for (let j = 0; j < result1.length; j++) {\n const queryResult = result1[j];\n let score = 0;\n if (queryResult.tf !== undefined) {\n // BM25 scoring.\n const tf = queryResult.tf;\n const fieldLength = Scorer._calculateFieldLength(this._invIdxs[queryResult.fieldName].documentStore.get(+docId)\n .fieldLength);\n const avgFieldLength = this._avgFieldLength(queryResult.fieldName);\n const tfNorm = (tf * (k1 + 1)) / (tf + k1 * (1 - b + b * (fieldLength / avgFieldLength)));\n score = queryResult.idf * tfNorm * queryResult.boost;\n if (explain) {\n docExplanation.push({\n boost: queryResult.boost,\n score: score,\n docID: docId,\n fieldName: queryResult.fieldName,\n index: String.fromCharCode(...queryResult.term),\n idf: queryResult.idf,\n tfNorm: tfNorm,\n tf: tf,\n fieldLength: fieldLength,\n avgFieldLength: avgFieldLength,\n });\n }\n } else {\n // Constant scoring.\n score = queryResult.boost;\n\n if (explain) {\n docExplanation.push({\n boost: queryResult.boost,\n score: score\n });\n }\n }\n docScore += score;\n }\n if (explain) {\n result[docId] = {\n score: docScore,\n explanation: docExplanation\n };\n } else {\n result[docId] = {\n score: docScore\n };\n }\n }\n return result;\n }\n\n private static _calculateFieldLength(fieldLength: number): number {\n // Dummy function to be compatible to lucene in unit tests.\n return fieldLength;\n }\n\n private _getCache(fieldName: string): Scorer.IDFCache {\n if (this._cache[fieldName] === undefined) {\n const avgFieldLength = this._invIdxs[fieldName].totalFieldLength / this._invIdxs[fieldName].documentCount;\n this._cache[fieldName] = {idfs: {}, avgFieldLength};\n }\n return this._cache[fieldName];\n }\n\n /**\n * Returns the idf by either calculate it or use a cached one.\n * @param {string} fieldName - the name of the field\n * @param {number} docFreq - the doc frequency of the term\n * @returns {number} the idf\n * @private\n */\n private _idf(fieldName: string, docFreq: number): number {\n const cache = this._getCache(fieldName);\n if (cache.idfs[docFreq] !== undefined) {\n return cache.idfs[docFreq];\n }\n return cache.idfs[docFreq] = Math.log(1 + (this._invIdxs[fieldName].documentCount - docFreq + 0.5) / (docFreq + 0.5));\n }\n\n private _avgFieldLength(fieldName: string): number {\n return this._getCache(fieldName).avgFieldLength;\n }\n}\n\nexport namespace Scorer {\n export interface IDFCache {\n idfs: Dict;\n avgFieldLength: number;\n }\n\n export interface QueryResult {\n tf?: number; // Term frequency.\n idf?: number; // Inverse document frequency\n boost: number;\n fieldName?: string;\n term?: number[];\n }\n\n export type QueryResults = Map;\n\n export interface BM25Explanation {\n boost: number;\n score: number;\n docID: number;\n fieldName: string;\n index: string;\n idf: number;\n tfNorm: number;\n tf: number;\n fieldLength: number;\n avgFieldLength: number;\n }\n\n export interface ConstantExplanation {\n boost: number;\n score: number;\n }\n\n export type ScoreExplanation = BM25Explanation | ConstantExplanation;\n\n export type ScoreResult = Dict<{ score: number, explanation?: ScoreExplanation[] }>;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/scorer.ts","import {Automaton} from \"./automaton\";\n\n/**\n * From org/apache/lucene/util/automaton/RunAutomaton.java\n * @hidden\n */\nexport class RunAutomaton {\n private _points: number[];\n private _accept: boolean[];\n private _transitions: number[];\n private _classmap: number[];\n\n constructor(automaton: Automaton) {\n const size = automaton.getNumStates();\n this._points = automaton.getStartPoints();\n this._accept = new Array(size);\n this._transitions = new Array(size * this._points.length);\n\n for (let n = 0; n < size; n++) {\n this._accept[n] = automaton.isAccept(n);\n for (let c = 0; c < this._points.length; c++) {\n // assert dest === -1 || dest < size;\n this._transitions[n * this._points.length + c] = automaton.step(n, this._points[c]);\n }\n }\n\n this._classmap = new Array(256 /* alphaSize */);\n for (let i = 0, j = 0; j < this._classmap.length; j++) {\n if (i + 1 < this._points.length && j === this._points[i + 1]) {\n i++;\n }\n this._classmap[j] = i;\n }\n }\n\n getCharClass(c: number): number {\n // binary search\n let a = 0;\n let b = this._points.length;\n while (b - a > 1) {\n const d = (a + b) >>> 1;\n if (this._points[d] > c) {\n b = d;\n } else if (this._points[d] < c) {\n a = d;\n } else {\n return d;\n }\n }\n return a;\n }\n\n step(state: number, c: number): number {\n if (c >= this._classmap.length) {\n return this._transitions[state * this._points.length + this.getCharClass(c)];\n } else {\n return this._transitions[state * this._points.length + this._classmap[c]];\n }\n }\n\n isAccept(state: number): boolean {\n return this._accept[state];\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/run_automaton.ts","import {Automaton, MAX_CODE_POINT} from \"./automaton\";\nimport {Lev1TParametricDescription} from \"./lev1t_parametric_description\";\nimport {Lev2TParametricDescription} from \"./lev2t_parametric_description\";\n\n/**\n * From org/apache/lucene/util/automaton/LevenshteinAutomata.java\n * @hidden\n */\nexport class LevenshteinAutomata {\n private _word: number[];\n private _numRanges: number;\n private _rangeLower: number[];\n private _rangeUpper: number[];\n private _description: Lev1TParametricDescription;\n private _alphabet: number[];\n private _editDistance: number;\n\n constructor(input: number[], editDistance: number) {\n this._word = input;\n this._editDistance = editDistance;\n this._alphabet = [...new Set(this._word)].sort((a, b) => a - b) as any;\n\n this._numRanges = 0;\n this._rangeLower = new Array(this._alphabet.length + 2);\n this._rangeUpper = new Array(this._alphabet.length + 2);\n // calculate the unicode range intervals that exclude the alphabet\n // these are the ranges for all unicode characters not in the alphabet\n let lower = 0;\n for (let i = 0; i < this._alphabet.length; i++) {\n const higher = this._alphabet[i];\n if (higher > lower) {\n this._rangeLower[this._numRanges] = lower;\n this._rangeUpper[this._numRanges] = higher - 1;\n this._numRanges++;\n }\n lower = higher + 1;\n }\n /* add the final endpoint */\n if (lower <= MAX_CODE_POINT) {\n this._rangeLower[this._numRanges] = lower;\n this._rangeUpper[this._numRanges] = MAX_CODE_POINT;\n this._numRanges++;\n }\n\n if (editDistance === 1) {\n this._description = new Lev1TParametricDescription(input.length);\n } else {\n this._description = new Lev2TParametricDescription(input.length);\n }\n }\n\n /**\n * Transforms the NDFA to a DFA.\n * @returns {Automaton}\n */\n public toAutomaton() {\n let automat = new Automaton();\n const range = 2 * this._editDistance + 1;\n\n // the number of states is based on the length of the word and the edit distance\n const numStates = this._description.size();\n\n // Prefix is not needed to be handled by the automaton.\n // stateOffset = 0;\n automat.createState();\n\n // create all states, and mark as accept states if appropriate\n for (let i = 1; i < numStates; i++) {\n let state = automat.createState();\n automat.setAccept(state, this._description.isAccept(i));\n }\n\n for (let k = 0; k < numStates; k++) {\n const xpos = this._description.getPosition(k);\n\n if (xpos < 0) {\n continue;\n }\n\n const end = xpos + Math.min(this._word.length - xpos, range);\n for (let x = 0; x < this._alphabet.length; x++) {\n const ch = this._alphabet[x];\n const cvec = this.getVector(ch, xpos, end);\n const dest = this._description.transition(k, xpos, cvec);\n\n if (dest >= 0) {\n automat.addTransition(k, dest, ch, ch);\n }\n }\n\n const dest = this._description.transition(k, xpos, 0);\n if (dest >= 0) {\n for (let r = 0; r < this._numRanges; r++) {\n automat.addTransition(k, dest, this._rangeLower[r], this._rangeUpper[r]);\n }\n }\n }\n\n // assert automat.deterministic;\n automat.finishState();\n\n return automat;\n }\n\n private getVector(x: number, pos: number, end: number) {\n let vector = 0;\n for (let i = pos; i < end; i++) {\n vector <<= 1;\n if (this._word[i] === x) {\n vector |= 1;\n }\n }\n return vector;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/levenshtein_automata.ts","/**\n * Transition with dest, min and max.\n * @hidden\n */\nexport declare type Transition = [number, number, number];\n\n/**\n * @type {number}\n * @hidden\n */\nexport const MIN_CODE_POINT = 0;\n/**\n * @type {number}\n * @hidden\n */\nexport const MAX_CODE_POINT = 1114111;\n\nfunction sortByDestMinMax(a: Transition, b: Transition) {\n if (a[0] < b[0]) {\n return -1;\n } else if (a[0] > b[0]) {\n return 1;\n }\n if (a[1] < b[1]) {\n return -1;\n } else if (a[1] > b[1]) {\n return 1;\n }\n if (a[2] < b[2]) {\n return -1;\n } else if (a[2] > b[2]) {\n return 1;\n }\n return 0;\n}\n\nfunction sortByMinMaxDest(a: Transition, b: Transition) {\n if (a[1] < b[1]) {\n return -1;\n } else if (a[1] > b[1]) {\n return 1;\n }\n if (a[2] < b[2]) {\n return -1;\n } else if (a[2] > b[2]) {\n return 1;\n }\n if (a[0] < b[0]) {\n return -1;\n } else if (a[0] > b[0]) {\n return 1;\n }\n return 0;\n}\n\n/**\n * From org/apache/lucene/util/automaton/Automaton.java\n * @hidden\n */\nexport class Automaton {\n private _stateTransitions: Transition[] = [];\n private _accept: Set;\n private _nextState: number;\n private _currState: number;\n // public deterministic: boolean;\n private _transitions: object;\n\n constructor() {\n this._stateTransitions = [];\n this._accept = new Set();\n this._nextState = 0;\n this._currState = -1;\n // this.deterministic = true;\n this._transitions = {};\n }\n\n public isAccept(n: number): boolean {\n return this._accept.has(n);\n }\n\n public createState(): number {\n return this._nextState++;\n }\n\n public setAccept(state: number, accept: boolean): void {\n if (accept) {\n this._accept.add(state);\n } else {\n this._accept.delete(state);\n }\n }\n\n public finishState(): void {\n if (this._currState !== -1) {\n this._finishCurrentState();\n this._currState = -1;\n }\n }\n\n private _finishCurrentState(): void {\n // Sort all transitions.\n this._stateTransitions.sort(sortByDestMinMax);\n\n let upto = 0;\n let p: Transition = [-1, -1, -1];\n\n for (let i = 0, len = this._stateTransitions.length; i < len; i++) {\n let t = this._stateTransitions[i];\n if (p[0] === t[0]) {\n if (t[1] <= p[2] + 1) {\n if (t[2] > p[2]) {\n p[2] = t[2];\n }\n } else {\n if (p[0] !== -1) {\n this._stateTransitions[upto][0] = p[0];\n this._stateTransitions[upto][1] = p[1];\n this._stateTransitions[upto][2] = p[2];\n upto++;\n }\n p[1] = t[1];\n p[2] = t[2];\n }\n } else {\n if (p[0] !== -1) {\n this._stateTransitions[upto][0] = p[0];\n this._stateTransitions[upto][1] = p[1];\n this._stateTransitions[upto][2] = p[2];\n upto++;\n }\n p[0] = t[0];\n p[1] = t[1];\n p[2] = t[2];\n }\n }\n\n if (p[0] !== -1) {\n // Last transition\n this._stateTransitions[upto][0] = p[0];\n this._stateTransitions[upto][1] = p[1];\n this._stateTransitions[upto][2] = p[2];\n upto++;\n }\n\n this._transitions[this._currState] = this._stateTransitions.slice(0, upto).sort(sortByMinMaxDest);\n\n // if (this.deterministic && upto > 1) {\n // let lastMax = this.stateTransitions[0][2];\n // for (let i = 1; i < upto; i++) {\n // let min = this.stateTransitions[i][1];\n // if (min <= lastMax) {\n // this.deterministic = false;\n // break;\n // }\n // lastMax = this.stateTransitions[i][2];\n // }\n // }\n\n this._stateTransitions = [];\n }\n\n public getStartPoints(): number[] {\n const pointset = new Set();\n pointset.add(MIN_CODE_POINT);\n\n const states = Object.keys(this._transitions);\n for (let i = 0; i < states.length; i++) {\n let trans = this._transitions[states[i]];\n for (let j = 0; j < trans.length; j++) {\n let tran = trans[j];\n pointset.add(tran[1]);\n if (tran[2] < MAX_CODE_POINT) {\n pointset.add(tran[2] + 1);\n }\n }\n }\n return Array.from(pointset).sort((a, b) => a - b);\n }\n\n public step(state: number, label: number): number {\n let trans = this._transitions[state];\n if (trans) {\n for (let i = 0; i < trans.length; i++) {\n let tran = trans[i];\n if (tran[1] <= label && label <= tran[2]) {\n return tran[0];\n }\n }\n }\n return -1;\n }\n\n public getNumStates(): number {\n return this._nextState;\n }\n\n public addTransition(source: number, dest: number, min: number, max: number): void {\n if (this._currState !== source) {\n if (this._currState !== -1) {\n this._finishCurrentState();\n }\n this._currState = source;\n }\n this._stateTransitions.push([dest, min, max]);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/automaton.ts","import {Long} from \"./long\";\nimport {ParametricDescription} from \"./parametric_description\";\n\n// 1 vectors; 2 states per vector; array length = 2\nconst toStates0 = [new Long(0x2)];\nconst offsetIncrs0 = [new Long(0x0)];\n\n// 2 vectors; 3 states per vector; array length = 6\nconst toStates1 = [new Long(0xa43)];\n\nconst offsetIncrs1 = [new Long(0x38)];\n\n// 4 vectors; 6 states per vector; array length = 24\nconst toStates2 = [new Long(0x82140003, 0x34534914), new Long(0x6d)];\nconst offsetIncrs2 = [new Long(0x55a20000, 0x5555)];\n\n// 8 vectors; 6 states per vector; array length = 48\nconst toStates3 = [new Long(0x900C0003, 0x21520854), new Long(0x4534916d, 0x5b4d19a2), new Long(0xda34)];\nconst offsetIncrs3 = [new Long(0x20fc0000, 0x5555ae0a), new Long(0x55555555)];\n\n// state map\n// 0 -> [(0, 0)]\n// 1 -> [(0, 1)]\n// 2 -> [(0, 1), (1, 1)]\n// 3 -> [(0, 1), (2, 1)]\n// 4 -> [t(0, 1), (0, 1), (1, 1), (2, 1)]\n// 5 -> [(0, 1), (1, 1), (2, 1)]\n\n/**\n * From org/apache/lucene/util/automaton/Lev1TParametricDescription.java\n * @hidden\n */\nexport class Lev1TParametricDescription extends ParametricDescription {\n constructor(w: number) {\n super(w, 1, [0, 1, 0, -1, -1, -1]);\n }\n\n public transition(absState: number, position: number, vector: number): number {\n // null absState should never be passed in\n //assert absState != -1;\n\n // decode absState -> state, offset\n let state = Math.floor(absState / (this._w + 1));\n let offset = absState % (this._w + 1);\n //assert offset >= 0;\n\n if (position === this._w) {\n if (state < 2) {\n const loc = vector * 2 + state;\n offset += this.unpack(offsetIncrs0, loc, 1);\n state = this.unpack(toStates0, loc, 2) - 1;\n }\n } else if (position === this._w - 1) {\n if (state < 3) {\n const loc = vector * 3 + state;\n offset += this.unpack(offsetIncrs1, loc, 1);\n state = this.unpack(toStates1, loc, 2) - 1;\n }\n } else if (position === this._w - 2) {\n if (state < 6) {\n const loc = vector * 6 + state;\n offset += this.unpack(offsetIncrs2, loc, 2);\n state = this.unpack(toStates2, loc, 3) - 1;\n }\n } else {\n if (state < 6) {\n const loc = vector * 6 + state;\n offset += this.unpack(offsetIncrs3, loc, 2);\n state = this.unpack(toStates3, loc, 3) - 1;\n }\n }\n\n if (state === -1) {\n // null state\n return -1;\n } else {\n // translate back to abs\n return state * (this._w + 1) + offset;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/lev1t_parametric_description.ts","import {Long} from \"./long\";\nimport {ParametricDescription} from \"./parametric_description\";\n\n// 1 vectors; 3 states per vector; array length = 3\nconst toStates0 = /*2 bits per value */ [\n new Long(0x23)\n];\nconst offsetIncrs0 = /*1 bits per value */ [\n new Long(0x0)\n];\n\n// 2 vectors; 5 states per vector; array length = 10\nconst toStates1 = /*3 bits per value */ [\n new Long(0x13688b44)\n];\nconst offsetIncrs1 = /*1 bits per value */ [\n new Long(0x3e0)\n];\n\n// 4 vectors; 13 states per vector; array length = 52\nconst toStates2 = /*4 bits per value */ [\n new Long(0x5200b504, 0x60dbb0b0), new Long(0x27062227, 0x52332176), new Long(0x14323235, 0x23555432), new Long(0x4354)\n];\nconst offsetIncrs2 = /*2 bits per value */ [\n new Long(0x00002000, 0x555080a8), new Long(0x55555555, 0x55)\n];\n\n// 8 vectors; 28 states per vector; array length = 224\nconst toStates3 = /*5 bits per value */ [\n new Long(0x40059404, 0xe701c029), new Long(0x00a50000, 0xa0101620), new Long(0xa1416288, 0xb02c8c40), new Long(0x310858c0, 0xa821032),\n new Long(0x0d28b201, 0x31442398), new Long(0x847788e0, 0x5281e528), new Long(0x08c2280e, 0xa23980d3), new Long(0xa962278c, 0x1e3294b1),\n new Long(0x2288e528, 0x8c41309e), new Long(0x021aca21, 0x11444409), new Long(0x86b1086b, 0x11a46248), new Long(0x1d6240c4, 0x2a625894),\n new Long(0x489074ad, 0x5024a50b), new Long(0x520c411a, 0x14821aca), new Long(0x0b594a44, 0x5888b589), new Long(0xc411a465, 0x941d6520),\n new Long(0xad6a62d4, 0x8b589075), new Long(0x1a5055a4)\n];\nconst offsetIncrs3 = /*2 bits per value */ [\n new Long(0x00002000, 0x30c302), new Long(0xc3fc333c, 0x2a0030f3), new Long(0x8282a820, 0x233a0032), new Long(0x32b283a8, 0x55555555),\n new Long(0x55555555, 0x55555555), new Long(0x55555555, 0x55555555), new Long(0x55555555, 0x55555555)\n];\n\n// 16 vectors; 45 states per vector; array length = 720\nconst toStates4 = /*6 bits per value */ [\n new Long(0x002c5004, 0x3801450), new Long(0x00000e38, 0xc500014b), new Long(0x51401402, 0x514), new Long(0x0),\n new Long(0x14010000, 0x518000b), new Long(0x28e20230, 0x9f1c208), new Long(0x830a70c2, 0x219f0df0), new Long(0x08208200, 0x82000082),\n new Long(0x60800800, 0x8050501), new Long(0x02602643, 0x30820986), new Long(0x50508064, 0x45640142), new Long(0x20000831, 0x8500514),\n new Long(0x85002082, 0x41405820), new Long(0x0990c201, 0x45618098), new Long(0x50a01051, 0x8316d0c), new Long(0x050df0e0, 0x21451420),\n new Long(0x14508214, 0xd142140), new Long(0x50821c60, 0x3c21c018), new Long(0xcb142087, 0x1cb1403), new Long(0x1851822c, 0x80082145),\n new Long(0x20800020, 0x200208), new Long(0x87180345, 0xd0061820), new Long(0x24976b09, 0xcb0a81cb), new Long(0x624709d1, 0x8b1a60e),\n new Long(0x82249089, 0x2490820), new Long(0x00d2c024, 0xc31421c6), new Long(0x15454423, 0x3c314515), new Long(0xc21cb140, 0x31853c22),\n new Long(0x2c208214, 0x4514500b), new Long(0x508b0051, 0x8718034), new Long(0x5108f0c5, 0xb2cb4551), new Long(0x1cb0a810, 0xe824715d),\n new Long(0x908b0e60, 0x1422cb14), new Long(0xc02cb145, 0x30812c22), new Long(0x0cb1420c, 0x84202202), new Long(0x20ce0850, 0x5c20ce08),\n new Long(0x8b0d70c2, 0x20820820), new Long(0x14214208, 0x42085082), new Long(0x50830c20, 0x9208340), new Long(0x13653592, 0xc6134dc6),\n new Long(0x6dc4db4d, 0xd309341c), new Long(0x54d34d34, 0x6424d908), new Long(0x030814c2, 0x92072c22), new Long(0x24a30930, 0x4220724b),\n new Long(0x25c920e2, 0x2470d720), new Long(0x975c9082, 0x92c92d70), new Long(0x04924e08, 0xcb0880c2), new Long(0xc24c2481, 0x45739728),\n new Long(0xda6174da, 0xc6da4db5), new Long(0x5d30971d, 0x4b5d35d7), new Long(0x93825ce2, 0x1030815c), new Long(0x020cb145, 0x51442051),\n new Long(0x2c220e2c, 0xc538210e), new Long(0x52cb0d70, 0x8514214), new Long(0x85145142, 0x204b0850), new Long(0x4051440c, 0x92156083),\n new Long(0xa60e6595, 0x4d660e4d), new Long(0x1c6dc658, 0x94d914e4), new Long(0x1454d365, 0x82642659), new Long(0x51030813, 0x2892072c),\n new Long(0xcb2ca30b, 0xe2c22072), new Long(0x20538910, 0x452c70d7), new Long(0x708e3891, 0x8b2cb2d), new Long(0xc204b24e, 0x81cb1440),\n new Long(0x28c2ca24, 0xda44e38e), new Long(0x85d660e4, 0x1dc6da65), new Long(0x8e5d914e, 0xe2cb5d33), new Long(0x38938238)\n];\nconst offsetIncrs4 = /*3 bits per value */ [\n new Long(0x00080000, 0x30020000), new Long(0x20c060), new Long(0x04000000, 0x81490000), new Long(0x10824824, 0x40249241),\n new Long(0x60002082, 0xdb6030c3), new Long(0x301b0d80, 0x6c36c06c), new Long(0x000db0db, 0xb01861b0), new Long(0x9188e06d, 0x1b703620),\n new Long(0x06d86db7, 0x8009200), new Long(0x02402490, 0x4920c24), new Long(0x08249009, 0x490002), new Long(0x28124804, 0x49081281),\n new Long(0x124a44a2, 0x34800104), new Long(0x0d24020c, 0xc3093090), new Long(0x24c24d24, 0x40009a09), new Long(0x9201061a, 0x4984a06),\n new Long(0x71269262, 0x494d0492), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249),\n new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924),\n new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492),\n new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249),\n new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x2492)\n];\n\n// 32 vectors; 45 states per vector; array length = 1440\nconst toStates5 = /*6 bits per value */ [\n new Long(0x002c5004, 0x3801450), new Long(0x00000e38, 0xc500014b), new Long(0x51401402, 0x514), new Long(0x0),\n new Long(0x14010000, 0x514000b), new Long(0x038e00e0, 0x550000), new Long(0x0600b180, 0x26451850), new Long(0x08208208, 0x82082082),\n new Long(0x40820820, 0x2c500), new Long(0x808c0146, 0x70820a38), new Long(0x9c30827c, 0xc37c20c2), new Long(0x20800867, 0x208208),\n new Long(0x02002080, 0xb1401020), new Long(0x00518000, 0x828e2023), new Long(0x209f1c20, 0x830a70c), new Long(0x853df0df, 0x51451450),\n new Long(0x14508214, 0x16142142), new Long(0x30805050, 0x60260264), new Long(0x43082098, 0x25050806), new Long(0x14564014, 0x42000083),\n new Long(0x20850051, 0x8500208), new Long(0x14140582, 0x80990c20), new Long(0x08261809, 0x82019202), new Long(0x90060941, 0x8920519),\n new Long(0xc22cb242, 0x22492492), new Long(0x0162492c, 0x43080505), new Long(0x86026026, 0x80414515), new Long(0xc5b43142, 0x37c38020),\n new Long(0x14508014, 0x42085085), new Long(0x50850051, 0x1414058), new Long(0x980990c2, 0x51456180), new Long(0x0c50a010, 0xe008316d),\n new Long(0x508b21f0, 0x2c52cb2c), new Long(0xc22cb249, 0x600d2c92), new Long(0x1850821c, 0x873c21c0), new Long(0x03cb1420, 0x2c01cb14),\n new Long(0x45185182, 0x20800821), new Long(0x08208000, 0x45002002), new Long(0x20871803, 0x8700614), new Long(0x050821cf, 0x740500f5),\n new Long(0x18609000, 0x934d9646), new Long(0x30824d30, 0x4c24d34d), new Long(0xc600d642, 0x1860821), new Long(0x25dac274, 0xc2a072c9),\n new Long(0x91c27472, 0x2c698398), new Long(0x89242242, 0x92420820), new Long(0x34b00900, 0x82087180), new Long(0xb09d0061, 0x1cb24976),\n new Long(0x9d1cb0a8, 0x60e62470), new Long(0x1574ce3e, 0xd31455d7), new Long(0x25c25d74, 0x1c600d38), new Long(0x423c3142, 0x51515454),\n new Long(0x1403c314, 0xc22c21cb), new Long(0x21431853, 0xb2c208), new Long(0x05145145, 0x34508b0), new Long(0x0c508718, 0x5515108f),\n new Long(0xf2051454, 0x8740500), new Long(0x0618f090, 0xe2534d92), new Long(0x6592c238, 0x49382659), new Long(0x21c600d6, 0x4423c314),\n new Long(0xcb2d1545, 0x72c2a042), new Long(0xa091c574, 0x422c3983), new Long(0x508b2c52, 0xb2c514), new Long(0x8034b08b, 0xf0c50871),\n new Long(0x45515108, 0xa810b2cb), new Long(0x715d1cb0, 0x2260e824), new Long(0x8e2d74ce, 0xe6592c53), new Long(0x38938238, 0x420c3081),\n new Long(0x22020cb1, 0x8508420), new Long(0xce0820ce, 0x70c25c20), new Long(0x08208b0d, 0x42082082), new Long(0x50821421, 0xc204208),\n new Long(0x832c5083, 0x21080880), new Long(0x0838c214, 0xa5083882), new Long(0xa9c39430, 0xaaaaaaaa), new Long(0x9fa9faaa, 0x1aaa7eaa),\n new Long(0x1420c308, 0x824820d0), new Long(0x84d94d64, 0x7184d371), new Long(0x1b7136d3, 0x34c24d07), new Long(0x1534d34d, 0x99093642),\n new Long(0x30c20530, 0x8340508), new Long(0x53592092, 0x34dc6136), new Long(0x4db4dc61, 0xa479c6dc), new Long(0x4924924a, 0x920a9f92),\n new Long(0x8192a82a, 0x72c22030), new Long(0x30930920, 0x724b24a), new Long(0x920e2422, 0xd72025c), new Long(0xc9082247, 0x92d70975),\n new Long(0x24e0892c, 0x880c2049), new Long(0xc2481cb0, 0x2c928c24), new Long(0x89088749, 0x80a52488), new Long(0xaac74394, 0x6a861b2a),\n new Long(0xab27b278, 0x81b2ca6), new Long(0x072c2203, 0xa3093092), new Long(0x6915ce5c, 0xd76985d3), new Long(0x771b6936, 0x5d74c25c),\n new Long(0x892d74d7, 0x724e0973), new Long(0x0880c205, 0x4c2481cb), new Long(0x739728c2, 0x6174da45), new Long(0xda4db5da, 0x4aa175c6),\n new Long(0x86486186, 0x6a869b27), new Long(0x308186ca, 0xcb14510), new Long(0x44205102, 0x220e2c51), new Long(0x38210e2c, 0xcb0d70c5),\n new Long(0x51421452, 0x14514208), new Long(0x4b085085, 0x51440c20), new Long(0x1440832c, 0xcb145108), new Long(0x488b0888, 0x94316208),\n new Long(0x9f7e79c3, 0xfaaa7dfa), new Long(0x7ea7df7d, 0x30819ea), new Long(0x20d01451, 0x65648558), new Long(0x93698399, 0x96135983),\n new Long(0x39071b71, 0xd9653645), new Long(0x96451534, 0x4e09909), new Long(0x051440c2, 0x21560834), new Long(0x60e65959, 0xd660e4da),\n new Long(0xc6dc6584, 0x9207e979), new Long(0xdf924820, 0xa82a8207), new Long(0x103081a6, 0x892072c5), new Long(0xb2ca30b2, 0x2c22072c),\n new Long(0x0538910e, 0x52c70d72), new Long(0x08e38914, 0x8b2cb2d7), new Long(0x204b24e0, 0x1cb1440c), new Long(0x8c2ca248, 0x874b2cb2),\n new Long(0x24488b08, 0x43948162), new Long(0x9b1f7e77, 0x9e786aa6), new Long(0xeca6a9e7, 0x51030819), new Long(0x2892072c, 0x8e38a30b),\n new Long(0x83936913, 0x69961759), new Long(0x4538771b, 0x74ce3976), new Long(0x08e38b2d, 0xc204e24e), new Long(0x81cb1440, 0x28c2ca24),\n new Long(0xda44e38e, 0x85d660e4), new Long(0x75c6da65, 0x698607e9), new Long(0x99e7864a, 0xa6ca6aa6)\n];\nconst offsetIncrs5 = /*3 bits per value */ [\n new Long(0x00080000, 0x30020000), new Long(0x20c060), new Long(0x04000000, 0x1000000), new Long(0x50603018, 0xdb6db6db),\n new Long(0x00002db6, 0xa4800002), new Long(0x41241240, 0x12492088), new Long(0x00104120, 0x40000100), new Long(0x92092052, 0x2492c420),\n new Long(0x096592d9, 0xc30d800), new Long(0xc36036d8, 0xb01b0c06), new Long(0x6c36db0d, 0x186c0003), new Long(0xb01b6c06, 0xad860361),\n new Long(0x5b6dd6dd, 0x360001b7), new Long(0x0db6030c, 0xc412311c), new Long(0xb6e36e06, 0xdb0d), new Long(0xdb01861b, 0x9188e06),\n new Long(0x71b72b62, 0x6dd6db), new Long(0x00800920, 0x40240249), new Long(0x904920c2, 0x20824900), new Long(0x40049000, 0x12012480),\n new Long(0xa4906120, 0x5524ad4a), new Long(0x02480015, 0x40924020), new Long(0x48409409, 0x92522512), new Long(0x24000820, 0x49201001),\n new Long(0x204a04a0, 0x29128924), new Long(0x00055549, 0x900830d2), new Long(0x24c24034, 0x934930c), new Long(0x02682493, 0x4186900),\n new Long(0x61201a48, 0x9a498612), new Long(0x355249d4, 0xc348001), new Long(0x940d2402, 0x24c40930), new Long(0x0924e24d, 0x1a40009a),\n new Long(0x06920106, 0x6204984a), new Long(0x92712692, 0x92494d54), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924),\n new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492),\n new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249),\n new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924),\n new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492),\n new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249),\n new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924),\n new Long(0x49249249, 0x92492492), new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492),\n new Long(0x24924924, 0x49249249), new Long(0x92492492, 0x24924924), new Long(0x49249249, 0x92492492), new Long(0x24924924)\n];\n\n// state map\n// 0 -> [(0, 0)]\n// 1 -> [(0, 2)]\n// 2 -> [(0, 1)]\n// 3 -> [(0, 1), (1, 1)]\n// 4 -> [(0, 2), (1, 2)]\n// 5 -> [t(0, 2), (0, 2), (1, 2), (2, 2)]\n// 6 -> [(0, 2), (2, 1)]\n// 7 -> [(0, 1), (2, 2)]\n// 8 -> [(0, 2), (2, 2)]\n// 9 -> [(0, 1), (1, 1), (2, 1)]\n// 10 -> [(0, 2), (1, 2), (2, 2)]\n// 11 -> [(0, 1), (2, 1)]\n// 12 -> [t(0, 1), (0, 1), (1, 1), (2, 1)]\n// 13 -> [(0, 2), (1, 2), (2, 2), (3, 2)]\n// 14 -> [t(0, 2), (0, 2), (1, 2), (2, 2), (3, 2)]\n// 15 -> [(0, 2), t(1, 2), (1, 2), (2, 2), (3, 2)]\n// 16 -> [(0, 2), (2, 1), (3, 1)]\n// 17 -> [(0, 1), t(1, 2), (2, 2), (3, 2)]\n// 18 -> [(0, 2), (3, 2)]\n// 19 -> [(0, 2), (1, 2), t(1, 2), (2, 2), (3, 2)]\n// 20 -> [t(0, 2), (0, 2), (1, 2), (3, 1)]\n// 21 -> [(0, 1), (1, 1), (3, 2)]\n// 22 -> [(0, 2), (2, 2), (3, 2)]\n// 23 -> [(0, 2), (1, 2), (3, 1)]\n// 24 -> [(0, 2), (1, 2), (3, 2)]\n// 25 -> [(0, 1), (2, 2), (3, 2)]\n// 26 -> [(0, 2), (3, 1)]\n// 27 -> [(0, 1), (3, 2)]\n// 28 -> [(0, 2), (2, 1), (4, 2)]\n// 29 -> [(0, 2), t(1, 2), (1, 2), (2, 2), (3, 2), (4, 2)]\n// 30 -> [(0, 2), (1, 2), (4, 2)]\n// 31 -> [(0, 2), (1, 2), (3, 2), (4, 2)]\n// 32 -> [(0, 2), (2, 2), (3, 2), (4, 2)]\n// 33 -> [(0, 2), (1, 2), t(2, 2), (2, 2), (3, 2), (4, 2)]\n// 34 -> [(0, 2), (1, 2), (2, 2), t(2, 2), (3, 2), (4, 2)]\n// 35 -> [(0, 2), (3, 2), (4, 2)]\n// 36 -> [(0, 2), t(2, 2), (2, 2), (3, 2), (4, 2)]\n// 37 -> [t(0, 2), (0, 2), (1, 2), (2, 2), (4, 2)]\n// 38 -> [(0, 2), (1, 2), (2, 2), (4, 2)]\n// 39 -> [t(0, 2), (0, 2), (1, 2), (2, 2), (3, 2), (4, 2)]\n// 40 -> [(0, 2), (1, 2), (2, 2), (3, 2), (4, 2)]\n// 41 -> [(0, 2), (4, 2)]\n// 42 -> [t(0, 2), (0, 2), (1, 2), (2, 2), t(2, 2), (3, 2), (4, 2)]\n// 43 -> [(0, 2), (2, 2), (4, 2)]\n// 44 -> [(0, 2), (1, 2), t(1, 2), (2, 2), (3, 2), (4, 2)]\n\n/**\n * From org/apache/lucene/util/automaton/Lev2TParametricDescription.java\n * @hidden\n */\nexport class Lev2TParametricDescription extends ParametricDescription {\n constructor(w: number) {\n super(w, 2, [0, 2, 1, 0, 1, 0, -1, 0, 0, -1, 0, -1, -1, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2]);\n }\n\n public transition(absState: number, position: number, vector: number): number {\n // null absState should never be passed in\n // assert absState != -1;\n\n // decode absState -> state, offset\n let state = Math.floor(absState / (this._w + 1));\n let offset = absState % (this._w + 1);\n // assert offset >= 0;\n\n if (position === this._w) {\n if (state < 3) {\n const loc = vector * 3 + state;\n offset += this.unpack(offsetIncrs0, loc, 1);\n state = this.unpack(toStates0, loc, 2) - 1;\n }\n } else if (position === this._w - 1) {\n if (state < 5) {\n const loc = vector * 5 + state;\n offset += this.unpack(offsetIncrs1, loc, 1);\n state = this.unpack(toStates1, loc, 3) - 1;\n }\n } else if (position === this._w - 2) {\n if (state < 13) {\n const loc = vector * 13 + state;\n offset += this.unpack(offsetIncrs2, loc, 2);\n state = this.unpack(toStates2, loc, 4) - 1;\n }\n } else if (position === this._w - 3) {\n if (state < 28) {\n const loc = vector * 28 + state;\n offset += this.unpack(offsetIncrs3, loc, 2);\n state = this.unpack(toStates3, loc, 5) - 1;\n }\n } else if (position === this._w - 4) {\n if (state < 45) {\n const loc = vector * 45 + state;\n offset += this.unpack(offsetIncrs4, loc, 3);\n state = this.unpack(toStates4, loc, 6) - 1;\n }\n } else {\n if (state < 45) {\n const loc = vector * 45 + state;\n offset += this.unpack(offsetIncrs5, loc, 3);\n state = this.unpack(toStates5, loc, 6) - 1;\n }\n }\n\n if (state === -1) {\n // null state\n return -1;\n } else {\n // translate back to abs\n return state * (this._w + 1) + offset;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/full-text-search/src/fuzzy/lev2t_parametric_description.ts","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 15\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/packages/full-text-search/lokijs.full-text-search.min.js b/dist/packages/full-text-search/lokijs.full-text-search.min.js index b85a5458..3955fe81 100644 --- a/dist/packages/full-text-search/lokijs.full-text-search.min.js +++ b/dist/packages/full-text-search/lokijs.full-text-search.min.js @@ -1 +1 @@ -(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["@lokijs/full-text-search"]=factory();else{root["@lokijs/full-text-search"]=factory();root["LokiFullTextSearch"]=root["@lokijs/full-text-search"].default}})(typeof self!=="undefined"?self:this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=5)}([function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_exports__["b"]=toCodePoints;var __WEBPACK_IMPORTED_MODULE_0__tokenizer__=__webpack_require__(2);function toCodePoints(str){const r=[];for(let i=0;i=55296&&chr<=56319){const low=str.charCodeAt(i++);r.push(65536+(chr-55296<<10)|low-56320)}else{r.push(chr)}}return r}class InvertedIndex{constructor(options={}){this._docCount=0;this._docStore=new Map;this._totalFieldLength=0;this._root=new Map;({store:this._store=true,optimizeChanges:this._optimizeChanges=true,tokenizer:this._tokenizer=new __WEBPACK_IMPORTED_MODULE_0__tokenizer__["a"]}=options)}get store(){return this._store}set store(val){this._store=val}get tokenizer(){return this._tokenizer}get documentCount(){return this._docCount}get documentStore(){return this._docStore}get totalFieldLength(){return this._totalFieldLength}get root(){return this._root}insert(field,docId){if(this._docStore.has(docId)){throw Error("Field already added.")}const fieldTokens=this._tokenizer.tokenize(field);this._totalFieldLength+=fieldTokens.length;this._docCount+=1;this._docStore.set(docId,{fieldLength:fieldTokens.length});const indexRef=[];if(this._optimizeChanges){Object.defineProperties(this._docStore.get(docId),{indexRef:{enumerable:false,configurable:true,writable:true,value:indexRef}})}for(const token of new Set(fieldTokens)){if(token===""){continue}let tf=0;for(let j=0;j=term.length){return null}for(let i=start;i>>numBits|this._high<<32-numBits,this._high>>numBits);else return new Long(this._high>>numBits-32,this._high>=0?0:-1)}shiftLeft(numBits){if((numBits&=63)===0)return this;else if(numBits<32)return new Long(this._low<>>32-numBits);else return new Long(0,this._low<2)){throw TypeError("Fuzziness must be 0, 1, 2 or AUTO.")}this._data.fuzziness=fuzziness;return this}prefixLength(prefixLength){if(prefixLength<0){throw TypeError("Prefix length must be a positive number.")}this._data.prefix_length=prefixLength;return this}extended(extended){this._data.extended=extended;return this}}class PrefixQueryBuilder extends BaseQueryBuilder{constructor(field,prefix,data={}){super("prefix",data);this._data.field=field;this._data.value=prefix}enableScoring(enable){this._data.enable_scoring=enable;return this}}class ExistsQueryBuilder extends BaseQueryBuilder{constructor(field,data={}){super("exists",data);this._data.field=field}}class MatchQueryBuilder extends BaseQueryBuilder{constructor(field,query,data={}){super("match",data);this._data.field=field;this._data.value=query}minimumShouldMatch(minShouldMatch){if(this._data.operator!==undefined&&this._data.operator==="and"){throw SyntaxError('Match query with "and" operator does not support minimum should match.')}this._data.minimum_should_match=minShouldMatch;return this}operator(op){if(op!=="and"&&op!=="or"){throw SyntaxError("Unknown operator.")}this._data.operator=op;if(this._data.minimum_should_match!==undefined&&this._data.operator==="and"){throw SyntaxError('Match query with "and" operator does not support minimum should match.')}return this}fuzziness(fuzziness){if(fuzziness!=="AUTO"&&(fuzziness<0||fuzziness>2)){throw TypeError("Fuzziness must be 0, 1, 2 or AUTO.")}this._data.fuzziness=fuzziness;return this}prefixLength(prefixLength){if(prefixLength<0){throw TypeError("Prefix length must be a positive number.")}this._data.prefix_length=prefixLength;return this}extended(extended){this._data.extended=extended;return this}}class MatchAllQueryBuilder extends BaseQueryBuilder{constructor(data={}){super("match_all",data)}}class ConstantScoreQueryBuilder extends BaseQueryBuilder{constructor(data={}){super("constant_score",data)}beginFilter(){this._data.filter={};return new ArrayQueryBuilder("endFilter",()=>{return this},this._data.filter)}}class BoolQueryBuilder extends BaseQueryBuilder{constructor(data={}){super("bool",data)}beginMust(){this._data.must={};return new ArrayQueryBuilder("endMust",()=>{return this},this._data.must)}beginFilter(){this._data.filter={};return new ArrayQueryBuilder("endFilter",()=>{return this},this._data.filter)}beginShould(){this._data.should={};return new ArrayQueryBuilder("endShould",()=>{return this},this._data.should)}beginNot(){this._data.not={};return new ArrayQueryBuilder("endNot",()=>{return this},this._data.not)}minimumShouldMatch(minShouldMatch){this._data.minimum_should_match=minShouldMatch;return this}}class ArrayQueryBuilder extends BaseQueryBuilder{constructor(callbackName,callback,data={}){super("array",data);this._data.values=[];this._callbackName=callbackName;this[callbackName]=callback;this._prepare=((queryType,...args)=>{const data={};const query=new queryType(...args,data);this._data.values.push(data);query.bool=this.bool;query.constantScore=this.constantScore;query.term=this.term;query.terms=this.terms;query.wildcard=this.wildcard;query.fuzzy=this.fuzzy;query.match=this.match;query.matchAll=this.matchAll;query.prefix=this.prefix;query.exists=this.exists;query._prepare=this._prepare;query[this._callbackName]=this[this._callbackName];return query})}bool(){return this._prepare(BoolQueryBuilder)}constantScore(){return this._prepare(ConstantScoreQueryBuilder)}term(field,term){return this._prepare(TermQueryBuilder,field,term)}terms(field,terms){return this._prepare(TermsQueryBuilder,field,terms)}wildcard(field,wildcard){return this._prepare(WildcardQueryBuilder,field,wildcard)}fuzzy(field,fuzzy){return this._prepare(FuzzyQueryBuilder,field,fuzzy)}match(field,query){return this._prepare(MatchQueryBuilder,field,query)}matchAll(){return this._prepare(MatchAllQueryBuilder)}prefix(field,prefix){return this._prepare(PrefixQueryBuilder,field,prefix)}exists(field){return this._prepare(ExistsQueryBuilder,field)}}class QueryBuilder{constructor(){this._data={query:{}}}enableFinalScoring(enable){this._data.final_scoring=enable;return this}BM25Similarity(k1=1.2,b=.75){if(k1<0){throw TypeError("BM25s k1 must be a positive number.")}if(b<0||b>1){throw TypeError("BM25s b must be a number between 0 and 1 inclusive.")}this._data.bm25={k1:k1,b:b};return this}bool(){return this._prepare(BoolQueryBuilder)}constantScore(){return this._prepare(ConstantScoreQueryBuilder)}term(field,term){return this._prepare(TermQueryBuilder,field,term)}terms(field,terms){return this._prepare(TermsQueryBuilder,field,terms)}wildcard(field,wildcard){return this._prepare(WildcardQueryBuilder,field,wildcard)}fuzzy(field,fuzzy){return this._prepare(FuzzyQueryBuilder,field,fuzzy)}match(field,query){return this._prepare(MatchQueryBuilder,field,query)}matchAll(){return this._prepare(MatchAllQueryBuilder)}prefix(field,prefix){return this._prepare(PrefixQueryBuilder,field,prefix)}exists(field){return this._prepare(ExistsQueryBuilder,field)}_prepare(queryType,...args){const query=new queryType(...args,this._data.query);query.build=(()=>{return this._data});return query}}__webpack_exports__["a"]=QueryBuilder},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__long__=__webpack_require__(1);const MASKS=[new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](3),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](7),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](15),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](31),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](63),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](127),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](255),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](511),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1023),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](2047),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4095),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](15,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](15,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](15,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](15,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](255,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](255,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](255,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](255,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4095,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4095,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4095,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4095,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](65535,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](65535,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](65535,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](65535,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1048575,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1048575,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1048575,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1048575,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](16777215,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](16777215,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](16777215,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](16777215,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](268435455,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](268435455,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](268435455,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](268435455,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4294967295,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4294967295,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4294967295,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4294967295,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](68719476735,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](68719476735,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](68719476735,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](68719476735,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffff,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffff,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffff,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffff,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xfffffffffff,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xfffffffffff,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xfffffffffff,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xfffffffffff,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffffff,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffffff,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffffff,32767)];class ParametricDescription{constructor(w,n,minErrors){this._w=w;this._n=n;this._minErrors=minErrors}size(){return this._minErrors.length*(this._w+1)}isAccept(absState){let state=Math.floor(absState/(this._w+1));let offset=absState%(this._w+1);return this._w-offset+this._minErrors[state]<=this._n}getPosition(absState){return absState%(this._w+1)}unpack(data,index,bitsPerValue){const bitLoc=bitsPerValue*index;const dataLoc=bitLoc>>6;const bitStart=bitLoc&63;if(bitStart+bitsPerValue<=64){return data[dataLoc].shiftRight(bitStart).and(MASKS[bitsPerValue-1]).toInt()}else{const part=64-bitStart;return data[dataLoc].shiftRight(bitStart).and(MASKS[part-1]).toInt()+data[1+dataLoc].and(MASKS[bitsPerValue-part-1]).shiftLeft(part).toInt()}}}__webpack_exports__["a"]=ParametricDescription},function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__full_text_search__=__webpack_require__(6);var __WEBPACK_IMPORTED_MODULE_1__tokenizer__=__webpack_require__(2);__webpack_require__.d(__webpack_exports__,"Tokenizer",function(){return __WEBPACK_IMPORTED_MODULE_1__tokenizer__["a"]});var __WEBPACK_IMPORTED_MODULE_2__query_builder__=__webpack_require__(3);__webpack_require__.d(__webpack_exports__,"QueryBuilder",function(){return __WEBPACK_IMPORTED_MODULE_2__query_builder__["a"]});var __WEBPACK_IMPORTED_MODULE_3__inverted_index__=__webpack_require__(0);__webpack_require__.d(__webpack_exports__,"InvertedIndex",function(){return __WEBPACK_IMPORTED_MODULE_3__inverted_index__["a"]});__webpack_require__.d(__webpack_exports__,"FullTextSearch",function(){return __WEBPACK_IMPORTED_MODULE_0__full_text_search__["a"]});__webpack_exports__["default"]=__WEBPACK_IMPORTED_MODULE_0__full_text_search__["a"]},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__inverted_index__=__webpack_require__(0);var __WEBPACK_IMPORTED_MODULE_1__index_searcher__=__webpack_require__(7);var __WEBPACK_IMPORTED_MODULE_2__common_plugin__=__webpack_require__(14);class FullTextSearch{constructor(fields=[],id="$loki"){this._invIdxs={};for(let i=0;i=msm){if(docResults.has(docId)){docResults.get(docId).push(...res)}else if(empty){docResults.set(docId,res)}else{docResults.delete(docId)}}}}if(query.not!==undefined){let notDocs=this._getAll(query.not.values,false);for(const docId of notDocs.keys()){if(docResults.has(docId)){docResults.delete(docId)}}}break}case"term":{const cps=Object(__WEBPACK_IMPORTED_MODULE_1__inverted_index__["b"])(query.value);let termIdx=__WEBPACK_IMPORTED_MODULE_1__inverted_index__["a"].getTermIndex(cps,root);this._scorer.score(fieldName,boost,termIdx,doScoring,docResults,cps);break}case"terms":{for(let i=0;i1){const d=a+b>>>1;if(this._points[d]>c){b=d}else if(this._points[d]=this._classmap.length){return this._transitions[state*this._points.length+this.getCharClass(c)]}else{return this._transitions[state*this._points.length+this._classmap[c]]}}isAccept(state){return this._accept[state]}}__webpack_exports__["a"]=RunAutomaton},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__automaton__=__webpack_require__(11);var __WEBPACK_IMPORTED_MODULE_1__lev1t_parametric_description__=__webpack_require__(12);var __WEBPACK_IMPORTED_MODULE_2__lev2t_parametric_description__=__webpack_require__(13);class LevenshteinAutomata{constructor(input,editDistance){this._word=input;this._editDistance=editDistance;this._alphabet=[...new Set(this._word)].sort((a,b)=>a-b);this._numRanges=0;this._rangeLower=new Array(this._alphabet.length+2);this._rangeUpper=new Array(this._alphabet.length+2);let lower=0;for(let i=0;ilower){this._rangeLower[this._numRanges]=lower;this._rangeUpper[this._numRanges]=higher-1;this._numRanges++}lower=higher+1}if(lower<=__WEBPACK_IMPORTED_MODULE_0__automaton__["b"]){this._rangeLower[this._numRanges]=lower;this._rangeUpper[this._numRanges]=__WEBPACK_IMPORTED_MODULE_0__automaton__["b"];this._numRanges++}if(editDistance===1){this._description=new __WEBPACK_IMPORTED_MODULE_1__lev1t_parametric_description__["a"](input.length)}else{this._description=new __WEBPACK_IMPORTED_MODULE_2__lev2t_parametric_description__["a"](input.length)}}toAutomaton(){let automat=new __WEBPACK_IMPORTED_MODULE_0__automaton__["a"];const range=2*this._editDistance+1;const numStates=this._description.size();automat.createState();for(let i=1;i=0){automat.addTransition(k,dest,ch,ch)}}const dest=this._description.transition(k,xpos,0);if(dest>=0){for(let r=0;rb[0]){return 1}if(a[1]b[1]){return 1}if(a[2]b[2]){return 1}return 0}function sortByMinMaxDest(a,b){if(a[1]b[1]){return 1}if(a[2]b[2]){return 1}if(a[0]b[0]){return 1}return 0}class Automaton{constructor(){this._stateTransitions=[];this._stateTransitions=[];this._accept=new Set;this._nextState=0;this._currState=-1;this._transitions={}}isAccept(n){return this._accept.has(n)}createState(){return this._nextState++}setAccept(state,accept){if(accept){this._accept.add(state)}else{this._accept.delete(state)}}finishState(){if(this._currState!==-1){this._finishCurrentState();this._currState=-1}}_finishCurrentState(){this._stateTransitions.sort(sortByDestMinMax);let upto=0;let p=[-1,-1,-1];for(let i=0,len=this._stateTransitions.length;ip[2]){p[2]=t[2]}}else{if(p[0]!==-1){this._stateTransitions[upto][0]=p[0];this._stateTransitions[upto][1]=p[1];this._stateTransitions[upto][2]=p[2];upto++}p[1]=t[1];p[2]=t[2]}}else{if(p[0]!==-1){this._stateTransitions[upto][0]=p[0];this._stateTransitions[upto][1]=p[1];this._stateTransitions[upto][2]=p[2];upto++}p[0]=t[0];p[1]=t[1];p[2]=t[2]}}if(p[0]!==-1){this._stateTransitions[upto][0]=p[0];this._stateTransitions[upto][1]=p[1];this._stateTransitions[upto][2]=p[2];upto++}this._transitions[this._currState]=this._stateTransitions.slice(0,upto).sort(sortByMinMaxDest);this._stateTransitions=[]}getStartPoints(){const pointset=new Set;pointset.add(MIN_CODE_POINT);const states=Object.keys(this._transitions);for(let i=0;ia-b)}step(state,label){let trans=this._transitions[state];if(trans){for(let i=0;i>>numBits|this._high<<32-numBits,this._high>>numBits);else return new Long(this._high>>numBits-32,this._high>=0?0:-1)}shiftLeft(numBits){if((numBits&=63)===0)return this;else if(numBits<32)return new Long(this._low<>>32-numBits);else return new Long(0,this._low<=55296&&chr<=56319){const low=str.charCodeAt(i++);r.push(65536+(chr-55296<<10)|low-56320)}else{r.push(chr)}}return r}class InvertedIndex{constructor(options={}){this._docCount=0;this._docStore=new Map;this._totalFieldLength=0;this._root=new Map;({store:this._store=true,optimizeChanges:this._optimizeChanges=true,tokenizer:this._tokenizer=new __WEBPACK_IMPORTED_MODULE_0__tokenizer__["a"]}=options)}get store(){return this._store}set store(val){this._store=val}get tokenizer(){return this._tokenizer}get documentCount(){return this._docCount}get documentStore(){return this._docStore}get totalFieldLength(){return this._totalFieldLength}get root(){return this._root}insert(field,docId){if(this._docStore.has(docId)){throw Error("Field already added.")}const fieldTokens=this._tokenizer.tokenize(field);this._totalFieldLength+=fieldTokens.length;this._docCount+=1;this._docStore.set(docId,{fieldLength:fieldTokens.length});const indexRef=[];if(this._optimizeChanges){Object.defineProperties(this._docStore.get(docId),{indexRef:{enumerable:false,configurable:true,writable:true,value:indexRef}})}for(const token of new Set(fieldTokens)){if(token===""){continue}let tf=0;for(let j=0;j=term.length){return null}for(let i=start;i2)){throw TypeError("Fuzziness must be 0, 1, 2 or AUTO.")}this._data.fuzziness=fuzziness;return this}prefixLength(prefixLength){if(prefixLength<0){throw TypeError("Prefix length must be a positive number.")}this._data.prefix_length=prefixLength;return this}extended(extended){this._data.extended=extended;return this}}class PrefixQueryBuilder extends BaseQueryBuilder{constructor(field,prefix,data={}){super("prefix",data);this._data.field=field;this._data.value=prefix}enableScoring(enable){this._data.enable_scoring=enable;return this}}class ExistsQueryBuilder extends BaseQueryBuilder{constructor(field,data={}){super("exists",data);this._data.field=field}}class MatchQueryBuilder extends BaseQueryBuilder{constructor(field,query,data={}){super("match",data);this._data.field=field;this._data.value=query}minimumShouldMatch(minShouldMatch){if(this._data.operator!==undefined&&this._data.operator==="and"){throw SyntaxError('Match query with "and" operator does not support minimum should match.')}this._data.minimum_should_match=minShouldMatch;return this}operator(op){if(op!=="and"&&op!=="or"){throw SyntaxError("Unknown operator.")}this._data.operator=op;if(this._data.minimum_should_match!==undefined&&this._data.operator==="and"){throw SyntaxError('Match query with "and" operator does not support minimum should match.')}return this}fuzziness(fuzziness){if(fuzziness!=="AUTO"&&(fuzziness<0||fuzziness>2)){throw TypeError("Fuzziness must be 0, 1, 2 or AUTO.")}this._data.fuzziness=fuzziness;return this}prefixLength(prefixLength){if(prefixLength<0){throw TypeError("Prefix length must be a positive number.")}this._data.prefix_length=prefixLength;return this}extended(extended){this._data.extended=extended;return this}}class MatchAllQueryBuilder extends BaseQueryBuilder{constructor(data={}){super("match_all",data)}}class ConstantScoreQueryBuilder extends BaseQueryBuilder{constructor(data={}){super("constant_score",data)}beginFilter(){this._data.filter={};return new ArrayQueryBuilder("endFilter",()=>{return this},this._data.filter)}}class BoolQueryBuilder extends BaseQueryBuilder{constructor(data={}){super("bool",data)}beginMust(){this._data.must={};return new ArrayQueryBuilder("endMust",()=>{return this},this._data.must)}beginFilter(){this._data.filter={};return new ArrayQueryBuilder("endFilter",()=>{return this},this._data.filter)}beginShould(){this._data.should={};return new ArrayQueryBuilder("endShould",()=>{return this},this._data.should)}beginNot(){this._data.not={};return new ArrayQueryBuilder("endNot",()=>{return this},this._data.not)}minimumShouldMatch(minShouldMatch){this._data.minimum_should_match=minShouldMatch;return this}}class ArrayQueryBuilder extends BaseQueryBuilder{constructor(callbackName,callback,data={}){super("array",data);this._data.values=[];this._callbackName=callbackName;this[callbackName]=callback;this._prepare=((queryType,...args)=>{const data={};const query=new queryType(...args,data);this._data.values.push(data);query.bool=this.bool;query.constantScore=this.constantScore;query.term=this.term;query.terms=this.terms;query.wildcard=this.wildcard;query.fuzzy=this.fuzzy;query.match=this.match;query.matchAll=this.matchAll;query.prefix=this.prefix;query.exists=this.exists;query._prepare=this._prepare;query[this._callbackName]=this[this._callbackName];return query})}bool(){return this._prepare(BoolQueryBuilder)}constantScore(){return this._prepare(ConstantScoreQueryBuilder)}term(field,term){return this._prepare(TermQueryBuilder,field,term)}terms(field,terms){return this._prepare(TermsQueryBuilder,field,terms)}wildcard(field,wildcard){return this._prepare(WildcardQueryBuilder,field,wildcard)}fuzzy(field,fuzzy){return this._prepare(FuzzyQueryBuilder,field,fuzzy)}match(field,query){return this._prepare(MatchQueryBuilder,field,query)}matchAll(){return this._prepare(MatchAllQueryBuilder)}prefix(field,prefix){return this._prepare(PrefixQueryBuilder,field,prefix)}exists(field){return this._prepare(ExistsQueryBuilder,field)}}class QueryBuilder{constructor(){this._data={query:{}}}enableFinalScoring(enable){this._data.final_scoring=enable;return this}explain(enable){this._data.explain=enable;return this}BM25Similarity(k1=1.2,b=.75){if(k1<0){throw TypeError("BM25s k1 must be a positive number.")}if(b<0||b>1){throw TypeError("BM25s b must be a number between 0 and 1 inclusive.")}this._data.bm25={k1:k1,b:b};return this}bool(){return this._prepare(BoolQueryBuilder)}constantScore(){return this._prepare(ConstantScoreQueryBuilder)}term(field,term){return this._prepare(TermQueryBuilder,field,term)}terms(field,terms){return this._prepare(TermsQueryBuilder,field,terms)}wildcard(field,wildcard){return this._prepare(WildcardQueryBuilder,field,wildcard)}fuzzy(field,fuzzy){return this._prepare(FuzzyQueryBuilder,field,fuzzy)}match(field,query){return this._prepare(MatchQueryBuilder,field,query)}matchAll(){return this._prepare(MatchAllQueryBuilder)}prefix(field,prefix){return this._prepare(PrefixQueryBuilder,field,prefix)}exists(field){return this._prepare(ExistsQueryBuilder,field)}_prepare(queryType,...args){const query=new queryType(...args,this._data.query);query.build=(()=>{return this._data});return query}}__webpack_exports__["a"]=QueryBuilder},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__long__=__webpack_require__(0);const MASKS=[new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](3),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](7),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](15),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](31),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](63),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](127),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](255),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](511),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1023),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](2047),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4095),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](15,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](15,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](15,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](15,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](255,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](255,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](255,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](255,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4095,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4095,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4095,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4095,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](65535,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](65535,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](65535,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](65535,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1048575,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1048575,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1048575,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](1048575,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](16777215,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](16777215,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](16777215,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](16777215,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](268435455,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](268435455,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](268435455,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](268435455,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4294967295,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4294967295,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4294967295,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](4294967295,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](68719476735,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](68719476735,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](68719476735,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](68719476735,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffff,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffff,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffff,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffff,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xfffffffffff,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xfffffffffff,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xfffffffffff,32767),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xfffffffffff,65535),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffffff,8191),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffffff,16383),new __WEBPACK_IMPORTED_MODULE_0__long__["a"](0xffffffffffff,32767)];class ParametricDescription{constructor(w,n,minErrors){this._w=w;this._n=n;this._minErrors=minErrors}size(){return this._minErrors.length*(this._w+1)}isAccept(absState){let state=Math.floor(absState/(this._w+1));let offset=absState%(this._w+1);return this._w-offset+this._minErrors[state]<=this._n}getPosition(absState){return absState%(this._w+1)}unpack(data,index,bitsPerValue){const bitLoc=bitsPerValue*index;const dataLoc=bitLoc>>6;const bitStart=bitLoc&63;if(bitStart+bitsPerValue<=64){return data[dataLoc].shiftRight(bitStart).and(MASKS[bitsPerValue-1]).toInt()}else{const part=64-bitStart;return data[dataLoc].shiftRight(bitStart).and(MASKS[part-1]).toInt()+data[1+dataLoc].and(MASKS[bitsPerValue-part-1]).shiftLeft(part).toInt()}}}__webpack_exports__["a"]=ParametricDescription},function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__full_text_search__=__webpack_require__(6);var __WEBPACK_IMPORTED_MODULE_1__tokenizer__=__webpack_require__(2);var __WEBPACK_IMPORTED_MODULE_2__query_builder__=__webpack_require__(3);__webpack_require__.d(__webpack_exports__,"FullTextSearch",function(){return __WEBPACK_IMPORTED_MODULE_0__full_text_search__["a"]});__webpack_require__.d(__webpack_exports__,"Tokenizer",function(){return __WEBPACK_IMPORTED_MODULE_1__tokenizer__["a"]});__webpack_require__.d(__webpack_exports__,"QueryBuilder",function(){return __WEBPACK_IMPORTED_MODULE_2__query_builder__["a"]});__WEBPACK_IMPORTED_MODULE_0__full_text_search__["a"]["Tokenizer"]=__WEBPACK_IMPORTED_MODULE_1__tokenizer__["a"];__WEBPACK_IMPORTED_MODULE_0__full_text_search__["a"]["QueryBuilder"]=__WEBPACK_IMPORTED_MODULE_2__query_builder__["a"];__webpack_exports__["default"]=__WEBPACK_IMPORTED_MODULE_0__full_text_search__["a"]},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__inverted_index__=__webpack_require__(1);var __WEBPACK_IMPORTED_MODULE_1__index_searcher__=__webpack_require__(7);var __WEBPACK_IMPORTED_MODULE_2__common_plugin__=__webpack_require__(14);class FullTextSearch{constructor(fields=[],id){this._invIdxs={};for(let i=0;i=msm){if(queryResults.has(docId)){queryResults.get(docId).push(...res)}else if(empty){queryResults.set(docId,res)}else{queryResults.delete(docId)}}}}if(query.not!==undefined){let notDocs=this._getAll(query.not.values,false);for(const docId of notDocs.keys()){if(queryResults.has(docId)){queryResults.delete(docId)}}}break}case"term":{const cps=Object(__WEBPACK_IMPORTED_MODULE_1__inverted_index__["b"])(query.value);let termIdx=__WEBPACK_IMPORTED_MODULE_1__inverted_index__["a"].getTermIndex(cps,root);this._scorer.score(fieldName,boost,termIdx,doScoring,queryResults,cps);break}case"terms":{for(let i=0;i1){const d=a+b>>>1;if(this._points[d]>c){b=d}else if(this._points[d]=this._classmap.length){return this._transitions[state*this._points.length+this.getCharClass(c)]}else{return this._transitions[state*this._points.length+this._classmap[c]]}}isAccept(state){return this._accept[state]}}__webpack_exports__["a"]=RunAutomaton},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__automaton__=__webpack_require__(11);var __WEBPACK_IMPORTED_MODULE_1__lev1t_parametric_description__=__webpack_require__(12);var __WEBPACK_IMPORTED_MODULE_2__lev2t_parametric_description__=__webpack_require__(13);class LevenshteinAutomata{constructor(input,editDistance){this._word=input;this._editDistance=editDistance;this._alphabet=[...new Set(this._word)].sort((a,b)=>a-b);this._numRanges=0;this._rangeLower=new Array(this._alphabet.length+2);this._rangeUpper=new Array(this._alphabet.length+2);let lower=0;for(let i=0;ilower){this._rangeLower[this._numRanges]=lower;this._rangeUpper[this._numRanges]=higher-1;this._numRanges++}lower=higher+1}if(lower<=__WEBPACK_IMPORTED_MODULE_0__automaton__["b"]){this._rangeLower[this._numRanges]=lower;this._rangeUpper[this._numRanges]=__WEBPACK_IMPORTED_MODULE_0__automaton__["b"];this._numRanges++}if(editDistance===1){this._description=new __WEBPACK_IMPORTED_MODULE_1__lev1t_parametric_description__["a"](input.length)}else{this._description=new __WEBPACK_IMPORTED_MODULE_2__lev2t_parametric_description__["a"](input.length)}}toAutomaton(){let automat=new __WEBPACK_IMPORTED_MODULE_0__automaton__["a"];const range=2*this._editDistance+1;const numStates=this._description.size();automat.createState();for(let i=1;i=0){automat.addTransition(k,dest,ch,ch)}}const dest=this._description.transition(k,xpos,0);if(dest>=0){for(let r=0;rb[0]){return 1}if(a[1]b[1]){return 1}if(a[2]b[2]){return 1}return 0}function sortByMinMaxDest(a,b){if(a[1]b[1]){return 1}if(a[2]b[2]){return 1}if(a[0]b[0]){return 1}return 0}class Automaton{constructor(){this._stateTransitions=[];this._stateTransitions=[];this._accept=new Set;this._nextState=0;this._currState=-1;this._transitions={}}isAccept(n){return this._accept.has(n)}createState(){return this._nextState++}setAccept(state,accept){if(accept){this._accept.add(state)}else{this._accept.delete(state)}}finishState(){if(this._currState!==-1){this._finishCurrentState();this._currState=-1}}_finishCurrentState(){this._stateTransitions.sort(sortByDestMinMax);let upto=0;let p=[-1,-1,-1];for(let i=0,len=this._stateTransitions.length;ip[2]){p[2]=t[2]}}else{if(p[0]!==-1){this._stateTransitions[upto][0]=p[0];this._stateTransitions[upto][1]=p[1];this._stateTransitions[upto][2]=p[2];upto++}p[1]=t[1];p[2]=t[2]}}else{if(p[0]!==-1){this._stateTransitions[upto][0]=p[0];this._stateTransitions[upto][1]=p[1];this._stateTransitions[upto][2]=p[2];upto++}p[0]=t[0];p[1]=t[1];p[2]=t[2]}}if(p[0]!==-1){this._stateTransitions[upto][0]=p[0];this._stateTransitions[upto][1]=p[1];this._stateTransitions[upto][2]=p[2];upto++}this._transitions[this._currState]=this._stateTransitions.slice(0,upto).sort(sortByMinMaxDest);this._stateTransitions=[]}getStartPoints(){const pointset=new Set;pointset.add(MIN_CODE_POINT);const states=Object.keys(this._transitions);for(let i=0;ia-b)}step(state,label){let trans=this._transitions[state];if(trans){for(let i=0;i; saveDatabase?(dbname: string, serialization: string): Promise; deleteDatabase?(dbname: string): Promise; mode?: string; - exportDatabase?(dbname: string, dbref: ANY): Promise; + exportDatabase?(dbname: string, dbref: Loki): Promise; } export declare type Doc = T & { $loki: number; @@ -14,10 +17,3 @@ export interface Dict { [index: string]: T; [index: number]: T; } -export interface Query { -} -export interface Filter { - type: string; - val: Query | ((obj: E, index: number, array: E[]) => boolean); - uid: number | string; -} diff --git a/dist/packages/full-text-search/types/fs-storage/src/fs_storage.d.ts b/dist/packages/full-text-search/types/fs-storage/src/fs_storage.d.ts index a92567ea..9930c0d0 100644 --- a/dist/packages/full-text-search/types/fs-storage/src/fs_storage.d.ts +++ b/dist/packages/full-text-search/types/fs-storage/src/fs_storage.d.ts @@ -2,7 +2,7 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists using node fs module. */ -export declare class LokiFSStorage implements StorageAdapter { +export declare class FSStorage implements StorageAdapter { /** * Registers the fs storage as plugin. */ @@ -32,4 +32,3 @@ export declare class LokiFSStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiFSStorage; diff --git a/dist/packages/full-text-search/types/fs-storage/src/index.d.ts b/dist/packages/full-text-search/types/fs-storage/src/index.d.ts new file mode 100644 index 00000000..e6b33d6c --- /dev/null +++ b/dist/packages/full-text-search/types/fs-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { FSStorage } from "./fs_storage"; +export { FSStorage }; +export default FSStorage; diff --git a/dist/packages/full-text-search/types/full-text-search-language-de/src/index.d.ts b/dist/packages/full-text-search/types/full-text-search-language-de/src/index.d.ts new file mode 100644 index 00000000..a2665427 --- /dev/null +++ b/dist/packages/full-text-search/types/full-text-search-language-de/src/index.d.ts @@ -0,0 +1,3 @@ +import { DE } from "./de"; +export { DE }; +export default DE; diff --git a/dist/packages/full-text-search/types/full-text-search-language-en/src/index.d.ts b/dist/packages/full-text-search/types/full-text-search-language-en/src/index.d.ts new file mode 100644 index 00000000..8313cf98 --- /dev/null +++ b/dist/packages/full-text-search/types/full-text-search-language-en/src/index.d.ts @@ -0,0 +1,3 @@ +import { EN } from "./en"; +export { EN }; +export default EN; diff --git a/dist/packages/full-text-search/types/full-text-search-language/src/index.d.ts b/dist/packages/full-text-search/types/full-text-search-language/src/index.d.ts new file mode 100644 index 00000000..e52d1a42 --- /dev/null +++ b/dist/packages/full-text-search/types/full-text-search-language/src/index.d.ts @@ -0,0 +1 @@ +export { generateStopWordFilter, generateTrimmer, Among, SnowballProgram } from "./language"; diff --git a/dist/packages/full-text-search/types/full-text-search/src/full_text_search.d.ts b/dist/packages/full-text-search/types/full-text-search/src/full_text_search.d.ts index a4752c88..65a26bef 100644 --- a/dist/packages/full-text-search/types/full-text-search/src/full_text_search.d.ts +++ b/dist/packages/full-text-search/types/full-text-search/src/full_text_search.d.ts @@ -2,7 +2,7 @@ import { InvertedIndex } from "./inverted_index"; import { Tokenizer } from "./tokenizer"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; export declare class FullTextSearch { private _id; private _docs; @@ -21,14 +21,14 @@ export declare class FullTextSearch { * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized * (requires more memory but performs better) * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field - * @param {string=$loki} id - the property name of the document index + * @param {string} [id] - the property name of the document index */ constructor(fields?: FullTextSearch.FieldOptions[], id?: string); addDocument(doc: object, id?: number): void; removeDocument(doc: object, id?: number): void; updateDocument(doc: object, id?: number): void; clear(): void; - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; toJSON(): FullTextSearch.Serialization; static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers?: Dict): FullTextSearch; } diff --git a/dist/packages/full-text-search/types/full-text-search/src/index.d.ts b/dist/packages/full-text-search/types/full-text-search/src/index.d.ts index f03dde09..b901b108 100644 --- a/dist/packages/full-text-search/types/full-text-search/src/index.d.ts +++ b/dist/packages/full-text-search/types/full-text-search/src/index.d.ts @@ -1,6 +1,5 @@ import { FullTextSearch } from "./full_text_search"; -export { Tokenizer } from "./tokenizer"; -export { QueryBuilder } from "./query_builder"; -export { InvertedIndex } from "./inverted_index"; -export { FullTextSearch }; +import { Tokenizer } from "./tokenizer"; +import { QueryBuilder } from "./query_builder"; +export { FullTextSearch, Tokenizer, QueryBuilder }; export default FullTextSearch; diff --git a/dist/packages/full-text-search/types/full-text-search/src/index_searcher.d.ts b/dist/packages/full-text-search/types/full-text-search/src/index_searcher.d.ts index d3cf7f93..00b99f2f 100644 --- a/dist/packages/full-text-search/types/full-text-search/src/index_searcher.d.ts +++ b/dist/packages/full-text-search/types/full-text-search/src/index_searcher.d.ts @@ -1,4 +1,4 @@ -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; import { InvertedIndex } from "./inverted_index"; import { Query } from "./query_builder"; import { Dict } from "../../common/types"; @@ -13,9 +13,9 @@ export declare class IndexSearcher { * @param {object} invIdxs */ constructor(invIdxs: Dict, docs: Set); - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; setDirty(): void; private _recursive(query, doScoring); - private _getUnique(queries, doScoring, docResults); + private _getUnique(queries, doScoring, queryResults); private _getAll(queries, doScoring); } diff --git a/dist/packages/full-text-search/types/full-text-search/src/query_builder.d.ts b/dist/packages/full-text-search/types/full-text-search/src/query_builder.d.ts index 923317f6..6f324e15 100644 --- a/dist/packages/full-text-search/types/full-text-search/src/query_builder.d.ts +++ b/dist/packages/full-text-search/types/full-text-search/src/query_builder.d.ts @@ -24,8 +24,8 @@ export declare class BaseQueryBuilder { */ build(): any; } -export interface BaseQuery { - type: string; +export interface BaseQuery { + type: Type; boost?: number; } /** @@ -51,7 +51,7 @@ export declare class TermQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, term: string, data?: any); } -export interface TermQuery extends BaseQuery { +export interface TermQuery extends BaseQuery<"term"> { field: string; value: string; } @@ -78,7 +78,7 @@ export declare class TermsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, terms: Array, data?: any); } -export interface TermsQuery extends BaseQuery { +export interface TermsQuery extends BaseQuery<"terms"> { field: string; value: string[]; } @@ -119,7 +119,7 @@ export declare class WildcardQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface WildcardQuery extends BaseQuery { +export interface WildcardQuery extends BaseQuery<"wildcard"> { field: string; value: string; enable_scoring?: boolean; @@ -169,7 +169,7 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { * * @return {FuzzyQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the initial word length. * @param {number} prefixLength - the positive prefix length @@ -183,10 +183,10 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface FuzzyQuery extends BaseQuery { +export interface FuzzyQuery extends BaseQuery<"fuzzy"> { field: string; value: string; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -221,7 +221,7 @@ export declare class PrefixQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface PrefixQuery extends BaseQuery { +export interface PrefixQuery extends BaseQuery<"prefix"> { field: string; value: string; enable_scoring?: boolean; @@ -247,7 +247,7 @@ export declare class ExistsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, data?: any); } -export interface ExistsQuery extends BaseQuery { +export interface ExistsQuery extends BaseQuery<"exists"> { field: string; } /** @@ -315,7 +315,7 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { * * @return {MatchQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the starting word length which should not be considered for fuzziness. * @param {number} prefixLength - the positive prefix length @@ -329,12 +329,12 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface MatchQuery extends BaseQuery { +export interface MatchQuery extends BaseQuery<"match"> { field: string; value: string; minimum_should_match?: number; operator?: "and" | "or"; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -360,7 +360,7 @@ export interface MatchQuery extends BaseQuery { export declare class MatchAllQueryBuilder extends BaseQueryBuilder { constructor(data?: any); } -export interface MatchQueryAll extends BaseQuery { +export interface MatchQueryAll extends BaseQuery<"match_all"> { } /** * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter. @@ -388,9 +388,11 @@ export declare class ConstantScoreQueryBuilder extends BaseQueryBuilder { * Starts an array of queries. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): ConstantScoreQueryBuilder; + }; } -export interface ConstantScoreQuery extends BaseQuery { +export interface ConstantScoreQuery extends BaseQuery<"constant_score"> { filter: ArrayQuery; } /** @@ -442,22 +444,30 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { * Starts an array of queries for must clause. Use endMust() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginMust(): ArrayQueryBuilder; + beginMust(): ArrayQueryBuilder & { + endMust(): BoolQueryBuilder; + }; /** * Starts an array of queries for filter clause. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): BoolQueryBuilder; + }; /** * Starts an array of queries for should clause. Use endShould() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginShould(): ArrayQueryBuilder; + beginShould(): ArrayQueryBuilder & { + endShould(): BoolQueryBuilder; + }; /** * Starts an array of queries for not clause. Use endNot() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginNot(): ArrayQueryBuilder; + beginNot(): ArrayQueryBuilder & { + endNot(): BoolQueryBuilder; + }; /** * Controls the amount of minimum matching sub queries before a document will be considered. * @param {number} minShouldMatch - number of minimum matching sub queries @@ -472,7 +482,7 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { */ minimumShouldMatch(minShouldMatch: number): this; } -export interface BoolQuery extends BaseQuery { +export interface BoolQuery extends BaseQuery<"bool"> { must?: ArrayQuery; filter?: ArrayQuery; should?: ArrayQuery; @@ -497,8 +507,8 @@ export declare class ArrayQueryBuilder extends BaseQueryBuilder { prefix(field: string, prefix: string): any; exists(field: string): any; } -export interface ArrayQuery { - values: any[]; +export interface ArrayQuery extends BaseQuery<"array"> { + values: QueryTypes[]; } /** * This query builder is the root of each query search. @@ -525,9 +535,15 @@ export declare class QueryBuilder { /** * The query performs a final scoring over all scored sub queries. * @param {boolean} enable - flag to enable or disable final scoring - * @return {QueryBuilder} + * @return {this} */ enableFinalScoring(enable: boolean): this; + /** + * Adds an explanation of the scoring of each document for all matched terms. + * @param {boolean} enable -flag to enable or disable explanation + * @returns {this} + */ + explain(enable: boolean): this; /** * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model. * @@ -535,10 +551,10 @@ export declare class QueryBuilder { * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}. * * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation. - * Lower values result in quicker saturation, and higher values in slower saturation. + * Lower values result in quicker saturation, and higher values in slower saturation * @param {number} [b=0.75] - controls how much effect field-length normalization should have. - * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully. - * @return {QueryBuilder} + * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully + * @return {this} */ BM25Similarity(k1?: number, b?: number): this; bool(): BoolQueryBuilder; @@ -553,9 +569,11 @@ export declare class QueryBuilder { exists(field: string): ExistsQueryBuilder; private _prepare(queryType, ...args); } +export declare type QueryTypes = BoolQuery | ConstantScoreQuery | TermQuery | TermsQuery | WildcardQuery | FuzzyQuery | MatchQuery | MatchQueryAll | PrefixQuery | ExistsQuery; export interface Query { - query: any; + query: QueryTypes; final_scoring?: boolean; + explain?: boolean; bm25?: { k1: number; b: number; diff --git a/dist/packages/full-text-search/types/full-text-search/src/scorer.d.ts b/dist/packages/full-text-search/types/full-text-search/src/scorer.d.ts index aed3e619..dacdc753 100644 --- a/dist/packages/full-text-search/types/full-text-search/src/scorer.d.ts +++ b/dist/packages/full-text-search/types/full-text-search/src/scorer.d.ts @@ -1,7 +1,6 @@ import { InvertedIndex } from "./inverted_index"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -export declare type ScoreResult = Dict; /** * @hidden */ @@ -10,9 +9,9 @@ export declare class Scorer { private _cache; constructor(invIdxs: Dict); setDirty(): void; - score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, docResults: Scorer.DocResults, term: number[]): void; - scoreConstant(boost: number, docId: number, docResults: Scorer.DocResults): Map; - finalScore(query: Query, docResults: Scorer.DocResults): ScoreResult; + score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, queryResults: Scorer.QueryResults, term: number[]): void; + scoreConstant(boost: number, docId: number, queryResults: Scorer.QueryResults): Map; + finalScore(query: Query, queryResults: Scorer.QueryResults): Scorer.ScoreResult; private static _calculateFieldLength(fieldLength); private _getCache(fieldName); /** @@ -30,12 +29,33 @@ export declare namespace Scorer { idfs: Dict; avgFieldLength: number; } - interface DocResult { + interface QueryResult { tf?: number; idf?: number; boost: number; fieldName?: string; term?: number[]; } - type DocResults = Map; + type QueryResults = Map; + interface BM25Explanation { + boost: number; + score: number; + docID: number; + fieldName: string; + index: string; + idf: number; + tfNorm: number; + tf: number; + fieldLength: number; + avgFieldLength: number; + } + interface ConstantExplanation { + boost: number; + score: number; + } + type ScoreExplanation = BM25Explanation | ConstantExplanation; + type ScoreResult = Dict<{ + score: number; + explanation?: ScoreExplanation[]; + }>; } diff --git a/dist/packages/full-text-search/types/indexed-storage/src/index.d.ts b/dist/packages/full-text-search/types/indexed-storage/src/index.d.ts new file mode 100644 index 00000000..bf453632 --- /dev/null +++ b/dist/packages/full-text-search/types/indexed-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { IndexedStorage } from "./indexed_storage"; +export { IndexedStorage }; +export default IndexedStorage; diff --git a/dist/packages/full-text-search/types/indexed-storage/src/indexed_storage.d.ts b/dist/packages/full-text-search/types/indexed-storage/src/indexed_storage.d.ts index 457b01a0..adaeaef1 100644 --- a/dist/packages/full-text-search/types/indexed-storage/src/indexed_storage.d.ts +++ b/dist/packages/full-text-search/types/indexed-storage/src/indexed_storage.d.ts @@ -6,7 +6,7 @@ import { StorageAdapter } from "../../common/types"; * IndexedDb storage is provided per-domain, so we implement app/key/value database to * allow separate contexts for separate apps within a domain. */ -export declare class LokiIndexedStorage implements StorageAdapter { +export declare class IndexedStorage implements StorageAdapter { private _appname; private catalog; /** @@ -98,4 +98,4 @@ export interface Entry { key: string; size: number; } -export default LokiIndexedStorage; +export default IndexedStorage; diff --git a/dist/packages/full-text-search/types/local-storage/src/index.d.ts b/dist/packages/full-text-search/types/local-storage/src/index.d.ts new file mode 100644 index 00000000..2b74e8c0 --- /dev/null +++ b/dist/packages/full-text-search/types/local-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { LocalStorage } from "./local_storage"; +export { LocalStorage }; +export default LocalStorage; diff --git a/dist/packages/full-text-search/types/local-storage/src/local_storage.d.ts b/dist/packages/full-text-search/types/local-storage/src/local_storage.d.ts index 2337eb12..380d8be9 100644 --- a/dist/packages/full-text-search/types/local-storage/src/local_storage.d.ts +++ b/dist/packages/full-text-search/types/local-storage/src/local_storage.d.ts @@ -1,9 +1,9 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists to web browser's local storage object - * @constructor LokiLocalStorageAdapter + * @constructor LocalStorageAdapter */ -export declare class LokiLocalStorage implements StorageAdapter { +export declare class LocalStorage implements StorageAdapter { /** * Registers the local storage as plugin. */ @@ -33,4 +33,4 @@ export declare class LokiLocalStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiLocalStorage; +export default LocalStorage; diff --git a/dist/packages/full-text-search/types/loki/src/clone.d.ts b/dist/packages/full-text-search/types/loki/src/clone.d.ts index 03b650d7..c74a17bd 100644 --- a/dist/packages/full-text-search/types/loki/src/clone.d.ts +++ b/dist/packages/full-text-search/types/loki/src/clone.d.ts @@ -1,10 +1,4 @@ -export declare enum CloneMethod { - PARSE_STRINGIFY = 0, - DEEP = 1, - SHALLOW = 2, - SHALLOW_ASSIGN = 3, - SHALLOW_RECURSE_OBJECTS = 4, -} +export declare type CloneMethod = "parse-stringify" | "deep" | "shallow" | "shallow-recurse-objects"; /** * @hidden */ diff --git a/dist/packages/full-text-search/types/loki/src/collection.d.ts b/dist/packages/full-text-search/types/loki/src/collection.d.ts index 8b44c82f..9bd5e091 100644 --- a/dist/packages/full-text-search/types/loki/src/collection.d.ts +++ b/dist/packages/full-text-search/types/loki/src/collection.d.ts @@ -1,34 +1,39 @@ import { LokiEventEmitter } from "./event_emitter"; import { UniqueIndex } from "./unique_index"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { DynamicView } from "./dynamic_view"; import { CloneMethod } from "./clone"; -import { Doc, Dict, Query } from "../../common/types"; +import { Doc, Dict } from "../../common/types"; import { FullTextSearch } from "../../full-text-search/src/full_text_search"; import { Tokenizer } from "../../full-text-search/src/tokenizer"; -export declare type ANY = any; export { CloneMethod } from "./clone"; /** * Collection class that handles documents of same type * @extends LokiEventEmitter + * @param - the data type + * @param - nested properties of data type */ -export declare class Collection extends LokiEventEmitter { +export declare class Collection extends LokiEventEmitter { name: string; - data: Doc[]; + _data: Doc[]; private idIndex; - binaryIndices: Dict; + binaryIndices: { + [P in keyof TData]?: Collection.BinaryIndex; + }; /** - * Unique contraints contain duplicate object references, so they are not persisted. - * We will keep track of properties which have unique contraint applied here, and regenerate on load. + * Unique constraints contain duplicate object references, so they are not persisted. + * We will keep track of properties which have unique constraints applied here, and regenerate on load. */ constraints: { - unique: {}; + unique: { + [P in keyof TData]?: UniqueIndex; + }; }; /** * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along * with the database. */ - transforms: {}; + transforms: Dict[]>; /** * In autosave scenarios we will use collection level dirty flags to determine whether save is needed. * currently, if any collection is dirty we will autosave the whole database if autosave is configured. @@ -62,7 +67,7 @@ export declare class Collection extends LokiEventEmit /** * Disable delta update object style on changes. */ - disableDeltaChangesApi: ANY; + disableDeltaChangesApi: boolean; /** * By default, if you insert a document into a collection with binary indices, if those indexed properties contain * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the @@ -72,7 +77,7 @@ export declare class Collection extends LokiEventEmit /** * Option to activate a cleaner daemon - clears "aged" documents at set intervals. */ - ttl: ANY; + ttl: Collection.TTL; private maxId; private _dynamicViews; /** @@ -81,7 +86,15 @@ export declare class Collection extends LokiEventEmit private changes; private insertHandler; private updateHandler; - console: ANY; + console: { + log(...args: any[]): void; + warn(...args: any[]): void; + error(...args: any[]): void; + }; + /** + * stages: a map of uniquely identified 'stages', which hold copies of objects to be + * manipulated without affecting the data in the original collection + */ private stages; private commitLog; _fullTextSearch: FullTextSearch; @@ -97,69 +110,50 @@ export declare class Collection extends LokiEventEmit * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable - * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method + * @param {string} [options.cloneMethod="deep"] - the clone method * @param {number} [options.transactional=false] - ? * @param {number} options.ttl - ? * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @see {@link Loki#addCollection} for normal creation of collections */ - constructor(name: string, options?: Collection.Options); - toJSON(): { - name: string; - _dynamicViews: DynamicView[]; - uniqueNames: string[]; - transforms: {}; - binaryIndices: Dict; - data: Doc[]; - idIndex: number[]; - maxId: number; - dirty: boolean; - adaptiveBinaryIndices: boolean; - transactional: boolean; - asyncListeners: boolean; - disableChangesApi: boolean; - cloneObjects: boolean; - cloneMethod: CloneMethod; - changes: any[]; - _fullTextSearch: FullTextSearch; - }; - static fromJSONObject(obj: ANY, options?: Collection.DeserializeOptions): Collection; + constructor(name: string, options?: Collection.Options); + toJSON(): Collection.Serialized; + static fromJSONObject(obj: Collection.Serialized, options?: Collection.DeserializeOptions): Collection; /** * Adds a named collection transform to the collection * @param {string} name - name to associate with transform * @param {array} transform - an array of transformation 'step' objects to save into the collection */ - addTransform(name: string, transform: ANY[]): void; + addTransform(name: string, transform: Collection.Transform[]): void; /** * Retrieves a named transform from the collection. * @param {string} name - name of the transform to lookup. */ - getTransform(name: string): any; + getTransform(name: string): Collection.Transform[]; /** * Updates a named collection transform to the collection * @param {string} name - name to associate with transform * @param {object} transform - a transformation object to save into collection */ - setTransform(name: string, transform: ANY[]): void; + setTransform(name: string, transform: Collection.Transform[]): void; /** * Removes a named collection transform from the collection * @param {string} name - name of collection transform to remove */ removeTransform(name: string): void; - ttlDaemonFuncGen(): () => void; private setTTL(age, interval); /** * create a row filter that covers all documents in the collection */ - prepareFullDocIndex(): any[]; + _prepareFullDocIndex(): number[]; /** * Ensure binary index on a certain field * @param {string} property - name of property to create binary index on - * @param {boolean} force - (Optional) flag indicating whether to construct index immediately + * @param {boolean} [force=false] - flag indicating whether to construct index immediately */ - ensureIndex(property: string, force?: boolean): void; - getSequencedIndexValues(property: string): string; - ensureUniqueIndex(field: string): UniqueIndex; + ensureIndex(property: keyof TData, force?: boolean): void; + getSequencedIndexValues(property: keyof TData): string; + ensureUniqueIndex(field: keyof TData): UniqueIndex; /** * Ensure all binary indices */ @@ -171,11 +165,11 @@ export declare class Collection extends LokiEventEmit * @param {object} query - (optional) query object to count results of * @returns {number} number of documents in the collection */ - count(query?: object): number; + count(query?: ResultSet.Query & TNested>): number; /** * Rebuild idIndex */ - ensureId(): void; + private _ensureId(); /** * Add a dynamic view to the collection * @param {string} name - name of dynamic view to add @@ -185,7 +179,7 @@ export declare class Collection extends LokiEventEmit * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here) * @returns {DynamicView} reference to the dynamic view added **/ - addDynamicView(name: string, options?: DynamicView.Options): DynamicView; + addDynamicView(name: string, options?: DynamicView.Options): DynamicView; /** * Remove a dynamic view from the collection * @param {string} name - name of dynamic view to remove @@ -196,7 +190,7 @@ export declare class Collection extends LokiEventEmit * @param {string} name - name of dynamic view to retrieve reference of * @returns {DynamicView} A reference to the dynamic view with that name **/ - getDynamicView(name: string): DynamicView; + getDynamicView(name: string): DynamicView; /** * Applies a 'mongo-like' find query object and passes all results to an update function. * For filter function querying you should migrate to [ @@ -205,38 +199,39 @@ export declare class Collection extends LokiEventEmit * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode) * @param {function} updateFunction - update function to run against filtered documents */ - findAndUpdate(filterObject: Query | ((obj: E) => boolean), updateFunction: (obj: E) => E): void; + findAndUpdate(filterObject: ResultSet.Query & TNested> | ((obj: Doc) => boolean), updateFunction: (obj: Doc) => any): void; /** * Applies a 'mongo-like' find query object removes all documents which match that filter. * * @param {object} filterObject - 'mongo-like' query object */ - findAndRemove(filterObject: object): void; + findAndRemove(filterObject: ResultSet.Query & TNested>): void; /** * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc. * @param {(object|array)} doc - the document (or array of documents) to be inserted * @returns {(object|array)} document or documents inserted */ - insert(doc: E | E[]): Doc; - insert(doc: E[]): Doc[]; + insert(doc: TData): Doc; + insert(doc: TData[]): Doc[]; /** * Adds a single object, ensures it has meta properties, clone it if necessary, etc. * @param {object} doc - the document to be inserted * @param {boolean} bulkInsert - quiet pre-insert and insert event emits * @returns {object} document or 'undefined' if there was a problem inserting it */ - insertOne(doc: E, bulkInsert?: boolean): Doc; + insertOne(doc: TData, bulkInsert?: boolean): Doc; /** * Empties the collection. - * @param {object} options - configure clear behavior - * @param {boolean} options.removeIndices - (default: false) + * @param {boolean} [removeIndices=false] - remove indices */ - clear(options?: ANY): void; + clear({removeIndices: removeIndices}?: { + removeIndices?: boolean; + }): void; /** * Updates an object and notifies collection that the document has changed. * @param {object} doc - document to update within the collection */ - update(doc: ANY): any; + update(doc: Doc | Doc[]): void; /** * Add object to collection */ @@ -247,24 +242,24 @@ export declare class Collection extends LokiEventEmit * @param {function} filterFunction - filter function whose results will execute update * @param {function} updateFunction - update function to run against filtered documents */ - updateWhere(filterFunction: (obj: E) => boolean, updateFunction: (obj: E) => E): void; + updateWhere(filterFunction: (obj: Doc) => boolean, updateFunction: (obj: Doc) => any): void; /** * Remove all documents matching supplied filter function. * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}. * @param {function|object} query - query object to filter on */ - removeWhere(query: Query | ((obj: E) => boolean)): void; + removeWhere(query: ResultSet.Query & TNested> | ((obj: Doc) => boolean)): void; removeDataOnly(): void; /** * Remove a document from the collection - * @param {object} doc - document to remove from collection + * @param {number|object} doc - document to remove from collection */ - remove(doc: ANY): any; + remove(doc: number | Doc | Doc[]): void; /** * Returns all changes. - * @returns {ANY} + * @returns {Collection.Change[]} */ - getChanges(): any[]; + getChanges(): Collection.Change[]; /** * Enables/disables changes api. * @param {boolean} disableChangesApi @@ -301,34 +296,35 @@ export declare class Collection extends LokiEventEmit * @returns {(object|array|null)} Object reference if document was found, null if not, * or an array if 'returnPosition' was passed. */ - get(id: number): Doc; - get(id: number, returnPosition: boolean): Doc | [Doc, number]; + get(id: number): Doc; + get(id: number, returnPosition: boolean): Doc | [Doc, number]; /** * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value * Since multiple documents may contain the same value (which the index is sorted on), * we hone in on range and then linear scan range to find exact index array position. - * @param {int} dataPosition : coll.data array index/position + * @param {int} dataPosition : data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - getBinaryIndexPosition(dataPosition: number, binaryIndexName: string): number; + getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData): number; /** * Adaptively insert a selected item to the index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively update a selected item within an index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively remove a selected item from the index. - * @param {int} dataPosition : coll.data array index/position + * @param {number} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in + * @param {boolean} removedFromIndexOnly - remove from index only */ - adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: string, removedFromIndexOnly?: boolean): ANY; + adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly?: boolean): void; /** * Internal method used for index maintenance and indexed searching. * Calculates the beginning of an index range for a given value. @@ -351,7 +347,7 @@ export declare class Collection extends LokiEventEmit private _calculateRangeEnd(prop, val); /** * Binary Search utility method to find range/segment of values matching criteria. - * this is used for collection.find() and first find filter of resultset/dynview + * this is used for collection.find() and first find filter of ResultSet/dynview * slightly different than get() binary search in that get() hones in on 1 value, * but we have to hone in on many (range) * @param {string} op - operation, such as $eq @@ -359,29 +355,29 @@ export declare class Collection extends LokiEventEmit * @param {object} val - value to use for range calculation. * @returns {array} [start, end] index array positions */ - calculateRange(op: string, prop: string, val: ANY): [number, number]; + calculateRange(op: string, prop: keyof TData, val: any): [number, number]; /** * Retrieve doc by Unique index * @param {string} field - name of uniquely indexed property to use when doing lookup * @param {any} value - unique value to search for * @returns {object} document matching the value passed */ - by(field: string, value: ANY): Doc; + by(field: string, value: any): Doc; /** * Find one object by index property, by property equal to value * @param {object} query - query object used to perform search with * @returns {(object|null)} First matching document, or null if none */ - findOne(query: object): Doc; + findOne(query: ResultSet.Query & TNested>): Doc; /** * Chain method, used for beginning a series of chained find() and/or view() operations * on a collection. * * @param {array} transform - Ordered array of transform step objects similar to chain * @param {object} parameters - Object containing properties representing parameters to substitute - * @returns {Resultset} (this) resultset, or data array if any map or join functions where called + * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called */ - chain(transform?: string | ANY[], parameters?: ANY): Resultset; + chain(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** * Find method, api is similar to mongodb. * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}. @@ -389,20 +385,26 @@ export declare class Collection extends LokiEventEmit * @param {object} query - 'mongo-like' query object * @returns {array} Array of matching documents */ - find(query?: Query): Doc[]; + find(query?: ResultSet.Query & TNested>): Doc[]; /** * Find object by unindexed field by property equal to value, * simply iterates and returns the first element matching the query */ - findOneUnindexed(prop: string, value: ANY): Doc; + findOneUnindexed(prop: string, value: any): Doc; /** * Transaction methods */ - /** start the transation */ + /** + * start the transation + */ startTransaction(): void; - /** commit the transation */ + /** + * commit the transation + */ commit(): void; - /** roll back the transation */ + /** + * roll back the transation + */ rollback(): void; /** * Query the collection by supplying a javascript filter function. @@ -414,14 +416,14 @@ export declare class Collection extends LokiEventEmit * @param {function} fun - filter function to run against all collection docs * @returns {array} all documents which pass your filter function */ - where(fun: (obj: E) => boolean): Doc[]; + where(fun: (obj: Doc) => boolean): Doc[]; /** * Map Reduce operation * @param {function} mapFunction - function to use as map function * @param {function} reduceFunction - function to use as reduce function * @returns {data} The result of your mapReduce operation */ - mapReduce(mapFunction: (value: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (value: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Join two collections on specified properties * @@ -429,13 +431,13 @@ export declare class Collection extends LokiEventEmit * @param {string} leftJoinProp - property name in collection * @param {string} rightJoinProp - property name in joinData * @param {function} mapFun - (Optional) map function to use - * @returns {Resultset} Result of the mapping operation - */ - eqJoin(joinData: ANY[], leftJoinProp: string, rightJoinProp: string, mapFun?: Function): Resultset; - /** - * stages: a map of uniquely identified 'stages', which hold copies of objects to be - * manipulated without affecting the data in the original collection + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method + * @returns {ResultSet} Result of the mapping operation */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinProp: string | ((obj: any) => string), rightJoinProp: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * (Staging API) create a stage and/or retrieve it */ @@ -446,7 +448,7 @@ export declare class Collection extends LokiEventEmit /** * (Staging API) create a copy of an object and insert it into a stage */ - stage(stageName: string, obj: ANY): any; + stage(stageName: string, obj: Doc): F; /** * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt * then create a message to be inserted in the commitlog @@ -459,10 +461,10 @@ export declare class Collection extends LokiEventEmit extract(field: string): any[]; /** */ - max(field: string): any; + max(field: string): number; /** */ - min(field: string): any; + min(field: string): number; /** */ maxRecord(field: string): { @@ -500,9 +502,9 @@ export declare class Collection extends LokiEventEmit median(field: string): number; } export declare namespace Collection { - interface Options { - unique?: string[]; - indices?: string[]; + interface Options { + unique?: (keyof TData)[]; + indices?: (keyof TData)[]; adaptiveBinaryIndices?: boolean; asyncListeners?: boolean; disableChangesApi?: boolean; @@ -518,10 +520,89 @@ export declare namespace Collection { interface DeserializeOptions { retainDirtyFlags?: boolean; fullTextSearch?: Dict; + [collName: string]: any | { + proto?: any; + inflate?: (src: object, dest?: object) => void; + }; } interface BinaryIndex { dirty: boolean; values: any; } - type Change = any; + interface Change { + name: string; + operation: string; + obj: any; + } + interface Serialized { + name: string; + _dynamicViews: DynamicView[]; + uniqueNames: string[]; + transforms: Dict; + binaryIndices: Dict; + _data: Doc[]; + idIndex: number[]; + maxId: number; + dirty: boolean; + adaptiveBinaryIndices: boolean; + transactional: boolean; + asyncListeners: boolean; + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + cloneObjects: boolean; + cloneMethod: CloneMethod; + changes: any; + _fullTextSearch: FullTextSearch; + } + type Transform = { + type: "find"; + value: ResultSet.Query & TNested> | string; + } | { + type: "where"; + value: ((obj: Doc) => boolean) | string; + } | { + type: "simplesort"; + property: keyof (TData & TNested); + desc?: boolean; + } | { + type: "compoundsort"; + value: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]; + } | { + type: "sort"; + value: (a: Doc, b: Doc) => number; + } | { + type: "sortByScoring"; + desc?: boolean; + } | { + type: "limit"; + value: number; + } | { + type: "offset"; + value: number; + } | { + type: "map"; + value: (obj: TData, index: number, array: TData[]) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "eqJoin"; + joinData: Collection | ResultSet; + leftJoinKey: string | ((obj: any) => string); + rightJoinKey: string | ((obj: any) => string); + mapFun?: (left: any, right: any) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "mapReduce"; + mapFunction: (item: TData, index: number, array: TData[]) => any; + reduceFunction: (array: any[]) => any; + } | { + type: "update"; + value: (obj: Doc) => any; + } | { + type: "remove"; + }; + interface TTL { + age: number; + ttlInterval: number; + daemon: any; + } } diff --git a/dist/packages/full-text-search/types/loki/src/dynamic_view.d.ts b/dist/packages/full-text-search/types/loki/src/dynamic_view.d.ts index 1aeab3a4..5cda4b13 100644 --- a/dist/packages/full-text-search/types/loki/src/dynamic_view.d.ts +++ b/dist/packages/full-text-search/types/loki/src/dynamic_view.d.ts @@ -1,9 +1,8 @@ import { LokiEventEmitter } from "./event_emitter"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { Collection } from "./collection"; -import { Doc, Filter } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; /** * DynamicView class is a versatile 'live' view class which can have filters and sorts applied. * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it @@ -18,18 +17,21 @@ export declare type ANY = any; * @extends LokiEventEmitter * @see {@link Collection#addDynamicView} to construct instances of DynamicView + * + * @param - the data type + * @param - nested properties of data type */ -export declare class DynamicView extends LokiEventEmitter { +export declare class DynamicView extends LokiEventEmitter { private _collection; private _persistent; private _sortPriority; private _minRebuildInterval; name: string; private _rebuildPending; - private _resultset; - private _resultdata; - private _resultsdirty; - private _cachedresultset; + private _resultSet; + private _resultData; + private _resultDirty; + private _cachedResultSet; private _filterPipeline; private _sortFunction; private _sortCriteria; @@ -41,10 +43,10 @@ export declare class DynamicView extends LokiEventEmi * @param {string} name - the name of this dynamic view * @param {object} options - the options * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' - * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority + * @param {string} [options.sortPriority="passive"] - the sort priority * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here) */ - constructor(collection: Collection, name: string, options?: DynamicView.Options); + constructor(collection: Collection, name: string, options?: DynamicView.Options); /** * Internally used immediately after deserialization (loading) * This will clear out and reapply filterPipeline ops, recreating the view. @@ -57,34 +59,22 @@ export declare class DynamicView extends LokiEventEmi */ _rematerialize({removeWhereFilters}: { removeWhereFilters?: boolean; - }): DynamicView; + }): this; /** - * Makes a copy of the internal resultset for branched queries. - * Unlike this dynamic view, the branched resultset will not be 'live' updated, + * Makes a copy of the internal ResultSet for branched queries. + * Unlike this dynamic view, the branched ResultSet will not be 'live' updated, * so your branched query should be immediately resolved and not held for future evaluation. * * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps * @param {object} parameters - optional parameters (if optional transform requires them) - * @returns {Resultset} A copy of the internal resultset for branched queries. + * @returns {ResultSet} A copy of the internal ResultSet for branched queries. */ - branchResultset(transform: string | any[], parameters?: object): Resultset; + branchResultSet(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** - * toJSON() - Override of toJSON to avoid circular references - * + * Override of toJSON to avoid circular references. */ - toJSON(): { - name: string; - _persistent: boolean; - _sortPriority: DynamicView.SortPriority; - _minRebuildInterval: number; - _resultset: Resultset; - _resultsdirty: boolean; - _filterPipeline: Filter[]; - _sortCriteria: (string | [string, boolean])[]; - _sortByScoring: boolean; - _sortDirty: boolean; - }; - static fromJSONObject(collection: ANY, obj: ANY): DynamicView; + toJSON(): DynamicView.Serialized; + static fromJSONObject(collection: Collection, obj: DynamicView.Serialized): DynamicView; /** * Used to clear pipeline and reset dynamic view to initial state. * Existing options should be retained. @@ -105,7 +95,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} comparefun - a javascript compare function used for sorting * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySort(comparefun: (lhs: E, rhs: E) => number): DynamicView; + applySort(comparefun: (lhs: Doc, rhs: Doc) => number): this; /** * Used to specify a property used for view translation. * @example @@ -115,9 +105,9 @@ export declare class DynamicView extends LokiEventEmi * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySimpleSort(propname: string, isdesc?: boolean): DynamicView; + applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * dv.applySortCriteria(['age', 'name']); @@ -129,32 +119,32 @@ export declare class DynamicView extends LokiEventEmi * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations. */ - applySortCriteria(criteria: (string | [string, boolean])[]): DynamicView; + applySortCriteria(criteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Used to apply a sort by the latest full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending */ - applySortByScoring(ascending?: boolean): DynamicView; + applySortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** * Marks the beginning of a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - startTransaction(): DynamicView; + startTransaction(): this; /** * Commits a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - commit(): DynamicView; + commit(): this; /** * Rolls back a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - rollback(): DynamicView; + rollback(): this; /** * Find the index of a filter in the pipeline, by that filter's ID. * @@ -163,7 +153,7 @@ export declare class DynamicView extends LokiEventEmi */ private _indexOfFilterWithId(uid); /** - * Add the filter object to the end of view's filter pipeline and apply the filter to the resultset. + * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet. * * @param {object} filter - The filter object. Refer to applyFilter() for extra details. */ @@ -173,7 +163,7 @@ export declare class DynamicView extends LokiEventEmi * * @returns {DynamicView} this DynamicView object, for further chain ops. */ - reapplyFilters(): DynamicView; + reapplyFilters(): this; /** * Adds or updates a filter in the DynamicView filter pipeline * @@ -181,7 +171,7 @@ export declare class DynamicView extends LokiEventEmi * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id } * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFilter(filter: Filter): DynamicView; + applyFilter(filter: DynamicView.Filter): this; /** * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline * @@ -189,7 +179,7 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFind(query: object, uid?: string | number): DynamicView; + applyFind(query: object, uid?: string | number): this; /** * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline * @@ -197,14 +187,14 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyWhere(fun: (obj: E) => boolean, uid?: string | number): DynamicView; + applyWhere(fun: (obj: Doc) => boolean, uid?: string | number): this; /** * removeFilter() - Remove the specified filter from the DynamicView filter pipeline * * @param {(string|number)} uid - The unique ID of the filter to be removed. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - removeFilter(uid: string | number): DynamicView; + removeFilter(uid: string | number): this; /** * Returns the number of documents representing the current DynamicView contents. * @returns {number} The number of documents representing the current DynamicView contents. @@ -213,16 +203,16 @@ export declare class DynamicView extends LokiEventEmi /** * Resolves and pending filtering and sorting, then returns document array as result. * - * @param {object} options - optional parameters to pass to resultset.data() if non-persistent - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * * @returns {Array} An array of documents representing the current DynamicView contents. */ - data(options?: object): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** * When the view is not sorted we may still wish to be notified of rebuild events. * This event will throttle and queue a single rebuild event when batches of updates affect the view. @@ -257,7 +247,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; } export declare namespace DynamicView { interface Options { @@ -265,8 +255,25 @@ export declare namespace DynamicView { sortPriority?: SortPriority; minRebuildInterval?: number; } - enum SortPriority { - PASSIVE = 0, - ACTIVE = 1, + type SortPriority = "passive" | "active"; + interface Serialized { + name: string; + _persistent: boolean; + _sortPriority: SortPriority; + _minRebuildInterval: number; + _resultSet: ResultSet; + _filterPipeline: Filter[]; + _sortCriteria: (string | [string, boolean])[]; + _sortByScoring: boolean; + _sortDirty: boolean; } + type Filter = { + type: "find"; + val: ResultSet.Query & TNested>; + uid: number | string; + } | { + type: "where"; + val: (obj: Doc) => boolean; + uid: number | string; + }; } diff --git a/dist/packages/full-text-search/types/loki/src/event_emitter.d.ts b/dist/packages/full-text-search/types/loki/src/event_emitter.d.ts index f422ee35..e55515e9 100644 --- a/dist/packages/full-text-search/types/loki/src/event_emitter.d.ts +++ b/dist/packages/full-text-search/types/loki/src/event_emitter.d.ts @@ -1,4 +1,3 @@ -export declare type ANY = any; /** * LokiEventEmitter is a minimalist version of EventEmitter. It enables any * constructor that inherits EventEmitter to emit events and trigger @@ -31,7 +30,7 @@ export declare class LokiEventEmitter { * @param {string} eventName - the name of the event * @param {object} data - optional object passed with the event */ - emit(eventName: string, ...data: ANY[]): void; + emit(eventName: string, ...data: any[]): void; /** * Alias of LokiEventEmitter.prototype.on * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event diff --git a/dist/packages/full-text-search/types/loki/src/helper.d.ts b/dist/packages/full-text-search/types/loki/src/helper.d.ts index b187e0eb..44b72305 100644 --- a/dist/packages/full-text-search/types/loki/src/helper.d.ts +++ b/dist/packages/full-text-search/types/loki/src/helper.d.ts @@ -1,8 +1,5 @@ /** - * @hidden - */ -export declare type ANY = any; -/** Helper function for determining 'loki' abstract equality which is a little more abstract than == + * Helper function for determining 'loki' abstract equality which is a little more abstract than == * aeqHelper(5, '5') === true * aeqHelper(5.0, '5') === true * aeqHelper(new Date("1/1/2011"), new Date("1/1/2011")) === true @@ -10,34 +7,33 @@ export declare type ANY = any; * aeqHelper([1, 2, 3], [1, 3]) === false * aeqHelper([1, 2, 3], [1, 2, 3]) === true * aeqHelper(undefined, null) === true - */ -/** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @returns {boolean} + * @hidden */ -export declare function aeqHelper(prop1: ANY, prop2: ANY): boolean; -/** Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. +export declare function aeqHelper(prop1: any, prop2: any): boolean; +/** + * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. * In the future we might want $lt and $gt ops to use their own functionality/helper. * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another. * @hidden */ -export declare function ltHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function ltHelper(prop1: any, prop2: any, equal: boolean): boolean; /** * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @param {boolean} equal * @returns {boolean} */ -export declare function gtHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function gtHelper(prop1: any, prop2: any, equal: boolean): boolean; /** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 - * @param {ANY} desc + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} descending * @returns {number} + * @hidden */ -export declare function sortHelper(prop1: ANY, prop2: ANY, desc: ANY): 0 | 1 | -1; +export declare function sortHelper(prop1: any, prop2: any, descending: boolean): number; diff --git a/dist/packages/full-text-search/types/loki/src/index.d.ts b/dist/packages/full-text-search/types/loki/src/index.d.ts index dee82236..17ee6df4 100644 --- a/dist/packages/full-text-search/types/loki/src/index.d.ts +++ b/dist/packages/full-text-search/types/loki/src/index.d.ts @@ -1,7 +1,4 @@ import { Loki } from "./loki"; import { Collection } from "./collection"; export { Loki, Collection }; -declare const _default: { - Loki: typeof Loki; -}; -export default _default; +export default Loki; diff --git a/dist/packages/full-text-search/types/loki/src/loki.d.ts b/dist/packages/full-text-search/types/loki/src/loki.d.ts index 10e81b65..f2deafd2 100644 --- a/dist/packages/full-text-search/types/loki/src/loki.d.ts +++ b/dist/packages/full-text-search/types/loki/src/loki.d.ts @@ -1,7 +1,6 @@ import { LokiEventEmitter } from "./event_emitter"; import { Collection } from "./collection"; import { Doc, StorageAdapter } from "../../common/types"; -export declare type ANY = any; export declare class Loki extends LokiEventEmitter { private filename; private databaseVersion; @@ -23,7 +22,7 @@ export declare class Loki extends LokiEventEmitter { * Constructs the main database class. * @param {string} filename - name of the file to be saved to * @param {object} [options={}] - options - * @param {Loki.Environment} [options.env=auto] - overrides environment detection + * @param {Loki.Environment} [options.env] - the javascript environment * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method * @param {string} [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization * @param {boolean} [options.verbose=false] - enable console output @@ -64,21 +63,21 @@ export declare class Loki extends LokiEventEmitter { * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @returns {Collection} a reference to the collection which was just added */ - addCollection(name: string, options?: Collection.Options): Collection; + addCollection(name: string, options?: Collection.Options): Collection; loadCollection(collection: Collection): void; /** * Retrieves reference to a collection by name. * @param {string} collectionName - name of collection to look up * @returns {Collection} Reference to collection in database by that name, or null if not found */ - getCollection(collectionName: string): Collection; + getCollection(collectionName: string): Collection; /** * Renames an existing loki collection * @param {string} oldName - name of collection to rename * @param {string} newName - new name of collection * @returns {Collection} reference to the newly renamed collection */ - renameCollection(oldName: string, newName: string): Collection<{}>; + renameCollection(oldName: string, newName: string): Collection; listCollections(): { name: string; count: number; @@ -95,20 +94,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {string} Stringified representation of the loki database. */ serialize(options?: Loki.SerializeOptions): string | string[]; - toJSON(): { - _env: Loki.Environment; - _serializationMethod: Loki.SerializationMethod; - _autosave: boolean; - _autosaveInterval: number; - _collections: Collection[]; - databaseVersion: number; - engineVersion: number; - filename: string; - _persistenceAdapter: StorageAdapter; - _persistenceMethod: Loki.PersistenceMethod; - _throttledSaves: boolean; - _verbose: boolean; - }; + toJSON(): Loki.Serialized; /** * Database level destructured JSON serialization routine to allow alternate serialization methods. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -134,7 +120,11 @@ export declare class Loki extends LokiEventEmitter { * * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection. */ - serializeCollection(options?: ANY): string | string[]; + serializeCollection(options?: { + delimited?: boolean; + collectionIndex?: number; + delimiter?: string; + }): string | string[]; /** * Database level destructured JSON deserialization routine to minimize memory overhead. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -150,7 +140,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array */ - deserializeDestructured(destructuredSource: ANY, options?: Loki.SerializeDestructuredOptions): any; + deserializeDestructured(destructuredSource: string | string[], options?: Loki.SerializeDestructuredOptions): any; /** * Collection level utility function to deserializes a destructured collection. * @@ -161,7 +151,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {Array} an array of documents to attach to collection.data. */ - deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc; + deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc[]; /** * Inflates a loki database from a serialized JSON string * @@ -169,15 +159,16 @@ export declare class Loki extends LokiEventEmitter { * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSON(serializedDb: string | string[], options?: ANY): void; + loadJSON(serializedDb: string | string[], options?: Collection.DeserializeOptions): void; /** * Inflates a loki database from a JS object * - * @param {object} dbObject - a serialized loki database string + * @param {object} dbObject - a serialized loki database object * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSONObject(dbObject: ANY, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki.Serialized, options?: Collection.DeserializeOptions): void; /** * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer. * Does not actually destroy the db. @@ -201,7 +192,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {Array} array of changes * @see private method _createChange() in Collection */ - generateChangesNotification(arrayOfCollectionNames?: string[]): any[]; + generateChangesNotification(arrayOfCollectionNames?: string[]): Collection.Change[]; /** * (Changes API) - stringify changes for network transmission * @returns {string} string representation of the changes @@ -310,24 +301,22 @@ export declare namespace Loki { recursiveWaitLimitDuration?: number; started?: Date; } - type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; - enum SerializationMethod { - NORMAL = 0, - PRETTY = 1, - DESTRUCTURED = 2, - } - enum PersistenceMethod { - FS_STORAGE = 0, - LOCAL_STORAGE = 1, - INDEXED_STORAGE = 2, - MEMORY_STORAGE = 3, - ADAPTER = 4, - } - enum Environment { - NODE_JS = 0, - NATIVE_SCRIPT = 1, - BROWSER = 2, - CORDOVA = 3, - MEMORY = 4, + interface Serialized { + _env: Environment; + _serializationMethod: SerializationMethod; + _autosave: boolean; + _autosaveInterval: number; + _collections: Collection[]; + databaseVersion: number; + engineVersion: number; + filename: string; + _persistenceAdapter: StorageAdapter; + _persistenceMethod: PersistenceMethod; + _throttledSaves: boolean; + _verbose: boolean; } + type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; + type SerializationMethod = "normal" | "pretty" | "destructured"; + type PersistenceMethod = "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter"; + type Environment = "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "MEMORY"; } diff --git a/dist/packages/full-text-search/types/loki/src/memory_adapter.d.ts b/dist/packages/full-text-search/types/loki/src/memory_adapter.d.ts deleted file mode 100644 index 7b97c7f7..00000000 --- a/dist/packages/full-text-search/types/loki/src/memory_adapter.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { StorageAdapter } from "../../common/types"; -export declare type ANY = any; -/** - * In in-memory persistence adapter for an in-memory database. - * This simple 'key/value' adapter is intended for unit testing and diagnostics. - */ -export declare class LokiMemoryAdapter implements StorageAdapter { - private hashStore; - private options; - /** - * @param {object} options - memory adapter options - * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) - * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) - * @param {ANY} options - */ - constructor(options?: ANY); - /** - * Loads a serialized database from its in-memory store. - * (Loki persistence adapter interface function) - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was loaded - */ - loadDatabase(dbname: string): Promise; - /** - * Saves a serialized database to its in-memory store. - * (Loki persistence adapter interface function) - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was persisted - */ - saveDatabase(dbname: string, dbstring: string): Promise; - /** - * Deletes a database from its in-memory store. - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was deleted - */ - deleteDatabase(dbname: string): Promise; -} diff --git a/dist/packages/full-text-search/types/loki/src/result_set.d.ts b/dist/packages/full-text-search/types/loki/src/result_set.d.ts new file mode 100644 index 00000000..b29e3a52 --- /dev/null +++ b/dist/packages/full-text-search/types/loki/src/result_set.d.ts @@ -0,0 +1,302 @@ +import { Collection } from "./collection"; +import { CloneMethod } from "./clone"; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; +import { Query as FullTextSearchQuery } from "../../full-text-search/src/query_builder"; +/** + * @hidden + */ +export declare const LokiOps: { + $eq(a: any, b: any): boolean; + $aeq(a: any, b: any): boolean; + $ne(a: any, b: any): boolean; + $dteq(a: any, b: any): boolean; + $gt(a: any, b: any): boolean; + $gte(a: any, b: any): boolean; + $lt(a: any, b: any): boolean; + $lte(a: any, b: any): boolean; + $between(a: any, range: [any, any]): boolean; + $in(a: any, b: any): boolean; + $nin(a: any, b: any): boolean; + $keyin(a: string, b: object): boolean; + $nkeyin(a: string, b: object): boolean; + $definedin(a: string, b: object): boolean; + $undefinedin(a: string, b: object): boolean; + $regex(a: string, b: RegExp): boolean; + $containsString(a: any, b: string): boolean; + $containsNone(a: any, b: any): boolean; + $containsAny(a: any, b: any): boolean; + $contains(a: any, b: any): boolean; + $type(a: any, b: any): boolean; + $finite(a: number, b: boolean): boolean; + $size(a: any, b: any): boolean; + $len(a: any, b: any): boolean; + $where(a: any, b: any): boolean; + $not(a: any, b: any): boolean; + $and(a: any, b: any): boolean; + $or(a: any, b: any): boolean; +}; +/** + * ResultSet class allowing chainable queries. Intended to be instanced internally. + * Collection.find(), Collection.where(), and Collection.chain() instantiate this. + * + * @example + * mycollection.chain() + * .find({ 'doors' : 4 }) + * .where(function(obj) { return obj.name === 'Toyota' }) + * .data(); + * + * @param - the data type + * @param - nested properties of data type + */ +export declare class ResultSet { + _collection: Collection; + _filteredRows: number[]; + _filterInitialized: boolean; + private _scoring; + /** + * Constructor. + * @param {Collection} collection - the collection which this ResultSet will query against + */ + constructor(collection: Collection); + /** + * reset() - Reset the ResultSet to its initial state. + * + * @returns {ResultSet} Reference to this ResultSet, for future chain operations. + */ + reset(): this; + /** + * Override of toJSON to avoid circular references + * + */ + toJSON(): ResultSet; + /** + * Allows you to limit the number of documents passed to next chain operation. + * A ResultSet copy() is made to avoid altering original ResultSet. + * + * @param {int} qty - The number of documents to return. + * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops. + */ + limit(qty: number): this; + /** + * Used for skipping 'pos' number of documents in the ResultSet. + * + * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. + * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops. + */ + offset(pos: number): this; + /** + * copy() - To support reuse of ResultSet in branched query situations. + * + * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same. + */ + copy(): ResultSet; + /** + * Alias of copy() + */ + branch(): ResultSet; + /** + * Executes a named collection transform or raw array of transform steps against the ResultSet. + * + * @param {(string|array)} transform - name of collection transform or raw transform array + * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. + * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps) + */ + transform(transform: string | Collection.Transform[], parameters?: object): this; + /** + * User supplied compare function is provided two documents to compare. (chainable) + * @example + * rslt.sort(function(obj1, obj2) { + * if (obj1.name === obj2.name) return 0; + * if (obj1.name > obj2.name) return 1; + * if (obj1.name < obj2.name) return -1; + * }); + * + * @param {function} comparefun - A javascript compare function used for sorting. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + sort(comparefun: (a: Doc, b: Doc) => number): this; + /** + * Simpler, loose evaluation for user to sort based on a property name. (chainable). + * Sorting based on the same lt/gt helper functions used for binary indices. + * + * @param {string} propname - name of property to sort by. + * @param {boolean} [descending=false] - if true, the property will be sorted in descending order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + simplesort(propname: keyof (TData & TNested), descending?: boolean): this; + /** + * Allows sorting a ResultSet based on multiple columns. + * @example + * // to sort by age and then name (both ascending) + * rs.compoundsort(['age', 'name']); + * // to sort by age (ascending) and then by name (descending) + * rs.compoundsort(['age', ['name', true]); + * + * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + compoundsort(properties: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; + /** + * Helper function for compoundsort(), performing individual object comparisons + * + * @param {Array} properties - array of property names, in order, by which to evaluate sort order + * @param {object} obj1 - first object to compare + * @param {object} obj2 - second object to compare + * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first + */ + private _compoundeval(properties, obj1, obj2); + /** + * Sorts the ResultSet based on the last full-text-search scoring. + * @param {boolean} [ascending=false] - sort ascending + * @returns {ResultSet} + */ + sortByScoring(ascending?: boolean): this; + /** + * Returns the scoring of the last full-text-search. + * @returns {ScoreResult} + */ + getScoring(): Scorer.ScoreResult; + /** + * Oversee the operation of OR'ed query expressions. + * OR'ed expression evaluation runs each expression individually against the full collection, + * and finally does a set OR on each expression's results. + * Each evaluation can utilize a binary index to prevent multiple linear array scans. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findOr(expressionArray: ResultSet.Query & TNested>[]): this; + $or(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Oversee the operation of AND'ed query expressions. + * AND'ed expression evaluation runs each expression progressively against the full collection, + * internally utilizing existing chained ResultSet functionality. + * Only the first filter can utilize a binary index. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findAnd(expressionArray: ResultSet.Query & TNested>[]): this; + $and(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Used for querying via a mongo-style query object. + * + * @param {object} query - A mongo-style query object used for filtering current results. + * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() + * @returns {ResultSet} this ResultSet for further chain ops. + */ + find(query?: ResultSet.Query & TNested>, firstOnly?: boolean): this; + /** + * Used for filtering via a javascript filter function. + * + * @param {function} fun - A javascript function used for filtering current results by. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + where(fun: (obj: Doc) => boolean): this; + /** + * Returns the number of documents in the ResultSet. + * @returns {number} The number of documents in the ResultSet. + */ + count(): number; + /** + * Terminates the chain and returns array of filtered documents + * @param {object} options + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when + * the collection is not configured for clone object. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values 'parse-stringify', 'deep', and 'shallow' and + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents + * + * @returns {Array} Array of documents in the ResultSet + */ + data(options?: ResultSet.DataOptions): Doc[]; + /** + * Used to run an update operation on all documents currently in the ResultSet. + * + * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + update(updateFunction: (obj: Doc) => TData): this; + /** + * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet) + * + * @returns {ResultSet} this (empty) ResultSet for further chain ops. + */ + remove(): this; + /** + * data transformation via user supplied functions + * + * @param {function} mapFunction - this function accepts a single document for you to transform and return + * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value + * @returns {value} The output of your reduceFunction + */ + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; + /** + * Left joining two sets of data. Join keys can be defined or calculated properties + * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key + * @param {Array|ResultSet|Collection} joinData - Data array to join to. + * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on + * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on + * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} + * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method + * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}] + */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinKey: string | ((obj: any) => string), rightJoinKey: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; + /** + * Applies a map function into a new collection for further chaining. + * @param {function} mapFun - javascript map function + * @param {object} [dataOptions=] - options to data() before input to your map function + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method + * @return {ResultSet} + */ + map(mapFun: (obj: TData, index: number, array: TData[]) => U, dataOptions?: ResultSet.DataOptions): ResultSet; +} +export declare namespace ResultSet { + interface DataOptions { + forceClones?: boolean; + forceCloneMethod?: CloneMethod; + removeMeta?: boolean; + } + type LokiOps = { + $eq?: R; + $aeq?: R; + $ne?: R; + $dteq?: R; + $gt?: R; + $gte?: R; + $lt?: R; + $lte?: R; + $between?: [R, R]; + $in?: R[]; + $nin?: R[]; + $keyin?: object; + $nkeyin?: object; + $definedin?: object; + $undefinedin?: object; + $regex?: RegExp | string | [string, string]; + $containsString?: string; + $containsNone?: R[] | R; + $containsAny?: R[] | R; + $contains?: any; + $type?: string; + $finite?: boolean; + $size?: number; + $len?: number; + $where?: (val?: R) => boolean; + }; + type Query = { + [P in keyof TData]?: LokiOps | TData[P]; + } & { + $and?: Query[]; + } & { + $or?: Query[]; + } & { + $fts?: FullTextSearchQuery; + }; +} diff --git a/dist/packages/full-text-search/types/loki/src/resultset.d.ts b/dist/packages/full-text-search/types/loki/src/resultset.d.ts deleted file mode 100644 index 8ee6b343..00000000 --- a/dist/packages/full-text-search/types/loki/src/resultset.d.ts +++ /dev/null @@ -1,262 +0,0 @@ -import { Collection } from "./collection"; -import { CloneMethod } from "./clone"; -import { Doc, Query } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; -/** - * @hidden - */ -export declare const LokiOps: { - $eq(a: any, b: any): boolean; - $aeq(a: any, b: any): boolean; - $ne(a: any, b: any): boolean; - $dteq(a: any, b: any): boolean; - $gt(a: any, b: any): boolean; - $gte(a: any, b: any): boolean; - $lt(a: any, b: any): boolean; - $lte(a: any, b: any): boolean; - $between(a: any, vals: any): boolean; - $in(a: any, b: any): boolean; - $nin(a: any, b: any): boolean; - $keyin(a: any, b: any): boolean; - $nkeyin(a: any, b: any): boolean; - $definedin(a: any, b: any): boolean; - $undefinedin(a: any, b: any): boolean; - $regex(a: any, b: any): any; - $containsString(a: any, b: any): boolean; - $containsNone(a: any, b: any): boolean; - $containsAny(a: any, b: any): any; - $contains(a: any, b: any): any; - $type(a: any, b: any): any; - $finite(a: any, b: any): boolean; - $size(a: any, b: any): any; - $len(a: any, b: any): any; - $where(a: any, b: any): boolean; - $not(a: any, b: any): boolean; - $and(a: any, b: any): boolean; - $or(a: any, b: any): boolean; -}; -/** - * Resultset class allowing chainable queries. Intended to be instanced internally. - * Collection.find(), Collection.where(), and Collection.chain() instantiate this. - * - * @example - * mycollection.chain() - * .find({ 'doors' : 4 }) - * .where(function(obj) { return obj.name === 'Toyota' }) - * .data(); - */ -export declare class Resultset { - collection: Collection; - filteredrows: number[]; - filterInitialized: boolean; - private _scoring; - /** - * Constructor. - * @param {Collection} collection - the collection which this Resultset will query against - */ - constructor(collection: Collection); - /** - * reset() - Reset the resultset to its initial state. - * - * @returns {Resultset} Reference to this resultset, for future chain operations. - */ - reset(): Resultset; - /** - * toJSON() - Override of toJSON to avoid circular references - * - */ - toJSON(): Resultset; - /** - * Allows you to limit the number of documents passed to next chain operation. - * A resultset copy() is made to avoid altering original resultset. - * - * @param {int} qty - The number of documents to return. - * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops. - */ - limit(qty: number): Resultset; - /** - * Used for skipping 'pos' number of documents in the resultset. - * - * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. - * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. - */ - offset(pos: number): Resultset; - /** - * copy() - To support reuse of resultset in branched query situations. - * - * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same. - */ - copy(): Resultset; - /** - * Alias of copy() - */ - branch(): Resultset; - /** - * Executes a named collection transform or raw array of transform steps against the resultset. - * - * @param {(string|array)} transform - name of collection transform or raw transform array - * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. - * @returns {Resultset} either (this) resultset or a clone of of this resultset (depending on steps) - */ - transform(transform: string | any[], parameters?: object): Resultset; - /** - * User supplied compare function is provided two documents to compare. (chainable) - * @example - * rslt.sort(function(obj1, obj2) { - * if (obj1.name === obj2.name) return 0; - * if (obj1.name > obj2.name) return 1; - * if (obj1.name < obj2.name) return -1; - * }); - * - * @param {function} comparefun - A javascript compare function used for sorting. - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - sort(comparefun: (a: E, b: E) => number): Resultset; - /** - * Simpler, loose evaluation for user to sort based on a property name. (chainable). - * Sorting based on the same lt/gt helper functions used for binary indices. - * - * @param {string} propname - name of property to sort by. - * @param {boolean} isdesc - (Optional) If true, the property will be sorted in descending order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - simplesort(propname: string, isdesc?: boolean): Resultset; - /** - * Allows sorting a resultset based on multiple columns. - * @example - * // to sort by age and then name (both ascending) - * rs.compoundsort(['age', 'name']); - * // to sort by age (ascending) and then by name (descending) - * rs.compoundsort(['age', ['name', true]); - * - * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - compoundsort(properties: (string | [string, boolean])[]): Resultset; - /** - * Helper function for compoundsort(), performing individual object comparisons - * - * @param {Array} properties - array of property names, in order, by which to evaluate sort order - * @param {object} obj1 - first object to compare - * @param {object} obj2 - second object to compare - * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first - */ - private _compoundeval(properties, obj1, obj2); - /** - * Sorts the resultset based on the last full-text-search scoring. - * @param {boolean} [ascending=false] - sort ascending - * @returns {Resultset} - */ - sortByScoring(ascending?: boolean): Resultset; - /** - * Returns the scoring of the last full-text-search. - * @returns {ScoreResult} - */ - getScoring(): ScoreResult; - /** - * findOr() - oversee the operation of OR'ed query expressions. - * OR'ed expression evaluation runs each expression individually against the full collection, - * and finally does a set OR on each expression's results. - * Each evaluation can utilize a binary index to prevent multiple linear array scans. - * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. - */ - findOr(expressionArray: Query[]): Resultset; - $or(expressionArray: Query[]): Resultset; - /** - * findAnd() - oversee the operation of AND'ed query expressions. - * AND'ed expression evaluation runs each expression progressively against the full collection, - * internally utilizing existing chained resultset functionality. - * Only the first filter can utilize a binary index. - * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. - */ - findAnd(expressionArray: Query[]): Resultset; - $and(expressionArray: Query[]): Resultset; - /** - * Used for querying via a mongo-style query object. - * - * @param {object} query - A mongo-style query object used for filtering current results. - * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() - * @returns {Resultset} this resultset for further chain ops. - */ - find(query?: Query, firstOnly?: boolean): Resultset; - /** - * Used for filtering via a javascript filter function. - * - * @param {function} fun - A javascript function used for filtering current results by. - * @returns {Resultset} this resultset for further chain ops. - */ - where(fun: (obj: E) => boolean): Resultset; - /** - * Returns the number of documents in the resultset. - * @returns {number} The number of documents in the resultset. - */ - count(): number; - /** - * Terminates the chain and returns array of filtered documents - * @param {object} options - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when - * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents - * - * @returns {Array} Array of documents in the resultset - */ - data(options?: Resultset.DataOptions): Doc[]; - /** - * Used to run an update operation on all documents currently in the resultset. - * - * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. - * @returns {Resultset} this resultset for further chain ops. - */ - update(updateFunction: (obj: E) => E): Resultset; - /** - * Removes all document objects which are currently in resultset from collection (as well as resultset) - * - * @returns {Resultset} this (empty) resultset for further chain ops. - */ - remove(): Resultset; - /** - * data transformation via user supplied functions - * - * @param {function} mapFunction - this function accepts a single document for you to transform and return - * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value - * @returns {value} The output of your reduceFunction - */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; - /** - * Left joining two sets of data. Join keys can be defined or calculated properties - * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key - * @param {Array|Resultset|Collection} joinData - Data array to join to. - * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on - * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on - * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} - * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides - * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun - * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}] - */ - eqJoin(joinData: ANY, leftJoinKey: string | Function, rightJoinKey: string | Function, mapFun?: Function, dataOptions?: ANY): ANY; - /** - * Applies a map function into a new collection for further chaining. - * @param {function} mapFun - javascript map function - * @param {object} [dataOptions=] - options to data() before input to your map function - * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun - * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - */ - map(mapFun: (obj: E, index: number, array: E[]) => U, dataOptions?: Resultset.DataOptions): Resultset; -} -export declare namespace Resultset { - interface DataOptions { - forceClones?: boolean; - forceCloneMethod?: CloneMethod; - removeMeta?: boolean; - } -} diff --git a/dist/packages/full-text-search/types/loki/src/unique_index.d.ts b/dist/packages/full-text-search/types/loki/src/unique_index.d.ts index 40312618..55284c11 100644 --- a/dist/packages/full-text-search/types/loki/src/unique_index.d.ts +++ b/dist/packages/full-text-search/types/loki/src/unique_index.d.ts @@ -1,30 +1,30 @@ import { Doc } from "../../common/types"; -export declare class UniqueIndex { +export declare class UniqueIndex { private _field; private _keyMap; /** * Constructs an unique index object. * @param {number|string} propertyField - the property field to index */ - constructor(propertyField: number | string); + constructor(propertyField: keyof E); /** * Sets a document's unique index. * @param {Doc} doc - the document * @param {number} row - the data row of the document */ - set(doc: Doc, row: number): void; + set(doc: Doc, row: number): void; /** * Returns the data row of an unique index. * @param {number|string} index - the index * @returns {number | string} - the row */ - get(index: number | string): number; + get(index: keyof E): number; /** * Updates a document's unique index. * @param {Object} doc - the document * @param {number} row - the data row of the document */ - update(doc: Doc, row: number): void; + update(doc: Doc, row: number): void; /** * Removes an unique index. * @param {number|string} index - the unique index diff --git a/dist/packages/full-text-search/types/memory-storage/src/index.d.ts b/dist/packages/full-text-search/types/memory-storage/src/index.d.ts new file mode 100644 index 00000000..5330aa7d --- /dev/null +++ b/dist/packages/full-text-search/types/memory-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { MemoryStorage } from "./memory_storage"; +export { MemoryStorage }; +export default MemoryStorage; diff --git a/dist/packages/full-text-search/types/memory-storage/src/memory_storage.d.ts b/dist/packages/full-text-search/types/memory-storage/src/memory_storage.d.ts new file mode 100644 index 00000000..0066a1de --- /dev/null +++ b/dist/packages/full-text-search/types/memory-storage/src/memory_storage.d.ts @@ -0,0 +1,57 @@ +import { Dict, StorageAdapter } from "../../common/types"; +/** + * An in-memory persistence adapter for an in-memory database. + * This simple 'key/value' adapter is intended for unit testing and diagnostics. + */ +export declare class MemoryStorage implements StorageAdapter { + hashStore: Dict<{ + savecount: number; + lastsave: Date; + value: string; + }>; + options: MemoryStorage.Options; + /** + * Registers the local storage as plugin. + */ + static register(): void; + /** + * Deregisters the local storage as plugin. + */ + static deregister(): void; + /** + * @param {object} options - memory storage options + * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) + * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) + */ + constructor(options?: MemoryStorage.Options); + /** + * Loads a serialized database from its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was loaded + */ + loadDatabase(dbname: string): Promise; + /** + * Saves a serialized database to its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @param {string} dbstring - the database content + * @returns {Promise} a Promise that resolves after the database was persisted + */ + saveDatabase(dbname: string, dbstring: string): Promise; + /** + * Deletes a database from its in-memory store. + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was deleted + */ + deleteDatabase(dbname: string): Promise; +} +export declare namespace MemoryStorage { + interface Options { + asyncResponses?: boolean; + asyncTimeout?: number; + } +} diff --git a/dist/packages/full-text-search/types/partitioning-adapter/src/index.d.ts b/dist/packages/full-text-search/types/partitioning-adapter/src/index.d.ts new file mode 100644 index 00000000..bf49882f --- /dev/null +++ b/dist/packages/full-text-search/types/partitioning-adapter/src/index.d.ts @@ -0,0 +1,3 @@ +import { PartitioningAdapter } from "./partitioning_adapter"; +export { PartitioningAdapter }; +export default PartitioningAdapter; diff --git a/dist/packages/full-text-search/types/partitioning-adapter/src/partitioning_adapter.d.ts b/dist/packages/full-text-search/types/partitioning-adapter/src/partitioning_adapter.d.ts index ff9568cf..45e14850 100644 --- a/dist/packages/full-text-search/types/partitioning-adapter/src/partitioning_adapter.d.ts +++ b/dist/packages/full-text-search/types/partitioning-adapter/src/partitioning_adapter.d.ts @@ -1,4 +1,5 @@ -import { ANY, StorageAdapter } from "../../common/types"; +import { Loki } from "../../loki/src/loki"; +import { StorageAdapter } from "../../common/types"; /** * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and @@ -9,7 +10,7 @@ import { ANY, StorageAdapter } from "../../common/types"; * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all * of that collection's pages will be written on next save. */ -export declare class LokiPartitioningAdapter implements StorageAdapter { +export declare class PartitioningAdapter implements StorageAdapter { mode: string; private _adapter; private _dbref; @@ -68,7 +69,7 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { * @returns {Promise} a Promise that resolves after the database was deleted * */ - exportDatabase(dbname: string, dbref: ANY): Promise; + exportDatabase(dbname: string, dbref: Loki): Promise; /** * Helper method used internally to save each dirty collection, one at a time. * @@ -82,11 +83,3 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { */ private _saveNextPage(); } -declare namespace LokiPartitioningAdapter { - interface PageIterator { - collection?: ANY; - docIndex?: number; - pageIndex?: number; - } -} -export default LokiPartitioningAdapter; diff --git a/dist/packages/indexed-storage/lokijs.indexed-storage.js b/dist/packages/indexed-storage/lokijs.indexed-storage.js index 7039ab5c..0d85a4fe 100644 --- a/dist/packages/indexed-storage/lokijs.indexed-storage.js +++ b/dist/packages/indexed-storage/lokijs.indexed-storage.js @@ -79,7 +79,19 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common_plugin__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__indexed_storage__ = __webpack_require__(1); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "IndexedStorage", function() { return __WEBPACK_IMPORTED_MODULE_0__indexed_storage__["a"]; }); + + +/* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__indexed_storage__["a" /* IndexedStorage */]); + + +/***/ }), +/* 1 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common_plugin__ = __webpack_require__(2); /** * Loki persistence adapter class for indexedDb. @@ -88,18 +100,18 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); * IndexedDb storage is provided per-domain, so we implement app/key/value database to * allow separate contexts for separate apps within a domain. */ -class LokiIndexedStorage { +class IndexedStorage { /** * Registers the indexed storage as plugin. */ static register() { - __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["LokiIndexedStorage"] = LokiIndexedStorage; + __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["IndexedStorage"] = IndexedStorage; } /** * Deregisters the indexed storage as plugin. */ static deregister() { - delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["LokiIndexedStorage"]; + delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["IndexedStorage"]; } /** * @param {string} [appname=loki] - Application name context can be used to distinguish subdomains, "loki" by default @@ -330,7 +342,7 @@ class LokiIndexedStorage { }); } } -/* harmony export (immutable) */ __webpack_exports__["LokiIndexedStorage"] = LokiIndexedStorage; +/* harmony export (immutable) */ __webpack_exports__["a"] = IndexedStorage; /** * LokiCatalog - underlying App/Key/Value catalog persistence @@ -564,11 +576,11 @@ class LokiCatalog { }))(callback); } } -/* harmony default export */ __webpack_exports__["default"] = (LokiIndexedStorage); +/* unused harmony default export */ var _unused_webpack_default_export = (IndexedStorage); /***/ }), -/* 1 */ +/* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -594,10 +606,10 @@ const PLUGINS = create(); /* harmony export (immutable) */ __webpack_exports__["a"] = PLUGINS; -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(2))) +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(3))) /***/ }), -/* 2 */ +/* 3 */ /***/ (function(module, exports) { var g; diff --git a/dist/packages/indexed-storage/lokijs.indexed-storage.js.map b/dist/packages/indexed-storage/lokijs.indexed-storage.js.map index 6dc01e80..7abf3e47 100644 --- a/dist/packages/indexed-storage/lokijs.indexed-storage.js.map +++ b/dist/packages/indexed-storage/lokijs.indexed-storage.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 11d263a04505520f7727","webpack:///./packages/indexed-storage/src/indexed_storage.ts","webpack:///./packages/common/plugin.ts","webpack:///(webpack)/buildin/global.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;AC7D4C;AAiB5C;;;;;;GAMG;AACG;IAIJ;;OAEG;IACH,MAAM,CAAC,QAAQ;QACb,+DAAO,CAAC,oBAAoB,CAAC,GAAG,kBAAkB,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU;QACf,OAAO,+DAAO,CAAC,oBAAoB,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,YAAY,UAAkB,MAAM;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,0DAA0D;QAC1D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,MAAc;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC;QAErB,uEAAuE;QACvE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,KAA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ports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/indexed-storage\"] = factory();\n\telse\n\t\troot[\"@lokijs/indexed-storage\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 11d263a04505520f7727","import {PLUGINS} from \"../../common/plugin\";\nimport {StorageAdapter} from \"../../common/types\";\n\n/*\n Loki IndexedDb Adapter (need to include this script to use it)\n\n Console Usage can be used for management/diagnostic, here are a few examples :\n adapter.getDatabaseList(); // with no callback passed, this method will log results to console\n adapter.saveDatabase(\"UserDatabase\", JSON.stringify(myDb));\n adapter.loadDatabase(\"UserDatabase\"); // will log the serialized db to console\n adapter.deleteDatabase(\"UserDatabase\");\n\n Should usercallback be still used?\n */\n\ndeclare type ANY = any;\n\n/**\n * Loki persistence adapter class for indexedDb.\n * This class fulfills abstract adapter interface which can be applied to other storage methods.\n * Utilizes the included LokiCatalog app/key/value database for actual database persistence.\n * IndexedDb storage is provided per-domain, so we implement app/key/value database to\n * allow separate contexts for separate apps within a domain.\n */\nexport class LokiIndexedStorage implements StorageAdapter {\n private _appname: string;\n private catalog: any;\n\n /**\n * Registers the indexed storage as plugin.\n */\n static register(): void {\n PLUGINS[\"LokiIndexedStorage\"] = LokiIndexedStorage;\n }\n\n /**\n * Deregisters the indexed storage as plugin.\n */\n static deregister(): void {\n delete PLUGINS[\"LokiIndexedStorage\"];\n }\n\n /**\n * @param {string} [appname=loki] - Application name context can be used to distinguish subdomains, \"loki\" by default\n */\n constructor(appname: string = \"loki\") {\n this._appname = appname;\n\n // keep reference to catalog class for base AKV operations\n this.catalog = null;\n }\n\n /**\n * Retrieves a serialized db string from the catalog.\n *\n * @example\n * // LOAD\n * var idbAdapter = new LokiIndexedAdapter(\"finance\");\n * var db = new loki(\"test\", { adapter: idbAdapter });\n * db.base(function(result) {\n\t * console.log(\"done\");\n\t * });\n *\n * @param {string} dbname - the name of the database to retrieve.\n * @returns {Promise} a Promise that resolves after the database was loaded\n */\n loadDatabase(dbname: string) {\n const appName = this._appname;\n const adapter = this;\n\n // lazy open/create db reference so dont -need- callback in constructor\n if (this.catalog === null || this.catalog.db === null) {\n return new Promise((resolve) => {\n adapter.catalog = new LokiCatalog((cat: LokiCatalog) => {\n adapter.catalog = cat;\n resolve(adapter.loadDatabase(dbname));\n });\n });\n }\n // lookup up db string in AKV db\n return new Promise((resolve) => {\n this.catalog.getAppKey(appName, dbname, (result: ANY) => {\n if (result.id === 0) {\n resolve();\n return;\n }\n resolve(result.val);\n });\n });\n }\n\n /**\n * Saves a serialized db to the catalog.\n *\n * @example\n * // SAVE : will save App/Key/Val as \"finance\"/\"test\"/{serializedDb}\n * let idbAdapter = new LokiIndexedAdapter(\"finance\");\n * let db = new loki(\"test\", { adapter: idbAdapter });\n * let coll = db.addCollection(\"testColl\");\n * coll.insert({test: \"val\"});\n * db.saveDatabase(); // could pass callback if needed for async complete\n *\n * @param {string} dbname - the name to give the serialized database within the catalog.\n * @param {string} dbstring - the serialized db string to save.\n * @returns {Promise} a Promise that resolves after the database was persisted\n */\n saveDatabase(dbname: string, dbstring: string): Promise {\n const appName = this._appname;\n const adapter = this;\n\n let resolve: ANY;\n let reject: ANY;\n const result = new Promise((res: ANY, rej: ANY) => {\n resolve = res;\n reject = rej;\n });\n\n function saveCallback(result: ANY) {\n if (result && result.success === true) {\n resolve();\n } else {\n reject(new Error(\"Error saving database\"));\n }\n }\n\n // lazy open/create db reference so dont -need- callback in constructor\n if (this.catalog === null || this.catalog.db === null) {\n this.catalog = new LokiCatalog((cat: LokiCatalog) => {\n adapter.catalog = cat;\n\n // now that catalog has been initialized, set (add/update) the AKV entry\n cat.setAppKey(appName, dbname, dbstring, saveCallback);\n });\n\n return Promise.resolve() as Promise;\n }\n\n // set (add/update) entry to AKV database\n this.catalog.setAppKey(appName, dbname, dbstring, saveCallback);\n\n return Promise.resolve() as Promise;\n }\n\n /**\n * Deletes a serialized db from the catalog.\n *\n * @example\n * // DELETE DATABASE\n * // delete \"finance\"/\"test\" value from catalog\n * idbAdapter.deleteDatabase(\"test\", function {\n\t * // database deleted\n\t * });\n *\n * @param {string} dbname - the name of the database to delete from the catalog.\n * @returns {Promise} a Promise that resolves after the database was deleted\n */\n deleteDatabase(dbname: string): Promise {\n const appName = this._appname;\n const adapter = this;\n\n // lazy open/create db reference and pass callback ahead\n if (this.catalog === null || this.catalog.db === null) {\n return new Promise((resolve) => {\n adapter.catalog = new LokiCatalog((cat: LokiCatalog) => {\n adapter.catalog = cat;\n\n resolve(adapter.deleteDatabase(dbname));\n });\n });\n }\n\n // catalog was already initialized, so just lookup object and delete by id\n return new Promise((resolve) => {\n this.catalog.getAppKey(appName, dbname, (result: ANY) => {\n const id = result.id;\n\n if (id !== 0) {\n adapter.catalog.deleteAppKey(id);\n }\n\n resolve();\n });\n });\n }\n\n /**\n * Removes all database partitions and pages with the base filename passed in.\n * This utility method does not (yet) guarantee async deletions will be completed before returning\n *\n * @param {string} dbname - the base filename which container, partitions, or pages are derived\n */\n deleteDatabasePartitions(dbname: string) {\n this.getDatabaseList((result: string[]) => {\n result.forEach((str) => {\n if (str.startsWith(dbname)) {\n this.deleteDatabase(str);\n }\n });\n });\n }\n\n /**\n * Retrieves object array of catalog entries for current app.\n *\n * @example\n * idbAdapter.getDatabaseList(function(result) {\n\t * // result is array of string names for that appcontext (\"finance\")\n\t * result.forEach(function(str) {\n\t * console.log(str);\n\t * });\n\t * });\n *\n * @param {function} callback - should accept array of database names in the catalog for current app.\n */\n getDatabaseList(callback: (names: string[]) => void) {\n const appName = this._appname;\n const adapter = this;\n\n // lazy open/create db reference so dont -need- callback in constructor\n if (this.catalog === null || this.catalog.db === null) {\n this.catalog = new LokiCatalog((cat: LokiCatalog) => {\n adapter.catalog = cat;\n\n adapter.getDatabaseList(callback);\n });\n\n return;\n }\n\n // catalog already initialized\n // get all keys for current appName, and transpose results so just string array\n this.catalog.getAppKeys(appName, (results: ANY) => {\n const names = [];\n\n for (let idx = 0; idx < results.length; idx++) {\n names.push(results[idx].key);\n }\n\n if (typeof(callback) === \"function\") {\n callback(names);\n } else {\n names.forEach(() => {\n // console.log(obj);\n });\n }\n });\n }\n\n /**\n * Allows retrieval of list of all keys in catalog along with size\n * @param {function} callback - (Optional) callback to accept result array.\n */\n public getCatalogSummary(callback: (entry: Entry[]) => void) {\n const adapter = this;\n\n // lazy open/create db reference\n if (this.catalog === null || this.catalog.db === null) {\n this.catalog = new LokiCatalog((cat: LokiCatalog) => {\n adapter.catalog = cat;\n\n adapter.getCatalogSummary(callback);\n });\n\n return;\n }\n\n // catalog already initialized\n // get all keys for current appName, and transpose results so just string array\n this.catalog.getAllKeys((results: ANY) => {\n const entries = [];\n let obj;\n let size;\n let oapp;\n let okey;\n let oval;\n\n for (let idx = 0; idx < results.length; idx++) {\n obj = results[idx];\n oapp = obj.app || \"\";\n okey = obj.key || \"\";\n oval = obj.val || \"\";\n\n // app and key are composited into an appkey column so we will mult by 2\n size = oapp.length * 2 + okey.length * 2 + oval.length + 1;\n\n entries.push({\n \"app\": obj.app,\n \"key\": obj.key,\n \"size\": size\n });\n }\n\n if (typeof(callback) === \"function\") {\n callback(entries);\n } else {\n entries.forEach(() => {\n // console.log(obj);\n });\n }\n });\n }\n}\n\nexport interface Entry {\n app: string;\n key: string;\n size: number;\n}\n\n/**\n * LokiCatalog - underlying App/Key/Value catalog persistence\n * This non-interface class implements the actual persistence.\n * Used by the LokiIndexedStorage class.\n */\nclass LokiCatalog {\n public db: ANY;\n\n constructor(callback: any) {\n this.db = null;\n this.initializeLokiCatalog(callback);\n }\n\n initializeLokiCatalog(callback: any) {\n const openRequest = indexedDB.open(\"LokiCatalog\", 1);\n const cat = this;\n\n // If database doesn't exist yet or its version is lower than our version specified above (2nd param in line above)\n openRequest.onupgradeneeded = (e: ANY) => {\n const thisDB = e.target.result;\n if (thisDB.objectStoreNames.contains(\"LokiAKV\")) {\n thisDB.deleteObjectStore(\"LokiAKV\");\n }\n\n if (!thisDB.objectStoreNames.contains(\"LokiAKV\")) {\n const objectStore = thisDB.createObjectStore(\"LokiAKV\", {\n keyPath: \"id\",\n autoIncrement: true\n });\n objectStore.createIndex(\"app\", \"app\", {\n unique: false\n });\n objectStore.createIndex(\"key\", \"key\", {\n unique: false\n });\n // hack to simulate composite key since overhead is low (main size should be in val field)\n // user (me) required to duplicate the app and key into comma delimited appkey field off object\n // This will allow retrieving single record with that composite key as well as\n // still supporting opening cursors on app or key alone\n objectStore.createIndex(\"appkey\", \"appkey\", {\n unique: true\n });\n }\n };\n\n openRequest.onsuccess = (e: ANY) => {\n cat.db = e.target.result;\n\n if (typeof(callback) === \"function\")\n callback(cat);\n };\n\n openRequest.onerror = (e: ANY) => {\n throw e;\n };\n }\n\n getAppKey(app: string, key: string, callback: any) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readonly\");\n const store = transaction.objectStore(\"LokiAKV\");\n const index = store.index(\"appkey\");\n const appkey = app + \",\" + key;\n const request = index.get(appkey);\n\n request.onsuccess = (((usercallback) => (e: ANY) => {\n let lres = e.target.result;\n\n if (lres === null || lres === undefined) {\n lres = {\n id: 0,\n success: false\n };\n }\n\n if (typeof(usercallback) === \"function\") {\n usercallback(lres);\n } else {\n // console.log(lres);\n }\n }))(callback);\n\n request.onerror = (((usercallback) => (e: ANY) => {\n if (typeof(usercallback) === \"function\") {\n usercallback({\n id: 0,\n success: false\n });\n } else {\n throw e;\n }\n }))(callback);\n }\n\n getAppKeyById(id: string, callback: ANY, data: ANY) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readonly\");\n const store = transaction.objectStore(\"LokiAKV\");\n const request = store.get(id);\n\n request.onsuccess = (((data, usercallback) => (e: ANY) => {\n if (typeof(usercallback) === \"function\") {\n usercallback(e.target.result, data);\n } else {\n // console.log(e.target.result);\n }\n }))(data, callback);\n }\n\n setAppKey(app: string, key: string, val: string, callback: any) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readwrite\");\n const store = transaction.objectStore(\"LokiAKV\");\n const index = store.index(\"appkey\");\n const appkey = app + \",\" + key;\n const request = index.get(appkey);\n\n // first try to retrieve an existing object by that key\n // need to do this because to update an object you need to have id in object, otherwise it will append id with new autocounter and clash the unique index appkey\n request.onsuccess = (e: ANY) => {\n let res = e.target.result;\n\n if (res === null || res === undefined) {\n res = {\n app,\n key,\n appkey: app + \",\" + key,\n val\n };\n } else {\n res.val = val;\n }\n\n const requestPut = store.put(res);\n\n requestPut.onerror = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") {\n usercallback({\n success: false\n });\n } else {\n // console.error(\"LokiCatalog.setAppKey (set) onerror\");\n // console.error(request.error);\n }\n }))(callback);\n\n requestPut.onsuccess = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") {\n usercallback({\n success: true\n });\n }\n }))(callback);\n };\n\n request.onerror = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") {\n usercallback({\n success: false\n });\n } else {\n // console.error(\"LokiCatalog.setAppKey (get) onerror\");\n // console.error(request.error);\n }\n }))(callback);\n }\n\n deleteAppKey(id: string, callback: any) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readwrite\");\n const store = transaction.objectStore(\"LokiAKV\");\n const request = store.delete(id);\n\n request.onsuccess = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") usercallback({\n success: true\n });\n }))(callback);\n\n request.onerror = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") {\n usercallback(false);\n } else {\n // console.error(\"LokiCatalog.deleteAppKey raised onerror\");\n // console.error(request.error);\n }\n }))(callback);\n }\n\n getAppKeys(app: string, callback: any) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readonly\");\n const store = transaction.objectStore(\"LokiAKV\");\n const index = store.index(\"app\");\n\n // We want cursor to all values matching our (single) app param\n const singleKeyRange = IDBKeyRange.only(app);\n\n // To use one of the key ranges, pass it in as the first argument of openCursor()/openKeyCursor()\n const cursor = index.openCursor(singleKeyRange);\n\n // cursor internally, pushing results into this.data[] and return\n // this.data[] when done (similar to service)\n const localdata: any[] = [];\n\n cursor.onsuccess = (((data, callback) => (e: ANY) => {\n const cursor = e.target.result;\n if (cursor) {\n const currObject = cursor.value;\n\n data.push(currObject);\n\n cursor.continue();\n } else {\n if (typeof(callback) === \"function\") {\n callback(data);\n } else {\n // console.log(data);\n }\n }\n }))(localdata, callback);\n\n cursor.onerror = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") {\n usercallback(null);\n } else {\n // console.error(\"LokiCatalog.getAppKeys raised onerror\");\n // console.error(e);\n }\n }))(callback);\n\n }\n\n // Hide \"cursoring\" and return array of { id: id, key: key }\n getAllKeys(callback: any) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readonly\");\n const store = transaction.objectStore(\"LokiAKV\");\n const cursor = store.openCursor();\n\n const localdata: ANY[] = [];\n\n cursor.onsuccess = (((data, callback) => (e: ANY) => {\n const cursor = e.target.result;\n if (cursor) {\n const currObject = cursor.value;\n\n data.push(currObject);\n\n cursor.continue();\n } else {\n if (typeof(callback) === \"function\") {\n callback(data);\n } else {\n // console.log(data);\n }\n }\n }))(localdata, callback);\n\n cursor.onerror = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") usercallback(null);\n }))(callback);\n }\n}\n\nexport default LokiIndexedStorage;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/indexed-storage/src/indexed_storage.ts","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 2\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 6cd7a39aa1f413207680","webpack:///./packages/indexed-storage/src/index.ts","webpack:///./packages/indexed-storage/src/indexed_storage.ts","webpack:///./packages/common/plugin.ts","webpack:///(webpack)/buildin/global.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;AC7DiD;AAEzB;AACxB,+DAAe,wEAAc,EAAC;;;;;;;;;ACHc;AAoB5C;;;;;;GAMG;AACG;IAIJ;;OAEG;IACH,MAAM,CAAC,QAAQ;QACb,+DAAO,CAAC,gBAAgB,CAAC,GAAG,cAAc,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU;QACf,OAAO,+DAAO,CAAC,gBAAgB,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,YAAY,UAAkB,MAAM;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,0DAA0D;QAC1D,IAAI,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AAO,GAAG,MAAM,EAAE,CAAC;AAAA;AAAA;;;;;;;;ACtBhC;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"lokijs.indexed-storage.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/indexed-storage\"] = factory();\n\telse\n\t\troot[\"@lokijs/indexed-storage\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 6cd7a39aa1f413207680","import {IndexedStorage} from \"./indexed_storage\";\n\nexport {IndexedStorage};\nexport default IndexedStorage;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/indexed-storage/src/index.ts","import {PLUGINS} from \"../../common/plugin\";\nimport {StorageAdapter} from \"../../common/types\";\n\n/*\n Loki IndexedDb Adapter (need to include this script to use it)\n\n Console Usage can be used for management/diagnostic, here are a few examples :\n adapter.getDatabaseList(); // with no callback passed, this method will log results to console\n adapter.saveDatabase(\"UserDatabase\", JSON.stringify(myDb));\n adapter.loadDatabase(\"UserDatabase\"); // will log the serialized db to console\n adapter.deleteDatabase(\"UserDatabase\");\n\n Should usercallback be still used?\n */\n\n/**\n * @hidden\n */\ndeclare type ANY = any;\n\n/**\n * Loki persistence adapter class for indexedDb.\n * This class fulfills abstract adapter interface which can be applied to other storage methods.\n * Utilizes the included LokiCatalog app/key/value database for actual database persistence.\n * IndexedDb storage is provided per-domain, so we implement app/key/value database to\n * allow separate contexts for separate apps within a domain.\n */\nexport class IndexedStorage implements StorageAdapter {\n private _appname: string;\n private catalog: any;\n\n /**\n * Registers the indexed storage as plugin.\n */\n static register(): void {\n PLUGINS[\"IndexedStorage\"] = IndexedStorage;\n }\n\n /**\n * Deregisters the indexed storage as plugin.\n */\n static deregister(): void {\n delete PLUGINS[\"IndexedStorage\"];\n }\n\n /**\n * @param {string} [appname=loki] - Application name context can be used to distinguish subdomains, \"loki\" by default\n */\n constructor(appname: string = \"loki\") {\n this._appname = appname;\n\n // keep reference to catalog class for base AKV operations\n this.catalog = null;\n }\n\n /**\n * Retrieves a serialized db string from the catalog.\n *\n * @example\n * // LOAD\n * var idbAdapter = new LokiIndexedAdapter(\"finance\");\n * var db = new loki(\"test\", { adapter: idbAdapter });\n * db.base(function(result) {\n\t * console.log(\"done\");\n\t * });\n *\n * @param {string} dbname - the name of the database to retrieve.\n * @returns {Promise} a Promise that resolves after the database was loaded\n */\n loadDatabase(dbname: string) {\n const appName = this._appname;\n const adapter = this;\n\n // lazy open/create db reference so dont -need- callback in constructor\n if (this.catalog === null || this.catalog.db === null) {\n return new Promise((resolve) => {\n adapter.catalog = new LokiCatalog((cat: LokiCatalog) => {\n adapter.catalog = cat;\n resolve(adapter.loadDatabase(dbname));\n });\n });\n }\n // lookup up db string in AKV db\n return new Promise((resolve) => {\n this.catalog.getAppKey(appName, dbname, (result: ANY) => {\n if (result.id === 0) {\n resolve();\n return;\n }\n resolve(result.val);\n });\n });\n }\n\n /**\n * Saves a serialized db to the catalog.\n *\n * @example\n * // SAVE : will save App/Key/Val as \"finance\"/\"test\"/{serializedDb}\n * let idbAdapter = new LokiIndexedAdapter(\"finance\");\n * let db = new loki(\"test\", { adapter: idbAdapter });\n * let coll = db.addCollection(\"testColl\");\n * coll.insert({test: \"val\"});\n * db.saveDatabase(); // could pass callback if needed for async complete\n *\n * @param {string} dbname - the name to give the serialized database within the catalog.\n * @param {string} dbstring - the serialized db string to save.\n * @returns {Promise} a Promise that resolves after the database was persisted\n */\n saveDatabase(dbname: string, dbstring: string): Promise {\n const appName = this._appname;\n const adapter = this;\n\n let resolve: ANY;\n let reject: ANY;\n const result = new Promise((res: ANY, rej: ANY) => {\n resolve = res;\n reject = rej;\n });\n\n function saveCallback(result: ANY) {\n if (result && result.success === true) {\n resolve();\n } else {\n reject(new Error(\"Error saving database\"));\n }\n }\n\n // lazy open/create db reference so dont -need- callback in constructor\n if (this.catalog === null || this.catalog.db === null) {\n this.catalog = new LokiCatalog((cat: LokiCatalog) => {\n adapter.catalog = cat;\n\n // now that catalog has been initialized, set (add/update) the AKV entry\n cat.setAppKey(appName, dbname, dbstring, saveCallback);\n });\n\n return Promise.resolve() as Promise;\n }\n\n // set (add/update) entry to AKV database\n this.catalog.setAppKey(appName, dbname, dbstring, saveCallback);\n\n return Promise.resolve() as Promise;\n }\n\n /**\n * Deletes a serialized db from the catalog.\n *\n * @example\n * // DELETE DATABASE\n * // delete \"finance\"/\"test\" value from catalog\n * idbAdapter.deleteDatabase(\"test\", function {\n\t * // database deleted\n\t * });\n *\n * @param {string} dbname - the name of the database to delete from the catalog.\n * @returns {Promise} a Promise that resolves after the database was deleted\n */\n deleteDatabase(dbname: string): Promise {\n const appName = this._appname;\n const adapter = this;\n\n // lazy open/create db reference and pass callback ahead\n if (this.catalog === null || this.catalog.db === null) {\n return new Promise((resolve) => {\n adapter.catalog = new LokiCatalog((cat: LokiCatalog) => {\n adapter.catalog = cat;\n\n resolve(adapter.deleteDatabase(dbname));\n });\n });\n }\n\n // catalog was already initialized, so just lookup object and delete by id\n return new Promise((resolve) => {\n this.catalog.getAppKey(appName, dbname, (result: ANY) => {\n const id = result.id;\n\n if (id !== 0) {\n adapter.catalog.deleteAppKey(id);\n }\n\n resolve();\n });\n });\n }\n\n /**\n * Removes all database partitions and pages with the base filename passed in.\n * This utility method does not (yet) guarantee async deletions will be completed before returning\n *\n * @param {string} dbname - the base filename which container, partitions, or pages are derived\n */\n deleteDatabasePartitions(dbname: string) {\n this.getDatabaseList((result: string[]) => {\n result.forEach((str) => {\n if (str.startsWith(dbname)) {\n this.deleteDatabase(str);\n }\n });\n });\n }\n\n /**\n * Retrieves object array of catalog entries for current app.\n *\n * @example\n * idbAdapter.getDatabaseList(function(result) {\n\t * // result is array of string names for that appcontext (\"finance\")\n\t * result.forEach(function(str) {\n\t * console.log(str);\n\t * });\n\t * });\n *\n * @param {function} callback - should accept array of database names in the catalog for current app.\n */\n getDatabaseList(callback: (names: string[]) => void) {\n const appName = this._appname;\n const adapter = this;\n\n // lazy open/create db reference so dont -need- callback in constructor\n if (this.catalog === null || this.catalog.db === null) {\n this.catalog = new LokiCatalog((cat: LokiCatalog) => {\n adapter.catalog = cat;\n\n adapter.getDatabaseList(callback);\n });\n\n return;\n }\n\n // catalog already initialized\n // get all keys for current appName, and transpose results so just string array\n this.catalog.getAppKeys(appName, (results: ANY) => {\n const names = [];\n\n for (let idx = 0; idx < results.length; idx++) {\n names.push(results[idx].key);\n }\n\n if (typeof(callback) === \"function\") {\n callback(names);\n } else {\n names.forEach(() => {\n // console.log(obj);\n });\n }\n });\n }\n\n /**\n * Allows retrieval of list of all keys in catalog along with size\n * @param {function} callback - (Optional) callback to accept result array.\n */\n public getCatalogSummary(callback: (entry: Entry[]) => void) {\n const adapter = this;\n\n // lazy open/create db reference\n if (this.catalog === null || this.catalog.db === null) {\n this.catalog = new LokiCatalog((cat: LokiCatalog) => {\n adapter.catalog = cat;\n\n adapter.getCatalogSummary(callback);\n });\n\n return;\n }\n\n // catalog already initialized\n // get all keys for current appName, and transpose results so just string array\n this.catalog.getAllKeys((results: ANY) => {\n const entries = [];\n let obj;\n let size;\n let oapp;\n let okey;\n let oval;\n\n for (let idx = 0; idx < results.length; idx++) {\n obj = results[idx];\n oapp = obj.app || \"\";\n okey = obj.key || \"\";\n oval = obj.val || \"\";\n\n // app and key are composited into an appkey column so we will mult by 2\n size = oapp.length * 2 + okey.length * 2 + oval.length + 1;\n\n entries.push({\n \"app\": obj.app,\n \"key\": obj.key,\n \"size\": size\n });\n }\n\n if (typeof(callback) === \"function\") {\n callback(entries);\n } else {\n entries.forEach(() => {\n // console.log(obj);\n });\n }\n });\n }\n}\n\nexport interface Entry {\n app: string;\n key: string;\n size: number;\n}\n\n/**\n * LokiCatalog - underlying App/Key/Value catalog persistence\n * This non-interface class implements the actual persistence.\n * Used by the LokiIndexedStorage class.\n */\nclass LokiCatalog {\n public db: ANY;\n\n constructor(callback: any) {\n this.db = null;\n this.initializeLokiCatalog(callback);\n }\n\n initializeLokiCatalog(callback: any) {\n const openRequest = indexedDB.open(\"LokiCatalog\", 1);\n const cat = this;\n\n // If database doesn't exist yet or its version is lower than our version specified above (2nd param in line above)\n openRequest.onupgradeneeded = (e: ANY) => {\n const thisDB = e.target.result;\n if (thisDB.objectStoreNames.contains(\"LokiAKV\")) {\n thisDB.deleteObjectStore(\"LokiAKV\");\n }\n\n if (!thisDB.objectStoreNames.contains(\"LokiAKV\")) {\n const objectStore = thisDB.createObjectStore(\"LokiAKV\", {\n keyPath: \"id\",\n autoIncrement: true\n });\n objectStore.createIndex(\"app\", \"app\", {\n unique: false\n });\n objectStore.createIndex(\"key\", \"key\", {\n unique: false\n });\n // hack to simulate composite key since overhead is low (main size should be in val field)\n // user (me) required to duplicate the app and key into comma delimited appkey field off object\n // This will allow retrieving single record with that composite key as well as\n // still supporting opening cursors on app or key alone\n objectStore.createIndex(\"appkey\", \"appkey\", {\n unique: true\n });\n }\n };\n\n openRequest.onsuccess = (e: ANY) => {\n cat.db = e.target.result;\n\n if (typeof(callback) === \"function\")\n callback(cat);\n };\n\n openRequest.onerror = (e: ANY) => {\n throw e;\n };\n }\n\n getAppKey(app: string, key: string, callback: any) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readonly\");\n const store = transaction.objectStore(\"LokiAKV\");\n const index = store.index(\"appkey\");\n const appkey = app + \",\" + key;\n const request = index.get(appkey);\n\n request.onsuccess = (((usercallback) => (e: ANY) => {\n let lres = e.target.result;\n\n if (lres === null || lres === undefined) {\n lres = {\n id: 0,\n success: false\n };\n }\n\n if (typeof(usercallback) === \"function\") {\n usercallback(lres);\n } else {\n // console.log(lres);\n }\n }))(callback);\n\n request.onerror = (((usercallback) => (e: ANY) => {\n if (typeof(usercallback) === \"function\") {\n usercallback({\n id: 0,\n success: false\n });\n } else {\n throw e;\n }\n }))(callback);\n }\n\n getAppKeyById(id: string, callback: ANY, data: ANY) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readonly\");\n const store = transaction.objectStore(\"LokiAKV\");\n const request = store.get(id);\n\n request.onsuccess = (((data, usercallback) => (e: ANY) => {\n if (typeof(usercallback) === \"function\") {\n usercallback(e.target.result, data);\n } else {\n // console.log(e.target.result);\n }\n }))(data, callback);\n }\n\n setAppKey(app: string, key: string, val: string, callback: any) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readwrite\");\n const store = transaction.objectStore(\"LokiAKV\");\n const index = store.index(\"appkey\");\n const appkey = app + \",\" + key;\n const request = index.get(appkey);\n\n // first try to retrieve an existing object by that key\n // need to do this because to update an object you need to have id in object, otherwise it will append id with new autocounter and clash the unique index appkey\n request.onsuccess = (e: ANY) => {\n let res = e.target.result;\n\n if (res === null || res === undefined) {\n res = {\n app,\n key,\n appkey: app + \",\" + key,\n val\n };\n } else {\n res.val = val;\n }\n\n const requestPut = store.put(res);\n\n requestPut.onerror = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") {\n usercallback({\n success: false\n });\n } else {\n // console.error(\"LokiCatalog.setAppKey (set) onerror\");\n // console.error(request.error);\n }\n }))(callback);\n\n requestPut.onsuccess = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") {\n usercallback({\n success: true\n });\n }\n }))(callback);\n };\n\n request.onerror = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") {\n usercallback({\n success: false\n });\n } else {\n // console.error(\"LokiCatalog.setAppKey (get) onerror\");\n // console.error(request.error);\n }\n }))(callback);\n }\n\n deleteAppKey(id: string, callback: any) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readwrite\");\n const store = transaction.objectStore(\"LokiAKV\");\n const request = store.delete(id);\n\n request.onsuccess = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") usercallback({\n success: true\n });\n }))(callback);\n\n request.onerror = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") {\n usercallback(false);\n } else {\n // console.error(\"LokiCatalog.deleteAppKey raised onerror\");\n // console.error(request.error);\n }\n }))(callback);\n }\n\n getAppKeys(app: string, callback: any) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readonly\");\n const store = transaction.objectStore(\"LokiAKV\");\n const index = store.index(\"app\");\n\n // We want cursor to all values matching our (single) app param\n const singleKeyRange = IDBKeyRange.only(app);\n\n // To use one of the key ranges, pass it in as the first argument of openCursor()/openKeyCursor()\n const cursor = index.openCursor(singleKeyRange);\n\n // cursor internally, pushing results into this.data[] and return\n // this.data[] when done (similar to service)\n const localdata: any[] = [];\n\n cursor.onsuccess = (((data, callback) => (e: ANY) => {\n const cursor = e.target.result;\n if (cursor) {\n const currObject = cursor.value;\n\n data.push(currObject);\n\n cursor.continue();\n } else {\n if (typeof(callback) === \"function\") {\n callback(data);\n } else {\n // console.log(data);\n }\n }\n }))(localdata, callback);\n\n cursor.onerror = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") {\n usercallback(null);\n } else {\n // console.error(\"LokiCatalog.getAppKeys raised onerror\");\n // console.error(e);\n }\n }))(callback);\n\n }\n\n // Hide \"cursoring\" and return array of { id: id, key: key }\n getAllKeys(callback: any) {\n const transaction = this.db.transaction([\"LokiAKV\"], \"readonly\");\n const store = transaction.objectStore(\"LokiAKV\");\n const cursor = store.openCursor();\n\n const localdata: ANY[] = [];\n\n cursor.onsuccess = (((data, callback) => (e: ANY) => {\n const cursor = e.target.result;\n if (cursor) {\n const currObject = cursor.value;\n\n data.push(currObject);\n\n cursor.continue();\n } else {\n if (typeof(callback) === \"function\") {\n callback(data);\n } else {\n // console.log(data);\n }\n }\n }))(localdata, callback);\n\n cursor.onerror = (((usercallback) => () => {\n if (typeof(usercallback) === \"function\") usercallback(null);\n }))(callback);\n }\n}\n\nexport default IndexedStorage;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/indexed-storage/src/indexed_storage.ts","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/packages/indexed-storage/lokijs.indexed-storage.min.js b/dist/packages/indexed-storage/lokijs.indexed-storage.min.js index 66acbc86..115256c3 100644 --- a/dist/packages/indexed-storage/lokijs.indexed-storage.min.js +++ b/dist/packages/indexed-storage/lokijs.indexed-storage.min.js @@ -1 +1 @@ -(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["@lokijs/indexed-storage"]=factory();else{root["@lokijs/indexed-storage"]=factory();root["LokiIndexedStorage"]=root["@lokijs/indexed-storage"].default}})(typeof self!=="undefined"?self:this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__common_plugin__=__webpack_require__(1);class LokiIndexedStorage{static register(){__WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["LokiIndexedStorage"]=LokiIndexedStorage}static deregister(){delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["LokiIndexedStorage"]}constructor(appname="loki"){this._appname=appname;this.catalog=null}loadDatabase(dbname){const appName=this._appname;const adapter=this;if(this.catalog===null||this.catalog.db===null){return new Promise(resolve=>{adapter.catalog=new LokiCatalog(cat=>{adapter.catalog=cat;resolve(adapter.loadDatabase(dbname))})})}return new Promise(resolve=>{this.catalog.getAppKey(appName,dbname,result=>{if(result.id===0){resolve();return}resolve(result.val)})})}saveDatabase(dbname,dbstring){const appName=this._appname;const adapter=this;let resolve;let reject;const result=new Promise((res,rej)=>{resolve=res;reject=rej});function saveCallback(result){if(result&&result.success===true){resolve()}else{reject(new Error("Error saving database"))}}if(this.catalog===null||this.catalog.db===null){this.catalog=new LokiCatalog(cat=>{adapter.catalog=cat;cat.setAppKey(appName,dbname,dbstring,saveCallback)});return Promise.resolve()}this.catalog.setAppKey(appName,dbname,dbstring,saveCallback);return Promise.resolve()}deleteDatabase(dbname){const appName=this._appname;const adapter=this;if(this.catalog===null||this.catalog.db===null){return new Promise(resolve=>{adapter.catalog=new LokiCatalog(cat=>{adapter.catalog=cat;resolve(adapter.deleteDatabase(dbname))})})}return new Promise(resolve=>{this.catalog.getAppKey(appName,dbname,result=>{const id=result.id;if(id!==0){adapter.catalog.deleteAppKey(id)}resolve()})})}deleteDatabasePartitions(dbname){this.getDatabaseList(result=>{result.forEach(str=>{if(str.startsWith(dbname)){this.deleteDatabase(str)}})})}getDatabaseList(callback){const appName=this._appname;const adapter=this;if(this.catalog===null||this.catalog.db===null){this.catalog=new LokiCatalog(cat=>{adapter.catalog=cat;adapter.getDatabaseList(callback)});return}this.catalog.getAppKeys(appName,results=>{const names=[];for(let idx=0;idx{})}})}getCatalogSummary(callback){const adapter=this;if(this.catalog===null||this.catalog.db===null){this.catalog=new LokiCatalog(cat=>{adapter.catalog=cat;adapter.getCatalogSummary(callback)});return}this.catalog.getAllKeys(results=>{const entries=[];let obj;let size;let oapp;let okey;let oval;for(let idx=0;idx{})}})}}__webpack_exports__["LokiIndexedStorage"]=LokiIndexedStorage;class LokiCatalog{constructor(callback){this.db=null;this.initializeLokiCatalog(callback)}initializeLokiCatalog(callback){const openRequest=indexedDB.open("LokiCatalog",1);const cat=this;openRequest.onupgradeneeded=(e=>{const thisDB=e.target.result;if(thisDB.objectStoreNames.contains("LokiAKV")){thisDB.deleteObjectStore("LokiAKV")}if(!thisDB.objectStoreNames.contains("LokiAKV")){const objectStore=thisDB.createObjectStore("LokiAKV",{keyPath:"id",autoIncrement:true});objectStore.createIndex("app","app",{unique:false});objectStore.createIndex("key","key",{unique:false});objectStore.createIndex("appkey","appkey",{unique:true})}});openRequest.onsuccess=(e=>{cat.db=e.target.result;if(typeof callback==="function")callback(cat)});openRequest.onerror=(e=>{throw e})}getAppKey(app,key,callback){const transaction=this.db.transaction(["LokiAKV"],"readonly");const store=transaction.objectStore("LokiAKV");const index=store.index("appkey");const appkey=app+","+key;const request=index.get(appkey);request.onsuccess=(usercallback=>e=>{let lres=e.target.result;if(lres===null||lres===undefined){lres={id:0,success:false}}if(typeof usercallback==="function"){usercallback(lres)}else{}})(callback);request.onerror=(usercallback=>e=>{if(typeof usercallback==="function"){usercallback({id:0,success:false})}else{throw e}})(callback)}getAppKeyById(id,callback,data){const transaction=this.db.transaction(["LokiAKV"],"readonly");const store=transaction.objectStore("LokiAKV");const request=store.get(id);request.onsuccess=((data,usercallback)=>e=>{if(typeof usercallback==="function"){usercallback(e.target.result,data)}else{}})(data,callback)}setAppKey(app,key,val,callback){const transaction=this.db.transaction(["LokiAKV"],"readwrite");const store=transaction.objectStore("LokiAKV");const index=store.index("appkey");const appkey=app+","+key;const request=index.get(appkey);request.onsuccess=(e=>{let res=e.target.result;if(res===null||res===undefined){res={app:app,key:key,appkey:app+","+key,val:val}}else{res.val=val}const requestPut=store.put(res);requestPut.onerror=(usercallback=>()=>{if(typeof usercallback==="function"){usercallback({success:false})}else{}})(callback);requestPut.onsuccess=(usercallback=>()=>{if(typeof usercallback==="function"){usercallback({success:true})}})(callback)});request.onerror=(usercallback=>()=>{if(typeof usercallback==="function"){usercallback({success:false})}else{}})(callback)}deleteAppKey(id,callback){const transaction=this.db.transaction(["LokiAKV"],"readwrite");const store=transaction.objectStore("LokiAKV");const request=store.delete(id);request.onsuccess=(usercallback=>()=>{if(typeof usercallback==="function")usercallback({success:true})})(callback);request.onerror=(usercallback=>()=>{if(typeof usercallback==="function"){usercallback(false)}else{}})(callback)}getAppKeys(app,callback){const transaction=this.db.transaction(["LokiAKV"],"readonly");const store=transaction.objectStore("LokiAKV");const index=store.index("app");const singleKeyRange=IDBKeyRange.only(app);const cursor=index.openCursor(singleKeyRange);const localdata=[];cursor.onsuccess=((data,callback)=>e=>{const cursor=e.target.result;if(cursor){const currObject=cursor.value;data.push(currObject);cursor.continue()}else{if(typeof callback==="function"){callback(data)}else{}}})(localdata,callback);cursor.onerror=(usercallback=>()=>{if(typeof usercallback==="function"){usercallback(null)}else{}})(callback)}getAllKeys(callback){const transaction=this.db.transaction(["LokiAKV"],"readonly");const store=transaction.objectStore("LokiAKV");const cursor=store.openCursor();const localdata=[];cursor.onsuccess=((data,callback)=>e=>{const cursor=e.target.result;if(cursor){const currObject=cursor.value;data.push(currObject);cursor.continue()}else{if(typeof callback==="function"){callback(data)}else{}}})(localdata,callback);cursor.onerror=(usercallback=>()=>{if(typeof usercallback==="function")usercallback(null)})(callback)}}__webpack_exports__["default"]=LokiIndexedStorage},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){function getGlobal(){let glob;(function(global){glob=global})(global!==undefined&&global||this);return glob}function create(){const global=getGlobal();const sym=Symbol.for("LOKI");if(global[sym]===undefined){global[sym]={}}return global[sym]}const PLUGINS=create();__webpack_exports__["a"]=PLUGINS}).call(__webpack_exports__,__webpack_require__(2))},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(1,eval)("this")}catch(e){if(typeof window==="object")g=window}module.exports=g}])}); \ No newline at end of file +(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["@lokijs/indexed-storage"]=factory();else{root["@lokijs/indexed-storage"]=factory();root["LokiIndexedStorage"]=root["@lokijs/indexed-storage"].default}})(typeof self!=="undefined"?self:this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__indexed_storage__=__webpack_require__(1);__webpack_require__.d(__webpack_exports__,"IndexedStorage",function(){return __WEBPACK_IMPORTED_MODULE_0__indexed_storage__["a"]});__webpack_exports__["default"]=__WEBPACK_IMPORTED_MODULE_0__indexed_storage__["a"]},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__common_plugin__=__webpack_require__(2);class IndexedStorage{static register(){__WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["IndexedStorage"]=IndexedStorage}static deregister(){delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["IndexedStorage"]}constructor(appname="loki"){this._appname=appname;this.catalog=null}loadDatabase(dbname){const appName=this._appname;const adapter=this;if(this.catalog===null||this.catalog.db===null){return new Promise(resolve=>{adapter.catalog=new LokiCatalog(cat=>{adapter.catalog=cat;resolve(adapter.loadDatabase(dbname))})})}return new Promise(resolve=>{this.catalog.getAppKey(appName,dbname,result=>{if(result.id===0){resolve();return}resolve(result.val)})})}saveDatabase(dbname,dbstring){const appName=this._appname;const adapter=this;let resolve;let reject;const result=new Promise((res,rej)=>{resolve=res;reject=rej});function saveCallback(result){if(result&&result.success===true){resolve()}else{reject(new Error("Error saving database"))}}if(this.catalog===null||this.catalog.db===null){this.catalog=new LokiCatalog(cat=>{adapter.catalog=cat;cat.setAppKey(appName,dbname,dbstring,saveCallback)});return Promise.resolve()}this.catalog.setAppKey(appName,dbname,dbstring,saveCallback);return Promise.resolve()}deleteDatabase(dbname){const appName=this._appname;const adapter=this;if(this.catalog===null||this.catalog.db===null){return new Promise(resolve=>{adapter.catalog=new LokiCatalog(cat=>{adapter.catalog=cat;resolve(adapter.deleteDatabase(dbname))})})}return new Promise(resolve=>{this.catalog.getAppKey(appName,dbname,result=>{const id=result.id;if(id!==0){adapter.catalog.deleteAppKey(id)}resolve()})})}deleteDatabasePartitions(dbname){this.getDatabaseList(result=>{result.forEach(str=>{if(str.startsWith(dbname)){this.deleteDatabase(str)}})})}getDatabaseList(callback){const appName=this._appname;const adapter=this;if(this.catalog===null||this.catalog.db===null){this.catalog=new LokiCatalog(cat=>{adapter.catalog=cat;adapter.getDatabaseList(callback)});return}this.catalog.getAppKeys(appName,results=>{const names=[];for(let idx=0;idx{})}})}getCatalogSummary(callback){const adapter=this;if(this.catalog===null||this.catalog.db===null){this.catalog=new LokiCatalog(cat=>{adapter.catalog=cat;adapter.getCatalogSummary(callback)});return}this.catalog.getAllKeys(results=>{const entries=[];let obj;let size;let oapp;let okey;let oval;for(let idx=0;idx{})}})}}__webpack_exports__["a"]=IndexedStorage;class LokiCatalog{constructor(callback){this.db=null;this.initializeLokiCatalog(callback)}initializeLokiCatalog(callback){const openRequest=indexedDB.open("LokiCatalog",1);const cat=this;openRequest.onupgradeneeded=(e=>{const thisDB=e.target.result;if(thisDB.objectStoreNames.contains("LokiAKV")){thisDB.deleteObjectStore("LokiAKV")}if(!thisDB.objectStoreNames.contains("LokiAKV")){const objectStore=thisDB.createObjectStore("LokiAKV",{keyPath:"id",autoIncrement:true});objectStore.createIndex("app","app",{unique:false});objectStore.createIndex("key","key",{unique:false});objectStore.createIndex("appkey","appkey",{unique:true})}});openRequest.onsuccess=(e=>{cat.db=e.target.result;if(typeof callback==="function")callback(cat)});openRequest.onerror=(e=>{throw e})}getAppKey(app,key,callback){const transaction=this.db.transaction(["LokiAKV"],"readonly");const store=transaction.objectStore("LokiAKV");const index=store.index("appkey");const appkey=app+","+key;const request=index.get(appkey);request.onsuccess=(usercallback=>e=>{let lres=e.target.result;if(lres===null||lres===undefined){lres={id:0,success:false}}if(typeof usercallback==="function"){usercallback(lres)}else{}})(callback);request.onerror=(usercallback=>e=>{if(typeof usercallback==="function"){usercallback({id:0,success:false})}else{throw e}})(callback)}getAppKeyById(id,callback,data){const transaction=this.db.transaction(["LokiAKV"],"readonly");const store=transaction.objectStore("LokiAKV");const request=store.get(id);request.onsuccess=((data,usercallback)=>e=>{if(typeof usercallback==="function"){usercallback(e.target.result,data)}else{}})(data,callback)}setAppKey(app,key,val,callback){const transaction=this.db.transaction(["LokiAKV"],"readwrite");const store=transaction.objectStore("LokiAKV");const index=store.index("appkey");const appkey=app+","+key;const request=index.get(appkey);request.onsuccess=(e=>{let res=e.target.result;if(res===null||res===undefined){res={app:app,key:key,appkey:app+","+key,val:val}}else{res.val=val}const requestPut=store.put(res);requestPut.onerror=(usercallback=>()=>{if(typeof usercallback==="function"){usercallback({success:false})}else{}})(callback);requestPut.onsuccess=(usercallback=>()=>{if(typeof usercallback==="function"){usercallback({success:true})}})(callback)});request.onerror=(usercallback=>()=>{if(typeof usercallback==="function"){usercallback({success:false})}else{}})(callback)}deleteAppKey(id,callback){const transaction=this.db.transaction(["LokiAKV"],"readwrite");const store=transaction.objectStore("LokiAKV");const request=store.delete(id);request.onsuccess=(usercallback=>()=>{if(typeof usercallback==="function")usercallback({success:true})})(callback);request.onerror=(usercallback=>()=>{if(typeof usercallback==="function"){usercallback(false)}else{}})(callback)}getAppKeys(app,callback){const transaction=this.db.transaction(["LokiAKV"],"readonly");const store=transaction.objectStore("LokiAKV");const index=store.index("app");const singleKeyRange=IDBKeyRange.only(app);const cursor=index.openCursor(singleKeyRange);const localdata=[];cursor.onsuccess=((data,callback)=>e=>{const cursor=e.target.result;if(cursor){const currObject=cursor.value;data.push(currObject);cursor.continue()}else{if(typeof callback==="function"){callback(data)}else{}}})(localdata,callback);cursor.onerror=(usercallback=>()=>{if(typeof usercallback==="function"){usercallback(null)}else{}})(callback)}getAllKeys(callback){const transaction=this.db.transaction(["LokiAKV"],"readonly");const store=transaction.objectStore("LokiAKV");const cursor=store.openCursor();const localdata=[];cursor.onsuccess=((data,callback)=>e=>{const cursor=e.target.result;if(cursor){const currObject=cursor.value;data.push(currObject);cursor.continue()}else{if(typeof callback==="function"){callback(data)}else{}}})(localdata,callback);cursor.onerror=(usercallback=>()=>{if(typeof usercallback==="function")usercallback(null)})(callback)}}var _unused_webpack_default_export=IndexedStorage},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){function getGlobal(){let glob;(function(global){glob=global})(global!==undefined&&global||this);return glob}function create(){const global=getGlobal();const sym=Symbol.for("LOKI");if(global[sym]===undefined){global[sym]={}}return global[sym]}const PLUGINS=create();__webpack_exports__["a"]=PLUGINS}).call(__webpack_exports__,__webpack_require__(3))},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(1,eval)("this")}catch(e){if(typeof window==="object")g=window}module.exports=g}])}); \ No newline at end of file diff --git a/dist/packages/indexed-storage/types/common/types.d.ts b/dist/packages/indexed-storage/types/common/types.d.ts index 846847e6..b8a936c6 100644 --- a/dist/packages/indexed-storage/types/common/types.d.ts +++ b/dist/packages/indexed-storage/types/common/types.d.ts @@ -1,10 +1,13 @@ -export declare type ANY = any; +/** + * @hidden + */ +import { Loki } from "../loki/src"; export interface StorageAdapter { loadDatabase(dbname: string): Promise; saveDatabase?(dbname: string, serialization: string): Promise; deleteDatabase?(dbname: string): Promise; mode?: string; - exportDatabase?(dbname: string, dbref: ANY): Promise; + exportDatabase?(dbname: string, dbref: Loki): Promise; } export declare type Doc = T & { $loki: number; @@ -14,10 +17,3 @@ export interface Dict { [index: string]: T; [index: number]: T; } -export interface Query { -} -export interface Filter { - type: string; - val: Query | ((obj: E, index: number, array: E[]) => boolean); - uid: number | string; -} diff --git a/dist/packages/indexed-storage/types/fs-storage/src/fs_storage.d.ts b/dist/packages/indexed-storage/types/fs-storage/src/fs_storage.d.ts index a92567ea..9930c0d0 100644 --- a/dist/packages/indexed-storage/types/fs-storage/src/fs_storage.d.ts +++ b/dist/packages/indexed-storage/types/fs-storage/src/fs_storage.d.ts @@ -2,7 +2,7 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists using node fs module. */ -export declare class LokiFSStorage implements StorageAdapter { +export declare class FSStorage implements StorageAdapter { /** * Registers the fs storage as plugin. */ @@ -32,4 +32,3 @@ export declare class LokiFSStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiFSStorage; diff --git a/dist/packages/indexed-storage/types/fs-storage/src/index.d.ts b/dist/packages/indexed-storage/types/fs-storage/src/index.d.ts new file mode 100644 index 00000000..e6b33d6c --- /dev/null +++ b/dist/packages/indexed-storage/types/fs-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { FSStorage } from "./fs_storage"; +export { FSStorage }; +export default FSStorage; diff --git a/dist/packages/indexed-storage/types/full-text-search-language-de/src/index.d.ts b/dist/packages/indexed-storage/types/full-text-search-language-de/src/index.d.ts new file mode 100644 index 00000000..a2665427 --- /dev/null +++ b/dist/packages/indexed-storage/types/full-text-search-language-de/src/index.d.ts @@ -0,0 +1,3 @@ +import { DE } from "./de"; +export { DE }; +export default DE; diff --git a/dist/packages/indexed-storage/types/full-text-search-language-en/src/index.d.ts b/dist/packages/indexed-storage/types/full-text-search-language-en/src/index.d.ts new file mode 100644 index 00000000..8313cf98 --- /dev/null +++ b/dist/packages/indexed-storage/types/full-text-search-language-en/src/index.d.ts @@ -0,0 +1,3 @@ +import { EN } from "./en"; +export { EN }; +export default EN; diff --git a/dist/packages/indexed-storage/types/full-text-search-language/src/index.d.ts b/dist/packages/indexed-storage/types/full-text-search-language/src/index.d.ts new file mode 100644 index 00000000..e52d1a42 --- /dev/null +++ b/dist/packages/indexed-storage/types/full-text-search-language/src/index.d.ts @@ -0,0 +1 @@ +export { generateStopWordFilter, generateTrimmer, Among, SnowballProgram } from "./language"; diff --git a/dist/packages/indexed-storage/types/full-text-search/src/full_text_search.d.ts b/dist/packages/indexed-storage/types/full-text-search/src/full_text_search.d.ts index a4752c88..65a26bef 100644 --- a/dist/packages/indexed-storage/types/full-text-search/src/full_text_search.d.ts +++ b/dist/packages/indexed-storage/types/full-text-search/src/full_text_search.d.ts @@ -2,7 +2,7 @@ import { InvertedIndex } from "./inverted_index"; import { Tokenizer } from "./tokenizer"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; export declare class FullTextSearch { private _id; private _docs; @@ -21,14 +21,14 @@ export declare class FullTextSearch { * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized * (requires more memory but performs better) * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field - * @param {string=$loki} id - the property name of the document index + * @param {string} [id] - the property name of the document index */ constructor(fields?: FullTextSearch.FieldOptions[], id?: string); addDocument(doc: object, id?: number): void; removeDocument(doc: object, id?: number): void; updateDocument(doc: object, id?: number): void; clear(): void; - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; toJSON(): FullTextSearch.Serialization; static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers?: Dict): FullTextSearch; } diff --git a/dist/packages/indexed-storage/types/full-text-search/src/index.d.ts b/dist/packages/indexed-storage/types/full-text-search/src/index.d.ts index f03dde09..b901b108 100644 --- a/dist/packages/indexed-storage/types/full-text-search/src/index.d.ts +++ b/dist/packages/indexed-storage/types/full-text-search/src/index.d.ts @@ -1,6 +1,5 @@ import { FullTextSearch } from "./full_text_search"; -export { Tokenizer } from "./tokenizer"; -export { QueryBuilder } from "./query_builder"; -export { InvertedIndex } from "./inverted_index"; -export { FullTextSearch }; +import { Tokenizer } from "./tokenizer"; +import { QueryBuilder } from "./query_builder"; +export { FullTextSearch, Tokenizer, QueryBuilder }; export default FullTextSearch; diff --git a/dist/packages/indexed-storage/types/full-text-search/src/index_searcher.d.ts b/dist/packages/indexed-storage/types/full-text-search/src/index_searcher.d.ts index d3cf7f93..00b99f2f 100644 --- a/dist/packages/indexed-storage/types/full-text-search/src/index_searcher.d.ts +++ b/dist/packages/indexed-storage/types/full-text-search/src/index_searcher.d.ts @@ -1,4 +1,4 @@ -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; import { InvertedIndex } from "./inverted_index"; import { Query } from "./query_builder"; import { Dict } from "../../common/types"; @@ -13,9 +13,9 @@ export declare class IndexSearcher { * @param {object} invIdxs */ constructor(invIdxs: Dict, docs: Set); - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; setDirty(): void; private _recursive(query, doScoring); - private _getUnique(queries, doScoring, docResults); + private _getUnique(queries, doScoring, queryResults); private _getAll(queries, doScoring); } diff --git a/dist/packages/indexed-storage/types/full-text-search/src/query_builder.d.ts b/dist/packages/indexed-storage/types/full-text-search/src/query_builder.d.ts index 923317f6..6f324e15 100644 --- a/dist/packages/indexed-storage/types/full-text-search/src/query_builder.d.ts +++ b/dist/packages/indexed-storage/types/full-text-search/src/query_builder.d.ts @@ -24,8 +24,8 @@ export declare class BaseQueryBuilder { */ build(): any; } -export interface BaseQuery { - type: string; +export interface BaseQuery { + type: Type; boost?: number; } /** @@ -51,7 +51,7 @@ export declare class TermQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, term: string, data?: any); } -export interface TermQuery extends BaseQuery { +export interface TermQuery extends BaseQuery<"term"> { field: string; value: string; } @@ -78,7 +78,7 @@ export declare class TermsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, terms: Array, data?: any); } -export interface TermsQuery extends BaseQuery { +export interface TermsQuery extends BaseQuery<"terms"> { field: string; value: string[]; } @@ -119,7 +119,7 @@ export declare class WildcardQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface WildcardQuery extends BaseQuery { +export interface WildcardQuery extends BaseQuery<"wildcard"> { field: string; value: string; enable_scoring?: boolean; @@ -169,7 +169,7 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { * * @return {FuzzyQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the initial word length. * @param {number} prefixLength - the positive prefix length @@ -183,10 +183,10 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface FuzzyQuery extends BaseQuery { +export interface FuzzyQuery extends BaseQuery<"fuzzy"> { field: string; value: string; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -221,7 +221,7 @@ export declare class PrefixQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface PrefixQuery extends BaseQuery { +export interface PrefixQuery extends BaseQuery<"prefix"> { field: string; value: string; enable_scoring?: boolean; @@ -247,7 +247,7 @@ export declare class ExistsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, data?: any); } -export interface ExistsQuery extends BaseQuery { +export interface ExistsQuery extends BaseQuery<"exists"> { field: string; } /** @@ -315,7 +315,7 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { * * @return {MatchQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the starting word length which should not be considered for fuzziness. * @param {number} prefixLength - the positive prefix length @@ -329,12 +329,12 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface MatchQuery extends BaseQuery { +export interface MatchQuery extends BaseQuery<"match"> { field: string; value: string; minimum_should_match?: number; operator?: "and" | "or"; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -360,7 +360,7 @@ export interface MatchQuery extends BaseQuery { export declare class MatchAllQueryBuilder extends BaseQueryBuilder { constructor(data?: any); } -export interface MatchQueryAll extends BaseQuery { +export interface MatchQueryAll extends BaseQuery<"match_all"> { } /** * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter. @@ -388,9 +388,11 @@ export declare class ConstantScoreQueryBuilder extends BaseQueryBuilder { * Starts an array of queries. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): ConstantScoreQueryBuilder; + }; } -export interface ConstantScoreQuery extends BaseQuery { +export interface ConstantScoreQuery extends BaseQuery<"constant_score"> { filter: ArrayQuery; } /** @@ -442,22 +444,30 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { * Starts an array of queries for must clause. Use endMust() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginMust(): ArrayQueryBuilder; + beginMust(): ArrayQueryBuilder & { + endMust(): BoolQueryBuilder; + }; /** * Starts an array of queries for filter clause. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): BoolQueryBuilder; + }; /** * Starts an array of queries for should clause. Use endShould() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginShould(): ArrayQueryBuilder; + beginShould(): ArrayQueryBuilder & { + endShould(): BoolQueryBuilder; + }; /** * Starts an array of queries for not clause. Use endNot() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginNot(): ArrayQueryBuilder; + beginNot(): ArrayQueryBuilder & { + endNot(): BoolQueryBuilder; + }; /** * Controls the amount of minimum matching sub queries before a document will be considered. * @param {number} minShouldMatch - number of minimum matching sub queries @@ -472,7 +482,7 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { */ minimumShouldMatch(minShouldMatch: number): this; } -export interface BoolQuery extends BaseQuery { +export interface BoolQuery extends BaseQuery<"bool"> { must?: ArrayQuery; filter?: ArrayQuery; should?: ArrayQuery; @@ -497,8 +507,8 @@ export declare class ArrayQueryBuilder extends BaseQueryBuilder { prefix(field: string, prefix: string): any; exists(field: string): any; } -export interface ArrayQuery { - values: any[]; +export interface ArrayQuery extends BaseQuery<"array"> { + values: QueryTypes[]; } /** * This query builder is the root of each query search. @@ -525,9 +535,15 @@ export declare class QueryBuilder { /** * The query performs a final scoring over all scored sub queries. * @param {boolean} enable - flag to enable or disable final scoring - * @return {QueryBuilder} + * @return {this} */ enableFinalScoring(enable: boolean): this; + /** + * Adds an explanation of the scoring of each document for all matched terms. + * @param {boolean} enable -flag to enable or disable explanation + * @returns {this} + */ + explain(enable: boolean): this; /** * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model. * @@ -535,10 +551,10 @@ export declare class QueryBuilder { * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}. * * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation. - * Lower values result in quicker saturation, and higher values in slower saturation. + * Lower values result in quicker saturation, and higher values in slower saturation * @param {number} [b=0.75] - controls how much effect field-length normalization should have. - * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully. - * @return {QueryBuilder} + * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully + * @return {this} */ BM25Similarity(k1?: number, b?: number): this; bool(): BoolQueryBuilder; @@ -553,9 +569,11 @@ export declare class QueryBuilder { exists(field: string): ExistsQueryBuilder; private _prepare(queryType, ...args); } +export declare type QueryTypes = BoolQuery | ConstantScoreQuery | TermQuery | TermsQuery | WildcardQuery | FuzzyQuery | MatchQuery | MatchQueryAll | PrefixQuery | ExistsQuery; export interface Query { - query: any; + query: QueryTypes; final_scoring?: boolean; + explain?: boolean; bm25?: { k1: number; b: number; diff --git a/dist/packages/indexed-storage/types/full-text-search/src/scorer.d.ts b/dist/packages/indexed-storage/types/full-text-search/src/scorer.d.ts index aed3e619..dacdc753 100644 --- a/dist/packages/indexed-storage/types/full-text-search/src/scorer.d.ts +++ b/dist/packages/indexed-storage/types/full-text-search/src/scorer.d.ts @@ -1,7 +1,6 @@ import { InvertedIndex } from "./inverted_index"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -export declare type ScoreResult = Dict; /** * @hidden */ @@ -10,9 +9,9 @@ export declare class Scorer { private _cache; constructor(invIdxs: Dict); setDirty(): void; - score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, docResults: Scorer.DocResults, term: number[]): void; - scoreConstant(boost: number, docId: number, docResults: Scorer.DocResults): Map; - finalScore(query: Query, docResults: Scorer.DocResults): ScoreResult; + score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, queryResults: Scorer.QueryResults, term: number[]): void; + scoreConstant(boost: number, docId: number, queryResults: Scorer.QueryResults): Map; + finalScore(query: Query, queryResults: Scorer.QueryResults): Scorer.ScoreResult; private static _calculateFieldLength(fieldLength); private _getCache(fieldName); /** @@ -30,12 +29,33 @@ export declare namespace Scorer { idfs: Dict; avgFieldLength: number; } - interface DocResult { + interface QueryResult { tf?: number; idf?: number; boost: number; fieldName?: string; term?: number[]; } - type DocResults = Map; + type QueryResults = Map; + interface BM25Explanation { + boost: number; + score: number; + docID: number; + fieldName: string; + index: string; + idf: number; + tfNorm: number; + tf: number; + fieldLength: number; + avgFieldLength: number; + } + interface ConstantExplanation { + boost: number; + score: number; + } + type ScoreExplanation = BM25Explanation | ConstantExplanation; + type ScoreResult = Dict<{ + score: number; + explanation?: ScoreExplanation[]; + }>; } diff --git a/dist/packages/indexed-storage/types/indexed-storage/src/index.d.ts b/dist/packages/indexed-storage/types/indexed-storage/src/index.d.ts new file mode 100644 index 00000000..bf453632 --- /dev/null +++ b/dist/packages/indexed-storage/types/indexed-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { IndexedStorage } from "./indexed_storage"; +export { IndexedStorage }; +export default IndexedStorage; diff --git a/dist/packages/indexed-storage/types/indexed-storage/src/indexed_storage.d.ts b/dist/packages/indexed-storage/types/indexed-storage/src/indexed_storage.d.ts index 457b01a0..adaeaef1 100644 --- a/dist/packages/indexed-storage/types/indexed-storage/src/indexed_storage.d.ts +++ b/dist/packages/indexed-storage/types/indexed-storage/src/indexed_storage.d.ts @@ -6,7 +6,7 @@ import { StorageAdapter } from "../../common/types"; * IndexedDb storage is provided per-domain, so we implement app/key/value database to * allow separate contexts for separate apps within a domain. */ -export declare class LokiIndexedStorage implements StorageAdapter { +export declare class IndexedStorage implements StorageAdapter { private _appname; private catalog; /** @@ -98,4 +98,4 @@ export interface Entry { key: string; size: number; } -export default LokiIndexedStorage; +export default IndexedStorage; diff --git a/dist/packages/indexed-storage/types/local-storage/src/index.d.ts b/dist/packages/indexed-storage/types/local-storage/src/index.d.ts new file mode 100644 index 00000000..2b74e8c0 --- /dev/null +++ b/dist/packages/indexed-storage/types/local-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { LocalStorage } from "./local_storage"; +export { LocalStorage }; +export default LocalStorage; diff --git a/dist/packages/indexed-storage/types/local-storage/src/local_storage.d.ts b/dist/packages/indexed-storage/types/local-storage/src/local_storage.d.ts index 2337eb12..380d8be9 100644 --- a/dist/packages/indexed-storage/types/local-storage/src/local_storage.d.ts +++ b/dist/packages/indexed-storage/types/local-storage/src/local_storage.d.ts @@ -1,9 +1,9 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists to web browser's local storage object - * @constructor LokiLocalStorageAdapter + * @constructor LocalStorageAdapter */ -export declare class LokiLocalStorage implements StorageAdapter { +export declare class LocalStorage implements StorageAdapter { /** * Registers the local storage as plugin. */ @@ -33,4 +33,4 @@ export declare class LokiLocalStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiLocalStorage; +export default LocalStorage; diff --git a/dist/packages/indexed-storage/types/loki/src/clone.d.ts b/dist/packages/indexed-storage/types/loki/src/clone.d.ts index 03b650d7..c74a17bd 100644 --- a/dist/packages/indexed-storage/types/loki/src/clone.d.ts +++ b/dist/packages/indexed-storage/types/loki/src/clone.d.ts @@ -1,10 +1,4 @@ -export declare enum CloneMethod { - PARSE_STRINGIFY = 0, - DEEP = 1, - SHALLOW = 2, - SHALLOW_ASSIGN = 3, - SHALLOW_RECURSE_OBJECTS = 4, -} +export declare type CloneMethod = "parse-stringify" | "deep" | "shallow" | "shallow-recurse-objects"; /** * @hidden */ diff --git a/dist/packages/indexed-storage/types/loki/src/collection.d.ts b/dist/packages/indexed-storage/types/loki/src/collection.d.ts index 8b44c82f..9bd5e091 100644 --- a/dist/packages/indexed-storage/types/loki/src/collection.d.ts +++ b/dist/packages/indexed-storage/types/loki/src/collection.d.ts @@ -1,34 +1,39 @@ import { LokiEventEmitter } from "./event_emitter"; import { UniqueIndex } from "./unique_index"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { DynamicView } from "./dynamic_view"; import { CloneMethod } from "./clone"; -import { Doc, Dict, Query } from "../../common/types"; +import { Doc, Dict } from "../../common/types"; import { FullTextSearch } from "../../full-text-search/src/full_text_search"; import { Tokenizer } from "../../full-text-search/src/tokenizer"; -export declare type ANY = any; export { CloneMethod } from "./clone"; /** * Collection class that handles documents of same type * @extends LokiEventEmitter + * @param - the data type + * @param - nested properties of data type */ -export declare class Collection extends LokiEventEmitter { +export declare class Collection extends LokiEventEmitter { name: string; - data: Doc[]; + _data: Doc[]; private idIndex; - binaryIndices: Dict; + binaryIndices: { + [P in keyof TData]?: Collection.BinaryIndex; + }; /** - * Unique contraints contain duplicate object references, so they are not persisted. - * We will keep track of properties which have unique contraint applied here, and regenerate on load. + * Unique constraints contain duplicate object references, so they are not persisted. + * We will keep track of properties which have unique constraints applied here, and regenerate on load. */ constraints: { - unique: {}; + unique: { + [P in keyof TData]?: UniqueIndex; + }; }; /** * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along * with the database. */ - transforms: {}; + transforms: Dict[]>; /** * In autosave scenarios we will use collection level dirty flags to determine whether save is needed. * currently, if any collection is dirty we will autosave the whole database if autosave is configured. @@ -62,7 +67,7 @@ export declare class Collection extends LokiEventEmit /** * Disable delta update object style on changes. */ - disableDeltaChangesApi: ANY; + disableDeltaChangesApi: boolean; /** * By default, if you insert a document into a collection with binary indices, if those indexed properties contain * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the @@ -72,7 +77,7 @@ export declare class Collection extends LokiEventEmit /** * Option to activate a cleaner daemon - clears "aged" documents at set intervals. */ - ttl: ANY; + ttl: Collection.TTL; private maxId; private _dynamicViews; /** @@ -81,7 +86,15 @@ export declare class Collection extends LokiEventEmit private changes; private insertHandler; private updateHandler; - console: ANY; + console: { + log(...args: any[]): void; + warn(...args: any[]): void; + error(...args: any[]): void; + }; + /** + * stages: a map of uniquely identified 'stages', which hold copies of objects to be + * manipulated without affecting the data in the original collection + */ private stages; private commitLog; _fullTextSearch: FullTextSearch; @@ -97,69 +110,50 @@ export declare class Collection extends LokiEventEmit * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable - * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method + * @param {string} [options.cloneMethod="deep"] - the clone method * @param {number} [options.transactional=false] - ? * @param {number} options.ttl - ? * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @see {@link Loki#addCollection} for normal creation of collections */ - constructor(name: string, options?: Collection.Options); - toJSON(): { - name: string; - _dynamicViews: DynamicView[]; - uniqueNames: string[]; - transforms: {}; - binaryIndices: Dict; - data: Doc[]; - idIndex: number[]; - maxId: number; - dirty: boolean; - adaptiveBinaryIndices: boolean; - transactional: boolean; - asyncListeners: boolean; - disableChangesApi: boolean; - cloneObjects: boolean; - cloneMethod: CloneMethod; - changes: any[]; - _fullTextSearch: FullTextSearch; - }; - static fromJSONObject(obj: ANY, options?: Collection.DeserializeOptions): Collection; + constructor(name: string, options?: Collection.Options); + toJSON(): Collection.Serialized; + static fromJSONObject(obj: Collection.Serialized, options?: Collection.DeserializeOptions): Collection; /** * Adds a named collection transform to the collection * @param {string} name - name to associate with transform * @param {array} transform - an array of transformation 'step' objects to save into the collection */ - addTransform(name: string, transform: ANY[]): void; + addTransform(name: string, transform: Collection.Transform[]): void; /** * Retrieves a named transform from the collection. * @param {string} name - name of the transform to lookup. */ - getTransform(name: string): any; + getTransform(name: string): Collection.Transform[]; /** * Updates a named collection transform to the collection * @param {string} name - name to associate with transform * @param {object} transform - a transformation object to save into collection */ - setTransform(name: string, transform: ANY[]): void; + setTransform(name: string, transform: Collection.Transform[]): void; /** * Removes a named collection transform from the collection * @param {string} name - name of collection transform to remove */ removeTransform(name: string): void; - ttlDaemonFuncGen(): () => void; private setTTL(age, interval); /** * create a row filter that covers all documents in the collection */ - prepareFullDocIndex(): any[]; + _prepareFullDocIndex(): number[]; /** * Ensure binary index on a certain field * @param {string} property - name of property to create binary index on - * @param {boolean} force - (Optional) flag indicating whether to construct index immediately + * @param {boolean} [force=false] - flag indicating whether to construct index immediately */ - ensureIndex(property: string, force?: boolean): void; - getSequencedIndexValues(property: string): string; - ensureUniqueIndex(field: string): UniqueIndex; + ensureIndex(property: keyof TData, force?: boolean): void; + getSequencedIndexValues(property: keyof TData): string; + ensureUniqueIndex(field: keyof TData): UniqueIndex; /** * Ensure all binary indices */ @@ -171,11 +165,11 @@ export declare class Collection extends LokiEventEmit * @param {object} query - (optional) query object to count results of * @returns {number} number of documents in the collection */ - count(query?: object): number; + count(query?: ResultSet.Query & TNested>): number; /** * Rebuild idIndex */ - ensureId(): void; + private _ensureId(); /** * Add a dynamic view to the collection * @param {string} name - name of dynamic view to add @@ -185,7 +179,7 @@ export declare class Collection extends LokiEventEmit * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here) * @returns {DynamicView} reference to the dynamic view added **/ - addDynamicView(name: string, options?: DynamicView.Options): DynamicView; + addDynamicView(name: string, options?: DynamicView.Options): DynamicView; /** * Remove a dynamic view from the collection * @param {string} name - name of dynamic view to remove @@ -196,7 +190,7 @@ export declare class Collection extends LokiEventEmit * @param {string} name - name of dynamic view to retrieve reference of * @returns {DynamicView} A reference to the dynamic view with that name **/ - getDynamicView(name: string): DynamicView; + getDynamicView(name: string): DynamicView; /** * Applies a 'mongo-like' find query object and passes all results to an update function. * For filter function querying you should migrate to [ @@ -205,38 +199,39 @@ export declare class Collection extends LokiEventEmit * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode) * @param {function} updateFunction - update function to run against filtered documents */ - findAndUpdate(filterObject: Query | ((obj: E) => boolean), updateFunction: (obj: E) => E): void; + findAndUpdate(filterObject: ResultSet.Query & TNested> | ((obj: Doc) => boolean), updateFunction: (obj: Doc) => any): void; /** * Applies a 'mongo-like' find query object removes all documents which match that filter. * * @param {object} filterObject - 'mongo-like' query object */ - findAndRemove(filterObject: object): void; + findAndRemove(filterObject: ResultSet.Query & TNested>): void; /** * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc. * @param {(object|array)} doc - the document (or array of documents) to be inserted * @returns {(object|array)} document or documents inserted */ - insert(doc: E | E[]): Doc; - insert(doc: E[]): Doc[]; + insert(doc: TData): Doc; + insert(doc: TData[]): Doc[]; /** * Adds a single object, ensures it has meta properties, clone it if necessary, etc. * @param {object} doc - the document to be inserted * @param {boolean} bulkInsert - quiet pre-insert and insert event emits * @returns {object} document or 'undefined' if there was a problem inserting it */ - insertOne(doc: E, bulkInsert?: boolean): Doc; + insertOne(doc: TData, bulkInsert?: boolean): Doc; /** * Empties the collection. - * @param {object} options - configure clear behavior - * @param {boolean} options.removeIndices - (default: false) + * @param {boolean} [removeIndices=false] - remove indices */ - clear(options?: ANY): void; + clear({removeIndices: removeIndices}?: { + removeIndices?: boolean; + }): void; /** * Updates an object and notifies collection that the document has changed. * @param {object} doc - document to update within the collection */ - update(doc: ANY): any; + update(doc: Doc | Doc[]): void; /** * Add object to collection */ @@ -247,24 +242,24 @@ export declare class Collection extends LokiEventEmit * @param {function} filterFunction - filter function whose results will execute update * @param {function} updateFunction - update function to run against filtered documents */ - updateWhere(filterFunction: (obj: E) => boolean, updateFunction: (obj: E) => E): void; + updateWhere(filterFunction: (obj: Doc) => boolean, updateFunction: (obj: Doc) => any): void; /** * Remove all documents matching supplied filter function. * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}. * @param {function|object} query - query object to filter on */ - removeWhere(query: Query | ((obj: E) => boolean)): void; + removeWhere(query: ResultSet.Query & TNested> | ((obj: Doc) => boolean)): void; removeDataOnly(): void; /** * Remove a document from the collection - * @param {object} doc - document to remove from collection + * @param {number|object} doc - document to remove from collection */ - remove(doc: ANY): any; + remove(doc: number | Doc | Doc[]): void; /** * Returns all changes. - * @returns {ANY} + * @returns {Collection.Change[]} */ - getChanges(): any[]; + getChanges(): Collection.Change[]; /** * Enables/disables changes api. * @param {boolean} disableChangesApi @@ -301,34 +296,35 @@ export declare class Collection extends LokiEventEmit * @returns {(object|array|null)} Object reference if document was found, null if not, * or an array if 'returnPosition' was passed. */ - get(id: number): Doc; - get(id: number, returnPosition: boolean): Doc | [Doc, number]; + get(id: number): Doc; + get(id: number, returnPosition: boolean): Doc | [Doc, number]; /** * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value * Since multiple documents may contain the same value (which the index is sorted on), * we hone in on range and then linear scan range to find exact index array position. - * @param {int} dataPosition : coll.data array index/position + * @param {int} dataPosition : data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - getBinaryIndexPosition(dataPosition: number, binaryIndexName: string): number; + getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData): number; /** * Adaptively insert a selected item to the index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively update a selected item within an index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively remove a selected item from the index. - * @param {int} dataPosition : coll.data array index/position + * @param {number} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in + * @param {boolean} removedFromIndexOnly - remove from index only */ - adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: string, removedFromIndexOnly?: boolean): ANY; + adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly?: boolean): void; /** * Internal method used for index maintenance and indexed searching. * Calculates the beginning of an index range for a given value. @@ -351,7 +347,7 @@ export declare class Collection extends LokiEventEmit private _calculateRangeEnd(prop, val); /** * Binary Search utility method to find range/segment of values matching criteria. - * this is used for collection.find() and first find filter of resultset/dynview + * this is used for collection.find() and first find filter of ResultSet/dynview * slightly different than get() binary search in that get() hones in on 1 value, * but we have to hone in on many (range) * @param {string} op - operation, such as $eq @@ -359,29 +355,29 @@ export declare class Collection extends LokiEventEmit * @param {object} val - value to use for range calculation. * @returns {array} [start, end] index array positions */ - calculateRange(op: string, prop: string, val: ANY): [number, number]; + calculateRange(op: string, prop: keyof TData, val: any): [number, number]; /** * Retrieve doc by Unique index * @param {string} field - name of uniquely indexed property to use when doing lookup * @param {any} value - unique value to search for * @returns {object} document matching the value passed */ - by(field: string, value: ANY): Doc; + by(field: string, value: any): Doc; /** * Find one object by index property, by property equal to value * @param {object} query - query object used to perform search with * @returns {(object|null)} First matching document, or null if none */ - findOne(query: object): Doc; + findOne(query: ResultSet.Query & TNested>): Doc; /** * Chain method, used for beginning a series of chained find() and/or view() operations * on a collection. * * @param {array} transform - Ordered array of transform step objects similar to chain * @param {object} parameters - Object containing properties representing parameters to substitute - * @returns {Resultset} (this) resultset, or data array if any map or join functions where called + * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called */ - chain(transform?: string | ANY[], parameters?: ANY): Resultset; + chain(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** * Find method, api is similar to mongodb. * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}. @@ -389,20 +385,26 @@ export declare class Collection extends LokiEventEmit * @param {object} query - 'mongo-like' query object * @returns {array} Array of matching documents */ - find(query?: Query): Doc[]; + find(query?: ResultSet.Query & TNested>): Doc[]; /** * Find object by unindexed field by property equal to value, * simply iterates and returns the first element matching the query */ - findOneUnindexed(prop: string, value: ANY): Doc; + findOneUnindexed(prop: string, value: any): Doc; /** * Transaction methods */ - /** start the transation */ + /** + * start the transation + */ startTransaction(): void; - /** commit the transation */ + /** + * commit the transation + */ commit(): void; - /** roll back the transation */ + /** + * roll back the transation + */ rollback(): void; /** * Query the collection by supplying a javascript filter function. @@ -414,14 +416,14 @@ export declare class Collection extends LokiEventEmit * @param {function} fun - filter function to run against all collection docs * @returns {array} all documents which pass your filter function */ - where(fun: (obj: E) => boolean): Doc[]; + where(fun: (obj: Doc) => boolean): Doc[]; /** * Map Reduce operation * @param {function} mapFunction - function to use as map function * @param {function} reduceFunction - function to use as reduce function * @returns {data} The result of your mapReduce operation */ - mapReduce(mapFunction: (value: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (value: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Join two collections on specified properties * @@ -429,13 +431,13 @@ export declare class Collection extends LokiEventEmit * @param {string} leftJoinProp - property name in collection * @param {string} rightJoinProp - property name in joinData * @param {function} mapFun - (Optional) map function to use - * @returns {Resultset} Result of the mapping operation - */ - eqJoin(joinData: ANY[], leftJoinProp: string, rightJoinProp: string, mapFun?: Function): Resultset; - /** - * stages: a map of uniquely identified 'stages', which hold copies of objects to be - * manipulated without affecting the data in the original collection + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method + * @returns {ResultSet} Result of the mapping operation */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinProp: string | ((obj: any) => string), rightJoinProp: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * (Staging API) create a stage and/or retrieve it */ @@ -446,7 +448,7 @@ export declare class Collection extends LokiEventEmit /** * (Staging API) create a copy of an object and insert it into a stage */ - stage(stageName: string, obj: ANY): any; + stage(stageName: string, obj: Doc): F; /** * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt * then create a message to be inserted in the commitlog @@ -459,10 +461,10 @@ export declare class Collection extends LokiEventEmit extract(field: string): any[]; /** */ - max(field: string): any; + max(field: string): number; /** */ - min(field: string): any; + min(field: string): number; /** */ maxRecord(field: string): { @@ -500,9 +502,9 @@ export declare class Collection extends LokiEventEmit median(field: string): number; } export declare namespace Collection { - interface Options { - unique?: string[]; - indices?: string[]; + interface Options { + unique?: (keyof TData)[]; + indices?: (keyof TData)[]; adaptiveBinaryIndices?: boolean; asyncListeners?: boolean; disableChangesApi?: boolean; @@ -518,10 +520,89 @@ export declare namespace Collection { interface DeserializeOptions { retainDirtyFlags?: boolean; fullTextSearch?: Dict; + [collName: string]: any | { + proto?: any; + inflate?: (src: object, dest?: object) => void; + }; } interface BinaryIndex { dirty: boolean; values: any; } - type Change = any; + interface Change { + name: string; + operation: string; + obj: any; + } + interface Serialized { + name: string; + _dynamicViews: DynamicView[]; + uniqueNames: string[]; + transforms: Dict; + binaryIndices: Dict; + _data: Doc[]; + idIndex: number[]; + maxId: number; + dirty: boolean; + adaptiveBinaryIndices: boolean; + transactional: boolean; + asyncListeners: boolean; + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + cloneObjects: boolean; + cloneMethod: CloneMethod; + changes: any; + _fullTextSearch: FullTextSearch; + } + type Transform = { + type: "find"; + value: ResultSet.Query & TNested> | string; + } | { + type: "where"; + value: ((obj: Doc) => boolean) | string; + } | { + type: "simplesort"; + property: keyof (TData & TNested); + desc?: boolean; + } | { + type: "compoundsort"; + value: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]; + } | { + type: "sort"; + value: (a: Doc, b: Doc) => number; + } | { + type: "sortByScoring"; + desc?: boolean; + } | { + type: "limit"; + value: number; + } | { + type: "offset"; + value: number; + } | { + type: "map"; + value: (obj: TData, index: number, array: TData[]) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "eqJoin"; + joinData: Collection | ResultSet; + leftJoinKey: string | ((obj: any) => string); + rightJoinKey: string | ((obj: any) => string); + mapFun?: (left: any, right: any) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "mapReduce"; + mapFunction: (item: TData, index: number, array: TData[]) => any; + reduceFunction: (array: any[]) => any; + } | { + type: "update"; + value: (obj: Doc) => any; + } | { + type: "remove"; + }; + interface TTL { + age: number; + ttlInterval: number; + daemon: any; + } } diff --git a/dist/packages/indexed-storage/types/loki/src/dynamic_view.d.ts b/dist/packages/indexed-storage/types/loki/src/dynamic_view.d.ts index 1aeab3a4..5cda4b13 100644 --- a/dist/packages/indexed-storage/types/loki/src/dynamic_view.d.ts +++ b/dist/packages/indexed-storage/types/loki/src/dynamic_view.d.ts @@ -1,9 +1,8 @@ import { LokiEventEmitter } from "./event_emitter"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { Collection } from "./collection"; -import { Doc, Filter } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; /** * DynamicView class is a versatile 'live' view class which can have filters and sorts applied. * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it @@ -18,18 +17,21 @@ export declare type ANY = any; * @extends LokiEventEmitter * @see {@link Collection#addDynamicView} to construct instances of DynamicView + * + * @param - the data type + * @param - nested properties of data type */ -export declare class DynamicView extends LokiEventEmitter { +export declare class DynamicView extends LokiEventEmitter { private _collection; private _persistent; private _sortPriority; private _minRebuildInterval; name: string; private _rebuildPending; - private _resultset; - private _resultdata; - private _resultsdirty; - private _cachedresultset; + private _resultSet; + private _resultData; + private _resultDirty; + private _cachedResultSet; private _filterPipeline; private _sortFunction; private _sortCriteria; @@ -41,10 +43,10 @@ export declare class DynamicView extends LokiEventEmi * @param {string} name - the name of this dynamic view * @param {object} options - the options * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' - * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority + * @param {string} [options.sortPriority="passive"] - the sort priority * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here) */ - constructor(collection: Collection, name: string, options?: DynamicView.Options); + constructor(collection: Collection, name: string, options?: DynamicView.Options); /** * Internally used immediately after deserialization (loading) * This will clear out and reapply filterPipeline ops, recreating the view. @@ -57,34 +59,22 @@ export declare class DynamicView extends LokiEventEmi */ _rematerialize({removeWhereFilters}: { removeWhereFilters?: boolean; - }): DynamicView; + }): this; /** - * Makes a copy of the internal resultset for branched queries. - * Unlike this dynamic view, the branched resultset will not be 'live' updated, + * Makes a copy of the internal ResultSet for branched queries. + * Unlike this dynamic view, the branched ResultSet will not be 'live' updated, * so your branched query should be immediately resolved and not held for future evaluation. * * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps * @param {object} parameters - optional parameters (if optional transform requires them) - * @returns {Resultset} A copy of the internal resultset for branched queries. + * @returns {ResultSet} A copy of the internal ResultSet for branched queries. */ - branchResultset(transform: string | any[], parameters?: object): Resultset; + branchResultSet(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** - * toJSON() - Override of toJSON to avoid circular references - * + * Override of toJSON to avoid circular references. */ - toJSON(): { - name: string; - _persistent: boolean; - _sortPriority: DynamicView.SortPriority; - _minRebuildInterval: number; - _resultset: Resultset; - _resultsdirty: boolean; - _filterPipeline: Filter[]; - _sortCriteria: (string | [string, boolean])[]; - _sortByScoring: boolean; - _sortDirty: boolean; - }; - static fromJSONObject(collection: ANY, obj: ANY): DynamicView; + toJSON(): DynamicView.Serialized; + static fromJSONObject(collection: Collection, obj: DynamicView.Serialized): DynamicView; /** * Used to clear pipeline and reset dynamic view to initial state. * Existing options should be retained. @@ -105,7 +95,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} comparefun - a javascript compare function used for sorting * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySort(comparefun: (lhs: E, rhs: E) => number): DynamicView; + applySort(comparefun: (lhs: Doc, rhs: Doc) => number): this; /** * Used to specify a property used for view translation. * @example @@ -115,9 +105,9 @@ export declare class DynamicView extends LokiEventEmi * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySimpleSort(propname: string, isdesc?: boolean): DynamicView; + applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * dv.applySortCriteria(['age', 'name']); @@ -129,32 +119,32 @@ export declare class DynamicView extends LokiEventEmi * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations. */ - applySortCriteria(criteria: (string | [string, boolean])[]): DynamicView; + applySortCriteria(criteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Used to apply a sort by the latest full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending */ - applySortByScoring(ascending?: boolean): DynamicView; + applySortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** * Marks the beginning of a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - startTransaction(): DynamicView; + startTransaction(): this; /** * Commits a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - commit(): DynamicView; + commit(): this; /** * Rolls back a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - rollback(): DynamicView; + rollback(): this; /** * Find the index of a filter in the pipeline, by that filter's ID. * @@ -163,7 +153,7 @@ export declare class DynamicView extends LokiEventEmi */ private _indexOfFilterWithId(uid); /** - * Add the filter object to the end of view's filter pipeline and apply the filter to the resultset. + * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet. * * @param {object} filter - The filter object. Refer to applyFilter() for extra details. */ @@ -173,7 +163,7 @@ export declare class DynamicView extends LokiEventEmi * * @returns {DynamicView} this DynamicView object, for further chain ops. */ - reapplyFilters(): DynamicView; + reapplyFilters(): this; /** * Adds or updates a filter in the DynamicView filter pipeline * @@ -181,7 +171,7 @@ export declare class DynamicView extends LokiEventEmi * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id } * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFilter(filter: Filter): DynamicView; + applyFilter(filter: DynamicView.Filter): this; /** * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline * @@ -189,7 +179,7 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFind(query: object, uid?: string | number): DynamicView; + applyFind(query: object, uid?: string | number): this; /** * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline * @@ -197,14 +187,14 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyWhere(fun: (obj: E) => boolean, uid?: string | number): DynamicView; + applyWhere(fun: (obj: Doc) => boolean, uid?: string | number): this; /** * removeFilter() - Remove the specified filter from the DynamicView filter pipeline * * @param {(string|number)} uid - The unique ID of the filter to be removed. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - removeFilter(uid: string | number): DynamicView; + removeFilter(uid: string | number): this; /** * Returns the number of documents representing the current DynamicView contents. * @returns {number} The number of documents representing the current DynamicView contents. @@ -213,16 +203,16 @@ export declare class DynamicView extends LokiEventEmi /** * Resolves and pending filtering and sorting, then returns document array as result. * - * @param {object} options - optional parameters to pass to resultset.data() if non-persistent - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * * @returns {Array} An array of documents representing the current DynamicView contents. */ - data(options?: object): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** * When the view is not sorted we may still wish to be notified of rebuild events. * This event will throttle and queue a single rebuild event when batches of updates affect the view. @@ -257,7 +247,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; } export declare namespace DynamicView { interface Options { @@ -265,8 +255,25 @@ export declare namespace DynamicView { sortPriority?: SortPriority; minRebuildInterval?: number; } - enum SortPriority { - PASSIVE = 0, - ACTIVE = 1, + type SortPriority = "passive" | "active"; + interface Serialized { + name: string; + _persistent: boolean; + _sortPriority: SortPriority; + _minRebuildInterval: number; + _resultSet: ResultSet; + _filterPipeline: Filter[]; + _sortCriteria: (string | [string, boolean])[]; + _sortByScoring: boolean; + _sortDirty: boolean; } + type Filter = { + type: "find"; + val: ResultSet.Query & TNested>; + uid: number | string; + } | { + type: "where"; + val: (obj: Doc) => boolean; + uid: number | string; + }; } diff --git a/dist/packages/indexed-storage/types/loki/src/event_emitter.d.ts b/dist/packages/indexed-storage/types/loki/src/event_emitter.d.ts index f422ee35..e55515e9 100644 --- a/dist/packages/indexed-storage/types/loki/src/event_emitter.d.ts +++ b/dist/packages/indexed-storage/types/loki/src/event_emitter.d.ts @@ -1,4 +1,3 @@ -export declare type ANY = any; /** * LokiEventEmitter is a minimalist version of EventEmitter. It enables any * constructor that inherits EventEmitter to emit events and trigger @@ -31,7 +30,7 @@ export declare class LokiEventEmitter { * @param {string} eventName - the name of the event * @param {object} data - optional object passed with the event */ - emit(eventName: string, ...data: ANY[]): void; + emit(eventName: string, ...data: any[]): void; /** * Alias of LokiEventEmitter.prototype.on * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event diff --git a/dist/packages/indexed-storage/types/loki/src/helper.d.ts b/dist/packages/indexed-storage/types/loki/src/helper.d.ts index 76484f67..44b72305 100644 --- a/dist/packages/indexed-storage/types/loki/src/helper.d.ts +++ b/dist/packages/indexed-storage/types/loki/src/helper.d.ts @@ -1,8 +1,5 @@ /** - * @hidden - */ -export declare type ANY = any; -/** Helper function for determining 'loki' abstract equality which is a little more abstract than == + * Helper function for determining 'loki' abstract equality which is a little more abstract than == * aeqHelper(5, '5') === true * aeqHelper(5.0, '5') === true * aeqHelper(new Date("1/1/2011"), new Date("1/1/2011")) === true @@ -10,34 +7,33 @@ export declare type ANY = any; * aeqHelper([1, 2, 3], [1, 3]) === false * aeqHelper([1, 2, 3], [1, 2, 3]) === true * aeqHelper(undefined, null) === true - */ -/** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @returns {boolean} + * @hidden */ -export declare function aeqHelper(prop1: ANY, prop2: ANY): boolean; -/** Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. +export declare function aeqHelper(prop1: any, prop2: any): boolean; +/** + * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. * In the future we might want $lt and $gt ops to use their own functionality/helper. * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another. * @hidden */ -export declare function ltHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function ltHelper(prop1: any, prop2: any, equal: boolean): boolean; /** * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @param {boolean} equal * @returns {boolean} */ -export declare function gtHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function gtHelper(prop1: any, prop2: any, equal: boolean): boolean; /** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 - * @param {ANY} desc + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} descending * @returns {number} + * @hidden */ -export declare function sortHelper(prop1: ANY, prop2: ANY, desc: ANY): 1 | 0 | -1; +export declare function sortHelper(prop1: any, prop2: any, descending: boolean): number; diff --git a/dist/packages/indexed-storage/types/loki/src/index.d.ts b/dist/packages/indexed-storage/types/loki/src/index.d.ts index dee82236..17ee6df4 100644 --- a/dist/packages/indexed-storage/types/loki/src/index.d.ts +++ b/dist/packages/indexed-storage/types/loki/src/index.d.ts @@ -1,7 +1,4 @@ import { Loki } from "./loki"; import { Collection } from "./collection"; export { Loki, Collection }; -declare const _default: { - Loki: typeof Loki; -}; -export default _default; +export default Loki; diff --git a/dist/packages/indexed-storage/types/loki/src/loki.d.ts b/dist/packages/indexed-storage/types/loki/src/loki.d.ts index 10e81b65..f2deafd2 100644 --- a/dist/packages/indexed-storage/types/loki/src/loki.d.ts +++ b/dist/packages/indexed-storage/types/loki/src/loki.d.ts @@ -1,7 +1,6 @@ import { LokiEventEmitter } from "./event_emitter"; import { Collection } from "./collection"; import { Doc, StorageAdapter } from "../../common/types"; -export declare type ANY = any; export declare class Loki extends LokiEventEmitter { private filename; private databaseVersion; @@ -23,7 +22,7 @@ export declare class Loki extends LokiEventEmitter { * Constructs the main database class. * @param {string} filename - name of the file to be saved to * @param {object} [options={}] - options - * @param {Loki.Environment} [options.env=auto] - overrides environment detection + * @param {Loki.Environment} [options.env] - the javascript environment * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method * @param {string} [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization * @param {boolean} [options.verbose=false] - enable console output @@ -64,21 +63,21 @@ export declare class Loki extends LokiEventEmitter { * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @returns {Collection} a reference to the collection which was just added */ - addCollection(name: string, options?: Collection.Options): Collection; + addCollection(name: string, options?: Collection.Options): Collection; loadCollection(collection: Collection): void; /** * Retrieves reference to a collection by name. * @param {string} collectionName - name of collection to look up * @returns {Collection} Reference to collection in database by that name, or null if not found */ - getCollection(collectionName: string): Collection; + getCollection(collectionName: string): Collection; /** * Renames an existing loki collection * @param {string} oldName - name of collection to rename * @param {string} newName - new name of collection * @returns {Collection} reference to the newly renamed collection */ - renameCollection(oldName: string, newName: string): Collection<{}>; + renameCollection(oldName: string, newName: string): Collection; listCollections(): { name: string; count: number; @@ -95,20 +94,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {string} Stringified representation of the loki database. */ serialize(options?: Loki.SerializeOptions): string | string[]; - toJSON(): { - _env: Loki.Environment; - _serializationMethod: Loki.SerializationMethod; - _autosave: boolean; - _autosaveInterval: number; - _collections: Collection[]; - databaseVersion: number; - engineVersion: number; - filename: string; - _persistenceAdapter: StorageAdapter; - _persistenceMethod: Loki.PersistenceMethod; - _throttledSaves: boolean; - _verbose: boolean; - }; + toJSON(): Loki.Serialized; /** * Database level destructured JSON serialization routine to allow alternate serialization methods. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -134,7 +120,11 @@ export declare class Loki extends LokiEventEmitter { * * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection. */ - serializeCollection(options?: ANY): string | string[]; + serializeCollection(options?: { + delimited?: boolean; + collectionIndex?: number; + delimiter?: string; + }): string | string[]; /** * Database level destructured JSON deserialization routine to minimize memory overhead. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -150,7 +140,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array */ - deserializeDestructured(destructuredSource: ANY, options?: Loki.SerializeDestructuredOptions): any; + deserializeDestructured(destructuredSource: string | string[], options?: Loki.SerializeDestructuredOptions): any; /** * Collection level utility function to deserializes a destructured collection. * @@ -161,7 +151,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {Array} an array of documents to attach to collection.data. */ - deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc; + deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc[]; /** * Inflates a loki database from a serialized JSON string * @@ -169,15 +159,16 @@ export declare class Loki extends LokiEventEmitter { * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSON(serializedDb: string | string[], options?: ANY): void; + loadJSON(serializedDb: string | string[], options?: Collection.DeserializeOptions): void; /** * Inflates a loki database from a JS object * - * @param {object} dbObject - a serialized loki database string + * @param {object} dbObject - a serialized loki database object * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSONObject(dbObject: ANY, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki.Serialized, options?: Collection.DeserializeOptions): void; /** * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer. * Does not actually destroy the db. @@ -201,7 +192,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {Array} array of changes * @see private method _createChange() in Collection */ - generateChangesNotification(arrayOfCollectionNames?: string[]): any[]; + generateChangesNotification(arrayOfCollectionNames?: string[]): Collection.Change[]; /** * (Changes API) - stringify changes for network transmission * @returns {string} string representation of the changes @@ -310,24 +301,22 @@ export declare namespace Loki { recursiveWaitLimitDuration?: number; started?: Date; } - type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; - enum SerializationMethod { - NORMAL = 0, - PRETTY = 1, - DESTRUCTURED = 2, - } - enum PersistenceMethod { - FS_STORAGE = 0, - LOCAL_STORAGE = 1, - INDEXED_STORAGE = 2, - MEMORY_STORAGE = 3, - ADAPTER = 4, - } - enum Environment { - NODE_JS = 0, - NATIVE_SCRIPT = 1, - BROWSER = 2, - CORDOVA = 3, - MEMORY = 4, + interface Serialized { + _env: Environment; + _serializationMethod: SerializationMethod; + _autosave: boolean; + _autosaveInterval: number; + _collections: Collection[]; + databaseVersion: number; + engineVersion: number; + filename: string; + _persistenceAdapter: StorageAdapter; + _persistenceMethod: PersistenceMethod; + _throttledSaves: boolean; + _verbose: boolean; } + type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; + type SerializationMethod = "normal" | "pretty" | "destructured"; + type PersistenceMethod = "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter"; + type Environment = "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "MEMORY"; } diff --git a/dist/packages/indexed-storage/types/loki/src/memory_adapter.d.ts b/dist/packages/indexed-storage/types/loki/src/memory_adapter.d.ts deleted file mode 100644 index 7b97c7f7..00000000 --- a/dist/packages/indexed-storage/types/loki/src/memory_adapter.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { StorageAdapter } from "../../common/types"; -export declare type ANY = any; -/** - * In in-memory persistence adapter for an in-memory database. - * This simple 'key/value' adapter is intended for unit testing and diagnostics. - */ -export declare class LokiMemoryAdapter implements StorageAdapter { - private hashStore; - private options; - /** - * @param {object} options - memory adapter options - * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) - * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) - * @param {ANY} options - */ - constructor(options?: ANY); - /** - * Loads a serialized database from its in-memory store. - * (Loki persistence adapter interface function) - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was loaded - */ - loadDatabase(dbname: string): Promise; - /** - * Saves a serialized database to its in-memory store. - * (Loki persistence adapter interface function) - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was persisted - */ - saveDatabase(dbname: string, dbstring: string): Promise; - /** - * Deletes a database from its in-memory store. - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was deleted - */ - deleteDatabase(dbname: string): Promise; -} diff --git a/dist/packages/indexed-storage/types/loki/src/result_set.d.ts b/dist/packages/indexed-storage/types/loki/src/result_set.d.ts new file mode 100644 index 00000000..b29e3a52 --- /dev/null +++ b/dist/packages/indexed-storage/types/loki/src/result_set.d.ts @@ -0,0 +1,302 @@ +import { Collection } from "./collection"; +import { CloneMethod } from "./clone"; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; +import { Query as FullTextSearchQuery } from "../../full-text-search/src/query_builder"; +/** + * @hidden + */ +export declare const LokiOps: { + $eq(a: any, b: any): boolean; + $aeq(a: any, b: any): boolean; + $ne(a: any, b: any): boolean; + $dteq(a: any, b: any): boolean; + $gt(a: any, b: any): boolean; + $gte(a: any, b: any): boolean; + $lt(a: any, b: any): boolean; + $lte(a: any, b: any): boolean; + $between(a: any, range: [any, any]): boolean; + $in(a: any, b: any): boolean; + $nin(a: any, b: any): boolean; + $keyin(a: string, b: object): boolean; + $nkeyin(a: string, b: object): boolean; + $definedin(a: string, b: object): boolean; + $undefinedin(a: string, b: object): boolean; + $regex(a: string, b: RegExp): boolean; + $containsString(a: any, b: string): boolean; + $containsNone(a: any, b: any): boolean; + $containsAny(a: any, b: any): boolean; + $contains(a: any, b: any): boolean; + $type(a: any, b: any): boolean; + $finite(a: number, b: boolean): boolean; + $size(a: any, b: any): boolean; + $len(a: any, b: any): boolean; + $where(a: any, b: any): boolean; + $not(a: any, b: any): boolean; + $and(a: any, b: any): boolean; + $or(a: any, b: any): boolean; +}; +/** + * ResultSet class allowing chainable queries. Intended to be instanced internally. + * Collection.find(), Collection.where(), and Collection.chain() instantiate this. + * + * @example + * mycollection.chain() + * .find({ 'doors' : 4 }) + * .where(function(obj) { return obj.name === 'Toyota' }) + * .data(); + * + * @param - the data type + * @param - nested properties of data type + */ +export declare class ResultSet { + _collection: Collection; + _filteredRows: number[]; + _filterInitialized: boolean; + private _scoring; + /** + * Constructor. + * @param {Collection} collection - the collection which this ResultSet will query against + */ + constructor(collection: Collection); + /** + * reset() - Reset the ResultSet to its initial state. + * + * @returns {ResultSet} Reference to this ResultSet, for future chain operations. + */ + reset(): this; + /** + * Override of toJSON to avoid circular references + * + */ + toJSON(): ResultSet; + /** + * Allows you to limit the number of documents passed to next chain operation. + * A ResultSet copy() is made to avoid altering original ResultSet. + * + * @param {int} qty - The number of documents to return. + * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops. + */ + limit(qty: number): this; + /** + * Used for skipping 'pos' number of documents in the ResultSet. + * + * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. + * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops. + */ + offset(pos: number): this; + /** + * copy() - To support reuse of ResultSet in branched query situations. + * + * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same. + */ + copy(): ResultSet; + /** + * Alias of copy() + */ + branch(): ResultSet; + /** + * Executes a named collection transform or raw array of transform steps against the ResultSet. + * + * @param {(string|array)} transform - name of collection transform or raw transform array + * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. + * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps) + */ + transform(transform: string | Collection.Transform[], parameters?: object): this; + /** + * User supplied compare function is provided two documents to compare. (chainable) + * @example + * rslt.sort(function(obj1, obj2) { + * if (obj1.name === obj2.name) return 0; + * if (obj1.name > obj2.name) return 1; + * if (obj1.name < obj2.name) return -1; + * }); + * + * @param {function} comparefun - A javascript compare function used for sorting. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + sort(comparefun: (a: Doc, b: Doc) => number): this; + /** + * Simpler, loose evaluation for user to sort based on a property name. (chainable). + * Sorting based on the same lt/gt helper functions used for binary indices. + * + * @param {string} propname - name of property to sort by. + * @param {boolean} [descending=false] - if true, the property will be sorted in descending order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + simplesort(propname: keyof (TData & TNested), descending?: boolean): this; + /** + * Allows sorting a ResultSet based on multiple columns. + * @example + * // to sort by age and then name (both ascending) + * rs.compoundsort(['age', 'name']); + * // to sort by age (ascending) and then by name (descending) + * rs.compoundsort(['age', ['name', true]); + * + * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + compoundsort(properties: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; + /** + * Helper function for compoundsort(), performing individual object comparisons + * + * @param {Array} properties - array of property names, in order, by which to evaluate sort order + * @param {object} obj1 - first object to compare + * @param {object} obj2 - second object to compare + * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first + */ + private _compoundeval(properties, obj1, obj2); + /** + * Sorts the ResultSet based on the last full-text-search scoring. + * @param {boolean} [ascending=false] - sort ascending + * @returns {ResultSet} + */ + sortByScoring(ascending?: boolean): this; + /** + * Returns the scoring of the last full-text-search. + * @returns {ScoreResult} + */ + getScoring(): Scorer.ScoreResult; + /** + * Oversee the operation of OR'ed query expressions. + * OR'ed expression evaluation runs each expression individually against the full collection, + * and finally does a set OR on each expression's results. + * Each evaluation can utilize a binary index to prevent multiple linear array scans. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findOr(expressionArray: ResultSet.Query & TNested>[]): this; + $or(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Oversee the operation of AND'ed query expressions. + * AND'ed expression evaluation runs each expression progressively against the full collection, + * internally utilizing existing chained ResultSet functionality. + * Only the first filter can utilize a binary index. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findAnd(expressionArray: ResultSet.Query & TNested>[]): this; + $and(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Used for querying via a mongo-style query object. + * + * @param {object} query - A mongo-style query object used for filtering current results. + * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() + * @returns {ResultSet} this ResultSet for further chain ops. + */ + find(query?: ResultSet.Query & TNested>, firstOnly?: boolean): this; + /** + * Used for filtering via a javascript filter function. + * + * @param {function} fun - A javascript function used for filtering current results by. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + where(fun: (obj: Doc) => boolean): this; + /** + * Returns the number of documents in the ResultSet. + * @returns {number} The number of documents in the ResultSet. + */ + count(): number; + /** + * Terminates the chain and returns array of filtered documents + * @param {object} options + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when + * the collection is not configured for clone object. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values 'parse-stringify', 'deep', and 'shallow' and + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents + * + * @returns {Array} Array of documents in the ResultSet + */ + data(options?: ResultSet.DataOptions): Doc[]; + /** + * Used to run an update operation on all documents currently in the ResultSet. + * + * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + update(updateFunction: (obj: Doc) => TData): this; + /** + * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet) + * + * @returns {ResultSet} this (empty) ResultSet for further chain ops. + */ + remove(): this; + /** + * data transformation via user supplied functions + * + * @param {function} mapFunction - this function accepts a single document for you to transform and return + * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value + * @returns {value} The output of your reduceFunction + */ + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; + /** + * Left joining two sets of data. Join keys can be defined or calculated properties + * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key + * @param {Array|ResultSet|Collection} joinData - Data array to join to. + * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on + * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on + * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} + * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method + * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}] + */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinKey: string | ((obj: any) => string), rightJoinKey: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; + /** + * Applies a map function into a new collection for further chaining. + * @param {function} mapFun - javascript map function + * @param {object} [dataOptions=] - options to data() before input to your map function + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method + * @return {ResultSet} + */ + map(mapFun: (obj: TData, index: number, array: TData[]) => U, dataOptions?: ResultSet.DataOptions): ResultSet; +} +export declare namespace ResultSet { + interface DataOptions { + forceClones?: boolean; + forceCloneMethod?: CloneMethod; + removeMeta?: boolean; + } + type LokiOps = { + $eq?: R; + $aeq?: R; + $ne?: R; + $dteq?: R; + $gt?: R; + $gte?: R; + $lt?: R; + $lte?: R; + $between?: [R, R]; + $in?: R[]; + $nin?: R[]; + $keyin?: object; + $nkeyin?: object; + $definedin?: object; + $undefinedin?: object; + $regex?: RegExp | string | [string, string]; + $containsString?: string; + $containsNone?: R[] | R; + $containsAny?: R[] | R; + $contains?: any; + $type?: string; + $finite?: boolean; + $size?: number; + $len?: number; + $where?: (val?: R) => boolean; + }; + type Query = { + [P in keyof TData]?: LokiOps | TData[P]; + } & { + $and?: Query[]; + } & { + $or?: Query[]; + } & { + $fts?: FullTextSearchQuery; + }; +} diff --git a/dist/packages/indexed-storage/types/loki/src/resultset.d.ts b/dist/packages/indexed-storage/types/loki/src/resultset.d.ts deleted file mode 100644 index 8ee6b343..00000000 --- a/dist/packages/indexed-storage/types/loki/src/resultset.d.ts +++ /dev/null @@ -1,262 +0,0 @@ -import { Collection } from "./collection"; -import { CloneMethod } from "./clone"; -import { Doc, Query } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; -/** - * @hidden - */ -export declare const LokiOps: { - $eq(a: any, b: any): boolean; - $aeq(a: any, b: any): boolean; - $ne(a: any, b: any): boolean; - $dteq(a: any, b: any): boolean; - $gt(a: any, b: any): boolean; - $gte(a: any, b: any): boolean; - $lt(a: any, b: any): boolean; - $lte(a: any, b: any): boolean; - $between(a: any, vals: any): boolean; - $in(a: any, b: any): boolean; - $nin(a: any, b: any): boolean; - $keyin(a: any, b: any): boolean; - $nkeyin(a: any, b: any): boolean; - $definedin(a: any, b: any): boolean; - $undefinedin(a: any, b: any): boolean; - $regex(a: any, b: any): any; - $containsString(a: any, b: any): boolean; - $containsNone(a: any, b: any): boolean; - $containsAny(a: any, b: any): any; - $contains(a: any, b: any): any; - $type(a: any, b: any): any; - $finite(a: any, b: any): boolean; - $size(a: any, b: any): any; - $len(a: any, b: any): any; - $where(a: any, b: any): boolean; - $not(a: any, b: any): boolean; - $and(a: any, b: any): boolean; - $or(a: any, b: any): boolean; -}; -/** - * Resultset class allowing chainable queries. Intended to be instanced internally. - * Collection.find(), Collection.where(), and Collection.chain() instantiate this. - * - * @example - * mycollection.chain() - * .find({ 'doors' : 4 }) - * .where(function(obj) { return obj.name === 'Toyota' }) - * .data(); - */ -export declare class Resultset { - collection: Collection; - filteredrows: number[]; - filterInitialized: boolean; - private _scoring; - /** - * Constructor. - * @param {Collection} collection - the collection which this Resultset will query against - */ - constructor(collection: Collection); - /** - * reset() - Reset the resultset to its initial state. - * - * @returns {Resultset} Reference to this resultset, for future chain operations. - */ - reset(): Resultset; - /** - * toJSON() - Override of toJSON to avoid circular references - * - */ - toJSON(): Resultset; - /** - * Allows you to limit the number of documents passed to next chain operation. - * A resultset copy() is made to avoid altering original resultset. - * - * @param {int} qty - The number of documents to return. - * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops. - */ - limit(qty: number): Resultset; - /** - * Used for skipping 'pos' number of documents in the resultset. - * - * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. - * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. - */ - offset(pos: number): Resultset; - /** - * copy() - To support reuse of resultset in branched query situations. - * - * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same. - */ - copy(): Resultset; - /** - * Alias of copy() - */ - branch(): Resultset; - /** - * Executes a named collection transform or raw array of transform steps against the resultset. - * - * @param {(string|array)} transform - name of collection transform or raw transform array - * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. - * @returns {Resultset} either (this) resultset or a clone of of this resultset (depending on steps) - */ - transform(transform: string | any[], parameters?: object): Resultset; - /** - * User supplied compare function is provided two documents to compare. (chainable) - * @example - * rslt.sort(function(obj1, obj2) { - * if (obj1.name === obj2.name) return 0; - * if (obj1.name > obj2.name) return 1; - * if (obj1.name < obj2.name) return -1; - * }); - * - * @param {function} comparefun - A javascript compare function used for sorting. - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - sort(comparefun: (a: E, b: E) => number): Resultset; - /** - * Simpler, loose evaluation for user to sort based on a property name. (chainable). - * Sorting based on the same lt/gt helper functions used for binary indices. - * - * @param {string} propname - name of property to sort by. - * @param {boolean} isdesc - (Optional) If true, the property will be sorted in descending order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - simplesort(propname: string, isdesc?: boolean): Resultset; - /** - * Allows sorting a resultset based on multiple columns. - * @example - * // to sort by age and then name (both ascending) - * rs.compoundsort(['age', 'name']); - * // to sort by age (ascending) and then by name (descending) - * rs.compoundsort(['age', ['name', true]); - * - * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - compoundsort(properties: (string | [string, boolean])[]): Resultset; - /** - * Helper function for compoundsort(), performing individual object comparisons - * - * @param {Array} properties - array of property names, in order, by which to evaluate sort order - * @param {object} obj1 - first object to compare - * @param {object} obj2 - second object to compare - * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first - */ - private _compoundeval(properties, obj1, obj2); - /** - * Sorts the resultset based on the last full-text-search scoring. - * @param {boolean} [ascending=false] - sort ascending - * @returns {Resultset} - */ - sortByScoring(ascending?: boolean): Resultset; - /** - * Returns the scoring of the last full-text-search. - * @returns {ScoreResult} - */ - getScoring(): ScoreResult; - /** - * findOr() - oversee the operation of OR'ed query expressions. - * OR'ed expression evaluation runs each expression individually against the full collection, - * and finally does a set OR on each expression's results. - * Each evaluation can utilize a binary index to prevent multiple linear array scans. - * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. - */ - findOr(expressionArray: Query[]): Resultset; - $or(expressionArray: Query[]): Resultset; - /** - * findAnd() - oversee the operation of AND'ed query expressions. - * AND'ed expression evaluation runs each expression progressively against the full collection, - * internally utilizing existing chained resultset functionality. - * Only the first filter can utilize a binary index. - * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. - */ - findAnd(expressionArray: Query[]): Resultset; - $and(expressionArray: Query[]): Resultset; - /** - * Used for querying via a mongo-style query object. - * - * @param {object} query - A mongo-style query object used for filtering current results. - * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() - * @returns {Resultset} this resultset for further chain ops. - */ - find(query?: Query, firstOnly?: boolean): Resultset; - /** - * Used for filtering via a javascript filter function. - * - * @param {function} fun - A javascript function used for filtering current results by. - * @returns {Resultset} this resultset for further chain ops. - */ - where(fun: (obj: E) => boolean): Resultset; - /** - * Returns the number of documents in the resultset. - * @returns {number} The number of documents in the resultset. - */ - count(): number; - /** - * Terminates the chain and returns array of filtered documents - * @param {object} options - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when - * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents - * - * @returns {Array} Array of documents in the resultset - */ - data(options?: Resultset.DataOptions): Doc[]; - /** - * Used to run an update operation on all documents currently in the resultset. - * - * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. - * @returns {Resultset} this resultset for further chain ops. - */ - update(updateFunction: (obj: E) => E): Resultset; - /** - * Removes all document objects which are currently in resultset from collection (as well as resultset) - * - * @returns {Resultset} this (empty) resultset for further chain ops. - */ - remove(): Resultset; - /** - * data transformation via user supplied functions - * - * @param {function} mapFunction - this function accepts a single document for you to transform and return - * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value - * @returns {value} The output of your reduceFunction - */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; - /** - * Left joining two sets of data. Join keys can be defined or calculated properties - * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key - * @param {Array|Resultset|Collection} joinData - Data array to join to. - * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on - * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on - * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} - * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides - * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun - * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}] - */ - eqJoin(joinData: ANY, leftJoinKey: string | Function, rightJoinKey: string | Function, mapFun?: Function, dataOptions?: ANY): ANY; - /** - * Applies a map function into a new collection for further chaining. - * @param {function} mapFun - javascript map function - * @param {object} [dataOptions=] - options to data() before input to your map function - * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun - * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - */ - map(mapFun: (obj: E, index: number, array: E[]) => U, dataOptions?: Resultset.DataOptions): Resultset; -} -export declare namespace Resultset { - interface DataOptions { - forceClones?: boolean; - forceCloneMethod?: CloneMethod; - removeMeta?: boolean; - } -} diff --git a/dist/packages/indexed-storage/types/loki/src/unique_index.d.ts b/dist/packages/indexed-storage/types/loki/src/unique_index.d.ts index 40312618..55284c11 100644 --- a/dist/packages/indexed-storage/types/loki/src/unique_index.d.ts +++ b/dist/packages/indexed-storage/types/loki/src/unique_index.d.ts @@ -1,30 +1,30 @@ import { Doc } from "../../common/types"; -export declare class UniqueIndex { +export declare class UniqueIndex { private _field; private _keyMap; /** * Constructs an unique index object. * @param {number|string} propertyField - the property field to index */ - constructor(propertyField: number | string); + constructor(propertyField: keyof E); /** * Sets a document's unique index. * @param {Doc} doc - the document * @param {number} row - the data row of the document */ - set(doc: Doc, row: number): void; + set(doc: Doc, row: number): void; /** * Returns the data row of an unique index. * @param {number|string} index - the index * @returns {number | string} - the row */ - get(index: number | string): number; + get(index: keyof E): number; /** * Updates a document's unique index. * @param {Object} doc - the document * @param {number} row - the data row of the document */ - update(doc: Doc, row: number): void; + update(doc: Doc, row: number): void; /** * Removes an unique index. * @param {number|string} index - the unique index diff --git a/dist/packages/indexed-storage/types/memory-storage/src/index.d.ts b/dist/packages/indexed-storage/types/memory-storage/src/index.d.ts new file mode 100644 index 00000000..5330aa7d --- /dev/null +++ b/dist/packages/indexed-storage/types/memory-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { MemoryStorage } from "./memory_storage"; +export { MemoryStorage }; +export default MemoryStorage; diff --git a/dist/packages/indexed-storage/types/memory-storage/src/memory_storage.d.ts b/dist/packages/indexed-storage/types/memory-storage/src/memory_storage.d.ts new file mode 100644 index 00000000..0066a1de --- /dev/null +++ b/dist/packages/indexed-storage/types/memory-storage/src/memory_storage.d.ts @@ -0,0 +1,57 @@ +import { Dict, StorageAdapter } from "../../common/types"; +/** + * An in-memory persistence adapter for an in-memory database. + * This simple 'key/value' adapter is intended for unit testing and diagnostics. + */ +export declare class MemoryStorage implements StorageAdapter { + hashStore: Dict<{ + savecount: number; + lastsave: Date; + value: string; + }>; + options: MemoryStorage.Options; + /** + * Registers the local storage as plugin. + */ + static register(): void; + /** + * Deregisters the local storage as plugin. + */ + static deregister(): void; + /** + * @param {object} options - memory storage options + * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) + * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) + */ + constructor(options?: MemoryStorage.Options); + /** + * Loads a serialized database from its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was loaded + */ + loadDatabase(dbname: string): Promise; + /** + * Saves a serialized database to its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @param {string} dbstring - the database content + * @returns {Promise} a Promise that resolves after the database was persisted + */ + saveDatabase(dbname: string, dbstring: string): Promise; + /** + * Deletes a database from its in-memory store. + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was deleted + */ + deleteDatabase(dbname: string): Promise; +} +export declare namespace MemoryStorage { + interface Options { + asyncResponses?: boolean; + asyncTimeout?: number; + } +} diff --git a/dist/packages/indexed-storage/types/partitioning-adapter/src/index.d.ts b/dist/packages/indexed-storage/types/partitioning-adapter/src/index.d.ts new file mode 100644 index 00000000..bf49882f --- /dev/null +++ b/dist/packages/indexed-storage/types/partitioning-adapter/src/index.d.ts @@ -0,0 +1,3 @@ +import { PartitioningAdapter } from "./partitioning_adapter"; +export { PartitioningAdapter }; +export default PartitioningAdapter; diff --git a/dist/packages/indexed-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts b/dist/packages/indexed-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts index ff9568cf..45e14850 100644 --- a/dist/packages/indexed-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts +++ b/dist/packages/indexed-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts @@ -1,4 +1,5 @@ -import { ANY, StorageAdapter } from "../../common/types"; +import { Loki } from "../../loki/src/loki"; +import { StorageAdapter } from "../../common/types"; /** * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and @@ -9,7 +10,7 @@ import { ANY, StorageAdapter } from "../../common/types"; * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all * of that collection's pages will be written on next save. */ -export declare class LokiPartitioningAdapter implements StorageAdapter { +export declare class PartitioningAdapter implements StorageAdapter { mode: string; private _adapter; private _dbref; @@ -68,7 +69,7 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { * @returns {Promise} a Promise that resolves after the database was deleted * */ - exportDatabase(dbname: string, dbref: ANY): Promise; + exportDatabase(dbname: string, dbref: Loki): Promise; /** * Helper method used internally to save each dirty collection, one at a time. * @@ -82,11 +83,3 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { */ private _saveNextPage(); } -declare namespace LokiPartitioningAdapter { - interface PageIterator { - collection?: ANY; - docIndex?: number; - pageIndex?: number; - } -} -export default LokiPartitioningAdapter; diff --git a/dist/packages/local-storage/lokijs.local-storage.js b/dist/packages/local-storage/lokijs.local-storage.js index a51a8ea1..5019fe4b 100644 --- a/dist/packages/local-storage/lokijs.local-storage.js +++ b/dist/packages/local-storage/lokijs.local-storage.js @@ -79,24 +79,36 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common_plugin__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__local_storage__ = __webpack_require__(1); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "LocalStorage", function() { return __WEBPACK_IMPORTED_MODULE_0__local_storage__["a"]; }); + + +/* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__local_storage__["a" /* LocalStorage */]); + + +/***/ }), +/* 1 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common_plugin__ = __webpack_require__(2); /** * A loki persistence adapter which persists to web browser's local storage object - * @constructor LokiLocalStorageAdapter + * @constructor LocalStorageAdapter */ -class LokiLocalStorage { +class LocalStorage { /** * Registers the local storage as plugin. */ static register() { - __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["LokiLocalStorage"] = LokiLocalStorage; + __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["LocalStorage"] = LocalStorage; } /** * Deregisters the local storage as plugin. */ static deregister() { - delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["LokiLocalStorage"]; + delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["LocalStorage"]; } /** * loadDatabase() - Load data from localstorage @@ -125,13 +137,13 @@ class LokiLocalStorage { return Promise.resolve(localStorage.removeItem(dbname)); } } -/* harmony export (immutable) */ __webpack_exports__["LokiLocalStorage"] = LokiLocalStorage; +/* harmony export (immutable) */ __webpack_exports__["a"] = LocalStorage; -/* harmony default export */ __webpack_exports__["default"] = (LokiLocalStorage); +/* unused harmony default export */ var _unused_webpack_default_export = (LocalStorage); /***/ }), -/* 1 */ +/* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -157,10 +169,10 @@ const PLUGINS = create(); /* harmony export (immutable) */ __webpack_exports__["a"] = PLUGINS; -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(2))) +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(3))) /***/ }), -/* 2 */ +/* 3 */ /***/ (function(module, exports) { var g; diff --git a/dist/packages/local-storage/lokijs.local-storage.js.map b/dist/packages/local-storage/lokijs.local-storage.js.map index c4ae3ac7..e54d0e42 100644 --- a/dist/packages/local-storage/lokijs.local-storage.js.map +++ b/dist/packages/local-storage/lokijs.local-storage.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap a7f018472a4d16aad076","webpack:///./packages/local-storage/src/local_storage.ts","webpack:///./packages/common/plugin.ts","webpack:///(webpack)/buildin/global.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;AC7D4C;AAG5C;;;GAGG;AACG;IACJ;;OAEG;IACH,MAAM,CAAC,QAAQ;QACb,+DAAO,CAAC,kBAAkB,CAAC,GAAG,gBAAgB,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU;QACf,OAAO,+DAAO,CAAC,kBAAkB,CAAC,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,MAAc;QACzB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACvD,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,MAAc,EAAE,QAAgB;QAC3C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,MAAc;QAC3B,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1D,CAAC;CACF;AAAA;AAAA;AAED,+DAAe,gBAAgB,EAAC;;;;;;;;ACpDhC;IACE,IAAI,IAAI,CAAC;IACT,CAAC,UAAU,MAAM;QACf,IAAI,GAAG,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,IAAI,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,IAAI,CAAC;AACd,CAAC;AAGD;IACE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAQ,CAAC;IACtC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,EACb,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACI,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAAA;AAAA;;;;;;;;ACtBhC;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"lokijs.local-storage.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/local-storage\"] = factory();\n\telse\n\t\troot[\"@lokijs/local-storage\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a7f018472a4d16aad076","import {PLUGINS} from \"../../common/plugin\";\nimport {StorageAdapter} from \"../../common/types\";\n\n/**\n * A loki persistence adapter which persists to web browser's local storage object\n * @constructor LokiLocalStorageAdapter\n */\nexport class LokiLocalStorage implements StorageAdapter {\n /**\n * Registers the local storage as plugin.\n */\n static register(): void {\n PLUGINS[\"LokiLocalStorage\"] = LokiLocalStorage;\n }\n\n /**\n * Deregisters the local storage as plugin.\n */\n static deregister(): void {\n delete PLUGINS[\"LokiLocalStorage\"];\n }\n\n /**\n * loadDatabase() - Load data from localstorage\n * @param {string} dbname - the name of the database to load\n * @returns {Promise} a Promise that resolves after the database was loaded\n */\n loadDatabase(dbname: string) {\n return Promise.resolve(localStorage.getItem(dbname));\n }\n\n /**\n * saveDatabase() - save data to localstorage, will throw an error if the file can't be saved\n * might want to expand this to avoid dataloss on partial save\n * @param {string} dbname - the filename of the database to load\n * @returns {Promise} a Promise that resolves after the database was saved\n */\n saveDatabase(dbname: string, dbstring: string) {\n return Promise.resolve(localStorage.setItem(dbname, dbstring));\n }\n\n /**\n * deleteDatabase() - delete the database from localstorage, will throw an error if it\n * can't be deleted\n * @param {string} dbname - the filename of the database to delete\n * @returns {Promise} a Promise that resolves after the database was deleted\n */\n deleteDatabase(dbname: string) {\n return Promise.resolve(localStorage.removeItem(dbname));\n }\n}\n\nexport default LokiLocalStorage;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/local-storage/src/local_storage.ts","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 2\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap a1588ab4b40437481fb0","webpack:///./packages/local-storage/src/index.ts","webpack:///./packages/local-storage/src/local_storage.ts","webpack:///./packages/common/plugin.ts","webpack:///(webpack)/buildin/global.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;AC7D6C;AAEvB;AACtB,+DAAe,oEAAY,EAAC;;;;;;;;;ACHgB;AAG5C;;;GAGG;AACG;IACJ;;OAEG;IACH,MAAM,CAAC,QAAQ;QACb,+DAAO,CAAC,cAAc,CAAC,GAAG,YAAY,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU;QACf,OAAO,+DAAO,CAAC,cAAc,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,MAAc;QACzB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACvD,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,MAAc,EAAE,QAAgB;QAC3C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,MAAc;QAC3B,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1D,CAAC;CACF;AAAA;AAAA;AAED,0EAAe,YAAY,EAAC;;;;;;;;ACpD5B;IACE,IAAI,IAAI,CAAC;IACT,CAAC,UAAU,MAAM;QACf,IAAI,GAAG,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,IAAI,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,IAAI,CAAC;AACd,CAAC;AAGD;IACE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAQ,CAAC;IACtC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,EACb,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACI,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAAA;AAAA;;;;;;;;ACtBhC;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"lokijs.local-storage.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/local-storage\"] = factory();\n\telse\n\t\troot[\"@lokijs/local-storage\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a1588ab4b40437481fb0","import {LocalStorage} from \"./local_storage\";\n\nexport {LocalStorage};\nexport default LocalStorage;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/local-storage/src/index.ts","import {PLUGINS} from \"../../common/plugin\";\nimport {StorageAdapter} from \"../../common/types\";\n\n/**\n * A loki persistence adapter which persists to web browser's local storage object\n * @constructor LocalStorageAdapter\n */\nexport class LocalStorage implements StorageAdapter {\n /**\n * Registers the local storage as plugin.\n */\n static register(): void {\n PLUGINS[\"LocalStorage\"] = LocalStorage;\n }\n\n /**\n * Deregisters the local storage as plugin.\n */\n static deregister(): void {\n delete PLUGINS[\"LocalStorage\"];\n }\n\n /**\n * loadDatabase() - Load data from localstorage\n * @param {string} dbname - the name of the database to load\n * @returns {Promise} a Promise that resolves after the database was loaded\n */\n loadDatabase(dbname: string) {\n return Promise.resolve(localStorage.getItem(dbname));\n }\n\n /**\n * saveDatabase() - save data to localstorage, will throw an error if the file can't be saved\n * might want to expand this to avoid dataloss on partial save\n * @param {string} dbname - the filename of the database to load\n * @returns {Promise} a Promise that resolves after the database was saved\n */\n saveDatabase(dbname: string, dbstring: string) {\n return Promise.resolve(localStorage.setItem(dbname, dbstring));\n }\n\n /**\n * deleteDatabase() - delete the database from localstorage, will throw an error if it\n * can't be deleted\n * @param {string} dbname - the filename of the database to delete\n * @returns {Promise} a Promise that resolves after the database was deleted\n */\n deleteDatabase(dbname: string) {\n return Promise.resolve(localStorage.removeItem(dbname));\n }\n}\n\nexport default LocalStorage;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/local-storage/src/local_storage.ts","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/packages/local-storage/lokijs.local-storage.min.js b/dist/packages/local-storage/lokijs.local-storage.min.js index 2ef183b5..c2c42a1e 100644 --- a/dist/packages/local-storage/lokijs.local-storage.min.js +++ b/dist/packages/local-storage/lokijs.local-storage.min.js @@ -1 +1 @@ -(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["@lokijs/local-storage"]=factory();else{root["@lokijs/local-storage"]=factory();root["LokiLocalStorage"]=root["@lokijs/local-storage"].default}})(typeof self!=="undefined"?self:this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__common_plugin__=__webpack_require__(1);class LokiLocalStorage{static register(){__WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["LokiLocalStorage"]=LokiLocalStorage}static deregister(){delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["LokiLocalStorage"]}loadDatabase(dbname){return Promise.resolve(localStorage.getItem(dbname))}saveDatabase(dbname,dbstring){return Promise.resolve(localStorage.setItem(dbname,dbstring))}deleteDatabase(dbname){return Promise.resolve(localStorage.removeItem(dbname))}}__webpack_exports__["LokiLocalStorage"]=LokiLocalStorage;__webpack_exports__["default"]=LokiLocalStorage},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){function getGlobal(){let glob;(function(global){glob=global})(global!==undefined&&global||this);return glob}function create(){const global=getGlobal();const sym=Symbol.for("LOKI");if(global[sym]===undefined){global[sym]={}}return global[sym]}const PLUGINS=create();__webpack_exports__["a"]=PLUGINS}).call(__webpack_exports__,__webpack_require__(2))},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(1,eval)("this")}catch(e){if(typeof window==="object")g=window}module.exports=g}])}); \ No newline at end of file +(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["@lokijs/local-storage"]=factory();else{root["@lokijs/local-storage"]=factory();root["LokiLocalStorage"]=root["@lokijs/local-storage"].default}})(typeof self!=="undefined"?self:this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__local_storage__=__webpack_require__(1);__webpack_require__.d(__webpack_exports__,"LocalStorage",function(){return __WEBPACK_IMPORTED_MODULE_0__local_storage__["a"]});__webpack_exports__["default"]=__WEBPACK_IMPORTED_MODULE_0__local_storage__["a"]},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__common_plugin__=__webpack_require__(2);class LocalStorage{static register(){__WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["LocalStorage"]=LocalStorage}static deregister(){delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["LocalStorage"]}loadDatabase(dbname){return Promise.resolve(localStorage.getItem(dbname))}saveDatabase(dbname,dbstring){return Promise.resolve(localStorage.setItem(dbname,dbstring))}deleteDatabase(dbname){return Promise.resolve(localStorage.removeItem(dbname))}}__webpack_exports__["a"]=LocalStorage;var _unused_webpack_default_export=LocalStorage},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){function getGlobal(){let glob;(function(global){glob=global})(global!==undefined&&global||this);return glob}function create(){const global=getGlobal();const sym=Symbol.for("LOKI");if(global[sym]===undefined){global[sym]={}}return global[sym]}const PLUGINS=create();__webpack_exports__["a"]=PLUGINS}).call(__webpack_exports__,__webpack_require__(3))},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(1,eval)("this")}catch(e){if(typeof window==="object")g=window}module.exports=g}])}); \ No newline at end of file diff --git a/dist/packages/local-storage/types/common/types.d.ts b/dist/packages/local-storage/types/common/types.d.ts index 846847e6..b8a936c6 100644 --- a/dist/packages/local-storage/types/common/types.d.ts +++ b/dist/packages/local-storage/types/common/types.d.ts @@ -1,10 +1,13 @@ -export declare type ANY = any; +/** + * @hidden + */ +import { Loki } from "../loki/src"; export interface StorageAdapter { loadDatabase(dbname: string): Promise; saveDatabase?(dbname: string, serialization: string): Promise; deleteDatabase?(dbname: string): Promise; mode?: string; - exportDatabase?(dbname: string, dbref: ANY): Promise; + exportDatabase?(dbname: string, dbref: Loki): Promise; } export declare type Doc = T & { $loki: number; @@ -14,10 +17,3 @@ export interface Dict { [index: string]: T; [index: number]: T; } -export interface Query { -} -export interface Filter { - type: string; - val: Query | ((obj: E, index: number, array: E[]) => boolean); - uid: number | string; -} diff --git a/dist/packages/local-storage/types/fs-storage/src/fs_storage.d.ts b/dist/packages/local-storage/types/fs-storage/src/fs_storage.d.ts index a92567ea..9930c0d0 100644 --- a/dist/packages/local-storage/types/fs-storage/src/fs_storage.d.ts +++ b/dist/packages/local-storage/types/fs-storage/src/fs_storage.d.ts @@ -2,7 +2,7 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists using node fs module. */ -export declare class LokiFSStorage implements StorageAdapter { +export declare class FSStorage implements StorageAdapter { /** * Registers the fs storage as plugin. */ @@ -32,4 +32,3 @@ export declare class LokiFSStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiFSStorage; diff --git a/dist/packages/local-storage/types/fs-storage/src/index.d.ts b/dist/packages/local-storage/types/fs-storage/src/index.d.ts new file mode 100644 index 00000000..e6b33d6c --- /dev/null +++ b/dist/packages/local-storage/types/fs-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { FSStorage } from "./fs_storage"; +export { FSStorage }; +export default FSStorage; diff --git a/dist/packages/local-storage/types/full-text-search-language-de/src/index.d.ts b/dist/packages/local-storage/types/full-text-search-language-de/src/index.d.ts new file mode 100644 index 00000000..a2665427 --- /dev/null +++ b/dist/packages/local-storage/types/full-text-search-language-de/src/index.d.ts @@ -0,0 +1,3 @@ +import { DE } from "./de"; +export { DE }; +export default DE; diff --git a/dist/packages/local-storage/types/full-text-search-language-en/src/index.d.ts b/dist/packages/local-storage/types/full-text-search-language-en/src/index.d.ts new file mode 100644 index 00000000..8313cf98 --- /dev/null +++ b/dist/packages/local-storage/types/full-text-search-language-en/src/index.d.ts @@ -0,0 +1,3 @@ +import { EN } from "./en"; +export { EN }; +export default EN; diff --git a/dist/packages/local-storage/types/full-text-search-language/src/index.d.ts b/dist/packages/local-storage/types/full-text-search-language/src/index.d.ts new file mode 100644 index 00000000..e52d1a42 --- /dev/null +++ b/dist/packages/local-storage/types/full-text-search-language/src/index.d.ts @@ -0,0 +1 @@ +export { generateStopWordFilter, generateTrimmer, Among, SnowballProgram } from "./language"; diff --git a/dist/packages/local-storage/types/full-text-search/src/full_text_search.d.ts b/dist/packages/local-storage/types/full-text-search/src/full_text_search.d.ts index a4752c88..65a26bef 100644 --- a/dist/packages/local-storage/types/full-text-search/src/full_text_search.d.ts +++ b/dist/packages/local-storage/types/full-text-search/src/full_text_search.d.ts @@ -2,7 +2,7 @@ import { InvertedIndex } from "./inverted_index"; import { Tokenizer } from "./tokenizer"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; export declare class FullTextSearch { private _id; private _docs; @@ -21,14 +21,14 @@ export declare class FullTextSearch { * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized * (requires more memory but performs better) * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field - * @param {string=$loki} id - the property name of the document index + * @param {string} [id] - the property name of the document index */ constructor(fields?: FullTextSearch.FieldOptions[], id?: string); addDocument(doc: object, id?: number): void; removeDocument(doc: object, id?: number): void; updateDocument(doc: object, id?: number): void; clear(): void; - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; toJSON(): FullTextSearch.Serialization; static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers?: Dict): FullTextSearch; } diff --git a/dist/packages/local-storage/types/full-text-search/src/index.d.ts b/dist/packages/local-storage/types/full-text-search/src/index.d.ts index f03dde09..b901b108 100644 --- a/dist/packages/local-storage/types/full-text-search/src/index.d.ts +++ b/dist/packages/local-storage/types/full-text-search/src/index.d.ts @@ -1,6 +1,5 @@ import { FullTextSearch } from "./full_text_search"; -export { Tokenizer } from "./tokenizer"; -export { QueryBuilder } from "./query_builder"; -export { InvertedIndex } from "./inverted_index"; -export { FullTextSearch }; +import { Tokenizer } from "./tokenizer"; +import { QueryBuilder } from "./query_builder"; +export { FullTextSearch, Tokenizer, QueryBuilder }; export default FullTextSearch; diff --git a/dist/packages/local-storage/types/full-text-search/src/index_searcher.d.ts b/dist/packages/local-storage/types/full-text-search/src/index_searcher.d.ts index d3cf7f93..00b99f2f 100644 --- a/dist/packages/local-storage/types/full-text-search/src/index_searcher.d.ts +++ b/dist/packages/local-storage/types/full-text-search/src/index_searcher.d.ts @@ -1,4 +1,4 @@ -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; import { InvertedIndex } from "./inverted_index"; import { Query } from "./query_builder"; import { Dict } from "../../common/types"; @@ -13,9 +13,9 @@ export declare class IndexSearcher { * @param {object} invIdxs */ constructor(invIdxs: Dict, docs: Set); - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; setDirty(): void; private _recursive(query, doScoring); - private _getUnique(queries, doScoring, docResults); + private _getUnique(queries, doScoring, queryResults); private _getAll(queries, doScoring); } diff --git a/dist/packages/local-storage/types/full-text-search/src/query_builder.d.ts b/dist/packages/local-storage/types/full-text-search/src/query_builder.d.ts index 923317f6..6f324e15 100644 --- a/dist/packages/local-storage/types/full-text-search/src/query_builder.d.ts +++ b/dist/packages/local-storage/types/full-text-search/src/query_builder.d.ts @@ -24,8 +24,8 @@ export declare class BaseQueryBuilder { */ build(): any; } -export interface BaseQuery { - type: string; +export interface BaseQuery { + type: Type; boost?: number; } /** @@ -51,7 +51,7 @@ export declare class TermQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, term: string, data?: any); } -export interface TermQuery extends BaseQuery { +export interface TermQuery extends BaseQuery<"term"> { field: string; value: string; } @@ -78,7 +78,7 @@ export declare class TermsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, terms: Array, data?: any); } -export interface TermsQuery extends BaseQuery { +export interface TermsQuery extends BaseQuery<"terms"> { field: string; value: string[]; } @@ -119,7 +119,7 @@ export declare class WildcardQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface WildcardQuery extends BaseQuery { +export interface WildcardQuery extends BaseQuery<"wildcard"> { field: string; value: string; enable_scoring?: boolean; @@ -169,7 +169,7 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { * * @return {FuzzyQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the initial word length. * @param {number} prefixLength - the positive prefix length @@ -183,10 +183,10 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface FuzzyQuery extends BaseQuery { +export interface FuzzyQuery extends BaseQuery<"fuzzy"> { field: string; value: string; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -221,7 +221,7 @@ export declare class PrefixQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface PrefixQuery extends BaseQuery { +export interface PrefixQuery extends BaseQuery<"prefix"> { field: string; value: string; enable_scoring?: boolean; @@ -247,7 +247,7 @@ export declare class ExistsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, data?: any); } -export interface ExistsQuery extends BaseQuery { +export interface ExistsQuery extends BaseQuery<"exists"> { field: string; } /** @@ -315,7 +315,7 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { * * @return {MatchQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the starting word length which should not be considered for fuzziness. * @param {number} prefixLength - the positive prefix length @@ -329,12 +329,12 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface MatchQuery extends BaseQuery { +export interface MatchQuery extends BaseQuery<"match"> { field: string; value: string; minimum_should_match?: number; operator?: "and" | "or"; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -360,7 +360,7 @@ export interface MatchQuery extends BaseQuery { export declare class MatchAllQueryBuilder extends BaseQueryBuilder { constructor(data?: any); } -export interface MatchQueryAll extends BaseQuery { +export interface MatchQueryAll extends BaseQuery<"match_all"> { } /** * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter. @@ -388,9 +388,11 @@ export declare class ConstantScoreQueryBuilder extends BaseQueryBuilder { * Starts an array of queries. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): ConstantScoreQueryBuilder; + }; } -export interface ConstantScoreQuery extends BaseQuery { +export interface ConstantScoreQuery extends BaseQuery<"constant_score"> { filter: ArrayQuery; } /** @@ -442,22 +444,30 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { * Starts an array of queries for must clause. Use endMust() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginMust(): ArrayQueryBuilder; + beginMust(): ArrayQueryBuilder & { + endMust(): BoolQueryBuilder; + }; /** * Starts an array of queries for filter clause. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): BoolQueryBuilder; + }; /** * Starts an array of queries for should clause. Use endShould() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginShould(): ArrayQueryBuilder; + beginShould(): ArrayQueryBuilder & { + endShould(): BoolQueryBuilder; + }; /** * Starts an array of queries for not clause. Use endNot() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginNot(): ArrayQueryBuilder; + beginNot(): ArrayQueryBuilder & { + endNot(): BoolQueryBuilder; + }; /** * Controls the amount of minimum matching sub queries before a document will be considered. * @param {number} minShouldMatch - number of minimum matching sub queries @@ -472,7 +482,7 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { */ minimumShouldMatch(minShouldMatch: number): this; } -export interface BoolQuery extends BaseQuery { +export interface BoolQuery extends BaseQuery<"bool"> { must?: ArrayQuery; filter?: ArrayQuery; should?: ArrayQuery; @@ -497,8 +507,8 @@ export declare class ArrayQueryBuilder extends BaseQueryBuilder { prefix(field: string, prefix: string): any; exists(field: string): any; } -export interface ArrayQuery { - values: any[]; +export interface ArrayQuery extends BaseQuery<"array"> { + values: QueryTypes[]; } /** * This query builder is the root of each query search. @@ -525,9 +535,15 @@ export declare class QueryBuilder { /** * The query performs a final scoring over all scored sub queries. * @param {boolean} enable - flag to enable or disable final scoring - * @return {QueryBuilder} + * @return {this} */ enableFinalScoring(enable: boolean): this; + /** + * Adds an explanation of the scoring of each document for all matched terms. + * @param {boolean} enable -flag to enable or disable explanation + * @returns {this} + */ + explain(enable: boolean): this; /** * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model. * @@ -535,10 +551,10 @@ export declare class QueryBuilder { * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}. * * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation. - * Lower values result in quicker saturation, and higher values in slower saturation. + * Lower values result in quicker saturation, and higher values in slower saturation * @param {number} [b=0.75] - controls how much effect field-length normalization should have. - * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully. - * @return {QueryBuilder} + * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully + * @return {this} */ BM25Similarity(k1?: number, b?: number): this; bool(): BoolQueryBuilder; @@ -553,9 +569,11 @@ export declare class QueryBuilder { exists(field: string): ExistsQueryBuilder; private _prepare(queryType, ...args); } +export declare type QueryTypes = BoolQuery | ConstantScoreQuery | TermQuery | TermsQuery | WildcardQuery | FuzzyQuery | MatchQuery | MatchQueryAll | PrefixQuery | ExistsQuery; export interface Query { - query: any; + query: QueryTypes; final_scoring?: boolean; + explain?: boolean; bm25?: { k1: number; b: number; diff --git a/dist/packages/local-storage/types/full-text-search/src/scorer.d.ts b/dist/packages/local-storage/types/full-text-search/src/scorer.d.ts index aed3e619..dacdc753 100644 --- a/dist/packages/local-storage/types/full-text-search/src/scorer.d.ts +++ b/dist/packages/local-storage/types/full-text-search/src/scorer.d.ts @@ -1,7 +1,6 @@ import { InvertedIndex } from "./inverted_index"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -export declare type ScoreResult = Dict; /** * @hidden */ @@ -10,9 +9,9 @@ export declare class Scorer { private _cache; constructor(invIdxs: Dict); setDirty(): void; - score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, docResults: Scorer.DocResults, term: number[]): void; - scoreConstant(boost: number, docId: number, docResults: Scorer.DocResults): Map; - finalScore(query: Query, docResults: Scorer.DocResults): ScoreResult; + score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, queryResults: Scorer.QueryResults, term: number[]): void; + scoreConstant(boost: number, docId: number, queryResults: Scorer.QueryResults): Map; + finalScore(query: Query, queryResults: Scorer.QueryResults): Scorer.ScoreResult; private static _calculateFieldLength(fieldLength); private _getCache(fieldName); /** @@ -30,12 +29,33 @@ export declare namespace Scorer { idfs: Dict; avgFieldLength: number; } - interface DocResult { + interface QueryResult { tf?: number; idf?: number; boost: number; fieldName?: string; term?: number[]; } - type DocResults = Map; + type QueryResults = Map; + interface BM25Explanation { + boost: number; + score: number; + docID: number; + fieldName: string; + index: string; + idf: number; + tfNorm: number; + tf: number; + fieldLength: number; + avgFieldLength: number; + } + interface ConstantExplanation { + boost: number; + score: number; + } + type ScoreExplanation = BM25Explanation | ConstantExplanation; + type ScoreResult = Dict<{ + score: number; + explanation?: ScoreExplanation[]; + }>; } diff --git a/dist/packages/local-storage/types/indexed-storage/src/index.d.ts b/dist/packages/local-storage/types/indexed-storage/src/index.d.ts new file mode 100644 index 00000000..bf453632 --- /dev/null +++ b/dist/packages/local-storage/types/indexed-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { IndexedStorage } from "./indexed_storage"; +export { IndexedStorage }; +export default IndexedStorage; diff --git a/dist/packages/local-storage/types/indexed-storage/src/indexed_storage.d.ts b/dist/packages/local-storage/types/indexed-storage/src/indexed_storage.d.ts index 457b01a0..adaeaef1 100644 --- a/dist/packages/local-storage/types/indexed-storage/src/indexed_storage.d.ts +++ b/dist/packages/local-storage/types/indexed-storage/src/indexed_storage.d.ts @@ -6,7 +6,7 @@ import { StorageAdapter } from "../../common/types"; * IndexedDb storage is provided per-domain, so we implement app/key/value database to * allow separate contexts for separate apps within a domain. */ -export declare class LokiIndexedStorage implements StorageAdapter { +export declare class IndexedStorage implements StorageAdapter { private _appname; private catalog; /** @@ -98,4 +98,4 @@ export interface Entry { key: string; size: number; } -export default LokiIndexedStorage; +export default IndexedStorage; diff --git a/dist/packages/local-storage/types/local-storage/src/index.d.ts b/dist/packages/local-storage/types/local-storage/src/index.d.ts new file mode 100644 index 00000000..2b74e8c0 --- /dev/null +++ b/dist/packages/local-storage/types/local-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { LocalStorage } from "./local_storage"; +export { LocalStorage }; +export default LocalStorage; diff --git a/dist/packages/local-storage/types/local-storage/src/local_storage.d.ts b/dist/packages/local-storage/types/local-storage/src/local_storage.d.ts index 2337eb12..380d8be9 100644 --- a/dist/packages/local-storage/types/local-storage/src/local_storage.d.ts +++ b/dist/packages/local-storage/types/local-storage/src/local_storage.d.ts @@ -1,9 +1,9 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists to web browser's local storage object - * @constructor LokiLocalStorageAdapter + * @constructor LocalStorageAdapter */ -export declare class LokiLocalStorage implements StorageAdapter { +export declare class LocalStorage implements StorageAdapter { /** * Registers the local storage as plugin. */ @@ -33,4 +33,4 @@ export declare class LokiLocalStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiLocalStorage; +export default LocalStorage; diff --git a/dist/packages/local-storage/types/loki/src/clone.d.ts b/dist/packages/local-storage/types/loki/src/clone.d.ts index 03b650d7..c74a17bd 100644 --- a/dist/packages/local-storage/types/loki/src/clone.d.ts +++ b/dist/packages/local-storage/types/loki/src/clone.d.ts @@ -1,10 +1,4 @@ -export declare enum CloneMethod { - PARSE_STRINGIFY = 0, - DEEP = 1, - SHALLOW = 2, - SHALLOW_ASSIGN = 3, - SHALLOW_RECURSE_OBJECTS = 4, -} +export declare type CloneMethod = "parse-stringify" | "deep" | "shallow" | "shallow-recurse-objects"; /** * @hidden */ diff --git a/dist/packages/local-storage/types/loki/src/collection.d.ts b/dist/packages/local-storage/types/loki/src/collection.d.ts index 8b44c82f..9bd5e091 100644 --- a/dist/packages/local-storage/types/loki/src/collection.d.ts +++ b/dist/packages/local-storage/types/loki/src/collection.d.ts @@ -1,34 +1,39 @@ import { LokiEventEmitter } from "./event_emitter"; import { UniqueIndex } from "./unique_index"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { DynamicView } from "./dynamic_view"; import { CloneMethod } from "./clone"; -import { Doc, Dict, Query } from "../../common/types"; +import { Doc, Dict } from "../../common/types"; import { FullTextSearch } from "../../full-text-search/src/full_text_search"; import { Tokenizer } from "../../full-text-search/src/tokenizer"; -export declare type ANY = any; export { CloneMethod } from "./clone"; /** * Collection class that handles documents of same type * @extends LokiEventEmitter + * @param - the data type + * @param - nested properties of data type */ -export declare class Collection extends LokiEventEmitter { +export declare class Collection extends LokiEventEmitter { name: string; - data: Doc[]; + _data: Doc[]; private idIndex; - binaryIndices: Dict; + binaryIndices: { + [P in keyof TData]?: Collection.BinaryIndex; + }; /** - * Unique contraints contain duplicate object references, so they are not persisted. - * We will keep track of properties which have unique contraint applied here, and regenerate on load. + * Unique constraints contain duplicate object references, so they are not persisted. + * We will keep track of properties which have unique constraints applied here, and regenerate on load. */ constraints: { - unique: {}; + unique: { + [P in keyof TData]?: UniqueIndex; + }; }; /** * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along * with the database. */ - transforms: {}; + transforms: Dict[]>; /** * In autosave scenarios we will use collection level dirty flags to determine whether save is needed. * currently, if any collection is dirty we will autosave the whole database if autosave is configured. @@ -62,7 +67,7 @@ export declare class Collection extends LokiEventEmit /** * Disable delta update object style on changes. */ - disableDeltaChangesApi: ANY; + disableDeltaChangesApi: boolean; /** * By default, if you insert a document into a collection with binary indices, if those indexed properties contain * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the @@ -72,7 +77,7 @@ export declare class Collection extends LokiEventEmit /** * Option to activate a cleaner daemon - clears "aged" documents at set intervals. */ - ttl: ANY; + ttl: Collection.TTL; private maxId; private _dynamicViews; /** @@ -81,7 +86,15 @@ export declare class Collection extends LokiEventEmit private changes; private insertHandler; private updateHandler; - console: ANY; + console: { + log(...args: any[]): void; + warn(...args: any[]): void; + error(...args: any[]): void; + }; + /** + * stages: a map of uniquely identified 'stages', which hold copies of objects to be + * manipulated without affecting the data in the original collection + */ private stages; private commitLog; _fullTextSearch: FullTextSearch; @@ -97,69 +110,50 @@ export declare class Collection extends LokiEventEmit * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable - * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method + * @param {string} [options.cloneMethod="deep"] - the clone method * @param {number} [options.transactional=false] - ? * @param {number} options.ttl - ? * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @see {@link Loki#addCollection} for normal creation of collections */ - constructor(name: string, options?: Collection.Options); - toJSON(): { - name: string; - _dynamicViews: DynamicView[]; - uniqueNames: string[]; - transforms: {}; - binaryIndices: Dict; - data: Doc[]; - idIndex: number[]; - maxId: number; - dirty: boolean; - adaptiveBinaryIndices: boolean; - transactional: boolean; - asyncListeners: boolean; - disableChangesApi: boolean; - cloneObjects: boolean; - cloneMethod: CloneMethod; - changes: any[]; - _fullTextSearch: FullTextSearch; - }; - static fromJSONObject(obj: ANY, options?: Collection.DeserializeOptions): Collection; + constructor(name: string, options?: Collection.Options); + toJSON(): Collection.Serialized; + static fromJSONObject(obj: Collection.Serialized, options?: Collection.DeserializeOptions): Collection; /** * Adds a named collection transform to the collection * @param {string} name - name to associate with transform * @param {array} transform - an array of transformation 'step' objects to save into the collection */ - addTransform(name: string, transform: ANY[]): void; + addTransform(name: string, transform: Collection.Transform[]): void; /** * Retrieves a named transform from the collection. * @param {string} name - name of the transform to lookup. */ - getTransform(name: string): any; + getTransform(name: string): Collection.Transform[]; /** * Updates a named collection transform to the collection * @param {string} name - name to associate with transform * @param {object} transform - a transformation object to save into collection */ - setTransform(name: string, transform: ANY[]): void; + setTransform(name: string, transform: Collection.Transform[]): void; /** * Removes a named collection transform from the collection * @param {string} name - name of collection transform to remove */ removeTransform(name: string): void; - ttlDaemonFuncGen(): () => void; private setTTL(age, interval); /** * create a row filter that covers all documents in the collection */ - prepareFullDocIndex(): any[]; + _prepareFullDocIndex(): number[]; /** * Ensure binary index on a certain field * @param {string} property - name of property to create binary index on - * @param {boolean} force - (Optional) flag indicating whether to construct index immediately + * @param {boolean} [force=false] - flag indicating whether to construct index immediately */ - ensureIndex(property: string, force?: boolean): void; - getSequencedIndexValues(property: string): string; - ensureUniqueIndex(field: string): UniqueIndex; + ensureIndex(property: keyof TData, force?: boolean): void; + getSequencedIndexValues(property: keyof TData): string; + ensureUniqueIndex(field: keyof TData): UniqueIndex; /** * Ensure all binary indices */ @@ -171,11 +165,11 @@ export declare class Collection extends LokiEventEmit * @param {object} query - (optional) query object to count results of * @returns {number} number of documents in the collection */ - count(query?: object): number; + count(query?: ResultSet.Query & TNested>): number; /** * Rebuild idIndex */ - ensureId(): void; + private _ensureId(); /** * Add a dynamic view to the collection * @param {string} name - name of dynamic view to add @@ -185,7 +179,7 @@ export declare class Collection extends LokiEventEmit * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here) * @returns {DynamicView} reference to the dynamic view added **/ - addDynamicView(name: string, options?: DynamicView.Options): DynamicView; + addDynamicView(name: string, options?: DynamicView.Options): DynamicView; /** * Remove a dynamic view from the collection * @param {string} name - name of dynamic view to remove @@ -196,7 +190,7 @@ export declare class Collection extends LokiEventEmit * @param {string} name - name of dynamic view to retrieve reference of * @returns {DynamicView} A reference to the dynamic view with that name **/ - getDynamicView(name: string): DynamicView; + getDynamicView(name: string): DynamicView; /** * Applies a 'mongo-like' find query object and passes all results to an update function. * For filter function querying you should migrate to [ @@ -205,38 +199,39 @@ export declare class Collection extends LokiEventEmit * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode) * @param {function} updateFunction - update function to run against filtered documents */ - findAndUpdate(filterObject: Query | ((obj: E) => boolean), updateFunction: (obj: E) => E): void; + findAndUpdate(filterObject: ResultSet.Query & TNested> | ((obj: Doc) => boolean), updateFunction: (obj: Doc) => any): void; /** * Applies a 'mongo-like' find query object removes all documents which match that filter. * * @param {object} filterObject - 'mongo-like' query object */ - findAndRemove(filterObject: object): void; + findAndRemove(filterObject: ResultSet.Query & TNested>): void; /** * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc. * @param {(object|array)} doc - the document (or array of documents) to be inserted * @returns {(object|array)} document or documents inserted */ - insert(doc: E | E[]): Doc; - insert(doc: E[]): Doc[]; + insert(doc: TData): Doc; + insert(doc: TData[]): Doc[]; /** * Adds a single object, ensures it has meta properties, clone it if necessary, etc. * @param {object} doc - the document to be inserted * @param {boolean} bulkInsert - quiet pre-insert and insert event emits * @returns {object} document or 'undefined' if there was a problem inserting it */ - insertOne(doc: E, bulkInsert?: boolean): Doc; + insertOne(doc: TData, bulkInsert?: boolean): Doc; /** * Empties the collection. - * @param {object} options - configure clear behavior - * @param {boolean} options.removeIndices - (default: false) + * @param {boolean} [removeIndices=false] - remove indices */ - clear(options?: ANY): void; + clear({removeIndices: removeIndices}?: { + removeIndices?: boolean; + }): void; /** * Updates an object and notifies collection that the document has changed. * @param {object} doc - document to update within the collection */ - update(doc: ANY): any; + update(doc: Doc | Doc[]): void; /** * Add object to collection */ @@ -247,24 +242,24 @@ export declare class Collection extends LokiEventEmit * @param {function} filterFunction - filter function whose results will execute update * @param {function} updateFunction - update function to run against filtered documents */ - updateWhere(filterFunction: (obj: E) => boolean, updateFunction: (obj: E) => E): void; + updateWhere(filterFunction: (obj: Doc) => boolean, updateFunction: (obj: Doc) => any): void; /** * Remove all documents matching supplied filter function. * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}. * @param {function|object} query - query object to filter on */ - removeWhere(query: Query | ((obj: E) => boolean)): void; + removeWhere(query: ResultSet.Query & TNested> | ((obj: Doc) => boolean)): void; removeDataOnly(): void; /** * Remove a document from the collection - * @param {object} doc - document to remove from collection + * @param {number|object} doc - document to remove from collection */ - remove(doc: ANY): any; + remove(doc: number | Doc | Doc[]): void; /** * Returns all changes. - * @returns {ANY} + * @returns {Collection.Change[]} */ - getChanges(): any[]; + getChanges(): Collection.Change[]; /** * Enables/disables changes api. * @param {boolean} disableChangesApi @@ -301,34 +296,35 @@ export declare class Collection extends LokiEventEmit * @returns {(object|array|null)} Object reference if document was found, null if not, * or an array if 'returnPosition' was passed. */ - get(id: number): Doc; - get(id: number, returnPosition: boolean): Doc | [Doc, number]; + get(id: number): Doc; + get(id: number, returnPosition: boolean): Doc | [Doc, number]; /** * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value * Since multiple documents may contain the same value (which the index is sorted on), * we hone in on range and then linear scan range to find exact index array position. - * @param {int} dataPosition : coll.data array index/position + * @param {int} dataPosition : data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - getBinaryIndexPosition(dataPosition: number, binaryIndexName: string): number; + getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData): number; /** * Adaptively insert a selected item to the index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively update a selected item within an index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively remove a selected item from the index. - * @param {int} dataPosition : coll.data array index/position + * @param {number} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in + * @param {boolean} removedFromIndexOnly - remove from index only */ - adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: string, removedFromIndexOnly?: boolean): ANY; + adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly?: boolean): void; /** * Internal method used for index maintenance and indexed searching. * Calculates the beginning of an index range for a given value. @@ -351,7 +347,7 @@ export declare class Collection extends LokiEventEmit private _calculateRangeEnd(prop, val); /** * Binary Search utility method to find range/segment of values matching criteria. - * this is used for collection.find() and first find filter of resultset/dynview + * this is used for collection.find() and first find filter of ResultSet/dynview * slightly different than get() binary search in that get() hones in on 1 value, * but we have to hone in on many (range) * @param {string} op - operation, such as $eq @@ -359,29 +355,29 @@ export declare class Collection extends LokiEventEmit * @param {object} val - value to use for range calculation. * @returns {array} [start, end] index array positions */ - calculateRange(op: string, prop: string, val: ANY): [number, number]; + calculateRange(op: string, prop: keyof TData, val: any): [number, number]; /** * Retrieve doc by Unique index * @param {string} field - name of uniquely indexed property to use when doing lookup * @param {any} value - unique value to search for * @returns {object} document matching the value passed */ - by(field: string, value: ANY): Doc; + by(field: string, value: any): Doc; /** * Find one object by index property, by property equal to value * @param {object} query - query object used to perform search with * @returns {(object|null)} First matching document, or null if none */ - findOne(query: object): Doc; + findOne(query: ResultSet.Query & TNested>): Doc; /** * Chain method, used for beginning a series of chained find() and/or view() operations * on a collection. * * @param {array} transform - Ordered array of transform step objects similar to chain * @param {object} parameters - Object containing properties representing parameters to substitute - * @returns {Resultset} (this) resultset, or data array if any map or join functions where called + * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called */ - chain(transform?: string | ANY[], parameters?: ANY): Resultset; + chain(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** * Find method, api is similar to mongodb. * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}. @@ -389,20 +385,26 @@ export declare class Collection extends LokiEventEmit * @param {object} query - 'mongo-like' query object * @returns {array} Array of matching documents */ - find(query?: Query): Doc[]; + find(query?: ResultSet.Query & TNested>): Doc[]; /** * Find object by unindexed field by property equal to value, * simply iterates and returns the first element matching the query */ - findOneUnindexed(prop: string, value: ANY): Doc; + findOneUnindexed(prop: string, value: any): Doc; /** * Transaction methods */ - /** start the transation */ + /** + * start the transation + */ startTransaction(): void; - /** commit the transation */ + /** + * commit the transation + */ commit(): void; - /** roll back the transation */ + /** + * roll back the transation + */ rollback(): void; /** * Query the collection by supplying a javascript filter function. @@ -414,14 +416,14 @@ export declare class Collection extends LokiEventEmit * @param {function} fun - filter function to run against all collection docs * @returns {array} all documents which pass your filter function */ - where(fun: (obj: E) => boolean): Doc[]; + where(fun: (obj: Doc) => boolean): Doc[]; /** * Map Reduce operation * @param {function} mapFunction - function to use as map function * @param {function} reduceFunction - function to use as reduce function * @returns {data} The result of your mapReduce operation */ - mapReduce(mapFunction: (value: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (value: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Join two collections on specified properties * @@ -429,13 +431,13 @@ export declare class Collection extends LokiEventEmit * @param {string} leftJoinProp - property name in collection * @param {string} rightJoinProp - property name in joinData * @param {function} mapFun - (Optional) map function to use - * @returns {Resultset} Result of the mapping operation - */ - eqJoin(joinData: ANY[], leftJoinProp: string, rightJoinProp: string, mapFun?: Function): Resultset; - /** - * stages: a map of uniquely identified 'stages', which hold copies of objects to be - * manipulated without affecting the data in the original collection + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method + * @returns {ResultSet} Result of the mapping operation */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinProp: string | ((obj: any) => string), rightJoinProp: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * (Staging API) create a stage and/or retrieve it */ @@ -446,7 +448,7 @@ export declare class Collection extends LokiEventEmit /** * (Staging API) create a copy of an object and insert it into a stage */ - stage(stageName: string, obj: ANY): any; + stage(stageName: string, obj: Doc): F; /** * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt * then create a message to be inserted in the commitlog @@ -459,10 +461,10 @@ export declare class Collection extends LokiEventEmit extract(field: string): any[]; /** */ - max(field: string): any; + max(field: string): number; /** */ - min(field: string): any; + min(field: string): number; /** */ maxRecord(field: string): { @@ -500,9 +502,9 @@ export declare class Collection extends LokiEventEmit median(field: string): number; } export declare namespace Collection { - interface Options { - unique?: string[]; - indices?: string[]; + interface Options { + unique?: (keyof TData)[]; + indices?: (keyof TData)[]; adaptiveBinaryIndices?: boolean; asyncListeners?: boolean; disableChangesApi?: boolean; @@ -518,10 +520,89 @@ export declare namespace Collection { interface DeserializeOptions { retainDirtyFlags?: boolean; fullTextSearch?: Dict; + [collName: string]: any | { + proto?: any; + inflate?: (src: object, dest?: object) => void; + }; } interface BinaryIndex { dirty: boolean; values: any; } - type Change = any; + interface Change { + name: string; + operation: string; + obj: any; + } + interface Serialized { + name: string; + _dynamicViews: DynamicView[]; + uniqueNames: string[]; + transforms: Dict; + binaryIndices: Dict; + _data: Doc[]; + idIndex: number[]; + maxId: number; + dirty: boolean; + adaptiveBinaryIndices: boolean; + transactional: boolean; + asyncListeners: boolean; + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + cloneObjects: boolean; + cloneMethod: CloneMethod; + changes: any; + _fullTextSearch: FullTextSearch; + } + type Transform = { + type: "find"; + value: ResultSet.Query & TNested> | string; + } | { + type: "where"; + value: ((obj: Doc) => boolean) | string; + } | { + type: "simplesort"; + property: keyof (TData & TNested); + desc?: boolean; + } | { + type: "compoundsort"; + value: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]; + } | { + type: "sort"; + value: (a: Doc, b: Doc) => number; + } | { + type: "sortByScoring"; + desc?: boolean; + } | { + type: "limit"; + value: number; + } | { + type: "offset"; + value: number; + } | { + type: "map"; + value: (obj: TData, index: number, array: TData[]) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "eqJoin"; + joinData: Collection | ResultSet; + leftJoinKey: string | ((obj: any) => string); + rightJoinKey: string | ((obj: any) => string); + mapFun?: (left: any, right: any) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "mapReduce"; + mapFunction: (item: TData, index: number, array: TData[]) => any; + reduceFunction: (array: any[]) => any; + } | { + type: "update"; + value: (obj: Doc) => any; + } | { + type: "remove"; + }; + interface TTL { + age: number; + ttlInterval: number; + daemon: any; + } } diff --git a/dist/packages/local-storage/types/loki/src/dynamic_view.d.ts b/dist/packages/local-storage/types/loki/src/dynamic_view.d.ts index 1aeab3a4..5cda4b13 100644 --- a/dist/packages/local-storage/types/loki/src/dynamic_view.d.ts +++ b/dist/packages/local-storage/types/loki/src/dynamic_view.d.ts @@ -1,9 +1,8 @@ import { LokiEventEmitter } from "./event_emitter"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { Collection } from "./collection"; -import { Doc, Filter } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; /** * DynamicView class is a versatile 'live' view class which can have filters and sorts applied. * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it @@ -18,18 +17,21 @@ export declare type ANY = any; * @extends LokiEventEmitter * @see {@link Collection#addDynamicView} to construct instances of DynamicView + * + * @param - the data type + * @param - nested properties of data type */ -export declare class DynamicView extends LokiEventEmitter { +export declare class DynamicView extends LokiEventEmitter { private _collection; private _persistent; private _sortPriority; private _minRebuildInterval; name: string; private _rebuildPending; - private _resultset; - private _resultdata; - private _resultsdirty; - private _cachedresultset; + private _resultSet; + private _resultData; + private _resultDirty; + private _cachedResultSet; private _filterPipeline; private _sortFunction; private _sortCriteria; @@ -41,10 +43,10 @@ export declare class DynamicView extends LokiEventEmi * @param {string} name - the name of this dynamic view * @param {object} options - the options * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' - * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority + * @param {string} [options.sortPriority="passive"] - the sort priority * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here) */ - constructor(collection: Collection, name: string, options?: DynamicView.Options); + constructor(collection: Collection, name: string, options?: DynamicView.Options); /** * Internally used immediately after deserialization (loading) * This will clear out and reapply filterPipeline ops, recreating the view. @@ -57,34 +59,22 @@ export declare class DynamicView extends LokiEventEmi */ _rematerialize({removeWhereFilters}: { removeWhereFilters?: boolean; - }): DynamicView; + }): this; /** - * Makes a copy of the internal resultset for branched queries. - * Unlike this dynamic view, the branched resultset will not be 'live' updated, + * Makes a copy of the internal ResultSet for branched queries. + * Unlike this dynamic view, the branched ResultSet will not be 'live' updated, * so your branched query should be immediately resolved and not held for future evaluation. * * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps * @param {object} parameters - optional parameters (if optional transform requires them) - * @returns {Resultset} A copy of the internal resultset for branched queries. + * @returns {ResultSet} A copy of the internal ResultSet for branched queries. */ - branchResultset(transform: string | any[], parameters?: object): Resultset; + branchResultSet(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** - * toJSON() - Override of toJSON to avoid circular references - * + * Override of toJSON to avoid circular references. */ - toJSON(): { - name: string; - _persistent: boolean; - _sortPriority: DynamicView.SortPriority; - _minRebuildInterval: number; - _resultset: Resultset; - _resultsdirty: boolean; - _filterPipeline: Filter[]; - _sortCriteria: (string | [string, boolean])[]; - _sortByScoring: boolean; - _sortDirty: boolean; - }; - static fromJSONObject(collection: ANY, obj: ANY): DynamicView; + toJSON(): DynamicView.Serialized; + static fromJSONObject(collection: Collection, obj: DynamicView.Serialized): DynamicView; /** * Used to clear pipeline and reset dynamic view to initial state. * Existing options should be retained. @@ -105,7 +95,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} comparefun - a javascript compare function used for sorting * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySort(comparefun: (lhs: E, rhs: E) => number): DynamicView; + applySort(comparefun: (lhs: Doc, rhs: Doc) => number): this; /** * Used to specify a property used for view translation. * @example @@ -115,9 +105,9 @@ export declare class DynamicView extends LokiEventEmi * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySimpleSort(propname: string, isdesc?: boolean): DynamicView; + applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * dv.applySortCriteria(['age', 'name']); @@ -129,32 +119,32 @@ export declare class DynamicView extends LokiEventEmi * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations. */ - applySortCriteria(criteria: (string | [string, boolean])[]): DynamicView; + applySortCriteria(criteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Used to apply a sort by the latest full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending */ - applySortByScoring(ascending?: boolean): DynamicView; + applySortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** * Marks the beginning of a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - startTransaction(): DynamicView; + startTransaction(): this; /** * Commits a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - commit(): DynamicView; + commit(): this; /** * Rolls back a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - rollback(): DynamicView; + rollback(): this; /** * Find the index of a filter in the pipeline, by that filter's ID. * @@ -163,7 +153,7 @@ export declare class DynamicView extends LokiEventEmi */ private _indexOfFilterWithId(uid); /** - * Add the filter object to the end of view's filter pipeline and apply the filter to the resultset. + * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet. * * @param {object} filter - The filter object. Refer to applyFilter() for extra details. */ @@ -173,7 +163,7 @@ export declare class DynamicView extends LokiEventEmi * * @returns {DynamicView} this DynamicView object, for further chain ops. */ - reapplyFilters(): DynamicView; + reapplyFilters(): this; /** * Adds or updates a filter in the DynamicView filter pipeline * @@ -181,7 +171,7 @@ export declare class DynamicView extends LokiEventEmi * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id } * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFilter(filter: Filter): DynamicView; + applyFilter(filter: DynamicView.Filter): this; /** * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline * @@ -189,7 +179,7 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFind(query: object, uid?: string | number): DynamicView; + applyFind(query: object, uid?: string | number): this; /** * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline * @@ -197,14 +187,14 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyWhere(fun: (obj: E) => boolean, uid?: string | number): DynamicView; + applyWhere(fun: (obj: Doc) => boolean, uid?: string | number): this; /** * removeFilter() - Remove the specified filter from the DynamicView filter pipeline * * @param {(string|number)} uid - The unique ID of the filter to be removed. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - removeFilter(uid: string | number): DynamicView; + removeFilter(uid: string | number): this; /** * Returns the number of documents representing the current DynamicView contents. * @returns {number} The number of documents representing the current DynamicView contents. @@ -213,16 +203,16 @@ export declare class DynamicView extends LokiEventEmi /** * Resolves and pending filtering and sorting, then returns document array as result. * - * @param {object} options - optional parameters to pass to resultset.data() if non-persistent - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * * @returns {Array} An array of documents representing the current DynamicView contents. */ - data(options?: object): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** * When the view is not sorted we may still wish to be notified of rebuild events. * This event will throttle and queue a single rebuild event when batches of updates affect the view. @@ -257,7 +247,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; } export declare namespace DynamicView { interface Options { @@ -265,8 +255,25 @@ export declare namespace DynamicView { sortPriority?: SortPriority; minRebuildInterval?: number; } - enum SortPriority { - PASSIVE = 0, - ACTIVE = 1, + type SortPriority = "passive" | "active"; + interface Serialized { + name: string; + _persistent: boolean; + _sortPriority: SortPriority; + _minRebuildInterval: number; + _resultSet: ResultSet; + _filterPipeline: Filter[]; + _sortCriteria: (string | [string, boolean])[]; + _sortByScoring: boolean; + _sortDirty: boolean; } + type Filter = { + type: "find"; + val: ResultSet.Query & TNested>; + uid: number | string; + } | { + type: "where"; + val: (obj: Doc) => boolean; + uid: number | string; + }; } diff --git a/dist/packages/local-storage/types/loki/src/event_emitter.d.ts b/dist/packages/local-storage/types/loki/src/event_emitter.d.ts index f422ee35..e55515e9 100644 --- a/dist/packages/local-storage/types/loki/src/event_emitter.d.ts +++ b/dist/packages/local-storage/types/loki/src/event_emitter.d.ts @@ -1,4 +1,3 @@ -export declare type ANY = any; /** * LokiEventEmitter is a minimalist version of EventEmitter. It enables any * constructor that inherits EventEmitter to emit events and trigger @@ -31,7 +30,7 @@ export declare class LokiEventEmitter { * @param {string} eventName - the name of the event * @param {object} data - optional object passed with the event */ - emit(eventName: string, ...data: ANY[]): void; + emit(eventName: string, ...data: any[]): void; /** * Alias of LokiEventEmitter.prototype.on * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event diff --git a/dist/packages/local-storage/types/loki/src/helper.d.ts b/dist/packages/local-storage/types/loki/src/helper.d.ts index b187e0eb..44b72305 100644 --- a/dist/packages/local-storage/types/loki/src/helper.d.ts +++ b/dist/packages/local-storage/types/loki/src/helper.d.ts @@ -1,8 +1,5 @@ /** - * @hidden - */ -export declare type ANY = any; -/** Helper function for determining 'loki' abstract equality which is a little more abstract than == + * Helper function for determining 'loki' abstract equality which is a little more abstract than == * aeqHelper(5, '5') === true * aeqHelper(5.0, '5') === true * aeqHelper(new Date("1/1/2011"), new Date("1/1/2011")) === true @@ -10,34 +7,33 @@ export declare type ANY = any; * aeqHelper([1, 2, 3], [1, 3]) === false * aeqHelper([1, 2, 3], [1, 2, 3]) === true * aeqHelper(undefined, null) === true - */ -/** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @returns {boolean} + * @hidden */ -export declare function aeqHelper(prop1: ANY, prop2: ANY): boolean; -/** Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. +export declare function aeqHelper(prop1: any, prop2: any): boolean; +/** + * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. * In the future we might want $lt and $gt ops to use their own functionality/helper. * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another. * @hidden */ -export declare function ltHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function ltHelper(prop1: any, prop2: any, equal: boolean): boolean; /** * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @param {boolean} equal * @returns {boolean} */ -export declare function gtHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function gtHelper(prop1: any, prop2: any, equal: boolean): boolean; /** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 - * @param {ANY} desc + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} descending * @returns {number} + * @hidden */ -export declare function sortHelper(prop1: ANY, prop2: ANY, desc: ANY): 0 | 1 | -1; +export declare function sortHelper(prop1: any, prop2: any, descending: boolean): number; diff --git a/dist/packages/local-storage/types/loki/src/index.d.ts b/dist/packages/local-storage/types/loki/src/index.d.ts index dee82236..17ee6df4 100644 --- a/dist/packages/local-storage/types/loki/src/index.d.ts +++ b/dist/packages/local-storage/types/loki/src/index.d.ts @@ -1,7 +1,4 @@ import { Loki } from "./loki"; import { Collection } from "./collection"; export { Loki, Collection }; -declare const _default: { - Loki: typeof Loki; -}; -export default _default; +export default Loki; diff --git a/dist/packages/local-storage/types/loki/src/loki.d.ts b/dist/packages/local-storage/types/loki/src/loki.d.ts index 10e81b65..f2deafd2 100644 --- a/dist/packages/local-storage/types/loki/src/loki.d.ts +++ b/dist/packages/local-storage/types/loki/src/loki.d.ts @@ -1,7 +1,6 @@ import { LokiEventEmitter } from "./event_emitter"; import { Collection } from "./collection"; import { Doc, StorageAdapter } from "../../common/types"; -export declare type ANY = any; export declare class Loki extends LokiEventEmitter { private filename; private databaseVersion; @@ -23,7 +22,7 @@ export declare class Loki extends LokiEventEmitter { * Constructs the main database class. * @param {string} filename - name of the file to be saved to * @param {object} [options={}] - options - * @param {Loki.Environment} [options.env=auto] - overrides environment detection + * @param {Loki.Environment} [options.env] - the javascript environment * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method * @param {string} [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization * @param {boolean} [options.verbose=false] - enable console output @@ -64,21 +63,21 @@ export declare class Loki extends LokiEventEmitter { * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @returns {Collection} a reference to the collection which was just added */ - addCollection(name: string, options?: Collection.Options): Collection; + addCollection(name: string, options?: Collection.Options): Collection; loadCollection(collection: Collection): void; /** * Retrieves reference to a collection by name. * @param {string} collectionName - name of collection to look up * @returns {Collection} Reference to collection in database by that name, or null if not found */ - getCollection(collectionName: string): Collection; + getCollection(collectionName: string): Collection; /** * Renames an existing loki collection * @param {string} oldName - name of collection to rename * @param {string} newName - new name of collection * @returns {Collection} reference to the newly renamed collection */ - renameCollection(oldName: string, newName: string): Collection<{}>; + renameCollection(oldName: string, newName: string): Collection; listCollections(): { name: string; count: number; @@ -95,20 +94,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {string} Stringified representation of the loki database. */ serialize(options?: Loki.SerializeOptions): string | string[]; - toJSON(): { - _env: Loki.Environment; - _serializationMethod: Loki.SerializationMethod; - _autosave: boolean; - _autosaveInterval: number; - _collections: Collection[]; - databaseVersion: number; - engineVersion: number; - filename: string; - _persistenceAdapter: StorageAdapter; - _persistenceMethod: Loki.PersistenceMethod; - _throttledSaves: boolean; - _verbose: boolean; - }; + toJSON(): Loki.Serialized; /** * Database level destructured JSON serialization routine to allow alternate serialization methods. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -134,7 +120,11 @@ export declare class Loki extends LokiEventEmitter { * * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection. */ - serializeCollection(options?: ANY): string | string[]; + serializeCollection(options?: { + delimited?: boolean; + collectionIndex?: number; + delimiter?: string; + }): string | string[]; /** * Database level destructured JSON deserialization routine to minimize memory overhead. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -150,7 +140,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array */ - deserializeDestructured(destructuredSource: ANY, options?: Loki.SerializeDestructuredOptions): any; + deserializeDestructured(destructuredSource: string | string[], options?: Loki.SerializeDestructuredOptions): any; /** * Collection level utility function to deserializes a destructured collection. * @@ -161,7 +151,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {Array} an array of documents to attach to collection.data. */ - deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc; + deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc[]; /** * Inflates a loki database from a serialized JSON string * @@ -169,15 +159,16 @@ export declare class Loki extends LokiEventEmitter { * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSON(serializedDb: string | string[], options?: ANY): void; + loadJSON(serializedDb: string | string[], options?: Collection.DeserializeOptions): void; /** * Inflates a loki database from a JS object * - * @param {object} dbObject - a serialized loki database string + * @param {object} dbObject - a serialized loki database object * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSONObject(dbObject: ANY, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki.Serialized, options?: Collection.DeserializeOptions): void; /** * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer. * Does not actually destroy the db. @@ -201,7 +192,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {Array} array of changes * @see private method _createChange() in Collection */ - generateChangesNotification(arrayOfCollectionNames?: string[]): any[]; + generateChangesNotification(arrayOfCollectionNames?: string[]): Collection.Change[]; /** * (Changes API) - stringify changes for network transmission * @returns {string} string representation of the changes @@ -310,24 +301,22 @@ export declare namespace Loki { recursiveWaitLimitDuration?: number; started?: Date; } - type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; - enum SerializationMethod { - NORMAL = 0, - PRETTY = 1, - DESTRUCTURED = 2, - } - enum PersistenceMethod { - FS_STORAGE = 0, - LOCAL_STORAGE = 1, - INDEXED_STORAGE = 2, - MEMORY_STORAGE = 3, - ADAPTER = 4, - } - enum Environment { - NODE_JS = 0, - NATIVE_SCRIPT = 1, - BROWSER = 2, - CORDOVA = 3, - MEMORY = 4, + interface Serialized { + _env: Environment; + _serializationMethod: SerializationMethod; + _autosave: boolean; + _autosaveInterval: number; + _collections: Collection[]; + databaseVersion: number; + engineVersion: number; + filename: string; + _persistenceAdapter: StorageAdapter; + _persistenceMethod: PersistenceMethod; + _throttledSaves: boolean; + _verbose: boolean; } + type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; + type SerializationMethod = "normal" | "pretty" | "destructured"; + type PersistenceMethod = "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter"; + type Environment = "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "MEMORY"; } diff --git a/dist/packages/local-storage/types/loki/src/memory_adapter.d.ts b/dist/packages/local-storage/types/loki/src/memory_adapter.d.ts deleted file mode 100644 index 7b97c7f7..00000000 --- a/dist/packages/local-storage/types/loki/src/memory_adapter.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { StorageAdapter } from "../../common/types"; -export declare type ANY = any; -/** - * In in-memory persistence adapter for an in-memory database. - * This simple 'key/value' adapter is intended for unit testing and diagnostics. - */ -export declare class LokiMemoryAdapter implements StorageAdapter { - private hashStore; - private options; - /** - * @param {object} options - memory adapter options - * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) - * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) - * @param {ANY} options - */ - constructor(options?: ANY); - /** - * Loads a serialized database from its in-memory store. - * (Loki persistence adapter interface function) - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was loaded - */ - loadDatabase(dbname: string): Promise; - /** - * Saves a serialized database to its in-memory store. - * (Loki persistence adapter interface function) - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was persisted - */ - saveDatabase(dbname: string, dbstring: string): Promise; - /** - * Deletes a database from its in-memory store. - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was deleted - */ - deleteDatabase(dbname: string): Promise; -} diff --git a/dist/packages/local-storage/types/loki/src/result_set.d.ts b/dist/packages/local-storage/types/loki/src/result_set.d.ts new file mode 100644 index 00000000..b29e3a52 --- /dev/null +++ b/dist/packages/local-storage/types/loki/src/result_set.d.ts @@ -0,0 +1,302 @@ +import { Collection } from "./collection"; +import { CloneMethod } from "./clone"; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; +import { Query as FullTextSearchQuery } from "../../full-text-search/src/query_builder"; +/** + * @hidden + */ +export declare const LokiOps: { + $eq(a: any, b: any): boolean; + $aeq(a: any, b: any): boolean; + $ne(a: any, b: any): boolean; + $dteq(a: any, b: any): boolean; + $gt(a: any, b: any): boolean; + $gte(a: any, b: any): boolean; + $lt(a: any, b: any): boolean; + $lte(a: any, b: any): boolean; + $between(a: any, range: [any, any]): boolean; + $in(a: any, b: any): boolean; + $nin(a: any, b: any): boolean; + $keyin(a: string, b: object): boolean; + $nkeyin(a: string, b: object): boolean; + $definedin(a: string, b: object): boolean; + $undefinedin(a: string, b: object): boolean; + $regex(a: string, b: RegExp): boolean; + $containsString(a: any, b: string): boolean; + $containsNone(a: any, b: any): boolean; + $containsAny(a: any, b: any): boolean; + $contains(a: any, b: any): boolean; + $type(a: any, b: any): boolean; + $finite(a: number, b: boolean): boolean; + $size(a: any, b: any): boolean; + $len(a: any, b: any): boolean; + $where(a: any, b: any): boolean; + $not(a: any, b: any): boolean; + $and(a: any, b: any): boolean; + $or(a: any, b: any): boolean; +}; +/** + * ResultSet class allowing chainable queries. Intended to be instanced internally. + * Collection.find(), Collection.where(), and Collection.chain() instantiate this. + * + * @example + * mycollection.chain() + * .find({ 'doors' : 4 }) + * .where(function(obj) { return obj.name === 'Toyota' }) + * .data(); + * + * @param - the data type + * @param - nested properties of data type + */ +export declare class ResultSet { + _collection: Collection; + _filteredRows: number[]; + _filterInitialized: boolean; + private _scoring; + /** + * Constructor. + * @param {Collection} collection - the collection which this ResultSet will query against + */ + constructor(collection: Collection); + /** + * reset() - Reset the ResultSet to its initial state. + * + * @returns {ResultSet} Reference to this ResultSet, for future chain operations. + */ + reset(): this; + /** + * Override of toJSON to avoid circular references + * + */ + toJSON(): ResultSet; + /** + * Allows you to limit the number of documents passed to next chain operation. + * A ResultSet copy() is made to avoid altering original ResultSet. + * + * @param {int} qty - The number of documents to return. + * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops. + */ + limit(qty: number): this; + /** + * Used for skipping 'pos' number of documents in the ResultSet. + * + * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. + * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops. + */ + offset(pos: number): this; + /** + * copy() - To support reuse of ResultSet in branched query situations. + * + * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same. + */ + copy(): ResultSet; + /** + * Alias of copy() + */ + branch(): ResultSet; + /** + * Executes a named collection transform or raw array of transform steps against the ResultSet. + * + * @param {(string|array)} transform - name of collection transform or raw transform array + * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. + * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps) + */ + transform(transform: string | Collection.Transform[], parameters?: object): this; + /** + * User supplied compare function is provided two documents to compare. (chainable) + * @example + * rslt.sort(function(obj1, obj2) { + * if (obj1.name === obj2.name) return 0; + * if (obj1.name > obj2.name) return 1; + * if (obj1.name < obj2.name) return -1; + * }); + * + * @param {function} comparefun - A javascript compare function used for sorting. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + sort(comparefun: (a: Doc, b: Doc) => number): this; + /** + * Simpler, loose evaluation for user to sort based on a property name. (chainable). + * Sorting based on the same lt/gt helper functions used for binary indices. + * + * @param {string} propname - name of property to sort by. + * @param {boolean} [descending=false] - if true, the property will be sorted in descending order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + simplesort(propname: keyof (TData & TNested), descending?: boolean): this; + /** + * Allows sorting a ResultSet based on multiple columns. + * @example + * // to sort by age and then name (both ascending) + * rs.compoundsort(['age', 'name']); + * // to sort by age (ascending) and then by name (descending) + * rs.compoundsort(['age', ['name', true]); + * + * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + compoundsort(properties: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; + /** + * Helper function for compoundsort(), performing individual object comparisons + * + * @param {Array} properties - array of property names, in order, by which to evaluate sort order + * @param {object} obj1 - first object to compare + * @param {object} obj2 - second object to compare + * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first + */ + private _compoundeval(properties, obj1, obj2); + /** + * Sorts the ResultSet based on the last full-text-search scoring. + * @param {boolean} [ascending=false] - sort ascending + * @returns {ResultSet} + */ + sortByScoring(ascending?: boolean): this; + /** + * Returns the scoring of the last full-text-search. + * @returns {ScoreResult} + */ + getScoring(): Scorer.ScoreResult; + /** + * Oversee the operation of OR'ed query expressions. + * OR'ed expression evaluation runs each expression individually against the full collection, + * and finally does a set OR on each expression's results. + * Each evaluation can utilize a binary index to prevent multiple linear array scans. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findOr(expressionArray: ResultSet.Query & TNested>[]): this; + $or(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Oversee the operation of AND'ed query expressions. + * AND'ed expression evaluation runs each expression progressively against the full collection, + * internally utilizing existing chained ResultSet functionality. + * Only the first filter can utilize a binary index. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findAnd(expressionArray: ResultSet.Query & TNested>[]): this; + $and(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Used for querying via a mongo-style query object. + * + * @param {object} query - A mongo-style query object used for filtering current results. + * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() + * @returns {ResultSet} this ResultSet for further chain ops. + */ + find(query?: ResultSet.Query & TNested>, firstOnly?: boolean): this; + /** + * Used for filtering via a javascript filter function. + * + * @param {function} fun - A javascript function used for filtering current results by. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + where(fun: (obj: Doc) => boolean): this; + /** + * Returns the number of documents in the ResultSet. + * @returns {number} The number of documents in the ResultSet. + */ + count(): number; + /** + * Terminates the chain and returns array of filtered documents + * @param {object} options + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when + * the collection is not configured for clone object. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values 'parse-stringify', 'deep', and 'shallow' and + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents + * + * @returns {Array} Array of documents in the ResultSet + */ + data(options?: ResultSet.DataOptions): Doc[]; + /** + * Used to run an update operation on all documents currently in the ResultSet. + * + * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + update(updateFunction: (obj: Doc) => TData): this; + /** + * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet) + * + * @returns {ResultSet} this (empty) ResultSet for further chain ops. + */ + remove(): this; + /** + * data transformation via user supplied functions + * + * @param {function} mapFunction - this function accepts a single document for you to transform and return + * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value + * @returns {value} The output of your reduceFunction + */ + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; + /** + * Left joining two sets of data. Join keys can be defined or calculated properties + * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key + * @param {Array|ResultSet|Collection} joinData - Data array to join to. + * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on + * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on + * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} + * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method + * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}] + */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinKey: string | ((obj: any) => string), rightJoinKey: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; + /** + * Applies a map function into a new collection for further chaining. + * @param {function} mapFun - javascript map function + * @param {object} [dataOptions=] - options to data() before input to your map function + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method + * @return {ResultSet} + */ + map(mapFun: (obj: TData, index: number, array: TData[]) => U, dataOptions?: ResultSet.DataOptions): ResultSet; +} +export declare namespace ResultSet { + interface DataOptions { + forceClones?: boolean; + forceCloneMethod?: CloneMethod; + removeMeta?: boolean; + } + type LokiOps = { + $eq?: R; + $aeq?: R; + $ne?: R; + $dteq?: R; + $gt?: R; + $gte?: R; + $lt?: R; + $lte?: R; + $between?: [R, R]; + $in?: R[]; + $nin?: R[]; + $keyin?: object; + $nkeyin?: object; + $definedin?: object; + $undefinedin?: object; + $regex?: RegExp | string | [string, string]; + $containsString?: string; + $containsNone?: R[] | R; + $containsAny?: R[] | R; + $contains?: any; + $type?: string; + $finite?: boolean; + $size?: number; + $len?: number; + $where?: (val?: R) => boolean; + }; + type Query = { + [P in keyof TData]?: LokiOps | TData[P]; + } & { + $and?: Query[]; + } & { + $or?: Query[]; + } & { + $fts?: FullTextSearchQuery; + }; +} diff --git a/dist/packages/local-storage/types/loki/src/resultset.d.ts b/dist/packages/local-storage/types/loki/src/resultset.d.ts deleted file mode 100644 index 8ee6b343..00000000 --- a/dist/packages/local-storage/types/loki/src/resultset.d.ts +++ /dev/null @@ -1,262 +0,0 @@ -import { Collection } from "./collection"; -import { CloneMethod } from "./clone"; -import { Doc, Query } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; -/** - * @hidden - */ -export declare const LokiOps: { - $eq(a: any, b: any): boolean; - $aeq(a: any, b: any): boolean; - $ne(a: any, b: any): boolean; - $dteq(a: any, b: any): boolean; - $gt(a: any, b: any): boolean; - $gte(a: any, b: any): boolean; - $lt(a: any, b: any): boolean; - $lte(a: any, b: any): boolean; - $between(a: any, vals: any): boolean; - $in(a: any, b: any): boolean; - $nin(a: any, b: any): boolean; - $keyin(a: any, b: any): boolean; - $nkeyin(a: any, b: any): boolean; - $definedin(a: any, b: any): boolean; - $undefinedin(a: any, b: any): boolean; - $regex(a: any, b: any): any; - $containsString(a: any, b: any): boolean; - $containsNone(a: any, b: any): boolean; - $containsAny(a: any, b: any): any; - $contains(a: any, b: any): any; - $type(a: any, b: any): any; - $finite(a: any, b: any): boolean; - $size(a: any, b: any): any; - $len(a: any, b: any): any; - $where(a: any, b: any): boolean; - $not(a: any, b: any): boolean; - $and(a: any, b: any): boolean; - $or(a: any, b: any): boolean; -}; -/** - * Resultset class allowing chainable queries. Intended to be instanced internally. - * Collection.find(), Collection.where(), and Collection.chain() instantiate this. - * - * @example - * mycollection.chain() - * .find({ 'doors' : 4 }) - * .where(function(obj) { return obj.name === 'Toyota' }) - * .data(); - */ -export declare class Resultset { - collection: Collection; - filteredrows: number[]; - filterInitialized: boolean; - private _scoring; - /** - * Constructor. - * @param {Collection} collection - the collection which this Resultset will query against - */ - constructor(collection: Collection); - /** - * reset() - Reset the resultset to its initial state. - * - * @returns {Resultset} Reference to this resultset, for future chain operations. - */ - reset(): Resultset; - /** - * toJSON() - Override of toJSON to avoid circular references - * - */ - toJSON(): Resultset; - /** - * Allows you to limit the number of documents passed to next chain operation. - * A resultset copy() is made to avoid altering original resultset. - * - * @param {int} qty - The number of documents to return. - * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops. - */ - limit(qty: number): Resultset; - /** - * Used for skipping 'pos' number of documents in the resultset. - * - * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. - * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. - */ - offset(pos: number): Resultset; - /** - * copy() - To support reuse of resultset in branched query situations. - * - * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same. - */ - copy(): Resultset; - /** - * Alias of copy() - */ - branch(): Resultset; - /** - * Executes a named collection transform or raw array of transform steps against the resultset. - * - * @param {(string|array)} transform - name of collection transform or raw transform array - * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. - * @returns {Resultset} either (this) resultset or a clone of of this resultset (depending on steps) - */ - transform(transform: string | any[], parameters?: object): Resultset; - /** - * User supplied compare function is provided two documents to compare. (chainable) - * @example - * rslt.sort(function(obj1, obj2) { - * if (obj1.name === obj2.name) return 0; - * if (obj1.name > obj2.name) return 1; - * if (obj1.name < obj2.name) return -1; - * }); - * - * @param {function} comparefun - A javascript compare function used for sorting. - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - sort(comparefun: (a: E, b: E) => number): Resultset; - /** - * Simpler, loose evaluation for user to sort based on a property name. (chainable). - * Sorting based on the same lt/gt helper functions used for binary indices. - * - * @param {string} propname - name of property to sort by. - * @param {boolean} isdesc - (Optional) If true, the property will be sorted in descending order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - simplesort(propname: string, isdesc?: boolean): Resultset; - /** - * Allows sorting a resultset based on multiple columns. - * @example - * // to sort by age and then name (both ascending) - * rs.compoundsort(['age', 'name']); - * // to sort by age (ascending) and then by name (descending) - * rs.compoundsort(['age', ['name', true]); - * - * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - compoundsort(properties: (string | [string, boolean])[]): Resultset; - /** - * Helper function for compoundsort(), performing individual object comparisons - * - * @param {Array} properties - array of property names, in order, by which to evaluate sort order - * @param {object} obj1 - first object to compare - * @param {object} obj2 - second object to compare - * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first - */ - private _compoundeval(properties, obj1, obj2); - /** - * Sorts the resultset based on the last full-text-search scoring. - * @param {boolean} [ascending=false] - sort ascending - * @returns {Resultset} - */ - sortByScoring(ascending?: boolean): Resultset; - /** - * Returns the scoring of the last full-text-search. - * @returns {ScoreResult} - */ - getScoring(): ScoreResult; - /** - * findOr() - oversee the operation of OR'ed query expressions. - * OR'ed expression evaluation runs each expression individually against the full collection, - * and finally does a set OR on each expression's results. - * Each evaluation can utilize a binary index to prevent multiple linear array scans. - * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. - */ - findOr(expressionArray: Query[]): Resultset; - $or(expressionArray: Query[]): Resultset; - /** - * findAnd() - oversee the operation of AND'ed query expressions. - * AND'ed expression evaluation runs each expression progressively against the full collection, - * internally utilizing existing chained resultset functionality. - * Only the first filter can utilize a binary index. - * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. - */ - findAnd(expressionArray: Query[]): Resultset; - $and(expressionArray: Query[]): Resultset; - /** - * Used for querying via a mongo-style query object. - * - * @param {object} query - A mongo-style query object used for filtering current results. - * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() - * @returns {Resultset} this resultset for further chain ops. - */ - find(query?: Query, firstOnly?: boolean): Resultset; - /** - * Used for filtering via a javascript filter function. - * - * @param {function} fun - A javascript function used for filtering current results by. - * @returns {Resultset} this resultset for further chain ops. - */ - where(fun: (obj: E) => boolean): Resultset; - /** - * Returns the number of documents in the resultset. - * @returns {number} The number of documents in the resultset. - */ - count(): number; - /** - * Terminates the chain and returns array of filtered documents - * @param {object} options - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when - * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents - * - * @returns {Array} Array of documents in the resultset - */ - data(options?: Resultset.DataOptions): Doc[]; - /** - * Used to run an update operation on all documents currently in the resultset. - * - * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. - * @returns {Resultset} this resultset for further chain ops. - */ - update(updateFunction: (obj: E) => E): Resultset; - /** - * Removes all document objects which are currently in resultset from collection (as well as resultset) - * - * @returns {Resultset} this (empty) resultset for further chain ops. - */ - remove(): Resultset; - /** - * data transformation via user supplied functions - * - * @param {function} mapFunction - this function accepts a single document for you to transform and return - * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value - * @returns {value} The output of your reduceFunction - */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; - /** - * Left joining two sets of data. Join keys can be defined or calculated properties - * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key - * @param {Array|Resultset|Collection} joinData - Data array to join to. - * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on - * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on - * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} - * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides - * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun - * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}] - */ - eqJoin(joinData: ANY, leftJoinKey: string | Function, rightJoinKey: string | Function, mapFun?: Function, dataOptions?: ANY): ANY; - /** - * Applies a map function into a new collection for further chaining. - * @param {function} mapFun - javascript map function - * @param {object} [dataOptions=] - options to data() before input to your map function - * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun - * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - */ - map(mapFun: (obj: E, index: number, array: E[]) => U, dataOptions?: Resultset.DataOptions): Resultset; -} -export declare namespace Resultset { - interface DataOptions { - forceClones?: boolean; - forceCloneMethod?: CloneMethod; - removeMeta?: boolean; - } -} diff --git a/dist/packages/local-storage/types/loki/src/unique_index.d.ts b/dist/packages/local-storage/types/loki/src/unique_index.d.ts index 40312618..55284c11 100644 --- a/dist/packages/local-storage/types/loki/src/unique_index.d.ts +++ b/dist/packages/local-storage/types/loki/src/unique_index.d.ts @@ -1,30 +1,30 @@ import { Doc } from "../../common/types"; -export declare class UniqueIndex { +export declare class UniqueIndex { private _field; private _keyMap; /** * Constructs an unique index object. * @param {number|string} propertyField - the property field to index */ - constructor(propertyField: number | string); + constructor(propertyField: keyof E); /** * Sets a document's unique index. * @param {Doc} doc - the document * @param {number} row - the data row of the document */ - set(doc: Doc, row: number): void; + set(doc: Doc, row: number): void; /** * Returns the data row of an unique index. * @param {number|string} index - the index * @returns {number | string} - the row */ - get(index: number | string): number; + get(index: keyof E): number; /** * Updates a document's unique index. * @param {Object} doc - the document * @param {number} row - the data row of the document */ - update(doc: Doc, row: number): void; + update(doc: Doc, row: number): void; /** * Removes an unique index. * @param {number|string} index - the unique index diff --git a/dist/packages/local-storage/types/memory-storage/src/index.d.ts b/dist/packages/local-storage/types/memory-storage/src/index.d.ts new file mode 100644 index 00000000..5330aa7d --- /dev/null +++ b/dist/packages/local-storage/types/memory-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { MemoryStorage } from "./memory_storage"; +export { MemoryStorage }; +export default MemoryStorage; diff --git a/dist/packages/local-storage/types/memory-storage/src/memory_storage.d.ts b/dist/packages/local-storage/types/memory-storage/src/memory_storage.d.ts new file mode 100644 index 00000000..0066a1de --- /dev/null +++ b/dist/packages/local-storage/types/memory-storage/src/memory_storage.d.ts @@ -0,0 +1,57 @@ +import { Dict, StorageAdapter } from "../../common/types"; +/** + * An in-memory persistence adapter for an in-memory database. + * This simple 'key/value' adapter is intended for unit testing and diagnostics. + */ +export declare class MemoryStorage implements StorageAdapter { + hashStore: Dict<{ + savecount: number; + lastsave: Date; + value: string; + }>; + options: MemoryStorage.Options; + /** + * Registers the local storage as plugin. + */ + static register(): void; + /** + * Deregisters the local storage as plugin. + */ + static deregister(): void; + /** + * @param {object} options - memory storage options + * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) + * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) + */ + constructor(options?: MemoryStorage.Options); + /** + * Loads a serialized database from its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was loaded + */ + loadDatabase(dbname: string): Promise; + /** + * Saves a serialized database to its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @param {string} dbstring - the database content + * @returns {Promise} a Promise that resolves after the database was persisted + */ + saveDatabase(dbname: string, dbstring: string): Promise; + /** + * Deletes a database from its in-memory store. + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was deleted + */ + deleteDatabase(dbname: string): Promise; +} +export declare namespace MemoryStorage { + interface Options { + asyncResponses?: boolean; + asyncTimeout?: number; + } +} diff --git a/dist/packages/local-storage/types/partitioning-adapter/src/index.d.ts b/dist/packages/local-storage/types/partitioning-adapter/src/index.d.ts new file mode 100644 index 00000000..bf49882f --- /dev/null +++ b/dist/packages/local-storage/types/partitioning-adapter/src/index.d.ts @@ -0,0 +1,3 @@ +import { PartitioningAdapter } from "./partitioning_adapter"; +export { PartitioningAdapter }; +export default PartitioningAdapter; diff --git a/dist/packages/local-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts b/dist/packages/local-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts index ff9568cf..45e14850 100644 --- a/dist/packages/local-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts +++ b/dist/packages/local-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts @@ -1,4 +1,5 @@ -import { ANY, StorageAdapter } from "../../common/types"; +import { Loki } from "../../loki/src/loki"; +import { StorageAdapter } from "../../common/types"; /** * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and @@ -9,7 +10,7 @@ import { ANY, StorageAdapter } from "../../common/types"; * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all * of that collection's pages will be written on next save. */ -export declare class LokiPartitioningAdapter implements StorageAdapter { +export declare class PartitioningAdapter implements StorageAdapter { mode: string; private _adapter; private _dbref; @@ -68,7 +69,7 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { * @returns {Promise} a Promise that resolves after the database was deleted * */ - exportDatabase(dbname: string, dbref: ANY): Promise; + exportDatabase(dbname: string, dbref: Loki): Promise; /** * Helper method used internally to save each dirty collection, one at a time. * @@ -82,11 +83,3 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { */ private _saveNextPage(); } -declare namespace LokiPartitioningAdapter { - interface PageIterator { - collection?: ANY; - docIndex?: number; - pageIndex?: number; - } -} -export default LokiPartitioningAdapter; diff --git a/dist/packages/loki/lokijs.loki.js b/dist/packages/loki/lokijs.loki.js index dc7be120..500c903d 100644 --- a/dist/packages/loki/lokijs.loki.js +++ b/dist/packages/loki/lokijs.loki.js @@ -170,13 +170,11 @@ class LokiEventEmitter { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__event_emitter__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unique_index__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__resultset__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__result_set__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__dynamic_view__ = __webpack_require__(10); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__helper__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__clone__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__clone__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__common_plugin__ = __webpack_require__(6); -/* unused harmony reexport CloneMethod */ - @@ -217,6 +215,8 @@ function deepProperty(obj, property, isDeep) { /** * Collection class that handles documents of same type * @extends LokiEventEmitter + * @param - the data type + * @param - nested properties of data type */ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEventEmitter */] { /** @@ -231,7 +231,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable - * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method + * @param {string} [options.cloneMethod="deep"] - the clone method * @param {number} [options.transactional=false] - ? * @param {number} options.ttl - ? * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. @@ -239,21 +239,14 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok */ constructor(name, options = {}) { super(); - /** - * Unique contraints contain duplicate object references, so they are not persisted. - * We will keep track of properties which have unique contraint applied here, and regenerate on load. - */ - this.constraints = { - unique: {} - }; // the name of the collection this.name = name; // the data held by the collection - this.data = []; + this._data = []; this.idIndex = []; // index of id this.binaryIndices = {}; // user defined indexes this.constraints = { - unique: {}, + unique: {} }; // . this.transforms = {}; @@ -294,7 +287,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok // . this.disableDeltaChangesApi = options.disableDeltaChangesApi !== undefined ? options.disableDeltaChangesApi : true; // . - this.cloneMethod = options.cloneMethod !== undefined ? options.cloneMethod : __WEBPACK_IMPORTED_MODULE_5__clone__["a" /* CloneMethod */].DEEP; + this.cloneMethod = options.cloneMethod !== undefined ? options.cloneMethod : "deep"; if (this.disableChangesApi) { this.disableDeltaChangesApi = true; } @@ -325,7 +318,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok // . this.changes = []; // initialize the id index - this.ensureId(); + this._ensureId(); let indices = options.indices ? options.indices : []; for (let idx = 0; idx < indices.length; idx++) { this.ensureIndex(options.indices[idx]); @@ -354,7 +347,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok warn() { }, error() { - }, + } }; /* ------ STAGING API -------- */ /** @@ -371,7 +364,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok uniqueNames: Object.keys(this.constraints.unique), transforms: this.transforms, binaryIndices: this.binaryIndices, - data: this.data, + _data: this._data, idIndex: this.idIndex, maxId: this.maxId, dirty: this.dirty, @@ -379,6 +372,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok transactional: this.transactional, asyncListeners: this.asyncListeners, disableChangesApi: this.disableChangesApi, + disableDeltaChangesApi: this.disableDeltaChangesApi, cloneObjects: this.cloneObjects, cloneMethod: this.cloneMethod, changes: this.changes, @@ -395,13 +389,13 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok coll.asyncListeners = obj.asyncListeners; coll.disableChangesApi = obj.disableChangesApi; coll.cloneObjects = obj.cloneObjects; - coll.cloneMethod = obj.cloneMethod || __WEBPACK_IMPORTED_MODULE_5__clone__["a" /* CloneMethod */].DEEP; + coll.cloneMethod = obj.cloneMethod || "deep"; coll.changes = obj.changes; coll.dirty = (options && options.retainDirtyFlags === true) ? obj.dirty : false; function makeLoader(coll) { const collOptions = options[coll.name]; if (collOptions.proto) { - let inflater = collOptions.inflate || ((src, dest) => { + const inflater = collOptions.inflate || ((src, dest) => { for (let prop in src) { dest[prop] = src[prop]; } @@ -415,17 +409,15 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok return collOptions.inflate; } // load each element individually - let clen = obj.data.length; - let j = 0; if (options && options[obj.name] !== undefined) { let loader = makeLoader(obj); - for (j; j < clen; j++) { - coll.data[j] = loader(obj.data[j]); + for (let j = 0; j < obj._data.length; j++) { + coll._data[j] = loader(obj._data[j]); } } else { - for (j; j < clen; j++) { - coll.data[j] = obj.data[j]; + for (let j = 0; j < obj._data.length; j++) { + coll._data[j] = obj._data[j]; } } coll.maxId = (obj.maxId === undefined) ? 0 : obj.maxId; @@ -436,16 +428,16 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok if (obj.transforms !== undefined) { coll.transforms = obj.transforms; } - coll.ensureId(); + coll._ensureId(); // regenerate unique indexes if (obj.uniqueNames !== undefined) { - for (j = 0; j < obj.uniqueNames.length; j++) { + for (let j = 0; j < obj.uniqueNames.length; j++) { coll.ensureUniqueIndex(obj.uniqueNames[j]); } } // in case they are loading a database created before we added dynamic views, handle undefined if (obj._dynamicViews !== undefined) { - // reinflate DynamicViews and attached Resultsets + // reinflate DynamicViews and attached ResultSets for (let idx = 0; idx < obj._dynamicViews.length; idx++) { coll._dynamicViews.push(__WEBPACK_IMPORTED_MODULE_3__dynamic_view__["a" /* DynamicView */].fromJSONObject(coll, obj._dynamicViews[idx])); } @@ -489,21 +481,8 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok delete this.transforms[name]; } /*----------------------------+ - | TTL daemon | + | TTL | +----------------------------*/ - ttlDaemonFuncGen() { - const collection = this; - const age = this.ttl.age; - return function ttlDaemon() { - const now = Date.now(); - const toRemove = collection.chain().where((member) => { - const timestamp = member.meta.updated || member.meta.created; - const diff = now - timestamp; - return age < diff; - }); - toRemove.remove(); - }; - } setTTL(age, interval) { if (age < 0) { clearInterval(this.ttl.daemon); @@ -511,19 +490,26 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok else { this.ttl.age = age; this.ttl.ttlInterval = interval; - this.ttl.daemon = setInterval(this.ttlDaemonFuncGen(), interval); + this.ttl.daemon = setInterval(() => { + const now = Date.now(); + const toRemove = this.chain().where((member) => { + const timestamp = member.meta.updated || member.meta.created; + const diff = now - timestamp; + return this.ttl.age < diff; + }); + toRemove.remove(); + }, interval); } } /*----------------------------+ - | INDEXING | + | INDEXING | +----------------------------*/ /** * create a row filter that covers all documents in the collection */ - prepareFullDocIndex() { - const len = this.data.length; - const indexes = new Array(len); - for (let i = 0; i < len; i += 1) { + _prepareFullDocIndex() { + const indexes = new Array(this._data.length); + for (let i = 0; i < indexes.length; i++) { indexes[i] = i; } return indexes; @@ -531,7 +517,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok /** * Ensure binary index on a certain field * @param {string} property - name of property to create binary index on - * @param {boolean} force - (Optional) flag indicating whether to construct index immediately + * @param {boolean} [force=false] - flag indicating whether to construct index immediately */ ensureIndex(property, force = false) { // optional parameter to force rebuild whether flagged as dirty or not @@ -549,13 +535,14 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok const index = { "name": property, "dirty": true, - "values": this.prepareFullDocIndex() + "values": this._prepareFullDocIndex() }; this.binaryIndices[property] = index; - const wrappedComparer = (((prop, data) => (a, b) => { - let val1, val2, arr; - if (~prop.indexOf(".")) { - arr = prop.split("."); + const data = this._data; + const wrappedComparer = (a, b) => { + let val1, val2; + if (~property.indexOf(".")) { + const arr = property.split("."); val1 = arr.reduce(function (obj, i) { return obj && obj[i] || undefined; }, data[a]); @@ -564,8 +551,8 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok }, data[b]); } else { - val1 = data[a][prop]; - val2 = data[b][prop]; + val1 = data[a][property]; + val2 = data[b][property]; } if (val1 !== val2) { if (Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c" /* ltHelper */])(val1, val2, false)) @@ -574,7 +561,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok return 1; } return 0; - }))(property, this.data); + }; index.values.sort(wrappedComparer); index.dirty = false; this.dirty = true; // for autosave scenarios @@ -584,7 +571,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok const idxvals = this.binaryIndices[property].values; let result = ""; for (idx = 0; idx < idxvals.length; idx++) { - result += " [" + idx + "] " + this.data[idxvals[idx]][property]; + result += " [" + idx + "] " + this._data[idxvals[idx]][property]; } return result; } @@ -592,8 +579,8 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok let index = new __WEBPACK_IMPORTED_MODULE_1__unique_index__["a" /* UniqueIndex */](field); // if index already existed, (re)loading it will likely cause collisions, rebuild always this.constraints.unique[field] = index; - for (let i = 0; i < this.data.length; i++) { - index.set(this.data[i], i); + for (let i = 0; i < this._data.length; i++) { + index.set(this._data[i], i); } return index; } @@ -601,9 +588,8 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok * Ensure all binary indices */ ensureAllIndexes(force = false) { - let key; const bIndices = this.binaryIndices; - for (key in bIndices) { + for (const key in bIndices) { if (bIndices[key] !== undefined) { this.ensureIndex(key, force); } @@ -629,19 +615,17 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok */ count(query) { if (!query) { - return this.data.length; + return this._data.length; } - return this.chain().find(query).filteredrows.length; + return this.chain().find(query)._filteredRows.length; } /** * Rebuild idIndex */ - ensureId() { - const len = this.data.length; - let i = 0; + _ensureId() { this.idIndex = []; - for (i; i < len; i += 1) { - this.idIndex.push(this.data[i].$loki); + for (let i = 0; i < this._data.length; i++) { + this.idIndex.push(this._data[i].$loki); } } /** @@ -724,7 +708,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok // at the 'batch' level, if clone option is true then emitted docs are clones this.emit("insert", results); // if clone option is set, clone return values - results = this.cloneObjects ? Object(__WEBPACK_IMPORTED_MODULE_5__clone__["b" /* clone */])(results, this.cloneMethod) : results; + results = this.cloneObjects ? Object(__WEBPACK_IMPORTED_MODULE_5__clone__["a" /* clone */])(results, this.cloneMethod) : results; return results.length === 1 ? results[0] : results; } /** @@ -747,7 +731,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok throw err; } // if configured to clone, do so now... otherwise just use same obj reference - const obj = this.cloneObjects ? Object(__WEBPACK_IMPORTED_MODULE_5__clone__["b" /* clone */])(doc, this.cloneMethod) : doc; + const obj = this.cloneObjects ? Object(__WEBPACK_IMPORTED_MODULE_5__clone__["a" /* clone */])(doc, this.cloneMethod) : doc; if (obj.meta === undefined) { obj.meta = { revision: 0, @@ -765,17 +749,16 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok returnObj = obj; if (!bulkInsert) { this.emit("insert", obj); - returnObj = this.cloneObjects ? Object(__WEBPACK_IMPORTED_MODULE_5__clone__["b" /* clone */])(obj, this.cloneMethod) : obj; + returnObj = this.cloneObjects ? Object(__WEBPACK_IMPORTED_MODULE_5__clone__["a" /* clone */])(obj, this.cloneMethod) : obj; } return returnObj; } /** * Empties the collection. - * @param {object} options - configure clear behavior - * @param {boolean} options.removeIndices - (default: false) + * @param {boolean} [removeIndices=false] - remove indices */ - clear(options = {}) { - this.data = []; + clear({ removeIndices: removeIndices = false } = {}) { + this._data = []; this.idIndex = []; this.cachedIndex = null; this.cachedBinaryIndex = null; @@ -784,10 +767,10 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok this._dynamicViews = []; this.dirty = true; // if removing indices entirely - if (options.removeIndices === true) { + if (removeIndices === true) { this.binaryIndices = {}; this.constraints = { - unique: {}, + unique: {} }; } else { @@ -815,7 +798,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok if (Array.isArray(doc)) { let k = 0; const len = doc.length; - for (k; k < len; k += 1) { + for (k; k < len; k++) { this.update(doc[k]); } return; @@ -835,23 +818,22 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok let position = arr[1]; // position in data array // ref to new internal obj // if configured to clone, do so now... otherwise just use same obj reference - let newInternal = this.cloneObjects || !this.disableDeltaChangesApi ? Object(__WEBPACK_IMPORTED_MODULE_5__clone__["b" /* clone */])(doc, this.cloneMethod) : doc; + let newInternal = this.cloneObjects || !this.disableDeltaChangesApi ? Object(__WEBPACK_IMPORTED_MODULE_5__clone__["a" /* clone */])(doc, this.cloneMethod) : doc; this.emit("pre-update", doc); Object.keys(this.constraints.unique).forEach((key) => { this.constraints.unique[key].update(newInternal, position); }); // operate the update - this.data[position] = newInternal; + this._data[position] = newInternal; // now that we can efficiently determine the data[] position of newly added document, // submit it for all registered DynamicViews to evaluate for inclusion/exclusion for (let idx = 0; idx < this._dynamicViews.length; idx++) { this._dynamicViews[idx]._evaluateDocument(position, false); } - let key; if (this.adaptiveBinaryIndices) { // for each binary index defined in collection, immediately update rather than flag for lazy rebuild const bIndices = this.binaryIndices; - for (key in bIndices) { + for (const key in bIndices) { this.adaptiveBinaryIndexUpdate(position, key); } } @@ -865,8 +847,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok } this.commit(); this.dirty = true; // for autosave scenarios - this.emit("update", doc, this.cloneObjects || !this.disableDeltaChangesApi ? Object(__WEBPACK_IMPORTED_MODULE_5__clone__["b" /* clone */])(oldInternal, this.cloneMethod) : null); - return doc; + this.emit("update", doc, this.cloneObjects || !this.disableDeltaChangesApi ? Object(__WEBPACK_IMPORTED_MODULE_5__clone__["a" /* clone */])(oldInternal, this.cloneMethod) : null); } catch (err) { this.rollback(); @@ -896,23 +877,22 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok this.startTransaction(); this.maxId++; if (isNaN(this.maxId)) { - this.maxId = (this.data[this.data.length - 1].$loki + 1); + this.maxId = (this._data[this._data.length - 1].$loki + 1); } const newDoc = obj; newDoc.$loki = this.maxId; newDoc.meta.version = 0; - let key; const constrUnique = this.constraints.unique; - for (key in constrUnique) { + for (const key in constrUnique) { if (constrUnique[key] !== undefined) { - constrUnique[key].set(newDoc, this.data.length); + constrUnique[key].set(newDoc, this._data.length); } } // add new obj id to idIndex this.idIndex.push(newDoc.$loki); // add the object - this.data.push(newDoc); - const addedPos = this.data.length - 1; + this._data.push(newDoc); + const addedPos = this._data.length - 1; // now that we can efficiently determine the data[] position of newly added document, // submit it for all registered DynamicViews to evaluate for inclusion/exclusion const dvlen = this._dynamicViews.length; @@ -921,8 +901,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok } if (this.adaptiveBinaryIndices) { // for each binary index defined in collection, immediately update rather than flag for lazy rebuild - const bIndices = this.binaryIndices; - for (key in bIndices) { + for (const key in this.binaryIndices) { this.adaptiveBinaryIndexInsert(addedPos, key); } } @@ -935,7 +914,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok } this.commit(); this.dirty = true; // for autosave scenarios - return (this.cloneObjects) ? (Object(__WEBPACK_IMPORTED_MODULE_5__clone__["b" /* clone */])(newDoc, this.cloneMethod)) : (newDoc); + return (this.cloneObjects) ? (Object(__WEBPACK_IMPORTED_MODULE_5__clone__["a" /* clone */])(newDoc, this.cloneMethod)) : (newDoc); } catch (err) { this.rollback(); @@ -952,12 +931,9 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok */ updateWhere(filterFunction, updateFunction) { const results = this.where(filterFunction); - let i = 0; - let obj; try { - for (i; i < results.length; i++) { - obj = updateFunction(results[i]); - this.update(obj); + for (let i = 0; i < results.length; i++) { + this.update(updateFunction(results[i])); } } catch (err) { @@ -971,33 +947,28 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok * @param {function|object} query - query object to filter on */ removeWhere(query) { - let list; if (typeof query === "function") { - list = this.data.filter(query); - this.remove(list); + this.remove(this._data.filter(query)); } else { this.chain().find(query).remove(); } } removeDataOnly() { - this.remove(this.data.slice()); + this.remove(this._data.slice()); } /** * Remove a document from the collection - * @param {object} doc - document to remove from collection + * @param {number|object} doc - document to remove from collection */ remove(doc) { if (typeof doc === "number") { doc = this.get(doc); } - if ("object" !== typeof doc) { - throw new Error("Parameter is not an object"); - } if (Array.isArray(doc)) { let k = 0; const len = doc.length; - for (k; k < len; k += 1) { + for (k; k < len; k++) { this.remove(doc[k]); } return; @@ -1021,16 +992,14 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok } if (this.adaptiveBinaryIndices) { // for each binary index defined in collection, immediately update rather than flag for lazy rebuild - let key; - const bIndices = this.binaryIndices; - for (key in bIndices) { + for (const key in this.binaryIndices) { this.adaptiveBinaryIndexRemove(position, key); } } else { this.flagBinaryIndexesDirty(); } - this.data.splice(position, 1); + this._data.splice(position, 1); // remove id from idIndex this.idIndex.splice(position, 1); // FullTextSearch. @@ -1042,7 +1011,6 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok this.emit("delete", arr[0]); delete doc.$loki; delete doc.meta; - return doc; } catch (err) { this.rollback(); @@ -1056,7 +1024,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok +------------*/ /** * Returns all changes. - * @returns {ANY} + * @returns {Collection.Change[]} */ getChanges() { return this.changes; @@ -1196,9 +1164,9 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok } if (max === min && data[min] === id) { if (returnPosition) { - return [this.data[min], min]; + return [this._data[min], min]; } - return this.data[min]; + return this._data[min]; } return null; } @@ -1206,15 +1174,15 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value * Since multiple documents may contain the same value (which the index is sorted on), * we hone in on range and then linear scan range to find exact index array position. - * @param {int} dataPosition : coll.data array index/position + * @param {int} dataPosition : data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ getBinaryIndexPosition(dataPosition, binaryIndexName) { - const val = this.data[dataPosition][binaryIndexName]; + const val = this._data[dataPosition][binaryIndexName]; const index = this.binaryIndices[binaryIndexName].values; // i think calculateRange can probably be moved to collection - // as it doesn't seem to need resultset. need to verify - //let rs = new Resultset(this, null, null); + // as it doesn't seem to need ResultSet. need to verify + //let rs = new ResultSet(this, null, null); const range = this.calculateRange("$eq", binaryIndexName, val); if (range[0] === 0 && range[1] === -1) { // uhoh didn't find range @@ -1239,11 +1207,11 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok */ adaptiveBinaryIndexInsert(dataPosition, binaryIndexName) { const index = this.binaryIndices[binaryIndexName].values; - let val = this.data[dataPosition][binaryIndexName]; + let val = this._data[dataPosition][binaryIndexName]; // If you are inserting a javascript Date value into a binary index, convert to epoch time if (this.serializableIndices === true && val instanceof Date) { - this.data[dataPosition][binaryIndexName] = val.getTime(); - val = this.data[dataPosition][binaryIndexName]; + this._data[dataPosition][binaryIndexName] = val.getTime(); + val = this._data[dataPosition][binaryIndexName]; } const idxPos = (index.length === 0) ? 0 : this._calculateRangeStart(binaryIndexName, val, true); // insert new data index into our binary index at the proper sorted location for relevant property calculated by idxPos. @@ -1272,17 +1240,14 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok } /** * Adaptively remove a selected item from the index. - * @param {int} dataPosition : coll.data array index/position + * @param {number} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in + * @param {boolean} removedFromIndexOnly - remove from index only */ adaptiveBinaryIndexRemove(dataPosition, binaryIndexName, removedFromIndexOnly = false) { const idxPos = this.getBinaryIndexPosition(dataPosition, binaryIndexName); - const index = this.binaryIndices[binaryIndexName].values; - let len; - let idx; if (idxPos === null) { - // throw new Error('unable to determine binary index position'); - return null; + return; } // remove document from index this.binaryIndices[binaryIndexName].values.splice(idxPos, 1); @@ -1293,8 +1258,8 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok } // since index stores data array positions, if we remove a document // we need to adjust array positions -1 for all document positions greater than removed position - len = index.length; - for (idx = 0; idx < len; idx++) { + const index = this.binaryIndices[binaryIndexName].values; + for (let idx = 0; idx < index.length; idx++) { if (index[idx] > dataPosition) { index[idx]--; } @@ -1315,7 +1280,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok * @param {bool?} adaptive - if true, we will return insert position */ _calculateRangeStart(prop, val, adaptive = false) { - const rcd = this.data; + const rcd = this._data; const index = this.binaryIndices[prop].values; let min = 0; let max = index.length - 1; @@ -1350,7 +1315,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok * (which may or may not yet exist) this will find the final position of that upper range value. */ _calculateRangeEnd(prop, val) { - const rcd = this.data; + const rcd = this._data; const index = this.binaryIndices[prop].values; let min = 0; let max = index.length - 1; @@ -1386,7 +1351,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok } /** * Binary Search utility method to find range/segment of values matching criteria. - * this is used for collection.find() and first find filter of resultset/dynview + * this is used for collection.find() and first find filter of ResultSet/dynview * slightly different than get() binary search in that get() hones in on 1 value, * but we have to hone in on many (range) * @param {string} op - operation, such as $eq @@ -1395,7 +1360,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok * @returns {array} [start, end] index array positions */ calculateRange(op, prop, val) { - const rcd = this.data; + const rcd = this._data; const index = this.binaryIndices[prop].values; const min = 0; const max = index.length - 1; @@ -1513,20 +1478,10 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok case "$eq": case "$aeq": case "$dteq": - // if hole (not found) - //if (ltHelper(lval, val, false) || gtHelper(lval, val, false)) { - // return [0, -1]; - //} if (!Object(__WEBPACK_IMPORTED_MODULE_4__helper__["a" /* aeqHelper */])(lval, val)) { return [0, -1]; } return [lbound, ubound]; - //case '$dteq': - // if hole (not found) - // if (lval > val || lval < val) { - // return [0, -1]; - // } - // return [lbound, ubound]; case "$gt": // (an eqHelper would probably be better test) // if hole (not found) ub position is already greater @@ -1580,7 +1535,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok */ findOne(query) { query = query || {}; - // Instantiate Resultset and exec find op passing firstOnly = true param + // Instantiate ResultSet and exec find op passing firstOnly = true param const result = this.chain().find(query, true).data(); if (Array.isArray(result) && result.length === 0) { return null; @@ -1590,7 +1545,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok return result[0]; } else { - return Object(__WEBPACK_IMPORTED_MODULE_5__clone__["b" /* clone */])(result[0], this.cloneMethod); + return Object(__WEBPACK_IMPORTED_MODULE_5__clone__["a" /* clone */])(result[0], this.cloneMethod); } } } @@ -1600,10 +1555,10 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok * * @param {array} transform - Ordered array of transform step objects similar to chain * @param {object} parameters - Object containing properties representing parameters to substitute - * @returns {Resultset} (this) resultset, or data array if any map or join functions where called + * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called */ chain(transform, parameters) { - const rs = new __WEBPACK_IMPORTED_MODULE_2__resultset__["a" /* Resultset */](this); + const rs = new __WEBPACK_IMPORTED_MODULE_2__result_set__["a" /* ResultSet */](this); if (transform === undefined) { return rs; } @@ -1624,11 +1579,11 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok * simply iterates and returns the first element matching the query */ findOneUnindexed(prop, value) { - let i = this.data.length; + let i = this._data.length; let doc; while (i--) { - if (this.data[i][prop] === value) { - doc = this.data[i]; + if (this._data[i][prop] === value) { + doc = this._data[i]; return doc; } } @@ -1637,10 +1592,12 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok /** * Transaction methods */ - /** start the transation */ + /** + * start the transation + */ startTransaction() { if (this.transactional) { - this.cachedData = Object(__WEBPACK_IMPORTED_MODULE_5__clone__["b" /* clone */])(this.data, this.cloneMethod); + this.cachedData = Object(__WEBPACK_IMPORTED_MODULE_5__clone__["a" /* clone */])(this._data, this.cloneMethod); this.cachedIndex = this.idIndex; this.cachedBinaryIndex = this.binaryIndices; // propagate startTransaction to dynamic views @@ -1649,7 +1606,9 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok } } } - /** commit the transation */ + /** + * commit the transation + */ commit() { if (this.transactional) { this.cachedData = null; @@ -1661,11 +1620,13 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok } } } - /** roll back the transation */ + /** + * roll back the transation + */ rollback() { if (this.transactional) { if (this.cachedData !== null && this.cachedIndex !== null) { - this.data = this.cachedData; + this._data = this.cachedData; this.idIndex = this.cachedIndex; this.binaryIndices = this.cachedBinaryIndex; } @@ -1695,12 +1656,7 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok * @returns {data} The result of your mapReduce operation */ mapReduce(mapFunction, reduceFunction) { - try { - return reduceFunction(this.data.map(mapFunction)); - } - catch (err) { - throw err; - } + return reduceFunction(this._data.map(mapFunction)); } /** * Join two collections on specified properties @@ -1709,20 +1665,16 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok * @param {string} leftJoinProp - property name in collection * @param {string} rightJoinProp - property name in joinData * @param {function} mapFun - (Optional) map function to use - * @returns {Resultset} Result of the mapping operation + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method + * @returns {ResultSet} Result of the mapping operation */ - //eqJoin(joinData: T[] | Resultset, leftJoinProp: string | ((obj: E) => string), rightJoinProp: string | ((obj: T) => string)): Resultset<{ left: E; right: T; }>; - // eqJoin(joinData: T[] | Resultset, leftJoinProp: string | ((obj: E) => string), rightJoinProp: string | ((obj: T) => string), mapFun?: (a: E, b: T) => U): Resultset { - //eqJoin(joinData: T[] | Resultset, leftJoinKey: string | ((obj: E) => string), rightJoinKey: string | ((obj: T) => string), mapFun?: (a: E, b: T) => U, dataOptions?: Resultset.DataOptions): Resultset<{ left: E; right: T; }> { - eqJoin(joinData, leftJoinProp, rightJoinProp, mapFun) { - // logic in Resultset class - return new __WEBPACK_IMPORTED_MODULE_2__resultset__["a" /* Resultset */](this).eqJoin(joinData, leftJoinProp, rightJoinProp, mapFun); + eqJoin(joinData, leftJoinProp, rightJoinProp, mapFun, dataOptions) { + return new __WEBPACK_IMPORTED_MODULE_2__result_set__["a" /* ResultSet */](this).eqJoin(joinData, leftJoinProp, rightJoinProp, mapFun, dataOptions); } /* ------ STAGING API -------- */ - /** - * stages: a map of uniquely identified 'stages', which hold copies of objects to be - * manipulated without affecting the data in the original collection - */ /** * (Staging API) create a stage and/or retrieve it */ @@ -1751,9 +1703,8 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok */ commitStage(stageName, message) { const stage = this.getStage(stageName); - let prop; const timestamp = new Date().getTime(); - for (prop in stage) { + for (const prop in stage) { this.update(stage[prop]); this.commitLog.push({ timestamp, @@ -1766,12 +1717,10 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok /** */ extract(field) { - let i = 0; - const len = this.data.length; const isDotNotation = isDeepProperty(field); const result = []; - for (i; i < len; i += 1) { - result.push(deepProperty(this.data[i], field, isDotNotation)); + for (let i = 0; i < this._data.length; i++) { + result.push(deepProperty(this._data[i], field, isDotNotation)); } return result; } @@ -1788,24 +1737,22 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok /** */ maxRecord(field) { - let i = 0; - const len = this.data.length; const deep = isDeepProperty(field); const result = { index: 0, value: 0 }; let max; - for (i; i < len; i += 1) { + for (let i = 0; i < this._data.length; i++) { if (max !== undefined) { - if (max < deepProperty(this.data[i], field, deep)) { - max = deepProperty(this.data[i], field, deep); - result.index = this.data[i].$loki; + if (max < deepProperty(this._data[i], field, deep)) { + max = deepProperty(this._data[i], field, deep); + result.index = this._data[i].$loki; } } else { - max = deepProperty(this.data[i], field, deep); - result.index = this.data[i].$loki; + max = deepProperty(this._data[i], field, deep); + result.index = this._data[i].$loki; } } result.value = max; @@ -1814,24 +1761,22 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok /** */ minRecord(field) { - let i = 0; - const len = this.data.length; const deep = isDeepProperty(field); const result = { index: 0, value: 0 }; let min; - for (i; i < len; i += 1) { + for (let i = 0; i < this._data.length; i++) { if (min !== undefined) { - if (min > deepProperty(this.data[i], field, deep)) { - min = deepProperty(this.data[i], field, deep); - result.index = this.data[i].$loki; + if (min > deepProperty(this._data[i], field, deep)) { + min = deepProperty(this._data[i], field, deep); + result.index = this._data[i].$loki; } } else { - min = deepProperty(this.data[i], field, deep); - result.index = this.data[i].$loki; + min = deepProperty(this._data[i], field, deep); + result.index = this._data[i].$loki; } } result.value = min; @@ -1909,112 +1854,6 @@ class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lok /***/ }), /* 2 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CloneMethod; }); -/* harmony export (immutable) */ __webpack_exports__["b"] = clone; -var CloneMethod; -(function (CloneMethod) { - CloneMethod[CloneMethod["PARSE_STRINGIFY"] = 0] = "PARSE_STRINGIFY"; - CloneMethod[CloneMethod["DEEP"] = 1] = "DEEP"; - CloneMethod[CloneMethod["SHALLOW"] = 2] = "SHALLOW"; - CloneMethod[CloneMethod["SHALLOW_ASSIGN"] = 3] = "SHALLOW_ASSIGN"; - CloneMethod[CloneMethod["SHALLOW_RECURSE_OBJECTS"] = 4] = "SHALLOW_RECURSE_OBJECTS"; -})(CloneMethod || (CloneMethod = {})); -function add(copy, key, value) { - if (copy instanceof Array) { - copy.push(value); - return copy[copy.length - 1]; - } - else if (copy instanceof Object) { - copy[key] = value; - return copy[key]; - } -} -function walk(target, copy) { - for (let key in target) { - let obj = target[key]; - if (obj instanceof Date) { - let value = new Date(obj.getTime()); - add(copy, key, value); - } - else if (obj instanceof Function) { - let value = obj; - add(copy, key, value); - } - else if (obj instanceof Array) { - let value = []; - let last = add(copy, key, value); - walk(obj, last); - } - else if (obj instanceof Object) { - let value = {}; - let last = add(copy, key, value); - walk(obj, last); - } - else { - let value = obj; - add(copy, key, value); - } - } -} -// Deep copy from Simeon Velichkov. -/** - * @param target - * @returns {any} - */ -function deepCopy(target) { - if (/number|string|boolean/.test(typeof target)) { - return target; - } - if (target instanceof Date) { - return new Date(target.getTime()); - } - const copy = (target instanceof Array) ? [] : {}; - walk(target, copy); - return copy; -} -/** - * @hidden - */ -function clone(data, method = CloneMethod.PARSE_STRINGIFY) { - if (data === null || data === undefined) { - return null; - } - let cloned; - switch (method) { - case CloneMethod.PARSE_STRINGIFY: - cloned = JSON.parse(JSON.stringify(data)); - break; - case CloneMethod.DEEP: - cloned = deepCopy(data); - break; - case CloneMethod.SHALLOW: - cloned = Object.create(data.constructor.prototype); - Object.assign(cloned, data); - break; - case CloneMethod.SHALLOW_RECURSE_OBJECTS: - // shallow clone top level properties - cloned = clone(data, CloneMethod.SHALLOW); - const keys = Object.keys(data); - // for each of the top level properties which are object literals, recursively shallow copy - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - if (typeof data[key] === "object" && data[key].constructor.name === "Object") { - cloned[key] = clone(data[key], CloneMethod.SHALLOW_RECURSE_OBJECTS); - } - } - break; - default: - break; - } - return cloned; -} - - -/***/ }), -/* 3 */ /***/ (function(module, exports) { var g; @@ -2041,25 +1880,24 @@ module.exports = g; /***/ }), -/* 4 */ +/* 3 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__collection__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__helper__ = __webpack_require__(5); // used to recursively scan hierarchical transform step object for param substitution function resolveTransformObject(subObj, params, depth = 0) { - let prop; - let pname; - if (++depth >= 10) + if (++depth >= 10) { return subObj; - for (prop in subObj) { + } + for (const prop in subObj) { if (typeof subObj[prop] === "string" && subObj[prop].indexOf("[%lktxp]") === 0) { - pname = subObj[prop].substring(8); + const pname = subObj[prop].substring(8); if (params[pname] !== undefined) { subObj[prop] = params[pname]; } @@ -2072,15 +1910,14 @@ function resolveTransformObject(subObj, params, depth = 0) { } // top level utility to resolve an entire (single) transform (array of steps) for parameter substitution function resolveTransformParams(transform, params) { - let idx; - let clonedStep; - const resolvedTransform = []; - if (params === undefined) + if (params === undefined) { return transform; + } // iterate all steps in the transform array - for (idx = 0; idx < transform.length; idx++) { + const resolvedTransform = []; + for (let idx = 0; idx < transform.length; idx++) { // clone transform so our scan/replace can operate directly on cloned transform - clonedStep = Object(__WEBPACK_IMPORTED_MODULE_1__clone__["b" /* clone */])(transform[idx], __WEBPACK_IMPORTED_MODULE_1__clone__["a" /* CloneMethod */].SHALLOW_RECURSE_OBJECTS); + const clonedStep = Object(__WEBPACK_IMPORTED_MODULE_1__clone__["a" /* clone */])(transform[idx], "shallow-recurse-objects"); resolvedTransform.push(resolveTransformObject(clonedStep, params)); } return resolvedTransform; @@ -2107,7 +1944,7 @@ function doQueryOp(val, op) { */ const LokiOps = { // comparison operators - // a is the value in the collection + // a is the value in the _collection // b is the query value $eq(a, b) { return a === b; @@ -2140,11 +1977,10 @@ const LokiOps = { $lte(a, b) { return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["c" /* ltHelper */])(a, b, true); }, - // ex : coll.find({'orderCount': {$between: [10, 50]}}); - $between(a, vals) { + $between(a, range) { if (a === undefined || a === null) return false; - return (Object(__WEBPACK_IMPORTED_MODULE_2__helper__["b" /* gtHelper */])(a, vals[0], true) && Object(__WEBPACK_IMPORTED_MODULE_2__helper__["c" /* ltHelper */])(a, vals[1], true)); + return (Object(__WEBPACK_IMPORTED_MODULE_2__helper__["b" /* gtHelper */])(a, range[0], true) && Object(__WEBPACK_IMPORTED_MODULE_2__helper__["c" /* ltHelper */])(a, range[1], true)); }, $in(a, b) { return b.indexOf(a) !== -1; @@ -2218,14 +2054,14 @@ const LokiOps = { return b(a) === true; }, // field-level logical operators - // a is the value in the collection + // a is the value in the _collection // b is the nested query operation (for '$not') // or an array of nested query operations (for '$and' and '$or') $not(a, b) { return !doQueryOp(a, b); }, $and(a, b) { - for (let idx = 0, len = b.length; idx < len; idx += 1) { + for (let idx = 0, len = b.length; idx < len; idx++) { if (!doQueryOp(a, b[idx])) { return false; } @@ -2233,7 +2069,7 @@ const LokiOps = { return true; }, $or(a, b) { - for (let idx = 0, len = b.length; idx < len; idx += 1) { + for (let idx = 0, len = b.length; idx < len; idx++) { if (doQueryOp(a, b[idx])) { return true; } @@ -2279,7 +2115,7 @@ function dotSubScan(root, paths, fun, value, pathOffset = 0) { valueFound = fun(element, value); } else if (Array.isArray(element)) { - for (let index = 0, len = element.length; index < len; index += 1) { + for (let index = 0, len = element.length; index < len; index++) { valueFound = dotSubScan(element[index], paths, fun, value, pathOffset + 1); if (valueFound === true) { break; @@ -2292,7 +2128,7 @@ function dotSubScan(root, paths, fun, value, pathOffset = 0) { return valueFound; } /** - * Resultset class allowing chainable queries. Intended to be instanced internally. + * ResultSet class allowing chainable queries. Intended to be instanced internally. * Collection.find(), Collection.where(), and Collection.chain() instantiate this. * * @example @@ -2300,82 +2136,83 @@ function dotSubScan(root, paths, fun, value, pathOffset = 0) { * .find({ 'doors' : 4 }) * .where(function(obj) { return obj.name === 'Toyota' }) * .data(); + * + * @param - the data type + * @param - nested properties of data type */ -class Resultset { +class ResultSet { /** * Constructor. - * @param {Collection} collection - the collection which this Resultset will query against + * @param {Collection} collection - the collection which this ResultSet will query against */ constructor(collection) { // retain reference to collection we are querying against - this.collection = collection; - this.filteredrows = []; - this.filterInitialized = false; + this._collection = collection; + this._filteredRows = []; + this._filterInitialized = false; this._scoring = null; } /** - * reset() - Reset the resultset to its initial state. + * reset() - Reset the ResultSet to its initial state. * - * @returns {Resultset} Reference to this resultset, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, for future chain operations. */ reset() { - if (this.filteredrows.length > 0) { - this.filteredrows = []; + if (this._filteredRows.length > 0) { + this._filteredRows = []; } - this.filterInitialized = false; + this._filterInitialized = false; return this; } /** - * toJSON() - Override of toJSON to avoid circular references + * Override of toJSON to avoid circular references * */ toJSON() { const copy = this.copy(); - copy.collection = null; + copy._collection = null; return copy; } /** * Allows you to limit the number of documents passed to next chain operation. - * A resultset copy() is made to avoid altering original resultset. + * A ResultSet copy() is made to avoid altering original ResultSet. * * @param {int} qty - The number of documents to return. - * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops. + * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops. */ limit(qty) { - // if this has no filters applied, we need to populate filteredrows first - if (!this.filterInitialized && this.filteredrows.length === 0) { - this.filteredrows = this.collection.prepareFullDocIndex(); + // if this has no filters applied, we need to populate filteredRows first + if (!this._filterInitialized && this._filteredRows.length === 0) { + this._filteredRows = this._collection._prepareFullDocIndex(); } - this.filteredrows = this.filteredrows.slice(0, qty); - this.filterInitialized = true; + this._filteredRows = this._filteredRows.slice(0, qty); + this._filterInitialized = true; return this; } /** - * Used for skipping 'pos' number of documents in the resultset. + * Used for skipping 'pos' number of documents in the ResultSet. * * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. - * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. + * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops. */ offset(pos) { - // if this has no filters applied, we need to populate filteredrows first - if (!this.filterInitialized && this.filteredrows.length === 0) { - this.filteredrows = this.collection.prepareFullDocIndex(); + // if this has no filters applied, we need to populate filteredRows first + if (!this._filterInitialized && this._filteredRows.length === 0) { + this._filteredRows = this._collection._prepareFullDocIndex(); } - this.filteredrows = this.filteredrows.slice(pos); - this.filterInitialized = true; + this._filteredRows = this._filteredRows.slice(pos); + this._filterInitialized = true; return this; } /** - * copy() - To support reuse of resultset in branched query situations. + * copy() - To support reuse of ResultSet in branched query situations. * - * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same. + * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same. */ copy() { - const result = new Resultset(this.collection); - if (this.filteredrows.length > 0) { - result.filteredrows = this.filteredrows.slice(); - } - result.filterInitialized = this.filterInitialized; + const result = new ResultSet(this._collection); + result._filteredRows = this._filteredRows.slice(); + result._filterInitialized = this._filterInitialized; return result; } /** @@ -2385,31 +2222,23 @@ class Resultset { return this.copy(); } /** - * Executes a named collection transform or raw array of transform steps against the resultset. + * Executes a named collection transform or raw array of transform steps against the ResultSet. * * @param {(string|array)} transform - name of collection transform or raw transform array * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. - * @returns {Resultset} either (this) resultset or a clone of of this resultset (depending on steps) + * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps) */ transform(transform, parameters) { - let idx; - let step; - let rs = this; // if transform is name, then do lookup first if (typeof transform === "string") { - if (this.collection.transforms[transform] !== undefined) { - transform = this.collection.transforms[transform]; - } - } - // either they passed in raw transform array or we looked it up, so process - if (typeof transform !== "object" || !Array.isArray(transform)) { - throw new Error("Invalid transform"); + transform = this._collection.transforms[transform]; } if (parameters !== undefined) { transform = resolveTransformParams(transform, parameters); } - for (idx = 0; idx < transform.length; idx++) { - step = transform[idx]; + let rs = this; + for (let idx = 0; idx < transform.length; idx++) { + const step = transform[idx]; switch (step.type) { case "find": rs.find(step.value); @@ -2426,6 +2255,9 @@ class Resultset { case "sort": rs.sort(step.value); break; + case "sortByScoring": + rs.sortByScoring(step.desc); + break; case "limit": rs = rs.limit(step.value); break; // limit makes copy so update reference @@ -2442,7 +2274,7 @@ class Resultset { case "mapReduce": rs = rs.mapReduce(step.mapFunction, step.reduceFunction); break; - // following cases update documents in current filtered resultset (use carefully) + // following cases update documents in current filtered ResultSet (use carefully) case "update": rs.update(step.value); break; @@ -2465,15 +2297,16 @@ class Resultset { * }); * * @param {function} comparefun - A javascript compare function used for sorting. - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ sort(comparefun) { - // if this has no filters applied, just we need to populate filteredrows first - if (!this.filterInitialized && this.filteredrows.length === 0) { - this.filteredrows = this.collection.prepareFullDocIndex(); + // if this has no filters applied, just we need to populate filteredRows first + if (!this._filterInitialized && this._filteredRows.length === 0) { + this._filteredRows = this._collection._prepareFullDocIndex(); } - const wrappedComparer = (((userComparer, data) => (a, b) => userComparer(data[a], data[b])))(comparefun, this.collection.data); - this.filteredrows.sort(wrappedComparer); + const data = this._collection._data; + const wrappedComparer = (a, b) => comparefun(data[a], data[b]); + this._filteredRows.sort(wrappedComparer); return this; } /** @@ -2481,35 +2314,34 @@ class Resultset { * Sorting based on the same lt/gt helper functions used for binary indices. * * @param {string} propname - name of property to sort by. - * @param {boolean} isdesc - (Optional) If true, the property will be sorted in descending order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @param {boolean} [descending=false] - if true, the property will be sorted in descending order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ - simplesort(propname, isdesc) { - if (isdesc === undefined) { - isdesc = false; - } - // if this has no filters applied, just we need to populate filteredrows first - if (!this.filterInitialized && this.filteredrows.length === 0) { + simplesort(propname, descending = false) { + // if this has no filters applied, just we need to populate filteredRows first + if (!this._filterInitialized && this._filteredRows.length === 0) { + //TODO: // if we have a binary index and no other filters applied, we can use that instead of sorting (again) - if (this.collection.binaryIndices[propname] !== undefined) { + if (this._collection.binaryIndices[propname] !== undefined) { // make sure index is up-to-date - this.collection.ensureIndex(propname); - // copy index values into filteredrows - this.filteredrows = this.collection.binaryIndices[propname].values.slice(0); - if (isdesc) { - this.filteredrows.reverse(); + this._collection.ensureIndex(propname); + // copy index values into filteredRows + this._filteredRows = this._collection.binaryIndices[propname].values.slice(0); + if (descending) { + this._filteredRows.reverse(); } - // we are done, return this (resultset) for further chain ops + // we are done, return this (ResultSet) for further chain ops return this; } else { - this.filteredrows = this.collection.prepareFullDocIndex(); + this._filteredRows = this._collection._prepareFullDocIndex(); } } - const wrappedComparer = ((prop, desc, data) => (a, b) => { - let val1, val2, arr; - if (~prop.indexOf(".")) { - arr = prop.split("."); + const data = this._collection._data; + const wrappedComparer = (a, b) => { + let val1, val2; + if (~propname.indexOf(".")) { + const arr = propname.split("."); val1 = arr.reduce(function (obj, i) { return obj && obj[i] || undefined; }, data[a]); @@ -2518,16 +2350,16 @@ class Resultset { }, data[b]); } else { - val1 = data[a][prop]; - val2 = data[b][prop]; + val1 = data[a][propname]; + val2 = data[b][propname]; } - return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["d" /* sortHelper */])(val1, val2, desc); - })(propname, isdesc, this.collection.data); - this.filteredrows.sort(wrappedComparer); + return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["d" /* sortHelper */])(val1, val2, descending); + }; + this._filteredRows.sort(wrappedComparer); return this; } /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * rs.compoundsort(['age', 'name']); @@ -2535,15 +2367,14 @@ class Resultset { * rs.compoundsort(['age', ['name', true]); * * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. */ compoundsort(properties) { if (properties.length === 0) { throw new Error("Invalid call to compoundsort, need at least one property"); } - let prop; if (properties.length === 1) { - prop = properties[0]; + const prop = properties[0]; if (typeof prop === "string") { return this.simplesort(prop, false); } @@ -2552,18 +2383,19 @@ class Resultset { } } // unify the structure of 'properties' to avoid checking it repeatedly while sorting - for (let i = 0, len = properties.length; i < len; i += 1) { - prop = properties[i]; + for (let i = 0, len = properties.length; i < len; i++) { + const prop = properties[i]; if (typeof prop === "string") { properties[i] = [prop, false]; } } - // if this has no filters applied, just we need to populate filteredrows first - if (!this.filterInitialized && this.filteredrows.length === 0) { - this.filteredrows = this.collection.prepareFullDocIndex(); + // if this has no filters applied, just we need to populate filteredRows first + if (!this._filterInitialized && this._filteredRows.length === 0) { + this._filteredRows = this._collection._prepareFullDocIndex(); } - const wrappedComparer = (((props, data) => (a, b) => this._compoundeval(props, data[a], data[b])))(properties, this.collection.data); - this.filteredrows.sort(wrappedComparer); + const data = this._collection._data; + const wrappedComparer = (a, b) => this._compoundeval(properties, data[a], data[b]); + this._filteredRows.sort(wrappedComparer); return this; } /** @@ -2575,13 +2407,10 @@ class Resultset { * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first */ _compoundeval(properties, obj1, obj2) { - let res = 0; - let prop; - let field; - let val1, val2, arr; for (let i = 0, len = properties.length; i < len; i++) { - prop = properties[i]; - field = prop[0]; + const prop = properties[i]; + const field = prop[0]; + let val1, val2, arr; if (~field.indexOf(".")) { arr = field.split("."); val1 = arr.reduce((obj, i) => { @@ -2595,7 +2424,7 @@ class Resultset { val1 = obj1[field]; val2 = obj2[field]; } - res = Object(__WEBPACK_IMPORTED_MODULE_2__helper__["d" /* sortHelper */])(val1, val2, prop[1]); + const res = Object(__WEBPACK_IMPORTED_MODULE_2__helper__["d" /* sortHelper */])(val1, val2, prop[1]); if (res !== 0) { return res; } @@ -2603,19 +2432,19 @@ class Resultset { return 0; } /** - * Sorts the resultset based on the last full-text-search scoring. + * Sorts the ResultSet based on the last full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending - * @returns {Resultset} + * @returns {ResultSet} */ sortByScoring(ascending = false) { if (this._scoring === null) { throw new Error("No scoring available"); } if (ascending) { - this.filteredrows.sort((a, b) => this._scoring[a] - this._scoring[b]); + this._filteredRows.sort((a, b) => this._scoring[a].score - this._scoring[b].score); } else { - this.filteredrows.sort((a, b) => this._scoring[b] - this._scoring[a]); + this._filteredRows.sort((a, b) => this._scoring[b].score - this._scoring[a].score); } return this; } @@ -2630,59 +2459,55 @@ class Resultset { return this._scoring; } /** - * findOr() - oversee the operation of OR'ed query expressions. + * Oversee the operation of OR'ed query expressions. * OR'ed expression evaluation runs each expression individually against the full collection, * and finally does a set OR on each expression's results. * Each evaluation can utilize a binary index to prevent multiple linear array scans. * * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ findOr(expressionArray) { - let fr = null; - let fri = 0; - let frlen = 0; const docset = []; const idxset = []; - let idx = 0; const origCount = this.count(); // If filter is already initialized, then we query against only those items already in filter. - // This means no index utilization for fields, so hopefully its filtered to a smallish filteredrows. + // This means no index utilization for fields, so hopefully its filtered to a smallish filteredRows. for (let ei = 0, elen = expressionArray.length; ei < elen; ei++) { // we need to branch existing query to run each filter separately and combine results - fr = this.branch().find(expressionArray[ei]).filteredrows; - frlen = fr.length; + const fr = this.branch().find(expressionArray[ei])._filteredRows; + const frlen = fr.length; // if the find operation did not reduce the initial set, then the initial set is the actual result if (frlen === origCount) { return this; } // add any document 'hits' - for (fri = 0; fri < frlen; fri++) { - idx = fr[fri]; + for (let fri = 0; fri < frlen; fri++) { + const idx = fr[fri]; if (idxset[idx] === undefined) { idxset[idx] = true; docset.push(idx); } } } - this.filteredrows = docset; - this.filterInitialized = true; + this._filteredRows = docset; + this._filterInitialized = true; return this; } $or(expressionArray) { return this.findOr(expressionArray); } /** - * findAnd() - oversee the operation of AND'ed query expressions. + * Oversee the operation of AND'ed query expressions. * AND'ed expression evaluation runs each expression progressively against the full collection, - * internally utilizing existing chained resultset functionality. + * internally utilizing existing chained ResultSet functionality. * Only the first filter can utilize a binary index. * * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ findAnd(expressionArray) { - // we have already implementing method chaining in this (our Resultset class) + // we have already implementing method chaining in this (our ResultSet class) // so lets just progressively apply user supplied and filters for (let i = 0, len = expressionArray.length; i < len; i++) { if (this.count() === 0) { @@ -2700,12 +2525,12 @@ class Resultset { * * @param {object} query - A mongo-style query object used for filtering current results. * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ find(query, firstOnly = false) { - if (this.collection.data.length === 0) { - this.filteredrows = []; - this.filterInitialized = true; + if (this._collection._data.length === 0) { + this._filteredRows = []; + this._filterInitialized = true; return this; } const queryObject = query || "getAll"; @@ -2732,17 +2557,17 @@ class Resultset { // apply no filters if they want all if (!property || queryObject === "getAll") { if (firstOnly) { - this.filteredrows = (this.collection.data.length > 0) ? [0] : []; - this.filterInitialized = true; + this._filteredRows = (this._collection._data.length > 0) ? [0] : []; + this._filterInitialized = true; } return this; } // injecting $and and $or expression tree evaluation here. if (property === "$and" || property === "$or") { this[property](queryObjectOp); - // for chained find with firstonly, - if (firstOnly && this.filteredrows.length > 1) { - this.filteredrows = this.filteredrows.slice(0, 1); + // for chained find with firstOnly, + if (firstOnly && this._filteredRows.length > 1) { + this._filteredRows = this._filteredRows.slice(0, 1); } return this; } @@ -2777,31 +2602,31 @@ class Resultset { const usingDotNotation = (property.indexOf(".") !== -1); // if an index exists for the property being queried against, use it // for now only enabling where it is the first filter applied and prop is indexed - const doIndexCheck = !usingDotNotation && !this.filterInitialized; + const doIndexCheck = !usingDotNotation && !this._filterInitialized; let searchByIndex = false; - if (doIndexCheck && this.collection.binaryIndices[property] && indexedOps[operator]) { + if (doIndexCheck && this._collection.binaryIndices[property] && indexedOps[operator]) { // this is where our lazy index rebuilding will take place // basically we will leave all indexes dirty until we need them // so here we will rebuild only the index tied to this property // ensureIndex() will only rebuild if flagged as dirty since we are not passing force=true param - if (this.collection.adaptiveBinaryIndices !== true) { - this.collection.ensureIndex(property); + if (this._collection.adaptiveBinaryIndices !== true) { + this._collection.ensureIndex(property); } searchByIndex = true; } // the comparison function const fun = LokiOps[operator]; // "shortcut" for collection data - const data = this.collection.data; + const data = this._collection._data; // Query executed differently depending on : // - whether the property being queried has an index defined - // - if chained, we handle first pass differently for initial filteredrows[] population + // - if chained, we handle first pass differently for initial filteredRows[] population // // For performance reasons, each case has its own if block to minimize in-loop calculations let result = []; - // If the filteredrows[] is already initialized, use it - if (this.filterInitialized) { - let filter = this.filteredrows; + // If the filteredRows[] is already initialized, use it + if (this._filterInitialized) { + let filter = this._filteredRows; // currently supporting dot notation for non-indexed conditions only if (usingDotNotation) { property = property.split("."); @@ -2813,18 +2638,18 @@ class Resultset { } } else if (property === "$fts") { - this._scoring = this.collection._fullTextSearch.search(query["$fts"]); + this._scoring = this._collection._fullTextSearch.search(query.$fts); let keys = Object.keys(this._scoring); for (let i = 0; i < keys.length; i++) { - if (filter.includes(+keys[i])) { + if (filter.indexOf(+keys[i]) !== -1) { result.push(+keys[i]); } } } - else if (this.collection.constraints.unique[property] !== undefined && operator === "$eq") { + else if (this._collection.constraints.unique[property] !== undefined && operator === "$eq") { // Use unique constraint for search. - let row = this.collection.constraints.unique[property].get(value); - if (filter.includes(row)) { + let row = this._collection.constraints.unique[property].get(value); + if (filter.indexOf(row) !== -1) { result.push(row); } } @@ -2836,14 +2661,14 @@ class Resultset { } } } - this.filteredrows = result; - this.filterInitialized = true; // next time work against filteredrows[] + this._filteredRows = result; + this._filterInitialized = true; // next time work against filteredRows[] return this; } - this.filteredrows = result; - this.filterInitialized = true; // next time work against filteredrows[] + this._filteredRows = result; + this._filterInitialized = true; // next time work against filteredRows[] if (property === "$fts") { - this._scoring = this.collection._fullTextSearch.search(query["$fts"]); + this._scoring = this._collection._fullTextSearch.search(query.$fts); let keys = Object.keys(this._scoring); for (let i = 0; i < keys.length; i++) { result.push(+keys[i]); @@ -2851,11 +2676,11 @@ class Resultset { return this; } // Use unique constraint for search. - if (this.collection.constraints.unique[property] !== undefined && operator === "$eq") { - result.push(this.collection.constraints.unique[property].get(value)); + if (this._collection.constraints.unique[property] !== undefined && operator === "$eq") { + result.push(this._collection.constraints.unique[property].get(value)); return this; } - // first chained query so work against data[] but put results in filteredrows + // first chained query so work against data[] but put results in filteredRows // if not searching by index if (!searchByIndex) { if (usingDotNotation) { @@ -2881,10 +2706,10 @@ class Resultset { } return this; } - let index = this.collection.binaryIndices[property]; + let index = this._collection.binaryIndices[property]; if (operator !== "$in") { // search by index - const segm = this.collection.calculateRange(operator, property, value); + const segm = this._collection.calculateRange(operator, property, value); for (let i = segm[0]; i <= segm[1]; i++) { if (indexedOps[operator] !== true) { // must be a function, implying 2nd phase filtering of results from calculateRange @@ -2907,7 +2732,7 @@ class Resultset { const idxset = []; // query each value '$eq' operator and merge the segment results. for (let j = 0, len = value.length; j < len; j++) { - const segm = this.collection.calculateRange("$eq", property, value[j]); + const segm = this._collection.calculateRange("$eq", property, value[j]); for (let i = segm[0]; i <= segm[1]; i++) { if (idxset[i] === undefined) { idxset[i] = true; @@ -2925,7 +2750,7 @@ class Resultset { * Used for filtering via a javascript filter function. * * @param {function} fun - A javascript function used for filtering current results by. - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ where(fun) { let viewFunction; @@ -2937,26 +2762,26 @@ class Resultset { throw new TypeError("Argument is not a stored view or a function"); } try { - // If the filteredrows[] is already initialized, use it - if (this.filterInitialized) { - let j = this.filteredrows.length; + // If the filteredRows[] is already initialized, use it + if (this._filterInitialized) { + let j = this._filteredRows.length; while (j--) { - if (viewFunction(this.collection.data[this.filteredrows[j]]) === true) { - result.push(this.filteredrows[j]); + if (viewFunction(this._collection._data[this._filteredRows[j]]) === true) { + result.push(this._filteredRows[j]); } } - this.filteredrows = result; + this._filteredRows = result; return this; } else { - let k = this.collection.data.length; + let k = this._collection._data.length; while (k--) { - if (viewFunction(this.collection.data[k]) === true) { + if (viewFunction(this._collection._data[k]) === true) { result.push(k); } } - this.filteredrows = result; - this.filterInitialized = true; + this._filteredRows = result; + this._filterInitialized = true; return this; } } @@ -2965,25 +2790,25 @@ class Resultset { } } /** - * Returns the number of documents in the resultset. - * @returns {number} The number of documents in the resultset. + * Returns the number of documents in the ResultSet. + * @returns {number} The number of documents in the ResultSet. */ count() { - if (this.filterInitialized) { - return this.filteredrows.length; + if (this._filterInitialized) { + return this._filteredRows.length; } - return this.collection.count(); + return this._collection.count(); } /** * Terminates the chain and returns array of filtered documents * @param {object} options - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values 'parse-stringify', 'deep', and 'shallow' and + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * - * @returns {Array} Array of documents in the resultset + * @returns {Array} Array of documents in the ResultSet */ data(options = {}) { let forceClones; @@ -2991,11 +2816,11 @@ class Resultset { let removeMeta; ({ forceClones, - forceCloneMethod = this.collection.cloneMethod, + forceCloneMethod = this._collection.cloneMethod, removeMeta = false } = options); let result = []; - let data = this.collection.data; + let data = this._collection._data; let obj; let len; let i; @@ -3003,22 +2828,22 @@ class Resultset { // if user opts to strip meta, then force clones and use 'shallow' if 'force' options are not present if (removeMeta && !forceClones) { forceClones = true; - forceCloneMethod = __WEBPACK_IMPORTED_MODULE_1__clone__["a" /* CloneMethod */].SHALLOW; + forceCloneMethod = "shallow"; } // if collection has delta changes active, then force clones and use CloneMethod.DEEP for effective change tracking of nested objects - if (!this.collection.disableDeltaChangesApi) { + if (!this._collection.disableDeltaChangesApi) { forceClones = true; - forceCloneMethod = __WEBPACK_IMPORTED_MODULE_1__clone__["a" /* CloneMethod */].DEEP; + forceCloneMethod = "deep"; } // if this has no filters applied, just return collection.data - if (!this.filterInitialized) { - if (this.filteredrows.length === 0) { + if (!this._filterInitialized) { + if (this._filteredRows.length === 0) { // determine whether we need to clone objects or not - if (this.collection.cloneObjects || forceClones) { + if (this._collection.cloneObjects || forceClones) { len = data.length; method = forceCloneMethod; for (i = 0; i < len; i++) { - obj = Object(__WEBPACK_IMPORTED_MODULE_1__clone__["b" /* clone */])(data[i], method); + obj = Object(__WEBPACK_IMPORTED_MODULE_1__clone__["a" /* clone */])(data[i], method); if (removeMeta) { delete obj.$loki; delete obj.meta; @@ -3032,16 +2857,16 @@ class Resultset { } } else { - // filteredrows must have been set manually, so use it - this.filterInitialized = true; + // filteredRows must have been set manually, so use it + this._filterInitialized = true; } } - const fr = this.filteredrows; + const fr = this._filteredRows; len = fr.length; - if (this.collection.cloneObjects || forceClones) { + if (this._collection.cloneObjects || forceClones) { method = forceCloneMethod; for (i = 0; i < len; i++) { - obj = Object(__WEBPACK_IMPORTED_MODULE_1__clone__["b" /* clone */])(data[fr[i]], method); + obj = Object(__WEBPACK_IMPORTED_MODULE_1__clone__["a" /* clone */])(data[fr[i]], method); if (removeMeta) { delete obj.$loki; delete obj.meta; @@ -3057,38 +2882,38 @@ class Resultset { return result; } /** - * Used to run an update operation on all documents currently in the resultset. + * Used to run an update operation on all documents currently in the ResultSet. * * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. - * @returns {Resultset} this resultset for further chain ops. + * @returns {ResultSet} this ResultSet for further chain ops. */ update(updateFunction) { - // if this has no filters applied, we need to populate filteredrows first - if (!this.filterInitialized && this.filteredrows.length === 0) { - this.filteredrows = this.collection.prepareFullDocIndex(); + // if this has no filters applied, we need to populate filteredRows first + if (!this._filterInitialized && this._filteredRows.length === 0) { + this._filteredRows = this._collection._prepareFullDocIndex(); } - const len = this.filteredrows.length; - const rcd = this.collection.data; + const len = this._filteredRows.length; + const rcd = this._collection._data; for (let idx = 0; idx < len; idx++) { - // pass in each document object currently in resultset to user supplied updateFunction - updateFunction(rcd[this.filteredrows[idx]]); + // pass in each document object currently in ResultSet to user supplied updateFunction + updateFunction(rcd[this._filteredRows[idx]]); // notify collection we have changed this object so it can update meta and allow DynamicViews to re-evaluate - this.collection.update(rcd[this.filteredrows[idx]]); + this._collection.update(rcd[this._filteredRows[idx]]); } return this; } /** - * Removes all document objects which are currently in resultset from collection (as well as resultset) + * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet) * - * @returns {Resultset} this (empty) resultset for further chain ops. + * @returns {ResultSet} this (empty) ResultSet for further chain ops. */ remove() { - // if this has no filters applied, we need to populate filteredrows first - if (!this.filterInitialized && this.filteredrows.length === 0) { - this.filteredrows = this.collection.prepareFullDocIndex(); + // if this has no filters applied, we need to populate filteredRows first + if (!this._filterInitialized && this._filteredRows.length === 0) { + this._filteredRows = this._collection._prepareFullDocIndex(); } - this.collection.remove(this.data()); - this.filteredrows = []; + this._collection.remove(this.data()); + this._filteredRows = []; return this; } /** @@ -3109,22 +2934,17 @@ class Resultset { /** * Left joining two sets of data. Join keys can be defined or calculated properties * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key - * @param {Array|Resultset|Collection} joinData - Data array to join to. + * @param {Array|ResultSet|Collection} joinData - Data array to join to. * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}] + * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method + * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}] */ - //eqJoin(joinData: T[] | Resultset, leftJoinKey: string | ((obj: E) => string), rightJoinKey: string | ((obj: T) => string)): Resultset<{ left: E; right: T; }>; - // eqJoin(joinData: T[] | Resultset, leftJoinKey: string | ((obj: E) => string), rightJoinKey: string | ((obj: T) => string), mapFun?: (a: E, b: T) => U, dataOptions?: Resultset.DataOptions): Resultset { eqJoin(joinData, leftJoinKey, rightJoinKey, mapFun, dataOptions) { - // eqJoin(joinData: T[] | Resultset, leftJoinKey: string | ((obj: E) => string), rightJoinKey: string | ((obj: T) => string), mapFun?: (a: E, b: T) => U, dataOptions?: Resultset.DataOptions): Resultset { - let leftData = []; - let leftDataLength; let rightData = []; let rightDataLength; let key; @@ -3133,13 +2953,13 @@ class Resultset { let rightKeyisFunction = typeof rightJoinKey === "function"; let joinMap = {}; //get the left data - leftData = this.data(dataOptions); - leftDataLength = leftData.length; + let leftData = this.data(dataOptions); + let leftDataLength = leftData.length; //get the right data if (joinData instanceof __WEBPACK_IMPORTED_MODULE_0__collection__["a" /* Collection */]) { rightData = joinData.chain().data(dataOptions); } - else if (joinData instanceof Resultset) { + else if (joinData instanceof ResultSet) { rightData = joinData.data(dataOptions); } else if (Array.isArray(joinData)) { @@ -3151,7 +2971,9 @@ class Resultset { rightDataLength = rightData.length; //construct a lookup table for (let i = 0; i < rightDataLength; i++) { - key = rightKeyisFunction ? rightJoinKey(rightData[i]) : rightData[i][rightJoinKey]; + key = rightKeyisFunction + ? rightJoinKey(rightData[i]) + : rightData[i][rightJoinKey]; joinMap[key] = rightData[i]; } if (!mapFun) { @@ -3160,16 +2982,18 @@ class Resultset { right }); } - //Run map function over each object in the resultset + //Run map function over each object in the ResultSet for (let j = 0; j < leftDataLength; j++) { - key = leftKeyisFunction ? leftJoinKey(leftData[j]) : leftData[j][leftJoinKey]; + key = leftKeyisFunction + ? leftJoinKey(leftData[j]) + : leftData[j][leftJoinKey]; result.push(mapFun(leftData[j], joinMap[key] || {})); } - //return a new resultset with no filters - this.collection = new __WEBPACK_IMPORTED_MODULE_0__collection__["a" /* Collection */]("joinData"); - this.collection.insert(result); - this.filteredrows = []; - this.filterInitialized = false; + //return a new ResultSet with no filters + this._collection = new __WEBPACK_IMPORTED_MODULE_0__collection__["a" /* Collection */]("joinData"); + this._collection.insert(result); + this._filteredRows = []; + this._filterInitialized = false; return this; } /** @@ -3178,22 +3002,120 @@ class Resultset { * @param {object} [dataOptions=] - options to data() before input to your map function * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method + * @return {ResultSet} */ map(mapFun, dataOptions) { - let data = this.data(dataOptions).map(mapFun); - //return return a new resultset with no filters - this.collection = new __WEBPACK_IMPORTED_MODULE_0__collection__["a" /* Collection */]("mappedData"); - this.collection.insert(data); - this.filteredrows = []; - this.filterInitialized = false; + const data = this.data(dataOptions).map(mapFun); + //return return a new ResultSet with no filters + this._collection = new __WEBPACK_IMPORTED_MODULE_0__collection__["a" /* Collection */]("mappedData"); + this._collection.insert(data); + this._filteredRows = []; + this._filterInitialized = false; return this; } } -/* harmony export (immutable) */ __webpack_exports__["a"] = Resultset; +/* harmony export (immutable) */ __webpack_exports__["a"] = ResultSet; +/***/ }), +/* 4 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (immutable) */ __webpack_exports__["a"] = clone; +function add(copy, key, value) { + if (copy instanceof Array) { + copy.push(value); + return copy[copy.length - 1]; + } + else if (copy instanceof Object) { + copy[key] = value; + return copy[key]; + } +} +function walk(target, copy) { + for (let key in target) { + let obj = target[key]; + if (obj instanceof Date) { + let value = new Date(obj.getTime()); + add(copy, key, value); + } + else if (obj instanceof Function) { + let value = obj; + add(copy, key, value); + } + else if (obj instanceof Array) { + let value = []; + let last = add(copy, key, value); + walk(obj, last); + } + else if (obj instanceof Object) { + let value = {}; + let last = add(copy, key, value); + walk(obj, last); + } + else { + let value = obj; + add(copy, key, value); + } + } +} +// Deep copy from Simeon Velichkov. +/** + * @param target + * @returns {any} + */ +function deepCopy(target) { + if (/number|string|boolean/.test(typeof target)) { + return target; + } + if (target instanceof Date) { + return new Date(target.getTime()); + } + const copy = (target instanceof Array) ? [] : {}; + walk(target, copy); + return copy; +} +/** + * @hidden + */ +function clone(data, method = "parse-stringify") { + if (data === null || data === undefined) { + return null; + } + let cloned; + switch (method) { + case "parse-stringify": + cloned = JSON.parse(JSON.stringify(data)); + break; + case "deep": + cloned = deepCopy(data); + break; + case "shallow": + cloned = Object.create(data.constructor.prototype); + Object.assign(cloned, data); + break; + case "shallow-recurse-objects": + // shallow clone top level properties + cloned = clone(data, "shallow"); + const keys = Object.keys(data); + // for each of the top level properties which are object literals, recursively shallow copy + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + if (typeof data[key] === "object" && data[key].constructor.name === "Object") { + cloned[key] = clone(data[key], "shallow-recurse-objects"); + } + } + break; + default: + break; + } + return cloned; +} + + /***/ }), /* 5 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { @@ -3203,7 +3125,8 @@ class Resultset { /* harmony export (immutable) */ __webpack_exports__["c"] = ltHelper; /* harmony export (immutable) */ __webpack_exports__["b"] = gtHelper; /* harmony export (immutable) */ __webpack_exports__["d"] = sortHelper; -/** Helper function for determining 'loki' abstract equality which is a little more abstract than == +/** + * Helper function for determining 'loki' abstract equality which is a little more abstract than == * aeqHelper(5, '5') === true * aeqHelper(5.0, '5') === true * aeqHelper(new Date("1/1/2011"), new Date("1/1/2011")) === true @@ -3211,22 +3134,18 @@ class Resultset { * aeqHelper([1, 2, 3], [1, 3]) === false * aeqHelper([1, 2, 3], [1, 2, 3]) === true * aeqHelper(undefined, null) === true - */ -/** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @returns {boolean} + * @hidden */ function aeqHelper(prop1, prop2) { - let cv1; - let cv2; - let t1; - let t2; if (prop1 === prop2) return true; // 'falsy' and Boolean handling if (!prop1 || !prop2 || prop1 === true || prop2 === true || prop1 !== prop1 || prop2 !== prop2) { + let t1; + let t2; // dates and NaN conditions (typed dates before serialization) switch (prop1) { case undefined: @@ -3274,8 +3193,8 @@ function aeqHelper(prop1, prop2) { } } // Handle 'Number-like' comparisons - cv1 = Number(prop1); - cv2 = Number(prop2); + let cv1 = Number(prop1); + let cv2 = Number(prop2); // if one or both are 'number-like'... if (cv1 === cv1 || cv2 === cv2) { return (cv1 === cv2); @@ -3285,20 +3204,19 @@ function aeqHelper(prop1, prop2) { cv2 = prop2.toString(); return (cv1 == cv2); } -/** Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. +/** + * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. * In the future we might want $lt and $gt ops to use their own functionality/helper. * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another. * @hidden */ function ltHelper(prop1, prop2, equal) { - let cv1; - let cv2; - let t1; - let t2; // if one of the params is falsy or strictly true or not equal to itself // 0, 0.0, "", NaN, null, undefined, not defined, false, true if (!prop1 || !prop2 || prop1 === true || prop2 === true || prop1 !== prop1 || prop2 !== prop2) { + let t1; + let t2; switch (prop1) { case undefined: t1 = 1; @@ -3346,8 +3264,8 @@ function ltHelper(prop1, prop2, equal) { } } // if both are numbers (string encoded or not), compare as numbers - cv1 = Number(prop1); - cv2 = Number(prop2); + let cv1 = Number(prop1); + let cv2 = Number(prop2); if (cv1 === cv1 && cv2 === cv2) { if (cv1 < cv2) return true; @@ -3380,18 +3298,16 @@ function ltHelper(prop1, prop2, equal) { } /** * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @param {boolean} equal * @returns {boolean} */ function gtHelper(prop1, prop2, equal) { - let cv1; - let cv2; - let t1; - let t2; // 'falsy' and Boolean handling if (!prop1 || !prop2 || prop1 === true || prop2 === true || prop1 !== prop1 || prop2 !== prop2) { + let t1; + let t2; switch (prop1) { case undefined: t1 = 1; @@ -3439,8 +3355,8 @@ function gtHelper(prop1, prop2, equal) { } } // if both are numbers (string encoded or not), compare as numbers - cv1 = Number(prop1); - cv2 = Number(prop2); + let cv1 = Number(prop1); + let cv2 = Number(prop2); if (cv1 === cv1 && cv2 === cv2) { if (cv1 > cv2) return true; @@ -3473,20 +3389,21 @@ function gtHelper(prop1, prop2, equal) { return false; } /** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 - * @param {ANY} desc + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} descending * @returns {number} + * @hidden */ -function sortHelper(prop1, prop2, desc) { - if (aeqHelper(prop1, prop2)) +function sortHelper(prop1, prop2, descending) { + if (aeqHelper(prop1, prop2)) { return 0; + } if (ltHelper(prop1, prop2, false)) { - return (desc) ? (1) : (-1); + return descending ? 1 : -1; } if (gtHelper(prop1, prop2, false)) { - return (desc) ? (-1) : (1); + return descending ? -1 : 1; } // not lt, not gt so implied equality-- date compatible return 0; @@ -3520,7 +3437,7 @@ const PLUGINS = create(); /* harmony export (immutable) */ __webpack_exports__["a"] = PLUGINS; -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(3))) +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(2))) /***/ }), /* 7 */ @@ -3534,8 +3451,9 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Collection", function() { return __WEBPACK_IMPORTED_MODULE_1__collection__["a"]; }); +__WEBPACK_IMPORTED_MODULE_0__loki__["a" /* Loki */]["Collection"] = __WEBPACK_IMPORTED_MODULE_1__collection__["a" /* Collection */]; -/* harmony default export */ __webpack_exports__["default"] = ({ Loki: __WEBPACK_IMPORTED_MODULE_0__loki__["a" /* Loki */] }); +/* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__loki__["a" /* Loki */]); /***/ }), @@ -3546,28 +3464,29 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__event_emitter__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__collection__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_plugin__ = __webpack_require__(6); +/* global global */ function getENV() { if (global !== undefined && (global["android"] || global["NSObject"])) { - return Loki.Environment.NATIVE_SCRIPT; + return "NATIVESCRIPT"; } const isNode = global !== undefined && ({}).toString.call(global) === "[object global]"; if (isNode) { if (global["window"]) { - return Loki.Environment.NODE_JS; //node-webkit + return "NODEJS"; //node-webkit } else { - return Loki.Environment.NODE_JS; + return "NODEJS"; } } const isBrowser = window !== undefined && ({}).toString.call(window) === "[object Window]"; if (document !== undefined) { if (document.URL.indexOf("http://") === -1 && document.URL.indexOf("https://") === -1) { - return Loki.Environment.CORDOVA; + return "CORDOVA"; } - return Loki.Environment.BROWSER; + return "BROWSER"; } if (!isBrowser) { throw SyntaxError("Unknown environment..."); @@ -3578,7 +3497,7 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent * Constructs the main database class. * @param {string} filename - name of the file to be saved to * @param {object} [options={}] - options - * @param {Loki.Environment} [options.env=auto] - overrides environment detection + * @param {Loki.Environment} [options.env] - the javascript environment * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method * @param {string} [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization * @param {boolean} [options.verbose=false] - enable console output @@ -3588,7 +3507,7 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent this.filename = filename; this._collections = []; ({ - serializationMethod: this._serializationMethod = Loki.SerializationMethod.NORMAL, + serializationMethod: this._serializationMethod = "normal", destructureDelimiter: this._destructureDelimiter = "$<\n", verbose: this._verbose = false, env: this._env = getENV() @@ -3645,19 +3564,19 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent persistenceMethod: this._persistenceMethod, // TODO //inflate: this.options.inflate, - throttledSaves: this._throttledSaves = true, + throttledSaves: this._throttledSaves = true } = options); const DEFAULT_PERSISTENCE = { - [Loki.Environment.NODE_JS]: [Loki.PersistenceMethod.FS_STORAGE], - [Loki.Environment.BROWSER]: [Loki.PersistenceMethod.LOCAL_STORAGE, Loki.PersistenceMethod.INDEXED_STORAGE], - [Loki.Environment.CORDOVA]: [Loki.PersistenceMethod.LOCAL_STORAGE, Loki.PersistenceMethod.INDEXED_STORAGE], - [Loki.Environment.MEMORY]: [Loki.PersistenceMethod.MEMORY_STORAGE] + "NODEJS": ["fs-storage"], + "BROWSER": ["local-storage", "indexed-storage"], + "CORDOVA": ["local-storage", "indexed-storage"], + "MEMORY": ["memory-storage"] }; const PERSISTENCE_METHODS = { - [Loki.PersistenceMethod.FS_STORAGE]: __WEBPACK_IMPORTED_MODULE_2__common_plugin__["a" /* PLUGINS */]["LokiFSStorage"], - [Loki.PersistenceMethod.LOCAL_STORAGE]: __WEBPACK_IMPORTED_MODULE_2__common_plugin__["a" /* PLUGINS */]["LokiLocalStorage"], - [Loki.PersistenceMethod.INDEXED_STORAGE]: __WEBPACK_IMPORTED_MODULE_2__common_plugin__["a" /* PLUGINS */]["LokiIndexedStorage"], - [Loki.PersistenceMethod.MEMORY_STORAGE]: __WEBPACK_IMPORTED_MODULE_2__common_plugin__["a" /* PLUGINS */]["LokiMemoryStorage"] + "fs-storage": __WEBPACK_IMPORTED_MODULE_2__common_plugin__["a" /* PLUGINS */]["FSStorage"], + "local-storage": __WEBPACK_IMPORTED_MODULE_2__common_plugin__["a" /* PLUGINS */]["LocalStorage"], + "indexed-storage": __WEBPACK_IMPORTED_MODULE_2__common_plugin__["a" /* PLUGINS */]["IndexedStorage"], + "memory-storage": __WEBPACK_IMPORTED_MODULE_2__common_plugin__["a" /* PLUGINS */]["MemoryStorage"] }; // process the options if (this._persistenceMethod !== undefined) { @@ -3671,7 +3590,7 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent } // if user passes adapter, set persistence mode to adapter and retain persistence adapter instance if (options.adapter !== undefined) { - this._persistenceMethod = Loki.PersistenceMethod.ADAPTER; + this._persistenceMethod = "adapter"; this._persistenceAdapter = options.adapter; } // if by now there is no adapter specified by user nor derived from persistenceMethod: use sensible defaults @@ -3688,7 +3607,8 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent } } this.autosaveDisable(); - // if they want to load database on loki instantiation, now is a good time to load... after adapter set and before possible autosave initiation + // if they want to load database on loki instantiation, now is a good time to load... after adapter set and before + // possible autosave initiation let loaded; if (options.autoload) { loaded = this.loadDatabase(options.inflate); @@ -3760,7 +3680,7 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent getCollection(collectionName) { let i; const len = this._collections.length; - for (i = 0; i < len; i += 1) { + for (i = 0; i < len; i++) { if (this._collections[i].name === collectionName) { return this._collections[i]; } @@ -3787,7 +3707,7 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent for (let i = 0; i < this._collections.length; i++) { colls.push({ name: this._collections[i].name, - count: this._collections[i].data.length + count: this._collections[i].count() }); } return colls; @@ -3797,7 +3717,7 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent * @param {string} collectionName - name of collection to remove */ removeCollection(collectionName) { - for (let i = 0; i < this._collections.length; i += 1) { + for (let i = 0; i < this._collections.length; i++) { if (this._collections[i].name === collectionName) { const tmpcol = new __WEBPACK_IMPORTED_MODULE_1__collection__["a" /* Collection */](collectionName, {}); const curcol = this._collections[i]; @@ -3824,11 +3744,11 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent options.serializationMethod = this._serializationMethod; } switch (options.serializationMethod) { - case Loki.SerializationMethod.NORMAL: + case "normal": return JSON.stringify(this); - case Loki.SerializationMethod.PRETTY: + case "pretty": return JSON.stringify(this, null, 2); - case Loki.SerializationMethod.DESTRUCTURED: + case "destructured": return this.serializeDestructured(); // use default options default: return JSON.stringify(this); @@ -3848,7 +3768,7 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent _persistenceAdapter: this._persistenceAdapter, _persistenceMethod: this._persistenceMethod, _throttledSaves: this._throttledSaves, - _verbose: this._verbose, + _verbose: this._verbose }; } /** @@ -3887,20 +3807,20 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent let dbcopy = new Loki(this.filename); dbcopy.loadJSONObject(this); for (let idx = 0; idx < dbcopy._collections.length; idx++) { - dbcopy._collections[idx].data = []; + dbcopy._collections[idx]._data = []; } // if we -only- wanted the db container portion, return it now if (options.partitioned === true && options.partition === -1) { // since we are deconstructing, override serializationMethod to normal for here return dbcopy.serialize({ - serializationMethod: Loki.SerializationMethod.NORMAL + serializationMethod: "normal" }); } // at this point we must be deconstructing the entire database // start by pushing db serialization into first array element const reconstruct = []; reconstruct.push(dbcopy.serialize({ - serializationMethod: Loki.SerializationMethod.NORMAL + serializationMethod: "normal" })); dbcopy = null; // push collection data into subsequent elements @@ -3966,19 +3886,16 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection. */ serializeCollection(options = {}) { - let doccount; - let docidx; - let resultlines = []; if (options.delimited === undefined) { options.delimited = true; } if (options.collectionIndex === undefined) { throw new Error("serializeCollection called without 'collectionIndex' option"); } - doccount = this._collections[options.collectionIndex].data.length; - resultlines = []; - for (docidx = 0; docidx < doccount; docidx++) { - resultlines.push(JSON.stringify(this._collections[options.collectionIndex].data[docidx])); + const doccount = this._collections[options.collectionIndex].count(); + let resultlines = []; + for (let docidx = 0; docidx < doccount; docidx++) { + resultlines.push(JSON.stringify(this._collections[options.collectionIndex]._data[docidx])); } // D and DA if (options.delimited) { @@ -4007,14 +3924,6 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array */ deserializeDestructured(destructuredSource, options = {}) { - let workarray = []; - let len; - let cdb; - let collIndex = 0; - let collCount; - let lineIndex = 1; - let done = false; - let currObject; if (options.partitioned === undefined) { options.partitioned = false; } @@ -4033,30 +3942,29 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent if (options.partition !== undefined) { // db only if (options.partition === -1) { - cdb = JSON.parse(destructuredSource[0]); - return cdb; + return JSON.parse(destructuredSource[0]); } // single collection, return doc array return this.deserializeCollection(destructuredSource[options.partition + 1], options); } // Otherwise we are restoring an entire partitioned db - cdb = JSON.parse(destructuredSource[0]); - collCount = cdb._collections.length; - for (collIndex = 0; collIndex < collCount; collIndex++) { + const cdb = JSON.parse(destructuredSource[0]); + const collCount = cdb._collections.length; + for (let collIndex = 0; collIndex < collCount; collIndex++) { // attach each collection docarray to container collection data, add 1 to collection array index since db is at 0 - cdb._collections[collIndex].data = this.deserializeCollection(destructuredSource[collIndex + 1], options); + cdb._collections[collIndex]._data = this.deserializeCollection(destructuredSource[collIndex + 1], options); } return cdb; } // Non-Partitioned // D : one big Delimited string { partitioned: false, delimited : true } // NDA : Non-Delimited Array : one iterable array with empty string collection partitions { partitioned: false, delimited: false } + let workarray = []; // D if (options.delimited) { workarray = destructuredSource.split(options.delimiter); destructuredSource = null; // lower memory pressure - len = workarray.length; - if (len === 0) { + if (workarray.length === 0) { return null; } } @@ -4064,9 +3972,12 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent workarray = destructuredSource; } // first line is database and collection shells - cdb = JSON.parse(workarray[0]); - collCount = cdb._collections.length; + const cdb = JSON.parse(workarray[0]); + const collCount = cdb._collections.length; workarray[0] = null; + let collIndex = 0; + let lineIndex = 1; + let done = false; while (!done) { // empty string indicates either end of collection or end of file if (workarray[lineIndex] === "") { @@ -4076,8 +3987,7 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent } } else { - currObject = JSON.parse(workarray[lineIndex]); - cdb._collections[collIndex].data.push(currObject); + cdb._collections[collIndex]._data.push(JSON.parse(workarray[lineIndex])); } // lower memory pressure and advance iterator workarray[lineIndex++] = null; @@ -4132,11 +4042,11 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent else { // using option defined in instantiated db not what was in serialized db switch (this._serializationMethod) { - case Loki.SerializationMethod.NORMAL: - case Loki.SerializationMethod.PRETTY: + case "normal": + case "pretty": dbObject = JSON.parse(serializedDb); break; - case Loki.SerializationMethod.DESTRUCTURED: + case "destructured": dbObject = this.deserializeDestructured(serializedDb); break; default: @@ -4146,13 +4056,6 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent } this.loadJSONObject(dbObject, options); } - /** - * Inflates a loki database from a JS object - * - * @param {object} dbObject - a serialized loki database string - * @param {object} options - apply or override collection level settings - * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved - */ loadJSONObject(dbObject, options = {}) { const len = dbObject._collections ? dbObject._collections.length : 0; this.filename = dbObject.filename; @@ -4441,32 +4344,8 @@ class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEvent } /* harmony export (immutable) */ __webpack_exports__["a"] = Loki; -(function (Loki) { - let SerializationMethod; - (function (SerializationMethod) { - SerializationMethod[SerializationMethod["NORMAL"] = 0] = "NORMAL"; - SerializationMethod[SerializationMethod["PRETTY"] = 1] = "PRETTY"; - SerializationMethod[SerializationMethod["DESTRUCTURED"] = 2] = "DESTRUCTURED"; - })(SerializationMethod = Loki.SerializationMethod || (Loki.SerializationMethod = {})); - let PersistenceMethod; - (function (PersistenceMethod) { - PersistenceMethod[PersistenceMethod["FS_STORAGE"] = 0] = "FS_STORAGE"; - PersistenceMethod[PersistenceMethod["LOCAL_STORAGE"] = 1] = "LOCAL_STORAGE"; - PersistenceMethod[PersistenceMethod["INDEXED_STORAGE"] = 2] = "INDEXED_STORAGE"; - PersistenceMethod[PersistenceMethod["MEMORY_STORAGE"] = 3] = "MEMORY_STORAGE"; - PersistenceMethod[PersistenceMethod["ADAPTER"] = 4] = "ADAPTER"; - })(PersistenceMethod = Loki.PersistenceMethod || (Loki.PersistenceMethod = {})); - let Environment; - (function (Environment) { - Environment[Environment["NODE_JS"] = 0] = "NODE_JS"; - Environment[Environment["NATIVE_SCRIPT"] = 1] = "NATIVE_SCRIPT"; - Environment[Environment["BROWSER"] = 2] = "BROWSER"; - Environment[Environment["CORDOVA"] = 3] = "CORDOVA"; - Environment[Environment["MEMORY"] = 4] = "MEMORY"; - })(Environment = Loki.Environment || (Loki.Environment = {})); -})(Loki || (Loki = {})); -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(3))) +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(2))) /***/ }), /* 9 */ @@ -4551,7 +4430,7 @@ class UniqueIndex { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__event_emitter__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__resultset__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__result_set__ = __webpack_require__(3); /** @@ -4568,6 +4447,9 @@ class UniqueIndex { * @extends LokiEventEmitter * @see {@link Collection#addDynamicView} to construct instances of DynamicView + * + * @param - the data type + * @param - nested properties of data type */ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* LokiEventEmitter */] { /** @@ -4576,14 +4458,14 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo * @param {string} name - the name of this dynamic view * @param {object} options - the options * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' - * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority + * @param {string} [options.sortPriority="passive"] - the sort priority * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here) */ constructor(collection, name, options = {}) { super(); ({ persistent: this._persistent = false, - sortPriority: this._sortPriority = DynamicView.SortPriority.PASSIVE, + sortPriority: this._sortPriority = "passive", minRebuildInterval: this._minRebuildInterval = 1 } = options); this._collection = collection; @@ -4591,11 +4473,10 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo this._rebuildPending = false; // 'passive' will defer the sort phase until they call data(). (most efficient overall) // 'active' will sort async whenever next idle. (prioritizes read speeds) - // sortPriority: this._sortPriority = DynamicView.SortPriority.PASSIVE, - this._resultset = new __WEBPACK_IMPORTED_MODULE_1__resultset__["a" /* Resultset */](collection); - this._resultdata = []; - this._resultsdirty = false; - this._cachedresultset = null; + this._resultSet = new __WEBPACK_IMPORTED_MODULE_1__result_set__["a" /* ResultSet */](collection); + this._resultData = []; + this._resultDirty = false; + this._cachedResultSet = null; // keep ordered filter pipeline this._filterPipeline = []; // sorting member variables @@ -4621,20 +4502,16 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo * @fires DynamicView.rebuild */ _rematerialize({ removeWhereFilters = false }) { - let fpl; - let fpi; - let idx; - this._resultdata = []; - this._resultsdirty = true; - this._resultset = new __WEBPACK_IMPORTED_MODULE_1__resultset__["a" /* Resultset */](this._collection); + this._resultData = []; + this._resultDirty = true; + this._resultSet = new __WEBPACK_IMPORTED_MODULE_1__result_set__["a" /* ResultSet */](this._collection); if (this._sortFunction || this._sortCriteria || this._sortByScoring !== null) { this._sortDirty = true; } if (removeWhereFilters) { // for each view see if it had any where filters applied... since they don't // serialize those functions lets remove those invalid filters - fpl = this._filterPipeline.length; - fpi = fpl; + let fpi = this._filterPipeline.length; while (fpi--) { if (this._filterPipeline[fpi].type === "where") { if (fpi !== this._filterPipeline.length - 1) { @@ -4648,8 +4525,7 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo const ofp = this._filterPipeline; this._filterPipeline = []; // now re-apply 'find' filterPipeline ops - fpl = ofp.length; - for (idx = 0; idx < fpl; idx++) { + for (let idx = 0; idx < ofp.length; idx++) { this.applyFind(ofp[idx].val); } // during creation of unit tests, i will remove this forced refresh and leave lazy @@ -4659,24 +4535,23 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo return this; } /** - * Makes a copy of the internal resultset for branched queries. - * Unlike this dynamic view, the branched resultset will not be 'live' updated, + * Makes a copy of the internal ResultSet for branched queries. + * Unlike this dynamic view, the branched ResultSet will not be 'live' updated, * so your branched query should be immediately resolved and not held for future evaluation. * * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps * @param {object} parameters - optional parameters (if optional transform requires them) - * @returns {Resultset} A copy of the internal resultset for branched queries. + * @returns {ResultSet} A copy of the internal ResultSet for branched queries. */ - branchResultset(transform, parameters) { - const rs = this._resultset.branch(); + branchResultSet(transform, parameters) { + const rs = this._resultSet.branch(); if (transform === undefined) { return rs; } return rs.transform(transform, parameters); } /** - * toJSON() - Override of toJSON to avoid circular references - * + * Override of toJSON to avoid circular references. */ toJSON() { return { @@ -4684,8 +4559,7 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo _persistent: this._persistent, _sortPriority: this._sortPriority, _minRebuildInterval: this._minRebuildInterval, - _resultset: this._resultset, - _resultsdirty: true, + _resultSet: this._resultSet, _filterPipeline: this._filterPipeline, _sortCriteria: this._sortCriteria, _sortByScoring: this._sortByScoring, @@ -4693,15 +4567,15 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo }; } static fromJSONObject(collection, obj) { - let dv = new DynamicView(collection, obj.name, obj.options); - dv._resultsdirty = obj._resultsdirty; + let dv = new DynamicView(collection, obj.name); + dv._resultDirty = true; dv._filterPipeline = obj._filterPipeline; - dv._resultdata = []; + dv._resultData = []; dv._sortCriteria = obj._sortCriteria; dv._sortByScoring = obj._sortByScoring; dv._sortDirty = obj._sortDirty; - dv._resultset.filteredrows = obj._resultset.filteredrows; - dv._resultset.filterInitialized = obj._resultset.filterInitialized; + dv._resultSet._filteredRows = obj._resultSet._filteredRows; + dv._resultSet._filterInitialized = obj._resultSet._filterInitialized; dv._rematerialize({ removeWhereFilters: true }); @@ -4714,10 +4588,10 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo */ removeFilters({ queueSortPhase = false } = {}) { this._rebuildPending = false; - this._resultset.reset(); - this._resultdata = []; - this._resultsdirty = true; - this._cachedresultset = null; + this._resultSet.reset(); + this._resultData = []; + this._resultDirty = true; + this._cachedResultSet = null; // keep ordered filter pipeline this._filterPipeline = []; // sorting member variables @@ -4768,7 +4642,7 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo return this; } /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * dv.applySortCriteria(['age', 'name']); @@ -4803,14 +4677,14 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo * @returns {ScoreResult} */ getScoring() { - return this._resultset.getScoring(); + return this._resultSet.getScoring(); } /** * Marks the beginning of a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ startTransaction() { - this._cachedresultset = this._resultset.copy(); + this._cachedResultSet = this._resultSet.copy(); return this; } /** @@ -4818,7 +4692,7 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo * @returns {DynamicView} this DynamicView object, for further chain ops. */ commit() { - this._cachedresultset = null; + this._cachedResultSet = null; return this; } /** @@ -4826,11 +4700,11 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo * @returns {DynamicView} this DynamicView object, for further chain ops. */ rollback() { - this._resultset = this._cachedresultset; + this._resultSet = this._cachedResultSet; if (this._persistent) { // for now just rebuild the persistent dynamic view data in this worst case scenario // (a persistent view utilizing transactions which get rolled back), we already know the filter so not too bad. - this._resultdata = this._resultset.data(); + this._resultData = this._resultSet.data(); this.emit("rebuild", this); } return this; @@ -4843,7 +4717,7 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo */ _indexOfFilterWithId(uid) { if (typeof uid === "string" || typeof uid === "number") { - for (let idx = 0, len = this._filterPipeline.length; idx < len; idx += 1) { + for (let idx = 0, len = this._filterPipeline.length; idx < len; idx++) { if (uid === this._filterPipeline[idx].uid) { return idx; } @@ -4852,13 +4726,13 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo return -1; } /** - * Add the filter object to the end of view's filter pipeline and apply the filter to the resultset. + * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet. * * @param {object} filter - The filter object. Refer to applyFilter() for extra details. */ _addFilter(filter) { this._filterPipeline.push(filter); - this._resultset[filter.type](filter.val); + this._resultSet[filter.type](filter.val); } /** * Reapply all the filters in the current pipeline. @@ -4866,15 +4740,15 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo * @returns {DynamicView} this DynamicView object, for further chain ops. */ reapplyFilters() { - this._resultset.reset(); - this._cachedresultset = null; + this._resultSet.reset(); + this._cachedResultSet = null; if (this._persistent) { - this._resultdata = []; - this._resultsdirty = true; + this._resultData = []; + this._resultDirty = true; } const filters = this._filterPipeline; this._filterPipeline = []; - for (let idx = 0, len = filters.length; idx < len; idx += 1) { + for (let idx = 0, len = filters.length; idx < len; idx++) { this._addFilter(filters[idx]); } if (this._sortFunction || this._sortCriteria || this._sortByScoring !== null) { @@ -4898,10 +4772,10 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo this._filterPipeline[idx] = filter; return this.reapplyFilters(); } - this._cachedresultset = null; + this._cachedResultSet = null; if (this._persistent) { - this._resultdata = []; - this._resultsdirty = true; + this._resultData = []; + this._resultDirty = true; } this._addFilter(filter); if (this._sortFunction || this._sortCriteria || this._sortByScoring !== null) { @@ -4963,33 +4837,33 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo */ count() { // in order to be accurate we will pay the minimum cost (and not alter dv state management) - // recurring resultset data resolutions should know internally its already up to date. + // recurring ResultSet data resolutions should know internally its already up to date. // for persistent data this will not update resultdata nor fire rebuild event. - if (this._resultsdirty) { - this._resultdata = this._resultset.data(); + if (this._resultDirty) { + this._resultData = this._resultSet.data(); } - return this._resultset.count(); + return this._resultSet.count(); } /** * Resolves and pending filtering and sorting, then returns document array as result. * - * @param {object} options - optional parameters to pass to resultset.data() if non-persistent - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * * @returns {Array} An array of documents representing the current DynamicView contents. */ data(options = {}) { // using final sort phase as 'catch all' for a few use cases which require full rebuild - if (this._sortDirty || this._resultsdirty) { + if (this._sortDirty || this._resultDirty) { this._performSortPhase({ suppressRebuildEvent: true }); } - return (this._persistent) ? (this._resultdata) : (this._resultset.data(options)); + return (this._persistent) ? (this._resultData) : (this._resultSet.data(options)); } /** * When the view is not sorted we may still wish to be notified of rebuild events. @@ -5018,7 +4892,7 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo return; } this._sortDirty = true; - if (this._sortPriority === DynamicView.SortPriority.ACTIVE) { + if (this._sortPriority === "active") { // active sorting... once they are done and yield js thread, run async performSortPhase() setTimeout(() => { this._performSortPhase(); @@ -5035,25 +4909,25 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo */ _performSortPhase(options = {}) { // async call to this may have been pre-empted by synchronous call to data before async could fire - if (!this._sortDirty && !this._resultsdirty) { + if (!this._sortDirty && !this._resultDirty) { return; } if (this._sortDirty) { if (this._sortFunction) { - this._resultset.sort(this._sortFunction); + this._resultSet.sort(this._sortFunction); } else if (this._sortCriteria) { - this._resultset.compoundsort(this._sortCriteria); + this._resultSet.compoundsort(this._sortCriteria); } else if (this._sortByScoring !== null) { - this._resultset.sortByScoring(this._sortByScoring); + this._resultSet.sortByScoring(this._sortByScoring); } this._sortDirty = false; } if (this._persistent) { // persistent view, rebuild local resultdata array - this._resultdata = this._resultset.data(); - this._resultsdirty = false; + this._resultData = this._resultSet.data(); + this._resultDirty = false; } if (!options.suppressRebuildEvent) { this.emit("rebuild", this); @@ -5068,9 +4942,9 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo */ _evaluateDocument(objIndex, isNew) { // if no filter applied yet, the result 'set' should remain 'everything' - if (!this._resultset.filterInitialized) { + if (!this._resultSet._filterInitialized) { if (this._persistent) { - this._resultdata = this._resultset.data(); + this._resultData = this._resultSet.data(); } // need to re-sort to sort new document if (this._sortFunction || this._sortCriteria) { @@ -5081,29 +4955,29 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo } return; } - const ofr = this._resultset.filteredrows; + const ofr = this._resultSet._filteredRows; const oldPos = (isNew) ? (-1) : (ofr.indexOf(+objIndex)); const oldlen = ofr.length; - // creating a 1-element resultset to run filter chain ops on to see if that doc passes filters; + // creating a 1-element ResultSet to run filter chain ops on to see if that doc passes filters; // mostly efficient algorithm, slight stack overhead price (this function is called on inserts and updates) - const evalResultset = new __WEBPACK_IMPORTED_MODULE_1__resultset__["a" /* Resultset */](this._collection); - evalResultset.filteredrows = [objIndex]; - evalResultset.filterInitialized = true; + const evalResultSet = new __WEBPACK_IMPORTED_MODULE_1__result_set__["a" /* ResultSet */](this._collection); + evalResultSet._filteredRows = [objIndex]; + evalResultSet._filterInitialized = true; let filter; for (let idx = 0, len = this._filterPipeline.length; idx < len; idx++) { filter = this._filterPipeline[idx]; - evalResultset[filter.type](filter.val); + evalResultSet[filter.type](filter.val); } // not a true position, but -1 if not pass our filter(s), 0 if passed filter(s) - const newPos = (evalResultset.filteredrows.length === 0) ? -1 : 0; + const newPos = (evalResultSet._filteredRows.length === 0) ? -1 : 0; // wasn't in old, shouldn't be now... do nothing if (oldPos === -1 && newPos === -1) return; - // wasn't in resultset, should be now... add + // wasn't in ResultSet, should be now... add if (oldPos === -1 && newPos !== -1) { ofr.push(objIndex); if (this._persistent) { - this._resultdata.push(this._collection.data[objIndex]); + this._resultData.push(this._collection._data[objIndex]); } // need to re-sort to sort new document if (this._sortFunction || this._sortCriteria) { @@ -5114,18 +4988,18 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo } return; } - // was in resultset, shouldn't be now... delete + // was in ResultSet, shouldn't be now... delete if (oldPos !== -1 && newPos === -1) { if (oldPos < oldlen - 1) { ofr.splice(oldPos, 1); if (this._persistent) { - this._resultdata.splice(oldPos, 1); + this._resultData.splice(oldPos, 1); } } else { ofr.length = oldlen - 1; if (this._persistent) { - this._resultdata.length = oldlen - 1; + this._resultData.length = oldlen - 1; } } // in case changes to data altered a sort column @@ -5137,11 +5011,11 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo } return; } - // was in resultset, should still be now... (update persistent only?) + // was in ResultSet, should still be now... (update persistent only?) if (oldPos !== -1 && newPos !== -1) { if (this._persistent) { - // in case document changed, replace persistent view data with the latest collection.data document - this._resultdata[oldPos] = this._collection.data[objIndex]; + // in case document changed, replace persistent view data with the latest collection._data document + this._resultData[oldPos] = this._collection._data[objIndex]; } // in case changes to data altered a sort column if (this._sortFunction || this._sortCriteria) { @@ -5157,9 +5031,9 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo */ _removeDocument(objIndex) { // if no filter applied yet, the result 'set' should remain 'everything' - if (!this._resultset.filterInitialized) { + if (!this._resultSet._filterInitialized) { if (this._persistent) { - this._resultdata = this._resultset.data(); + this._resultData = this._resultSet.data(); } // in case changes to data altered a sort column if (this._sortFunction || this._sortCriteria) { @@ -5170,24 +5044,23 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo } return; } - const ofr = this._resultset.filteredrows; + const ofr = this._resultSet._filteredRows; const oldPos = ofr.indexOf(+objIndex); let oldlen = ofr.length; - let idx; if (oldPos !== -1) { // if not last row in resultdata, swap last to hole and truncate last row if (oldPos < oldlen - 1) { ofr[oldPos] = ofr[oldlen - 1]; ofr.length = oldlen - 1; if (this._persistent) { - this._resultdata[oldPos] = this._resultdata[oldlen - 1]; - this._resultdata.length = oldlen - 1; + this._resultData[oldPos] = this._resultData[oldlen - 1]; + this._resultData.length = oldlen - 1; } } else { ofr.length = oldlen - 1; if (this._persistent) { - this._resultdata.length = oldlen - 1; + this._resultData.length = oldlen - 1; } } // in case changes to data altered a sort column @@ -5198,11 +5071,11 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo this._queueRebuildEvent(); } } - // since we are using filteredrows to store data array positions + // since we are using filteredRows to store data array positions // if they remove a document (whether in our view or not), // we need to adjust array positions -1 for all document array references after that position oldlen = ofr.length; - for (idx = 0; idx < oldlen; idx++) { + for (let idx = 0; idx < oldlen; idx++) { if (ofr[idx] > objIndex) { ofr[idx]--; } @@ -5226,13 +5099,6 @@ class DynamicView extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a" /* Lo } /* harmony export (immutable) */ __webpack_exports__["a"] = DynamicView; -(function (DynamicView) { - let SortPriority; - (function (SortPriority) { - SortPriority[SortPriority["PASSIVE"] = 0] = "PASSIVE"; - SortPriority[SortPriority["ACTIVE"] = 1] = "ACTIVE"; - })(SortPriority = DynamicView.SortPriority || (DynamicView.SortPriority = {})); -})(DynamicView || (DynamicView = {})); /***/ }) diff --git a/dist/packages/loki/lokijs.loki.js.map b/dist/packages/loki/lokijs.loki.js.map index 950dbb78..19d4ed2f 100644 --- a/dist/packages/loki/lokijs.loki.js.map +++ b/dist/packages/loki/lokijs.loki.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 1ac6fef0809affa3cb67","webpack:///./packages/loki/src/event_emitter.ts","webpack:///./packages/loki/src/collection.ts","webpack:///./packages/loki/src/clone.ts","webpack:///(webpack)/buildin/global.js","webpack:///./packages/loki/src/resultset.ts","webpack:///./packages/loki/src/helper.ts","webpack:///./packages/common/plugin.ts","webpack:///./packages/loki/src/index.ts","webpack:///./packages/loki/src/loki.ts","webpack:///./packages/loki/src/unique_index.ts","webpack:///./packages/loki/src/dynamic_view.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;AC3DA;;;;;;GAMG;AACG;IAYJ;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACH,EAAE,CAAC,SAA4B,EAAE,QAAkB;QACjD,IAAI,KAAK,CAAC;QAEV,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAC7B,SAAS,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,EAAE;gBACrC,IAAI,CAAC,EAAE,CAAC,gBAAgB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AAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;gBAC7C,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5B,CAAC;QACH,CAAC;QAED,gEAAgE;QAChE,0DAA0D;QAC1D,6FAA6F;QAC7F,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QACpB,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;YAClC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;gBACxB,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACb,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,SAAS,CAAO,WAAsD,EAAE,cAAiC;QAC9G,IAAI,CAAC;YACH,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;QACtD,CAAC;QAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACb,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AAAA;AAAA;AAED,WAAiB,WAAW;IAO1B,IAAY,YAGX;IAHD,WAAY,YAAY;QACtB,qDAAO;QACP,mDAAM;IACR,CAAC,EAHW,YAAY,GAAZ,wBAAY,KAAZ,wBAAY,QAGvB;AACH,CAAC,EAXgB,WAAW,KAAX,WAAW,QAW3B","file":"lokijs.loki.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/loki\"] = factory();\n\telse\n\t\troot[\"@lokijs/loki\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 7);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1ac6fef0809affa3cb67","export type ANY = any;\n\n/**\n * LokiEventEmitter is a minimalist version of EventEmitter. It enables any\n * constructor that inherits EventEmitter to emit events and trigger\n * listeners that have been added to the event through the on(event, callback) method\n *\n * @constructor LokiEventEmitter\n */\nexport class LokiEventEmitter {\n /**\n * A map, with each property being an array of callbacks.\n */\n protected events: object;\n\n /**\n * Determines whether or not the callbacks associated with each event should happen in an async fashion or not.\n * Default is false, which means events are synchronous\n */\n protected asyncListeners: boolean;\n\n constructor() {\n this.events = {};\n this.asyncListeners = false;\n }\n\n /**\n * on(eventName, listener) - adds a listener to the queue of callbacks associated to an event\n * @param {string|string[]} eventName - the name(s) of the event(s) to listen to\n * @param {function} listener - callback function of listener to attach\n * @returns {int} the index of the callback in the array of listeners for a particular event\n */\n on(eventName: string | string[], listener: Function) {\n let event;\n\n if (Array.isArray(eventName)) {\n eventName.forEach((currentEventName) => {\n this.on(currentEventName, listener);\n });\n return listener;\n }\n\n event = this.events[eventName];\n if (!event) {\n event = this.events[eventName] = [];\n }\n event.push(listener);\n return listener;\n }\n\n /**\n * emit(eventName, data) - emits a particular event\n * with the option of passing optional parameters which are going to be processed by the callback\n * provided signatures match (i.e. if passing emit(event, arg0, arg1) the listener should take two parameters)\n * @param {string} eventName - the name of the event\n * @param {object} data - optional object passed with the event\n */\n emit(eventName: string, ...data: ANY[]) {\n if (eventName && this.events[eventName]) {\n this.events[eventName].forEach((listener: Function) => {\n if (this.asyncListeners) {\n setTimeout(() => {\n listener(...data);\n }, 1);\n } else {\n listener(...data);\n }\n\n });\n }\n }\n\n /**\n * Alias of LokiEventEmitter.prototype.on\n * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event\n * @param {string|string[]} eventName - the name(s) of the event(s) to listen to\n * @param {function} listener - callback function of listener to attach\n * @returns {int} the index of the callback in the array of listeners for a particular event\n */\n addListener(eventName: string | string[], listener: Function) {\n return this.on(eventName, listener);\n }\n\n /**\n * removeListener() - removes the listener at position 'index' from the event 'eventName'\n * @param {string|string[]} eventName - the name(s) of the event(s) which the listener is attached to\n * @param {function} listener - the listener callback function to remove from emitter\n */\n removeListener(eventName: string | string[], listener: Function) {\n if (Array.isArray(eventName)) {\n eventName.forEach((currentEventName) => {\n this.removeListener(currentEventName, listener);\n });\n }\n\n if (this.events[eventName as string]) {\n const listeners = this.events[eventName as string];\n listeners.splice(listeners.indexOf(listener), 1);\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/event_emitter.ts","import {LokiEventEmitter} from \"./event_emitter\";\nimport {UniqueIndex} from \"./unique_index\";\nimport {Resultset} from \"./resultset\";\nimport {DynamicView} from \"./dynamic_view\";\nimport {ltHelper, gtHelper, aeqHelper} from \"./helper\";\nimport {Loki} from \"./loki\";\nimport {clone, CloneMethod} from \"./clone\";\nimport {Doc, Dict, Query} from \"../../common/types\";\nimport {FullTextSearch} from \"../../full-text-search/src/full_text_search\";\nimport {PLUGINS} from \"../../common/plugin\";\nimport {Tokenizer} from \"../../full-text-search/src/tokenizer\";\n\nexport type ANY = any;\nexport {CloneMethod} from \"./clone\";\n\n/**\n * General utils, including statistical functions\n */\nfunction isDeepProperty(field: string) {\n return field.indexOf(\".\") !== -1;\n}\n\nfunction average(array: number[]) {\n return (array.reduce((a, b) => a + b, 0)) / array.length;\n}\n\nfunction standardDeviation(values: number[]) {\n const avg = average(values);\n const squareDiffs = values.map((value) => {\n const diff = value - avg;\n return diff * diff;\n });\n\n const avgSquareDiff = average(squareDiffs);\n return Math.sqrt(avgSquareDiff);\n}\n\nfunction deepProperty(obj: object, property: string, isDeep: boolean) {\n if (isDeep === false) {\n // pass without processing\n return obj[property];\n }\n const pieces = property.split(\".\");\n let root = obj;\n while (pieces.length > 0) {\n root = root[pieces.shift()];\n }\n return root;\n}\n\n/**\n * Collection class that handles documents of same type\n * @extends LokiEventEmitter\n */\nexport class Collection extends LokiEventEmitter {\n\n public name: string;\n // the data held by the collection\n public data: Doc[];\n private idIndex: number[]; // index of id\n public binaryIndices: Dict; // user defined indexes\n\n /**\n * Unique contraints contain duplicate object references, so they are not persisted.\n * We will keep track of properties which have unique contraint applied here, and regenerate on load.\n */\n public constraints = {\n unique: {}\n };\n\n /**\n * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along\n * with the database.\n */\n public transforms: {};\n\n /**\n * In autosave scenarios we will use collection level dirty flags to determine whether save is needed.\n * currently, if any collection is dirty we will autosave the whole database if autosave is configured.\n * Defaulting to true since this is called from addCollection and adding a collection should trigger save.\n */\n public dirty: boolean;\n\n private cachedIndex: ANY;\n private cachedBinaryIndex: ANY;\n private cachedData: ANY;\n\n /**\n * If set to true we will optimally keep indices 'fresh' during insert/update/remove ops (never dirty/never needs rebuild).\n * If you frequently intersperse insert/update/remove ops between find ops this will likely be significantly faster option.\n */\n public adaptiveBinaryIndices: boolean;\n\n /**\n * Is collection transactional.\n */\n private transactional: boolean;\n\n\n /**\n * Options to clone objects when inserting them.\n */\n public cloneObjects: boolean;\n\n /**\n * Default clone method (if enabled) is parse-stringify.\n */\n public cloneMethod: CloneMethod;\n\n\n /**\n * Disable track changes.\n */\n private disableChangesApi: boolean;\n\n /**\n * Disable delta update object style on changes.\n */\n public disableDeltaChangesApi: ANY;\n\n /**\n * By default, if you insert a document into a collection with binary indices, if those indexed properties contain\n * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the\n * same 'after' serialization as it was 'before'.\n */\n private serializableIndices: boolean;\n\n /**\n * Option to activate a cleaner daemon - clears \"aged\" documents at set intervals.\n */\n public ttl: ANY;\n\n private maxId: number;\n private _dynamicViews: DynamicView[];\n\n /**\n * Changes are tracked by collection and aggregated by the db.\n */\n private changes: Collection.Change[];\n\n /* assign correct handler based on ChangesAPI flag */\n private insertHandler: ANY;\n private updateHandler: ANY;\n\n public console: ANY;\n private stages: object;\n private commitLog: ANY[];\n\n public _fullTextSearch: FullTextSearch;\n\n /**\n * @param {string} name - collection name\n * @param {(object)} [options={}] - a configuration object\n * @param {string[]} [options.unique=[]] - array of property names to define unique constraints for\n * @param {string[]} [options.exact=[]] - array of property names to define exact constraints for\n * @param {string[]} [options.indices=[]] - array property names to define binary indexes for\n * @param {boolean} [options.adaptiveBinaryIndices=true] - collection indices will be actively rebuilt rather than lazily\n * @param {boolean} [options.asyncListeners=false] - whether listeners are invoked asynchronously\n * @param {boolean} [options.disableChangesApi=true] - set to false to enable Changes API\n * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning)\n * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user\n * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable\n * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method\n * @param {number} [options.transactional=false] - ?\n * @param {number} options.ttl - ?\n * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default.\n * @see {@link Loki#addCollection} for normal creation of collections\n */\n constructor(name: string, options: Collection.Options = {}) {\n super();\n // the name of the collection\n this.name = name;\n // the data held by the collection\n this.data = [];\n this.idIndex = []; // index of id\n this.binaryIndices = {}; // user defined indexes\n this.constraints = {\n unique: {},\n };\n\n // .\n this.transforms = {};\n\n // .\n this.dirty = true;\n\n // private holders for cached data\n this.cachedIndex = null;\n this.cachedBinaryIndex = null;\n this.cachedData = null;\n\n /* OPTIONS */\n // exact match and unique constraints\n if (options.unique !== undefined) {\n if (!Array.isArray(options.unique)) {\n options.unique = [options.unique];\n }\n options.unique.forEach((prop: string) => {\n this.constraints.unique[prop] = new UniqueIndex(prop);\n });\n }\n\n // Full text search\n if (PLUGINS[\"FullTextSearch\"] !== undefined) {\n this._fullTextSearch = options.fullTextSearch !== undefined\n ? new (PLUGINS[\"FullTextSearch\"])(options.fullTextSearch) : null;\n } else {\n this._fullTextSearch = null;\n }\n\n // .\n this.adaptiveBinaryIndices = options.adaptiveBinaryIndices !== undefined ? options.adaptiveBinaryIndices : true;\n\n // .\n this.transactional = options.transactional !== undefined ? options.transactional : false;\n\n // .\n this.cloneObjects = options.clone !== undefined ? options.clone : false;\n\n // .\n this.asyncListeners = options.asyncListeners !== undefined ? options.asyncListeners : false;\n\n // .\n this.disableChangesApi = options.disableChangesApi !== undefined ? options.disableChangesApi : true;\n\n // .\n this.disableDeltaChangesApi = options.disableDeltaChangesApi !== undefined ? options.disableDeltaChangesApi : true;\n\n // .\n this.cloneMethod = options.cloneMethod !== undefined ? options.cloneMethod : CloneMethod.DEEP;\n if (this.disableChangesApi) {\n this.disableDeltaChangesApi = true;\n }\n\n // .\n this.serializableIndices = options.serializableIndices !== undefined ? options.serializableIndices : true;\n\n //\n this.ttl = {\n age: null,\n ttlInterval: null,\n daemon: null\n };\n this.setTTL(options.ttl || -1, options.ttlInterval);\n\n // currentMaxId - change manually at your own peril!\n this.maxId = 0;\n\n this._dynamicViews = [];\n\n // events\n this.events = {\n \"insert\": [],\n \"update\": [],\n \"pre-insert\": [],\n \"pre-update\": [],\n \"close\": [],\n \"flushbuffer\": [],\n \"error\": [],\n \"delete\": [],\n \"warning\": []\n };\n\n // .\n this.changes = [];\n\n // initialize the id index\n this.ensureId();\n let indices = options.indices ? options.indices : [];\n for (let idx = 0; idx < indices.length; idx++) {\n this.ensureIndex(options.indices[idx]);\n }\n\n this.setChangesApi(this.disableChangesApi, this.disableDeltaChangesApi);\n\n // Add change api to event callback.\n this.on(\"insert\", (obj: Doc) => {\n this.insertHandler(obj);\n });\n\n this.on(\"update\", (obj: Doc, old: Doc) => {\n this.updateHandler(obj, old);\n });\n\n this.on(\"delete\", (obj: Doc) => {\n if (!this.disableChangesApi) {\n this._createChange(this.name, \"R\", obj);\n }\n });\n\n this.on(\"warning\", (warning: ANY) => {\n this.console.warn(warning);\n });\n\n // for de-serialization purposes\n this.flushChanges();\n\n this.console = {\n log() {\n },\n warn() {\n },\n error() {\n },\n };\n\n /* ------ STAGING API -------- */\n /**\n * stages: a map of uniquely identified 'stages', which hold copies of objects to be\n * manipulated without affecting the data in the original collection\n */\n this.stages = {};\n this.commitLog = [];\n }\n\n toJSON() {\n return {\n name: this.name,\n _dynamicViews: this._dynamicViews,\n uniqueNames: Object.keys(this.constraints.unique),\n transforms: this.transforms,\n binaryIndices: this.binaryIndices,\n data: this.data,\n idIndex: this.idIndex,\n maxId: this.maxId,\n dirty: this.dirty,\n adaptiveBinaryIndices: this.adaptiveBinaryIndices,\n transactional: this.transactional,\n asyncListeners: this.asyncListeners,\n disableChangesApi: this.disableChangesApi,\n cloneObjects: this.cloneObjects,\n cloneMethod: this.cloneMethod,\n changes: this.changes,\n _fullTextSearch: this._fullTextSearch\n };\n }\n\n static fromJSONObject(obj: ANY, options?: Collection.DeserializeOptions) {\n let coll = new Collection(obj.name, {\n disableChangesApi: obj.disableChangesApi,\n disableDeltaChangesApi: obj.disableDeltaChangesApi\n });\n\n coll.adaptiveBinaryIndices = obj.adaptiveBinaryIndices !== undefined ? (obj.adaptiveBinaryIndices === true) : false;\n coll.transactional = obj.transactional;\n coll.asyncListeners = obj.asyncListeners;\n coll.disableChangesApi = obj.disableChangesApi;\n coll.cloneObjects = obj.cloneObjects;\n coll.cloneMethod = obj.cloneMethod || CloneMethod.DEEP;\n coll.changes = obj.changes;\n\n coll.dirty = (options && options.retainDirtyFlags === true) ? obj.dirty : false;\n\n function makeLoader(coll: ANY) {\n const collOptions = options[coll.name];\n\n if (collOptions.proto) {\n let inflater = collOptions.inflate || ((src: object, dest: object) => {\n for (let prop in src) {\n dest[prop] = src[prop];\n }\n });\n\n return (data: ANY) => {\n const collObj = new (collOptions.proto)();\n inflater(data, collObj);\n return collObj;\n };\n }\n\n return collOptions.inflate;\n }\n\n // load each element individually\n let clen = obj.data.length;\n let j = 0;\n if (options && options[obj.name] !== undefined) {\n let loader = makeLoader(obj);\n\n for (j; j < clen; j++) {\n coll.data[j] = loader(obj.data[j]);\n }\n } else {\n for (j; j < clen; j++) {\n coll.data[j] = obj.data[j];\n }\n }\n\n coll.maxId = (obj.maxId === undefined) ? 0 : obj.maxId;\n coll.idIndex = obj.idIndex;\n if (obj.binaryIndices !== undefined) {\n coll.binaryIndices = obj.binaryIndices;\n }\n if (obj.transforms !== undefined) {\n coll.transforms = obj.transforms;\n }\n\n coll.ensureId();\n\n // regenerate unique indexes\n if (obj.uniqueNames !== undefined) {\n for (j = 0; j < obj.uniqueNames.length; j++) {\n coll.ensureUniqueIndex(obj.uniqueNames[j]);\n }\n }\n\n // in case they are loading a database created before we added dynamic views, handle undefined\n if (obj._dynamicViews !== undefined) {\n // reinflate DynamicViews and attached Resultsets\n for (let idx = 0; idx < obj._dynamicViews.length; idx++) {\n coll._dynamicViews.push(DynamicView.fromJSONObject(coll, obj._dynamicViews[idx]));\n }\n }\n\n if (obj._fullTextSearch) {\n coll._fullTextSearch = PLUGINS[\"FullTextSearch\"].fromJSONObject(obj._fullTextSearch, options.fullTextSearch);\n }\n\n return coll;\n }\n\n /**\n * Adds a named collection transform to the collection\n * @param {string} name - name to associate with transform\n * @param {array} transform - an array of transformation 'step' objects to save into the collection\n */\n addTransform(name: string, transform: ANY[]) {\n if (this.transforms[name] !== undefined) {\n throw new Error(\"a transform by that name already exists\");\n }\n\n this.transforms[name] = transform;\n }\n\n /**\n * Retrieves a named transform from the collection.\n * @param {string} name - name of the transform to lookup.\n */\n getTransform(name: string) {\n return this.transforms[name];\n }\n\n /**\n * Updates a named collection transform to the collection\n * @param {string} name - name to associate with transform\n * @param {object} transform - a transformation object to save into collection\n */\n setTransform(name: string, transform: ANY[]) {\n this.transforms[name] = transform;\n }\n\n /**\n * Removes a named collection transform from the collection\n * @param {string} name - name of collection transform to remove\n */\n removeTransform(name: string) {\n delete this.transforms[name];\n }\n\n /*----------------------------+\n | TTL daemon |\n +----------------------------*/\n ttlDaemonFuncGen() {\n const collection = this;\n const age = this.ttl.age;\n return function ttlDaemon() {\n const now = Date.now();\n const toRemove = collection.chain().where((member: ANY) => {\n const timestamp = member.meta.updated || member.meta.created;\n const diff = now - timestamp;\n return age < diff;\n });\n toRemove.remove();\n };\n }\n\n private setTTL(age: number, interval: number) {\n if (age < 0) {\n clearInterval(this.ttl.daemon);\n } else {\n this.ttl.age = age;\n this.ttl.ttlInterval = interval;\n this.ttl.daemon = setInterval(this.ttlDaemonFuncGen(), interval);\n }\n }\n\n /*----------------------------+\n | INDEXING |\n +----------------------------*/\n\n /**\n * create a row filter that covers all documents in the collection\n */\n prepareFullDocIndex() {\n const len = this.data.length;\n const indexes = new Array(len);\n for (let i = 0; i < len; i += 1) {\n indexes[i] = i;\n }\n return indexes;\n }\n\n /**\n * Ensure binary index on a certain field\n * @param {string} property - name of property to create binary index on\n * @param {boolean} force - (Optional) flag indicating whether to construct index immediately\n */\n ensureIndex(property: string, force = false) {\n // optional parameter to force rebuild whether flagged as dirty or not\n if (property === null || property === undefined) {\n throw new Error(\"Attempting to set index without an associated property\");\n }\n\n if (this.binaryIndices[property] && !force) {\n if (!this.binaryIndices[property].dirty) return;\n }\n\n // if the index is already defined and we are using adaptiveBinaryIndices and we are not forcing a rebuild, return.\n if (this.adaptiveBinaryIndices === true && this.binaryIndices[property] !== undefined && !force) {\n return;\n }\n\n const index = {\n \"name\": property,\n \"dirty\": true,\n \"values\": this.prepareFullDocIndex()\n };\n this.binaryIndices[property] = index;\n\n const wrappedComparer =\n (((prop, data) => (a: string, b: string) => {\n let val1, val2, arr;\n if (~prop.indexOf(\".\")) {\n arr = prop.split(\".\");\n val1 = arr.reduce(function (obj, i) {\n return obj && obj[i] || undefined;\n }, data[a]);\n val2 = arr.reduce(function (obj, i) {\n return obj && obj[i] || undefined;\n }, data[b]);\n } else {\n val1 = data[a][prop];\n val2 = data[b][prop];\n }\n\n if (val1 !== val2) {\n if (ltHelper(val1, val2, false)) return -1;\n if (gtHelper(val1, val2, false)) return 1;\n }\n return 0;\n }))(property, this.data);\n\n index.values.sort(wrappedComparer);\n index.dirty = false;\n\n this.dirty = true; // for autosave scenarios\n }\n\n getSequencedIndexValues(property: string) {\n let idx;\n const idxvals = this.binaryIndices[property].values;\n let result = \"\";\n\n for (idx = 0; idx < idxvals.length; idx++) {\n result += \" [\" + idx + \"] \" + this.data[idxvals[idx]][property];\n }\n\n return result;\n }\n\n ensureUniqueIndex(field: string) {\n let index = new UniqueIndex(field);\n\n // if index already existed, (re)loading it will likely cause collisions, rebuild always\n this.constraints.unique[field] = index;\n for (let i = 0; i < this.data.length; i++) {\n index.set(this.data[i], i);\n }\n return index;\n }\n\n /**\n * Ensure all binary indices\n */\n ensureAllIndexes(force = false) {\n let key;\n const bIndices = this.binaryIndices;\n for (key in bIndices) {\n if (bIndices[key] !== undefined) {\n this.ensureIndex(key, force);\n }\n }\n }\n\n flagBinaryIndexesDirty() {\n let key;\n const bIndices = this.binaryIndices;\n for (key in bIndices) {\n if (bIndices[key] !== undefined) {\n bIndices[key].dirty = true;\n }\n }\n }\n\n flagBinaryIndexDirty(index: string) {\n if (this.binaryIndices[index])\n this.binaryIndices[index].dirty = true;\n }\n\n /**\n * Quickly determine number of documents in collection (or query)\n * @param {object} query - (optional) query object to count results of\n * @returns {number} number of documents in the collection\n */\n count(query?: object): number {\n if (!query) {\n return this.data.length;\n }\n\n return this.chain().find(query).filteredrows.length;\n }\n\n /**\n * Rebuild idIndex\n */\n ensureId() {\n const len = this.data.length;\n let i = 0;\n\n this.idIndex = [];\n for (i; i < len; i += 1) {\n this.idIndex.push(this.data[i].$loki);\n }\n }\n\n /**\n * Add a dynamic view to the collection\n * @param {string} name - name of dynamic view to add\n * @param {object} options - (optional) options to configure dynamic view with\n * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata'\n * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority\n * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here)\n * @returns {DynamicView} reference to the dynamic view added\n **/\n addDynamicView(name: string, options?: DynamicView.Options): DynamicView {\n const dv = new DynamicView(this, name, options);\n this._dynamicViews.push(dv);\n\n return dv;\n }\n\n /**\n * Remove a dynamic view from the collection\n * @param {string} name - name of dynamic view to remove\n **/\n removeDynamicView(name: string) {\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n if (this._dynamicViews[idx].name === name) {\n this._dynamicViews.splice(idx, 1);\n }\n }\n }\n\n /**\n * Look up dynamic view reference from within the collection\n * @param {string} name - name of dynamic view to retrieve reference of\n * @returns {DynamicView} A reference to the dynamic view with that name\n **/\n getDynamicView(name: string) {\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n if (this._dynamicViews[idx].name === name) {\n return this._dynamicViews[idx];\n }\n }\n\n return null;\n }\n\n /**\n * Applies a 'mongo-like' find query object and passes all results to an update function.\n * For filter function querying you should migrate to [\n * Where()]{@link Collection#updateWhere}.\n *\n * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode)\n * @param {function} updateFunction - update function to run against filtered documents\n */\n findAndUpdate(filterObject: Query | ((obj: E) => boolean), updateFunction: (obj: E) => E) {\n if (typeof(filterObject) === \"function\") {\n this.updateWhere(filterObject, updateFunction);\n } else {\n this.chain().find(filterObject).update(updateFunction);\n }\n }\n\n /**\n * Applies a 'mongo-like' find query object removes all documents which match that filter.\n *\n * @param {object} filterObject - 'mongo-like' query object\n */\n findAndRemove(filterObject: object) {\n this.chain().find(filterObject).remove();\n }\n\n /**\n * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc.\n * @param {(object|array)} doc - the document (or array of documents) to be inserted\n * @returns {(object|array)} document or documents inserted\n */\n insert(doc: E | E[]): Doc;\n insert(doc: E[]): Doc[];\n insert(doc: E | E[]) {\n if (!Array.isArray(doc)) {\n return this.insertOne(doc);\n }\n\n // holder to the clone of the object inserted if collections is set to clone objects\n let obj;\n let results = [];\n\n this.emit(\"pre-insert\", doc);\n for (let i = 0; i < doc.length; i++) {\n obj = this.insertOne(doc[i], true);\n if (!obj) {\n return undefined;\n }\n results.push(obj);\n }\n // at the 'batch' level, if clone option is true then emitted docs are clones\n this.emit(\"insert\", results);\n\n // if clone option is set, clone return values\n results = this.cloneObjects ? clone(results, this.cloneMethod) : results;\n\n return results.length === 1 ? results[0] : results;\n }\n\n /**\n * Adds a single object, ensures it has meta properties, clone it if necessary, etc.\n * @param {object} doc - the document to be inserted\n * @param {boolean} bulkInsert - quiet pre-insert and insert event emits\n * @returns {object} document or 'undefined' if there was a problem inserting it\n */\n insertOne(doc: E, bulkInsert = false): Doc {\n let err = null;\n let returnObj;\n\n if (typeof doc !== \"object\") {\n err = new TypeError(\"Document needs to be an object\");\n } else if (doc === null) {\n err = new TypeError(\"Object cannot be null\");\n }\n\n if (err !== null) {\n this.emit(\"error\", err);\n throw err;\n }\n\n // if configured to clone, do so now... otherwise just use same obj reference\n const obj = this.cloneObjects ? clone(doc, this.cloneMethod) : doc;\n\n if ((obj).meta === undefined) {\n (obj).meta = {\n revision: 0,\n created: 0\n };\n }\n\n // both 'pre-insert' and 'insert' events are passed internal data reference even when cloning\n // insert needs internal reference because that is where loki itself listens to add meta\n if (!bulkInsert) {\n this.emit(\"pre-insert\", obj);\n }\n if (!this.add(obj)) {\n return undefined;\n }\n\n returnObj = obj;\n if (!bulkInsert) {\n this.emit(\"insert\", obj);\n returnObj = this.cloneObjects ? clone(obj, this.cloneMethod) : obj;\n }\n\n return returnObj as Doc;\n }\n\n /**\n * Empties the collection.\n * @param {object} options - configure clear behavior\n * @param {boolean} options.removeIndices - (default: false)\n */\n clear(options: ANY = {}) {\n this.data = [];\n this.idIndex = [];\n this.cachedIndex = null;\n this.cachedBinaryIndex = null;\n this.cachedData = null;\n this.maxId = 0;\n this._dynamicViews = [];\n this.dirty = true;\n\n // if removing indices entirely\n if (options.removeIndices === true) {\n this.binaryIndices = {};\n\n this.constraints = {\n unique: {},\n };\n }\n // clear indices but leave definitions in place\n else {\n // clear binary indices\n const keys = Object.keys(this.binaryIndices);\n keys.forEach((biname) => {\n this.binaryIndices[biname].dirty = false;\n this.binaryIndices[biname].values = [];\n });\n\n // clear entire unique indices definition\n const uniqueNames = Object.keys(this.constraints.unique);\n for (let i = 0; i < uniqueNames.length; i++) {\n this.constraints.unique[uniqueNames[i]].clear();\n }\n }\n\n if (this._fullTextSearch !== null) {\n this._fullTextSearch.clear();\n }\n }\n\n /**\n * Updates an object and notifies collection that the document has changed.\n * @param {object} doc - document to update within the collection\n */\n update(doc: ANY) {\n if (Array.isArray(doc)) {\n let k = 0;\n const len = doc.length;\n for (k; k < len; k += 1) {\n this.update(doc[k]);\n }\n return;\n }\n\n // verify object is a properly formed document\n if (doc.$loki === undefined) {\n throw new Error(\"Trying to update unsynced document. Please save the document first by using insert() or addMany()\");\n }\n try {\n this.startTransaction();\n const arr = this.get(doc.$loki, true);\n\n if (!arr) {\n throw new Error(\"Trying to update a document not in collection.\");\n }\n\n // ref to existing obj\n let oldInternal = arr[0]; // -internal- obj ref\n let position = arr[1]; // position in data array\n\n // ref to new internal obj\n // if configured to clone, do so now... otherwise just use same obj reference\n let newInternal = this.cloneObjects || !this.disableDeltaChangesApi ? clone(doc, this.cloneMethod) : doc;\n\n this.emit(\"pre-update\", doc);\n\n Object.keys(this.constraints.unique).forEach((key) => {\n this.constraints.unique[key].update(newInternal, position);\n });\n\n // operate the update\n this.data[position] = newInternal;\n\n // now that we can efficiently determine the data[] position of newly added document,\n // submit it for all registered DynamicViews to evaluate for inclusion/exclusion\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n this._dynamicViews[idx]._evaluateDocument(position, false);\n }\n\n let key;\n if (this.adaptiveBinaryIndices) {\n // for each binary index defined in collection, immediately update rather than flag for lazy rebuild\n const bIndices = this.binaryIndices;\n for (key in bIndices) {\n this.adaptiveBinaryIndexUpdate(position, key);\n }\n } else {\n this.flagBinaryIndexesDirty();\n }\n\n this.idIndex[position] = newInternal.$loki;\n\n // FullTextSearch.\n if (this._fullTextSearch !== null) {\n this._fullTextSearch.updateDocument(doc, position);\n }\n\n this.commit();\n this.dirty = true; // for autosave scenarios\n\n this.emit(\"update\", doc, this.cloneObjects || !this.disableDeltaChangesApi ? clone(oldInternal, this.cloneMethod) : null);\n return doc;\n } catch (err) {\n this.rollback();\n this.console.error(err.message);\n this.emit(\"error\", err);\n throw (err); // re-throw error so user does not think it succeeded\n }\n }\n\n /**\n * Add object to collection\n */\n private add(obj: E) {\n // if parameter isn't object exit with throw\n if (\"object\" !== typeof obj) {\n throw new TypeError(\"Object being added needs to be an object\");\n }\n // if object you are adding already has id column it is either already in the collection\n // or the object is carrying its own 'id' property. If it also has a meta property,\n // then this is already in collection so throw error, otherwise rename to originalId and continue adding.\n if (obj[\"$loki\"] !== undefined) {\n throw new Error(\"Document is already in collection, please use update()\");\n }\n\n /*\n * try adding object to collection\n */\n try {\n this.startTransaction();\n this.maxId++;\n\n if (isNaN(this.maxId)) {\n this.maxId = (this.data[this.data.length - 1].$loki + 1);\n }\n\n const newDoc = obj as Doc;\n newDoc.$loki = this.maxId;\n newDoc.meta.version = 0;\n\n let key;\n const constrUnique = this.constraints.unique;\n for (key in constrUnique) {\n if (constrUnique[key] !== undefined) {\n constrUnique[key].set(newDoc, this.data.length);\n }\n }\n\n // add new obj id to idIndex\n this.idIndex.push(newDoc.$loki);\n\n // add the object\n this.data.push(newDoc);\n\n const addedPos = this.data.length - 1;\n\n // now that we can efficiently determine the data[] position of newly added document,\n // submit it for all registered DynamicViews to evaluate for inclusion/exclusion\n const dvlen = this._dynamicViews.length;\n for (let i = 0; i < dvlen; i++) {\n this._dynamicViews[i]._evaluateDocument(addedPos, true);\n }\n\n if (this.adaptiveBinaryIndices) {\n // for each binary index defined in collection, immediately update rather than flag for lazy rebuild\n const bIndices = this.binaryIndices;\n for (key in bIndices) {\n this.adaptiveBinaryIndexInsert(addedPos, key);\n }\n } else {\n this.flagBinaryIndexesDirty();\n }\n\n // FullTextSearch.\n if (this._fullTextSearch !== null) {\n this._fullTextSearch.addDocument(newDoc, addedPos);\n }\n\n this.commit();\n this.dirty = true; // for autosave scenarios\n\n return (this.cloneObjects) ? (clone(newDoc, this.cloneMethod)) : (newDoc);\n } catch (err) {\n this.rollback();\n this.console.error(err.message);\n this.emit(\"error\", err);\n throw (err); // re-throw error so user does not think it succeeded\n }\n }\n\n /**\n * Applies a filter function and passes all results to an update function.\n *\n * @param {function} filterFunction - filter function whose results will execute update\n * @param {function} updateFunction - update function to run against filtered documents\n */\n updateWhere(filterFunction: (obj: E) => boolean, updateFunction: (obj: E) => E) {\n const results = this.where(filterFunction);\n let i = 0;\n let obj;\n try {\n for (i; i < results.length; i++) {\n obj = updateFunction(results[i]);\n this.update(obj);\n }\n\n } catch (err) {\n this.rollback();\n this.console.error(err.message);\n }\n }\n\n /**\n * Remove all documents matching supplied filter function.\n * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}.\n * @param {function|object} query - query object to filter on\n */\n removeWhere(query: Query | ((obj: E) => boolean)) {\n let list;\n if (typeof query === \"function\") {\n list = this.data.filter(query);\n this.remove(list);\n } else {\n this.chain().find(query).remove();\n }\n }\n\n removeDataOnly() {\n this.remove(this.data.slice());\n }\n\n /**\n * Remove a document from the collection\n * @param {object} doc - document to remove from collection\n */\n remove(doc: ANY) {\n if (typeof doc === \"number\") {\n doc = this.get(doc);\n }\n\n if (\"object\" !== typeof doc) {\n throw new Error(\"Parameter is not an object\");\n }\n if (Array.isArray(doc)) {\n let k = 0;\n const len = doc.length;\n for (k; k < len; k += 1) {\n this.remove(doc[k]);\n }\n return;\n }\n\n if (doc.$loki === undefined) {\n throw new Error(\"Object is not a document stored in the collection\");\n }\n\n try {\n this.startTransaction();\n const arr = this.get(doc.$loki, true);\n\n const position = arr[1];\n\n Object.keys(this.constraints.unique).forEach((key) => {\n if (doc[key] !== null && doc[key] !== undefined) {\n this.constraints.unique[key].remove(doc[key]);\n }\n });\n // now that we can efficiently determine the data[] position of newly added document,\n // submit it for all registered DynamicViews to remove\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n this._dynamicViews[idx]._removeDocument(position);\n }\n\n if (this.adaptiveBinaryIndices) {\n // for each binary index defined in collection, immediately update rather than flag for lazy rebuild\n let key;\n\n const bIndices = this.binaryIndices;\n for (key in bIndices) {\n this.adaptiveBinaryIndexRemove(position, key);\n }\n } else {\n this.flagBinaryIndexesDirty();\n }\n\n this.data.splice(position, 1);\n\n // remove id from idIndex\n this.idIndex.splice(position, 1);\n\n // FullTextSearch.\n if (this._fullTextSearch !== null) {\n this._fullTextSearch.removeDocument(doc, position);\n }\n\n this.commit();\n this.dirty = true; // for autosave scenarios\n this.emit(\"delete\", arr[0]);\n delete doc.$loki;\n delete doc.meta;\n return doc;\n } catch (err) {\n this.rollback();\n this.console.error(err.message);\n this.emit(\"error\", err);\n return null;\n }\n }\n\n /*------------+\n | Change API |\n +------------*/\n /**\n * Returns all changes.\n * @returns {ANY}\n */\n public getChanges() {\n return this.changes;\n }\n\n /**\n * Enables/disables changes api.\n * @param {boolean} disableChangesApi\n * @param {boolean} disableDeltaChangesApi\n */\n public setChangesApi(disableChangesApi: boolean, disableDeltaChangesApi: boolean = true) {\n this.disableChangesApi = disableChangesApi;\n this.disableDeltaChangesApi = disableDeltaChangesApi;\n\n if (disableChangesApi) {\n this.disableDeltaChangesApi = true;\n }\n\n this.insertHandler = this.disableChangesApi ? this._insertMeta : this._insertMetaWithChange;\n this.updateHandler = this.disableChangesApi ? this._updateMeta : this._updateMetaWithChange;\n }\n\n /**\n * Clears all the changes.\n */\n public flushChanges() {\n this.changes = [];\n }\n\n private _getObjectDelta(oldObject: Doc, newObject: Doc) {\n const propertyNames = newObject !== null && typeof newObject === \"object\" ? Object.keys(newObject) : null;\n if (propertyNames && propertyNames.length && [\"string\", \"boolean\", \"number\"].indexOf(typeof(newObject)) < 0) {\n const delta = {};\n for (let i = 0; i < propertyNames.length; i++) {\n const propertyName = propertyNames[i];\n if (newObject.hasOwnProperty(propertyName)) {\n if (!oldObject.hasOwnProperty(propertyName) || this.constraints.unique[propertyName] !== undefined || propertyName === \"$loki\" || propertyName === \"meta\") {\n delta[propertyName] = newObject[propertyName];\n }\n else {\n const propertyDelta = this._getObjectDelta(oldObject[propertyName], newObject[propertyName]);\n if (propertyDelta !== undefined && propertyDelta !== {}) {\n delta[propertyName] = propertyDelta;\n }\n }\n }\n }\n return Object.keys(delta).length === 0 ? undefined : delta;\n }\n else {\n return oldObject === newObject ? undefined : newObject;\n }\n }\n\n /**\n * Compare changed object (which is a forced clone) with existing object and return the delta\n */\n private _getChangeDelta(obj: Doc, old: Doc) {\n if (old) {\n return this._getObjectDelta(old, obj);\n }\n else {\n return JSON.parse(JSON.stringify(obj));\n }\n }\n\n /**\n * This method creates a clone of the current status of an object and associates operation and collection name,\n * so the parent db can aggregate and generate a changes object for the entire db\n */\n private _createChange(name: string, op: string, obj: Doc, old?: Doc) {\n this.changes.push({\n name,\n operation: op,\n obj: op === \"U\" && !this.disableDeltaChangesApi ? this._getChangeDelta(obj, old) : JSON.parse(JSON.stringify(obj))\n });\n }\n\n private _createInsertChange(obj: Doc) {\n this._createChange(this.name, \"I\", obj);\n }\n\n /**\n * If the changes API is disabled make sure only metadata is added without re-evaluating everytime if the changesApi is enabled\n */\n private _insertMeta(obj: Doc) {\n let len;\n let idx;\n\n if (!obj) {\n return;\n }\n\n // if batch insert\n if (Array.isArray(obj)) {\n len = obj.length;\n\n for (idx = 0; idx < len; idx++) {\n if (obj[idx].meta === undefined) {\n obj[idx].meta = {};\n }\n\n obj[idx].meta.created = (new Date()).getTime();\n obj[idx].meta.revision = 0;\n }\n\n return;\n }\n\n // single object\n if (!obj.meta) {\n obj.meta = {};\n }\n\n obj.meta.created = (new Date()).getTime();\n obj.meta.revision = 0;\n }\n\n private _updateMeta(obj: Doc) {\n if (!obj) {\n return;\n }\n obj.meta.updated = (new Date()).getTime();\n obj.meta.revision += 1;\n }\n\n\n private _createUpdateChange(obj: Doc, old: Doc) {\n this._createChange(this.name, \"U\", obj, old);\n }\n\n private _insertMetaWithChange(obj: Doc) {\n this._insertMeta(obj);\n this._createInsertChange(obj);\n }\n\n private _updateMetaWithChange(obj: Doc, old: Doc) {\n this._updateMeta(obj);\n this._createUpdateChange(obj, old);\n }\n\n /*---------------------+\n | Finding methods |\n +----------------------*/\n\n /**\n * Get by Id - faster than other methods because of the searching algorithm\n * @param {int} id - $loki id of document you want to retrieve\n * @param {boolean} returnPosition - if 'true' we will return [object, position]\n * @returns {(object|array|null)} Object reference if document was found, null if not,\n * or an array if 'returnPosition' was passed.\n */\n public get(id: number): Doc;\n public get(id: number, returnPosition: boolean): Doc | [Doc, number];\n public get(id: number, returnPosition = false) {\n const data = this.idIndex;\n let max = data.length - 1;\n let min = 0;\n let mid = (min + max) >> 1;\n\n id = typeof id === \"number\" ? id : parseInt(id, 10);\n\n if (isNaN(id)) {\n throw new TypeError(\"Passed id is not an integer\");\n }\n\n while (data[min] < data[max]) {\n mid = (min + max) >> 1;\n\n if (data[mid] < id) {\n min = mid + 1;\n } else {\n max = mid;\n }\n }\n\n if (max === min && data[min] === id) {\n if (returnPosition) {\n return [this.data[min], min];\n }\n return this.data[min];\n }\n return null;\n }\n\n /**\n * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value\n * Since multiple documents may contain the same value (which the index is sorted on),\n * we hone in on range and then linear scan range to find exact index array position.\n * @param {int} dataPosition : coll.data array index/position\n * @param {string} binaryIndexName : index to search for dataPosition in\n */\n public getBinaryIndexPosition(dataPosition: number, binaryIndexName: string) {\n const val = this.data[dataPosition][binaryIndexName];\n const index = this.binaryIndices[binaryIndexName].values;\n\n // i think calculateRange can probably be moved to collection\n // as it doesn't seem to need resultset. need to verify\n //let rs = new Resultset(this, null, null);\n const range = this.calculateRange(\"$eq\", binaryIndexName, val);\n\n if (range[0] === 0 && range[1] === -1) {\n // uhoh didn't find range\n return null;\n }\n\n const min = range[0];\n const max = range[1];\n\n // narrow down the sub-segment of index values\n // where the indexed property value exactly matches our\n // value and then linear scan to find exact -index- position\n for (let idx = min; idx <= max; idx++) {\n if (index[idx] === dataPosition) return idx;\n }\n\n // uhoh\n return null;\n }\n\n /**\n * Adaptively insert a selected item to the index.\n * @param {int} dataPosition : coll.data array index/position\n * @param {string} binaryIndexName : index to search for dataPosition in\n */\n public adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: string) {\n const index = this.binaryIndices[binaryIndexName].values;\n let val = this.data[dataPosition][binaryIndexName];\n\n // If you are inserting a javascript Date value into a binary index, convert to epoch time\n if (this.serializableIndices === true && val instanceof Date) {\n this.data[dataPosition][binaryIndexName] = val.getTime();\n val = this.data[dataPosition][binaryIndexName];\n }\n\n const idxPos = (index.length === 0) ? 0 : this._calculateRangeStart(binaryIndexName, val, true);\n\n // insert new data index into our binary index at the proper sorted location for relevant property calculated by idxPos.\n // doing this after adjusting dataPositions so no clash with previous item at that position.\n this.binaryIndices[binaryIndexName].values.splice(idxPos, 0, dataPosition);\n }\n\n /**\n * Adaptively update a selected item within an index.\n * @param {int} dataPosition : coll.data array index/position\n * @param {string} binaryIndexName : index to search for dataPosition in\n */\n public adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: string) {\n // linear scan needed to find old position within index unless we optimize for clone scenarios later\n // within (my) node 5.6.0, the following for() loop with strict compare is -much- faster than indexOf()\n let idxPos;\n\n const index = this.binaryIndices[binaryIndexName].values;\n const len = index.length;\n\n for (idxPos = 0; idxPos < len; idxPos++) {\n if (index[idxPos] === dataPosition) break;\n }\n\n //let idxPos = this.binaryIndices[binaryIndexName].values.indexOf(dataPosition);\n this.binaryIndices[binaryIndexName].values.splice(idxPos, 1);\n\n //this.adaptiveBinaryIndexRemove(dataPosition, binaryIndexName, true);\n this.adaptiveBinaryIndexInsert(dataPosition, binaryIndexName);\n }\n\n /**\n * Adaptively remove a selected item from the index.\n * @param {int} dataPosition : coll.data array index/position\n * @param {string} binaryIndexName : index to search for dataPosition in\n */\n public adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: string, removedFromIndexOnly = false): ANY {\n const idxPos = this.getBinaryIndexPosition(dataPosition, binaryIndexName);\n const index = this.binaryIndices[binaryIndexName].values;\n let len;\n let idx;\n\n if (idxPos === null) {\n // throw new Error('unable to determine binary index position');\n return null;\n }\n\n // remove document from index\n this.binaryIndices[binaryIndexName].values.splice(idxPos, 1);\n\n // if we passed this optional flag parameter, we are calling from adaptiveBinaryIndexUpdate,\n // in which case data positions stay the same.\n if (removedFromIndexOnly === true) {\n return;\n }\n\n // since index stores data array positions, if we remove a document\n // we need to adjust array positions -1 for all document positions greater than removed position\n len = index.length;\n for (idx = 0; idx < len; idx++) {\n if (index[idx] > dataPosition) {\n index[idx]--;\n }\n }\n }\n\n /**\n * Internal method used for index maintenance and indexed searching.\n * Calculates the beginning of an index range for a given value.\n * For index maintainance (adaptive:true), we will return a valid index position to insert to.\n * For querying (adaptive:false/undefined), we will :\n * return lower bound/index of range of that value (if found)\n * return next lower index position if not found (hole)\n * If index is empty it is assumed to be handled at higher level, so\n * this method assumes there is at least 1 document in index.\n *\n * @param {string} prop - name of property which has binary index\n * @param {any} val - value to find within index\n * @param {bool?} adaptive - if true, we will return insert position\n */\n private _calculateRangeStart(prop: string, val: ANY, adaptive = false): number {\n const rcd = this.data;\n const index = this.binaryIndices[prop].values;\n let min = 0;\n let max = index.length - 1;\n let mid = 0;\n\n if (index.length === 0) {\n return -1;\n }\n\n // hone in on start position of value\n while (min < max) {\n mid = (min + max) >> 1;\n\n if (ltHelper(rcd[index[mid]][prop], val, false)) {\n min = mid + 1;\n } else {\n max = mid;\n }\n }\n\n const lbound = min;\n\n // found it... return it\n if (aeqHelper(val, rcd[index[lbound]][prop])) {\n return lbound;\n }\n\n // if not in index and our value is less than the found one\n if (ltHelper(val, rcd[index[lbound]][prop], false)) {\n return adaptive ? lbound : lbound - 1;\n }\n\n // not in index and our value is greater than the found one\n return adaptive ? lbound + 1 : lbound;\n }\n\n /**\n * Internal method used for indexed $between. Given a prop (index name), and a value\n * (which may or may not yet exist) this will find the final position of that upper range value.\n */\n private _calculateRangeEnd(prop: string, val: ANY) {\n const rcd = this.data;\n const index = this.binaryIndices[prop].values;\n let min = 0;\n let max = index.length - 1;\n let mid = 0;\n\n if (index.length === 0) {\n return -1;\n }\n\n // hone in on start position of value\n while (min < max) {\n mid = (min + max) >> 1;\n\n if (ltHelper(val, rcd[index[mid]][prop], false)) {\n max = mid;\n } else {\n min = mid + 1;\n }\n }\n\n const ubound = max;\n\n // only eq if last element in array is our val\n if (aeqHelper(val, rcd[index[ubound]][prop])) {\n return ubound;\n }\n\n // if not in index and our value is less than the found one\n if (gtHelper(val, rcd[index[ubound]][prop], false)) {\n return ubound + 1;\n }\n\n // either hole or first nonmatch\n if (aeqHelper(val, rcd[index[ubound - 1]][prop])) {\n return ubound - 1;\n }\n\n // hole, so ubound if nearest gt than the val we were looking for\n return ubound;\n }\n\n /**\n * Binary Search utility method to find range/segment of values matching criteria.\n * this is used for collection.find() and first find filter of resultset/dynview\n * slightly different than get() binary search in that get() hones in on 1 value,\n * but we have to hone in on many (range)\n * @param {string} op - operation, such as $eq\n * @param {string} prop - name of property to calculate range for\n * @param {object} val - value to use for range calculation.\n * @returns {array} [start, end] index array positions\n */\n public calculateRange(op: string, prop: string, val: ANY): [number, number] {\n const rcd = this.data;\n const index = this.binaryIndices[prop].values;\n const min = 0;\n const max = index.length - 1;\n let lbound;\n let lval;\n let ubound;\n\n // when no documents are in collection, return empty range condition\n if (rcd.length === 0) {\n return [0, -1];\n }\n\n const minVal = rcd[index[min]][prop];\n const maxVal = rcd[index[max]][prop];\n\n // if value falls outside of our range return [0, -1] to designate no results\n switch (op) {\n case \"$eq\":\n case \"$aeq\":\n if (ltHelper(val, minVal, false) || gtHelper(val, maxVal, false)) {\n return [0, -1];\n }\n break;\n case \"$dteq\":\n if (ltHelper(val, minVal, false) || gtHelper(val, maxVal, false)) {\n return [0, -1];\n }\n break;\n case \"$gt\":\n // none are within range\n if (gtHelper(val, maxVal, true)) {\n return [0, -1];\n }\n // all are within range\n if (gtHelper(minVal, val, false)) {\n return [min, max];\n }\n break;\n case \"$gte\":\n // none are within range\n if (gtHelper(val, maxVal, false)) {\n return [0, -1];\n }\n // all are within range\n if (gtHelper(minVal, val, true)) {\n return [min, max];\n }\n break;\n case \"$lt\":\n // none are within range\n if (ltHelper(val, minVal, true)) {\n return [0, -1];\n }\n // all are within range\n if (ltHelper(maxVal, val, false)) {\n return [min, max];\n }\n break;\n case \"$lte\":\n // none are within range\n if (ltHelper(val, minVal, false)) {\n return [0, -1];\n }\n // all are within range\n if (ltHelper(maxVal, val, true)) {\n return [min, max];\n }\n break;\n case \"$between\":\n // none are within range (low range is greater)\n if (gtHelper(val[0], maxVal, false)) {\n return [0, -1];\n }\n // none are within range (high range lower)\n if (ltHelper(val[1], minVal, false)) {\n return [0, -1];\n }\n\n lbound = this._calculateRangeStart(prop, val[0]);\n ubound = this._calculateRangeEnd(prop, val[1]);\n\n if (lbound < 0) lbound++;\n if (ubound > max) ubound--;\n\n if (!gtHelper(rcd[index[lbound]][prop], val[0], true)) lbound++;\n if (!ltHelper(rcd[index[ubound]][prop], val[1], true)) ubound--;\n\n if (ubound < lbound) return [0, -1];\n\n return ([lbound, ubound]);\n }\n\n // determine lbound where needed\n switch (op) {\n case \"$eq\":\n case \"$aeq\":\n case \"$dteq\":\n case \"$gte\":\n case \"$lt\":\n lbound = this._calculateRangeStart(prop, val);\n lval = rcd[index[lbound]][prop];\n break;\n default:\n break;\n }\n\n // determine ubound where needed\n switch (op) {\n case \"$eq\":\n case \"$aeq\":\n case \"$dteq\":\n case \"$lte\":\n case \"$gt\":\n ubound = this._calculateRangeEnd(prop, val);\n break;\n default:\n break;\n }\n\n\n switch (op) {\n case \"$eq\":\n case \"$aeq\":\n case \"$dteq\":\n // if hole (not found)\n //if (ltHelper(lval, val, false) || gtHelper(lval, val, false)) {\n // return [0, -1];\n //}\n if (!aeqHelper(lval, val)) {\n return [0, -1];\n }\n\n return [lbound, ubound];\n\n //case '$dteq':\n // if hole (not found)\n // if (lval > val || lval < val) {\n // return [0, -1];\n // }\n\n // return [lbound, ubound];\n\n case \"$gt\":\n // (an eqHelper would probably be better test)\n // if hole (not found) ub position is already greater\n if (!aeqHelper(rcd[index[ubound]][prop], val)) {\n //if (gtHelper(rcd[index[ubound]][prop], val, false)) {\n return [ubound, max];\n }\n // otherwise (found) so ubound is still equal, get next\n return [ubound + 1, max];\n\n case \"$gte\":\n // if hole (not found) lb position marks left outside of range\n if (!aeqHelper(rcd[index[lbound]][prop], val)) {\n //if (ltHelper(rcd[index[lbound]][prop], val, false)) {\n return [lbound + 1, max];\n }\n // otherwise (found) so lb is first position where its equal\n return [lbound, max];\n\n case \"$lt\":\n // if hole (not found) position already is less than\n if (!aeqHelper(rcd[index[lbound]][prop], val)) {\n //if (ltHelper(rcd[index[lbound]][prop], val, false)) {\n return [min, lbound];\n }\n // otherwise (found) so lb marks left inside of eq range, get previous\n return [min, lbound - 1];\n\n case \"$lte\":\n // if hole (not found) ub position marks right outside so get previous\n if (!aeqHelper(rcd[index[ubound]][prop], val)) {\n //if (gtHelper(rcd[index[ubound]][prop], val, false)) {\n return [min, ubound - 1];\n }\n // otherwise (found) so ub is last position where its still equal\n return [min, ubound];\n\n default:\n return [0, rcd.length - 1];\n }\n }\n\n /**\n * Retrieve doc by Unique index\n * @param {string} field - name of uniquely indexed property to use when doing lookup\n * @param {any} value - unique value to search for\n * @returns {object} document matching the value passed\n */\n public by(field: string, value: ANY): Doc {\n return this.findOne({[field]: value});\n }\n\n /**\n * Find one object by index property, by property equal to value\n * @param {object} query - query object used to perform search with\n * @returns {(object|null)} First matching document, or null if none\n */\n public findOne(query: object): Doc {\n query = query || {};\n\n // Instantiate Resultset and exec find op passing firstOnly = true param\n const result = this.chain().find(query, true).data();\n\n if (Array.isArray(result) && result.length === 0) {\n return null;\n } else {\n if (!this.cloneObjects) {\n return result[0] as any as Doc;\n } else {\n return clone(result[0], this.cloneMethod) as any as Doc;\n }\n }\n }\n\n /**\n * Chain method, used for beginning a series of chained find() and/or view() operations\n * on a collection.\n *\n * @param {array} transform - Ordered array of transform step objects similar to chain\n * @param {object} parameters - Object containing properties representing parameters to substitute\n * @returns {Resultset} (this) resultset, or data array if any map or join functions where called\n */\n public chain(transform?: string | ANY[], parameters?: ANY): Resultset {\n const rs = new Resultset(this);\n\n if (transform === undefined) {\n return rs;\n }\n return rs.transform(transform, parameters) as Resultset;\n }\n\n /**\n * Find method, api is similar to mongodb.\n * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}.\n * @example {@tutorial Query Examples}\n * @param {object} query - 'mongo-like' query object\n * @returns {array} Array of matching documents\n */\n public find(query?: Query): Doc[] {\n return this.chain().find(query).data();\n }\n\n /**\n * Find object by unindexed field by property equal to value,\n * simply iterates and returns the first element matching the query\n */\n public findOneUnindexed(prop: string, value: ANY) {\n let i = this.data.length;\n let doc;\n while (i--) {\n if (this.data[i][prop] === value) {\n doc = this.data[i];\n return doc;\n }\n }\n return null;\n }\n\n /**\n * Transaction methods\n */\n\n /** start the transation */\n public startTransaction(): void {\n if (this.transactional) {\n this.cachedData = clone(this.data, this.cloneMethod);\n this.cachedIndex = this.idIndex;\n this.cachedBinaryIndex = this.binaryIndices;\n\n // propagate startTransaction to dynamic views\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n this._dynamicViews[idx].startTransaction();\n }\n }\n }\n\n /** commit the transation */\n public commit(): void {\n if (this.transactional) {\n this.cachedData = null;\n this.cachedIndex = null;\n this.cachedBinaryIndex = null;\n\n // propagate commit to dynamic views\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n this._dynamicViews[idx].commit();\n }\n }\n }\n\n /** roll back the transation */\n public rollback(): void {\n if (this.transactional) {\n if (this.cachedData !== null && this.cachedIndex !== null) {\n this.data = this.cachedData;\n this.idIndex = this.cachedIndex;\n this.binaryIndices = this.cachedBinaryIndex;\n }\n\n // propagate rollback to dynamic views\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n this._dynamicViews[idx].rollback();\n }\n }\n }\n\n /**\n * Query the collection by supplying a javascript filter function.\n * @example\n * let results = coll.where(function(obj) {\n\t * return obj.legs === 8;\n\t * });\n *\n * @param {function} fun - filter function to run against all collection docs\n * @returns {array} all documents which pass your filter function\n */\n public where(fun: (obj: E) => boolean): Doc[] {\n return this.chain().where(fun).data();\n }\n\n /**\n * Map Reduce operation\n * @param {function} mapFunction - function to use as map function\n * @param {function} reduceFunction - function to use as reduce function\n * @returns {data} The result of your mapReduce operation\n */\n public mapReduce(mapFunction: (value: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U {\n try {\n return reduceFunction(this.data.map(mapFunction));\n } catch (err) {\n throw err;\n }\n }\n\n /**\n * Join two collections on specified properties\n *\n * @param {array} joinData - array of documents to 'join' to this collection\n * @param {string} leftJoinProp - property name in collection\n * @param {string} rightJoinProp - property name in joinData\n * @param {function} mapFun - (Optional) map function to use\n * @returns {Resultset} Result of the mapping operation\n */\n //eqJoin(joinData: T[] | Resultset, leftJoinProp: string | ((obj: E) => string), rightJoinProp: string | ((obj: T) => string)): Resultset<{ left: E; right: T; }>;\n // eqJoin(joinData: T[] | Resultset, leftJoinProp: string | ((obj: E) => string), rightJoinProp: string | ((obj: T) => string), mapFun?: (a: E, b: T) => U): Resultset {\n //eqJoin(joinData: T[] | Resultset, leftJoinKey: string | ((obj: E) => string), rightJoinKey: string | ((obj: T) => string), mapFun?: (a: E, b: T) => U, dataOptions?: Resultset.DataOptions): Resultset<{ left: E; right: T; }> {\n public eqJoin(joinData: ANY[], leftJoinProp: string, rightJoinProp: string, mapFun?: Function): Resultset {\n // logic in Resultset class\n return new Resultset(this).eqJoin(joinData, leftJoinProp, rightJoinProp, mapFun);\n }\n\n /* ------ STAGING API -------- */\n\n /**\n * stages: a map of uniquely identified 'stages', which hold copies of objects to be\n * manipulated without affecting the data in the original collection\n */\n\n\n /**\n * (Staging API) create a stage and/or retrieve it\n */\n getStage(name: string) {\n if (!this.stages[name]) {\n this.stages[name] = {};\n }\n return this.stages[name];\n }\n\n /**\n * a collection of objects recording the changes applied through a commmitStage\n */\n\n /**\n * (Staging API) create a copy of an object and insert it into a stage\n */\n public stage(stageName: string, obj: ANY) {\n const copy = JSON.parse(JSON.stringify(obj));\n this.getStage(stageName)[obj.$loki] = copy;\n return copy;\n }\n\n /**\n * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt\n * then create a message to be inserted in the commitlog\n * @param {string} stageName - name of stage\n * @param {string} message\n */\n public commitStage(stageName: string, message: string) {\n const stage = this.getStage(stageName);\n let prop;\n const timestamp = new Date().getTime();\n\n for (prop in stage) {\n this.update(stage[prop]);\n this.commitLog.push({\n timestamp,\n message,\n data: JSON.parse(JSON.stringify(stage[prop]))\n });\n }\n this.stages[stageName] = {};\n }\n\n /**\n */\n public extract(field: string) {\n let i = 0;\n const len = this.data.length;\n const isDotNotation = isDeepProperty(field);\n const result = [];\n for (i; i < len; i += 1) {\n result.push(deepProperty(this.data[i], field, isDotNotation));\n }\n return result;\n }\n\n /**\n */\n public max(field: string) {\n return Math.max.apply(null, this.extract(field));\n }\n\n /**\n */\n public min(field: string) {\n return Math.min.apply(null, this.extract(field));\n }\n\n /**\n */\n public maxRecord(field: string) {\n let i = 0;\n const len = this.data.length;\n const deep = isDeepProperty(field);\n\n const result = {\n index: 0,\n value: 0\n };\n\n let max;\n\n for (i; i < len; i += 1) {\n if (max !== undefined) {\n if (max < deepProperty(this.data[i], field, deep)) {\n max = deepProperty(this.data[i], field, deep);\n result.index = this.data[i].$loki;\n }\n } else {\n max = deepProperty(this.data[i], field, deep);\n result.index = this.data[i].$loki;\n }\n }\n result.value = max;\n return result;\n }\n\n /**\n */\n minRecord(field: string) {\n let i = 0;\n const len = this.data.length;\n const deep = isDeepProperty(field);\n\n const result = {\n index: 0,\n value: 0\n };\n\n let min;\n\n for (i; i < len; i += 1) {\n if (min !== undefined) {\n if (min > deepProperty(this.data[i], field, deep)) {\n min = deepProperty(this.data[i], field, deep);\n result.index = this.data[i].$loki;\n }\n } else {\n min = deepProperty(this.data[i], field, deep);\n result.index = this.data[i].$loki;\n }\n }\n result.value = min;\n return result;\n }\n\n /**\n */\n public extractNumerical(field: string) {\n return this.extract(field).map(parseFloat).filter(Number).filter((n) => !(isNaN(n)));\n }\n\n /**\n * Calculates the average numerical value of a property\n *\n * @param {string} field - name of property in docs to average\n * @returns {number} average of property in all docs in the collection\n */\n public avg(field: string) {\n return average(this.extractNumerical(field));\n }\n\n /**\n * Calculate standard deviation of a field\n * @param {string} field\n */\n public stdDev(field: string) {\n return standardDeviation(this.extractNumerical(field));\n }\n\n /**\n * @param {string} field\n */\n public mode(field: string) {\n const dict = {};\n const data = this.extract(field);\n data.forEach((obj) => {\n if (dict[obj]) {\n dict[obj] += 1;\n } else {\n dict[obj] = 1;\n }\n });\n let max;\n let prop;\n let mode;\n for (prop in dict) {\n if (max) {\n if (max < dict[prop]) {\n mode = prop;\n }\n } else {\n mode = prop;\n max = dict[prop];\n }\n }\n return mode;\n }\n\n /**\n * @param {string} field - property name\n */\n public median(field: string) {\n const values = this.extractNumerical(field);\n values.sort((a, b) => a - b);\n\n const half = Math.floor(values.length / 2);\n\n if (values.length % 2) {\n return values[half];\n } else {\n return (values[half - 1] + values[half]) / 2.0;\n }\n }\n}\n\nexport namespace Collection {\n export interface Options {\n unique?: string[];\n indices?: string[];\n adaptiveBinaryIndices?: boolean;\n asyncListeners?: boolean;\n disableChangesApi?: boolean;\n disableDeltaChangesApi?: boolean;\n clone?: boolean;\n serializableIndices?: boolean;\n cloneMethod?: CloneMethod;\n transactional?: boolean;\n ttl?: number;\n ttlInterval?: number;\n fullTextSearch?: FullTextSearch.FieldOptions[];\n }\n\n export interface DeserializeOptions {\n retainDirtyFlags?: boolean;\n fullTextSearch?: Dict;\n }\n\n export interface BinaryIndex {\n dirty: boolean;\n values: any;\n }\n\n export type Change = any;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/collection.ts","export enum CloneMethod {\n PARSE_STRINGIFY,\n DEEP,\n SHALLOW,\n SHALLOW_ASSIGN,\n SHALLOW_RECURSE_OBJECTS,\n}\n\nfunction add(copy: any, key: any, value: any) {\n if (copy instanceof Array) {\n copy.push(value);\n return copy[copy.length - 1];\n }\n else if (copy instanceof Object) {\n copy[key] = value;\n return copy[key];\n }\n}\n\nfunction walk(target: any, copy: any) {\n for (let key in target) {\n let obj = target[key];\n if (obj instanceof Date) {\n let value = new Date(obj.getTime());\n add(copy, key, value);\n }\n else if (obj instanceof Function) {\n let value = obj;\n add(copy, key, value);\n }\n else if (obj instanceof Array) {\n let value: any[] = [];\n let last = add(copy, key, value);\n walk(obj, last);\n }\n else if (obj instanceof Object) {\n let value = {};\n let last = add(copy, key, value);\n walk(obj, last);\n }\n else {\n let value = obj;\n add(copy, key, value);\n }\n }\n}\n\n// Deep copy from Simeon Velichkov.\n/**\n * @param target\n * @returns {any}\n */\nfunction deepCopy(target: any) {\n if (/number|string|boolean/.test(typeof target)) {\n return target;\n }\n if (target instanceof Date) {\n return new Date(target.getTime());\n }\n\n const copy = (target instanceof Array) ? [] : {};\n walk(target, copy);\n return copy;\n}\n\n/**\n * @hidden\n */\nexport function clone(data: T, method: CloneMethod = CloneMethod.PARSE_STRINGIFY): T {\n if (data === null || data === undefined) {\n return null;\n }\n\n let cloned: any;\n\n switch (method) {\n case CloneMethod.PARSE_STRINGIFY:\n cloned = JSON.parse(JSON.stringify(data));\n break;\n case CloneMethod.DEEP:\n cloned = deepCopy(data);\n break;\n case CloneMethod.SHALLOW:\n cloned = Object.create(data.constructor.prototype);\n Object.assign(cloned, data);\n break;\n case CloneMethod.SHALLOW_RECURSE_OBJECTS:\n // shallow clone top level properties\n cloned = clone(data, CloneMethod.SHALLOW);\n const keys = Object.keys(data);\n // for each of the top level properties which are object literals, recursively shallow copy\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (typeof data[key] === \"object\" && data[key].constructor.name === \"Object\") {\n cloned[key] = clone(data[key], CloneMethod.SHALLOW_RECURSE_OBJECTS);\n }\n }\n break;\n default:\n break;\n }\n\n return cloned as any as T;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/clone.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 3\n// module chunks = 0","import {Collection} from \"./collection\";\nimport {clone, CloneMethod} from \"./clone\";\nimport {ltHelper, gtHelper, aeqHelper, sortHelper} from \"./helper\";\nimport {Dict, Doc, Query} from \"../../common/types\";\nimport {ScoreResult} from \"../../full-text-search/src/scorer\";\n\nexport type ANY = any;\n\n// used to recursively scan hierarchical transform step object for param substitution\nfunction resolveTransformObject(subObj: object, params: object, depth: number = 0) {\n let prop;\n let pname;\n\n if (++depth >= 10) return subObj;\n\n for (prop in subObj) {\n if (typeof subObj[prop] === \"string\" && subObj[prop].indexOf(\"[%lktxp]\") === 0) {\n pname = subObj[prop].substring(8);\n if (params[pname] !== undefined) {\n subObj[prop] = params[pname];\n }\n } else if (typeof subObj[prop] === \"object\") {\n subObj[prop] = resolveTransformObject(subObj[prop], params, depth);\n }\n }\n\n return subObj;\n}\n\n// top level utility to resolve an entire (single) transform (array of steps) for parameter substitution\nfunction resolveTransformParams(transform: any, params: object) {\n let idx;\n let clonedStep;\n const resolvedTransform = [];\n\n if (params === undefined) return transform;\n\n // iterate all steps in the transform array\n for (idx = 0; idx < transform.length; idx++) {\n // clone transform so our scan/replace can operate directly on cloned transform\n clonedStep = clone(transform[idx], CloneMethod.SHALLOW_RECURSE_OBJECTS);\n resolvedTransform.push(resolveTransformObject(clonedStep, params));\n }\n\n return resolvedTransform;\n}\n\nfunction containsCheckFn(a: ANY) {\n if (typeof a === \"string\" || Array.isArray(a)) {\n return (b: ANY) => (a as string).indexOf(b) !== -1;\n } else if (typeof a === \"object\" && a !== null) {\n return (b: ANY) => Object.hasOwnProperty.call(a, b);\n }\n return null;\n}\n\nfunction doQueryOp(val: ANY, op: ANY) {\n for (let p in op) {\n if (Object.hasOwnProperty.call(op, p)) {\n return LokiOps[p](val, op[p]);\n }\n }\n return false;\n}\n\n\n/**\n * @hidden\n */\nexport const LokiOps = {\n // comparison operators\n // a is the value in the collection\n // b is the query value\n $eq(a: ANY, b: ANY) {\n return a === b;\n },\n\n // abstract/loose equality\n $aeq(a: ANY, b: ANY) {\n return a == b;\n },\n\n $ne(a: ANY, b: ANY) {\n // ecma 5 safe test for NaN\n if (b !== b) {\n // ecma 5 test value is not NaN\n return (a === a);\n }\n\n return a !== b;\n },\n\n // date equality / loki abstract equality test\n $dteq(a: ANY, b: ANY) {\n return aeqHelper(a, b);\n },\n\n $gt(a: ANY, b: ANY) {\n return gtHelper(a, b, false);\n },\n\n $gte(a: ANY, b: ANY) {\n return gtHelper(a, b, true);\n },\n\n $lt(a: ANY, b: ANY) {\n return ltHelper(a, b, false);\n },\n\n $lte(a: ANY, b: ANY) {\n return ltHelper(a, b, true);\n },\n\n // ex : coll.find({'orderCount': {$between: [10, 50]}});\n $between(a: ANY, vals: ANY) {\n if (a === undefined || a === null) return false;\n return (gtHelper(a, vals[0], true) && ltHelper(a, vals[1], true));\n },\n\n $in(a: ANY, b: ANY) {\n return b.indexOf(a) !== -1;\n },\n\n $nin(a: ANY, b: ANY) {\n return b.indexOf(a) === -1;\n },\n\n $keyin(a: ANY, b: ANY) {\n return a in b;\n },\n\n $nkeyin(a: ANY, b: ANY) {\n return !(a in b);\n },\n\n $definedin(a: ANY, b: ANY) {\n return b[a] !== undefined;\n },\n\n $undefinedin(a: ANY, b: ANY) {\n return b[a] === undefined;\n },\n\n $regex(a: ANY, b: ANY) {\n return b.test(a);\n },\n\n $containsString(a: ANY, b: ANY) {\n return (typeof a === \"string\") && (a.indexOf(b) !== -1);\n },\n\n $containsNone(a: ANY, b: ANY) {\n return !LokiOps.$containsAny(a, b);\n },\n\n $containsAny(a: ANY, b: ANY) {\n const checkFn = containsCheckFn(a);\n if (checkFn !== null) {\n return (Array.isArray(b)) ? (b.some(checkFn)) : (checkFn(b));\n }\n return false;\n },\n\n $contains(a: ANY, b: ANY) {\n const checkFn = containsCheckFn(a);\n if (checkFn !== null) {\n return (Array.isArray(b)) ? (b.every(checkFn)) : (checkFn(b));\n }\n return false;\n },\n\n $type(a: ANY, b: ANY) {\n let type: string = typeof a;\n if (type === \"object\") {\n if (Array.isArray(a)) {\n type = \"array\";\n } else if (a instanceof Date) {\n type = \"date\";\n }\n }\n return (typeof b !== \"object\") ? (type === b) : doQueryOp(type, b);\n },\n\n $finite(a: ANY, b: ANY) {\n return (b === isFinite(a));\n },\n\n $size(a: ANY, b: ANY) {\n if (Array.isArray(a)) {\n return (typeof b !== \"object\") ? (a.length === b) : doQueryOp(a.length, b);\n }\n return false;\n },\n\n $len(a: ANY, b: ANY) {\n if (typeof a === \"string\") {\n return (typeof b !== \"object\") ? (a.length === b) : doQueryOp(a.length, b);\n }\n return false;\n },\n\n $where(a: ANY, b: ANY) {\n return b(a) === true;\n },\n\n // field-level logical operators\n // a is the value in the collection\n // b is the nested query operation (for '$not')\n // or an array of nested query operations (for '$and' and '$or')\n $not(a: ANY, b: ANY) {\n return !doQueryOp(a, b);\n },\n\n $and(a: ANY, b: ANY) {\n for (let idx = 0, len = b.length; idx < len; idx += 1) {\n if (!doQueryOp(a, b[idx])) {\n return false;\n }\n }\n return true;\n },\n\n $or(a: ANY, b: ANY) {\n for (let idx = 0, len = b.length; idx < len; idx += 1) {\n if (doQueryOp(a, b[idx])) {\n return true;\n }\n }\n return false;\n }\n};\n\n// if an op is registered in this object, our 'calculateRange' can use it with our binary indices.\n// if the op is registered to a function, we will run that function/op as a 2nd pass filter on results.\n// those 2nd pass filter functions should be similar to LokiOps functions, accepting 2 vals to compare.\nconst indexedOps = {\n $eq: LokiOps.$eq,\n $aeq: true,\n $dteq: true,\n $gt: true,\n $gte: true,\n $lt: true,\n $lte: true,\n $in: true,\n $between: true\n};\n\n/**\n * dotSubScan - helper function used for dot notation queries.\n *\n * @param {object} root - object to traverse\n * @param {array} paths - array of properties to drill into\n * @param {function} fun - evaluation function to test with\n * @param {any} value - comparative value to also pass to (compare) fun\n * @param {number} pathOffset - index of the item in 'paths' to start the sub-scan from\n */\nfunction dotSubScan(root: object, paths: string[], fun: Function, value: ANY, pathOffset = 0) {\n const path = paths[pathOffset];\n if (root === undefined || root === null || root[path] === undefined) {\n return false;\n }\n\n let valueFound = false;\n const element = root[path];\n if (pathOffset + 1 >= paths.length) {\n // if we have already expanded out the dot notation,\n // then just evaluate the test function and value on the element\n valueFound = fun(element, value);\n } else if (Array.isArray(element)) {\n for (let index = 0, len = element.length; index < len; index += 1) {\n valueFound = dotSubScan(element[index], paths, fun, value, pathOffset + 1);\n if (valueFound === true) {\n break;\n }\n }\n } else {\n valueFound = dotSubScan(element, paths, fun, value, pathOffset + 1);\n }\n\n return valueFound;\n}\n\n/**\n * Resultset class allowing chainable queries. Intended to be instanced internally.\n * Collection.find(), Collection.where(), and Collection.chain() instantiate this.\n *\n * @example\n * mycollection.chain()\n * .find({ 'doors' : 4 })\n * .where(function(obj) { return obj.name === 'Toyota' })\n * .data();\n */\nexport class Resultset {\n\n public collection: Collection;\n public filteredrows: number[];\n public filterInitialized: boolean;\n // Holds the scoring result of the last full-text search.\n private _scoring: ScoreResult;\n\n /**\n * Constructor.\n * @param {Collection} collection - the collection which this Resultset will query against\n */\n constructor(collection: Collection) {\n // retain reference to collection we are querying against\n this.collection = collection;\n this.filteredrows = [];\n this.filterInitialized = false;\n this._scoring = null;\n }\n\n /**\n * reset() - Reset the resultset to its initial state.\n *\n * @returns {Resultset} Reference to this resultset, for future chain operations.\n */\n reset(): Resultset {\n if (this.filteredrows.length > 0) {\n this.filteredrows = [];\n }\n this.filterInitialized = false;\n return this;\n }\n\n /**\n * toJSON() - Override of toJSON to avoid circular references\n *\n */\n public toJSON(): Resultset {\n const copy = this.copy();\n copy.collection = null;\n return copy;\n }\n\n /**\n * Allows you to limit the number of documents passed to next chain operation.\n * A resultset copy() is made to avoid altering original resultset.\n *\n * @param {int} qty - The number of documents to return.\n * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops.\n */\n public limit(qty: number): Resultset {\n // if this has no filters applied, we need to populate filteredrows first\n if (!this.filterInitialized && this.filteredrows.length === 0) {\n this.filteredrows = this.collection.prepareFullDocIndex();\n }\n\n this.filteredrows = this.filteredrows.slice(0, qty);\n this.filterInitialized = true;\n return this;\n }\n\n /**\n * Used for skipping 'pos' number of documents in the resultset.\n *\n * @param {int} pos - Number of documents to skip; all preceding documents are filtered out.\n * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops.\n */\n public offset(pos: number): Resultset {\n // if this has no filters applied, we need to populate filteredrows first\n if (!this.filterInitialized && this.filteredrows.length === 0) {\n this.filteredrows = this.collection.prepareFullDocIndex();\n }\n\n this.filteredrows = this.filteredrows.slice(pos);\n this.filterInitialized = true;\n return this;\n }\n\n /**\n * copy() - To support reuse of resultset in branched query situations.\n *\n * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same.\n */\n public copy(): Resultset {\n const result = new Resultset(this.collection);\n\n if (this.filteredrows.length > 0) {\n result.filteredrows = this.filteredrows.slice();\n }\n result.filterInitialized = this.filterInitialized;\n\n return result;\n }\n\n /**\n * Alias of copy()\n */\n branch() {\n return this.copy();\n }\n\n /**\n * Executes a named collection transform or raw array of transform steps against the resultset.\n *\n * @param {(string|array)} transform - name of collection transform or raw transform array\n * @param {object} [parameters=] - object property hash of parameters, if the transform requires them.\n * @returns {Resultset} either (this) resultset or a clone of of this resultset (depending on steps)\n */\n transform(transform: string | any[], parameters?: object): Resultset {\n let idx;\n let step;\n let rs = this as Resultset;\n\n // if transform is name, then do lookup first\n if (typeof transform === \"string\") {\n if (this.collection.transforms[transform] !== undefined) {\n transform = this.collection.transforms[transform];\n }\n }\n\n // either they passed in raw transform array or we looked it up, so process\n if (typeof transform !== \"object\" || !Array.isArray(transform)) {\n throw new Error(\"Invalid transform\");\n }\n\n if (parameters !== undefined) {\n transform = resolveTransformParams(transform, parameters);\n }\n\n for (idx = 0; idx < transform.length; idx++) {\n step = transform[idx];\n\n switch (step.type) {\n case \"find\":\n rs.find(step.value);\n break;\n case \"where\":\n rs.where(step.value);\n break;\n case \"simplesort\":\n rs.simplesort(step.property, step.desc);\n break;\n case \"compoundsort\":\n rs.compoundsort(step.value);\n break;\n case \"sort\":\n rs.sort(step.value);\n break;\n case \"limit\":\n rs = rs.limit(step.value);\n break; // limit makes copy so update reference\n case \"offset\":\n rs = rs.offset(step.value);\n break; // offset makes copy so update reference\n case \"map\":\n rs = rs.map(step.value, step.dataOptions);\n break;\n case \"eqJoin\":\n rs = rs.eqJoin(step.joinData, step.leftJoinKey, step.rightJoinKey, step.mapFun, step.dataOptions);\n break;\n // following cases break chain by returning array data so make any of these last in transform steps\n case \"mapReduce\":\n rs = rs.mapReduce(step.mapFunction, step.reduceFunction);\n break;\n // following cases update documents in current filtered resultset (use carefully)\n case \"update\":\n rs.update(step.value);\n break;\n case \"remove\":\n rs.remove();\n break;\n default:\n break;\n }\n }\n return rs as Resultset;\n }\n\n /**\n * User supplied compare function is provided two documents to compare. (chainable)\n * @example\n * rslt.sort(function(obj1, obj2) {\n\t * if (obj1.name === obj2.name) return 0;\n\t * if (obj1.name > obj2.name) return 1;\n\t * if (obj1.name < obj2.name) return -1;\n\t * });\n *\n * @param {function} comparefun - A javascript compare function used for sorting.\n * @returns {Resultset} Reference to this resultset, sorted, for future chain operations.\n */\n public sort(comparefun: (a: E, b: E) => number): Resultset {\n // if this has no filters applied, just we need to populate filteredrows first\n if (!this.filterInitialized && this.filteredrows.length === 0) {\n this.filteredrows = this.collection.prepareFullDocIndex();\n }\n\n const wrappedComparer =\n (((userComparer, data) => (a: number, b: number) => userComparer(data[a], data[b])))(comparefun, this.collection.data);\n\n this.filteredrows.sort(wrappedComparer);\n\n return this;\n }\n\n /**\n * Simpler, loose evaluation for user to sort based on a property name. (chainable).\n * Sorting based on the same lt/gt helper functions used for binary indices.\n *\n * @param {string} propname - name of property to sort by.\n * @param {boolean} isdesc - (Optional) If true, the property will be sorted in descending order\n * @returns {Resultset} Reference to this resultset, sorted, for future chain operations.\n */\n public simplesort(propname: string, isdesc?: boolean): Resultset {\n if (isdesc === undefined) {\n isdesc = false;\n }\n\n // if this has no filters applied, just we need to populate filteredrows first\n if (!this.filterInitialized && this.filteredrows.length === 0) {\n // if we have a binary index and no other filters applied, we can use that instead of sorting (again)\n if (this.collection.binaryIndices[propname] !== undefined) {\n // make sure index is up-to-date\n this.collection.ensureIndex(propname);\n // copy index values into filteredrows\n this.filteredrows = this.collection.binaryIndices[propname].values.slice(0);\n\n if (isdesc) {\n this.filteredrows.reverse();\n }\n\n // we are done, return this (resultset) for further chain ops\n return this;\n }\n // otherwise initialize array for sort below\n else {\n this.filteredrows = this.collection.prepareFullDocIndex();\n }\n }\n\n const wrappedComparer = ((prop, desc, data) => (a: number, b: number) => {\n let val1, val2, arr;\n if (~prop.indexOf(\".\")) {\n arr = prop.split(\".\");\n val1 = arr.reduce(function (obj, i) {\n return obj && obj[i] || undefined;\n }, data[a]);\n val2 = arr.reduce(function (obj, i) {\n return obj && obj[i] || undefined;\n }, data[b]);\n } else {\n val1 = data[a][prop];\n val2 = data[b][prop];\n }\n return sortHelper(val1, val2, desc);\n })(propname, isdesc, this.collection.data);\n\n this.filteredrows.sort(wrappedComparer);\n\n return this;\n }\n\n /**\n * Allows sorting a resultset based on multiple columns.\n * @example\n * // to sort by age and then name (both ascending)\n * rs.compoundsort(['age', 'name']);\n * // to sort by age (ascending) and then by name (descending)\n * rs.compoundsort(['age', ['name', true]);\n *\n * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order\n * @returns {Resultset} Reference to this resultset, sorted, for future chain operations.\n */\n public compoundsort(properties: (string | [string, boolean])[]): Resultset {\n if (properties.length === 0) {\n throw new Error(\"Invalid call to compoundsort, need at least one property\");\n }\n\n let prop;\n if (properties.length === 1) {\n prop = properties[0];\n if (typeof prop === \"string\") {\n return this.simplesort(prop, false);\n } else {\n return this.simplesort(prop[0], prop[1]);\n }\n }\n\n // unify the structure of 'properties' to avoid checking it repeatedly while sorting\n for (let i = 0, len = properties.length; i < len; i += 1) {\n prop = properties[i];\n if (typeof prop === \"string\") {\n properties[i] = [prop, false];\n }\n }\n\n // if this has no filters applied, just we need to populate filteredrows first\n if (!this.filterInitialized && this.filteredrows.length === 0) {\n this.filteredrows = this.collection.prepareFullDocIndex();\n }\n\n const wrappedComparer =\n (((props, data) => (a: number, b: number) => this._compoundeval(props, data[a], data[b])))(properties as [string, boolean][], this.collection.data);\n\n this.filteredrows.sort(wrappedComparer);\n\n return this;\n }\n\n /**\n * Helper function for compoundsort(), performing individual object comparisons\n *\n * @param {Array} properties - array of property names, in order, by which to evaluate sort order\n * @param {object} obj1 - first object to compare\n * @param {object} obj2 - second object to compare\n * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first\n */\n private _compoundeval(properties: [string, boolean][], obj1: E, obj2: E): number {\n let res = 0;\n let prop;\n let field;\n let val1, val2, arr;\n for (let i = 0, len = properties.length; i < len; i++) {\n prop = properties[i];\n field = prop[0];\n if (~field.indexOf(\".\")) {\n arr = field.split(\".\");\n val1 = arr.reduce((obj: object, i: string) => {\n return obj && obj[i] || undefined;\n }, obj1);\n val2 = arr.reduce((obj: object, i: string) => {\n return obj && obj[i] || undefined;\n }, obj2);\n } else {\n val1 = obj1[field];\n val2 = obj2[field];\n }\n res = sortHelper(val1, val2, prop[1]);\n if (res !== 0) {\n return res;\n }\n }\n return 0;\n }\n\n /**\n * Sorts the resultset based on the last full-text-search scoring.\n * @param {boolean} [ascending=false] - sort ascending\n * @returns {Resultset}\n */\n public sortByScoring(ascending = false): Resultset {\n if (this._scoring === null) {\n throw new Error(\"No scoring available\");\n }\n\n if (ascending) {\n this.filteredrows.sort((a: number, b: number) => this._scoring[a] - this._scoring[b]);\n } else {\n this.filteredrows.sort((a: number, b: number) => this._scoring[b] - this._scoring[a]);\n }\n\n return this;\n }\n\n /**\n * Returns the scoring of the last full-text-search.\n * @returns {ScoreResult}\n */\n public getScoring(): ScoreResult {\n if (this._scoring === null) {\n throw new Error(\"No scoring available\");\n }\n\n return this._scoring;\n }\n\n /**\n * findOr() - oversee the operation of OR'ed query expressions.\n * OR'ed expression evaluation runs each expression individually against the full collection,\n * and finally does a set OR on each expression's results.\n * Each evaluation can utilize a binary index to prevent multiple linear array scans.\n *\n * @param {array} expressionArray - array of expressions\n * @returns {Resultset} this resultset for further chain ops.\n */\n public findOr(expressionArray: Query[]): Resultset {\n let fr = null;\n let fri = 0;\n let frlen = 0;\n const docset = [];\n const idxset = [];\n let idx = 0;\n const origCount = this.count();\n\n // If filter is already initialized, then we query against only those items already in filter.\n // This means no index utilization for fields, so hopefully its filtered to a smallish filteredrows.\n for (let ei = 0, elen = expressionArray.length; ei < elen; ei++) {\n // we need to branch existing query to run each filter separately and combine results\n fr = this.branch().find(expressionArray[ei]).filteredrows;\n frlen = fr.length;\n // if the find operation did not reduce the initial set, then the initial set is the actual result\n if (frlen === origCount) {\n return this;\n }\n\n // add any document 'hits'\n for (fri = 0; fri < frlen; fri++) {\n idx = fr[fri];\n if (idxset[idx] === undefined) {\n idxset[idx] = true;\n docset.push(idx);\n }\n }\n }\n\n this.filteredrows = docset;\n this.filterInitialized = true;\n\n return this;\n }\n\n public $or(expressionArray: Query[]): Resultset {\n return this.findOr(expressionArray);\n }\n\n /**\n * findAnd() - oversee the operation of AND'ed query expressions.\n * AND'ed expression evaluation runs each expression progressively against the full collection,\n * internally utilizing existing chained resultset functionality.\n * Only the first filter can utilize a binary index.\n *\n * @param {array} expressionArray - array of expressions\n * @returns {Resultset} this resultset for further chain ops.\n */\n public findAnd(expressionArray: Query[]): Resultset {\n // we have already implementing method chaining in this (our Resultset class)\n // so lets just progressively apply user supplied and filters\n for (let i = 0, len = expressionArray.length; i < len; i++) {\n if (this.count() === 0) {\n return this;\n }\n this.find(expressionArray[i]);\n }\n return this;\n }\n\n public $and(expressionArray: Query[]): Resultset {\n return this.findAnd(expressionArray);\n }\n\n /**\n * Used for querying via a mongo-style query object.\n *\n * @param {object} query - A mongo-style query object used for filtering current results.\n * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne()\n * @returns {Resultset} this resultset for further chain ops.\n */\n public find(query?: Query, firstOnly = false): Resultset {\n if (this.collection.data.length === 0) {\n this.filteredrows = [];\n this.filterInitialized = true;\n return this;\n }\n\n const queryObject = query || \"getAll\";\n let property;\n let queryObjectOp;\n let value;\n\n if (typeof queryObject === \"object\") {\n let filters = [];\n for (let p in queryObject) {\n let obj = {};\n obj[p] = queryObject[p];\n filters.push(obj);\n\n if (queryObject[p] !== undefined) {\n property = p;\n queryObjectOp = queryObject[p];\n }\n }\n // if more than one expression in single query object,\n // convert implicit $and to explicit $and\n if (filters.length > 1) {\n return this.find({\"$and\": filters}, firstOnly);\n }\n }\n\n // apply no filters if they want all\n if (!property || queryObject === \"getAll\") {\n if (firstOnly) {\n this.filteredrows = (this.collection.data.length > 0) ? [0] : [];\n this.filterInitialized = true;\n }\n return this;\n }\n\n // injecting $and and $or expression tree evaluation here.\n if (property === \"$and\" || property === \"$or\") {\n this[property](queryObjectOp);\n\n // for chained find with firstonly,\n if (firstOnly && this.filteredrows.length > 1) {\n this.filteredrows = this.filteredrows.slice(0, 1);\n }\n\n return this;\n }\n\n // see if query object is in shorthand mode (assuming eq operator)\n let operator;\n if (queryObjectOp === null || (typeof queryObjectOp !== \"object\" || queryObjectOp instanceof Date)) {\n operator = \"$eq\";\n value = queryObjectOp;\n } else if (typeof queryObjectOp === \"object\") {\n for (let key in queryObjectOp) {\n if (queryObjectOp[key] !== undefined) {\n operator = key;\n value = queryObjectOp[key];\n break;\n }\n }\n } else {\n throw new Error(\"Do not know what you want to do.\");\n }\n\n // for regex ops, precompile\n if (operator === \"$regex\") {\n if (Array.isArray(value)) {\n value = new RegExp(value[0], value[1]);\n } else if (!(value instanceof RegExp)) {\n value = new RegExp(value);\n }\n }\n\n // if user is deep querying the object such as find('name.first': 'odin')\n const usingDotNotation = (property.indexOf(\".\") !== -1);\n\n // if an index exists for the property being queried against, use it\n // for now only enabling where it is the first filter applied and prop is indexed\n const doIndexCheck = !usingDotNotation && !this.filterInitialized;\n\n let searchByIndex = false;\n if (doIndexCheck && this.collection.binaryIndices[property] && indexedOps[operator]) {\n // this is where our lazy index rebuilding will take place\n // basically we will leave all indexes dirty until we need them\n // so here we will rebuild only the index tied to this property\n // ensureIndex() will only rebuild if flagged as dirty since we are not passing force=true param\n if (this.collection.adaptiveBinaryIndices !== true) {\n this.collection.ensureIndex(property);\n }\n searchByIndex = true;\n }\n\n // the comparison function\n const fun = LokiOps[operator];\n\n // \"shortcut\" for collection data\n const data = this.collection.data;\n\n // Query executed differently depending on :\n // - whether the property being queried has an index defined\n // - if chained, we handle first pass differently for initial filteredrows[] population\n //\n // For performance reasons, each case has its own if block to minimize in-loop calculations\n\n let result: number[] = [];\n // If the filteredrows[] is already initialized, use it\n if (this.filterInitialized) {\n let filter = this.filteredrows;\n\n // currently supporting dot notation for non-indexed conditions only\n if (usingDotNotation) {\n property = property.split(\".\");\n for (let i = 0; i < filter.length; i++) {\n let rowIdx = filter[i];\n if (dotSubScan(data[rowIdx], property, fun, value)) {\n result.push(rowIdx);\n }\n }\n } else if (property === \"$fts\") {\n this._scoring = this.collection._fullTextSearch.search(query[\"$fts\"]);\n let keys = Object.keys(this._scoring);\n for (let i = 0; i < keys.length; i++) {\n if (filter.includes(+keys[i])) {\n result.push(+keys[i]);\n }\n }\n } else if (this.collection.constraints.unique[property] !== undefined && operator === \"$eq\") {\n // Use unique constraint for search.\n let row = this.collection.constraints.unique[property].get(value);\n if (filter.includes(row)) {\n result.push(row);\n }\n } else {\n for (let i = 0; i < filter.length; i++) {\n let rowIdx = filter[i];\n if (fun(data[rowIdx][property], value)) {\n result.push(rowIdx);\n }\n }\n }\n\n this.filteredrows = result;\n this.filterInitialized = true; // next time work against filteredrows[]\n return this;\n }\n\n this.filteredrows = result;\n this.filterInitialized = true; // next time work against filteredrows[]\n\n if (property === \"$fts\") {\n this._scoring = this.collection._fullTextSearch.search(query[\"$fts\"]);\n let keys = Object.keys(this._scoring);\n for (let i = 0; i < keys.length; i++) {\n result.push(+keys[i]);\n }\n return this;\n }\n\n // Use unique constraint for search.\n if (this.collection.constraints.unique[property] !== undefined && operator === \"$eq\") {\n result.push(this.collection.constraints.unique[property].get(value));\n return this;\n }\n\n // first chained query so work against data[] but put results in filteredrows\n // if not searching by index\n if (!searchByIndex) {\n if (usingDotNotation) {\n property = property.split(\".\");\n for (let i = 0; i < data.length; i++) {\n if (dotSubScan(data[i], property, fun, value)) {\n result.push(i);\n if (firstOnly) {\n return this;\n }\n }\n }\n } else {\n for (let i = 0; i < data.length; i++) {\n if (fun(data[i][property], value)) {\n result.push(i);\n if (firstOnly) {\n return this;\n }\n }\n }\n }\n return this;\n }\n\n let index = this.collection.binaryIndices[property];\n if (operator !== \"$in\") {\n // search by index\n const segm = this.collection.calculateRange(operator, property, value);\n for (let i = segm[0]; i <= segm[1]; i++) {\n if (indexedOps[operator] !== true) {\n // must be a function, implying 2nd phase filtering of results from calculateRange\n if (indexedOps[operator](data[index.values[i]][property], value)) {\n result.push(index.values[i]);\n if (firstOnly) {\n return this;\n }\n }\n } else {\n result.push(index.values[i]);\n if (firstOnly) {\n return this;\n }\n }\n }\n } else {\n const idxset = [];\n // query each value '$eq' operator and merge the segment results.\n for (let j = 0, len = value.length; j < len; j++) {\n const segm = this.collection.calculateRange(\"$eq\", property, value[j]);\n for (let i = segm[0]; i <= segm[1]; i++) {\n if (idxset[i] === undefined) {\n idxset[i] = true;\n result.push(index.values[i]);\n }\n if (firstOnly) {\n return this;\n }\n }\n }\n }\n return this;\n }\n\n\n /**\n * Used for filtering via a javascript filter function.\n *\n * @param {function} fun - A javascript function used for filtering current results by.\n * @returns {Resultset} this resultset for further chain ops.\n */\n public where(fun: (obj: E) => boolean): Resultset {\n let viewFunction;\n let result = [];\n\n if (\"function\" === typeof fun) {\n viewFunction = fun;\n } else {\n throw new TypeError(\"Argument is not a stored view or a function\");\n }\n try {\n // If the filteredrows[] is already initialized, use it\n if (this.filterInitialized) {\n let j = this.filteredrows.length;\n\n while (j--) {\n if (viewFunction(this.collection.data[this.filteredrows[j]]) === true) {\n result.push(this.filteredrows[j]);\n }\n }\n\n this.filteredrows = result;\n\n return this;\n }\n // otherwise this is initial chained op, work against data, push into filteredrows[]\n else {\n let k = this.collection.data.length;\n\n while (k--) {\n if (viewFunction(this.collection.data[k]) === true) {\n result.push(k);\n }\n }\n\n this.filteredrows = result;\n this.filterInitialized = true;\n\n return this;\n }\n } catch (err) {\n throw err;\n }\n }\n\n /**\n * Returns the number of documents in the resultset.\n * @returns {number} The number of documents in the resultset.\n */\n public count(): number {\n if (this.filterInitialized) {\n return this.filteredrows.length;\n }\n return this.collection.count();\n }\n\n /**\n * Terminates the chain and returns array of filtered documents\n * @param {object} options\n * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when\n * the collection is not configured for clone object.\n * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method.\n * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow'\n * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents\n *\n * @returns {Array} Array of documents in the resultset\n */\n public data(options: Resultset.DataOptions = {}): Doc[] {\n let forceClones: boolean;\n let forceCloneMethod: CloneMethod;\n let removeMeta: boolean;\n (\n {\n forceClones,\n forceCloneMethod = this.collection.cloneMethod,\n removeMeta = false\n } = options\n );\n\n let result = [];\n let data = this.collection.data;\n let obj;\n let len;\n let i;\n let method;\n\n // if user opts to strip meta, then force clones and use 'shallow' if 'force' options are not present\n if (removeMeta && !forceClones) {\n forceClones = true;\n forceCloneMethod = CloneMethod.SHALLOW;\n }\n\n // if collection has delta changes active, then force clones and use CloneMethod.DEEP for effective change tracking of nested objects\n if (!this.collection.disableDeltaChangesApi) {\n forceClones = true;\n forceCloneMethod = CloneMethod.DEEP;\n }\n\n // if this has no filters applied, just return collection.data\n if (!this.filterInitialized) {\n if (this.filteredrows.length === 0) {\n // determine whether we need to clone objects or not\n if (this.collection.cloneObjects || forceClones) {\n len = data.length;\n method = forceCloneMethod;\n\n for (i = 0; i < len; i++) {\n obj = clone(data[i], method);\n if (removeMeta) {\n delete obj.$loki;\n delete obj.meta;\n }\n result.push(obj);\n }\n return result;\n }\n // otherwise we are not cloning so return sliced array with same object references\n else {\n return data.slice();\n }\n } else {\n // filteredrows must have been set manually, so use it\n this.filterInitialized = true;\n }\n }\n\n const fr = this.filteredrows;\n len = fr.length;\n\n if (this.collection.cloneObjects || forceClones) {\n method = forceCloneMethod;\n for (i = 0; i < len; i++) {\n obj = clone(data[fr[i]], method);\n if (removeMeta) {\n delete obj.$loki;\n delete obj.meta;\n }\n result.push(obj);\n }\n } else {\n for (i = 0; i < len; i++) {\n result.push(data[fr[i]]);\n }\n }\n return result;\n }\n\n /**\n * Used to run an update operation on all documents currently in the resultset.\n *\n * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object.\n * @returns {Resultset} this resultset for further chain ops.\n */\n update(updateFunction: (obj: E) => E): Resultset {\n // if this has no filters applied, we need to populate filteredrows first\n if (!this.filterInitialized && this.filteredrows.length === 0) {\n this.filteredrows = this.collection.prepareFullDocIndex();\n }\n\n const len = this.filteredrows.length;\n const rcd = this.collection.data;\n\n for (let idx = 0; idx < len; idx++) {\n // pass in each document object currently in resultset to user supplied updateFunction\n updateFunction(rcd[this.filteredrows[idx]]);\n\n // notify collection we have changed this object so it can update meta and allow DynamicViews to re-evaluate\n this.collection.update(rcd[this.filteredrows[idx]]);\n }\n\n return this;\n }\n\n /**\n * Removes all document objects which are currently in resultset from collection (as well as resultset)\n *\n * @returns {Resultset} this (empty) resultset for further chain ops.\n */\n public remove(): Resultset {\n // if this has no filters applied, we need to populate filteredrows first\n if (!this.filterInitialized && this.filteredrows.length === 0) {\n this.filteredrows = this.collection.prepareFullDocIndex();\n }\n this.collection.remove(this.data());\n this.filteredrows = [];\n return this;\n }\n\n /**\n * data transformation via user supplied functions\n *\n * @param {function} mapFunction - this function accepts a single document for you to transform and return\n * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value\n * @returns {value} The output of your reduceFunction\n */\n public mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U {\n try {\n return reduceFunction(this.data().map(mapFunction));\n } catch (err) {\n throw err;\n }\n }\n\n /**\n * Left joining two sets of data. Join keys can be defined or calculated properties\n * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key\n * @param {Array|Resultset|Collection} joinData - Data array to join to.\n * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on\n * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on\n * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject}\n * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides\n * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun\n * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object\n * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method.\n * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}]\n */\n //eqJoin(joinData: T[] | Resultset, leftJoinKey: string | ((obj: E) => string), rightJoinKey: string | ((obj: T) => string)): Resultset<{ left: E; right: T; }>;\n // eqJoin(joinData: T[] | Resultset, leftJoinKey: string | ((obj: E) => string), rightJoinKey: string | ((obj: T) => string), mapFun?: (a: E, b: T) => U, dataOptions?: Resultset.DataOptions): Resultset {\n eqJoin(joinData: ANY, leftJoinKey: string | Function, rightJoinKey: string | Function, mapFun?: Function, dataOptions?: ANY): ANY {\n// eqJoin(joinData: T[] | Resultset, leftJoinKey: string | ((obj: E) => string), rightJoinKey: string | ((obj: T) => string), mapFun?: (a: E, b: T) => U, dataOptions?: Resultset.DataOptions): Resultset {\n let leftData = [];\n let leftDataLength;\n let rightData = [];\n let rightDataLength;\n let key;\n let result = [];\n let leftKeyisFunction = typeof leftJoinKey === \"function\";\n let rightKeyisFunction = typeof rightJoinKey === \"function\";\n let joinMap = {};\n\n //get the left data\n leftData = this.data(dataOptions);\n leftDataLength = leftData.length;\n\n //get the right data\n if (joinData instanceof Collection) {\n rightData = joinData.chain().data(dataOptions);\n } else if (joinData instanceof Resultset) {\n rightData = joinData.data(dataOptions);\n } else if (Array.isArray(joinData)) {\n rightData = joinData;\n } else {\n throw new TypeError(\"joinData needs to be an array or result set\");\n }\n rightDataLength = rightData.length;\n\n //construct a lookup table\n for (let i = 0; i < rightDataLength; i++) {\n key = rightKeyisFunction ? (rightJoinKey as Function)(rightData[i]) : rightData[i][rightJoinKey as string];\n joinMap[key] = rightData[i];\n }\n\n if (!mapFun) {\n mapFun = (left: ANY, right: ANY) => ({\n left,\n right\n });\n }\n\n //Run map function over each object in the resultset\n for (let j = 0; j < leftDataLength; j++) {\n key = leftKeyisFunction ? (leftJoinKey as Function)(leftData[j]) : leftData[j][leftJoinKey as string];\n result.push(mapFun(leftData[j], joinMap[key] || {}));\n }\n\n //return a new resultset with no filters\n this.collection = new Collection(\"joinData\");\n this.collection.insert(result);\n this.filteredrows = [];\n this.filterInitialized = false;\n\n return this;\n }\n\n /**\n * Applies a map function into a new collection for further chaining.\n * @param {function} mapFun - javascript map function\n * @param {object} [dataOptions=] - options to data() before input to your map function\n * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun\n * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object\n * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method.\n */\n map(mapFun: (obj: E, index: number, array: E[]) => U, dataOptions?: Resultset.DataOptions): Resultset {\n let data = this.data(dataOptions).map(mapFun);\n //return return a new resultset with no filters\n this.collection = new Collection(\"mappedData\");\n this.collection.insert(data as any as E);\n this.filteredrows = [];\n this.filterInitialized = false;\n\n return this as any as Resultset;\n }\n}\n\nexport namespace Resultset {\n export interface DataOptions {\n forceClones?: boolean;\n forceCloneMethod?: CloneMethod;\n removeMeta?: boolean;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/resultset.ts","/**\n * @hidden\n */\nexport type ANY = any;\n\n/** Helper function for determining 'loki' abstract equality which is a little more abstract than ==\n * aeqHelper(5, '5') === true\n * aeqHelper(5.0, '5') === true\n * aeqHelper(new Date(\"1/1/2011\"), new Date(\"1/1/2011\")) === true\n * aeqHelper({a:1}, {z:4}) === true (all objects sorted equally)\n * aeqHelper([1, 2, 3], [1, 3]) === false\n * aeqHelper([1, 2, 3], [1, 2, 3]) === true\n * aeqHelper(undefined, null) === true\n */\n\n/**\n * @hidden\n * @param {ANY} prop1\n * @param {ANY} prop2\n * @returns {boolean}\n */\nexport function aeqHelper(prop1: ANY, prop2: ANY) {\n let cv1;\n let cv2;\n let t1;\n let t2;\n\n if (prop1 === prop2) return true;\n\n // 'falsy' and Boolean handling\n if (!prop1 || !prop2 || prop1 === true || prop2 === true || prop1 !== prop1 || prop2 !== prop2) {\n // dates and NaN conditions (typed dates before serialization)\n switch (prop1) {\n case undefined:\n t1 = 1;\n break;\n case null:\n t1 = 1;\n break;\n case false:\n t1 = 3;\n break;\n case true:\n t1 = 4;\n break;\n case \"\":\n t1 = 5;\n break;\n default:\n t1 = (prop1 === prop1) ? 9 : 0;\n break;\n }\n\n switch (prop2) {\n case undefined:\n t2 = 1;\n break;\n case null:\n t2 = 1;\n break;\n case false:\n t2 = 3;\n break;\n case true:\n t2 = 4;\n break;\n case \"\":\n t2 = 5;\n break;\n default:\n t2 = (prop2 === prop2) ? 9 : 0;\n break;\n }\n\n // one or both is edge case\n if (t1 !== 9 || t2 !== 9) {\n return (t1 === t2);\n }\n }\n\n // Handle 'Number-like' comparisons\n cv1 = Number(prop1);\n cv2 = Number(prop2);\n\n // if one or both are 'number-like'...\n if (cv1 === cv1 || cv2 === cv2) {\n return (cv1 === cv2);\n }\n\n // not strict equal nor less than nor gt so must be mixed types, convert to string and use that to compare\n cv1 = prop1.toString();\n cv2 = prop2.toString();\n\n return (cv1 == cv2);\n}\n\n/** Helper function for determining 'less-than' conditions for ops, sorting, and binary indices.\n * In the future we might want $lt and $gt ops to use their own functionality/helper.\n * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we\n * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another.\n * @hidden\n */\nexport function ltHelper(prop1: ANY, prop2: ANY, equal: boolean) {\n let cv1;\n let cv2;\n let t1;\n let t2;\n\n // if one of the params is falsy or strictly true or not equal to itself\n // 0, 0.0, \"\", NaN, null, undefined, not defined, false, true\n if (!prop1 || !prop2 || prop1 === true || prop2 === true || prop1 !== prop1 || prop2 !== prop2) {\n switch (prop1) {\n case undefined:\n t1 = 1;\n break;\n case null:\n t1 = 1;\n break;\n case false:\n t1 = 3;\n break;\n case true:\n t1 = 4;\n break;\n case \"\":\n t1 = 5;\n break;\n // if strict equal probably 0 so sort higher, otherwise probably NaN so sort lower than even null\n default:\n t1 = (prop1 === prop1) ? 9 : 0;\n break;\n }\n\n switch (prop2) {\n case undefined:\n t2 = 1;\n break;\n case null:\n t2 = 1;\n break;\n case false:\n t2 = 3;\n break;\n case true:\n t2 = 4;\n break;\n case \"\":\n t2 = 5;\n break;\n default:\n t2 = (prop2 === prop2) ? 9 : 0;\n break;\n }\n\n // one or both is edge case\n if (t1 !== 9 || t2 !== 9) {\n return (t1 === t2) ? equal : (t1 < t2);\n }\n }\n\n // if both are numbers (string encoded or not), compare as numbers\n cv1 = Number(prop1);\n cv2 = Number(prop2);\n\n if (cv1 === cv1 && cv2 === cv2) {\n if (cv1 < cv2) return true;\n if (cv1 > cv2) return false;\n return equal;\n }\n\n if (cv1 === cv1 && cv2 !== cv2) {\n return true;\n }\n\n if (cv2 === cv2 && cv1 !== cv1) {\n return false;\n }\n\n if (prop1 < prop2) return true;\n if (prop1 > prop2) return false;\n if (prop1 == prop2) return equal;\n\n // not strict equal nor less than nor gt so must be mixed types, convert to string and use that to compare\n cv1 = prop1.toString();\n cv2 = prop2.toString();\n\n if (cv1 < cv2) {\n return true;\n }\n\n if (cv1 == cv2) {\n return equal;\n }\n\n return false;\n}\n\n/**\n * @hidden\n * @param {ANY} prop1\n * @param {ANY} prop2\n * @param {boolean} equal\n * @returns {boolean}\n */\nexport function gtHelper(prop1: ANY, prop2: ANY, equal: boolean) {\n let cv1;\n let cv2;\n let t1;\n let t2;\n\n // 'falsy' and Boolean handling\n if (!prop1 || !prop2 || prop1 === true || prop2 === true || prop1 !== prop1 || prop2 !== prop2) {\n switch (prop1) {\n case undefined:\n t1 = 1;\n break;\n case null:\n t1 = 1;\n break;\n case false:\n t1 = 3;\n break;\n case true:\n t1 = 4;\n break;\n case \"\":\n t1 = 5;\n break;\n // NaN 0\n default:\n t1 = (prop1 === prop1) ? 9 : 0;\n break;\n }\n\n switch (prop2) {\n case undefined:\n t2 = 1;\n break;\n case null:\n t2 = 1;\n break;\n case false:\n t2 = 3;\n break;\n case true:\n t2 = 4;\n break;\n case \"\":\n t2 = 5;\n break;\n default:\n t2 = (prop2 === prop2) ? 9 : 0;\n break;\n }\n\n // one or both is edge case\n if (t1 !== 9 || t2 !== 9) {\n return (t1 === t2) ? equal : (t1 > t2);\n }\n }\n\n // if both are numbers (string encoded or not), compare as numbers\n cv1 = Number(prop1);\n cv2 = Number(prop2);\n if (cv1 === cv1 && cv2 === cv2) {\n if (cv1 > cv2) return true;\n if (cv1 < cv2) return false;\n return equal;\n }\n\n if (cv1 === cv1 && cv2 !== cv2) {\n return false;\n }\n\n if (cv2 === cv2 && cv1 !== cv1) {\n return true;\n }\n\n if (prop1 > prop2) return true;\n if (prop1 < prop2) return false;\n if (prop1 == prop2) return equal;\n\n // not strict equal nor less than nor gt so must be dates or mixed types\n // convert to string and use that to compare\n cv1 = prop1.toString();\n cv2 = prop2.toString();\n\n if (cv1 > cv2) {\n return true;\n }\n\n if (cv1 == cv2) {\n return equal;\n }\n\n return false;\n}\n\n/**\n * @hidden\n * @param {ANY} prop1\n * @param {ANY} prop2\n * @param {ANY} desc\n * @returns {number}\n */\nexport function sortHelper(prop1: ANY, prop2: ANY, desc: ANY) {\n if (aeqHelper(prop1, prop2)) return 0;\n\n if (ltHelper(prop1, prop2, false)) {\n return (desc) ? (1) : (-1);\n }\n\n if (gtHelper(prop1, prop2, false)) {\n return (desc) ? (-1) : (1);\n }\n\n // not lt, not gt so implied equality-- date compatible\n return 0;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/helper.ts","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","import {Loki} from \"./loki\";\nimport {Collection} from \"./collection\";\n\nexport {Loki, Collection};\n\nexport default {Loki};\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/index.ts","import {LokiEventEmitter} from \"./event_emitter\";\nimport {Collection} from \"./collection\";\nimport {Doc, StorageAdapter} from \"../../common/types\";\nimport {PLUGINS} from \"../../common/plugin\";\n\nexport type ANY = any;\n\nfunction getENV() {\n if (global !== undefined && (global[\"android\"] || global[\"NSObject\"])) {\n return Loki.Environment.NATIVE_SCRIPT;\n }\n\n const isNode = global !== undefined && ({}).toString.call(global) === \"[object global]\";\n if (isNode) {\n if (global[\"window\"]) {\n return Loki.Environment.NODE_JS; //node-webkit\n } else {\n return Loki.Environment.NODE_JS;\n }\n }\n\n const isBrowser = window !== undefined && ({}).toString.call(window) === \"[object Window]\";\n if (document !== undefined) {\n if (document.URL.indexOf(\"http://\") === -1 && document.URL.indexOf(\"https://\") === -1) {\n return Loki.Environment.CORDOVA;\n }\n return Loki.Environment.BROWSER;\n }\n\n if (!isBrowser) {\n throw SyntaxError(\"Unknown environment...\");\n }\n}\n\nexport class Loki extends LokiEventEmitter {\n\n private filename: string;\n private databaseVersion: number;\n private engineVersion: number;\n\n\n //private options: ANY;\n private _collections: Collection[];\n private _verbose: boolean;\n\n private _env: Loki.Environment;\n\n private _serializationMethod: Loki.SerializationMethod;\n private _destructureDelimiter: string;\n private _persistenceMethod: Loki.PersistenceMethod;\n private _persistenceAdapter: StorageAdapter;\n\n private _throttledSaves: boolean;\n private _throttledSaveRunning: Promise;\n private _throttledSavePending: Promise;\n\n private _autosave: boolean;\n private _autosaveInterval: number;\n private _autosaveHandle: Function;\n\n\n /**\n * Constructs the main database class.\n * @param {string} filename - name of the file to be saved to\n * @param {object} [options={}] - options\n * @param {Loki.Environment} [options.env=auto] - overrides environment detection\n * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method\n * @param {string} [options.destructureDelimiter=\"$<\\n\"] - string delimiter used for destructured serialization\n * @param {boolean} [options.verbose=false] - enable console output\n */\n constructor(filename = \"loki.db\", options: Loki.Options = {}) {\n super();\n\n this.filename = filename;\n this._collections = [];\n\n (\n {\n serializationMethod: this._serializationMethod = Loki.SerializationMethod.NORMAL,\n destructureDelimiter: this._destructureDelimiter = \"$<\\n\",\n verbose: this._verbose = false,\n env: this._env = getENV()\n } = options\n );\n\n // persist version of code which created the database to the database.\n // could use for upgrade scenarios\n this.databaseVersion = 1.5;\n this.engineVersion = 1.5;\n\n // autosave support (disabled by default)\n this._autosave = false;\n this._autosaveInterval = 5000;\n this._autosaveHandle = null;\n this._throttledSaves = true;\n\n // currently keeping persistenceMethod and persistenceAdapter as loki level properties that\n // will not or cannot be deserialized You are required to configure persistence every time\n // you instantiate a loki object (or use default environment detection) in order to load the database anyways.\n\n // persistenceMethod could be 'fs', 'localStorage', or 'adapter'\n // this is optional option param, otherwise environment detection will be used\n // if user passes their own adapter we will force this method to 'adapter' later, so no need to pass method option.\n this._persistenceMethod = null;\n\n // retain reference to optional (non-serializable) persistenceAdapter 'instance'\n this._persistenceAdapter = null;\n\n // flags used to throttle saves\n this._throttledSaveRunning = null;\n this._throttledSavePending = null;\n\n this.events = {\n \"init\": [],\n \"loaded\": [],\n \"flushChanges\": [],\n \"close\": [],\n \"changes\": [],\n \"warning\": []\n };\n\n this.on(\"init\", this.clearChanges);\n }\n\n /**\n * configures options related to database persistence.\n *\n * @param {Loki.PersistenceOptions} [options={}] - options\n * @param {adapter} [options.adapter=auto] - an instance of a loki persistence adapter\n * @param {boolean} [options.autosave=false] - enables autosave\n * @param {int} [options.autosaveInterval=5000] - time interval (in milliseconds) between saves (if dirty)\n * @param {boolean} [options.autoload=false] - enables autoload on loki instantiation\n * @param {object} options.inflate - options that are passed to loadDatabase if autoload enabled\n * @param {boolean} [options.throttledSaves=true] - if true, it batches multiple calls to to saveDatabase reducing number of\n * disk I/O operations and guaranteeing proper serialization of the calls. Default value is true.\n * @param {Loki.PersistenceMethod} options.persistenceMethod - a persistence method which should be used (FS_STORAGE, LOCAL_STORAGE...)\n * @returns {Promise} a Promise that resolves after initialization and (if enabled) autoloading the database\n */\n initializePersistence(options: Loki.PersistenceOptions = {}) {\n (\n {\n autosave: this._autosave = false,\n autosaveInterval: this._autosaveInterval = 5000,\n persistenceMethod: this._persistenceMethod,\n // TODO\n //inflate: this.options.inflate,\n throttledSaves: this._throttledSaves = true,\n } = options\n );\n\n const DEFAULT_PERSISTENCE = {\n [Loki.Environment.NODE_JS]: [Loki.PersistenceMethod.FS_STORAGE],\n [Loki.Environment.BROWSER]: [Loki.PersistenceMethod.LOCAL_STORAGE, Loki.PersistenceMethod.INDEXED_STORAGE],\n [Loki.Environment.CORDOVA]: [Loki.PersistenceMethod.LOCAL_STORAGE, Loki.PersistenceMethod.INDEXED_STORAGE],\n [Loki.Environment.MEMORY]: [Loki.PersistenceMethod.MEMORY_STORAGE]\n };\n\n const PERSISTENCE_METHODS = {\n [Loki.PersistenceMethod.FS_STORAGE]: PLUGINS[\"LokiFSStorage\"],\n [Loki.PersistenceMethod.LOCAL_STORAGE]: PLUGINS[\"LokiLocalStorage\"],\n [Loki.PersistenceMethod.INDEXED_STORAGE]: PLUGINS[\"LokiIndexedStorage\"],\n [Loki.PersistenceMethod.MEMORY_STORAGE]: PLUGINS[\"LokiMemoryStorage\"]\n };\n\n // process the options\n if (this._persistenceMethod !== undefined) {\n // check if the specified persistence method is known\n if (typeof(PERSISTENCE_METHODS[this._persistenceMethod]) === \"function\") {\n this._persistenceAdapter = new (PERSISTENCE_METHODS[this._persistenceMethod]);\n } else {\n throw Error(\"Unknown persistence method.\");\n }\n }\n\n // if user passes adapter, set persistence mode to adapter and retain persistence adapter instance\n if (options.adapter !== undefined) {\n this._persistenceMethod = Loki.PersistenceMethod.ADAPTER;\n this._persistenceAdapter = options.adapter;\n }\n\n // if by now there is no adapter specified by user nor derived from persistenceMethod: use sensible defaults\n if (this._persistenceAdapter === null) {\n let possiblePersistenceMethods = DEFAULT_PERSISTENCE[this._env];\n if (possiblePersistenceMethods) {\n for (let i = 0; i < possiblePersistenceMethods.length; i++) {\n if (PERSISTENCE_METHODS[possiblePersistenceMethods[i]]) {\n this._persistenceMethod = possiblePersistenceMethods[i];\n this._persistenceAdapter = new (PERSISTENCE_METHODS[possiblePersistenceMethods[i]]);\n break;\n }\n }\n }\n }\n\n this.autosaveDisable();\n\n // if they want to load database on loki instantiation, now is a good time to load... after adapter set and before possible autosave initiation\n let loaded;\n if (options.autoload) {\n loaded = this.loadDatabase(options.inflate);\n } else {\n loaded = Promise.resolve();\n }\n\n return loaded.then(() => {\n if (this._autosave) {\n this.autosaveEnable();\n }\n });\n }\n\n /**\n * Copies 'this' database into a new Loki instance. Object references are shared to make lightweight.\n * @param {object} options - options\n * @param {boolean} options.removeNonSerializable - nulls properties not safe for serialization.\n */\n copy(options: Loki.CopyOptions = {}) {\n const databaseCopy = new Loki(this.filename, {env: this._env});\n\n // currently inverting and letting loadJSONObject do most of the work\n databaseCopy.loadJSONObject(this, {\n retainDirtyFlags: true\n });\n\n // since our toJSON is not invoked for reference database adapters, this will let us mimic\n if (options.removeNonSerializable) {\n databaseCopy._autosaveHandle = null;\n databaseCopy._persistenceAdapter = null;\n\n for (let idx = 0; idx < databaseCopy._collections.length; idx++) {\n databaseCopy._collections[idx].constraints = null;\n databaseCopy._collections[idx].ttl = null;\n }\n }\n\n return databaseCopy;\n }\n\n /**\n * Adds a collection to the database.\n * @param {string} name - name of collection to add\n * @param {object} [options={}] - options to configure collection with.\n * @param {array} [options.unique=[]] - array of property names to define unique constraints for\n * @param {array} [options.exact=[]] - array of property names to define exact constraints for\n * @param {array} [options.indices=[]] - array property names to define binary indexes for\n * @param {boolean} [options.asyncListeners=false] - whether listeners are called asynchronously\n * @param {boolean} [options.disableChangesApi=true] - set to false to enable Changes Api\n * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user\n * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method\n * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default.\n * @returns {Collection} a reference to the collection which was just added\n */\n addCollection(name: string, options: Collection.Options = {}) {\n const collection = new Collection(name, options);\n this._collections.push(collection);\n\n if (this._verbose) {\n collection.console = console;\n }\n return collection as Collection;\n }\n\n loadCollection(collection: Collection) {\n if (!collection.name) {\n throw new Error(\"Collection must have a name property to be loaded\");\n }\n this._collections.push(collection);\n }\n\n /**\n * Retrieves reference to a collection by name.\n * @param {string} collectionName - name of collection to look up\n * @returns {Collection} Reference to collection in database by that name, or null if not found\n */\n getCollection(collectionName: string) {\n let i;\n const len = this._collections.length;\n\n for (i = 0; i < len; i += 1) {\n if (this._collections[i].name === collectionName) {\n return this._collections[i] as Collection;\n }\n }\n\n // no such collection\n this.emit(\"warning\", \"collection \" + collectionName + \" not found\");\n return null;\n }\n\n /**\n * Renames an existing loki collection\n * @param {string} oldName - name of collection to rename\n * @param {string} newName - new name of collection\n * @returns {Collection} reference to the newly renamed collection\n */\n renameCollection(oldName: string, newName: string) {\n const c = this.getCollection(oldName);\n if (c) {\n c.name = newName;\n }\n\n return c;\n }\n\n listCollections() {\n const colls = [];\n for (let i = 0; i < this._collections.length; i++) {\n colls.push({\n name: this._collections[i].name,\n count: this._collections[i].data.length\n });\n }\n return colls;\n }\n\n /**\n * Removes a collection from the database.\n * @param {string} collectionName - name of collection to remove\n */\n removeCollection(collectionName: string) {\n for (let i = 0; i < this._collections.length; i += 1) {\n if (this._collections[i].name === collectionName) {\n const tmpcol = new Collection(collectionName, {});\n const curcol = this._collections[i];\n for (const prop in curcol) {\n if (curcol[prop] !== undefined && tmpcol[prop] !== undefined) {\n curcol[prop] = tmpcol[prop];\n }\n }\n this._collections.splice(i, 1);\n return;\n }\n }\n }\n\n getName() {\n return this.filename;\n }\n\n /**\n * Serialize database to a string which can be loaded via {@link Loki#loadJSON}\n *\n * @returns {string} Stringified representation of the loki database.\n */\n serialize(options: Loki.SerializeOptions = {}) {\n if (options.serializationMethod === undefined) {\n options.serializationMethod = this._serializationMethod;\n }\n\n switch (options.serializationMethod) {\n case Loki.SerializationMethod.NORMAL:\n return JSON.stringify(this);\n case Loki.SerializationMethod.PRETTY:\n return JSON.stringify(this, null, 2);\n case Loki.SerializationMethod.DESTRUCTURED:\n return this.serializeDestructured(); // use default options\n default:\n return JSON.stringify(this);\n }\n }\n\n // alias of serialize\n toJSON() {\n return {\n _env: this._env,\n _serializationMethod: this._serializationMethod,\n _autosave: this._autosave,\n _autosaveInterval: this._autosaveInterval,\n _collections: this._collections,\n databaseVersion: this.databaseVersion,\n engineVersion: this.engineVersion,\n filename: this.filename,\n _persistenceAdapter: this._persistenceAdapter,\n _persistenceMethod: this._persistenceMethod,\n _throttledSaves: this._throttledSaves,\n _verbose: this._verbose,\n };\n }\n\n /**\n * Database level destructured JSON serialization routine to allow alternate serialization methods.\n * Internally, Loki supports destructuring via loki \"serializationMethod' option and\n * the optional LokiPartitioningAdapter class. It is also available if you wish to do\n * your own structured persistence or data exchange.\n *\n * @param {object} options - output format options for use externally to loki\n * @param {boolean} [options.partitioned=false] - whether db and each collection are separate\n * @param {int} options.partition - can be used to only output an individual collection or db (-1)\n * @param {boolean} [options.delimited=true] - whether subitems are delimited or subarrays\n * @param {string} options.delimiter - override default delimiter\n *\n * @returns {string|Array} A custom, restructured aggregation of independent serializations.\n */\n serializeDestructured(options: Loki.SerializeDestructuredOptions = {}): string | string[] {\n if (options.partitioned === undefined) {\n options.partitioned = false;\n }\n\n if (options.delimited === undefined) {\n options.delimited = true;\n }\n\n if (options.delimiter === undefined) {\n options.delimiter = this._destructureDelimiter;\n }\n\n // 'partitioned' along with 'partition' of 0 or greater is a request for single collection serialization\n if (options.partitioned === true && options.partition !== undefined && options.partition >= 0) {\n return this.serializeCollection({\n delimited: options.delimited,\n delimiter: options.delimiter,\n collectionIndex: options.partition\n });\n }\n\n // not just an individual collection, so we will need to serialize db container via shallow copy\n let dbcopy = new Loki(this.filename);\n dbcopy.loadJSONObject(this);\n\n for (let idx = 0; idx < dbcopy._collections.length; idx++) {\n dbcopy._collections[idx].data = [];\n }\n\n // if we -only- wanted the db container portion, return it now\n if (options.partitioned === true && options.partition === -1) {\n // since we are deconstructing, override serializationMethod to normal for here\n return dbcopy.serialize({\n serializationMethod: Loki.SerializationMethod.NORMAL\n });\n }\n\n // at this point we must be deconstructing the entire database\n // start by pushing db serialization into first array element\n const reconstruct: string[] = [];\n reconstruct.push(dbcopy.serialize({\n serializationMethod: Loki.SerializationMethod.NORMAL\n }) as string);\n\n dbcopy = null;\n\n // push collection data into subsequent elements\n for (let idx = 0; idx < this._collections.length; idx++) {\n let result = this.serializeCollection({\n delimited: options.delimited,\n delimiter: options.delimiter,\n collectionIndex: idx\n });\n\n // NDA : Non-Delimited Array : one iterable concatenated array with empty string collection partitions\n if (options.partitioned === false && options.delimited === false) {\n if (!Array.isArray(result)) {\n throw new Error(\"a nondelimited, non partitioned collection serialization did not return an expected array\");\n }\n\n // Array.concat would probably duplicate memory overhead for copying strings.\n // Instead copy each individually, and clear old value after each copy.\n // Hopefully this will allow g.c. to reduce memory pressure, if needed.\n for (let sidx = 0; sidx < result.length; sidx++) {\n reconstruct.push(result[sidx]);\n result[sidx] = null;\n }\n reconstruct.push(\"\");\n } else {\n reconstruct.push(result as string);\n }\n }\n\n // Reconstruct / present results according to four combinations : D, DA, NDA, NDAA\n if (options.partitioned) {\n // DA : Delimited Array of strings [0] db [1] collection [n] collection { partitioned: true, delimited: true }\n // useful for simple future adaptations of existing persistence adapters to save collections separately\n if (options.delimited) {\n return reconstruct;\n }\n // NDAA : Non-Delimited Array with subArrays. db at [0] and collection subarrays at [n] { partitioned: true, delimited : false }\n // This format might be the most versatile for 'rolling your own' partitioned sync or save.\n // Memory overhead can be reduced by specifying a specific partition, but at this code path they did not, so its all.\n else {\n return reconstruct;\n }\n } else {\n // D : one big Delimited string { partitioned: false, delimited : true }\n // This is the method Loki will use internally if 'destructured'.\n // Little memory overhead improvements but does not require multiple asynchronous adapter call scheduling\n if (options.delimited) {\n // indicate no more collections\n reconstruct.push(\"\");\n\n return reconstruct.join(options.delimiter);\n }\n // NDA : Non-Delimited Array : one iterable array with empty string collection partitions { partitioned: false, delimited: false }\n // This format might be best candidate for custom synchronous syncs or saves\n else {\n // indicate no more collections\n reconstruct.push(\"\");\n\n return reconstruct;\n }\n }\n }\n\n /**\n * Collection level utility method to serialize a collection in a 'destructured' format\n *\n * @param {object} options - used to determine output of method\n * @param {int} options.delimited - whether to return single delimited string or an array\n * @param {string} options.delimiter - (optional) if delimited, this is delimiter to use\n * @param {int} options.collectionIndex - specify which collection to serialize data for\n *\n * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection.\n */\n serializeCollection(options: ANY = {}) {\n let doccount;\n let docidx;\n let resultlines = [];\n\n if (options.delimited === undefined) {\n options.delimited = true;\n }\n\n if (options.collectionIndex === undefined) {\n throw new Error(\"serializeCollection called without 'collectionIndex' option\");\n }\n\n doccount = this._collections[options.collectionIndex].data.length;\n\n resultlines = [];\n\n for (docidx = 0; docidx < doccount; docidx++) {\n resultlines.push(JSON.stringify(this._collections[options.collectionIndex].data[docidx]));\n }\n\n // D and DA\n if (options.delimited) {\n // indicate no more documents in collection (via empty delimited string)\n resultlines.push(\"\");\n\n return resultlines.join(options.delimiter);\n } else {\n // NDAA and NDA\n return resultlines;\n }\n }\n\n /**\n * Database level destructured JSON deserialization routine to minimize memory overhead.\n * Internally, Loki supports destructuring via loki \"serializationMethod' option and\n * the optional LokiPartitioningAdapter class. It is also available if you wish to do\n * your own structured persistence or data exchange.\n *\n * @param {string|array} destructuredSource - destructured json or array to deserialize from\n * @param {object} options - source format options\n * @param {boolean} [options.partitioned=false] - whether db and each collection are separate\n * @param {int} options.partition - can be used to deserialize only a single partition\n * @param {boolean} [options.delimited=true] - whether subitems are delimited or subarrays\n * @param {string} options.delimiter - override default delimiter\n *\n * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array\n */\n deserializeDestructured(destructuredSource: ANY, options: Loki.SerializeDestructuredOptions = {}) {\n let workarray = [];\n let len;\n let cdb;\n let collIndex = 0;\n let collCount;\n let lineIndex = 1;\n let done = false;\n let currObject;\n\n if (options.partitioned === undefined) {\n options.partitioned = false;\n }\n\n if (options.delimited === undefined) {\n options.delimited = true;\n }\n\n if (options.delimiter === undefined) {\n options.delimiter = this._destructureDelimiter;\n }\n\n // Partitioned\n // DA : Delimited Array of strings [0] db [1] collection [n] collection { partitioned: true, delimited: true }\n // NDAA : Non-Delimited Array with subArrays. db at [0] and collection subarrays at [n] { partitioned: true, delimited : false }\n // -or- single partition\n if (options.partitioned) {\n // handle single partition\n if (options.partition !== undefined) {\n // db only\n if (options.partition === -1) {\n cdb = JSON.parse(destructuredSource[0]);\n\n return cdb;\n }\n\n // single collection, return doc array\n return this.deserializeCollection(destructuredSource[options.partition + 1], options);\n }\n\n // Otherwise we are restoring an entire partitioned db\n cdb = JSON.parse(destructuredSource[0]);\n collCount = cdb._collections.length;\n for (collIndex = 0; collIndex < collCount; collIndex++) {\n // attach each collection docarray to container collection data, add 1 to collection array index since db is at 0\n cdb._collections[collIndex].data = this.deserializeCollection(destructuredSource[collIndex + 1], options);\n }\n\n return cdb;\n }\n\n // Non-Partitioned\n // D : one big Delimited string { partitioned: false, delimited : true }\n // NDA : Non-Delimited Array : one iterable array with empty string collection partitions { partitioned: false, delimited: false }\n\n // D\n if (options.delimited) {\n workarray = destructuredSource.split(options.delimiter);\n destructuredSource = null; // lower memory pressure\n len = workarray.length;\n\n if (len === 0) {\n return null;\n }\n }\n // NDA\n else {\n workarray = destructuredSource;\n }\n\n // first line is database and collection shells\n cdb = JSON.parse(workarray[0]);\n collCount = cdb._collections.length;\n workarray[0] = null;\n\n while (!done) {\n // empty string indicates either end of collection or end of file\n if (workarray[lineIndex] === \"\") {\n // if no more collections to load into, we are done\n if (++collIndex > collCount) {\n done = true;\n }\n } else {\n currObject = JSON.parse(workarray[lineIndex]);\n cdb._collections[collIndex].data.push(currObject);\n }\n\n // lower memory pressure and advance iterator\n workarray[lineIndex++] = null;\n }\n\n return cdb;\n }\n\n /**\n * Collection level utility function to deserializes a destructured collection.\n *\n * @param {string|string[]} destructuredSource - destructured representation of collection to inflate\n * @param {object} options - used to describe format of destructuredSource input\n * @param {int} [options.delimited=false] - whether source is delimited string or an array\n * @param {string} options.delimiter - if delimited, this is delimiter to use (if other than default)\n *\n * @returns {Array} an array of documents to attach to collection.data.\n */\n deserializeCollection(destructuredSource: string | string[], options: Loki.DeserializeCollectionOptions = {}) {\n if (options.partitioned === undefined) {\n options.partitioned = false;\n }\n\n if (options.delimited === undefined) {\n options.delimited = true;\n }\n\n if (options.delimiter === undefined) {\n options.delimiter = this._destructureDelimiter;\n }\n\n let workarray = [];\n if (options.delimited) {\n workarray = (destructuredSource as string).split(options.delimiter);\n workarray.pop();\n } else {\n workarray = destructuredSource as string[];\n }\n\n for (let idx = 0; idx < workarray.length; idx++) {\n workarray[idx] = JSON.parse(workarray[idx]);\n }\n return workarray as any as Doc;\n }\n\n /**\n * Inflates a loki database from a serialized JSON string\n *\n * @param {string} serializedDb - a serialized loki database string\n * @param {object} options - apply or override collection level settings\n * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved\n */\n loadJSON(serializedDb: string | string[], options?: ANY) {\n let dbObject;\n if (serializedDb.length === 0) {\n dbObject = {};\n } else {\n // using option defined in instantiated db not what was in serialized db\n switch (this._serializationMethod) {\n case Loki.SerializationMethod.NORMAL:\n case Loki.SerializationMethod.PRETTY:\n dbObject = JSON.parse(serializedDb as string);\n break;\n case Loki.SerializationMethod.DESTRUCTURED:\n dbObject = this.deserializeDestructured(serializedDb);\n break;\n default:\n dbObject = JSON.parse(serializedDb as string);\n break;\n }\n }\n this.loadJSONObject(dbObject, options);\n }\n\n /**\n * Inflates a loki database from a JS object\n *\n * @param {object} dbObject - a serialized loki database string\n * @param {object} options - apply or override collection level settings\n * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved\n */\n loadJSONObject(dbObject: ANY, options: Collection.DeserializeOptions = {}) {\n const len = dbObject._collections ? dbObject._collections.length : 0;\n\n this.filename = dbObject.filename;\n this._collections = [];\n\n for (let i = 0; i < len; ++i) {\n this._collections.push(Collection.fromJSONObject(dbObject._collections[i], options));\n }\n }\n\n /**\n * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer.\n * Does not actually destroy the db.\n *\n * @returns {Promise} a Promise that resolves after closing the database succeeded\n */\n close() {\n let saved;\n // for autosave scenarios, we will let close perform final save (if dirty)\n // For web use, you might call from window.onbeforeunload to shutdown database, saving pending changes\n if (this._autosave) {\n this.autosaveDisable();\n // Check if collections are dirty.\n for (let idx = 0; idx < this._collections.length; idx++) {\n if (this._collections[idx].dirty) {\n saved = this.saveDatabase();\n break;\n }\n }\n }\n\n return Promise.resolve(saved).then(() => {\n this.emit(\"close\");\n });\n }\n\n /**-------------------------+\n | Changes API |\n +--------------------------*/\n\n /**\n * The Changes API enables the tracking the changes occurred in the collections since the beginning of the session,\n * so it's possible to create a differential dataset for synchronization purposes (possibly to a remote db)\n */\n\n /**\n * (Changes API) : takes all the changes stored in each\n * collection and creates a single array for the entire database. If an array of names\n * of collections is passed then only the included collections will be tracked.\n *\n * @param {Array} [arrayOfCollectionNames=] - array of collection names. No arg means all collections are processed.\n * @returns {Array} array of changes\n * @see private method _createChange() in Collection\n */\n generateChangesNotification(arrayOfCollectionNames?: string[]) {\n let changes: ANY[] = [];\n const selectedCollections = arrayOfCollectionNames\n || this._collections.map((coll: Collection) => coll.name);\n\n this._collections.forEach((coll) => {\n if (selectedCollections.indexOf(coll.name) !== -1) {\n changes = changes.concat(coll.getChanges());\n }\n });\n return changes;\n }\n\n /**\n * (Changes API) - stringify changes for network transmission\n * @returns {string} string representation of the changes\n */\n serializeChanges(collectionNamesArray?: string[]) {\n return JSON.stringify(this.generateChangesNotification(collectionNamesArray));\n }\n\n /**\n * (Changes API) : clears all the changes in all collections.\n */\n clearChanges() {\n this._collections.forEach((coll) => {\n if (coll.flushChanges) {\n coll.flushChanges();\n }\n });\n }\n\n /**\n * Wait for throttledSaves to complete and invoke your callback when drained or duration is met.\n *\n * @param {object} options - configuration options\n * @param {boolean} [options.recursiveWait=true] - if after queue is drained, another save was kicked off, wait for it\n * @param {boolean} [options.recursiveWaitLimit=false] - limit our recursive waiting to a duration\n * @param {number} [options.recursiveWaitLimitDuration=2000] - cutoff in ms to stop recursively re-draining\n * @param {Date} [options.started=now()] - the start time of the recursive wait duration\n * @returns {Promise} a Promise that resolves when save queue is drained, it is passed a sucess parameter value\n */\n throttledSaveDrain(options: Loki.ThrottledDrainOptions = {}): Promise {\n const now = (new Date()).getTime();\n\n if (!this._throttledSaves) {\n return Promise.resolve();\n }\n\n if (options.recursiveWait === undefined) {\n options.recursiveWait = true;\n }\n if (options.recursiveWaitLimit === undefined) {\n options.recursiveWaitLimit = false;\n }\n if (options.recursiveWaitLimitDuration === undefined) {\n options.recursiveWaitLimitDuration = 2000;\n }\n if (options.started === undefined) {\n options.started = new Date();\n }\n\n // if save is pending\n if (this._throttledSaves && this._throttledSaveRunning !== null) {\n // if we want to wait until we are in a state where there are no pending saves at all\n if (options.recursiveWait) {\n // queue the following meta callback for when it completes\n return Promise.resolve(Promise.all([this._throttledSaveRunning, this._throttledSavePending])).then(() => {\n if (this._throttledSaveRunning !== null || this._throttledSavePending !== null) {\n if (options.recursiveWaitLimit && (now - options.started.getTime() > options.recursiveWaitLimitDuration)) {\n return Promise.reject({});\n }\n return this.throttledSaveDrain(options);\n } else {\n return Promise.resolve();\n }\n });\n }\n // just notify when current queue is depleted\n else {\n return Promise.resolve(this._throttledSaveRunning);\n }\n }\n // no save pending, just callback\n else {\n return Promise.resolve();\n }\n }\n\n /**\n * Internal load logic, decoupled from throttling/contention logic\n *\n * @param {object} options - an object containing inflation options for each collection\n * @returns {Promise} a Promise that resolves after the database is loaded\n */\n private _loadDatabase(options = {}) {\n // the persistenceAdapter should be present if all is ok, but check to be sure.\n if (this._persistenceAdapter === null) {\n return Promise.reject(new Error(\"persistenceAdapter not configured\"));\n }\n\n return Promise.resolve(this._persistenceAdapter.loadDatabase(this.filename))\n .then((dbString) => {\n if (typeof (dbString) === \"string\") {\n this.loadJSON(dbString, options);\n this.emit(\"load\", this);\n } else {\n dbString = dbString as object;\n // if adapter has returned an js object (other than null or error) attempt to load from JSON object\n if (typeof (dbString) === \"object\" && dbString !== null && !(dbString instanceof Error)) {\n this.loadJSONObject(dbString, options);\n this.emit(\"load\", this);\n } else {\n if (dbString instanceof Error)\n throw dbString;\n\n throw new TypeError(\"The persistence adapter did not load a serialized DB string or object.\");\n }\n }\n });\n }\n\n /**\n * Handles manually loading from an adapter storage (such as fs-storage)\n * This method utilizes loki configuration options (if provided) to determine which\n * persistence method to use, or environment detection (if configuration was not provided).\n * To avoid contention with any throttledSaves, we will drain the save queue first.\n *\n * If you are configured with autosave, you do not need to call this method yourself.\n *\n * @param {object} [options={}] - if throttling saves and loads, this controls how we drain save queue before loading\n * @param {boolean} [options.recursiveWait=true] wait recursively until no saves are queued\n * @param {boolean} [options.recursiveWaitLimit=false] limit our recursive waiting to a duration\n * @param {number} [options.recursiveWaitLimitDelay=2000] cutoff in ms to stop recursively re-draining\n * @param {Date} [options.started=now()] - the start time of the recursive wait duration\n * @returns {Promise} a Promise that resolves after the database is loaded\n */\n public loadDatabase(options: Loki.LoadDatabaseOptions = {}): Promise {\n // if throttling disabled, just call internal\n if (!this._throttledSaves) {\n return this._loadDatabase(options);\n }\n\n // try to drain any pending saves in the queue to lock it for loading\n return this.throttledSaveDrain(options).then(() => {\n // pause/throttle saving until loading is done\n this._throttledSaveRunning = this._loadDatabase(options).then(() => {\n // now that we are finished loading, if no saves were throttled, disable flag\n this._throttledSaveRunning = null;\n });\n return this._throttledSaveRunning;\n }, () => {\n throw new Error(\"Unable to pause save throttling long enough to read database\");\n });\n }\n\n private _saveDatabase() {\n // the persistenceAdapter should be present if all is ok, but check to be sure.\n if (this._persistenceAdapter === null) {\n return Promise.reject(new Error(\"persistenceAdapter not configured\"));\n }\n\n let saved;\n\n // check if the adapter is requesting (and supports) a 'reference' mode export\n if (this._persistenceAdapter.mode === \"reference\" && typeof this._persistenceAdapter.exportDatabase === \"function\") {\n // filename may seem redundant but loadDatabase will need to expect this same filename\n saved = this._persistenceAdapter.exportDatabase(this.filename, this.copy({removeNonSerializable: true}));\n }\n // otherwise just pass the serialized database to adapter\n else {\n saved = this._persistenceAdapter.saveDatabase(this.filename, this.serialize() as string);\n }\n\n return Promise.resolve(saved).then(() => {\n // Set all collection not dirty.\n for (let idx = 0; idx < this._collections.length; idx++) {\n this._collections[idx].dirty = false;\n }\n this.emit(\"save\");\n });\n }\n\n /**\n * Handles manually saving to an adapter storage (such as fs-storage)\n * This method utilizes loki configuration options (if provided) to determine which\n * persistence method to use, or environment detection (if configuration was not provided).\n *\n * If you are configured with autosave, you do not need to call this method yourself.\n *\n * @returns {Promise} a Promise that resolves after the database is persisted\n */\n saveDatabase() {\n if (!this._throttledSaves) {\n return this._saveDatabase();\n }\n\n // if the db save is currently running, a new promise for a next db save is created\n // all calls to save db will get this new promise which will be processed right after\n // the current db save is finished\n if (this._throttledSaveRunning !== null && this._throttledSavePending === null) {\n this._throttledSavePending = Promise.resolve(this._throttledSaveRunning).then(() => {\n this._throttledSaveRunning = null;\n this._throttledSavePending = null;\n return this.saveDatabase();\n });\n }\n if (this._throttledSavePending !== null) {\n return this._throttledSavePending;\n }\n this._throttledSaveRunning = this._saveDatabase().then(() => {\n this._throttledSaveRunning = null;\n });\n\n return this._throttledSaveRunning;\n }\n\n /**\n * Handles deleting a database from the underlying storage adapter\n *\n * @returns {Promise} a Promise that resolves after the database is deleted\n */\n deleteDatabase() {\n // the persistenceAdapter should be present if all is ok, but check to be sure.\n if (this._persistenceAdapter === null) {\n return Promise.reject(new Error(\"persistenceAdapter not configured\"));\n }\n\n return Promise.resolve(this._persistenceAdapter.deleteDatabase(this.filename));\n }\n\n /**\n * Starts periodically saves to the underlying storage adapter.\n */\n autosaveEnable() {\n if (this._autosaveHandle) {\n return;\n }\n\n let running = true;\n\n this._autosave = true;\n this._autosaveHandle = () => {\n running = false;\n this._autosaveHandle = undefined;\n };\n\n setTimeout(() => {\n if (running) {\n this.saveDatabase().then(this.saveDatabase, this.saveDatabase);\n }\n }, this._autosaveInterval);\n }\n\n /**\n * Stops the autosave interval timer.\n */\n autosaveDisable() {\n this._autosave = false;\n\n if (this._autosaveHandle) {\n this._autosaveHandle();\n }\n }\n}\n\nexport namespace Loki {\n export interface Options {\n env?: Environment;\n serializationMethod?: SerializationMethod;\n destructureDelimiter?: string;\n verbose?: boolean;\n }\n\n export interface PersistenceOptions {\n adapter?: StorageAdapter;\n autosave?: boolean;\n autosaveInterval?: number;\n autoload?: boolean;\n throttledSaves?: boolean;\n persistenceMethod?: Loki.PersistenceMethod;\n inflate?: any;\n }\n\n export interface CopyOptions {\n removeNonSerializable?: boolean;\n }\n\n export interface SerializeOptions {\n serializationMethod?: SerializationMethod;\n }\n\n export interface SerializeDestructuredOptions {\n partitioned?: boolean;\n partition?: number;\n delimited?: boolean;\n delimiter?: string;\n }\n\n export interface DeserializeCollectionOptions {\n partitioned?: boolean;\n delimited?: boolean;\n delimiter?: string;\n }\n\n export interface ThrottledDrainOptions {\n recursiveWait?: boolean;\n recursiveWaitLimit?: boolean;\n recursiveWaitLimitDuration?: number;\n started?: Date;\n }\n\n export type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions;\n\n export enum SerializationMethod {\n NORMAL,\n PRETTY,\n DESTRUCTURED,\n }\n\n export enum PersistenceMethod {\n FS_STORAGE,\n LOCAL_STORAGE,\n INDEXED_STORAGE,\n MEMORY_STORAGE,\n ADAPTER,\n }\n\n export enum Environment {\n NODE_JS,\n NATIVE_SCRIPT,\n BROWSER,\n CORDOVA,\n MEMORY,\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/loki.ts","import {Dict, Doc} from \"../../common/types\";\n\nexport class UniqueIndex {\n // The property field to index.\n private _field: number | string;\n // The map with the indices rows of unique property fields.\n private _keyMap: Dict;\n\n /**\n * Constructs an unique index object.\n * @param {number|string} propertyField - the property field to index\n */\n constructor(propertyField: number | string) {\n this._field = propertyField;\n this._keyMap = {};\n }\n\n /**\n * Sets a document's unique index.\n * @param {Doc} doc - the document\n * @param {number} row - the data row of the document\n */\n public set(doc: Doc, row: number): void {\n const fieldValue = doc[this._field];\n if (fieldValue !== null && fieldValue !== undefined) {\n if (this._keyMap[fieldValue] !== undefined) {\n throw new Error(\"Duplicate key for property \" + this._field + \": \" + fieldValue);\n } else {\n this._keyMap[fieldValue] = row;\n }\n }\n }\n\n /**\n * Returns the data row of an unique index.\n * @param {number|string} index - the index\n * @returns {number | string} - the row\n */\n public get(index: number | string): number {\n return this._keyMap[index];\n }\n\n /**\n * Updates a document's unique index.\n * @param {Object} doc - the document\n * @param {number} row - the data row of the document\n */\n public update(doc: Doc, row: number): void {\n // Find and remove current keyMap for row.\n const uniqueNames = Object.keys(this._keyMap);\n for (let i = 0; i < uniqueNames.length; i++) {\n if (row === this._keyMap[uniqueNames[i]]) {\n delete this._keyMap[uniqueNames[i]];\n break;\n }\n }\n this.set(doc, row);\n }\n\n /**\n * Removes an unique index.\n * @param {number|string} index - the unique index\n */\n public remove(index: number | string): void {\n if (this._keyMap[index] !== undefined) {\n delete this._keyMap[index];\n } else {\n throw new Error(\"Key is not in unique index: \" + this._field);\n }\n }\n\n /**\n * Clears all unique indexes.\n */\n public clear(): void {\n this._keyMap = {};\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/unique_index.ts","import {LokiEventEmitter} from \"./event_emitter\";\nimport {Resultset} from \"./resultset\";\nimport {Collection} from \"./collection\";\nimport {Doc, Filter} from \"../../common/types\";\nimport {ScoreResult} from \"../../full-text-search/src/scorer\";\n\nexport type ANY = any;\n\n/**\n * DynamicView class is a versatile 'live' view class which can have filters and sorts applied.\n * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it\n * whenever documents are add/updated/removed so it can remain up-to-date. (chainable)\n *\n * @example\n * let mydv = mycollection.addDynamicView('test'); // default is non-persistent\n * mydv.applyFind({ 'doors' : 4 });\n * mydv.applyWhere(function(obj) { return obj.name === 'Toyota'; });\n * let results = mydv.data();\n *\n * @extends LokiEventEmitter\n\n * @see {@link Collection#addDynamicView} to construct instances of DynamicView\n */\nexport class DynamicView extends LokiEventEmitter {\n\n private _collection: Collection;\n private _persistent: boolean;\n private _sortPriority: DynamicView.SortPriority;\n private _minRebuildInterval: number;\n public name: string;\n private _rebuildPending: boolean;\n\n private _resultset: Resultset;\n private _resultdata: Doc[];\n private _resultsdirty: boolean;\n\n private _cachedresultset: Resultset;\n\n private _filterPipeline: Filter[];\n\n\n private _sortFunction: (lhs: E, rhs: E) => number;\n private _sortCriteria: (string | [string, boolean])[];\n private _sortByScoring: boolean;\n private _sortDirty: boolean;\n\n /**\n * Constructor.\n * @param {Collection} collection - a reference to the collection to work agains\n * @param {string} name - the name of this dynamic view\n * @param {object} options - the options\n * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata'\n * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority\n * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here)\n */\n constructor(collection: Collection, name: string, options: DynamicView.Options = {}) {\n super();\n (\n {\n persistent: this._persistent = false,\n sortPriority: this._sortPriority = DynamicView.SortPriority.PASSIVE,\n minRebuildInterval: this._minRebuildInterval = 1\n } = options\n );\n\n this._collection = collection;\n this.name = name;\n this._rebuildPending = false;\n\n // 'passive' will defer the sort phase until they call data(). (most efficient overall)\n // 'active' will sort async whenever next idle. (prioritizes read speeds)\n // sortPriority: this._sortPriority = DynamicView.SortPriority.PASSIVE,\n\n this._resultset = new Resultset(collection);\n this._resultdata = [];\n this._resultsdirty = false;\n\n this._cachedresultset = null;\n\n // keep ordered filter pipeline\n this._filterPipeline = [];\n\n // sorting member variables\n // we only support one active search, applied using applySort() or applySimpleSort()\n this._sortFunction = null;\n this._sortCriteria = null;\n this._sortByScoring = null;\n this._sortDirty = false;\n\n // for now just have 1 event for when we finally rebuilt lazy view\n // once we refactor transactions, i will tie in certain transactional events\n\n this.events = {\n \"rebuild\": []\n };\n }\n\n /**\n * Internally used immediately after deserialization (loading)\n * This will clear out and reapply filterPipeline ops, recreating the view.\n * Since where filters do not persist correctly, this method allows\n * restoring the view to state where user can re-apply those where filters.\n *\n * @param removeWhereFilters\n * @returns {DynamicView} This dynamic view for further chained ops.\n * @fires DynamicView.rebuild\n */\n _rematerialize({removeWhereFilters = false}): DynamicView {\n let fpl;\n let fpi;\n let idx;\n\n this._resultdata = [];\n this._resultsdirty = true;\n this._resultset = new Resultset(this._collection);\n\n if (this._sortFunction || this._sortCriteria || this._sortByScoring !== null) {\n this._sortDirty = true;\n }\n\n if (removeWhereFilters) {\n // for each view see if it had any where filters applied... since they don't\n // serialize those functions lets remove those invalid filters\n fpl = this._filterPipeline.length;\n fpi = fpl;\n while (fpi--) {\n if (this._filterPipeline[fpi].type === \"where\") {\n if (fpi !== this._filterPipeline.length - 1) {\n this._filterPipeline[fpi] = this._filterPipeline[this._filterPipeline.length - 1];\n }\n this._filterPipeline.length--;\n }\n }\n }\n\n // back up old filter pipeline, clear filter pipeline, and reapply pipeline ops\n const ofp = this._filterPipeline;\n this._filterPipeline = [];\n\n // now re-apply 'find' filterPipeline ops\n fpl = ofp.length;\n for (idx = 0; idx < fpl; idx++) {\n this.applyFind(ofp[idx].val);\n }\n\n // during creation of unit tests, i will remove this forced refresh and leave lazy\n this.data();\n\n // emit rebuild event in case user wants to be notified\n this.emit(\"rebuild\", this);\n\n return this;\n }\n\n /**\n * Makes a copy of the internal resultset for branched queries.\n * Unlike this dynamic view, the branched resultset will not be 'live' updated,\n * so your branched query should be immediately resolved and not held for future evaluation.\n *\n * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps\n * @param {object} parameters - optional parameters (if optional transform requires them)\n * @returns {Resultset} A copy of the internal resultset for branched queries.\n */\n branchResultset(transform: string | any[], parameters?: object): Resultset {\n const rs = this._resultset.branch();\n if (transform === undefined) {\n return rs;\n }\n return rs.transform(transform, parameters);\n }\n\n /**\n * toJSON() - Override of toJSON to avoid circular references\n *\n */\n toJSON() {\n return {\n name: this.name,\n _persistent: this._persistent,\n _sortPriority: this._sortPriority,\n _minRebuildInterval: this._minRebuildInterval,\n _resultset: this._resultset,\n _resultsdirty: true,\n _filterPipeline: this._filterPipeline,\n _sortCriteria: this._sortCriteria,\n _sortByScoring: this._sortByScoring,\n _sortDirty: this._sortDirty,\n };\n }\n\n static fromJSONObject(collection: ANY, obj: ANY): DynamicView {\n let dv = new DynamicView(collection, obj.name, obj.options);\n dv._resultsdirty = obj._resultsdirty;\n dv._filterPipeline = obj._filterPipeline;\n dv._resultdata = [];\n\n dv._sortCriteria = obj._sortCriteria;\n dv._sortByScoring = obj._sortByScoring;\n dv._sortDirty = obj._sortDirty;\n dv._resultset.filteredrows = obj._resultset.filteredrows;\n dv._resultset.filterInitialized = obj._resultset.filterInitialized;\n dv._rematerialize({\n removeWhereFilters: true\n });\n return dv;\n }\n\n /**\n * Used to clear pipeline and reset dynamic view to initial state.\n * Existing options should be retained.\n * @param {boolean} queueSortPhase - (default: false) if true we will async rebuild view (maybe set default to true in future?)\n */\n public removeFilters({queueSortPhase = false} = {}): void {\n this._rebuildPending = false;\n this._resultset.reset();\n this._resultdata = [];\n this._resultsdirty = true;\n\n this._cachedresultset = null;\n\n // keep ordered filter pipeline\n this._filterPipeline = [];\n\n // sorting member variables\n // we only support one active search, applied using applySort() or applySimpleSort()\n this._sortFunction = null;\n this._sortCriteria = null;\n this._sortByScoring = null;\n this._sortDirty = false;\n\n if (queueSortPhase === true) {\n this._queueSortPhase();\n }\n }\n\n /**\n * Used to apply a sort to the dynamic view\n * @example\n * dv.applySort(function(obj1, obj2) {\n\t * if (obj1.name === obj2.name) return 0;\n\t * if (obj1.name > obj2.name) return 1;\n\t * if (obj1.name < obj2.name) return -1;\n\t * });\n *\n * @param {function} comparefun - a javascript compare function used for sorting\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public applySort(comparefun: (lhs: E, rhs: E) => number): DynamicView {\n this._sortFunction = comparefun;\n this._sortCriteria = null;\n this._sortByScoring = null;\n this._queueSortPhase();\n return this;\n }\n\n /**\n * Used to specify a property used for view translation.\n * @example\n * dv.applySimpleSort(\"name\");\n *\n * @param {string} propname - Name of property by which to sort.\n * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public applySimpleSort(propname: string, isdesc?: boolean): DynamicView {\n this._sortCriteria = [\n [propname, isdesc || false]\n ];\n this._sortFunction = null;\n this._sortByScoring = null;\n this._queueSortPhase();\n return this;\n }\n\n /**\n * Allows sorting a resultset based on multiple columns.\n * @example\n * // to sort by age and then name (both ascending)\n * dv.applySortCriteria(['age', 'name']);\n * // to sort by age (ascending) and then by name (descending)\n * dv.applySortCriteria(['age', ['name', true]);\n * // to sort by age (descending) and then by name (descending)\n * dv.applySortCriteria(['age', true], ['name', true]);\n *\n * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order\n * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations.\n */\n public applySortCriteria(criteria: (string | [string, boolean])[]): DynamicView {\n this._sortCriteria = criteria;\n this._sortFunction = null;\n this._sortByScoring = null;\n this._queueSortPhase();\n return this;\n }\n\n /**\n * Used to apply a sort by the latest full-text-search scoring.\n * @param {boolean} [ascending=false] - sort ascending\n */\n public applySortByScoring(ascending = false): DynamicView {\n this._sortFunction = null;\n this._sortCriteria = null;\n this._sortByScoring = ascending;\n this._queueSortPhase();\n return this;\n }\n\n /**\n * Returns the scoring of the last full-text-search.\n * @returns {ScoreResult}\n */\n public getScoring(): ScoreResult {\n return this._resultset.getScoring();\n }\n\n /**\n * Marks the beginning of a transaction.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public startTransaction(): DynamicView {\n this._cachedresultset = this._resultset.copy();\n return this;\n }\n\n /**\n * Commits a transaction.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public commit(): DynamicView {\n this._cachedresultset = null;\n return this;\n }\n\n /**\n * Rolls back a transaction.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public rollback(): DynamicView {\n this._resultset = this._cachedresultset;\n\n if (this._persistent) {\n // for now just rebuild the persistent dynamic view data in this worst case scenario\n // (a persistent view utilizing transactions which get rolled back), we already know the filter so not too bad.\n this._resultdata = this._resultset.data();\n\n this.emit(\"rebuild\", this);\n }\n return this;\n }\n\n /**\n * Find the index of a filter in the pipeline, by that filter's ID.\n *\n * @param {(string|number)} uid - The unique ID of the filter.\n * @returns {number}: index of the referenced filter in the pipeline; -1 if not found.\n */\n private _indexOfFilterWithId(uid: string | number): number {\n if (typeof uid === \"string\" || typeof uid === \"number\") {\n for (let idx = 0, len = this._filterPipeline.length; idx < len; idx += 1) {\n if (uid === this._filterPipeline[idx].uid) {\n return idx;\n }\n }\n }\n return -1;\n }\n\n /**\n * Add the filter object to the end of view's filter pipeline and apply the filter to the resultset.\n *\n * @param {object} filter - The filter object. Refer to applyFilter() for extra details.\n */\n private _addFilter(filter: Filter): void {\n this._filterPipeline.push(filter);\n this._resultset[filter.type](filter.val);\n }\n\n /**\n * Reapply all the filters in the current pipeline.\n *\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public reapplyFilters(): DynamicView {\n this._resultset.reset();\n\n this._cachedresultset = null;\n if (this._persistent) {\n this._resultdata = [];\n this._resultsdirty = true;\n }\n\n const filters = this._filterPipeline;\n this._filterPipeline = [];\n\n for (let idx = 0, len = filters.length; idx < len; idx += 1) {\n this._addFilter(filters[idx]);\n }\n\n if (this._sortFunction || this._sortCriteria || this._sortByScoring !== null) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n\n return this;\n }\n\n /**\n * Adds or updates a filter in the DynamicView filter pipeline\n *\n * @param {object} filter - A filter object to add to the pipeline.\n * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id }\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public applyFilter(filter: Filter): DynamicView {\n const idx = this._indexOfFilterWithId(filter.uid);\n if (idx >= 0) {\n this._filterPipeline[idx] = filter;\n return this.reapplyFilters();\n }\n\n this._cachedresultset = null;\n if (this._persistent) {\n this._resultdata = [];\n this._resultsdirty = true;\n }\n\n this._addFilter(filter);\n\n if (this._sortFunction || this._sortCriteria || this._sortByScoring !== null) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n return this;\n }\n\n /**\n * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline\n *\n * @param {object} query - A mongo-style query object to apply to pipeline\n * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public applyFind(query: object, uid: string | number = \"\"): DynamicView {\n this.applyFilter({\n type: \"find\",\n val: query,\n uid\n });\n return this;\n }\n\n /**\n * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline\n *\n * @param {function} fun - A javascript filter function to apply to pipeline\n * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public applyWhere(fun: (obj: E) => boolean, uid?: string | number): DynamicView {\n this.applyFilter({\n type: \"where\",\n val: fun,\n uid\n });\n return this;\n }\n\n /**\n * removeFilter() - Remove the specified filter from the DynamicView filter pipeline\n *\n * @param {(string|number)} uid - The unique ID of the filter to be removed.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public removeFilter(uid: string | number): DynamicView {\n const idx = this._indexOfFilterWithId(uid);\n if (idx < 0) {\n throw new Error(\"Dynamic view does not contain a filter with ID: \" + uid);\n }\n\n this._filterPipeline.splice(idx, 1);\n this.reapplyFilters();\n return this;\n }\n\n /**\n * Returns the number of documents representing the current DynamicView contents.\n * @returns {number} The number of documents representing the current DynamicView contents.\n */\n public count(): number {\n // in order to be accurate we will pay the minimum cost (and not alter dv state management)\n // recurring resultset data resolutions should know internally its already up to date.\n // for persistent data this will not update resultdata nor fire rebuild event.\n if (this._resultsdirty) {\n this._resultdata = this._resultset.data();\n }\n\n return this._resultset.count();\n }\n\n /**\n * Resolves and pending filtering and sorting, then returns document array as result.\n *\n * @param {object} options - optional parameters to pass to resultset.data() if non-persistent\n * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when\n * the collection is not configured for clone object.\n * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method.\n * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign'\n * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents\n *\n * @returns {Array} An array of documents representing the current DynamicView contents.\n */\n data(options: object = {}): Doc[] {\n // using final sort phase as 'catch all' for a few use cases which require full rebuild\n if (this._sortDirty || this._resultsdirty) {\n this._performSortPhase({\n suppressRebuildEvent: true\n });\n }\n return (this._persistent) ? (this._resultdata) : (this._resultset.data(options));\n }\n\n /**\n * When the view is not sorted we may still wish to be notified of rebuild events.\n * This event will throttle and queue a single rebuild event when batches of updates affect the view.\n */\n private _queueRebuildEvent(): void {\n if (this._rebuildPending) {\n return;\n }\n this._rebuildPending = true;\n\n setTimeout(() => {\n if (this._rebuildPending) {\n this._rebuildPending = false;\n this.emit(\"rebuild\", this);\n }\n }, this._minRebuildInterval);\n }\n\n /**\n * If the view is sorted we will throttle sorting to either :\n * (1) passive - when the user calls data(), or\n * (2) active - once they stop updating and yield js thread control\n */\n private _queueSortPhase(): void {\n // already queued? exit without queuing again\n if (this._sortDirty) {\n return;\n }\n this._sortDirty = true;\n\n if (this._sortPriority === DynamicView.SortPriority.ACTIVE) {\n // active sorting... once they are done and yield js thread, run async performSortPhase()\n setTimeout(() => {\n this._performSortPhase();\n }, this._minRebuildInterval);\n } else {\n // must be passive sorting... since not calling performSortPhase (until data call), lets use queueRebuildEvent to\n // potentially notify user that data has changed.\n this._queueRebuildEvent();\n }\n }\n\n /**\n * Invoked synchronously or asynchronously to perform final sort phase (if needed)\n */\n private _performSortPhase(options: { suppressRebuildEvent?: boolean } = {}): void {\n // async call to this may have been pre-empted by synchronous call to data before async could fire\n if (!this._sortDirty && !this._resultsdirty) {\n return;\n }\n\n if (this._sortDirty) {\n if (this._sortFunction) {\n this._resultset.sort(this._sortFunction);\n } else if (this._sortCriteria) {\n this._resultset.compoundsort(this._sortCriteria);\n } else if (this._sortByScoring !== null) {\n this._resultset.sortByScoring(this._sortByScoring);\n }\n\n this._sortDirty = false;\n }\n\n if (this._persistent) {\n // persistent view, rebuild local resultdata array\n this._resultdata = this._resultset.data();\n this._resultsdirty = false;\n }\n\n if (!options.suppressRebuildEvent) {\n this.emit(\"rebuild\", this);\n }\n }\n\n /**\n * (Re)evaluating document inclusion.\n * Called by : collection.insert() and collection.update().\n *\n * @param {int} objIndex - index of document to (re)run through filter pipeline.\n * @param {boolean} isNew - true if the document was just added to the collection.\n */\n _evaluateDocument(objIndex: number, isNew: boolean) {\n // if no filter applied yet, the result 'set' should remain 'everything'\n if (!this._resultset.filterInitialized) {\n if (this._persistent) {\n this._resultdata = this._resultset.data();\n }\n // need to re-sort to sort new document\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n return;\n }\n\n const ofr = this._resultset.filteredrows;\n const oldPos = (isNew) ? (-1) : (ofr.indexOf(+objIndex));\n const oldlen = ofr.length;\n\n // creating a 1-element resultset to run filter chain ops on to see if that doc passes filters;\n // mostly efficient algorithm, slight stack overhead price (this function is called on inserts and updates)\n const evalResultset = new Resultset(this._collection);\n evalResultset.filteredrows = [objIndex];\n evalResultset.filterInitialized = true;\n let filter;\n for (let idx = 0, len = this._filterPipeline.length; idx < len; idx++) {\n filter = this._filterPipeline[idx];\n evalResultset[filter.type](filter.val);\n }\n\n // not a true position, but -1 if not pass our filter(s), 0 if passed filter(s)\n const newPos = (evalResultset.filteredrows.length === 0) ? -1 : 0;\n\n // wasn't in old, shouldn't be now... do nothing\n if (oldPos === -1 && newPos === -1) return;\n\n // wasn't in resultset, should be now... add\n if (oldPos === -1 && newPos !== -1) {\n ofr.push(objIndex);\n\n if (this._persistent) {\n this._resultdata.push(this._collection.data[objIndex]);\n }\n\n // need to re-sort to sort new document\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n\n return;\n }\n\n // was in resultset, shouldn't be now... delete\n if (oldPos !== -1 && newPos === -1) {\n if (oldPos < oldlen - 1) {\n ofr.splice(oldPos, 1);\n\n if (this._persistent) {\n this._resultdata.splice(oldPos, 1);\n }\n } else {\n ofr.length = oldlen - 1;\n\n if (this._persistent) {\n this._resultdata.length = oldlen - 1;\n }\n }\n\n // in case changes to data altered a sort column\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n return;\n }\n\n // was in resultset, should still be now... (update persistent only?)\n if (oldPos !== -1 && newPos !== -1) {\n if (this._persistent) {\n // in case document changed, replace persistent view data with the latest collection.data document\n this._resultdata[oldPos] = this._collection.data[objIndex];\n }\n\n // in case changes to data altered a sort column\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n }\n }\n\n /**\n * internal function called on collection.delete()\n */\n _removeDocument(objIndex: number) {\n // if no filter applied yet, the result 'set' should remain 'everything'\n if (!this._resultset.filterInitialized) {\n if (this._persistent) {\n this._resultdata = this._resultset.data();\n }\n // in case changes to data altered a sort column\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n return;\n }\n\n const ofr = this._resultset.filteredrows;\n const oldPos = ofr.indexOf(+objIndex);\n let oldlen = ofr.length;\n let idx;\n\n if (oldPos !== -1) {\n // if not last row in resultdata, swap last to hole and truncate last row\n if (oldPos < oldlen - 1) {\n ofr[oldPos] = ofr[oldlen - 1];\n ofr.length = oldlen - 1;\n\n if (this._persistent) {\n this._resultdata[oldPos] = this._resultdata[oldlen - 1];\n this._resultdata.length = oldlen - 1;\n }\n }\n // last row, so just truncate last row\n else {\n ofr.length = oldlen - 1;\n\n if (this._persistent) {\n this._resultdata.length = oldlen - 1;\n }\n }\n\n // in case changes to data altered a sort column\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n }\n\n // since we are using filteredrows to store data array positions\n // if they remove a document (whether in our view or not),\n // we need to adjust array positions -1 for all document array references after that position\n oldlen = ofr.length;\n for (idx = 0; idx < oldlen; idx++) {\n if (ofr[idx] > objIndex) {\n ofr[idx]--;\n }\n }\n }\n\n /**\n * Data transformation via user supplied functions\n *\n * @param {function} mapFunction - this function accepts a single document for you to transform and return\n * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value\n * @returns The output of your reduceFunction\n */\n public mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U {\n try {\n return reduceFunction(this.data().map(mapFunction));\n } catch (err) {\n throw err;\n }\n }\n}\n\nexport namespace DynamicView {\n export interface Options {\n persistent?: boolean;\n sortPriority?: SortPriority;\n minRebuildInterval?: number;\n }\n\n export enum SortPriority {\n PASSIVE, // sorts performed on call to data\n ACTIVE, // or right after updates\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/dynamic_view.ts"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap e05cd93acbfc371c7cd3","webpack:///./packages/loki/src/event_emitter.ts","webpack:///./packages/loki/src/collection.ts","webpack:///(webpack)/buildin/global.js","webpack:///./packages/loki/src/result_set.ts","webpack:///./packages/loki/src/clone.ts","webpack:///./packages/loki/src/helper.ts","webpack:///./packages/common/plugin.ts","webpack:///./packages/loki/src/index.ts","webpack:///./packages/loki/src/loki.ts","webpack:///./packages/loki/src/unique_index.ts","webpack:///./packages/loki/src/dynamic_view.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;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;QACH,CAAC;QAED,gEAAgE;QAChE,0DAA0D;QAC1D,6FAA6F;QAC7F,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QACpB,GAAG,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;YACtC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;gBACxB,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACb,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,SAAS,CAAO,WAA8D,EAAE,cAAiC;QACtH,IAAI,CAAC;YACH,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;QACtD,CAAC;QAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACb,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AAAA;AAAA","file":"lokijs.loki.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/loki\"] = factory();\n\telse\n\t\troot[\"@lokijs/loki\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 7);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e05cd93acbfc371c7cd3","/**\n * LokiEventEmitter is a minimalist version of EventEmitter. It enables any\n * constructor that inherits EventEmitter to emit events and trigger\n * listeners that have been added to the event through the on(event, callback) method\n *\n * @constructor LokiEventEmitter\n */\nexport class LokiEventEmitter {\n /**\n * A map, with each property being an array of callbacks.\n */\n protected events: object;\n\n /**\n * Determines whether or not the callbacks associated with each event should happen in an async fashion or not.\n * Default is false, which means events are synchronous\n */\n protected asyncListeners: boolean;\n\n constructor() {\n this.events = {};\n this.asyncListeners = false;\n }\n\n /**\n * on(eventName, listener) - adds a listener to the queue of callbacks associated to an event\n * @param {string|string[]} eventName - the name(s) of the event(s) to listen to\n * @param {function} listener - callback function of listener to attach\n * @returns {int} the index of the callback in the array of listeners for a particular event\n */\n on(eventName: string | string[], listener: Function) {\n let event;\n\n if (Array.isArray(eventName)) {\n eventName.forEach((currentEventName) => {\n this.on(currentEventName, listener);\n });\n return listener;\n }\n\n event = this.events[eventName];\n if (!event) {\n event = this.events[eventName] = [];\n }\n event.push(listener);\n return listener;\n }\n\n /**\n * emit(eventName, data) - emits a particular event\n * with the option of passing optional parameters which are going to be processed by the callback\n * provided signatures match (i.e. if passing emit(event, arg0, arg1) the listener should take two parameters)\n * @param {string} eventName - the name of the event\n * @param {object} data - optional object passed with the event\n */\n emit(eventName: string, ...data: any[]) {\n if (eventName && this.events[eventName]) {\n this.events[eventName].forEach((listener: Function) => {\n if (this.asyncListeners) {\n setTimeout(() => {\n listener(...data);\n }, 1);\n } else {\n listener(...data);\n }\n\n });\n }\n }\n\n /**\n * Alias of LokiEventEmitter.prototype.on\n * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event\n * @param {string|string[]} eventName - the name(s) of the event(s) to listen to\n * @param {function} listener - callback function of listener to attach\n * @returns {int} the index of the callback in the array of listeners for a particular event\n */\n addListener(eventName: string | string[], listener: Function) {\n return this.on(eventName, listener);\n }\n\n /**\n * removeListener() - removes the listener at position 'index' from the event 'eventName'\n * @param {string|string[]} eventName - the name(s) of the event(s) which the listener is attached to\n * @param {function} listener - the listener callback function to remove from emitter\n */\n removeListener(eventName: string | string[], listener: Function) {\n if (Array.isArray(eventName)) {\n eventName.forEach((currentEventName) => {\n this.removeListener(currentEventName, listener);\n });\n }\n\n if (this.events[eventName as string]) {\n const listeners = this.events[eventName as string];\n listeners.splice(listeners.indexOf(listener), 1);\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/event_emitter.ts","import {LokiEventEmitter} from \"./event_emitter\";\nimport {UniqueIndex} from \"./unique_index\";\nimport {ResultSet} from \"./result_set\";\nimport {DynamicView} from \"./dynamic_view\";\nimport {ltHelper, gtHelper, aeqHelper} from \"./helper\";\nimport {Loki} from \"./loki\";\nimport {clone, CloneMethod} from \"./clone\";\nimport {Doc, Dict} from \"../../common/types\";\nimport {FullTextSearch} from \"../../full-text-search/src/full_text_search\";\nimport {PLUGINS} from \"../../common/plugin\";\nimport {Tokenizer} from \"../../full-text-search/src/tokenizer\";\n\nexport {CloneMethod} from \"./clone\";\n\n/**\n * General utils, including statistical functions\n */\nfunction isDeepProperty(field: string): boolean {\n return field.indexOf(\".\") !== -1;\n}\n\nfunction average(array: number[]): number {\n return (array.reduce((a, b) => a + b, 0)) / array.length;\n}\n\nfunction standardDeviation(values: number[]): number {\n const avg = average(values);\n const squareDiffs = values.map((value) => {\n const diff = value - avg;\n return diff * diff;\n });\n\n const avgSquareDiff = average(squareDiffs);\n return Math.sqrt(avgSquareDiff);\n}\n\nfunction deepProperty(obj: object, property: string, isDeep: boolean): any {\n if (isDeep === false) {\n // pass without processing\n return obj[property];\n }\n const pieces = property.split(\".\");\n let root = obj;\n while (pieces.length > 0) {\n root = root[pieces.shift()];\n }\n return root;\n}\n\n/**\n * Collection class that handles documents of same type\n * @extends LokiEventEmitter\n * @param - the data type\n * @param - nested properties of data type\n */\nexport class Collection extends LokiEventEmitter {\n\n public name: string;\n // the data held by the collection\n public _data: Doc[];\n private idIndex: number[]; // index of id\n public binaryIndices: { [P in keyof TData]?: Collection.BinaryIndex }; // user defined indexes\n\n /**\n * Unique constraints contain duplicate object references, so they are not persisted.\n * We will keep track of properties which have unique constraints applied here, and regenerate on load.\n */\n public constraints: {\n unique: {\n [P in keyof TData]?: UniqueIndex;\n }\n };\n\n /**\n * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along\n * with the database.\n */\n public transforms: Dict[]>;\n\n /**\n * In autosave scenarios we will use collection level dirty flags to determine whether save is needed.\n * currently, if any collection is dirty we will autosave the whole database if autosave is configured.\n * Defaulting to true since this is called from addCollection and adding a collection should trigger save.\n */\n public dirty: boolean;\n\n private cachedIndex: number[];\n private cachedBinaryIndex: { [P in keyof TData]?: Collection.BinaryIndex };\n private cachedData: Doc[];\n\n /**\n * If set to true we will optimally keep indices 'fresh' during insert/update/remove ops (never dirty/never needs rebuild).\n * If you frequently intersperse insert/update/remove ops between find ops this will likely be significantly faster option.\n */\n public adaptiveBinaryIndices: boolean;\n\n /**\n * Is collection transactional.\n */\n private transactional: boolean;\n\n\n /**\n * Options to clone objects when inserting them.\n */\n public cloneObjects: boolean;\n\n /**\n * Default clone method (if enabled) is parse-stringify.\n */\n public cloneMethod: CloneMethod;\n\n\n /**\n * Disable track changes.\n */\n private disableChangesApi: boolean;\n\n /**\n * Disable delta update object style on changes.\n */\n public disableDeltaChangesApi: boolean;\n\n /**\n * By default, if you insert a document into a collection with binary indices, if those indexed properties contain\n * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the\n * same 'after' serialization as it was 'before'.\n */\n private serializableIndices: boolean;\n\n /**\n * Option to activate a cleaner daemon - clears \"aged\" documents at set intervals.\n */\n public ttl: Collection.TTL;\n\n private maxId: number;\n private _dynamicViews: DynamicView[];\n\n /**\n * Changes are tracked by collection and aggregated by the db.\n */\n private changes: Collection.Change[];\n\n /* assign correct handler based on ChangesAPI flag */\n private insertHandler: (obj: Doc) => void;\n private updateHandler: (obj: Doc, old: Doc) => void;\n\n public console: {\n log(...args: any[]): void;\n warn(...args: any[]): void;\n error(...args: any[]): void;\n };\n\n /**\n * stages: a map of uniquely identified 'stages', which hold copies of objects to be\n * manipulated without affecting the data in the original collection\n */\n private stages: object;\n private commitLog: { timestamp: number; message: string; data: any }[];\n\n public _fullTextSearch: FullTextSearch;\n\n /**\n * @param {string} name - collection name\n * @param {(object)} [options={}] - a configuration object\n * @param {string[]} [options.unique=[]] - array of property names to define unique constraints for\n * @param {string[]} [options.exact=[]] - array of property names to define exact constraints for\n * @param {string[]} [options.indices=[]] - array property names to define binary indexes for\n * @param {boolean} [options.adaptiveBinaryIndices=true] - collection indices will be actively rebuilt rather than lazily\n * @param {boolean} [options.asyncListeners=false] - whether listeners are invoked asynchronously\n * @param {boolean} [options.disableChangesApi=true] - set to false to enable Changes API\n * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning)\n * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user\n * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable\n * @param {string} [options.cloneMethod=\"deep\"] - the clone method\n * @param {number} [options.transactional=false] - ?\n * @param {number} options.ttl - ?\n * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default.\n * @see {@link Loki#addCollection} for normal creation of collections\n */\n constructor(name: string, options: Collection.Options = {}) {\n super();\n // the name of the collection\n this.name = name;\n // the data held by the collection\n this._data = [];\n this.idIndex = []; // index of id\n this.binaryIndices = {}; // user defined indexes\n this.constraints = {\n unique: {}\n };\n\n // .\n this.transforms = {};\n\n // .\n this.dirty = true;\n\n // private holders for cached data\n this.cachedIndex = null;\n this.cachedBinaryIndex = null;\n this.cachedData = null;\n\n /* OPTIONS */\n // exact match and unique constraints\n if (options.unique !== undefined) {\n if (!Array.isArray(options.unique)) {\n options.unique = [options.unique];\n }\n options.unique.forEach((prop: keyof TData) => {\n this.constraints.unique[prop] = new UniqueIndex(prop);\n });\n }\n\n // Full text search\n if (PLUGINS[\"FullTextSearch\"] !== undefined) {\n this._fullTextSearch = options.fullTextSearch !== undefined\n ? new (PLUGINS[\"FullTextSearch\"])(options.fullTextSearch) : null;\n } else {\n this._fullTextSearch = null;\n }\n\n // .\n this.adaptiveBinaryIndices = options.adaptiveBinaryIndices !== undefined ? options.adaptiveBinaryIndices : true;\n\n // .\n this.transactional = options.transactional !== undefined ? options.transactional : false;\n\n // .\n this.cloneObjects = options.clone !== undefined ? options.clone : false;\n\n // .\n this.asyncListeners = options.asyncListeners !== undefined ? options.asyncListeners : false;\n\n // .\n this.disableChangesApi = options.disableChangesApi !== undefined ? options.disableChangesApi : true;\n\n // .\n this.disableDeltaChangesApi = options.disableDeltaChangesApi !== undefined ? options.disableDeltaChangesApi : true;\n\n // .\n this.cloneMethod = options.cloneMethod !== undefined ? options.cloneMethod : \"deep\";\n if (this.disableChangesApi) {\n this.disableDeltaChangesApi = true;\n }\n\n // .\n this.serializableIndices = options.serializableIndices !== undefined ? options.serializableIndices : true;\n\n //\n this.ttl = {\n age: null,\n ttlInterval: null,\n daemon: null\n };\n this.setTTL(options.ttl || -1, options.ttlInterval);\n\n // currentMaxId - change manually at your own peril!\n this.maxId = 0;\n\n this._dynamicViews = [];\n\n // events\n this.events = {\n \"insert\": [],\n \"update\": [],\n \"pre-insert\": [],\n \"pre-update\": [],\n \"close\": [],\n \"flushbuffer\": [],\n \"error\": [],\n \"delete\": [],\n \"warning\": []\n };\n\n // .\n this.changes = [];\n\n // initialize the id index\n this._ensureId();\n let indices = options.indices ? options.indices : [];\n for (let idx = 0; idx < indices.length; idx++) {\n this.ensureIndex(options.indices[idx]);\n }\n\n this.setChangesApi(this.disableChangesApi, this.disableDeltaChangesApi);\n\n // Add change api to event callback.\n this.on(\"insert\", (obj: Doc) => {\n this.insertHandler(obj);\n });\n\n this.on(\"update\", (obj: Doc, old: Doc) => {\n this.updateHandler(obj, old);\n });\n\n this.on(\"delete\", (obj: Doc) => {\n if (!this.disableChangesApi) {\n this._createChange(this.name, \"R\", obj);\n }\n });\n\n this.on(\"warning\", (warning: string) => {\n this.console.warn(warning);\n });\n\n // for de-serialization purposes\n this.flushChanges();\n\n this.console = {\n log() {\n },\n warn() {\n },\n error() {\n }\n };\n\n /* ------ STAGING API -------- */\n /**\n * stages: a map of uniquely identified 'stages', which hold copies of objects to be\n * manipulated without affecting the data in the original collection\n */\n this.stages = {};\n this.commitLog = [];\n }\n\n toJSON(): Collection.Serialized {\n return {\n name: this.name,\n _dynamicViews: this._dynamicViews,\n uniqueNames: Object.keys(this.constraints.unique),\n transforms: this.transforms as any,\n binaryIndices: this.binaryIndices as any,\n _data: this._data,\n idIndex: this.idIndex,\n maxId: this.maxId,\n dirty: this.dirty,\n adaptiveBinaryIndices: this.adaptiveBinaryIndices,\n transactional: this.transactional,\n asyncListeners: this.asyncListeners,\n disableChangesApi: this.disableChangesApi,\n disableDeltaChangesApi: this.disableDeltaChangesApi,\n cloneObjects: this.cloneObjects,\n cloneMethod: this.cloneMethod,\n changes: this.changes,\n _fullTextSearch: this._fullTextSearch\n };\n }\n\n static fromJSONObject(obj: Collection.Serialized, options?: Collection.DeserializeOptions) {\n let coll = new Collection(obj.name, {\n disableChangesApi: obj.disableChangesApi,\n disableDeltaChangesApi: obj.disableDeltaChangesApi\n });\n\n coll.adaptiveBinaryIndices = obj.adaptiveBinaryIndices !== undefined ? (obj.adaptiveBinaryIndices === true) : false;\n coll.transactional = obj.transactional;\n coll.asyncListeners = obj.asyncListeners;\n coll.disableChangesApi = obj.disableChangesApi;\n coll.cloneObjects = obj.cloneObjects;\n coll.cloneMethod = obj.cloneMethod || \"deep\";\n coll.changes = obj.changes;\n\n coll.dirty = (options && options.retainDirtyFlags === true) ? obj.dirty : false;\n\n function makeLoader(coll: Collection.Serialized) {\n const collOptions = options[coll.name];\n\n if (collOptions.proto) {\n const inflater = collOptions.inflate || ((src: Doc, dest: Doc) => {\n for (let prop in src) {\n dest[prop] = src[prop];\n }\n });\n\n return (data: Doc) => {\n const collObj = new (collOptions.proto)();\n inflater(data, collObj);\n return collObj;\n };\n }\n\n return collOptions.inflate;\n }\n\n // load each element individually\n if (options && options[obj.name] !== undefined) {\n let loader = makeLoader(obj);\n\n for (let j = 0; j < obj._data.length; j++) {\n coll._data[j] = loader(obj._data[j]);\n }\n } else {\n for (let j = 0; j < obj._data.length; j++) {\n coll._data[j] = obj._data[j];\n }\n }\n\n coll.maxId = (obj.maxId === undefined) ? 0 : obj.maxId;\n coll.idIndex = obj.idIndex;\n if (obj.binaryIndices !== undefined) {\n coll.binaryIndices = obj.binaryIndices;\n }\n if (obj.transforms !== undefined) {\n coll.transforms = obj.transforms;\n }\n\n coll._ensureId();\n\n // regenerate unique indexes\n if (obj.uniqueNames !== undefined) {\n for (let j = 0; j < obj.uniqueNames.length; j++) {\n coll.ensureUniqueIndex(obj.uniqueNames[j]);\n }\n }\n\n // in case they are loading a database created before we added dynamic views, handle undefined\n if (obj._dynamicViews !== undefined) {\n // reinflate DynamicViews and attached ResultSets\n for (let idx = 0; idx < obj._dynamicViews.length; idx++) {\n coll._dynamicViews.push(DynamicView.fromJSONObject(coll, obj._dynamicViews[idx] as any));\n }\n }\n\n if (obj._fullTextSearch) {\n coll._fullTextSearch = PLUGINS[\"FullTextSearch\"].fromJSONObject(obj._fullTextSearch, options.fullTextSearch);\n }\n\n return coll;\n }\n\n /**\n * Adds a named collection transform to the collection\n * @param {string} name - name to associate with transform\n * @param {array} transform - an array of transformation 'step' objects to save into the collection\n */\n public addTransform(name: string, transform: Collection.Transform[]): void {\n if (this.transforms[name] !== undefined) {\n throw new Error(\"a transform by that name already exists\");\n }\n this.transforms[name] = transform;\n }\n\n /**\n * Retrieves a named transform from the collection.\n * @param {string} name - name of the transform to lookup.\n */\n public getTransform(name: string): Collection.Transform[] {\n return this.transforms[name];\n }\n\n /**\n * Updates a named collection transform to the collection\n * @param {string} name - name to associate with transform\n * @param {object} transform - a transformation object to save into collection\n */\n public setTransform(name: string, transform: Collection.Transform[]): void {\n this.transforms[name] = transform;\n }\n\n /**\n * Removes a named collection transform from the collection\n * @param {string} name - name of collection transform to remove\n */\n public removeTransform(name: string): void {\n delete this.transforms[name];\n }\n\n /*----------------------------+\n | TTL |\n +----------------------------*/\n private setTTL(age: number, interval: number): void {\n if (age < 0) {\n clearInterval(this.ttl.daemon);\n } else {\n this.ttl.age = age;\n this.ttl.ttlInterval = interval;\n this.ttl.daemon = setInterval(() => {\n const now = Date.now();\n const toRemove = this.chain().where((member: Doc) => {\n const timestamp = member.meta.updated || member.meta.created;\n const diff = now - timestamp;\n return this.ttl.age < diff;\n });\n toRemove.remove();\n }, interval);\n }\n }\n\n /*----------------------------+\n | INDEXING |\n +----------------------------*/\n\n /**\n * create a row filter that covers all documents in the collection\n */\n _prepareFullDocIndex(): number[] {\n const indexes = new Array(this._data.length);\n for (let i = 0; i < indexes.length; i++) {\n indexes[i] = i;\n }\n return indexes;\n }\n\n /**\n * Ensure binary index on a certain field\n * @param {string} property - name of property to create binary index on\n * @param {boolean} [force=false] - flag indicating whether to construct index immediately\n */\n ensureIndex(property: keyof TData, force = false) {\n // optional parameter to force rebuild whether flagged as dirty or not\n if (property === null || property === undefined) {\n throw new Error(\"Attempting to set index without an associated property\");\n }\n\n if (this.binaryIndices[property] && !force) {\n if (!this.binaryIndices[property].dirty) return;\n }\n\n // if the index is already defined and we are using adaptiveBinaryIndices and we are not forcing a rebuild, return.\n if (this.adaptiveBinaryIndices === true && this.binaryIndices[property] !== undefined && !force) {\n return;\n }\n\n const index = {\n \"name\": property,\n \"dirty\": true,\n \"values\": this._prepareFullDocIndex()\n };\n this.binaryIndices[property] = index;\n\n const data = this._data;\n const wrappedComparer = (a: number, b: number) => {\n let val1, val2;\n if (~property.indexOf(\".\")) {\n const arr = property.split(\".\");\n val1 = arr.reduce(function (obj, i) {\n return obj && obj[i] || undefined;\n }, data[a]);\n val2 = arr.reduce(function (obj, i) {\n return obj && obj[i] || undefined;\n }, data[b]);\n } else {\n val1 = data[a][property];\n val2 = data[b][property];\n }\n\n if (val1 !== val2) {\n if (ltHelper(val1, val2, false)) return -1;\n if (gtHelper(val1, val2, false)) return 1;\n }\n return 0;\n };\n\n index.values.sort(wrappedComparer);\n index.dirty = false;\n\n this.dirty = true; // for autosave scenarios\n }\n\n getSequencedIndexValues(property: keyof TData) {\n let idx;\n const idxvals = this.binaryIndices[property].values;\n let result = \"\";\n\n for (idx = 0; idx < idxvals.length; idx++) {\n result += \" [\" + idx + \"] \" + this._data[idxvals[idx]][property];\n }\n\n return result;\n }\n\n ensureUniqueIndex(field: keyof TData) {\n let index = new UniqueIndex(field);\n\n // if index already existed, (re)loading it will likely cause collisions, rebuild always\n this.constraints.unique[field] = index;\n for (let i = 0; i < this._data.length; i++) {\n index.set(this._data[i], i);\n }\n return index;\n }\n\n /**\n * Ensure all binary indices\n */\n ensureAllIndexes(force = false) {\n const bIndices = this.binaryIndices;\n for (const key in bIndices) {\n if (bIndices[key] !== undefined) {\n this.ensureIndex(key, force);\n }\n }\n }\n\n flagBinaryIndexesDirty() {\n let key;\n const bIndices = this.binaryIndices;\n for (key in bIndices) {\n if (bIndices[key] !== undefined) {\n bIndices[key].dirty = true;\n }\n }\n }\n\n flagBinaryIndexDirty(index: string) {\n if (this.binaryIndices[index])\n this.binaryIndices[index].dirty = true;\n }\n\n /**\n * Quickly determine number of documents in collection (or query)\n * @param {object} query - (optional) query object to count results of\n * @returns {number} number of documents in the collection\n */\n public count(query?: ResultSet.Query & TNested>): number {\n if (!query) {\n return this._data.length;\n }\n return this.chain().find(query)._filteredRows.length;\n }\n\n /**\n * Rebuild idIndex\n */\n private _ensureId(): void {\n this.idIndex = [];\n for (let i = 0; i < this._data.length; i++) {\n this.idIndex.push(this._data[i].$loki);\n }\n }\n\n /**\n * Add a dynamic view to the collection\n * @param {string} name - name of dynamic view to add\n * @param {object} options - (optional) options to configure dynamic view with\n * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata'\n * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority\n * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here)\n * @returns {DynamicView} reference to the dynamic view added\n **/\n public addDynamicView(name: string, options?: DynamicView.Options): DynamicView {\n const dv = new DynamicView(this, name, options);\n this._dynamicViews.push(dv);\n\n return dv;\n }\n\n /**\n * Remove a dynamic view from the collection\n * @param {string} name - name of dynamic view to remove\n **/\n public removeDynamicView(name: string): void {\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n if (this._dynamicViews[idx].name === name) {\n this._dynamicViews.splice(idx, 1);\n }\n }\n }\n\n /**\n * Look up dynamic view reference from within the collection\n * @param {string} name - name of dynamic view to retrieve reference of\n * @returns {DynamicView} A reference to the dynamic view with that name\n **/\n public getDynamicView(name: string): DynamicView {\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n if (this._dynamicViews[idx].name === name) {\n return this._dynamicViews[idx];\n }\n }\n\n return null;\n }\n\n /**\n * Applies a 'mongo-like' find query object and passes all results to an update function.\n * For filter function querying you should migrate to [\n * Where()]{@link Collection#updateWhere}.\n *\n * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode)\n * @param {function} updateFunction - update function to run against filtered documents\n */\n findAndUpdate(filterObject: ResultSet.Query & TNested> | ((obj: Doc) => boolean), updateFunction: (obj: Doc) => any) {\n if (typeof(filterObject) === \"function\") {\n this.updateWhere(filterObject, updateFunction);\n } else {\n this.chain().find(filterObject).update(updateFunction);\n }\n }\n\n /**\n * Applies a 'mongo-like' find query object removes all documents which match that filter.\n *\n * @param {object} filterObject - 'mongo-like' query object\n */\n findAndRemove(filterObject: ResultSet.Query & TNested>) {\n this.chain().find(filterObject).remove();\n }\n\n /**\n * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc.\n * @param {(object|array)} doc - the document (or array of documents) to be inserted\n * @returns {(object|array)} document or documents inserted\n */\n insert(doc: TData): Doc;\n insert(doc: TData[]): Doc[];\n insert(doc: TData | TData[]): Doc | Doc[] {\n if (!Array.isArray(doc)) {\n return this.insertOne(doc);\n }\n\n // holder to the clone of the object inserted if collections is set to clone objects\n let obj;\n let results = [];\n\n this.emit(\"pre-insert\", doc);\n for (let i = 0; i < doc.length; i++) {\n obj = this.insertOne(doc[i], true);\n if (!obj) {\n return undefined;\n }\n results.push(obj);\n }\n // at the 'batch' level, if clone option is true then emitted docs are clones\n this.emit(\"insert\", results);\n\n // if clone option is set, clone return values\n results = this.cloneObjects ? clone(results, this.cloneMethod) : results;\n\n return results.length === 1 ? results[0] : results;\n }\n\n /**\n * Adds a single object, ensures it has meta properties, clone it if necessary, etc.\n * @param {object} doc - the document to be inserted\n * @param {boolean} bulkInsert - quiet pre-insert and insert event emits\n * @returns {object} document or 'undefined' if there was a problem inserting it\n */\n insertOne(doc: TData, bulkInsert = false): Doc {\n let err = null;\n let returnObj;\n\n if (typeof doc !== \"object\") {\n err = new TypeError(\"Document needs to be an object\");\n } else if (doc === null) {\n err = new TypeError(\"Object cannot be null\");\n }\n\n if (err !== null) {\n this.emit(\"error\", err);\n throw err;\n }\n\n // if configured to clone, do so now... otherwise just use same obj reference\n const obj = this.cloneObjects ? clone(doc, this.cloneMethod) : doc;\n\n if ((obj).meta === undefined) {\n (obj).meta = {\n revision: 0,\n created: 0\n };\n }\n\n // both 'pre-insert' and 'insert' events are passed internal data reference even when cloning\n // insert needs internal reference because that is where loki itself listens to add meta\n if (!bulkInsert) {\n this.emit(\"pre-insert\", obj);\n }\n if (!this.add(obj)) {\n return undefined;\n }\n\n returnObj = obj;\n if (!bulkInsert) {\n this.emit(\"insert\", obj);\n returnObj = this.cloneObjects ? clone(obj, this.cloneMethod) : obj;\n }\n\n return returnObj as Doc;\n }\n\n /**\n * Empties the collection.\n * @param {boolean} [removeIndices=false] - remove indices\n */\n clear({removeIndices: removeIndices = false} = {}) {\n this._data = [];\n this.idIndex = [];\n this.cachedIndex = null;\n this.cachedBinaryIndex = null;\n this.cachedData = null;\n this.maxId = 0;\n this._dynamicViews = [];\n this.dirty = true;\n\n // if removing indices entirely\n if (removeIndices === true) {\n this.binaryIndices = {};\n\n this.constraints = {\n unique: {}\n };\n }\n // clear indices but leave definitions in place\n else {\n // clear binary indices\n const keys = Object.keys(this.binaryIndices);\n keys.forEach((biname) => {\n this.binaryIndices[biname].dirty = false;\n this.binaryIndices[biname].values = [];\n });\n\n // clear entire unique indices definition\n const uniqueNames = Object.keys(this.constraints.unique);\n for (let i = 0; i < uniqueNames.length; i++) {\n this.constraints.unique[uniqueNames[i]].clear();\n }\n }\n\n if (this._fullTextSearch !== null) {\n this._fullTextSearch.clear();\n }\n }\n\n /**\n * Updates an object and notifies collection that the document has changed.\n * @param {object} doc - document to update within the collection\n */\n public update(doc: Doc | Doc[]): void {\n if (Array.isArray(doc)) {\n let k = 0;\n const len = doc.length;\n for (k; k < len; k++) {\n this.update(doc[k]);\n }\n return;\n }\n // verify object is a properly formed document\n if (doc.$loki === undefined) {\n throw new Error(\"Trying to update unsynced document. Please save the document first by using insert() or addMany()\");\n }\n\n try {\n this.startTransaction();\n const arr = this.get(doc.$loki, true);\n\n if (!arr) {\n throw new Error(\"Trying to update a document not in collection.\");\n }\n\n // ref to existing obj\n let oldInternal = arr[0]; // -internal- obj ref\n let position = arr[1]; // position in data array\n\n // ref to new internal obj\n // if configured to clone, do so now... otherwise just use same obj reference\n let newInternal = this.cloneObjects || !this.disableDeltaChangesApi ? clone(doc, this.cloneMethod) : doc;\n\n this.emit(\"pre-update\", doc);\n\n Object.keys(this.constraints.unique).forEach((key) => {\n this.constraints.unique[key].update(newInternal, position);\n });\n\n // operate the update\n this._data[position] = newInternal;\n\n // now that we can efficiently determine the data[] position of newly added document,\n // submit it for all registered DynamicViews to evaluate for inclusion/exclusion\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n this._dynamicViews[idx]._evaluateDocument(position, false);\n }\n\n if (this.adaptiveBinaryIndices) {\n // for each binary index defined in collection, immediately update rather than flag for lazy rebuild\n const bIndices = this.binaryIndices;\n for (const key in bIndices) {\n this.adaptiveBinaryIndexUpdate(position, key);\n }\n } else {\n this.flagBinaryIndexesDirty();\n }\n\n this.idIndex[position] = newInternal.$loki;\n\n // FullTextSearch.\n if (this._fullTextSearch !== null) {\n this._fullTextSearch.updateDocument(doc, position);\n }\n\n this.commit();\n this.dirty = true; // for autosave scenarios\n\n this.emit(\"update\", doc, this.cloneObjects || !this.disableDeltaChangesApi ? clone(oldInternal, this.cloneMethod) : null);\n } catch (err) {\n this.rollback();\n this.console.error(err.message);\n this.emit(\"error\", err);\n throw (err); // re-throw error so user does not think it succeeded\n }\n }\n\n /**\n * Add object to collection\n */\n private add(obj: TData) {\n // if parameter isn't object exit with throw\n if (\"object\" !== typeof obj) {\n throw new TypeError(\"Object being added needs to be an object\");\n }\n // if object you are adding already has id column it is either already in the collection\n // or the object is carrying its own 'id' property. If it also has a meta property,\n // then this is already in collection so throw error, otherwise rename to originalId and continue adding.\n if (obj[\"$loki\"] !== undefined) {\n throw new Error(\"Document is already in collection, please use update()\");\n }\n\n /*\n * try adding object to collection\n */\n try {\n this.startTransaction();\n this.maxId++;\n\n if (isNaN(this.maxId)) {\n this.maxId = (this._data[this._data.length - 1].$loki + 1);\n }\n\n const newDoc = obj as Doc;\n newDoc.$loki = this.maxId;\n newDoc.meta.version = 0;\n\n const constrUnique = this.constraints.unique;\n for (const key in constrUnique) {\n if (constrUnique[key] !== undefined) {\n constrUnique[key].set(newDoc, this._data.length);\n }\n }\n\n // add new obj id to idIndex\n this.idIndex.push(newDoc.$loki);\n\n // add the object\n this._data.push(newDoc);\n\n const addedPos = this._data.length - 1;\n\n // now that we can efficiently determine the data[] position of newly added document,\n // submit it for all registered DynamicViews to evaluate for inclusion/exclusion\n const dvlen = this._dynamicViews.length;\n for (let i = 0; i < dvlen; i++) {\n this._dynamicViews[i]._evaluateDocument(addedPos, true);\n }\n\n if (this.adaptiveBinaryIndices) {\n // for each binary index defined in collection, immediately update rather than flag for lazy rebuild\n for (const key in this.binaryIndices) {\n this.adaptiveBinaryIndexInsert(addedPos, key);\n }\n } else {\n this.flagBinaryIndexesDirty();\n }\n\n // FullTextSearch.\n if (this._fullTextSearch !== null) {\n this._fullTextSearch.addDocument(newDoc, addedPos);\n }\n\n this.commit();\n this.dirty = true; // for autosave scenarios\n\n return (this.cloneObjects) ? (clone(newDoc, this.cloneMethod)) : (newDoc);\n } catch (err) {\n this.rollback();\n this.console.error(err.message);\n this.emit(\"error\", err);\n throw (err); // re-throw error so user does not think it succeeded\n }\n }\n\n /**\n * Applies a filter function and passes all results to an update function.\n *\n * @param {function} filterFunction - filter function whose results will execute update\n * @param {function} updateFunction - update function to run against filtered documents\n */\n updateWhere(filterFunction: (obj: Doc) => boolean, updateFunction: (obj: Doc) => any) {\n const results = this.where(filterFunction);\n try {\n for (let i = 0; i < results.length; i++) {\n this.update(updateFunction(results[i]));\n }\n } catch (err) {\n this.rollback();\n this.console.error(err.message);\n }\n }\n\n /**\n * Remove all documents matching supplied filter function.\n * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}.\n * @param {function|object} query - query object to filter on\n */\n removeWhere(query: ResultSet.Query & TNested> | ((obj: Doc) => boolean)) {\n if (typeof query === \"function\") {\n this.remove(this._data.filter(query));\n } else {\n this.chain().find(query).remove();\n }\n }\n\n removeDataOnly() {\n this.remove(this._data.slice());\n }\n\n /**\n * Remove a document from the collection\n * @param {number|object} doc - document to remove from collection\n */\n remove(doc: number | Doc | Doc[]): void {\n if (typeof doc === \"number\") {\n doc = this.get(doc);\n }\n\n if (Array.isArray(doc)) {\n let k = 0;\n const len = doc.length;\n for (k; k < len; k++) {\n this.remove(doc[k]);\n }\n return;\n }\n if (doc.$loki === undefined) {\n throw new Error(\"Object is not a document stored in the collection\");\n }\n\n try {\n this.startTransaction();\n const arr = this.get(doc.$loki, true);\n\n const position = arr[1];\n\n Object.keys(this.constraints.unique).forEach((key) => {\n if (doc[key] !== null && doc[key] !== undefined) {\n this.constraints.unique[key].remove(doc[key]);\n }\n });\n // now that we can efficiently determine the data[] position of newly added document,\n // submit it for all registered DynamicViews to remove\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n this._dynamicViews[idx]._removeDocument(position);\n }\n\n if (this.adaptiveBinaryIndices) {\n // for each binary index defined in collection, immediately update rather than flag for lazy rebuild\n for (const key in this.binaryIndices) {\n this.adaptiveBinaryIndexRemove(position, key);\n }\n } else {\n this.flagBinaryIndexesDirty();\n }\n\n this._data.splice(position, 1);\n\n // remove id from idIndex\n this.idIndex.splice(position, 1);\n\n // FullTextSearch.\n if (this._fullTextSearch !== null) {\n this._fullTextSearch.removeDocument(doc, position);\n }\n\n this.commit();\n this.dirty = true; // for autosave scenarios\n this.emit(\"delete\", arr[0]);\n delete doc.$loki;\n delete doc.meta;\n } catch (err) {\n this.rollback();\n this.console.error(err.message);\n this.emit(\"error\", err);\n return null;\n }\n }\n\n /*------------+\n | Change API |\n +------------*/\n /**\n * Returns all changes.\n * @returns {Collection.Change[]}\n */\n public getChanges(): Collection.Change[] {\n return this.changes;\n }\n\n /**\n * Enables/disables changes api.\n * @param {boolean} disableChangesApi\n * @param {boolean} disableDeltaChangesApi\n */\n public setChangesApi(disableChangesApi: boolean, disableDeltaChangesApi: boolean = true) {\n this.disableChangesApi = disableChangesApi;\n this.disableDeltaChangesApi = disableDeltaChangesApi;\n\n if (disableChangesApi) {\n this.disableDeltaChangesApi = true;\n }\n\n this.insertHandler = this.disableChangesApi ? this._insertMeta : this._insertMetaWithChange;\n this.updateHandler = this.disableChangesApi ? this._updateMeta : this._updateMetaWithChange;\n }\n\n /**\n * Clears all the changes.\n */\n public flushChanges() {\n this.changes = [];\n }\n\n private _getObjectDelta(oldObject: Doc, newObject: Doc) {\n const propertyNames = newObject !== null && typeof newObject === \"object\" ? Object.keys(newObject) : null;\n if (propertyNames && propertyNames.length && [\"string\", \"boolean\", \"number\"].indexOf(typeof(newObject)) < 0) {\n const delta = {};\n for (let i = 0; i < propertyNames.length; i++) {\n const propertyName = propertyNames[i];\n if (newObject.hasOwnProperty(propertyName)) {\n if (!oldObject.hasOwnProperty(propertyName) || this.constraints.unique[propertyName] !== undefined || propertyName === \"$loki\" || propertyName === \"meta\") {\n delta[propertyName] = newObject[propertyName];\n }\n else {\n const propertyDelta = this._getObjectDelta(oldObject[propertyName], newObject[propertyName]);\n if (propertyDelta !== undefined && propertyDelta !== {}) {\n delta[propertyName] = propertyDelta;\n }\n }\n }\n }\n return Object.keys(delta).length === 0 ? undefined : delta;\n }\n else {\n return oldObject === newObject ? undefined : newObject;\n }\n }\n\n /**\n * Compare changed object (which is a forced clone) with existing object and return the delta\n */\n private _getChangeDelta(obj: Doc, old: Doc) {\n if (old) {\n return this._getObjectDelta(old, obj);\n }\n else {\n return JSON.parse(JSON.stringify(obj));\n }\n }\n\n /**\n * This method creates a clone of the current status of an object and associates operation and collection name,\n * so the parent db can aggregate and generate a changes object for the entire db\n */\n private _createChange(name: string, op: string, obj: Doc, old?: Doc) {\n this.changes.push({\n name,\n operation: op,\n obj: op === \"U\" && !this.disableDeltaChangesApi ? this._getChangeDelta(obj, old) : JSON.parse(JSON.stringify(obj))\n });\n }\n\n private _createInsertChange(obj: Doc) {\n this._createChange(this.name, \"I\", obj);\n }\n\n /**\n * If the changes API is disabled make sure only metadata is added without re-evaluating everytime if the changesApi is enabled\n */\n private _insertMeta(obj: Doc) {\n let len;\n let idx;\n\n if (!obj) {\n return;\n }\n\n // if batch insert\n if (Array.isArray(obj)) {\n len = obj.length;\n\n for (idx = 0; idx < len; idx++) {\n if (obj[idx].meta === undefined) {\n obj[idx].meta = {};\n }\n\n obj[idx].meta.created = (new Date()).getTime();\n obj[idx].meta.revision = 0;\n }\n\n return;\n }\n\n // single object\n if (!obj.meta) {\n obj.meta = {};\n }\n\n obj.meta.created = (new Date()).getTime();\n obj.meta.revision = 0;\n }\n\n private _updateMeta(obj: Doc) {\n if (!obj) {\n return;\n }\n obj.meta.updated = (new Date()).getTime();\n obj.meta.revision += 1;\n }\n\n\n private _createUpdateChange(obj: Doc, old: Doc) {\n this._createChange(this.name, \"U\", obj, old);\n }\n\n private _insertMetaWithChange(obj: Doc) {\n this._insertMeta(obj);\n this._createInsertChange(obj);\n }\n\n private _updateMetaWithChange(obj: Doc, old: Doc) {\n this._updateMeta(obj);\n this._createUpdateChange(obj, old);\n }\n\n /*---------------------+\n | Finding methods |\n +----------------------*/\n\n /**\n * Get by Id - faster than other methods because of the searching algorithm\n * @param {int} id - $loki id of document you want to retrieve\n * @param {boolean} returnPosition - if 'true' we will return [object, position]\n * @returns {(object|array|null)} Object reference if document was found, null if not,\n * or an array if 'returnPosition' was passed.\n */\n public get(id: number): Doc;\n public get(id: number, returnPosition: boolean): Doc | [Doc, number];\n public get(id: number, returnPosition = false) {\n const data = this.idIndex;\n let max = data.length - 1;\n let min = 0;\n let mid = (min + max) >> 1;\n\n id = typeof id === \"number\" ? id : parseInt(id, 10);\n\n if (isNaN(id)) {\n throw new TypeError(\"Passed id is not an integer\");\n }\n\n while (data[min] < data[max]) {\n mid = (min + max) >> 1;\n\n if (data[mid] < id) {\n min = mid + 1;\n } else {\n max = mid;\n }\n }\n\n if (max === min && data[min] === id) {\n if (returnPosition) {\n return [this._data[min], min];\n }\n return this._data[min];\n }\n return null;\n }\n\n /**\n * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value\n * Since multiple documents may contain the same value (which the index is sorted on),\n * we hone in on range and then linear scan range to find exact index array position.\n * @param {int} dataPosition : data array index/position\n * @param {string} binaryIndexName : index to search for dataPosition in\n */\n public getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData) {\n const val = this._data[dataPosition][binaryIndexName];\n const index = this.binaryIndices[binaryIndexName].values;\n\n // i think calculateRange can probably be moved to collection\n // as it doesn't seem to need ResultSet. need to verify\n //let rs = new ResultSet(this, null, null);\n const range = this.calculateRange(\"$eq\", binaryIndexName, val);\n\n if (range[0] === 0 && range[1] === -1) {\n // uhoh didn't find range\n return null;\n }\n\n const min = range[0];\n const max = range[1];\n\n // narrow down the sub-segment of index values\n // where the indexed property value exactly matches our\n // value and then linear scan to find exact -index- position\n for (let idx = min; idx <= max; idx++) {\n if (index[idx] === dataPosition) return idx;\n }\n\n // uhoh\n return null;\n }\n\n /**\n * Adaptively insert a selected item to the index.\n * @param {int} dataPosition : coll.data array index/position\n * @param {string} binaryIndexName : index to search for dataPosition in\n */\n public adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData) {\n const index = this.binaryIndices[binaryIndexName].values;\n let val: any = this._data[dataPosition][binaryIndexName];\n\n // If you are inserting a javascript Date value into a binary index, convert to epoch time\n if (this.serializableIndices === true && val instanceof Date) {\n this._data[dataPosition][binaryIndexName] = val.getTime();\n val = this._data[dataPosition][binaryIndexName];\n }\n\n const idxPos = (index.length === 0) ? 0 : this._calculateRangeStart(binaryIndexName, val, true);\n\n // insert new data index into our binary index at the proper sorted location for relevant property calculated by idxPos.\n // doing this after adjusting dataPositions so no clash with previous item at that position.\n this.binaryIndices[binaryIndexName].values.splice(idxPos, 0, dataPosition);\n }\n\n /**\n * Adaptively update a selected item within an index.\n * @param {int} dataPosition : coll.data array index/position\n * @param {string} binaryIndexName : index to search for dataPosition in\n */\n public adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData) {\n // linear scan needed to find old position within index unless we optimize for clone scenarios later\n // within (my) node 5.6.0, the following for() loop with strict compare is -much- faster than indexOf()\n let idxPos;\n\n const index = this.binaryIndices[binaryIndexName].values;\n const len = index.length;\n\n for (idxPos = 0; idxPos < len; idxPos++) {\n if (index[idxPos] === dataPosition) break;\n }\n\n //let idxPos = this.binaryIndices[binaryIndexName].values.indexOf(dataPosition);\n this.binaryIndices[binaryIndexName].values.splice(idxPos, 1);\n\n //this.adaptiveBinaryIndexRemove(dataPosition, binaryIndexName, true);\n this.adaptiveBinaryIndexInsert(dataPosition, binaryIndexName);\n }\n\n /**\n * Adaptively remove a selected item from the index.\n * @param {number} dataPosition : coll.data array index/position\n * @param {string} binaryIndexName : index to search for dataPosition in\n * @param {boolean} removedFromIndexOnly - remove from index only\n */\n public adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly = false): void {\n const idxPos = this.getBinaryIndexPosition(dataPosition, binaryIndexName);\n if (idxPos === null) {\n return;\n }\n\n // remove document from index\n this.binaryIndices[binaryIndexName].values.splice(idxPos, 1);\n\n // if we passed this optional flag parameter, we are calling from adaptiveBinaryIndexUpdate,\n // in which case data positions stay the same.\n if (removedFromIndexOnly === true) {\n return;\n }\n\n // since index stores data array positions, if we remove a document\n // we need to adjust array positions -1 for all document positions greater than removed position\n const index = this.binaryIndices[binaryIndexName].values;\n for (let idx = 0; idx < index.length; idx++) {\n if (index[idx] > dataPosition) {\n index[idx]--;\n }\n }\n }\n\n /**\n * Internal method used for index maintenance and indexed searching.\n * Calculates the beginning of an index range for a given value.\n * For index maintainance (adaptive:true), we will return a valid index position to insert to.\n * For querying (adaptive:false/undefined), we will :\n * return lower bound/index of range of that value (if found)\n * return next lower index position if not found (hole)\n * If index is empty it is assumed to be handled at higher level, so\n * this method assumes there is at least 1 document in index.\n *\n * @param {string} prop - name of property which has binary index\n * @param {any} val - value to find within index\n * @param {bool?} adaptive - if true, we will return insert position\n */\n private _calculateRangeStart(prop: keyof TData, val: any, adaptive = false): number {\n const rcd = this._data;\n const index = this.binaryIndices[prop].values;\n let min = 0;\n let max = index.length - 1;\n let mid = 0;\n\n if (index.length === 0) {\n return -1;\n }\n\n // hone in on start position of value\n while (min < max) {\n mid = (min + max) >> 1;\n\n if (ltHelper(rcd[index[mid]][prop], val, false)) {\n min = mid + 1;\n } else {\n max = mid;\n }\n }\n\n const lbound = min;\n\n // found it... return it\n if (aeqHelper(val, rcd[index[lbound]][prop])) {\n return lbound;\n }\n\n // if not in index and our value is less than the found one\n if (ltHelper(val, rcd[index[lbound]][prop], false)) {\n return adaptive ? lbound : lbound - 1;\n }\n\n // not in index and our value is greater than the found one\n return adaptive ? lbound + 1 : lbound;\n }\n\n /**\n * Internal method used for indexed $between. Given a prop (index name), and a value\n * (which may or may not yet exist) this will find the final position of that upper range value.\n */\n private _calculateRangeEnd(prop: keyof TData, val: any) {\n const rcd = this._data;\n const index = this.binaryIndices[prop].values;\n let min = 0;\n let max = index.length - 1;\n let mid = 0;\n\n if (index.length === 0) {\n return -1;\n }\n\n // hone in on start position of value\n while (min < max) {\n mid = (min + max) >> 1;\n\n if (ltHelper(val, rcd[index[mid]][prop], false)) {\n max = mid;\n } else {\n min = mid + 1;\n }\n }\n\n const ubound = max;\n\n // only eq if last element in array is our val\n if (aeqHelper(val, rcd[index[ubound]][prop])) {\n return ubound;\n }\n\n // if not in index and our value is less than the found one\n if (gtHelper(val, rcd[index[ubound]][prop], false)) {\n return ubound + 1;\n }\n\n // either hole or first nonmatch\n if (aeqHelper(val, rcd[index[ubound - 1]][prop])) {\n return ubound - 1;\n }\n\n // hole, so ubound if nearest gt than the val we were looking for\n return ubound;\n }\n\n /**\n * Binary Search utility method to find range/segment of values matching criteria.\n * this is used for collection.find() and first find filter of ResultSet/dynview\n * slightly different than get() binary search in that get() hones in on 1 value,\n * but we have to hone in on many (range)\n * @param {string} op - operation, such as $eq\n * @param {string} prop - name of property to calculate range for\n * @param {object} val - value to use for range calculation.\n * @returns {array} [start, end] index array positions\n */\n public calculateRange(op: string, prop: keyof TData, val: any): [number, number] {\n const rcd = this._data;\n const index = this.binaryIndices[prop].values;\n const min = 0;\n const max = index.length - 1;\n let lbound;\n let lval;\n let ubound;\n\n // when no documents are in collection, return empty range condition\n if (rcd.length === 0) {\n return [0, -1];\n }\n\n const minVal = rcd[index[min]][prop];\n const maxVal = rcd[index[max]][prop];\n\n // if value falls outside of our range return [0, -1] to designate no results\n switch (op) {\n case \"$eq\":\n case \"$aeq\":\n if (ltHelper(val, minVal, false) || gtHelper(val, maxVal, false)) {\n return [0, -1];\n }\n break;\n case \"$dteq\":\n if (ltHelper(val, minVal, false) || gtHelper(val, maxVal, false)) {\n return [0, -1];\n }\n break;\n case \"$gt\":\n // none are within range\n if (gtHelper(val, maxVal, true)) {\n return [0, -1];\n }\n // all are within range\n if (gtHelper(minVal, val, false)) {\n return [min, max];\n }\n break;\n case \"$gte\":\n // none are within range\n if (gtHelper(val, maxVal, false)) {\n return [0, -1];\n }\n // all are within range\n if (gtHelper(minVal, val, true)) {\n return [min, max];\n }\n break;\n case \"$lt\":\n // none are within range\n if (ltHelper(val, minVal, true)) {\n return [0, -1];\n }\n // all are within range\n if (ltHelper(maxVal, val, false)) {\n return [min, max];\n }\n break;\n case \"$lte\":\n // none are within range\n if (ltHelper(val, minVal, false)) {\n return [0, -1];\n }\n // all are within range\n if (ltHelper(maxVal, val, true)) {\n return [min, max];\n }\n break;\n case \"$between\":\n // none are within range (low range is greater)\n if (gtHelper(val[0], maxVal, false)) {\n return [0, -1];\n }\n // none are within range (high range lower)\n if (ltHelper(val[1], minVal, false)) {\n return [0, -1];\n }\n\n lbound = this._calculateRangeStart(prop, val[0]);\n ubound = this._calculateRangeEnd(prop, val[1]);\n\n if (lbound < 0) lbound++;\n if (ubound > max) ubound--;\n\n if (!gtHelper(rcd[index[lbound]][prop], val[0], true)) lbound++;\n if (!ltHelper(rcd[index[ubound]][prop], val[1], true)) ubound--;\n\n if (ubound < lbound) return [0, -1];\n\n return ([lbound, ubound]);\n }\n\n // determine lbound where needed\n switch (op) {\n case \"$eq\":\n case \"$aeq\":\n case \"$dteq\":\n case \"$gte\":\n case \"$lt\":\n lbound = this._calculateRangeStart(prop, val);\n lval = rcd[index[lbound]][prop];\n break;\n default:\n break;\n }\n\n // determine ubound where needed\n switch (op) {\n case \"$eq\":\n case \"$aeq\":\n case \"$dteq\":\n case \"$lte\":\n case \"$gt\":\n ubound = this._calculateRangeEnd(prop, val);\n break;\n default:\n break;\n }\n\n\n switch (op) {\n case \"$eq\":\n case \"$aeq\":\n case \"$dteq\":\n if (!aeqHelper(lval, val)) {\n return [0, -1];\n }\n return [lbound, ubound];\n\n case \"$gt\":\n // (an eqHelper would probably be better test)\n // if hole (not found) ub position is already greater\n if (!aeqHelper(rcd[index[ubound]][prop], val)) {\n //if (gtHelper(rcd[index[ubound]][prop], val, false)) {\n return [ubound, max];\n }\n // otherwise (found) so ubound is still equal, get next\n return [ubound + 1, max];\n\n case \"$gte\":\n // if hole (not found) lb position marks left outside of range\n if (!aeqHelper(rcd[index[lbound]][prop], val)) {\n //if (ltHelper(rcd[index[lbound]][prop], val, false)) {\n return [lbound + 1, max];\n }\n // otherwise (found) so lb is first position where its equal\n return [lbound, max];\n\n case \"$lt\":\n // if hole (not found) position already is less than\n if (!aeqHelper(rcd[index[lbound]][prop], val)) {\n //if (ltHelper(rcd[index[lbound]][prop], val, false)) {\n return [min, lbound];\n }\n // otherwise (found) so lb marks left inside of eq range, get previous\n return [min, lbound - 1];\n\n case \"$lte\":\n // if hole (not found) ub position marks right outside so get previous\n if (!aeqHelper(rcd[index[ubound]][prop], val)) {\n //if (gtHelper(rcd[index[ubound]][prop], val, false)) {\n return [min, ubound - 1];\n }\n // otherwise (found) so ub is last position where its still equal\n return [min, ubound];\n\n default:\n return [0, rcd.length - 1];\n }\n }\n\n /**\n * Retrieve doc by Unique index\n * @param {string} field - name of uniquely indexed property to use when doing lookup\n * @param {any} value - unique value to search for\n * @returns {object} document matching the value passed\n */\n public by(field: string, value: any): Doc {\n return this.findOne({[field]: value} as any);\n }\n\n /**\n * Find one object by index property, by property equal to value\n * @param {object} query - query object used to perform search with\n * @returns {(object|null)} First matching document, or null if none\n */\n public findOne(query: ResultSet.Query & TNested>): Doc {\n query = query || {};\n\n // Instantiate ResultSet and exec find op passing firstOnly = true param\n const result = this.chain().find(query, true).data();\n\n if (Array.isArray(result) && result.length === 0) {\n return null;\n } else {\n if (!this.cloneObjects) {\n return result[0] as any as Doc;\n } else {\n return clone(result[0], this.cloneMethod) as any as Doc;\n }\n }\n }\n\n /**\n * Chain method, used for beginning a series of chained find() and/or view() operations\n * on a collection.\n *\n * @param {array} transform - Ordered array of transform step objects similar to chain\n * @param {object} parameters - Object containing properties representing parameters to substitute\n * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called\n */\n public chain(transform?: string | Collection.Transform[], parameters?: object): ResultSet {\n const rs = new ResultSet(this);\n if (transform === undefined) {\n return rs;\n }\n return rs.transform(transform, parameters);\n }\n\n /**\n * Find method, api is similar to mongodb.\n * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}.\n * @example {@tutorial Query Examples}\n * @param {object} query - 'mongo-like' query object\n * @returns {array} Array of matching documents\n */\n public find(query?: ResultSet.Query & TNested>): Doc[] {\n return this.chain().find(query).data();\n }\n\n /**\n * Find object by unindexed field by property equal to value,\n * simply iterates and returns the first element matching the query\n */\n public findOneUnindexed(prop: string, value: any) {\n let i = this._data.length;\n let doc;\n while (i--) {\n if (this._data[i][prop] === value) {\n doc = this._data[i];\n return doc;\n }\n }\n return null;\n }\n\n /**\n * Transaction methods\n */\n\n /**\n * start the transation\n */\n public startTransaction(): void {\n if (this.transactional) {\n this.cachedData = clone(this._data, this.cloneMethod);\n this.cachedIndex = this.idIndex;\n this.cachedBinaryIndex = this.binaryIndices;\n\n // propagate startTransaction to dynamic views\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n this._dynamicViews[idx].startTransaction();\n }\n }\n }\n\n /**\n * commit the transation\n */\n public commit(): void {\n if (this.transactional) {\n this.cachedData = null;\n this.cachedIndex = null;\n this.cachedBinaryIndex = null;\n\n // propagate commit to dynamic views\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n this._dynamicViews[idx].commit();\n }\n }\n }\n\n /**\n * roll back the transation\n */\n public rollback(): void {\n if (this.transactional) {\n if (this.cachedData !== null && this.cachedIndex !== null) {\n this._data = this.cachedData;\n this.idIndex = this.cachedIndex;\n this.binaryIndices = this.cachedBinaryIndex;\n }\n\n // propagate rollback to dynamic views\n for (let idx = 0; idx < this._dynamicViews.length; idx++) {\n this._dynamicViews[idx].rollback();\n }\n }\n }\n\n /**\n * Query the collection by supplying a javascript filter function.\n * @example\n * let results = coll.where(function(obj) {\n\t * return obj.legs === 8;\n\t * });\n *\n * @param {function} fun - filter function to run against all collection docs\n * @returns {array} all documents which pass your filter function\n */\n public where(fun: (obj: Doc) => boolean): Doc[] {\n return this.chain().where(fun).data();\n }\n\n /**\n * Map Reduce operation\n * @param {function} mapFunction - function to use as map function\n * @param {function} reduceFunction - function to use as reduce function\n * @returns {data} The result of your mapReduce operation\n */\n public mapReduce(mapFunction: (value: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U {\n return reduceFunction(this._data.map(mapFunction));\n }\n\n /**\n * Join two collections on specified properties\n *\n * @param {array} joinData - array of documents to 'join' to this collection\n * @param {string} leftJoinProp - property name in collection\n * @param {string} rightJoinProp - property name in joinData\n * @param {function} mapFun - (Optional) map function to use\n * @param dataOptions - options to data() before input to your map function\n * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun\n * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object\n * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method\n * @returns {ResultSet} Result of the mapping operation\n */\n public eqJoin(joinData: Collection | ResultSet | any[], leftJoinProp: string | ((obj: any) => string),\n rightJoinProp: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any,\n dataOptions?: ResultSet.DataOptions): ResultSet {\n return new ResultSet(this).eqJoin(joinData, leftJoinProp, rightJoinProp, mapFun, dataOptions);\n }\n\n /* ------ STAGING API -------- */\n\n /**\n * (Staging API) create a stage and/or retrieve it\n */\n getStage(name: string) {\n if (!this.stages[name]) {\n this.stages[name] = {};\n }\n return this.stages[name];\n }\n\n /**\n * a collection of objects recording the changes applied through a commmitStage\n */\n\n /**\n * (Staging API) create a copy of an object and insert it into a stage\n */\n public stage(stageName: string, obj: Doc): F {\n const copy = JSON.parse(JSON.stringify(obj));\n this.getStage(stageName)[obj.$loki] = copy;\n return copy;\n }\n\n /**\n * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt\n * then create a message to be inserted in the commitlog\n * @param {string} stageName - name of stage\n * @param {string} message\n */\n public commitStage(stageName: string, message: string) {\n const stage = this.getStage(stageName);\n const timestamp = new Date().getTime();\n\n for (const prop in stage) {\n this.update(stage[prop]);\n this.commitLog.push({\n timestamp,\n message,\n data: JSON.parse(JSON.stringify(stage[prop]))\n });\n }\n this.stages[stageName] = {};\n }\n\n /**\n */\n public extract(field: string): any[] {\n const isDotNotation = isDeepProperty(field);\n const result = [];\n for (let i = 0; i < this._data.length; i++) {\n result.push(deepProperty(this._data[i], field, isDotNotation));\n }\n return result;\n }\n\n /**\n */\n public max(field: string): number {\n return Math.max.apply(null, this.extract(field));\n }\n\n /**\n */\n public min(field: string): number {\n return Math.min.apply(null, this.extract(field));\n }\n\n /**\n */\n public maxRecord(field: string) {\n const deep = isDeepProperty(field);\n\n const result = {\n index: 0,\n value: 0\n };\n\n let max;\n for (let i = 0; i < this._data.length; i++) {\n if (max !== undefined) {\n if (max < deepProperty(this._data[i], field, deep)) {\n max = deepProperty(this._data[i], field, deep);\n result.index = this._data[i].$loki;\n }\n } else {\n max = deepProperty(this._data[i], field, deep);\n result.index = this._data[i].$loki;\n }\n }\n result.value = max;\n return result;\n }\n\n /**\n */\n public minRecord(field: string) {\n const deep = isDeepProperty(field);\n\n const result = {\n index: 0,\n value: 0\n };\n\n let min;\n for (let i = 0; i < this._data.length; i++) {\n if (min !== undefined) {\n if (min > deepProperty(this._data[i], field, deep)) {\n min = deepProperty(this._data[i], field, deep);\n result.index = this._data[i].$loki;\n }\n } else {\n min = deepProperty(this._data[i], field, deep);\n result.index = this._data[i].$loki;\n }\n }\n result.value = min;\n return result;\n }\n\n /**\n */\n public extractNumerical(field: string) {\n return this.extract(field).map(parseFloat).filter(Number).filter((n) => !(isNaN(n)));\n }\n\n /**\n * Calculates the average numerical value of a property\n *\n * @param {string} field - name of property in docs to average\n * @returns {number} average of property in all docs in the collection\n */\n public avg(field: string) {\n return average(this.extractNumerical(field));\n }\n\n /**\n * Calculate standard deviation of a field\n * @param {string} field\n */\n public stdDev(field: string) {\n return standardDeviation(this.extractNumerical(field));\n }\n\n /**\n * @param {string} field\n */\n public mode(field: string) {\n const dict = {};\n const data = this.extract(field);\n data.forEach((obj) => {\n if (dict[obj]) {\n dict[obj] += 1;\n } else {\n dict[obj] = 1;\n }\n });\n let max;\n let prop;\n let mode;\n for (prop in dict) {\n if (max) {\n if (max < dict[prop]) {\n mode = prop;\n }\n } else {\n mode = prop;\n max = dict[prop];\n }\n }\n return mode;\n }\n\n /**\n * @param {string} field - property name\n */\n public median(field: string) {\n const values = this.extractNumerical(field);\n values.sort((a, b) => a - b);\n\n const half = Math.floor(values.length / 2);\n\n if (values.length % 2) {\n return values[half];\n } else {\n return (values[half - 1] + values[half]) / 2.0;\n }\n }\n}\n\nexport namespace Collection {\n export interface Options {\n unique?: (keyof TData)[];\n indices?: (keyof TData)[];\n adaptiveBinaryIndices?: boolean;\n asyncListeners?: boolean;\n disableChangesApi?: boolean;\n disableDeltaChangesApi?: boolean;\n clone?: boolean;\n serializableIndices?: boolean;\n cloneMethod?: CloneMethod;\n transactional?: boolean;\n ttl?: number;\n ttlInterval?: number;\n fullTextSearch?: FullTextSearch.FieldOptions[];\n }\n\n export interface DeserializeOptions {\n retainDirtyFlags?: boolean;\n fullTextSearch?: Dict;\n\n [collName: string]: any | { proto?: any; inflate?: (src: object, dest?: object) => void };\n }\n\n export interface BinaryIndex {\n dirty: boolean;\n values: any;\n }\n\n export interface Change {\n name: string;\n operation: string;\n obj: any;\n }\n\n export interface Serialized {\n name: string;\n _dynamicViews: DynamicView[];\n uniqueNames: string[];\n transforms: Dict;\n binaryIndices: Dict;\n _data: Doc[];\n idIndex: number[];\n maxId: number;\n dirty: boolean;\n adaptiveBinaryIndices: boolean;\n transactional: boolean;\n asyncListeners: boolean;\n disableChangesApi: boolean;\n disableDeltaChangesApi: boolean;\n cloneObjects: boolean;\n cloneMethod: CloneMethod;\n changes: any;\n _fullTextSearch: FullTextSearch;\n }\n\n export type Transform = {\n type: \"find\";\n value: ResultSet.Query & TNested> | string;\n } | {\n type: \"where\";\n value: ((obj: Doc) => boolean) | string;\n } | {\n type: \"simplesort\";\n property: keyof (TData & TNested);\n desc?: boolean;\n } | {\n type: \"compoundsort\";\n value: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[];\n } | {\n type: \"sort\";\n value: (a: Doc, b: Doc) => number;\n } | {\n type: \"sortByScoring\";\n desc?: boolean;\n } | {\n type: \"limit\";\n value: number;\n } | {\n type: \"offset\";\n value: number;\n } | {\n type: \"map\";\n value: (obj: TData, index: number, array: TData[]) => any;\n dataOptions?: ResultSet.DataOptions;\n } | {\n type: \"eqJoin\";\n joinData: Collection | ResultSet;\n leftJoinKey: string | ((obj: any) => string);\n rightJoinKey: string | ((obj: any) => string);\n mapFun?: (left: any, right: any) => any;\n dataOptions?: ResultSet.DataOptions;\n } | {\n type: \"mapReduce\";\n mapFunction: (item: TData, index: number, array: TData[]) => any;\n reduceFunction: (array: any[]) => any;\n } | {\n type: \"update\";\n value: (obj: Doc) => any;\n } | {\n type: \"remove\";\n };\n\n export interface TTL {\n age: number;\n ttlInterval: number;\n daemon: any; // setInterval Timer\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/collection.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 2\n// module chunks = 0","import {Collection} from \"./collection\";\nimport {clone, CloneMethod} from \"./clone\";\nimport {ltHelper, gtHelper, aeqHelper, sortHelper} from \"./helper\";\nimport {Doc} from \"../../common/types\";\nimport {Scorer} from \"../../full-text-search/src/scorer\";\nimport {Query as FullTextSearchQuery} from \"../../full-text-search/src/query_builder\";\n\n// used to recursively scan hierarchical transform step object for param substitution\nfunction resolveTransformObject(subObj: Collection.Transform, params: object, depth: number = 0): Collection.Transform {\n if (++depth >= 10) {\n return subObj;\n }\n\n for (const prop in subObj) {\n if (typeof subObj[prop] === \"string\" && subObj[prop].indexOf(\"[%lktxp]\") === 0) {\n const pname = subObj[prop].substring(8);\n if (params[pname] !== undefined) {\n subObj[prop] = params[pname];\n }\n } else if (typeof subObj[prop] === \"object\") {\n subObj[prop] = resolveTransformObject(subObj[prop], params, depth);\n }\n }\n return subObj;\n}\n\n// top level utility to resolve an entire (single) transform (array of steps) for parameter substitution\nfunction resolveTransformParams(transform: Collection.Transform[], params: object): Collection.Transform[] {\n if (params === undefined) {\n return transform;\n }\n\n // iterate all steps in the transform array\n const resolvedTransform: Collection.Transform[] = [];\n for (let idx = 0; idx < transform.length; idx++) {\n // clone transform so our scan/replace can operate directly on cloned transform\n const clonedStep = clone(transform[idx], \"shallow-recurse-objects\");\n resolvedTransform.push(resolveTransformObject(clonedStep, params));\n }\n\n return resolvedTransform;\n}\n\nfunction containsCheckFn(a: any) {\n if (typeof a === \"string\" || Array.isArray(a)) {\n return (b: any) => (a as any).indexOf(b) !== -1;\n } else if (typeof a === \"object\" && a !== null) {\n return (b: string) => Object.hasOwnProperty.call(a, b);\n }\n return null;\n}\n\nfunction doQueryOp(val: any, op: object) {\n for (let p in op) {\n if (Object.hasOwnProperty.call(op, p)) {\n return LokiOps[p](val, op[p]);\n }\n }\n return false;\n}\n\n\n/**\n * @hidden\n */\nexport const LokiOps = {\n // comparison operators\n // a is the value in the _collection\n // b is the query value\n $eq(a: any, b: any): boolean {\n return a === b;\n },\n\n // abstract/loose equality\n $aeq(a: any, b: any): boolean {\n return a == b;\n },\n\n $ne(a: any, b: any): boolean {\n // ecma 5 safe test for NaN\n if (b !== b) {\n // ecma 5 test value is not NaN\n return (a === a);\n }\n return a !== b;\n },\n\n // date equality / loki abstract equality test\n $dteq(a: any, b: any): boolean {\n return aeqHelper(a, b);\n },\n\n $gt(a: any, b: any): boolean {\n return gtHelper(a, b, false);\n },\n\n $gte(a: any, b: any): boolean {\n return gtHelper(a, b, true);\n },\n\n $lt(a: any, b: any): boolean {\n return ltHelper(a, b, false);\n },\n\n $lte(a: any, b: any): boolean {\n return ltHelper(a, b, true);\n },\n\n $between(a: any, range: [any, any]): boolean {\n if (a === undefined || a === null) return false;\n return (gtHelper(a, range[0], true) && ltHelper(a, range[1], true));\n },\n\n $in(a: any, b: any): boolean {\n return b.indexOf(a) !== -1;\n },\n\n $nin(a: any, b: any): boolean {\n return b.indexOf(a) === -1;\n },\n\n $keyin(a: string, b: object): boolean {\n return a in b;\n },\n\n $nkeyin(a: string, b: object): boolean {\n return !(a in b);\n },\n\n $definedin(a: string, b: object): boolean {\n return b[a] !== undefined;\n },\n\n $undefinedin(a: string, b: object): boolean {\n return b[a] === undefined;\n },\n\n $regex(a: string, b: RegExp): boolean {\n return b.test(a);\n },\n\n $containsString(a: any, b: string): boolean {\n return (typeof a === \"string\") && (a.indexOf(b) !== -1);\n },\n\n $containsNone(a: any, b: any): boolean {\n return !LokiOps.$containsAny(a, b);\n },\n\n $containsAny(a: any, b: any): boolean {\n const checkFn = containsCheckFn(a);\n if (checkFn !== null) {\n return (Array.isArray(b)) ? (b.some(checkFn)) : (checkFn(b));\n }\n return false;\n },\n\n $contains(a: any, b: any): boolean {\n const checkFn = containsCheckFn(a);\n if (checkFn !== null) {\n return (Array.isArray(b)) ? (b.every(checkFn)) : (checkFn(b));\n }\n return false;\n },\n\n $type(a: any, b: any): boolean {\n let type: string = typeof a;\n if (type === \"object\") {\n if (Array.isArray(a)) {\n type = \"array\";\n } else if (a instanceof Date) {\n type = \"date\";\n }\n }\n return (typeof b !== \"object\") ? (type === b) : doQueryOp(type, b);\n },\n\n $finite(a: number, b: boolean): boolean {\n return (b === isFinite(a));\n },\n\n $size(a: any, b: any): boolean {\n if (Array.isArray(a)) {\n return (typeof b !== \"object\") ? (a.length === b) : doQueryOp(a.length, b);\n }\n return false;\n },\n\n $len(a: any, b: any): boolean {\n if (typeof a === \"string\") {\n return (typeof b !== \"object\") ? (a.length === b) : doQueryOp(a.length, b);\n }\n return false;\n },\n\n $where(a: any, b: any): boolean {\n return b(a) === true;\n },\n\n // field-level logical operators\n // a is the value in the _collection\n // b is the nested query operation (for '$not')\n // or an array of nested query operations (for '$and' and '$or')\n $not(a: any, b: any): boolean {\n return !doQueryOp(a, b);\n },\n\n $and(a: any, b: any): boolean {\n for (let idx = 0, len = b.length; idx < len; idx++) {\n if (!doQueryOp(a, b[idx])) {\n return false;\n }\n }\n return true;\n },\n\n $or(a: any, b: any): boolean {\n for (let idx = 0, len = b.length; idx < len; idx++) {\n if (doQueryOp(a, b[idx])) {\n return true;\n }\n }\n return false;\n }\n};\n\n// if an op is registered in this object, our 'calculateRange' can use it with our binary indices.\n// if the op is registered to a function, we will run that function/op as a 2nd pass filter on results.\n// those 2nd pass filter functions should be similar to LokiOps functions, accepting 2 vals to compare.\nconst indexedOps = {\n $eq: LokiOps.$eq,\n $aeq: true,\n $dteq: true,\n $gt: true,\n $gte: true,\n $lt: true,\n $lte: true,\n $in: true,\n $between: true\n};\n\n/**\n * dotSubScan - helper function used for dot notation queries.\n *\n * @param {object} root - object to traverse\n * @param {array} paths - array of properties to drill into\n * @param {function} fun - evaluation function to test with\n * @param {any} value - comparative value to also pass to (compare) fun\n * @param {number} pathOffset - index of the item in 'paths' to start the sub-scan from\n */\nfunction dotSubScan(root: object, paths: string[], fun: (a: any, b: any) => boolean, value: any, pathOffset = 0) {\n const path = paths[pathOffset];\n if (root === undefined || root === null || root[path] === undefined) {\n return false;\n }\n\n let valueFound = false;\n const element = root[path];\n if (pathOffset + 1 >= paths.length) {\n // if we have already expanded out the dot notation,\n // then just evaluate the test function and value on the element\n valueFound = fun(element, value);\n } else if (Array.isArray(element)) {\n for (let index = 0, len = element.length; index < len; index++) {\n valueFound = dotSubScan(element[index], paths, fun, value, pathOffset + 1);\n if (valueFound === true) {\n break;\n }\n }\n } else {\n valueFound = dotSubScan(element, paths, fun, value, pathOffset + 1);\n }\n\n return valueFound;\n}\n\n/**\n * ResultSet class allowing chainable queries. Intended to be instanced internally.\n * Collection.find(), Collection.where(), and Collection.chain() instantiate this.\n *\n * @example\n * mycollection.chain()\n * .find({ 'doors' : 4 })\n * .where(function(obj) { return obj.name === 'Toyota' })\n * .data();\n *\n * @param - the data type\n * @param - nested properties of data type\n */\nexport class ResultSet {\n\n public _collection: Collection;\n public _filteredRows: number[];\n public _filterInitialized: boolean;\n // Holds the scoring result of the last full-text search.\n private _scoring: Scorer.ScoreResult;\n\n /**\n * Constructor.\n * @param {Collection} collection - the collection which this ResultSet will query against\n */\n constructor(collection: Collection) {\n // retain reference to collection we are querying against\n this._collection = collection;\n this._filteredRows = [];\n this._filterInitialized = false;\n this._scoring = null;\n }\n\n /**\n * reset() - Reset the ResultSet to its initial state.\n *\n * @returns {ResultSet} Reference to this ResultSet, for future chain operations.\n */\n reset(): this {\n if (this._filteredRows.length > 0) {\n this._filteredRows = [];\n }\n this._filterInitialized = false;\n return this;\n }\n\n /**\n * Override of toJSON to avoid circular references\n *\n */\n public toJSON(): ResultSet {\n const copy = this.copy();\n copy._collection = null;\n return copy;\n }\n\n /**\n * Allows you to limit the number of documents passed to next chain operation.\n * A ResultSet copy() is made to avoid altering original ResultSet.\n *\n * @param {int} qty - The number of documents to return.\n * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops.\n */\n public limit(qty: number): this {\n // if this has no filters applied, we need to populate filteredRows first\n if (!this._filterInitialized && this._filteredRows.length === 0) {\n this._filteredRows = this._collection._prepareFullDocIndex();\n }\n\n this._filteredRows = this._filteredRows.slice(0, qty);\n this._filterInitialized = true;\n return this;\n }\n\n /**\n * Used for skipping 'pos' number of documents in the ResultSet.\n *\n * @param {int} pos - Number of documents to skip; all preceding documents are filtered out.\n * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops.\n */\n public offset(pos: number): this {\n // if this has no filters applied, we need to populate filteredRows first\n if (!this._filterInitialized && this._filteredRows.length === 0) {\n this._filteredRows = this._collection._prepareFullDocIndex();\n }\n\n this._filteredRows = this._filteredRows.slice(pos);\n this._filterInitialized = true;\n return this;\n }\n\n /**\n * copy() - To support reuse of ResultSet in branched query situations.\n *\n * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same.\n */\n public copy(): ResultSet {\n const result = new ResultSet(this._collection);\n result._filteredRows = this._filteredRows.slice();\n result._filterInitialized = this._filterInitialized;\n return result;\n }\n\n /**\n * Alias of copy()\n */\n public branch(): ResultSet {\n return this.copy();\n }\n\n /**\n * Executes a named collection transform or raw array of transform steps against the ResultSet.\n *\n * @param {(string|array)} transform - name of collection transform or raw transform array\n * @param {object} [parameters=] - object property hash of parameters, if the transform requires them.\n * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps)\n */\n public transform(transform: string | Collection.Transform[], parameters?: object): this {\n // if transform is name, then do lookup first\n if (typeof transform === \"string\") {\n transform = this._collection.transforms[transform];\n }\n\n if (parameters !== undefined) {\n transform = resolveTransformParams(transform, parameters);\n }\n\n let rs = this;\n for (let idx = 0; idx < transform.length; idx++) {\n const step = transform[idx];\n\n switch (step.type) {\n case \"find\":\n rs.find(step.value as ResultSet.Query & TNested>);\n break;\n case \"where\":\n rs.where(step.value as (obj: Doc) => boolean);\n break;\n case \"simplesort\":\n rs.simplesort(step.property, step.desc);\n break;\n case \"compoundsort\":\n rs.compoundsort(step.value);\n break;\n case \"sort\":\n rs.sort(step.value);\n break;\n case \"sortByScoring\":\n rs.sortByScoring(step.desc);\n break;\n case \"limit\":\n rs = rs.limit(step.value);\n break; // limit makes copy so update reference\n case \"offset\":\n rs = rs.offset(step.value);\n break; // offset makes copy so update reference\n case \"map\":\n rs = rs.map(step.value, step.dataOptions) as any as this;\n break;\n case \"eqJoin\":\n rs = rs.eqJoin(step.joinData, step.leftJoinKey, step.rightJoinKey, step.mapFun, step.dataOptions) as this;\n break;\n // following cases break chain by returning array data so make any of these last in transform steps\n case \"mapReduce\":\n rs = rs.mapReduce(step.mapFunction, step.reduceFunction);\n break;\n // following cases update documents in current filtered ResultSet (use carefully)\n case \"update\":\n rs.update(step.value);\n break;\n case \"remove\":\n rs.remove();\n break;\n default:\n break;\n }\n }\n return rs;\n }\n\n /**\n * User supplied compare function is provided two documents to compare. (chainable)\n * @example\n * rslt.sort(function(obj1, obj2) {\n\t * if (obj1.name === obj2.name) return 0;\n\t * if (obj1.name > obj2.name) return 1;\n\t * if (obj1.name < obj2.name) return -1;\n\t * });\n *\n * @param {function} comparefun - A javascript compare function used for sorting.\n * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations.\n */\n public sort(comparefun: (a: Doc, b: Doc) => number): this {\n // if this has no filters applied, just we need to populate filteredRows first\n if (!this._filterInitialized && this._filteredRows.length === 0) {\n this._filteredRows = this._collection._prepareFullDocIndex();\n }\n\n const data = this._collection._data;\n const wrappedComparer = (a: number, b: number) => comparefun(data[a], data[b]);\n\n this._filteredRows.sort(wrappedComparer);\n\n return this;\n }\n\n /**\n * Simpler, loose evaluation for user to sort based on a property name. (chainable).\n * Sorting based on the same lt/gt helper functions used for binary indices.\n *\n * @param {string} propname - name of property to sort by.\n * @param {boolean} [descending=false] - if true, the property will be sorted in descending order\n * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations.\n */\n public simplesort(propname: keyof (TData & TNested), descending: boolean = false): this {\n // if this has no filters applied, just we need to populate filteredRows first\n if (!this._filterInitialized && this._filteredRows.length === 0) {\n //TODO:\n // if we have a binary index and no other filters applied, we can use that instead of sorting (again)\n if (this._collection.binaryIndices[propname as keyof TData] !== undefined) {\n // make sure index is up-to-date\n this._collection.ensureIndex(propname as keyof TData);\n // copy index values into filteredRows\n this._filteredRows = this._collection.binaryIndices[propname as keyof TData].values.slice(0);\n\n if (descending) {\n this._filteredRows.reverse();\n }\n\n // we are done, return this (ResultSet) for further chain ops\n return this;\n }\n // otherwise initialize array for sort below\n else {\n this._filteredRows = this._collection._prepareFullDocIndex();\n }\n }\n\n const data = this._collection._data;\n const wrappedComparer = (a: number, b: number) => {\n let val1, val2;\n if (~propname.indexOf(\".\")) {\n const arr = propname.split(\".\");\n val1 = arr.reduce(function (obj, i) {\n return obj && obj[i] || undefined;\n }, data[a]);\n val2 = arr.reduce(function (obj, i) {\n return obj && obj[i] || undefined;\n }, data[b]);\n } else {\n val1 = data[a][propname as keyof TData];\n val2 = data[b][propname as keyof TData];\n }\n return sortHelper(val1, val2, descending);\n };\n\n this._filteredRows.sort(wrappedComparer);\n\n return this;\n }\n\n /**\n * Allows sorting a ResultSet based on multiple columns.\n * @example\n * // to sort by age and then name (both ascending)\n * rs.compoundsort(['age', 'name']);\n * // to sort by age (ascending) and then by name (descending)\n * rs.compoundsort(['age', ['name', true]);\n *\n * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order\n * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations.\n */\n public compoundsort(properties: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this {\n if (properties.length === 0) {\n throw new Error(\"Invalid call to compoundsort, need at least one property\");\n }\n\n if (properties.length === 1) {\n const prop = properties[0];\n if (typeof prop === \"string\") {\n return this.simplesort(prop, false);\n } else {\n return this.simplesort(prop[0] as keyof (TData & TNested), prop[1] as boolean);\n }\n }\n\n // unify the structure of 'properties' to avoid checking it repeatedly while sorting\n for (let i = 0, len = properties.length; i < len; i++) {\n const prop = properties[i];\n if (typeof prop === \"string\") {\n properties[i] = [prop, false];\n }\n }\n\n // if this has no filters applied, just we need to populate filteredRows first\n if (!this._filterInitialized && this._filteredRows.length === 0) {\n this._filteredRows = this._collection._prepareFullDocIndex();\n }\n\n const data = this._collection._data;\n const wrappedComparer = (a: number, b: number) => this._compoundeval(properties as [string, boolean][], data[a], data[b]);\n\n this._filteredRows.sort(wrappedComparer);\n\n return this;\n }\n\n /**\n * Helper function for compoundsort(), performing individual object comparisons\n *\n * @param {Array} properties - array of property names, in order, by which to evaluate sort order\n * @param {object} obj1 - first object to compare\n * @param {object} obj2 - second object to compare\n * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first\n */\n private _compoundeval(properties: [string, boolean][], obj1: TData, obj2: TData): number {\n for (let i = 0, len = properties.length; i < len; i++) {\n const prop = properties[i];\n const field = prop[0];\n let val1, val2, arr;\n if (~field.indexOf(\".\")) {\n arr = field.split(\".\");\n val1 = arr.reduce((obj: object, i: string) => {\n return obj && obj[i] || undefined;\n }, obj1);\n val2 = arr.reduce((obj: object, i: string) => {\n return obj && obj[i] || undefined;\n }, obj2);\n } else {\n val1 = obj1[field];\n val2 = obj2[field];\n }\n const res = sortHelper(val1, val2, prop[1]);\n if (res !== 0) {\n return res;\n }\n }\n return 0;\n }\n\n /**\n * Sorts the ResultSet based on the last full-text-search scoring.\n * @param {boolean} [ascending=false] - sort ascending\n * @returns {ResultSet}\n */\n public sortByScoring(ascending = false): this {\n if (this._scoring === null) {\n throw new Error(\"No scoring available\");\n }\n\n if (ascending) {\n this._filteredRows.sort((a: number, b: number) => this._scoring[a].score - this._scoring[b].score);\n } else {\n this._filteredRows.sort((a: number, b: number) => this._scoring[b].score - this._scoring[a].score);\n }\n\n return this;\n }\n\n /**\n * Returns the scoring of the last full-text-search.\n * @returns {ScoreResult}\n */\n public getScoring(): Scorer.ScoreResult {\n if (this._scoring === null) {\n throw new Error(\"No scoring available\");\n }\n return this._scoring;\n }\n\n /**\n * Oversee the operation of OR'ed query expressions.\n * OR'ed expression evaluation runs each expression individually against the full collection,\n * and finally does a set OR on each expression's results.\n * Each evaluation can utilize a binary index to prevent multiple linear array scans.\n *\n * @param {array} expressionArray - array of expressions\n * @returns {ResultSet} this ResultSet for further chain ops.\n */\n public findOr(expressionArray: ResultSet.Query & TNested>[]): this {\n const docset = [];\n const idxset = [];\n const origCount = this.count();\n\n // If filter is already initialized, then we query against only those items already in filter.\n // This means no index utilization for fields, so hopefully its filtered to a smallish filteredRows.\n for (let ei = 0, elen = expressionArray.length; ei < elen; ei++) {\n // we need to branch existing query to run each filter separately and combine results\n const fr = this.branch().find(expressionArray[ei])._filteredRows;\n const frlen = fr.length;\n // if the find operation did not reduce the initial set, then the initial set is the actual result\n if (frlen === origCount) {\n return this;\n }\n\n // add any document 'hits'\n for (let fri = 0; fri < frlen; fri++) {\n const idx = fr[fri];\n if (idxset[idx] === undefined) {\n idxset[idx] = true;\n docset.push(idx);\n }\n }\n }\n\n this._filteredRows = docset;\n this._filterInitialized = true;\n\n return this;\n }\n\n public $or(expressionArray: ResultSet.Query & TNested>[]): this {\n return this.findOr(expressionArray);\n }\n\n /**\n * Oversee the operation of AND'ed query expressions.\n * AND'ed expression evaluation runs each expression progressively against the full collection,\n * internally utilizing existing chained ResultSet functionality.\n * Only the first filter can utilize a binary index.\n *\n * @param {array} expressionArray - array of expressions\n * @returns {ResultSet} this ResultSet for further chain ops.\n */\n public findAnd(expressionArray: ResultSet.Query & TNested>[]): this {\n // we have already implementing method chaining in this (our ResultSet class)\n // so lets just progressively apply user supplied and filters\n for (let i = 0, len = expressionArray.length; i < len; i++) {\n if (this.count() === 0) {\n return this;\n }\n this.find(expressionArray[i]);\n }\n return this;\n }\n\n public $and(expressionArray: ResultSet.Query & TNested>[]): this {\n return this.findAnd(expressionArray);\n }\n\n /**\n * Used for querying via a mongo-style query object.\n *\n * @param {object} query - A mongo-style query object used for filtering current results.\n * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne()\n * @returns {ResultSet} this ResultSet for further chain ops.\n */\n public find(query?: ResultSet.Query & TNested>, firstOnly = false): this {\n if (this._collection._data.length === 0) {\n this._filteredRows = [];\n this._filterInitialized = true;\n return this;\n }\n\n const queryObject = query || \"getAll\";\n let property: any;\n let queryObjectOp: any;\n let value: any;\n\n if (typeof queryObject === \"object\") {\n let filters = [];\n for (let p in queryObject) {\n let obj = {};\n obj[p as any] = queryObject[p];\n filters.push(obj);\n\n if (queryObject[p] !== undefined) {\n property = p;\n queryObjectOp = queryObject[p];\n }\n }\n // if more than one expression in single query object,\n // convert implicit $and to explicit $and\n if (filters.length > 1) {\n return this.find({\"$and\": filters} as any, firstOnly);\n }\n }\n\n // apply no filters if they want all\n if (!property || queryObject === \"getAll\") {\n if (firstOnly) {\n this._filteredRows = (this._collection._data.length > 0) ? [0] : [];\n this._filterInitialized = true;\n }\n return this;\n }\n\n // injecting $and and $or expression tree evaluation here.\n if (property === \"$and\" || property === \"$or\") {\n this[property](queryObjectOp);\n\n // for chained find with firstOnly,\n if (firstOnly && this._filteredRows.length > 1) {\n this._filteredRows = this._filteredRows.slice(0, 1);\n }\n\n return this;\n }\n\n // see if query object is in shorthand mode (assuming eq operator)\n let operator;\n if (queryObjectOp === null || (typeof queryObjectOp !== \"object\" || queryObjectOp instanceof Date)) {\n operator = \"$eq\";\n value = queryObjectOp;\n } else if (typeof queryObjectOp === \"object\") {\n for (let key in queryObjectOp) {\n if (queryObjectOp[key] !== undefined) {\n operator = key;\n value = queryObjectOp[key];\n break;\n }\n }\n } else {\n throw new Error(\"Do not know what you want to do.\");\n }\n\n // for regex ops, precompile\n if (operator === \"$regex\") {\n if (Array.isArray(value)) {\n value = new RegExp(value[0], value[1]);\n } else if (!(value instanceof RegExp)) {\n value = new RegExp(value as any);\n }\n }\n\n // if user is deep querying the object such as find('name.first': 'odin')\n const usingDotNotation = (property.indexOf(\".\") !== -1);\n\n // if an index exists for the property being queried against, use it\n // for now only enabling where it is the first filter applied and prop is indexed\n const doIndexCheck = !usingDotNotation && !this._filterInitialized;\n\n let searchByIndex = false;\n if (doIndexCheck && this._collection.binaryIndices[property] && indexedOps[operator]) {\n // this is where our lazy index rebuilding will take place\n // basically we will leave all indexes dirty until we need them\n // so here we will rebuild only the index tied to this property\n // ensureIndex() will only rebuild if flagged as dirty since we are not passing force=true param\n if (this._collection.adaptiveBinaryIndices !== true) {\n this._collection.ensureIndex(property);\n }\n searchByIndex = true;\n }\n\n // the comparison function\n const fun = LokiOps[operator];\n\n // \"shortcut\" for collection data\n const data = this._collection._data;\n\n // Query executed differently depending on :\n // - whether the property being queried has an index defined\n // - if chained, we handle first pass differently for initial filteredRows[] population\n //\n // For performance reasons, each case has its own if block to minimize in-loop calculations\n\n let result: number[] = [];\n // If the filteredRows[] is already initialized, use it\n if (this._filterInitialized) {\n let filter = this._filteredRows;\n\n // currently supporting dot notation for non-indexed conditions only\n if (usingDotNotation) {\n property = property.split(\".\");\n for (let i = 0; i < filter.length; i++) {\n let rowIdx = filter[i];\n if (dotSubScan(data[rowIdx], property, fun, value)) {\n result.push(rowIdx);\n }\n }\n } else if (property === \"$fts\") {\n this._scoring = this._collection._fullTextSearch.search(query.$fts as FullTextSearchQuery);\n let keys = Object.keys(this._scoring);\n for (let i = 0; i < keys.length; i++) {\n if (filter.indexOf(+keys[i]) !== -1) {\n result.push(+keys[i]);\n }\n }\n } else if (this._collection.constraints.unique[property] !== undefined && operator === \"$eq\") {\n // Use unique constraint for search.\n let row = this._collection.constraints.unique[property].get(value);\n if (filter.indexOf(row) !== -1) {\n result.push(row);\n }\n } else {\n for (let i = 0; i < filter.length; i++) {\n let rowIdx = filter[i];\n if (fun(data[rowIdx][property], value)) {\n result.push(rowIdx);\n }\n }\n }\n\n this._filteredRows = result;\n this._filterInitialized = true; // next time work against filteredRows[]\n return this;\n }\n\n this._filteredRows = result;\n this._filterInitialized = true; // next time work against filteredRows[]\n\n if (property === \"$fts\") {\n this._scoring = this._collection._fullTextSearch.search(query.$fts as FullTextSearchQuery);\n let keys = Object.keys(this._scoring);\n for (let i = 0; i < keys.length; i++) {\n result.push(+keys[i]);\n }\n return this;\n }\n\n // Use unique constraint for search.\n if (this._collection.constraints.unique[property] !== undefined && operator === \"$eq\") {\n result.push(this._collection.constraints.unique[property].get(value));\n return this;\n }\n\n // first chained query so work against data[] but put results in filteredRows\n // if not searching by index\n if (!searchByIndex) {\n if (usingDotNotation) {\n property = property.split(\".\");\n for (let i = 0; i < data.length; i++) {\n if (dotSubScan(data[i], property, fun, value)) {\n result.push(i);\n if (firstOnly) {\n return this;\n }\n }\n }\n } else {\n for (let i = 0; i < data.length; i++) {\n if (fun(data[i][property], value)) {\n result.push(i);\n if (firstOnly) {\n return this;\n }\n }\n }\n }\n return this;\n }\n\n let index = this._collection.binaryIndices[property];\n if (operator !== \"$in\") {\n // search by index\n const segm = this._collection.calculateRange(operator, property, value);\n for (let i = segm[0]; i <= segm[1]; i++) {\n if (indexedOps[operator] !== true) {\n // must be a function, implying 2nd phase filtering of results from calculateRange\n if (indexedOps[operator](data[index.values[i]][property], value)) {\n result.push(index.values[i]);\n if (firstOnly) {\n return this;\n }\n }\n } else {\n result.push(index.values[i]);\n if (firstOnly) {\n return this;\n }\n }\n }\n } else {\n const idxset = [];\n // query each value '$eq' operator and merge the segment results.\n for (let j = 0, len = value.length; j < len; j++) {\n const segm = this._collection.calculateRange(\"$eq\", property, value[j]);\n for (let i = segm[0]; i <= segm[1]; i++) {\n if (idxset[i] === undefined) {\n idxset[i] = true;\n result.push(index.values[i]);\n }\n if (firstOnly) {\n return this;\n }\n }\n }\n }\n return this;\n }\n\n\n /**\n * Used for filtering via a javascript filter function.\n *\n * @param {function} fun - A javascript function used for filtering current results by.\n * @returns {ResultSet} this ResultSet for further chain ops.\n */\n public where(fun: (obj: Doc) => boolean): this {\n let viewFunction;\n let result = [];\n\n if (\"function\" === typeof fun) {\n viewFunction = fun;\n } else {\n throw new TypeError(\"Argument is not a stored view or a function\");\n }\n try {\n // If the filteredRows[] is already initialized, use it\n if (this._filterInitialized) {\n let j = this._filteredRows.length;\n\n while (j--) {\n if (viewFunction(this._collection._data[this._filteredRows[j]]) === true) {\n result.push(this._filteredRows[j]);\n }\n }\n\n this._filteredRows = result;\n\n return this;\n }\n // otherwise this is initial chained op, work against data, push into filteredRows[]\n else {\n let k = this._collection._data.length;\n\n while (k--) {\n if (viewFunction(this._collection._data[k]) === true) {\n result.push(k);\n }\n }\n\n this._filteredRows = result;\n this._filterInitialized = true;\n\n return this;\n }\n } catch (err) {\n throw err;\n }\n }\n\n /**\n * Returns the number of documents in the ResultSet.\n * @returns {number} The number of documents in the ResultSet.\n */\n public count(): number {\n if (this._filterInitialized) {\n return this._filteredRows.length;\n }\n return this._collection.count();\n }\n\n /**\n * Terminates the chain and returns array of filtered documents\n * @param {object} options\n * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when\n * the collection is not configured for clone object.\n * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method.\n * Possible values 'parse-stringify', 'deep', and 'shallow' and\n * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents\n *\n * @returns {Array} Array of documents in the ResultSet\n */\n public data(options: ResultSet.DataOptions = {}): Doc[] {\n let forceClones: boolean;\n let forceCloneMethod: CloneMethod;\n let removeMeta: boolean;\n (\n {\n forceClones,\n forceCloneMethod = this._collection.cloneMethod,\n removeMeta = false\n } = options\n );\n\n let result = [];\n let data = this._collection._data;\n let obj;\n let len;\n let i;\n let method: CloneMethod;\n\n // if user opts to strip meta, then force clones and use 'shallow' if 'force' options are not present\n if (removeMeta && !forceClones) {\n forceClones = true;\n forceCloneMethod = \"shallow\";\n }\n\n // if collection has delta changes active, then force clones and use CloneMethod.DEEP for effective change tracking of nested objects\n if (!this._collection.disableDeltaChangesApi) {\n forceClones = true;\n forceCloneMethod = \"deep\";\n }\n\n // if this has no filters applied, just return collection.data\n if (!this._filterInitialized) {\n if (this._filteredRows.length === 0) {\n // determine whether we need to clone objects or not\n if (this._collection.cloneObjects || forceClones) {\n len = data.length;\n method = forceCloneMethod;\n\n for (i = 0; i < len; i++) {\n obj = clone(data[i], method);\n if (removeMeta) {\n delete obj.$loki;\n delete obj.meta;\n }\n result.push(obj);\n }\n return result;\n }\n // otherwise we are not cloning so return sliced array with same object references\n else {\n return data.slice();\n }\n } else {\n // filteredRows must have been set manually, so use it\n this._filterInitialized = true;\n }\n }\n\n const fr = this._filteredRows;\n len = fr.length;\n\n if (this._collection.cloneObjects || forceClones) {\n method = forceCloneMethod;\n for (i = 0; i < len; i++) {\n obj = clone(data[fr[i]], method);\n if (removeMeta) {\n delete obj.$loki;\n delete obj.meta;\n }\n result.push(obj);\n }\n } else {\n for (i = 0; i < len; i++) {\n result.push(data[fr[i]]);\n }\n }\n return result;\n }\n\n /**\n * Used to run an update operation on all documents currently in the ResultSet.\n *\n * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object.\n * @returns {ResultSet} this ResultSet for further chain ops.\n */\n update(updateFunction: (obj: Doc) => TData): this {\n // if this has no filters applied, we need to populate filteredRows first\n if (!this._filterInitialized && this._filteredRows.length === 0) {\n this._filteredRows = this._collection._prepareFullDocIndex();\n }\n\n const len = this._filteredRows.length;\n const rcd = this._collection._data;\n\n for (let idx = 0; idx < len; idx++) {\n // pass in each document object currently in ResultSet to user supplied updateFunction\n updateFunction(rcd[this._filteredRows[idx]]);\n\n // notify collection we have changed this object so it can update meta and allow DynamicViews to re-evaluate\n this._collection.update(rcd[this._filteredRows[idx]]);\n }\n\n return this;\n }\n\n /**\n * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet)\n *\n * @returns {ResultSet} this (empty) ResultSet for further chain ops.\n */\n public remove(): this {\n // if this has no filters applied, we need to populate filteredRows first\n if (!this._filterInitialized && this._filteredRows.length === 0) {\n this._filteredRows = this._collection._prepareFullDocIndex();\n }\n this._collection.remove(this.data());\n this._filteredRows = [];\n return this;\n }\n\n /**\n * data transformation via user supplied functions\n *\n * @param {function} mapFunction - this function accepts a single document for you to transform and return\n * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value\n * @returns {value} The output of your reduceFunction\n */\n public mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U {\n try {\n return reduceFunction(this.data().map(mapFunction));\n } catch (err) {\n throw err;\n }\n }\n\n /**\n * Left joining two sets of data. Join keys can be defined or calculated properties\n * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key\n * @param {Array|ResultSet|Collection} joinData - Data array to join to.\n * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on\n * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on\n * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject}\n * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides\n * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun\n * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object\n * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method\n * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}]\n */\n public eqJoin(joinData: Collection | ResultSet | any[], leftJoinKey: string | ((obj: any) => string),\n rightJoinKey: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any,\n dataOptions?: ResultSet.DataOptions): ResultSet {\n let rightData = [];\n let rightDataLength;\n let key;\n let result = [];\n let leftKeyisFunction = typeof leftJoinKey === \"function\";\n let rightKeyisFunction = typeof rightJoinKey === \"function\";\n let joinMap = {};\n\n //get the left data\n let leftData = this.data(dataOptions);\n let leftDataLength = leftData.length;\n\n //get the right data\n if (joinData instanceof Collection) {\n rightData = joinData.chain().data(dataOptions);\n } else if (joinData instanceof ResultSet) {\n rightData = joinData.data(dataOptions);\n } else if (Array.isArray(joinData)) {\n rightData = joinData;\n } else {\n throw new TypeError(\"joinData needs to be an array or result set\");\n }\n rightDataLength = rightData.length;\n\n //construct a lookup table\n for (let i = 0; i < rightDataLength; i++) {\n key = rightKeyisFunction\n ? (rightJoinKey as (obj: any) => string)(rightData[i])\n : rightData[i][rightJoinKey as string];\n joinMap[key] = rightData[i];\n }\n\n if (!mapFun) {\n mapFun = (left: any, right: any) => ({\n left,\n right\n });\n }\n\n //Run map function over each object in the ResultSet\n for (let j = 0; j < leftDataLength; j++) {\n key = leftKeyisFunction\n ? (leftJoinKey as (obj: any) => string)(leftData[j])\n : leftData[j][leftJoinKey as string];\n result.push(mapFun(leftData[j], joinMap[key] || {}));\n }\n\n //return a new ResultSet with no filters\n this._collection = new Collection(\"joinData\");\n this._collection.insert(result);\n this._filteredRows = [];\n this._filterInitialized = false;\n\n return this;\n }\n\n /**\n * Applies a map function into a new collection for further chaining.\n * @param {function} mapFun - javascript map function\n * @param {object} [dataOptions=] - options to data() before input to your map function\n * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun\n * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object\n * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method\n * @return {ResultSet}\n */\n map(mapFun: (obj: TData, index: number, array: TData[]) => U, dataOptions?: ResultSet.DataOptions): ResultSet {\n const data = this.data(dataOptions).map(mapFun);\n //return return a new ResultSet with no filters\n this._collection = new Collection(\"mappedData\");\n this._collection.insert(data as any as TData);\n this._filteredRows = [];\n this._filterInitialized = false;\n return this as any as ResultSet;\n }\n}\n\nexport namespace ResultSet {\n export interface DataOptions {\n forceClones?: boolean;\n forceCloneMethod?: CloneMethod;\n removeMeta?: boolean;\n }\n\n export type LokiOps = {\n $eq?: R;\n $aeq?: R;\n $ne?: R;\n $dteq?: R;\n $gt?: R;\n $gte?: R;\n $lt?: R;\n $lte?: R;\n $between?: [R, R];\n $in?: R[];\n $nin?: R[];\n $keyin?: object;\n $nkeyin?: object;\n $definedin?: object;\n $undefinedin?: object;\n $regex?: RegExp | string | [string, string] // string and [string, string] are better for serialization\n $containsString?: string;\n $containsNone?: R[] | R; // Only R if string.\n $containsAny?: R[] | R; // Only R if string.\n $contains?: any; // ? R without array!\n $type?: string;\n $finite?: boolean;\n $size?: number;\n $len?: number;\n $where?: (val?: R) => boolean;\n };\n\n export type Query =\n { [P in keyof TData]?: LokiOps | TData[P] }\n & { $and?: Query[] }\n & { $or?: Query[] }\n & { $fts?: FullTextSearchQuery };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/result_set.ts","export type CloneMethod = \"parse-stringify\" | \"deep\" | \"shallow\" | \"shallow-recurse-objects\";\n\nfunction add(copy: any, key: any, value: any) {\n if (copy instanceof Array) {\n copy.push(value);\n return copy[copy.length - 1];\n }\n else if (copy instanceof Object) {\n copy[key] = value;\n return copy[key];\n }\n}\n\nfunction walk(target: any, copy: any) {\n for (let key in target) {\n let obj = target[key];\n if (obj instanceof Date) {\n let value = new Date(obj.getTime());\n add(copy, key, value);\n }\n else if (obj instanceof Function) {\n let value = obj;\n add(copy, key, value);\n }\n else if (obj instanceof Array) {\n let value: any[] = [];\n let last = add(copy, key, value);\n walk(obj, last);\n }\n else if (obj instanceof Object) {\n let value = {};\n let last = add(copy, key, value);\n walk(obj, last);\n }\n else {\n let value = obj;\n add(copy, key, value);\n }\n }\n}\n\n// Deep copy from Simeon Velichkov.\n/**\n * @param target\n * @returns {any}\n */\nfunction deepCopy(target: any) {\n if (/number|string|boolean/.test(typeof target)) {\n return target;\n }\n if (target instanceof Date) {\n return new Date(target.getTime());\n }\n\n const copy = (target instanceof Array) ? [] : {};\n walk(target, copy);\n return copy;\n}\n\n/**\n * @hidden\n */\nexport function clone(data: T, method: CloneMethod = \"parse-stringify\"): T {\n if (data === null || data === undefined) {\n return null;\n }\n\n let cloned: any;\n\n switch (method) {\n case \"parse-stringify\":\n cloned = JSON.parse(JSON.stringify(data));\n break;\n case \"deep\":\n cloned = deepCopy(data);\n break;\n case \"shallow\":\n cloned = Object.create(data.constructor.prototype);\n Object.assign(cloned, data);\n break;\n case \"shallow-recurse-objects\":\n // shallow clone top level properties\n cloned = clone(data, \"shallow\");\n const keys = Object.keys(data);\n // for each of the top level properties which are object literals, recursively shallow copy\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (typeof data[key] === \"object\" && data[key].constructor.name === \"Object\") {\n cloned[key] = clone(data[key], \"shallow-recurse-objects\");\n }\n }\n break;\n default:\n break;\n }\n\n return cloned as any as T;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/clone.ts","/**\n * Helper function for determining 'loki' abstract equality which is a little more abstract than ==\n * aeqHelper(5, '5') === true\n * aeqHelper(5.0, '5') === true\n * aeqHelper(new Date(\"1/1/2011\"), new Date(\"1/1/2011\")) === true\n * aeqHelper({a:1}, {z:4}) === true (all objects sorted equally)\n * aeqHelper([1, 2, 3], [1, 3]) === false\n * aeqHelper([1, 2, 3], [1, 2, 3]) === true\n * aeqHelper(undefined, null) === true\n * @param {any} prop1\n * @param {any} prop2\n * @returns {boolean}\n * @hidden\n */\nexport function aeqHelper(prop1: any, prop2: any): boolean {\n if (prop1 === prop2) return true;\n\n // 'falsy' and Boolean handling\n if (!prop1 || !prop2 || prop1 === true || prop2 === true || prop1 !== prop1 || prop2 !== prop2) {\n let t1: number;\n let t2: number;\n\n // dates and NaN conditions (typed dates before serialization)\n switch (prop1) {\n case undefined:\n t1 = 1;\n break;\n case null:\n t1 = 1;\n break;\n case false:\n t1 = 3;\n break;\n case true:\n t1 = 4;\n break;\n case \"\":\n t1 = 5;\n break;\n default:\n t1 = (prop1 === prop1) ? 9 : 0;\n break;\n }\n\n switch (prop2) {\n case undefined:\n t2 = 1;\n break;\n case null:\n t2 = 1;\n break;\n case false:\n t2 = 3;\n break;\n case true:\n t2 = 4;\n break;\n case \"\":\n t2 = 5;\n break;\n default:\n t2 = (prop2 === prop2) ? 9 : 0;\n break;\n }\n\n // one or both is edge case\n if (t1 !== 9 || t2 !== 9) {\n return (t1 === t2);\n }\n }\n\n // Handle 'Number-like' comparisons\n let cv1 = Number(prop1);\n let cv2 = Number(prop2);\n\n // if one or both are 'number-like'...\n if (cv1 === cv1 || cv2 === cv2) {\n return (cv1 === cv2);\n }\n\n // not strict equal nor less than nor gt so must be mixed types, convert to string and use that to compare\n cv1 = prop1.toString();\n cv2 = prop2.toString();\n\n return (cv1 == cv2);\n}\n\n/**\n * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices.\n * In the future we might want $lt and $gt ops to use their own functionality/helper.\n * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we\n * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another.\n * @hidden\n */\nexport function ltHelper(prop1: any, prop2: any, equal: boolean): boolean {\n // if one of the params is falsy or strictly true or not equal to itself\n // 0, 0.0, \"\", NaN, null, undefined, not defined, false, true\n if (!prop1 || !prop2 || prop1 === true || prop2 === true || prop1 !== prop1 || prop2 !== prop2) {\n let t1: number;\n let t2: number;\n\n switch (prop1) {\n case undefined:\n t1 = 1;\n break;\n case null:\n t1 = 1;\n break;\n case false:\n t1 = 3;\n break;\n case true:\n t1 = 4;\n break;\n case \"\":\n t1 = 5;\n break;\n // if strict equal probably 0 so sort higher, otherwise probably NaN so sort lower than even null\n default:\n t1 = (prop1 === prop1) ? 9 : 0;\n break;\n }\n\n switch (prop2) {\n case undefined:\n t2 = 1;\n break;\n case null:\n t2 = 1;\n break;\n case false:\n t2 = 3;\n break;\n case true:\n t2 = 4;\n break;\n case \"\":\n t2 = 5;\n break;\n default:\n t2 = (prop2 === prop2) ? 9 : 0;\n break;\n }\n\n // one or both is edge case\n if (t1 !== 9 || t2 !== 9) {\n return (t1 === t2) ? equal : (t1 < t2);\n }\n }\n\n // if both are numbers (string encoded or not), compare as numbers\n let cv1 = Number(prop1);\n let cv2 = Number(prop2);\n\n if (cv1 === cv1 && cv2 === cv2) {\n if (cv1 < cv2) return true;\n if (cv1 > cv2) return false;\n return equal;\n }\n\n if (cv1 === cv1 && cv2 !== cv2) {\n return true;\n }\n\n if (cv2 === cv2 && cv1 !== cv1) {\n return false;\n }\n\n if (prop1 < prop2) return true;\n if (prop1 > prop2) return false;\n if (prop1 == prop2) return equal;\n\n // not strict equal nor less than nor gt so must be mixed types, convert to string and use that to compare\n cv1 = prop1.toString();\n cv2 = prop2.toString();\n\n if (cv1 < cv2) {\n return true;\n }\n\n if (cv1 == cv2) {\n return equal;\n }\n\n return false;\n}\n\n/**\n * @hidden\n * @param {any} prop1\n * @param {any} prop2\n * @param {boolean} equal\n * @returns {boolean}\n */\nexport function gtHelper(prop1: any, prop2: any, equal: boolean): boolean {\n // 'falsy' and Boolean handling\n if (!prop1 || !prop2 || prop1 === true || prop2 === true || prop1 !== prop1 || prop2 !== prop2) {\n let t1: number;\n let t2: number;\n\n switch (prop1) {\n case undefined:\n t1 = 1;\n break;\n case null:\n t1 = 1;\n break;\n case false:\n t1 = 3;\n break;\n case true:\n t1 = 4;\n break;\n case \"\":\n t1 = 5;\n break;\n // NaN 0\n default:\n t1 = (prop1 === prop1) ? 9 : 0;\n break;\n }\n\n switch (prop2) {\n case undefined:\n t2 = 1;\n break;\n case null:\n t2 = 1;\n break;\n case false:\n t2 = 3;\n break;\n case true:\n t2 = 4;\n break;\n case \"\":\n t2 = 5;\n break;\n default:\n t2 = (prop2 === prop2) ? 9 : 0;\n break;\n }\n\n // one or both is edge case\n if (t1 !== 9 || t2 !== 9) {\n return (t1 === t2) ? equal : (t1 > t2);\n }\n }\n\n // if both are numbers (string encoded or not), compare as numbers\n let cv1 = Number(prop1);\n let cv2 = Number(prop2);\n if (cv1 === cv1 && cv2 === cv2) {\n if (cv1 > cv2) return true;\n if (cv1 < cv2) return false;\n return equal;\n }\n\n if (cv1 === cv1 && cv2 !== cv2) {\n return false;\n }\n\n if (cv2 === cv2 && cv1 !== cv1) {\n return true;\n }\n\n if (prop1 > prop2) return true;\n if (prop1 < prop2) return false;\n if (prop1 == prop2) return equal;\n\n // not strict equal nor less than nor gt so must be dates or mixed types\n // convert to string and use that to compare\n cv1 = prop1.toString();\n cv2 = prop2.toString();\n\n if (cv1 > cv2) {\n return true;\n }\n\n if (cv1 == cv2) {\n return equal;\n }\n\n return false;\n}\n\n/**\n * @param {any} prop1\n * @param {any} prop2\n * @param {boolean} descending\n * @returns {number}\n * @hidden\n */\nexport function sortHelper(prop1: any, prop2: any, descending: boolean): number {\n if (aeqHelper(prop1, prop2)) {\n return 0;\n }\n\n if (ltHelper(prop1, prop2, false)) {\n return descending ? 1 : -1;\n }\n\n if (gtHelper(prop1, prop2, false)) {\n return descending ? -1 : 1;\n }\n\n // not lt, not gt so implied equality-- date compatible\n return 0;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/helper.ts","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","import {Loki} from \"./loki\";\nimport {Collection} from \"./collection\";\n\nLoki[\"Collection\"] = Collection;\n\nexport {Loki, Collection};\nexport default Loki;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/index.ts","/* global global */\nimport {LokiEventEmitter} from \"./event_emitter\";\nimport {Collection} from \"./collection\";\nimport {Doc, StorageAdapter} from \"../../common/types\";\nimport {PLUGINS} from \"../../common/plugin\";\n\nfunction getENV(): Loki.Environment {\n if (global !== undefined && (global[\"android\"] || global[\"NSObject\"])) {\n return \"NATIVESCRIPT\";\n }\n\n const isNode = global !== undefined && ({}).toString.call(global) === \"[object global]\";\n if (isNode) {\n if (global[\"window\"]) {\n return \"NODEJS\"; //node-webkit\n } else {\n return \"NODEJS\";\n }\n }\n\n const isBrowser = window !== undefined && ({}).toString.call(window) === \"[object Window]\";\n if (document !== undefined) {\n if (document.URL.indexOf(\"http://\") === -1 && document.URL.indexOf(\"https://\") === -1) {\n return \"CORDOVA\";\n }\n return \"BROWSER\";\n }\n\n if (!isBrowser) {\n throw SyntaxError(\"Unknown environment...\");\n }\n}\n\nexport class Loki extends LokiEventEmitter {\n\n private filename: string;\n private databaseVersion: number;\n private engineVersion: number;\n\n private _collections: Collection[];\n private _verbose: boolean;\n\n private _env: Loki.Environment;\n\n private _serializationMethod: Loki.SerializationMethod;\n private _destructureDelimiter: string;\n private _persistenceMethod: Loki.PersistenceMethod;\n private _persistenceAdapter: StorageAdapter;\n\n private _throttledSaves: boolean;\n private _throttledSaveRunning: Promise;\n private _throttledSavePending: Promise;\n\n private _autosave: boolean;\n private _autosaveInterval: number;\n private _autosaveHandle: Function;\n\n\n /**\n * Constructs the main database class.\n * @param {string} filename - name of the file to be saved to\n * @param {object} [options={}] - options\n * @param {Loki.Environment} [options.env] - the javascript environment\n * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method\n * @param {string} [options.destructureDelimiter=\"$<\\n\"] - string delimiter used for destructured serialization\n * @param {boolean} [options.verbose=false] - enable console output\n */\n constructor(filename = \"loki.db\", options: Loki.Options = {}) {\n super();\n\n this.filename = filename;\n this._collections = [];\n\n (\n {\n serializationMethod: this._serializationMethod = \"normal\",\n destructureDelimiter: this._destructureDelimiter = \"$<\\n\",\n verbose: this._verbose = false,\n env: this._env = getENV()\n } = options\n );\n\n // persist version of code which created the database to the database.\n // could use for upgrade scenarios\n this.databaseVersion = 1.5;\n this.engineVersion = 1.5;\n\n // autosave support (disabled by default)\n this._autosave = false;\n this._autosaveInterval = 5000;\n this._autosaveHandle = null;\n this._throttledSaves = true;\n\n // currently keeping persistenceMethod and persistenceAdapter as loki level properties that\n // will not or cannot be deserialized You are required to configure persistence every time\n // you instantiate a loki object (or use default environment detection) in order to load the database anyways.\n\n // persistenceMethod could be 'fs', 'localStorage', or 'adapter'\n // this is optional option param, otherwise environment detection will be used\n // if user passes their own adapter we will force this method to 'adapter' later, so no need to pass method option.\n this._persistenceMethod = null;\n\n // retain reference to optional (non-serializable) persistenceAdapter 'instance'\n this._persistenceAdapter = null;\n\n // flags used to throttle saves\n this._throttledSaveRunning = null;\n this._throttledSavePending = null;\n\n this.events = {\n \"init\": [],\n \"loaded\": [],\n \"flushChanges\": [],\n \"close\": [],\n \"changes\": [],\n \"warning\": []\n };\n\n this.on(\"init\", this.clearChanges);\n }\n\n /**\n * configures options related to database persistence.\n *\n * @param {Loki.PersistenceOptions} [options={}] - options\n * @param {adapter} [options.adapter=auto] - an instance of a loki persistence adapter\n * @param {boolean} [options.autosave=false] - enables autosave\n * @param {int} [options.autosaveInterval=5000] - time interval (in milliseconds) between saves (if dirty)\n * @param {boolean} [options.autoload=false] - enables autoload on loki instantiation\n * @param {object} options.inflate - options that are passed to loadDatabase if autoload enabled\n * @param {boolean} [options.throttledSaves=true] - if true, it batches multiple calls to to saveDatabase reducing number of\n * disk I/O operations and guaranteeing proper serialization of the calls. Default value is true.\n * @param {Loki.PersistenceMethod} options.persistenceMethod - a persistence method which should be used (FS_STORAGE, LOCAL_STORAGE...)\n * @returns {Promise} a Promise that resolves after initialization and (if enabled) autoloading the database\n */\n public initializePersistence(options: Loki.PersistenceOptions = {}): Promise {\n (\n {\n autosave: this._autosave = false,\n autosaveInterval: this._autosaveInterval = 5000,\n persistenceMethod: this._persistenceMethod,\n // TODO\n //inflate: this.options.inflate,\n throttledSaves: this._throttledSaves = true\n } = options\n );\n\n const DEFAULT_PERSISTENCE = {\n \"NODEJS\": [\"fs-storage\"],\n \"BROWSER\": [\"local-storage\", \"indexed-storage\"],\n \"CORDOVA\": [\"local-storage\", \"indexed-storage\"],\n \"MEMORY\": [\"memory-storage\"]\n };\n\n const PERSISTENCE_METHODS = {\n \"fs-storage\": PLUGINS[\"FSStorage\"],\n \"local-storage\": PLUGINS[\"LocalStorage\"],\n \"indexed-storage\": PLUGINS[\"IndexedStorage\"],\n \"memory-storage\": PLUGINS[\"MemoryStorage\"]\n };\n\n // process the options\n if (this._persistenceMethod !== undefined) {\n // check if the specified persistence method is known\n if (typeof(PERSISTENCE_METHODS[this._persistenceMethod]) === \"function\") {\n this._persistenceAdapter = new (PERSISTENCE_METHODS[this._persistenceMethod]);\n } else {\n throw Error(\"Unknown persistence method.\");\n }\n }\n\n // if user passes adapter, set persistence mode to adapter and retain persistence adapter instance\n if (options.adapter !== undefined) {\n this._persistenceMethod = \"adapter\";\n this._persistenceAdapter = options.adapter;\n }\n\n // if by now there is no adapter specified by user nor derived from persistenceMethod: use sensible defaults\n if (this._persistenceAdapter === null) {\n let possiblePersistenceMethods = DEFAULT_PERSISTENCE[this._env];\n if (possiblePersistenceMethods) {\n for (let i = 0; i < possiblePersistenceMethods.length; i++) {\n if (PERSISTENCE_METHODS[possiblePersistenceMethods[i]]) {\n this._persistenceMethod = possiblePersistenceMethods[i];\n this._persistenceAdapter = new (PERSISTENCE_METHODS[possiblePersistenceMethods[i]]);\n break;\n }\n }\n }\n }\n\n this.autosaveDisable();\n\n // if they want to load database on loki instantiation, now is a good time to load... after adapter set and before\n // possible autosave initiation\n let loaded;\n if (options.autoload) {\n loaded = this.loadDatabase(options.inflate);\n } else {\n loaded = Promise.resolve();\n }\n\n return loaded.then(() => {\n if (this._autosave) {\n this.autosaveEnable();\n }\n });\n }\n\n /**\n * Copies 'this' database into a new Loki instance. Object references are shared to make lightweight.\n * @param {object} options - options\n * @param {boolean} options.removeNonSerializable - nulls properties not safe for serialization.\n */\n public copy(options: Loki.CopyOptions = {}): Loki {\n const databaseCopy = new Loki(this.filename, {env: this._env});\n\n // currently inverting and letting loadJSONObject do most of the work\n databaseCopy.loadJSONObject(this, {\n retainDirtyFlags: true\n });\n\n // since our toJSON is not invoked for reference database adapters, this will let us mimic\n if (options.removeNonSerializable) {\n databaseCopy._autosaveHandle = null;\n databaseCopy._persistenceAdapter = null;\n\n for (let idx = 0; idx < databaseCopy._collections.length; idx++) {\n databaseCopy._collections[idx].constraints = null;\n databaseCopy._collections[idx].ttl = null;\n }\n }\n\n return databaseCopy;\n }\n\n /**\n * Adds a collection to the database.\n * @param {string} name - name of collection to add\n * @param {object} [options={}] - options to configure collection with.\n * @param {array} [options.unique=[]] - array of property names to define unique constraints for\n * @param {array} [options.exact=[]] - array of property names to define exact constraints for\n * @param {array} [options.indices=[]] - array property names to define binary indexes for\n * @param {boolean} [options.asyncListeners=false] - whether listeners are called asynchronously\n * @param {boolean} [options.disableChangesApi=true] - set to false to enable Changes Api\n * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user\n * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method\n * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default.\n * @returns {Collection} a reference to the collection which was just added\n */\n public addCollection(name: string, options: Collection.Options = {}): Collection {\n const collection = new Collection(name, options);\n this._collections.push(collection);\n\n if (this._verbose) {\n collection.console = console;\n }\n return collection;\n }\n\n public loadCollection(collection: Collection): void {\n if (!collection.name) {\n throw new Error(\"Collection must have a name property to be loaded\");\n }\n this._collections.push(collection);\n }\n\n /**\n * Retrieves reference to a collection by name.\n * @param {string} collectionName - name of collection to look up\n * @returns {Collection} Reference to collection in database by that name, or null if not found\n */\n public getCollection(collectionName: string): Collection {\n let i;\n const len = this._collections.length;\n\n for (i = 0; i < len; i++) {\n if (this._collections[i].name === collectionName) {\n return this._collections[i] as Collection;\n }\n }\n\n // no such collection\n this.emit(\"warning\", \"collection \" + collectionName + \" not found\");\n return null;\n }\n\n /**\n * Renames an existing loki collection\n * @param {string} oldName - name of collection to rename\n * @param {string} newName - new name of collection\n * @returns {Collection} reference to the newly renamed collection\n */\n public renameCollection(oldName: string, newName: string): Collection {\n const c = this.getCollection(oldName);\n if (c) {\n c.name = newName;\n }\n return c;\n }\n\n public listCollections(): { name: string, count: number }[] {\n const colls = [];\n for (let i = 0; i < this._collections.length; i++) {\n colls.push({\n name: this._collections[i].name,\n count: this._collections[i].count()\n });\n }\n return colls;\n }\n\n /**\n * Removes a collection from the database.\n * @param {string} collectionName - name of collection to remove\n */\n public removeCollection(collectionName: string): void {\n for (let i = 0; i < this._collections.length; i++) {\n if (this._collections[i].name === collectionName) {\n const tmpcol = new Collection(collectionName, {});\n const curcol = this._collections[i];\n for (const prop in curcol) {\n if (curcol[prop] !== undefined && tmpcol[prop] !== undefined) {\n curcol[prop] = tmpcol[prop];\n }\n }\n this._collections.splice(i, 1);\n return;\n }\n }\n }\n\n public getName(): string {\n return this.filename;\n }\n\n /**\n * Serialize database to a string which can be loaded via {@link Loki#loadJSON}\n *\n * @returns {string} Stringified representation of the loki database.\n */\n public serialize(options: Loki.SerializeOptions = {}) {\n if (options.serializationMethod === undefined) {\n options.serializationMethod = this._serializationMethod;\n }\n\n switch (options.serializationMethod) {\n case \"normal\":\n return JSON.stringify(this);\n case \"pretty\":\n return JSON.stringify(this, null, 2);\n case \"destructured\":\n return this.serializeDestructured(); // use default options\n default:\n return JSON.stringify(this);\n }\n }\n\n // alias of serialize\n public toJSON(): Loki.Serialized {\n return {\n _env: this._env,\n _serializationMethod: this._serializationMethod,\n _autosave: this._autosave,\n _autosaveInterval: this._autosaveInterval,\n _collections: this._collections,\n databaseVersion: this.databaseVersion,\n engineVersion: this.engineVersion,\n filename: this.filename,\n _persistenceAdapter: this._persistenceAdapter,\n _persistenceMethod: this._persistenceMethod,\n _throttledSaves: this._throttledSaves,\n _verbose: this._verbose\n };\n }\n\n /**\n * Database level destructured JSON serialization routine to allow alternate serialization methods.\n * Internally, Loki supports destructuring via loki \"serializationMethod' option and\n * the optional LokiPartitioningAdapter class. It is also available if you wish to do\n * your own structured persistence or data exchange.\n *\n * @param {object} options - output format options for use externally to loki\n * @param {boolean} [options.partitioned=false] - whether db and each collection are separate\n * @param {int} options.partition - can be used to only output an individual collection or db (-1)\n * @param {boolean} [options.delimited=true] - whether subitems are delimited or subarrays\n * @param {string} options.delimiter - override default delimiter\n *\n * @returns {string|Array} A custom, restructured aggregation of independent serializations.\n */\n public serializeDestructured(options: Loki.SerializeDestructuredOptions = {}): string | string[] {\n if (options.partitioned === undefined) {\n options.partitioned = false;\n }\n\n if (options.delimited === undefined) {\n options.delimited = true;\n }\n\n if (options.delimiter === undefined) {\n options.delimiter = this._destructureDelimiter;\n }\n\n // 'partitioned' along with 'partition' of 0 or greater is a request for single collection serialization\n if (options.partitioned === true && options.partition !== undefined && options.partition >= 0) {\n return this.serializeCollection({\n delimited: options.delimited,\n delimiter: options.delimiter,\n collectionIndex: options.partition\n });\n }\n\n // not just an individual collection, so we will need to serialize db container via shallow copy\n let dbcopy = new Loki(this.filename);\n dbcopy.loadJSONObject(this);\n\n for (let idx = 0; idx < dbcopy._collections.length; idx++) {\n dbcopy._collections[idx]._data = [];\n }\n\n // if we -only- wanted the db container portion, return it now\n if (options.partitioned === true && options.partition === -1) {\n // since we are deconstructing, override serializationMethod to normal for here\n return dbcopy.serialize({\n serializationMethod: \"normal\"\n });\n }\n\n // at this point we must be deconstructing the entire database\n // start by pushing db serialization into first array element\n const reconstruct: string[] = [];\n reconstruct.push(dbcopy.serialize({\n serializationMethod: \"normal\"\n }) as string);\n\n dbcopy = null;\n\n // push collection data into subsequent elements\n for (let idx = 0; idx < this._collections.length; idx++) {\n let result = this.serializeCollection({\n delimited: options.delimited,\n delimiter: options.delimiter,\n collectionIndex: idx\n });\n\n // NDA : Non-Delimited Array : one iterable concatenated array with empty string collection partitions\n if (options.partitioned === false && options.delimited === false) {\n if (!Array.isArray(result)) {\n throw new Error(\"a nondelimited, non partitioned collection serialization did not return an expected array\");\n }\n\n // Array.concat would probably duplicate memory overhead for copying strings.\n // Instead copy each individually, and clear old value after each copy.\n // Hopefully this will allow g.c. to reduce memory pressure, if needed.\n for (let sidx = 0; sidx < result.length; sidx++) {\n reconstruct.push(result[sidx]);\n result[sidx] = null;\n }\n reconstruct.push(\"\");\n } else {\n reconstruct.push(result as string);\n }\n }\n\n // Reconstruct / present results according to four combinations : D, DA, NDA, NDAA\n if (options.partitioned) {\n // DA : Delimited Array of strings [0] db [1] collection [n] collection { partitioned: true, delimited: true }\n // useful for simple future adaptations of existing persistence adapters to save collections separately\n if (options.delimited) {\n return reconstruct;\n }\n // NDAA : Non-Delimited Array with subArrays. db at [0] and collection subarrays at [n] { partitioned: true, delimited : false }\n // This format might be the most versatile for 'rolling your own' partitioned sync or save.\n // Memory overhead can be reduced by specifying a specific partition, but at this code path they did not, so its all.\n else {\n return reconstruct;\n }\n } else {\n // D : one big Delimited string { partitioned: false, delimited : true }\n // This is the method Loki will use internally if 'destructured'.\n // Little memory overhead improvements but does not require multiple asynchronous adapter call scheduling\n if (options.delimited) {\n // indicate no more collections\n reconstruct.push(\"\");\n\n return reconstruct.join(options.delimiter);\n }\n // NDA : Non-Delimited Array : one iterable array with empty string collection partitions { partitioned: false, delimited: false }\n // This format might be best candidate for custom synchronous syncs or saves\n else {\n // indicate no more collections\n reconstruct.push(\"\");\n\n return reconstruct;\n }\n }\n }\n\n /**\n * Collection level utility method to serialize a collection in a 'destructured' format\n *\n * @param {object} options - used to determine output of method\n * @param {int} options.delimited - whether to return single delimited string or an array\n * @param {string} options.delimiter - (optional) if delimited, this is delimiter to use\n * @param {int} options.collectionIndex - specify which collection to serialize data for\n *\n * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection.\n */\n public serializeCollection(options: { delimited?: boolean; collectionIndex?: number; delimiter?: string } = {}): string | string[] {\n if (options.delimited === undefined) {\n options.delimited = true;\n }\n\n if (options.collectionIndex === undefined) {\n throw new Error(\"serializeCollection called without 'collectionIndex' option\");\n }\n const doccount = this._collections[options.collectionIndex].count();\n\n let resultlines = [];\n for (let docidx = 0; docidx < doccount; docidx++) {\n resultlines.push(JSON.stringify(this._collections[options.collectionIndex]._data[docidx]));\n }\n\n // D and DA\n if (options.delimited) {\n // indicate no more documents in collection (via empty delimited string)\n resultlines.push(\"\");\n\n return resultlines.join(options.delimiter);\n } else {\n // NDAA and NDA\n return resultlines;\n }\n }\n\n /**\n * Database level destructured JSON deserialization routine to minimize memory overhead.\n * Internally, Loki supports destructuring via loki \"serializationMethod' option and\n * the optional LokiPartitioningAdapter class. It is also available if you wish to do\n * your own structured persistence or data exchange.\n *\n * @param {string|array} destructuredSource - destructured json or array to deserialize from\n * @param {object} options - source format options\n * @param {boolean} [options.partitioned=false] - whether db and each collection are separate\n * @param {int} options.partition - can be used to deserialize only a single partition\n * @param {boolean} [options.delimited=true] - whether subitems are delimited or subarrays\n * @param {string} options.delimiter - override default delimiter\n *\n * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array\n */\n public deserializeDestructured(destructuredSource: string | string[], options: Loki.SerializeDestructuredOptions = {}) {\n if (options.partitioned === undefined) {\n options.partitioned = false;\n }\n\n if (options.delimited === undefined) {\n options.delimited = true;\n }\n\n if (options.delimiter === undefined) {\n options.delimiter = this._destructureDelimiter;\n }\n\n // Partitioned\n // DA : Delimited Array of strings [0] db [1] collection [n] collection { partitioned: true, delimited: true }\n // NDAA : Non-Delimited Array with subArrays. db at [0] and collection subarrays at [n] { partitioned: true, delimited : false }\n // -or- single partition\n if (options.partitioned) {\n // handle single partition\n if (options.partition !== undefined) {\n // db only\n if (options.partition === -1) {\n return JSON.parse(destructuredSource[0]);\n }\n\n // single collection, return doc array\n return this.deserializeCollection(destructuredSource[options.partition + 1], options);\n }\n\n // Otherwise we are restoring an entire partitioned db\n const cdb = JSON.parse(destructuredSource[0]);\n const collCount = cdb._collections.length;\n for (let collIndex = 0; collIndex < collCount; collIndex++) {\n // attach each collection docarray to container collection data, add 1 to collection array index since db is at 0\n cdb._collections[collIndex]._data = this.deserializeCollection(destructuredSource[collIndex + 1], options);\n }\n\n return cdb;\n }\n\n // Non-Partitioned\n // D : one big Delimited string { partitioned: false, delimited : true }\n // NDA : Non-Delimited Array : one iterable array with empty string collection partitions { partitioned: false, delimited: false }\n\n let workarray = [];\n\n // D\n if (options.delimited) {\n workarray = (destructuredSource as string).split(options.delimiter);\n destructuredSource = null; // lower memory pressure\n if (workarray.length === 0) {\n return null;\n }\n }\n // NDA\n else {\n workarray = destructuredSource as string[];\n }\n\n // first line is database and collection shells\n const cdb = JSON.parse(workarray[0]);\n const collCount = cdb._collections.length;\n workarray[0] = null;\n\n let collIndex = 0;\n let lineIndex = 1;\n let done = false;\n while (!done) {\n // empty string indicates either end of collection or end of file\n if (workarray[lineIndex] === \"\") {\n // if no more collections to load into, we are done\n if (++collIndex > collCount) {\n done = true;\n }\n } else {\n cdb._collections[collIndex]._data.push(JSON.parse(workarray[lineIndex]));\n }\n\n // lower memory pressure and advance iterator\n workarray[lineIndex++] = null;\n }\n\n return cdb;\n }\n\n /**\n * Collection level utility function to deserializes a destructured collection.\n *\n * @param {string|string[]} destructuredSource - destructured representation of collection to inflate\n * @param {object} options - used to describe format of destructuredSource input\n * @param {int} [options.delimited=false] - whether source is delimited string or an array\n * @param {string} options.delimiter - if delimited, this is delimiter to use (if other than default)\n *\n * @returns {Array} an array of documents to attach to collection.data.\n */\n public deserializeCollection(destructuredSource: string | string[], options: Loki.DeserializeCollectionOptions = {}): Doc[] {\n if (options.partitioned === undefined) {\n options.partitioned = false;\n }\n\n if (options.delimited === undefined) {\n options.delimited = true;\n }\n\n if (options.delimiter === undefined) {\n options.delimiter = this._destructureDelimiter;\n }\n\n let workarray = [];\n if (options.delimited) {\n workarray = (destructuredSource as string).split(options.delimiter);\n workarray.pop();\n } else {\n workarray = destructuredSource as string[];\n }\n\n for (let idx = 0; idx < workarray.length; idx++) {\n workarray[idx] = JSON.parse(workarray[idx]);\n }\n return workarray as any as Doc[];\n }\n\n /**\n * Inflates a loki database from a serialized JSON string\n *\n * @param {string} serializedDb - a serialized loki database string\n * @param {object} options - apply or override collection level settings\n * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved\n */\n public loadJSON(serializedDb: string | string[], options?: Collection.DeserializeOptions): void {\n let dbObject;\n if (serializedDb.length === 0) {\n dbObject = {};\n } else {\n // using option defined in instantiated db not what was in serialized db\n switch (this._serializationMethod) {\n case \"normal\":\n case \"pretty\":\n dbObject = JSON.parse(serializedDb as string);\n break;\n case \"destructured\":\n dbObject = this.deserializeDestructured(serializedDb);\n break;\n default:\n dbObject = JSON.parse(serializedDb as string);\n break;\n }\n }\n this.loadJSONObject(dbObject, options);\n }\n\n /**\n * Inflates a loki database from a JS object\n *\n * @param {object} dbObject - a serialized loki database object\n * @param {object} options - apply or override collection level settings\n * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved\n */\n public loadJSONObject(dbObject: Loki, options?: Collection.DeserializeOptions): void;\n public loadJSONObject(dbObject: Loki.Serialized, options?: Collection.DeserializeOptions): void;\n public loadJSONObject(dbObject: any, options: Collection.DeserializeOptions = {}): void {\n const len = dbObject._collections ? dbObject._collections.length : 0;\n\n this.filename = dbObject.filename;\n this._collections = [];\n\n for (let i = 0; i < len; ++i) {\n this._collections.push(Collection.fromJSONObject(dbObject._collections[i], options));\n }\n }\n\n /**\n * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer.\n * Does not actually destroy the db.\n *\n * @returns {Promise} a Promise that resolves after closing the database succeeded\n */\n public close(): Promise {\n let saved;\n // for autosave scenarios, we will let close perform final save (if dirty)\n // For web use, you might call from window.onbeforeunload to shutdown database, saving pending changes\n if (this._autosave) {\n this.autosaveDisable();\n // Check if collections are dirty.\n for (let idx = 0; idx < this._collections.length; idx++) {\n if (this._collections[idx].dirty) {\n saved = this.saveDatabase();\n break;\n }\n }\n }\n\n return Promise.resolve(saved).then(() => {\n this.emit(\"close\");\n });\n }\n\n /**-------------------------+\n | Changes API |\n +--------------------------*/\n\n /**\n * The Changes API enables the tracking the changes occurred in the collections since the beginning of the session,\n * so it's possible to create a differential dataset for synchronization purposes (possibly to a remote db)\n */\n\n /**\n * (Changes API) : takes all the changes stored in each\n * collection and creates a single array for the entire database. If an array of names\n * of collections is passed then only the included collections will be tracked.\n *\n * @param {Array} [arrayOfCollectionNames=] - array of collection names. No arg means all collections are processed.\n * @returns {Array} array of changes\n * @see private method _createChange() in Collection\n */\n public generateChangesNotification(arrayOfCollectionNames?: string[]): Collection.Change[] {\n let changes: Collection.Change[] = [];\n const selectedCollections = arrayOfCollectionNames\n || this._collections.map((coll: Collection) => coll.name);\n\n this._collections.forEach((coll) => {\n if (selectedCollections.indexOf(coll.name) !== -1) {\n changes = changes.concat(coll.getChanges());\n }\n });\n return changes;\n }\n\n /**\n * (Changes API) - stringify changes for network transmission\n * @returns {string} string representation of the changes\n */\n public serializeChanges(collectionNamesArray?: string[]) {\n return JSON.stringify(this.generateChangesNotification(collectionNamesArray));\n }\n\n /**\n * (Changes API) : clears all the changes in all collections.\n */\n public clearChanges() {\n this._collections.forEach((coll) => {\n if (coll.flushChanges) {\n coll.flushChanges();\n }\n });\n }\n\n /**\n * Wait for throttledSaves to complete and invoke your callback when drained or duration is met.\n *\n * @param {object} options - configuration options\n * @param {boolean} [options.recursiveWait=true] - if after queue is drained, another save was kicked off, wait for it\n * @param {boolean} [options.recursiveWaitLimit=false] - limit our recursive waiting to a duration\n * @param {number} [options.recursiveWaitLimitDuration=2000] - cutoff in ms to stop recursively re-draining\n * @param {Date} [options.started=now()] - the start time of the recursive wait duration\n * @returns {Promise} a Promise that resolves when save queue is drained, it is passed a sucess parameter value\n */\n throttledSaveDrain(options: Loki.ThrottledDrainOptions = {}): Promise {\n const now = (new Date()).getTime();\n\n if (!this._throttledSaves) {\n return Promise.resolve();\n }\n\n if (options.recursiveWait === undefined) {\n options.recursiveWait = true;\n }\n if (options.recursiveWaitLimit === undefined) {\n options.recursiveWaitLimit = false;\n }\n if (options.recursiveWaitLimitDuration === undefined) {\n options.recursiveWaitLimitDuration = 2000;\n }\n if (options.started === undefined) {\n options.started = new Date();\n }\n\n // if save is pending\n if (this._throttledSaves && this._throttledSaveRunning !== null) {\n // if we want to wait until we are in a state where there are no pending saves at all\n if (options.recursiveWait) {\n // queue the following meta callback for when it completes\n return Promise.resolve(Promise.all([this._throttledSaveRunning, this._throttledSavePending])).then(() => {\n if (this._throttledSaveRunning !== null || this._throttledSavePending !== null) {\n if (options.recursiveWaitLimit && (now - options.started.getTime() > options.recursiveWaitLimitDuration)) {\n return Promise.reject({});\n }\n return this.throttledSaveDrain(options);\n } else {\n return Promise.resolve();\n }\n });\n }\n // just notify when current queue is depleted\n else {\n return Promise.resolve(this._throttledSaveRunning);\n }\n }\n // no save pending, just callback\n else {\n return Promise.resolve();\n }\n }\n\n /**\n * Internal load logic, decoupled from throttling/contention logic\n *\n * @param {object} options - an object containing inflation options for each collection\n * @returns {Promise} a Promise that resolves after the database is loaded\n */\n private _loadDatabase(options = {}) {\n // the persistenceAdapter should be present if all is ok, but check to be sure.\n if (this._persistenceAdapter === null) {\n return Promise.reject(new Error(\"persistenceAdapter not configured\"));\n }\n\n return Promise.resolve(this._persistenceAdapter.loadDatabase(this.filename))\n .then((dbString) => {\n if (typeof (dbString) === \"string\") {\n this.loadJSON(dbString, options);\n this.emit(\"load\", this);\n } else {\n dbString = dbString as object;\n // if adapter has returned an js object (other than null or error) attempt to load from JSON object\n if (typeof (dbString) === \"object\" && dbString !== null && !(dbString instanceof Error)) {\n this.loadJSONObject(dbString, options);\n this.emit(\"load\", this);\n } else {\n if (dbString instanceof Error)\n throw dbString;\n\n throw new TypeError(\"The persistence adapter did not load a serialized DB string or object.\");\n }\n }\n });\n }\n\n /**\n * Handles manually loading from an adapter storage (such as fs-storage)\n * This method utilizes loki configuration options (if provided) to determine which\n * persistence method to use, or environment detection (if configuration was not provided).\n * To avoid contention with any throttledSaves, we will drain the save queue first.\n *\n * If you are configured with autosave, you do not need to call this method yourself.\n *\n * @param {object} [options={}] - if throttling saves and loads, this controls how we drain save queue before loading\n * @param {boolean} [options.recursiveWait=true] wait recursively until no saves are queued\n * @param {boolean} [options.recursiveWaitLimit=false] limit our recursive waiting to a duration\n * @param {number} [options.recursiveWaitLimitDelay=2000] cutoff in ms to stop recursively re-draining\n * @param {Date} [options.started=now()] - the start time of the recursive wait duration\n * @returns {Promise} a Promise that resolves after the database is loaded\n */\n public loadDatabase(options: Loki.LoadDatabaseOptions = {}): Promise {\n // if throttling disabled, just call internal\n if (!this._throttledSaves) {\n return this._loadDatabase(options);\n }\n\n // try to drain any pending saves in the queue to lock it for loading\n return this.throttledSaveDrain(options).then(() => {\n // pause/throttle saving until loading is done\n this._throttledSaveRunning = this._loadDatabase(options).then(() => {\n // now that we are finished loading, if no saves were throttled, disable flag\n this._throttledSaveRunning = null;\n });\n return this._throttledSaveRunning;\n }, () => {\n throw new Error(\"Unable to pause save throttling long enough to read database\");\n });\n }\n\n private _saveDatabase() {\n // the persistenceAdapter should be present if all is ok, but check to be sure.\n if (this._persistenceAdapter === null) {\n return Promise.reject(new Error(\"persistenceAdapter not configured\"));\n }\n\n let saved;\n\n // check if the adapter is requesting (and supports) a 'reference' mode export\n if (this._persistenceAdapter.mode === \"reference\" && typeof this._persistenceAdapter.exportDatabase === \"function\") {\n // filename may seem redundant but loadDatabase will need to expect this same filename\n saved = this._persistenceAdapter.exportDatabase(this.filename, this.copy({removeNonSerializable: true}));\n }\n // otherwise just pass the serialized database to adapter\n else {\n saved = this._persistenceAdapter.saveDatabase(this.filename, this.serialize() as string);\n }\n\n return Promise.resolve(saved).then(() => {\n // Set all collection not dirty.\n for (let idx = 0; idx < this._collections.length; idx++) {\n this._collections[idx].dirty = false;\n }\n this.emit(\"save\");\n });\n }\n\n /**\n * Handles manually saving to an adapter storage (such as fs-storage)\n * This method utilizes loki configuration options (if provided) to determine which\n * persistence method to use, or environment detection (if configuration was not provided).\n *\n * If you are configured with autosave, you do not need to call this method yourself.\n *\n * @returns {Promise} a Promise that resolves after the database is persisted\n */\n saveDatabase() {\n if (!this._throttledSaves) {\n return this._saveDatabase();\n }\n\n // if the db save is currently running, a new promise for a next db save is created\n // all calls to save db will get this new promise which will be processed right after\n // the current db save is finished\n if (this._throttledSaveRunning !== null && this._throttledSavePending === null) {\n this._throttledSavePending = Promise.resolve(this._throttledSaveRunning).then(() => {\n this._throttledSaveRunning = null;\n this._throttledSavePending = null;\n return this.saveDatabase();\n });\n }\n if (this._throttledSavePending !== null) {\n return this._throttledSavePending;\n }\n this._throttledSaveRunning = this._saveDatabase().then(() => {\n this._throttledSaveRunning = null;\n });\n\n return this._throttledSaveRunning;\n }\n\n /**\n * Handles deleting a database from the underlying storage adapter\n *\n * @returns {Promise} a Promise that resolves after the database is deleted\n */\n deleteDatabase() {\n // the persistenceAdapter should be present if all is ok, but check to be sure.\n if (this._persistenceAdapter === null) {\n return Promise.reject(new Error(\"persistenceAdapter not configured\"));\n }\n\n return Promise.resolve(this._persistenceAdapter.deleteDatabase(this.filename));\n }\n\n /**\n * Starts periodically saves to the underlying storage adapter.\n */\n autosaveEnable() {\n if (this._autosaveHandle) {\n return;\n }\n\n let running = true;\n\n this._autosave = true;\n this._autosaveHandle = () => {\n running = false;\n this._autosaveHandle = undefined;\n };\n\n setTimeout(() => {\n if (running) {\n this.saveDatabase().then(this.saveDatabase, this.saveDatabase);\n }\n }, this._autosaveInterval);\n }\n\n /**\n * Stops the autosave interval timer.\n */\n autosaveDisable() {\n this._autosave = false;\n\n if (this._autosaveHandle) {\n this._autosaveHandle();\n }\n }\n}\n\nexport namespace Loki {\n export interface Options {\n env?: Environment;\n serializationMethod?: SerializationMethod;\n destructureDelimiter?: string;\n verbose?: boolean;\n }\n\n export interface PersistenceOptions {\n adapter?: StorageAdapter;\n autosave?: boolean;\n autosaveInterval?: number;\n autoload?: boolean;\n throttledSaves?: boolean;\n persistenceMethod?: Loki.PersistenceMethod;\n inflate?: any;\n }\n\n export interface CopyOptions {\n removeNonSerializable?: boolean;\n }\n\n export interface SerializeOptions {\n serializationMethod?: SerializationMethod;\n }\n\n export interface SerializeDestructuredOptions {\n partitioned?: boolean;\n partition?: number;\n delimited?: boolean;\n delimiter?: string;\n }\n\n export interface DeserializeCollectionOptions {\n partitioned?: boolean;\n delimited?: boolean;\n delimiter?: string;\n }\n\n export interface ThrottledDrainOptions {\n recursiveWait?: boolean;\n recursiveWaitLimit?: boolean;\n recursiveWaitLimitDuration?: number;\n started?: Date;\n }\n\n export interface Serialized {\n _env: Environment;\n _serializationMethod: SerializationMethod;\n _autosave: boolean;\n _autosaveInterval: number;\n _collections: Collection[];\n databaseVersion: number;\n engineVersion: number;\n filename: string;\n _persistenceAdapter: StorageAdapter;\n _persistenceMethod: PersistenceMethod;\n _throttledSaves: boolean;\n _verbose: boolean;\n }\n\n export type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions;\n\n export type SerializationMethod = \"normal\" | \"pretty\" | \"destructured\";\n\n export type PersistenceMethod = \"fs-storage\" | \"local-storage\" | \"indexed-storage\" | \"memory-storage\" | \"adapter\";\n\n export type Environment = \"NATIVESCRIPT\" | \"NODEJS\" | \"CORDOVA\" | \"BROWSER\" | \"MEMORY\";\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/loki.ts","import {Dict, Doc} from \"../../common/types\";\n\nexport class UniqueIndex {\n // The property field to index.\n private _field: keyof E;\n // The map with the indices rows of unique property fields.\n private _keyMap: Dict;\n\n /**\n * Constructs an unique index object.\n * @param {number|string} propertyField - the property field to index\n */\n constructor(propertyField: keyof E) {\n this._field = propertyField;\n this._keyMap = {};\n }\n\n /**\n * Sets a document's unique index.\n * @param {Doc} doc - the document\n * @param {number} row - the data row of the document\n */\n public set(doc: Doc, row: number): void {\n const fieldValue = doc[this._field];\n if (fieldValue !== null && fieldValue !== undefined) {\n if (this._keyMap[fieldValue] !== undefined) {\n throw new Error(\"Duplicate key for property \" + this._field + \": \" + fieldValue);\n } else {\n this._keyMap[fieldValue] = row;\n }\n }\n }\n\n /**\n * Returns the data row of an unique index.\n * @param {number|string} index - the index\n * @returns {number | string} - the row\n */\n public get(index: keyof E): number {\n return this._keyMap[index];\n }\n\n /**\n * Updates a document's unique index.\n * @param {Object} doc - the document\n * @param {number} row - the data row of the document\n */\n public update(doc: Doc, row: number): void {\n // Find and remove current keyMap for row.\n const uniqueNames = Object.keys(this._keyMap);\n for (let i = 0; i < uniqueNames.length; i++) {\n if (row === this._keyMap[uniqueNames[i]]) {\n delete this._keyMap[uniqueNames[i]];\n break;\n }\n }\n this.set(doc, row);\n }\n\n /**\n * Removes an unique index.\n * @param {number|string} index - the unique index\n */\n public remove(index: number | string): void {\n if (this._keyMap[index] !== undefined) {\n delete this._keyMap[index];\n } else {\n throw new Error(\"Key is not in unique index: \" + this._field);\n }\n }\n\n /**\n * Clears all unique indexes.\n */\n public clear(): void {\n this._keyMap = {};\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/unique_index.ts","import {LokiEventEmitter} from \"./event_emitter\";\nimport {ResultSet} from \"./result_set\";\nimport {Collection} from \"./collection\";\nimport {Doc} from \"../../common/types\";\nimport {Scorer} from \"../../full-text-search/src/scorer\";\n\n/**\n * DynamicView class is a versatile 'live' view class which can have filters and sorts applied.\n * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it\n * whenever documents are add/updated/removed so it can remain up-to-date. (chainable)\n *\n * @example\n * let mydv = mycollection.addDynamicView('test'); // default is non-persistent\n * mydv.applyFind({ 'doors' : 4 });\n * mydv.applyWhere(function(obj) { return obj.name === 'Toyota'; });\n * let results = mydv.data();\n *\n * @extends LokiEventEmitter\n\n * @see {@link Collection#addDynamicView} to construct instances of DynamicView\n *\n * @param - the data type\n * @param - nested properties of data type\n */\nexport class DynamicView extends LokiEventEmitter {\n\n private _collection: Collection;\n private _persistent: boolean;\n private _sortPriority: DynamicView.SortPriority;\n private _minRebuildInterval: number;\n public name: string;\n private _rebuildPending: boolean;\n\n private _resultSet: ResultSet;\n private _resultData: Doc[];\n private _resultDirty: boolean;\n\n private _cachedResultSet: ResultSet;\n\n private _filterPipeline: DynamicView.Filter[];\n\n private _sortFunction: (lhs: Doc, rhs: Doc) => number;\n private _sortCriteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[];\n private _sortByScoring: boolean;\n private _sortDirty: boolean;\n\n /**\n * Constructor.\n * @param {Collection} collection - a reference to the collection to work agains\n * @param {string} name - the name of this dynamic view\n * @param {object} options - the options\n * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata'\n * @param {string} [options.sortPriority=\"passive\"] - the sort priority\n * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here)\n */\n constructor(collection: Collection, name: string, options: DynamicView.Options = {}) {\n super();\n (\n {\n persistent: this._persistent = false,\n sortPriority: this._sortPriority = \"passive\",\n minRebuildInterval: this._minRebuildInterval = 1\n } = options\n );\n\n this._collection = collection;\n this.name = name;\n this._rebuildPending = false;\n\n // 'passive' will defer the sort phase until they call data(). (most efficient overall)\n // 'active' will sort async whenever next idle. (prioritizes read speeds)\n\n this._resultSet = new ResultSet(collection);\n this._resultData = [];\n this._resultDirty = false;\n\n this._cachedResultSet = null;\n\n // keep ordered filter pipeline\n this._filterPipeline = [];\n\n // sorting member variables\n // we only support one active search, applied using applySort() or applySimpleSort()\n this._sortFunction = null;\n this._sortCriteria = null;\n this._sortByScoring = null;\n this._sortDirty = false;\n\n // for now just have 1 event for when we finally rebuilt lazy view\n // once we refactor transactions, i will tie in certain transactional events\n\n this.events = {\n \"rebuild\": []\n };\n }\n\n /**\n * Internally used immediately after deserialization (loading)\n * This will clear out and reapply filterPipeline ops, recreating the view.\n * Since where filters do not persist correctly, this method allows\n * restoring the view to state where user can re-apply those where filters.\n *\n * @param removeWhereFilters\n * @returns {DynamicView} This dynamic view for further chained ops.\n * @fires DynamicView.rebuild\n */\n _rematerialize({removeWhereFilters = false}): this {\n this._resultData = [];\n this._resultDirty = true;\n this._resultSet = new ResultSet(this._collection);\n\n if (this._sortFunction || this._sortCriteria || this._sortByScoring !== null) {\n this._sortDirty = true;\n }\n\n if (removeWhereFilters) {\n // for each view see if it had any where filters applied... since they don't\n // serialize those functions lets remove those invalid filters\n let fpi = this._filterPipeline.length;\n while (fpi--) {\n if (this._filterPipeline[fpi].type === \"where\") {\n if (fpi !== this._filterPipeline.length - 1) {\n this._filterPipeline[fpi] = this._filterPipeline[this._filterPipeline.length - 1];\n }\n this._filterPipeline.length--;\n }\n }\n }\n\n // back up old filter pipeline, clear filter pipeline, and reapply pipeline ops\n const ofp = this._filterPipeline;\n this._filterPipeline = [];\n\n // now re-apply 'find' filterPipeline ops\n for (let idx = 0; idx < ofp.length; idx++) {\n this.applyFind(ofp[idx].val);\n }\n\n // during creation of unit tests, i will remove this forced refresh and leave lazy\n this.data();\n\n // emit rebuild event in case user wants to be notified\n this.emit(\"rebuild\", this);\n\n return this;\n }\n\n /**\n * Makes a copy of the internal ResultSet for branched queries.\n * Unlike this dynamic view, the branched ResultSet will not be 'live' updated,\n * so your branched query should be immediately resolved and not held for future evaluation.\n *\n * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps\n * @param {object} parameters - optional parameters (if optional transform requires them)\n * @returns {ResultSet} A copy of the internal ResultSet for branched queries.\n */\n public branchResultSet(transform?: string | Collection.Transform[], parameters?: object): ResultSet {\n const rs = this._resultSet.branch();\n if (transform === undefined) {\n return rs;\n }\n return rs.transform(transform, parameters);\n }\n\n /**\n * Override of toJSON to avoid circular references.\n */\n public toJSON(): DynamicView.Serialized {\n return {\n name: this.name,\n _persistent: this._persistent,\n _sortPriority: this._sortPriority,\n _minRebuildInterval: this._minRebuildInterval,\n _resultSet: this._resultSet,\n _filterPipeline: this._filterPipeline,\n _sortCriteria: this._sortCriteria,\n _sortByScoring: this._sortByScoring,\n _sortDirty: this._sortDirty,\n };\n }\n\n public static fromJSONObject(collection: Collection, obj: DynamicView.Serialized): DynamicView {\n let dv = new DynamicView(collection, obj.name);\n dv._resultDirty = true;\n dv._filterPipeline = obj._filterPipeline;\n dv._resultData = [];\n dv._sortCriteria = obj._sortCriteria as any;\n dv._sortByScoring = obj._sortByScoring;\n dv._sortDirty = obj._sortDirty;\n dv._resultSet._filteredRows = obj._resultSet._filteredRows;\n dv._resultSet._filterInitialized = obj._resultSet._filterInitialized;\n dv._rematerialize({\n removeWhereFilters: true\n });\n return dv;\n }\n\n /**\n * Used to clear pipeline and reset dynamic view to initial state.\n * Existing options should be retained.\n * @param {boolean} queueSortPhase - (default: false) if true we will async rebuild view (maybe set default to true in future?)\n */\n public removeFilters({queueSortPhase = false} = {}): void {\n this._rebuildPending = false;\n this._resultSet.reset();\n this._resultData = [];\n this._resultDirty = true;\n\n this._cachedResultSet = null;\n\n // keep ordered filter pipeline\n this._filterPipeline = [];\n\n // sorting member variables\n // we only support one active search, applied using applySort() or applySimpleSort()\n this._sortFunction = null;\n this._sortCriteria = null;\n this._sortByScoring = null;\n this._sortDirty = false;\n\n if (queueSortPhase === true) {\n this._queueSortPhase();\n }\n }\n\n /**\n * Used to apply a sort to the dynamic view\n * @example\n * dv.applySort(function(obj1, obj2) {\n\t * if (obj1.name === obj2.name) return 0;\n\t * if (obj1.name > obj2.name) return 1;\n\t * if (obj1.name < obj2.name) return -1;\n\t * });\n *\n * @param {function} comparefun - a javascript compare function used for sorting\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public applySort(comparefun: (lhs: Doc, rhs: Doc) => number): this {\n this._sortFunction = comparefun;\n this._sortCriteria = null;\n this._sortByScoring = null;\n this._queueSortPhase();\n return this;\n }\n\n /**\n * Used to specify a property used for view translation.\n * @example\n * dv.applySimpleSort(\"name\");\n *\n * @param {string} propname - Name of property by which to sort.\n * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this {\n this._sortCriteria = [\n [propname, isdesc || false]\n ];\n this._sortFunction = null;\n this._sortByScoring = null;\n this._queueSortPhase();\n return this;\n }\n\n /**\n * Allows sorting a ResultSet based on multiple columns.\n * @example\n * // to sort by age and then name (both ascending)\n * dv.applySortCriteria(['age', 'name']);\n * // to sort by age (ascending) and then by name (descending)\n * dv.applySortCriteria(['age', ['name', true]);\n * // to sort by age (descending) and then by name (descending)\n * dv.applySortCriteria(['age', true], ['name', true]);\n *\n * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order\n * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations.\n */\n public applySortCriteria(criteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this {\n this._sortCriteria = criteria;\n this._sortFunction = null;\n this._sortByScoring = null;\n this._queueSortPhase();\n return this;\n }\n\n /**\n * Used to apply a sort by the latest full-text-search scoring.\n * @param {boolean} [ascending=false] - sort ascending\n */\n public applySortByScoring(ascending = false): this {\n this._sortFunction = null;\n this._sortCriteria = null;\n this._sortByScoring = ascending;\n this._queueSortPhase();\n return this;\n }\n\n /**\n * Returns the scoring of the last full-text-search.\n * @returns {ScoreResult}\n */\n public getScoring(): Scorer.ScoreResult {\n return this._resultSet.getScoring();\n }\n\n /**\n * Marks the beginning of a transaction.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public startTransaction(): this {\n this._cachedResultSet = this._resultSet.copy();\n return this;\n }\n\n /**\n * Commits a transaction.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public commit(): this {\n this._cachedResultSet = null;\n return this;\n }\n\n /**\n * Rolls back a transaction.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public rollback(): this {\n this._resultSet = this._cachedResultSet;\n\n if (this._persistent) {\n // for now just rebuild the persistent dynamic view data in this worst case scenario\n // (a persistent view utilizing transactions which get rolled back), we already know the filter so not too bad.\n this._resultData = this._resultSet.data();\n\n this.emit(\"rebuild\", this);\n }\n return this;\n }\n\n /**\n * Find the index of a filter in the pipeline, by that filter's ID.\n *\n * @param {(string|number)} uid - The unique ID of the filter.\n * @returns {number}: index of the referenced filter in the pipeline; -1 if not found.\n */\n private _indexOfFilterWithId(uid: string | number): number {\n if (typeof uid === \"string\" || typeof uid === \"number\") {\n for (let idx = 0, len = this._filterPipeline.length; idx < len; idx++) {\n if (uid === this._filterPipeline[idx].uid) {\n return idx;\n }\n }\n }\n return -1;\n }\n\n /**\n * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet.\n *\n * @param {object} filter - The filter object. Refer to applyFilter() for extra details.\n */\n private _addFilter(filter: DynamicView.Filter): void {\n this._filterPipeline.push(filter);\n this._resultSet[filter.type as string](filter.val);\n }\n\n /**\n * Reapply all the filters in the current pipeline.\n *\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public reapplyFilters(): this {\n this._resultSet.reset();\n\n this._cachedResultSet = null;\n if (this._persistent) {\n this._resultData = [];\n this._resultDirty = true;\n }\n\n const filters = this._filterPipeline;\n this._filterPipeline = [];\n\n for (let idx = 0, len = filters.length; idx < len; idx++) {\n this._addFilter(filters[idx]);\n }\n\n if (this._sortFunction || this._sortCriteria || this._sortByScoring !== null) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n\n return this;\n }\n\n /**\n * Adds or updates a filter in the DynamicView filter pipeline\n *\n * @param {object} filter - A filter object to add to the pipeline.\n * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id }\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public applyFilter(filter: DynamicView.Filter): this {\n const idx = this._indexOfFilterWithId(filter.uid);\n if (idx >= 0) {\n this._filterPipeline[idx] = filter;\n return this.reapplyFilters();\n }\n\n this._cachedResultSet = null;\n if (this._persistent) {\n this._resultData = [];\n this._resultDirty = true;\n }\n\n this._addFilter(filter);\n\n if (this._sortFunction || this._sortCriteria || this._sortByScoring !== null) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n return this;\n }\n\n /**\n * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline\n *\n * @param {object} query - A mongo-style query object to apply to pipeline\n * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public applyFind(query: object, uid: string | number = \"\"): this {\n this.applyFilter({\n type: \"find\",\n val: query,\n uid\n });\n return this;\n }\n\n /**\n * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline\n *\n * @param {function} fun - A javascript filter function to apply to pipeline\n * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public applyWhere(fun: (obj: Doc) => boolean, uid?: string | number): this {\n this.applyFilter({\n type: \"where\",\n val: fun,\n uid\n });\n return this;\n }\n\n /**\n * removeFilter() - Remove the specified filter from the DynamicView filter pipeline\n *\n * @param {(string|number)} uid - The unique ID of the filter to be removed.\n * @returns {DynamicView} this DynamicView object, for further chain ops.\n */\n public removeFilter(uid: string | number): this {\n const idx = this._indexOfFilterWithId(uid);\n if (idx < 0) {\n throw new Error(\"Dynamic view does not contain a filter with ID: \" + uid);\n }\n\n this._filterPipeline.splice(idx, 1);\n this.reapplyFilters();\n return this;\n }\n\n /**\n * Returns the number of documents representing the current DynamicView contents.\n * @returns {number} The number of documents representing the current DynamicView contents.\n */\n public count(): number {\n // in order to be accurate we will pay the minimum cost (and not alter dv state management)\n // recurring ResultSet data resolutions should know internally its already up to date.\n // for persistent data this will not update resultdata nor fire rebuild event.\n if (this._resultDirty) {\n this._resultData = this._resultSet.data();\n }\n\n return this._resultSet.count();\n }\n\n /**\n * Resolves and pending filtering and sorting, then returns document array as result.\n *\n * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent\n * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when\n * the collection is not configured for clone object.\n * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method.\n * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign'\n * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents\n *\n * @returns {Array} An array of documents representing the current DynamicView contents.\n */\n public data(options: ResultSet.DataOptions = {}): Doc[] {\n // using final sort phase as 'catch all' for a few use cases which require full rebuild\n if (this._sortDirty || this._resultDirty) {\n this._performSortPhase({\n suppressRebuildEvent: true\n });\n }\n return (this._persistent) ? (this._resultData) : (this._resultSet.data(options));\n }\n\n /**\n * When the view is not sorted we may still wish to be notified of rebuild events.\n * This event will throttle and queue a single rebuild event when batches of updates affect the view.\n */\n private _queueRebuildEvent(): void {\n if (this._rebuildPending) {\n return;\n }\n this._rebuildPending = true;\n\n setTimeout(() => {\n if (this._rebuildPending) {\n this._rebuildPending = false;\n this.emit(\"rebuild\", this);\n }\n }, this._minRebuildInterval);\n }\n\n /**\n * If the view is sorted we will throttle sorting to either :\n * (1) passive - when the user calls data(), or\n * (2) active - once they stop updating and yield js thread control\n */\n private _queueSortPhase(): void {\n // already queued? exit without queuing again\n if (this._sortDirty) {\n return;\n }\n this._sortDirty = true;\n\n if (this._sortPriority === \"active\") {\n // active sorting... once they are done and yield js thread, run async performSortPhase()\n setTimeout(() => {\n this._performSortPhase();\n }, this._minRebuildInterval);\n } else {\n // must be passive sorting... since not calling performSortPhase (until data call), lets use queueRebuildEvent to\n // potentially notify user that data has changed.\n this._queueRebuildEvent();\n }\n }\n\n /**\n * Invoked synchronously or asynchronously to perform final sort phase (if needed)\n */\n private _performSortPhase(options: { suppressRebuildEvent?: boolean } = {}): void {\n // async call to this may have been pre-empted by synchronous call to data before async could fire\n if (!this._sortDirty && !this._resultDirty) {\n return;\n }\n\n if (this._sortDirty) {\n if (this._sortFunction) {\n this._resultSet.sort(this._sortFunction);\n } else if (this._sortCriteria) {\n this._resultSet.compoundsort(this._sortCriteria);\n } else if (this._sortByScoring !== null) {\n this._resultSet.sortByScoring(this._sortByScoring);\n }\n\n this._sortDirty = false;\n }\n\n if (this._persistent) {\n // persistent view, rebuild local resultdata array\n this._resultData = this._resultSet.data();\n this._resultDirty = false;\n }\n\n if (!options.suppressRebuildEvent) {\n this.emit(\"rebuild\", this);\n }\n }\n\n /**\n * (Re)evaluating document inclusion.\n * Called by : collection.insert() and collection.update().\n *\n * @param {int} objIndex - index of document to (re)run through filter pipeline.\n * @param {boolean} isNew - true if the document was just added to the collection.\n */\n _evaluateDocument(objIndex: number, isNew: boolean): void {\n // if no filter applied yet, the result 'set' should remain 'everything'\n if (!this._resultSet._filterInitialized) {\n if (this._persistent) {\n this._resultData = this._resultSet.data();\n }\n // need to re-sort to sort new document\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n return;\n }\n\n const ofr = this._resultSet._filteredRows;\n const oldPos = (isNew) ? (-1) : (ofr.indexOf(+objIndex));\n const oldlen = ofr.length;\n\n // creating a 1-element ResultSet to run filter chain ops on to see if that doc passes filters;\n // mostly efficient algorithm, slight stack overhead price (this function is called on inserts and updates)\n const evalResultSet = new ResultSet(this._collection);\n evalResultSet._filteredRows = [objIndex];\n evalResultSet._filterInitialized = true;\n let filter;\n for (let idx = 0, len = this._filterPipeline.length; idx < len; idx++) {\n filter = this._filterPipeline[idx];\n evalResultSet[filter.type as string](filter.val);\n }\n\n // not a true position, but -1 if not pass our filter(s), 0 if passed filter(s)\n const newPos = (evalResultSet._filteredRows.length === 0) ? -1 : 0;\n\n // wasn't in old, shouldn't be now... do nothing\n if (oldPos === -1 && newPos === -1) return;\n\n // wasn't in ResultSet, should be now... add\n if (oldPos === -1 && newPos !== -1) {\n ofr.push(objIndex);\n\n if (this._persistent) {\n this._resultData.push(this._collection._data[objIndex]);\n }\n\n // need to re-sort to sort new document\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n\n return;\n }\n\n // was in ResultSet, shouldn't be now... delete\n if (oldPos !== -1 && newPos === -1) {\n if (oldPos < oldlen - 1) {\n ofr.splice(oldPos, 1);\n\n if (this._persistent) {\n this._resultData.splice(oldPos, 1);\n }\n } else {\n ofr.length = oldlen - 1;\n\n if (this._persistent) {\n this._resultData.length = oldlen - 1;\n }\n }\n\n // in case changes to data altered a sort column\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n return;\n }\n\n // was in ResultSet, should still be now... (update persistent only?)\n if (oldPos !== -1 && newPos !== -1) {\n if (this._persistent) {\n // in case document changed, replace persistent view data with the latest collection._data document\n this._resultData[oldPos] = this._collection._data[objIndex];\n }\n\n // in case changes to data altered a sort column\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n }\n }\n\n /**\n * internal function called on collection.delete()\n */\n _removeDocument(objIndex: number): void {\n // if no filter applied yet, the result 'set' should remain 'everything'\n if (!this._resultSet._filterInitialized) {\n if (this._persistent) {\n this._resultData = this._resultSet.data();\n }\n // in case changes to data altered a sort column\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n return;\n }\n\n const ofr = this._resultSet._filteredRows;\n const oldPos = ofr.indexOf(+objIndex);\n let oldlen = ofr.length;\n if (oldPos !== -1) {\n // if not last row in resultdata, swap last to hole and truncate last row\n if (oldPos < oldlen - 1) {\n ofr[oldPos] = ofr[oldlen - 1];\n ofr.length = oldlen - 1;\n\n if (this._persistent) {\n this._resultData[oldPos] = this._resultData[oldlen - 1];\n this._resultData.length = oldlen - 1;\n }\n }\n // last row, so just truncate last row\n else {\n ofr.length = oldlen - 1;\n\n if (this._persistent) {\n this._resultData.length = oldlen - 1;\n }\n }\n\n // in case changes to data altered a sort column\n if (this._sortFunction || this._sortCriteria) {\n this._queueSortPhase();\n } else {\n this._queueRebuildEvent();\n }\n }\n\n // since we are using filteredRows to store data array positions\n // if they remove a document (whether in our view or not),\n // we need to adjust array positions -1 for all document array references after that position\n oldlen = ofr.length;\n for (let idx = 0; idx < oldlen; idx++) {\n if (ofr[idx] > objIndex) {\n ofr[idx]--;\n }\n }\n }\n\n /**\n * Data transformation via user supplied functions\n *\n * @param {function} mapFunction - this function accepts a single document for you to transform and return\n * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value\n * @returns The output of your reduceFunction\n */\n public mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U {\n try {\n return reduceFunction(this.data().map(mapFunction));\n } catch (err) {\n throw err;\n }\n }\n}\n\nexport namespace DynamicView {\n export interface Options {\n persistent?: boolean;\n sortPriority?: SortPriority;\n minRebuildInterval?: number;\n }\n\n export type SortPriority = \"passive\" | \"active\";\n\n export interface Serialized {\n name: string;\n _persistent: boolean;\n _sortPriority: SortPriority;\n _minRebuildInterval: number;\n _resultSet: ResultSet;\n _filterPipeline: Filter[];\n _sortCriteria: (string | [string, boolean])[];\n _sortByScoring: boolean;\n _sortDirty: boolean;\n }\n\n export type Filter = {\n type: \"find\";\n val: ResultSet.Query & TNested>;\n uid: number | string;\n } | {\n type: \"where\";\n val: (obj: Doc) => boolean;\n uid: number | string;\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/loki/src/dynamic_view.ts"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/packages/loki/lokijs.loki.min.js b/dist/packages/loki/lokijs.loki.min.js index 9cdf8e4d..38c39502 100644 --- a/dist/packages/loki/lokijs.loki.min.js +++ b/dist/packages/loki/lokijs.loki.min.js @@ -1 +1 @@ -(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["@lokijs/loki"]=factory();else{root["@lokijs/loki"]=factory();root["Loki"]=root["@lokijs/loki"].default}})(typeof self!=="undefined"?self:this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=7)}([function(module,__webpack_exports__,__webpack_require__){"use strict";class LokiEventEmitter{constructor(){this.events={};this.asyncListeners=false}on(eventName,listener){let event;if(Array.isArray(eventName)){eventName.forEach(currentEventName=>{this.on(currentEventName,listener)});return listener}event=this.events[eventName];if(!event){event=this.events[eventName]=[]}event.push(listener);return listener}emit(eventName,...data){if(eventName&&this.events[eventName]){this.events[eventName].forEach(listener=>{if(this.asyncListeners){setTimeout(()=>{listener(...data)},1)}else{listener(...data)}})}}addListener(eventName,listener){return this.on(eventName,listener)}removeListener(eventName,listener){if(Array.isArray(eventName)){eventName.forEach(currentEventName=>{this.removeListener(currentEventName,listener)})}if(this.events[eventName]){const listeners=this.events[eventName];listeners.splice(listeners.indexOf(listener),1)}}}__webpack_exports__["a"]=LokiEventEmitter},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__event_emitter__=__webpack_require__(0);var __WEBPACK_IMPORTED_MODULE_1__unique_index__=__webpack_require__(9);var __WEBPACK_IMPORTED_MODULE_2__resultset__=__webpack_require__(4);var __WEBPACK_IMPORTED_MODULE_3__dynamic_view__=__webpack_require__(10);var __WEBPACK_IMPORTED_MODULE_4__helper__=__webpack_require__(5);var __WEBPACK_IMPORTED_MODULE_5__clone__=__webpack_require__(2);var __WEBPACK_IMPORTED_MODULE_6__common_plugin__=__webpack_require__(6);function isDeepProperty(field){return field.indexOf(".")!==-1}function average(array){return array.reduce((a,b)=>a+b,0)/array.length}function standardDeviation(values){const avg=average(values);const squareDiffs=values.map(value=>{const diff=value-avg;return diff*diff});const avgSquareDiff=average(squareDiffs);return Math.sqrt(avgSquareDiff)}function deepProperty(obj,property,isDeep){if(isDeep===false){return obj[property]}const pieces=property.split(".");let root=obj;while(pieces.length>0){root=root[pieces.shift()]}return root}class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a"]{constructor(name,options={}){super();this.constraints={unique:{}};this.name=name;this.data=[];this.idIndex=[];this.binaryIndices={};this.constraints={unique:{}};this.transforms={};this.dirty=true;this.cachedIndex=null;this.cachedBinaryIndex=null;this.cachedData=null;if(options.unique!==undefined){if(!Array.isArray(options.unique)){options.unique=[options.unique]}options.unique.forEach(prop=>{this.constraints.unique[prop]=new __WEBPACK_IMPORTED_MODULE_1__unique_index__["a"](prop)})}if(__WEBPACK_IMPORTED_MODULE_6__common_plugin__["a"]["FullTextSearch"]!==undefined){this._fullTextSearch=options.fullTextSearch!==undefined?new __WEBPACK_IMPORTED_MODULE_6__common_plugin__["a"]["FullTextSearch"](options.fullTextSearch):null}else{this._fullTextSearch=null}this.adaptiveBinaryIndices=options.adaptiveBinaryIndices!==undefined?options.adaptiveBinaryIndices:true;this.transactional=options.transactional!==undefined?options.transactional:false;this.cloneObjects=options.clone!==undefined?options.clone:false;this.asyncListeners=options.asyncListeners!==undefined?options.asyncListeners:false;this.disableChangesApi=options.disableChangesApi!==undefined?options.disableChangesApi:true;this.disableDeltaChangesApi=options.disableDeltaChangesApi!==undefined?options.disableDeltaChangesApi:true;this.cloneMethod=options.cloneMethod!==undefined?options.cloneMethod:__WEBPACK_IMPORTED_MODULE_5__clone__["a"].DEEP;if(this.disableChangesApi){this.disableDeltaChangesApi=true}this.serializableIndices=options.serializableIndices!==undefined?options.serializableIndices:true;this.ttl={age:null,ttlInterval:null,daemon:null};this.setTTL(options.ttl||-1,options.ttlInterval);this.maxId=0;this._dynamicViews=[];this.events={insert:[],update:[],"pre-insert":[],"pre-update":[],close:[],flushbuffer:[],error:[],delete:[],warning:[]};this.changes=[];this.ensureId();let indices=options.indices?options.indices:[];for(let idx=0;idx{this.insertHandler(obj)});this.on("update",(obj,old)=>{this.updateHandler(obj,old)});this.on("delete",obj=>{if(!this.disableChangesApi){this._createChange(this.name,"R",obj)}});this.on("warning",warning=>{this.console.warn(warning)});this.flushChanges();this.console={log(){},warn(){},error(){}};this.stages={};this.commitLog=[]}toJSON(){return{name:this.name,_dynamicViews:this._dynamicViews,uniqueNames:Object.keys(this.constraints.unique),transforms:this.transforms,binaryIndices:this.binaryIndices,data:this.data,idIndex:this.idIndex,maxId:this.maxId,dirty:this.dirty,adaptiveBinaryIndices:this.adaptiveBinaryIndices,transactional:this.transactional,asyncListeners:this.asyncListeners,disableChangesApi:this.disableChangesApi,cloneObjects:this.cloneObjects,cloneMethod:this.cloneMethod,changes:this.changes,_fullTextSearch:this._fullTextSearch}}static fromJSONObject(obj,options){let coll=new Collection(obj.name,{disableChangesApi:obj.disableChangesApi,disableDeltaChangesApi:obj.disableDeltaChangesApi});coll.adaptiveBinaryIndices=obj.adaptiveBinaryIndices!==undefined?obj.adaptiveBinaryIndices===true:false;coll.transactional=obj.transactional;coll.asyncListeners=obj.asyncListeners;coll.disableChangesApi=obj.disableChangesApi;coll.cloneObjects=obj.cloneObjects;coll.cloneMethod=obj.cloneMethod||__WEBPACK_IMPORTED_MODULE_5__clone__["a"].DEEP;coll.changes=obj.changes;coll.dirty=options&&options.retainDirtyFlags===true?obj.dirty:false;function makeLoader(coll){const collOptions=options[coll.name];if(collOptions.proto){let inflater=collOptions.inflate||((src,dest)=>{for(let prop in src){dest[prop]=src[prop]}});return data=>{const collObj=new collOptions.proto;inflater(data,collObj);return collObj}}return collOptions.inflate}let clen=obj.data.length;let j=0;if(options&&options[obj.name]!==undefined){let loader=makeLoader(obj);for(j;j{const timestamp=member.meta.updated||member.meta.created;const diff=now-timestamp;return age(a,b)=>{let val1,val2,arr;if(~prop.indexOf(".")){arr=prop.split(".");val1=arr.reduce(function(obj,i){return obj&&obj[i]||undefined},data[a]);val2=arr.reduce(function(obj,i){return obj&&obj[i]||undefined},data[b])}else{val1=data[a][prop];val2=data[b][prop]}if(val1!==val2){if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val1,val2,false))return-1;if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val1,val2,false))return 1}return 0})(property,this.data);index.values.sort(wrappedComparer);index.dirty=false;this.dirty=true}getSequencedIndexValues(property){let idx;const idxvals=this.binaryIndices[property].values;let result="";for(idx=0;idx{this.binaryIndices[biname].dirty=false;this.binaryIndices[biname].values=[]});const uniqueNames=Object.keys(this.constraints.unique);for(let i=0;i{this.constraints.unique[key].update(newInternal,position)});this.data[position]=newInternal;for(let idx=0;idx{if(doc[key]!==null&&doc[key]!==undefined){this.constraints.unique[key].remove(doc[key])}});for(let idx=0;idx>1;id=typeof id==="number"?id:parseInt(id,10);if(isNaN(id)){throw new TypeError("Passed id is not an integer")}while(data[min]>1;if(data[mid]dataPosition){index[idx]--}}}_calculateRangeStart(prop,val,adaptive=false){const rcd=this.data;const index=this.binaryIndices[prop].values;let min=0;let max=index.length-1;let mid=0;if(index.length===0){return-1}while(min>1;if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(rcd[index[mid]][prop],val,false)){min=mid+1}else{max=mid}}const lbound=min;if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["a"])(val,rcd[index[lbound]][prop])){return lbound}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,rcd[index[lbound]][prop],false)){return adaptive?lbound:lbound-1}return adaptive?lbound+1:lbound}_calculateRangeEnd(prop,val){const rcd=this.data;const index=this.binaryIndices[prop].values;let min=0;let max=index.length-1;let mid=0;if(index.length===0){return-1}while(min>1;if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,rcd[index[mid]][prop],false)){max=mid}else{min=mid+1}}const ubound=max;if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["a"])(val,rcd[index[ubound]][prop])){return ubound}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val,rcd[index[ubound]][prop],false)){return ubound+1}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["a"])(val,rcd[index[ubound-1]][prop])){return ubound-1}return ubound}calculateRange(op,prop,val){const rcd=this.data;const index=this.binaryIndices[prop].values;const min=0;const max=index.length-1;let lbound;let lval;let ubound;if(rcd.length===0){return[0,-1]}const minVal=rcd[index[min]][prop];const maxVal=rcd[index[max]][prop];switch(op){case"$eq":case"$aeq":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,minVal,false)||Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val,maxVal,false)){return[0,-1]}break;case"$dteq":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,minVal,false)||Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val,maxVal,false)){return[0,-1]}break;case"$gt":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val,maxVal,true)){return[0,-1]}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(minVal,val,false)){return[min,max]}break;case"$gte":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val,maxVal,false)){return[0,-1]}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(minVal,val,true)){return[min,max]}break;case"$lt":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,minVal,true)){return[0,-1]}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(maxVal,val,false)){return[min,max]}break;case"$lte":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,minVal,false)){return[0,-1]}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(maxVal,val,true)){return[min,max]}break;case"$between":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val[0],maxVal,false)){return[0,-1]}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val[1],minVal,false)){return[0,-1]}lbound=this._calculateRangeStart(prop,val[0]);ubound=this._calculateRangeEnd(prop,val[1]);if(lbound<0)lbound++;if(ubound>max)ubound--;if(!Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(rcd[index[lbound]][prop],val[0],true))lbound++;if(!Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(rcd[index[ubound]][prop],val[1],true))ubound--;if(ubounddeepProperty(this.data[i],field,deep)){min=deepProperty(this.data[i],field,deep);result.index=this.data[i].$loki}}else{min=deepProperty(this.data[i],field,deep);result.index=this.data[i].$loki}}result.value=min;return result}extractNumerical(field){return this.extract(field).map(parseFloat).filter(Number).filter(n=>!isNaN(n))}avg(field){return average(this.extractNumerical(field))}stdDev(field){return standardDeviation(this.extractNumerical(field))}mode(field){const dict={};const data=this.extract(field);data.forEach(obj=>{if(dict[obj]){dict[obj]+=1}else{dict[obj]=1}});let max;let prop;let mode;for(prop in dict){if(max){if(maxa-b);const half=Math.floor(values.length/2);if(values.length%2){return values[half]}else{return(values[half-1]+values[half])/2}}}__webpack_exports__["a"]=Collection},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",function(){return CloneMethod});__webpack_exports__["b"]=clone;var CloneMethod;(function(CloneMethod){CloneMethod[CloneMethod["PARSE_STRINGIFY"]=0]="PARSE_STRINGIFY";CloneMethod[CloneMethod["DEEP"]=1]="DEEP";CloneMethod[CloneMethod["SHALLOW"]=2]="SHALLOW";CloneMethod[CloneMethod["SHALLOW_ASSIGN"]=3]="SHALLOW_ASSIGN";CloneMethod[CloneMethod["SHALLOW_RECURSE_OBJECTS"]=4]="SHALLOW_RECURSE_OBJECTS"})(CloneMethod||(CloneMethod={}));function add(copy,key,value){if(copy instanceof Array){copy.push(value);return copy[copy.length-1]}else if(copy instanceof Object){copy[key]=value;return copy[key]}}function walk(target,copy){for(let key in target){let obj=target[key];if(obj instanceof Date){let value=new Date(obj.getTime());add(copy,key,value)}else if(obj instanceof Function){let value=obj;add(copy,key,value)}else if(obj instanceof Array){let value=[];let last=add(copy,key,value);walk(obj,last)}else if(obj instanceof Object){let value={};let last=add(copy,key,value);walk(obj,last)}else{let value=obj;add(copy,key,value)}}}function deepCopy(target){if(/number|string|boolean/.test(typeof target)){return target}if(target instanceof Date){return new Date(target.getTime())}const copy=target instanceof Array?[]:{};walk(target,copy);return copy}function clone(data,method=CloneMethod.PARSE_STRINGIFY){if(data===null||data===undefined){return null}let cloned;switch(method){case CloneMethod.PARSE_STRINGIFY:cloned=JSON.parse(JSON.stringify(data));break;case CloneMethod.DEEP:cloned=deepCopy(data);break;case CloneMethod.SHALLOW:cloned=Object.create(data.constructor.prototype);Object.assign(cloned,data);break;case CloneMethod.SHALLOW_RECURSE_OBJECTS:cloned=clone(data,CloneMethod.SHALLOW);const keys=Object.keys(data);for(let i=0;i=10)return subObj;for(prop in subObj){if(typeof subObj[prop]==="string"&&subObj[prop].indexOf("[%lktxp]")===0){pname=subObj[prop].substring(8);if(params[pname]!==undefined){subObj[prop]=params[pname]}}else if(typeof subObj[prop]==="object"){subObj[prop]=resolveTransformObject(subObj[prop],params,depth)}}return subObj}function resolveTransformParams(transform,params){let idx;let clonedStep;const resolvedTransform=[];if(params===undefined)return transform;for(idx=0;idxa.indexOf(b)!==-1}else if(typeof a==="object"&&a!==null){return b=>Object.hasOwnProperty.call(a,b)}return null}function doQueryOp(val,op){for(let p in op){if(Object.hasOwnProperty.call(op,p)){return LokiOps[p](val,op[p])}}return false}const LokiOps={$eq(a,b){return a===b},$aeq(a,b){return a==b},$ne(a,b){if(b!==b){return a===a}return a!==b},$dteq(a,b){return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["a"])(a,b)},$gt(a,b){return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["b"])(a,b,false)},$gte(a,b){return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["b"])(a,b,true)},$lt(a,b){return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["c"])(a,b,false)},$lte(a,b){return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["c"])(a,b,true)},$between(a,vals){if(a===undefined||a===null)return false;return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["b"])(a,vals[0],true)&&Object(__WEBPACK_IMPORTED_MODULE_2__helper__["c"])(a,vals[1],true)},$in(a,b){return b.indexOf(a)!==-1},$nin(a,b){return b.indexOf(a)===-1},$keyin(a,b){return a in b},$nkeyin(a,b){return!(a in b)},$definedin(a,b){return b[a]!==undefined},$undefinedin(a,b){return b[a]===undefined},$regex(a,b){return b.test(a)},$containsString(a,b){return typeof a==="string"&&a.indexOf(b)!==-1},$containsNone(a,b){return!LokiOps.$containsAny(a,b)},$containsAny(a,b){const checkFn=containsCheckFn(a);if(checkFn!==null){return Array.isArray(b)?b.some(checkFn):checkFn(b)}return false},$contains(a,b){const checkFn=containsCheckFn(a);if(checkFn!==null){return Array.isArray(b)?b.every(checkFn):checkFn(b)}return false},$type(a,b){let type=typeof a;if(type==="object"){if(Array.isArray(a)){type="array"}else if(a instanceof Date){type="date"}}return typeof b!=="object"?type===b:doQueryOp(type,b)},$finite(a,b){return b===isFinite(a)},$size(a,b){if(Array.isArray(a)){return typeof b!=="object"?a.length===b:doQueryOp(a.length,b)}return false},$len(a,b){if(typeof a==="string"){return typeof b!=="object"?a.length===b:doQueryOp(a.length,b)}return false},$where(a,b){return b(a)===true},$not(a,b){return!doQueryOp(a,b)},$and(a,b){for(let idx=0,len=b.length;idx=paths.length){valueFound=fun(element,value)}else if(Array.isArray(element)){for(let index=0,len=element.length;index0){this.filteredrows=[]}this.filterInitialized=false;return this}toJSON(){const copy=this.copy();copy.collection=null;return copy}limit(qty){if(!this.filterInitialized&&this.filteredrows.length===0){this.filteredrows=this.collection.prepareFullDocIndex()}this.filteredrows=this.filteredrows.slice(0,qty);this.filterInitialized=true;return this}offset(pos){if(!this.filterInitialized&&this.filteredrows.length===0){this.filteredrows=this.collection.prepareFullDocIndex()}this.filteredrows=this.filteredrows.slice(pos);this.filterInitialized=true;return this}copy(){const result=new Resultset(this.collection);if(this.filteredrows.length>0){result.filteredrows=this.filteredrows.slice()}result.filterInitialized=this.filterInitialized;return result}branch(){return this.copy()}transform(transform,parameters){let idx;let step;let rs=this;if(typeof transform==="string"){if(this.collection.transforms[transform]!==undefined){transform=this.collection.transforms[transform]}}if(typeof transform!=="object"||!Array.isArray(transform)){throw new Error("Invalid transform")}if(parameters!==undefined){transform=resolveTransformParams(transform,parameters)}for(idx=0;idx(a,b)=>userComparer(data[a],data[b]))(comparefun,this.collection.data);this.filteredrows.sort(wrappedComparer);return this}simplesort(propname,isdesc){if(isdesc===undefined){isdesc=false}if(!this.filterInitialized&&this.filteredrows.length===0){if(this.collection.binaryIndices[propname]!==undefined){this.collection.ensureIndex(propname);this.filteredrows=this.collection.binaryIndices[propname].values.slice(0);if(isdesc){this.filteredrows.reverse()}return this}else{this.filteredrows=this.collection.prepareFullDocIndex()}}const wrappedComparer=((prop,desc,data)=>(a,b)=>{let val1,val2,arr;if(~prop.indexOf(".")){arr=prop.split(".");val1=arr.reduce(function(obj,i){return obj&&obj[i]||undefined},data[a]);val2=arr.reduce(function(obj,i){return obj&&obj[i]||undefined},data[b])}else{val1=data[a][prop];val2=data[b][prop]}return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["d"])(val1,val2,desc)})(propname,isdesc,this.collection.data);this.filteredrows.sort(wrappedComparer);return this}compoundsort(properties){if(properties.length===0){throw new Error("Invalid call to compoundsort, need at least one property")}let prop;if(properties.length===1){prop=properties[0];if(typeof prop==="string"){return this.simplesort(prop,false)}else{return this.simplesort(prop[0],prop[1])}}for(let i=0,len=properties.length;i(a,b)=>this._compoundeval(props,data[a],data[b]))(properties,this.collection.data);this.filteredrows.sort(wrappedComparer);return this}_compoundeval(properties,obj1,obj2){let res=0;let prop;let field;let val1,val2,arr;for(let i=0,len=properties.length;i{return obj&&obj[i]||undefined},obj1);val2=arr.reduce((obj,i)=>{return obj&&obj[i]||undefined},obj2)}else{val1=obj1[field];val2=obj2[field]}res=Object(__WEBPACK_IMPORTED_MODULE_2__helper__["d"])(val1,val2,prop[1]);if(res!==0){return res}}return 0}sortByScoring(ascending=false){if(this._scoring===null){throw new Error("No scoring available")}if(ascending){this.filteredrows.sort((a,b)=>this._scoring[a]-this._scoring[b])}else{this.filteredrows.sort((a,b)=>this._scoring[b]-this._scoring[a])}return this}getScoring(){if(this._scoring===null){throw new Error("No scoring available")}return this._scoring}findOr(expressionArray){let fr=null;let fri=0;let frlen=0;const docset=[];const idxset=[];let idx=0;const origCount=this.count();for(let ei=0,elen=expressionArray.length;ei1){return this.find({$and:filters},firstOnly)}}if(!property||queryObject==="getAll"){if(firstOnly){this.filteredrows=this.collection.data.length>0?[0]:[];this.filterInitialized=true}return this}if(property==="$and"||property==="$or"){this[property](queryObjectOp);if(firstOnly&&this.filteredrows.length>1){this.filteredrows=this.filteredrows.slice(0,1)}return this}let operator;if(queryObjectOp===null||(typeof queryObjectOp!=="object"||queryObjectOp instanceof Date)){operator="$eq";value=queryObjectOp}else if(typeof queryObjectOp==="object"){for(let key in queryObjectOp){if(queryObjectOp[key]!==undefined){operator=key;value=queryObjectOp[key];break}}}else{throw new Error("Do not know what you want to do.")}if(operator==="$regex"){if(Array.isArray(value)){value=new RegExp(value[0],value[1])}else if(!(value instanceof RegExp)){value=new RegExp(value)}}const usingDotNotation=property.indexOf(".")!==-1;const doIndexCheck=!usingDotNotation&&!this.filterInitialized;let searchByIndex=false;if(doIndexCheck&&this.collection.binaryIndices[property]&&indexedOps[operator]){if(this.collection.adaptiveBinaryIndices!==true){this.collection.ensureIndex(property)}searchByIndex=true}const fun=LokiOps[operator];const data=this.collection.data;let result=[];if(this.filterInitialized){let filter=this.filteredrows;if(usingDotNotation){property=property.split(".");for(let i=0;i({left:left,right:right}))}for(let j=0;jcv2)return false;return equal}if(cv1===cv1&&cv2!==cv2){return true}if(cv2===cv2&&cv1!==cv1){return false}if(prop1prop2)return false;if(prop1==prop2)return equal;cv1=prop1.toString();cv2=prop2.toString();if(cv1t2}}cv1=Number(prop1);cv2=Number(prop2);if(cv1===cv1&&cv2===cv2){if(cv1>cv2)return true;if(cv1prop2)return true;if(prop1cv2){return true}if(cv1==cv2){return equal}return false}function sortHelper(prop1,prop2,desc){if(aeqHelper(prop1,prop2))return 0;if(ltHelper(prop1,prop2,false)){return desc?1:-1}if(gtHelper(prop1,prop2,false)){return desc?-1:1}return 0}},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){function getGlobal(){let glob;(function(global){glob=global})(global!==undefined&&global||this);return glob}function create(){const global=getGlobal();const sym=Symbol.for("LOKI");if(global[sym]===undefined){global[sym]={}}return global[sym]}const PLUGINS=create();__webpack_exports__["a"]=PLUGINS}).call(__webpack_exports__,__webpack_require__(3))},function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__loki__=__webpack_require__(8);var __WEBPACK_IMPORTED_MODULE_1__collection__=__webpack_require__(1);__webpack_require__.d(__webpack_exports__,"Loki",function(){return __WEBPACK_IMPORTED_MODULE_0__loki__["a"]});__webpack_require__.d(__webpack_exports__,"Collection",function(){return __WEBPACK_IMPORTED_MODULE_1__collection__["a"]});__webpack_exports__["default"]={Loki:__WEBPACK_IMPORTED_MODULE_0__loki__["a"]}},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){var __WEBPACK_IMPORTED_MODULE_0__event_emitter__=__webpack_require__(0);var __WEBPACK_IMPORTED_MODULE_1__collection__=__webpack_require__(1);var __WEBPACK_IMPORTED_MODULE_2__common_plugin__=__webpack_require__(6);function getENV(){if(global!==undefined&&(global["android"]||global["NSObject"])){return Loki.Environment.NATIVE_SCRIPT}const isNode=global!==undefined&&{}.toString.call(global)==="[object global]";if(isNode){if(global["window"]){return Loki.Environment.NODE_JS}else{return Loki.Environment.NODE_JS}}const isBrowser=window!==undefined&&{}.toString.call(window)==="[object Window]";if(document!==undefined){if(document.URL.indexOf("http://")===-1&&document.URL.indexOf("https://")===-1){return Loki.Environment.CORDOVA}return Loki.Environment.BROWSER}if(!isBrowser){throw SyntaxError("Unknown environment...")}}class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a"]{constructor(filename="loki.db",options={}){super();this.filename=filename;this._collections=[];({serializationMethod:this._serializationMethod=Loki.SerializationMethod.NORMAL,destructureDelimiter:this._destructureDelimiter="$<\n",verbose:this._verbose=false,env:this._env=getENV()}=options);this.databaseVersion=1.5;this.engineVersion=1.5;this._autosave=false;this._autosaveInterval=5e3;this._autosaveHandle=null;this._throttledSaves=true;this._persistenceMethod=null;this._persistenceAdapter=null;this._throttledSaveRunning=null;this._throttledSavePending=null;this.events={init:[],loaded:[],flushChanges:[],close:[],changes:[],warning:[]};this.on("init",this.clearChanges)}initializePersistence(options={}){({autosave:this._autosave=false,autosaveInterval:this._autosaveInterval=5e3,persistenceMethod:this._persistenceMethod,throttledSaves:this._throttledSaves=true}=options);const DEFAULT_PERSISTENCE={[Loki.Environment.NODE_JS]:[Loki.PersistenceMethod.FS_STORAGE],[Loki.Environment.BROWSER]:[Loki.PersistenceMethod.LOCAL_STORAGE,Loki.PersistenceMethod.INDEXED_STORAGE],[Loki.Environment.CORDOVA]:[Loki.PersistenceMethod.LOCAL_STORAGE,Loki.PersistenceMethod.INDEXED_STORAGE],[Loki.Environment.MEMORY]:[Loki.PersistenceMethod.MEMORY_STORAGE]};const PERSISTENCE_METHODS={[Loki.PersistenceMethod.FS_STORAGE]:__WEBPACK_IMPORTED_MODULE_2__common_plugin__["a"]["LokiFSStorage"],[Loki.PersistenceMethod.LOCAL_STORAGE]:__WEBPACK_IMPORTED_MODULE_2__common_plugin__["a"]["LokiLocalStorage"],[Loki.PersistenceMethod.INDEXED_STORAGE]:__WEBPACK_IMPORTED_MODULE_2__common_plugin__["a"]["LokiIndexedStorage"],[Loki.PersistenceMethod.MEMORY_STORAGE]:__WEBPACK_IMPORTED_MODULE_2__common_plugin__["a"]["LokiMemoryStorage"]};if(this._persistenceMethod!==undefined){if(typeof PERSISTENCE_METHODS[this._persistenceMethod]==="function"){this._persistenceAdapter=new PERSISTENCE_METHODS[this._persistenceMethod]}else{throw Error("Unknown persistence method.")}}if(options.adapter!==undefined){this._persistenceMethod=Loki.PersistenceMethod.ADAPTER;this._persistenceAdapter=options.adapter}if(this._persistenceAdapter===null){let possiblePersistenceMethods=DEFAULT_PERSISTENCE[this._env];if(possiblePersistenceMethods){for(let i=0;i{if(this._autosave){this.autosaveEnable()}})}copy(options={}){const databaseCopy=new Loki(this.filename,{env:this._env});databaseCopy.loadJSONObject(this,{retainDirtyFlags:true});if(options.removeNonSerializable){databaseCopy._autosaveHandle=null;databaseCopy._persistenceAdapter=null;for(let idx=0;idx=0){return this.serializeCollection({delimited:options.delimited,delimiter:options.delimiter,collectionIndex:options.partition})}let dbcopy=new Loki(this.filename);dbcopy.loadJSONObject(this);for(let idx=0;idxcollCount){done=true}}else{currObject=JSON.parse(workarray[lineIndex]);cdb._collections[collIndex].data.push(currObject)}workarray[lineIndex++]=null}return cdb}deserializeCollection(destructuredSource,options={}){if(options.partitioned===undefined){options.partitioned=false}if(options.delimited===undefined){options.delimited=true}if(options.delimiter===undefined){options.delimiter=this._destructureDelimiter}let workarray=[];if(options.delimited){workarray=destructuredSource.split(options.delimiter);workarray.pop()}else{workarray=destructuredSource}for(let idx=0;idx{this.emit("close")})}generateChangesNotification(arrayOfCollectionNames){let changes=[];const selectedCollections=arrayOfCollectionNames||this._collections.map(coll=>coll.name);this._collections.forEach(coll=>{if(selectedCollections.indexOf(coll.name)!==-1){changes=changes.concat(coll.getChanges())}});return changes}serializeChanges(collectionNamesArray){return JSON.stringify(this.generateChangesNotification(collectionNamesArray))}clearChanges(){this._collections.forEach(coll=>{if(coll.flushChanges){coll.flushChanges()}})}throttledSaveDrain(options={}){const now=(new Date).getTime();if(!this._throttledSaves){return Promise.resolve()}if(options.recursiveWait===undefined){options.recursiveWait=true}if(options.recursiveWaitLimit===undefined){options.recursiveWaitLimit=false}if(options.recursiveWaitLimitDuration===undefined){options.recursiveWaitLimitDuration=2e3}if(options.started===undefined){options.started=new Date}if(this._throttledSaves&&this._throttledSaveRunning!==null){if(options.recursiveWait){return Promise.resolve(Promise.all([this._throttledSaveRunning,this._throttledSavePending])).then(()=>{if(this._throttledSaveRunning!==null||this._throttledSavePending!==null){if(options.recursiveWaitLimit&&now-options.started.getTime()>options.recursiveWaitLimitDuration){return Promise.reject({})}return this.throttledSaveDrain(options)}else{return Promise.resolve()}})}else{return Promise.resolve(this._throttledSaveRunning)}}else{return Promise.resolve()}}_loadDatabase(options={}){if(this._persistenceAdapter===null){return Promise.reject(new Error("persistenceAdapter not configured"))}return Promise.resolve(this._persistenceAdapter.loadDatabase(this.filename)).then(dbString=>{if(typeof dbString==="string"){this.loadJSON(dbString,options);this.emit("load",this)}else{dbString=dbString;if(typeof dbString==="object"&&dbString!==null&&!(dbString instanceof Error)){this.loadJSONObject(dbString,options);this.emit("load",this)}else{if(dbString instanceof Error)throw dbString;throw new TypeError("The persistence adapter did not load a serialized DB string or object.")}}})}loadDatabase(options={}){if(!this._throttledSaves){return this._loadDatabase(options)}return this.throttledSaveDrain(options).then(()=>{this._throttledSaveRunning=this._loadDatabase(options).then(()=>{this._throttledSaveRunning=null});return this._throttledSaveRunning},()=>{throw new Error("Unable to pause save throttling long enough to read database")})}_saveDatabase(){if(this._persistenceAdapter===null){return Promise.reject(new Error("persistenceAdapter not configured"))}let saved;if(this._persistenceAdapter.mode==="reference"&&typeof this._persistenceAdapter.exportDatabase==="function"){saved=this._persistenceAdapter.exportDatabase(this.filename,this.copy({removeNonSerializable:true}))}else{saved=this._persistenceAdapter.saveDatabase(this.filename,this.serialize())}return Promise.resolve(saved).then(()=>{for(let idx=0;idx{this._throttledSaveRunning=null;this._throttledSavePending=null;return this.saveDatabase()})}if(this._throttledSavePending!==null){return this._throttledSavePending}this._throttledSaveRunning=this._saveDatabase().then(()=>{this._throttledSaveRunning=null});return this._throttledSaveRunning}deleteDatabase(){if(this._persistenceAdapter===null){return Promise.reject(new Error("persistenceAdapter not configured"))}return Promise.resolve(this._persistenceAdapter.deleteDatabase(this.filename))}autosaveEnable(){if(this._autosaveHandle){return}let running=true;this._autosave=true;this._autosaveHandle=(()=>{running=false;this._autosaveHandle=undefined});setTimeout(()=>{if(running){this.saveDatabase().then(this.saveDatabase,this.saveDatabase)}},this._autosaveInterval)}autosaveDisable(){this._autosave=false;if(this._autosaveHandle){this._autosaveHandle()}}}__webpack_exports__["a"]=Loki;(function(Loki){let SerializationMethod;(function(SerializationMethod){SerializationMethod[SerializationMethod["NORMAL"]=0]="NORMAL";SerializationMethod[SerializationMethod["PRETTY"]=1]="PRETTY";SerializationMethod[SerializationMethod["DESTRUCTURED"]=2]="DESTRUCTURED"})(SerializationMethod=Loki.SerializationMethod||(Loki.SerializationMethod={}));let PersistenceMethod;(function(PersistenceMethod){PersistenceMethod[PersistenceMethod["FS_STORAGE"]=0]="FS_STORAGE";PersistenceMethod[PersistenceMethod["LOCAL_STORAGE"]=1]="LOCAL_STORAGE";PersistenceMethod[PersistenceMethod["INDEXED_STORAGE"]=2]="INDEXED_STORAGE";PersistenceMethod[PersistenceMethod["MEMORY_STORAGE"]=3]="MEMORY_STORAGE";PersistenceMethod[PersistenceMethod["ADAPTER"]=4]="ADAPTER"})(PersistenceMethod=Loki.PersistenceMethod||(Loki.PersistenceMethod={}));let Environment;(function(Environment){Environment[Environment["NODE_JS"]=0]="NODE_JS";Environment[Environment["NATIVE_SCRIPT"]=1]="NATIVE_SCRIPT";Environment[Environment["BROWSER"]=2]="BROWSER";Environment[Environment["CORDOVA"]=3]="CORDOVA";Environment[Environment["MEMORY"]=4]="MEMORY"})(Environment=Loki.Environment||(Loki.Environment={}))})(Loki||(Loki={}))}).call(__webpack_exports__,__webpack_require__(3))},function(module,__webpack_exports__,__webpack_require__){"use strict";class UniqueIndex{constructor(propertyField){this._field=propertyField;this._keyMap={}}set(doc,row){const fieldValue=doc[this._field];if(fieldValue!==null&&fieldValue!==undefined){if(this._keyMap[fieldValue]!==undefined){throw new Error("Duplicate key for property "+this._field+": "+fieldValue)}else{this._keyMap[fieldValue]=row}}}get(index){return this._keyMap[index]}update(doc,row){const uniqueNames=Object.keys(this._keyMap);for(let i=0;i=0){this._filterPipeline[idx]=filter;return this.reapplyFilters()}this._cachedresultset=null;if(this._persistent){this._resultdata=[];this._resultsdirty=true}this._addFilter(filter);if(this._sortFunction||this._sortCriteria||this._sortByScoring!==null){this._queueSortPhase()}else{this._queueRebuildEvent()}return this}applyFind(query,uid=""){this.applyFilter({type:"find",val:query,uid:uid});return this}applyWhere(fun,uid){this.applyFilter({type:"where",val:fun,uid:uid});return this}removeFilter(uid){const idx=this._indexOfFilterWithId(uid);if(idx<0){throw new Error("Dynamic view does not contain a filter with ID: "+uid)}this._filterPipeline.splice(idx,1);this.reapplyFilters();return this}count(){if(this._resultsdirty){this._resultdata=this._resultset.data()}return this._resultset.count()}data(options={}){if(this._sortDirty||this._resultsdirty){this._performSortPhase({suppressRebuildEvent:true})}return this._persistent?this._resultdata:this._resultset.data(options)}_queueRebuildEvent(){if(this._rebuildPending){return}this._rebuildPending=true;setTimeout(()=>{if(this._rebuildPending){this._rebuildPending=false;this.emit("rebuild",this)}},this._minRebuildInterval)}_queueSortPhase(){if(this._sortDirty){return}this._sortDirty=true;if(this._sortPriority===DynamicView.SortPriority.ACTIVE){setTimeout(()=>{this._performSortPhase()},this._minRebuildInterval)}else{this._queueRebuildEvent()}}_performSortPhase(options={}){if(!this._sortDirty&&!this._resultsdirty){return}if(this._sortDirty){if(this._sortFunction){this._resultset.sort(this._sortFunction)}else if(this._sortCriteria){this._resultset.compoundsort(this._sortCriteria)}else if(this._sortByScoring!==null){this._resultset.sortByScoring(this._sortByScoring)}this._sortDirty=false}if(this._persistent){this._resultdata=this._resultset.data();this._resultsdirty=false}if(!options.suppressRebuildEvent){this.emit("rebuild",this)}}_evaluateDocument(objIndex,isNew){if(!this._resultset.filterInitialized){if(this._persistent){this._resultdata=this._resultset.data()}if(this._sortFunction||this._sortCriteria){this._queueSortPhase()}else{this._queueRebuildEvent()}return}const ofr=this._resultset.filteredrows;const oldPos=isNew?-1:ofr.indexOf(+objIndex);const oldlen=ofr.length;const evalResultset=new __WEBPACK_IMPORTED_MODULE_1__resultset__["a"](this._collection);evalResultset.filteredrows=[objIndex];evalResultset.filterInitialized=true;let filter;for(let idx=0,len=this._filterPipeline.length;idxobjIndex){ofr[idx]--}}}mapReduce(mapFunction,reduceFunction){try{return reduceFunction(this.data().map(mapFunction))}catch(err){throw err}}}__webpack_exports__["a"]=DynamicView;(function(DynamicView){let SortPriority;(function(SortPriority){SortPriority[SortPriority["PASSIVE"]=0]="PASSIVE";SortPriority[SortPriority["ACTIVE"]=1]="ACTIVE"})(SortPriority=DynamicView.SortPriority||(DynamicView.SortPriority={}))})(DynamicView||(DynamicView={}))}])}); \ No newline at end of file +(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["@lokijs/loki"]=factory();else{root["@lokijs/loki"]=factory();root["Loki"]=root["@lokijs/loki"].default}})(typeof self!=="undefined"?self:this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=7)}([function(module,__webpack_exports__,__webpack_require__){"use strict";class LokiEventEmitter{constructor(){this.events={};this.asyncListeners=false}on(eventName,listener){let event;if(Array.isArray(eventName)){eventName.forEach(currentEventName=>{this.on(currentEventName,listener)});return listener}event=this.events[eventName];if(!event){event=this.events[eventName]=[]}event.push(listener);return listener}emit(eventName,...data){if(eventName&&this.events[eventName]){this.events[eventName].forEach(listener=>{if(this.asyncListeners){setTimeout(()=>{listener(...data)},1)}else{listener(...data)}})}}addListener(eventName,listener){return this.on(eventName,listener)}removeListener(eventName,listener){if(Array.isArray(eventName)){eventName.forEach(currentEventName=>{this.removeListener(currentEventName,listener)})}if(this.events[eventName]){const listeners=this.events[eventName];listeners.splice(listeners.indexOf(listener),1)}}}__webpack_exports__["a"]=LokiEventEmitter},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__event_emitter__=__webpack_require__(0);var __WEBPACK_IMPORTED_MODULE_1__unique_index__=__webpack_require__(9);var __WEBPACK_IMPORTED_MODULE_2__result_set__=__webpack_require__(3);var __WEBPACK_IMPORTED_MODULE_3__dynamic_view__=__webpack_require__(10);var __WEBPACK_IMPORTED_MODULE_4__helper__=__webpack_require__(5);var __WEBPACK_IMPORTED_MODULE_5__clone__=__webpack_require__(4);var __WEBPACK_IMPORTED_MODULE_6__common_plugin__=__webpack_require__(6);function isDeepProperty(field){return field.indexOf(".")!==-1}function average(array){return array.reduce((a,b)=>a+b,0)/array.length}function standardDeviation(values){const avg=average(values);const squareDiffs=values.map(value=>{const diff=value-avg;return diff*diff});const avgSquareDiff=average(squareDiffs);return Math.sqrt(avgSquareDiff)}function deepProperty(obj,property,isDeep){if(isDeep===false){return obj[property]}const pieces=property.split(".");let root=obj;while(pieces.length>0){root=root[pieces.shift()]}return root}class Collection extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a"]{constructor(name,options={}){super();this.name=name;this._data=[];this.idIndex=[];this.binaryIndices={};this.constraints={unique:{}};this.transforms={};this.dirty=true;this.cachedIndex=null;this.cachedBinaryIndex=null;this.cachedData=null;if(options.unique!==undefined){if(!Array.isArray(options.unique)){options.unique=[options.unique]}options.unique.forEach(prop=>{this.constraints.unique[prop]=new __WEBPACK_IMPORTED_MODULE_1__unique_index__["a"](prop)})}if(__WEBPACK_IMPORTED_MODULE_6__common_plugin__["a"]["FullTextSearch"]!==undefined){this._fullTextSearch=options.fullTextSearch!==undefined?new __WEBPACK_IMPORTED_MODULE_6__common_plugin__["a"]["FullTextSearch"](options.fullTextSearch):null}else{this._fullTextSearch=null}this.adaptiveBinaryIndices=options.adaptiveBinaryIndices!==undefined?options.adaptiveBinaryIndices:true;this.transactional=options.transactional!==undefined?options.transactional:false;this.cloneObjects=options.clone!==undefined?options.clone:false;this.asyncListeners=options.asyncListeners!==undefined?options.asyncListeners:false;this.disableChangesApi=options.disableChangesApi!==undefined?options.disableChangesApi:true;this.disableDeltaChangesApi=options.disableDeltaChangesApi!==undefined?options.disableDeltaChangesApi:true;this.cloneMethod=options.cloneMethod!==undefined?options.cloneMethod:"deep";if(this.disableChangesApi){this.disableDeltaChangesApi=true}this.serializableIndices=options.serializableIndices!==undefined?options.serializableIndices:true;this.ttl={age:null,ttlInterval:null,daemon:null};this.setTTL(options.ttl||-1,options.ttlInterval);this.maxId=0;this._dynamicViews=[];this.events={insert:[],update:[],"pre-insert":[],"pre-update":[],close:[],flushbuffer:[],error:[],delete:[],warning:[]};this.changes=[];this._ensureId();let indices=options.indices?options.indices:[];for(let idx=0;idx{this.insertHandler(obj)});this.on("update",(obj,old)=>{this.updateHandler(obj,old)});this.on("delete",obj=>{if(!this.disableChangesApi){this._createChange(this.name,"R",obj)}});this.on("warning",warning=>{this.console.warn(warning)});this.flushChanges();this.console={log(){},warn(){},error(){}};this.stages={};this.commitLog=[]}toJSON(){return{name:this.name,_dynamicViews:this._dynamicViews,uniqueNames:Object.keys(this.constraints.unique),transforms:this.transforms,binaryIndices:this.binaryIndices,_data:this._data,idIndex:this.idIndex,maxId:this.maxId,dirty:this.dirty,adaptiveBinaryIndices:this.adaptiveBinaryIndices,transactional:this.transactional,asyncListeners:this.asyncListeners,disableChangesApi:this.disableChangesApi,disableDeltaChangesApi:this.disableDeltaChangesApi,cloneObjects:this.cloneObjects,cloneMethod:this.cloneMethod,changes:this.changes,_fullTextSearch:this._fullTextSearch}}static fromJSONObject(obj,options){let coll=new Collection(obj.name,{disableChangesApi:obj.disableChangesApi,disableDeltaChangesApi:obj.disableDeltaChangesApi});coll.adaptiveBinaryIndices=obj.adaptiveBinaryIndices!==undefined?obj.adaptiveBinaryIndices===true:false;coll.transactional=obj.transactional;coll.asyncListeners=obj.asyncListeners;coll.disableChangesApi=obj.disableChangesApi;coll.cloneObjects=obj.cloneObjects;coll.cloneMethod=obj.cloneMethod||"deep";coll.changes=obj.changes;coll.dirty=options&&options.retainDirtyFlags===true?obj.dirty:false;function makeLoader(coll){const collOptions=options[coll.name];if(collOptions.proto){const inflater=collOptions.inflate||((src,dest)=>{for(let prop in src){dest[prop]=src[prop]}});return data=>{const collObj=new collOptions.proto;inflater(data,collObj);return collObj}}return collOptions.inflate}if(options&&options[obj.name]!==undefined){let loader=makeLoader(obj);for(let j=0;j{const now=Date.now();const toRemove=this.chain().where(member=>{const timestamp=member.meta.updated||member.meta.created;const diff=now-timestamp;return this.ttl.age{let val1,val2;if(~property.indexOf(".")){const arr=property.split(".");val1=arr.reduce(function(obj,i){return obj&&obj[i]||undefined},data[a]);val2=arr.reduce(function(obj,i){return obj&&obj[i]||undefined},data[b])}else{val1=data[a][property];val2=data[b][property]}if(val1!==val2){if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val1,val2,false))return-1;if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val1,val2,false))return 1}return 0};index.values.sort(wrappedComparer);index.dirty=false;this.dirty=true}getSequencedIndexValues(property){let idx;const idxvals=this.binaryIndices[property].values;let result="";for(idx=0;idx{this.binaryIndices[biname].dirty=false;this.binaryIndices[biname].values=[]});const uniqueNames=Object.keys(this.constraints.unique);for(let i=0;i{this.constraints.unique[key].update(newInternal,position)});this._data[position]=newInternal;for(let idx=0;idx{if(doc[key]!==null&&doc[key]!==undefined){this.constraints.unique[key].remove(doc[key])}});for(let idx=0;idx>1;id=typeof id==="number"?id:parseInt(id,10);if(isNaN(id)){throw new TypeError("Passed id is not an integer")}while(data[min]>1;if(data[mid]dataPosition){index[idx]--}}}_calculateRangeStart(prop,val,adaptive=false){const rcd=this._data;const index=this.binaryIndices[prop].values;let min=0;let max=index.length-1;let mid=0;if(index.length===0){return-1}while(min>1;if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(rcd[index[mid]][prop],val,false)){min=mid+1}else{max=mid}}const lbound=min;if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["a"])(val,rcd[index[lbound]][prop])){return lbound}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,rcd[index[lbound]][prop],false)){return adaptive?lbound:lbound-1}return adaptive?lbound+1:lbound}_calculateRangeEnd(prop,val){const rcd=this._data;const index=this.binaryIndices[prop].values;let min=0;let max=index.length-1;let mid=0;if(index.length===0){return-1}while(min>1;if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,rcd[index[mid]][prop],false)){max=mid}else{min=mid+1}}const ubound=max;if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["a"])(val,rcd[index[ubound]][prop])){return ubound}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val,rcd[index[ubound]][prop],false)){return ubound+1}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["a"])(val,rcd[index[ubound-1]][prop])){return ubound-1}return ubound}calculateRange(op,prop,val){const rcd=this._data;const index=this.binaryIndices[prop].values;const min=0;const max=index.length-1;let lbound;let lval;let ubound;if(rcd.length===0){return[0,-1]}const minVal=rcd[index[min]][prop];const maxVal=rcd[index[max]][prop];switch(op){case"$eq":case"$aeq":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,minVal,false)||Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val,maxVal,false)){return[0,-1]}break;case"$dteq":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,minVal,false)||Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val,maxVal,false)){return[0,-1]}break;case"$gt":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val,maxVal,true)){return[0,-1]}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(minVal,val,false)){return[min,max]}break;case"$gte":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val,maxVal,false)){return[0,-1]}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(minVal,val,true)){return[min,max]}break;case"$lt":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,minVal,true)){return[0,-1]}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(maxVal,val,false)){return[min,max]}break;case"$lte":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val,minVal,false)){return[0,-1]}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(maxVal,val,true)){return[min,max]}break;case"$between":if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(val[0],maxVal,false)){return[0,-1]}if(Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(val[1],minVal,false)){return[0,-1]}lbound=this._calculateRangeStart(prop,val[0]);ubound=this._calculateRangeEnd(prop,val[1]);if(lbound<0)lbound++;if(ubound>max)ubound--;if(!Object(__WEBPACK_IMPORTED_MODULE_4__helper__["b"])(rcd[index[lbound]][prop],val[0],true))lbound++;if(!Object(__WEBPACK_IMPORTED_MODULE_4__helper__["c"])(rcd[index[ubound]][prop],val[1],true))ubound--;if(ubounddeepProperty(this._data[i],field,deep)){min=deepProperty(this._data[i],field,deep);result.index=this._data[i].$loki}}else{min=deepProperty(this._data[i],field,deep);result.index=this._data[i].$loki}}result.value=min;return result}extractNumerical(field){return this.extract(field).map(parseFloat).filter(Number).filter(n=>!isNaN(n))}avg(field){return average(this.extractNumerical(field))}stdDev(field){return standardDeviation(this.extractNumerical(field))}mode(field){const dict={};const data=this.extract(field);data.forEach(obj=>{if(dict[obj]){dict[obj]+=1}else{dict[obj]=1}});let max;let prop;let mode;for(prop in dict){if(max){if(maxa-b);const half=Math.floor(values.length/2);if(values.length%2){return values[half]}else{return(values[half-1]+values[half])/2}}}__webpack_exports__["a"]=Collection},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(1,eval)("this")}catch(e){if(typeof window==="object")g=window}module.exports=g},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__collection__=__webpack_require__(1);var __WEBPACK_IMPORTED_MODULE_1__clone__=__webpack_require__(4);var __WEBPACK_IMPORTED_MODULE_2__helper__=__webpack_require__(5);function resolveTransformObject(subObj,params,depth=0){if(++depth>=10){return subObj}for(const prop in subObj){if(typeof subObj[prop]==="string"&&subObj[prop].indexOf("[%lktxp]")===0){const pname=subObj[prop].substring(8);if(params[pname]!==undefined){subObj[prop]=params[pname]}}else if(typeof subObj[prop]==="object"){subObj[prop]=resolveTransformObject(subObj[prop],params,depth)}}return subObj}function resolveTransformParams(transform,params){if(params===undefined){return transform}const resolvedTransform=[];for(let idx=0;idxa.indexOf(b)!==-1}else if(typeof a==="object"&&a!==null){return b=>Object.hasOwnProperty.call(a,b)}return null}function doQueryOp(val,op){for(let p in op){if(Object.hasOwnProperty.call(op,p)){return LokiOps[p](val,op[p])}}return false}const LokiOps={$eq(a,b){return a===b},$aeq(a,b){return a==b},$ne(a,b){if(b!==b){return a===a}return a!==b},$dteq(a,b){return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["a"])(a,b)},$gt(a,b){return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["b"])(a,b,false)},$gte(a,b){return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["b"])(a,b,true)},$lt(a,b){return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["c"])(a,b,false)},$lte(a,b){return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["c"])(a,b,true)},$between(a,range){if(a===undefined||a===null)return false;return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["b"])(a,range[0],true)&&Object(__WEBPACK_IMPORTED_MODULE_2__helper__["c"])(a,range[1],true)},$in(a,b){return b.indexOf(a)!==-1},$nin(a,b){return b.indexOf(a)===-1},$keyin(a,b){return a in b},$nkeyin(a,b){return!(a in b)},$definedin(a,b){return b[a]!==undefined},$undefinedin(a,b){return b[a]===undefined},$regex(a,b){return b.test(a)},$containsString(a,b){return typeof a==="string"&&a.indexOf(b)!==-1},$containsNone(a,b){return!LokiOps.$containsAny(a,b)},$containsAny(a,b){const checkFn=containsCheckFn(a);if(checkFn!==null){return Array.isArray(b)?b.some(checkFn):checkFn(b)}return false},$contains(a,b){const checkFn=containsCheckFn(a);if(checkFn!==null){return Array.isArray(b)?b.every(checkFn):checkFn(b)}return false},$type(a,b){let type=typeof a;if(type==="object"){if(Array.isArray(a)){type="array"}else if(a instanceof Date){type="date"}}return typeof b!=="object"?type===b:doQueryOp(type,b)},$finite(a,b){return b===isFinite(a)},$size(a,b){if(Array.isArray(a)){return typeof b!=="object"?a.length===b:doQueryOp(a.length,b)}return false},$len(a,b){if(typeof a==="string"){return typeof b!=="object"?a.length===b:doQueryOp(a.length,b)}return false},$where(a,b){return b(a)===true},$not(a,b){return!doQueryOp(a,b)},$and(a,b){for(let idx=0,len=b.length;idx=paths.length){valueFound=fun(element,value)}else if(Array.isArray(element)){for(let index=0,len=element.length;index0){this._filteredRows=[]}this._filterInitialized=false;return this}toJSON(){const copy=this.copy();copy._collection=null;return copy}limit(qty){if(!this._filterInitialized&&this._filteredRows.length===0){this._filteredRows=this._collection._prepareFullDocIndex()}this._filteredRows=this._filteredRows.slice(0,qty);this._filterInitialized=true;return this}offset(pos){if(!this._filterInitialized&&this._filteredRows.length===0){this._filteredRows=this._collection._prepareFullDocIndex()}this._filteredRows=this._filteredRows.slice(pos);this._filterInitialized=true;return this}copy(){const result=new ResultSet(this._collection);result._filteredRows=this._filteredRows.slice();result._filterInitialized=this._filterInitialized;return result}branch(){return this.copy()}transform(transform,parameters){if(typeof transform==="string"){transform=this._collection.transforms[transform]}if(parameters!==undefined){transform=resolveTransformParams(transform,parameters)}let rs=this;for(let idx=0;idxcomparefun(data[a],data[b]);this._filteredRows.sort(wrappedComparer);return this}simplesort(propname,descending=false){if(!this._filterInitialized&&this._filteredRows.length===0){if(this._collection.binaryIndices[propname]!==undefined){this._collection.ensureIndex(propname);this._filteredRows=this._collection.binaryIndices[propname].values.slice(0);if(descending){this._filteredRows.reverse()}return this}else{this._filteredRows=this._collection._prepareFullDocIndex()}}const data=this._collection._data;const wrappedComparer=(a,b)=>{let val1,val2;if(~propname.indexOf(".")){const arr=propname.split(".");val1=arr.reduce(function(obj,i){return obj&&obj[i]||undefined},data[a]);val2=arr.reduce(function(obj,i){return obj&&obj[i]||undefined},data[b])}else{val1=data[a][propname];val2=data[b][propname]}return Object(__WEBPACK_IMPORTED_MODULE_2__helper__["d"])(val1,val2,descending)};this._filteredRows.sort(wrappedComparer);return this}compoundsort(properties){if(properties.length===0){throw new Error("Invalid call to compoundsort, need at least one property")}if(properties.length===1){const prop=properties[0];if(typeof prop==="string"){return this.simplesort(prop,false)}else{return this.simplesort(prop[0],prop[1])}}for(let i=0,len=properties.length;ithis._compoundeval(properties,data[a],data[b]);this._filteredRows.sort(wrappedComparer);return this}_compoundeval(properties,obj1,obj2){for(let i=0,len=properties.length;i{return obj&&obj[i]||undefined},obj1);val2=arr.reduce((obj,i)=>{return obj&&obj[i]||undefined},obj2)}else{val1=obj1[field];val2=obj2[field]}const res=Object(__WEBPACK_IMPORTED_MODULE_2__helper__["d"])(val1,val2,prop[1]);if(res!==0){return res}}return 0}sortByScoring(ascending=false){if(this._scoring===null){throw new Error("No scoring available")}if(ascending){this._filteredRows.sort((a,b)=>this._scoring[a].score-this._scoring[b].score)}else{this._filteredRows.sort((a,b)=>this._scoring[b].score-this._scoring[a].score)}return this}getScoring(){if(this._scoring===null){throw new Error("No scoring available")}return this._scoring}findOr(expressionArray){const docset=[];const idxset=[];const origCount=this.count();for(let ei=0,elen=expressionArray.length;ei1){return this.find({$and:filters},firstOnly)}}if(!property||queryObject==="getAll"){if(firstOnly){this._filteredRows=this._collection._data.length>0?[0]:[];this._filterInitialized=true}return this}if(property==="$and"||property==="$or"){this[property](queryObjectOp);if(firstOnly&&this._filteredRows.length>1){this._filteredRows=this._filteredRows.slice(0,1)}return this}let operator;if(queryObjectOp===null||(typeof queryObjectOp!=="object"||queryObjectOp instanceof Date)){operator="$eq";value=queryObjectOp}else if(typeof queryObjectOp==="object"){for(let key in queryObjectOp){if(queryObjectOp[key]!==undefined){operator=key;value=queryObjectOp[key];break}}}else{throw new Error("Do not know what you want to do.")}if(operator==="$regex"){if(Array.isArray(value)){value=new RegExp(value[0],value[1])}else if(!(value instanceof RegExp)){value=new RegExp(value)}}const usingDotNotation=property.indexOf(".")!==-1;const doIndexCheck=!usingDotNotation&&!this._filterInitialized;let searchByIndex=false;if(doIndexCheck&&this._collection.binaryIndices[property]&&indexedOps[operator]){if(this._collection.adaptiveBinaryIndices!==true){this._collection.ensureIndex(property)}searchByIndex=true}const fun=LokiOps[operator];const data=this._collection._data;let result=[];if(this._filterInitialized){let filter=this._filteredRows;if(usingDotNotation){property=property.split(".");for(let i=0;i({left:left,right:right}))}for(let j=0;jcv2)return false;return equal}if(cv1===cv1&&cv2!==cv2){return true}if(cv2===cv2&&cv1!==cv1){return false}if(prop1prop2)return false;if(prop1==prop2)return equal;cv1=prop1.toString();cv2=prop2.toString();if(cv1t2}}let cv1=Number(prop1);let cv2=Number(prop2);if(cv1===cv1&&cv2===cv2){if(cv1>cv2)return true;if(cv1prop2)return true;if(prop1cv2){return true}if(cv1==cv2){return equal}return false}function sortHelper(prop1,prop2,descending){if(aeqHelper(prop1,prop2)){return 0}if(ltHelper(prop1,prop2,false)){return descending?1:-1}if(gtHelper(prop1,prop2,false)){return descending?-1:1}return 0}},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){function getGlobal(){let glob;(function(global){glob=global})(global!==undefined&&global||this);return glob}function create(){const global=getGlobal();const sym=Symbol.for("LOKI");if(global[sym]===undefined){global[sym]={}}return global[sym]}const PLUGINS=create();__webpack_exports__["a"]=PLUGINS}).call(__webpack_exports__,__webpack_require__(2))},function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__loki__=__webpack_require__(8);var __WEBPACK_IMPORTED_MODULE_1__collection__=__webpack_require__(1);__webpack_require__.d(__webpack_exports__,"Loki",function(){return __WEBPACK_IMPORTED_MODULE_0__loki__["a"]});__webpack_require__.d(__webpack_exports__,"Collection",function(){return __WEBPACK_IMPORTED_MODULE_1__collection__["a"]});__WEBPACK_IMPORTED_MODULE_0__loki__["a"]["Collection"]=__WEBPACK_IMPORTED_MODULE_1__collection__["a"];__webpack_exports__["default"]=__WEBPACK_IMPORTED_MODULE_0__loki__["a"]},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){var __WEBPACK_IMPORTED_MODULE_0__event_emitter__=__webpack_require__(0);var __WEBPACK_IMPORTED_MODULE_1__collection__=__webpack_require__(1);var __WEBPACK_IMPORTED_MODULE_2__common_plugin__=__webpack_require__(6);function getENV(){if(global!==undefined&&(global["android"]||global["NSObject"])){return"NATIVESCRIPT"}const isNode=global!==undefined&&{}.toString.call(global)==="[object global]";if(isNode){if(global["window"]){return"NODEJS"}else{return"NODEJS"}}const isBrowser=window!==undefined&&{}.toString.call(window)==="[object Window]";if(document!==undefined){if(document.URL.indexOf("http://")===-1&&document.URL.indexOf("https://")===-1){return"CORDOVA"}return"BROWSER"}if(!isBrowser){throw SyntaxError("Unknown environment...")}}class Loki extends __WEBPACK_IMPORTED_MODULE_0__event_emitter__["a"]{constructor(filename="loki.db",options={}){super();this.filename=filename;this._collections=[];({serializationMethod:this._serializationMethod="normal",destructureDelimiter:this._destructureDelimiter="$<\n",verbose:this._verbose=false,env:this._env=getENV()}=options);this.databaseVersion=1.5;this.engineVersion=1.5;this._autosave=false;this._autosaveInterval=5e3;this._autosaveHandle=null;this._throttledSaves=true;this._persistenceMethod=null;this._persistenceAdapter=null;this._throttledSaveRunning=null;this._throttledSavePending=null;this.events={init:[],loaded:[],flushChanges:[],close:[],changes:[],warning:[]};this.on("init",this.clearChanges)}initializePersistence(options={}){({autosave:this._autosave=false,autosaveInterval:this._autosaveInterval=5e3,persistenceMethod:this._persistenceMethod,throttledSaves:this._throttledSaves=true}=options);const DEFAULT_PERSISTENCE={NODEJS:["fs-storage"],BROWSER:["local-storage","indexed-storage"],CORDOVA:["local-storage","indexed-storage"],MEMORY:["memory-storage"]};const PERSISTENCE_METHODS={"fs-storage":__WEBPACK_IMPORTED_MODULE_2__common_plugin__["a"]["FSStorage"],"local-storage":__WEBPACK_IMPORTED_MODULE_2__common_plugin__["a"]["LocalStorage"],"indexed-storage":__WEBPACK_IMPORTED_MODULE_2__common_plugin__["a"]["IndexedStorage"],"memory-storage":__WEBPACK_IMPORTED_MODULE_2__common_plugin__["a"]["MemoryStorage"]};if(this._persistenceMethod!==undefined){if(typeof PERSISTENCE_METHODS[this._persistenceMethod]==="function"){this._persistenceAdapter=new PERSISTENCE_METHODS[this._persistenceMethod]}else{throw Error("Unknown persistence method.")}}if(options.adapter!==undefined){this._persistenceMethod="adapter";this._persistenceAdapter=options.adapter}if(this._persistenceAdapter===null){let possiblePersistenceMethods=DEFAULT_PERSISTENCE[this._env];if(possiblePersistenceMethods){for(let i=0;i{if(this._autosave){this.autosaveEnable()}})}copy(options={}){const databaseCopy=new Loki(this.filename,{env:this._env});databaseCopy.loadJSONObject(this,{retainDirtyFlags:true});if(options.removeNonSerializable){databaseCopy._autosaveHandle=null;databaseCopy._persistenceAdapter=null;for(let idx=0;idx=0){return this.serializeCollection({delimited:options.delimited,delimiter:options.delimiter,collectionIndex:options.partition})}let dbcopy=new Loki(this.filename);dbcopy.loadJSONObject(this);for(let idx=0;idxcollCount){done=true}}else{cdb._collections[collIndex]._data.push(JSON.parse(workarray[lineIndex]))}workarray[lineIndex++]=null}return cdb}deserializeCollection(destructuredSource,options={}){if(options.partitioned===undefined){options.partitioned=false}if(options.delimited===undefined){options.delimited=true}if(options.delimiter===undefined){options.delimiter=this._destructureDelimiter}let workarray=[];if(options.delimited){workarray=destructuredSource.split(options.delimiter);workarray.pop()}else{workarray=destructuredSource}for(let idx=0;idx{this.emit("close")})}generateChangesNotification(arrayOfCollectionNames){let changes=[];const selectedCollections=arrayOfCollectionNames||this._collections.map(coll=>coll.name);this._collections.forEach(coll=>{if(selectedCollections.indexOf(coll.name)!==-1){changes=changes.concat(coll.getChanges())}});return changes}serializeChanges(collectionNamesArray){return JSON.stringify(this.generateChangesNotification(collectionNamesArray))}clearChanges(){this._collections.forEach(coll=>{if(coll.flushChanges){coll.flushChanges()}})}throttledSaveDrain(options={}){const now=(new Date).getTime();if(!this._throttledSaves){return Promise.resolve()}if(options.recursiveWait===undefined){options.recursiveWait=true}if(options.recursiveWaitLimit===undefined){options.recursiveWaitLimit=false}if(options.recursiveWaitLimitDuration===undefined){options.recursiveWaitLimitDuration=2e3}if(options.started===undefined){options.started=new Date}if(this._throttledSaves&&this._throttledSaveRunning!==null){if(options.recursiveWait){return Promise.resolve(Promise.all([this._throttledSaveRunning,this._throttledSavePending])).then(()=>{if(this._throttledSaveRunning!==null||this._throttledSavePending!==null){if(options.recursiveWaitLimit&&now-options.started.getTime()>options.recursiveWaitLimitDuration){return Promise.reject({})}return this.throttledSaveDrain(options)}else{return Promise.resolve()}})}else{return Promise.resolve(this._throttledSaveRunning)}}else{return Promise.resolve()}}_loadDatabase(options={}){if(this._persistenceAdapter===null){return Promise.reject(new Error("persistenceAdapter not configured"))}return Promise.resolve(this._persistenceAdapter.loadDatabase(this.filename)).then(dbString=>{if(typeof dbString==="string"){this.loadJSON(dbString,options);this.emit("load",this)}else{dbString=dbString;if(typeof dbString==="object"&&dbString!==null&&!(dbString instanceof Error)){this.loadJSONObject(dbString,options);this.emit("load",this)}else{if(dbString instanceof Error)throw dbString;throw new TypeError("The persistence adapter did not load a serialized DB string or object.")}}})}loadDatabase(options={}){if(!this._throttledSaves){return this._loadDatabase(options)}return this.throttledSaveDrain(options).then(()=>{this._throttledSaveRunning=this._loadDatabase(options).then(()=>{this._throttledSaveRunning=null});return this._throttledSaveRunning},()=>{throw new Error("Unable to pause save throttling long enough to read database")})}_saveDatabase(){if(this._persistenceAdapter===null){return Promise.reject(new Error("persistenceAdapter not configured"))}let saved;if(this._persistenceAdapter.mode==="reference"&&typeof this._persistenceAdapter.exportDatabase==="function"){saved=this._persistenceAdapter.exportDatabase(this.filename,this.copy({removeNonSerializable:true}))}else{saved=this._persistenceAdapter.saveDatabase(this.filename,this.serialize())}return Promise.resolve(saved).then(()=>{for(let idx=0;idx{this._throttledSaveRunning=null;this._throttledSavePending=null;return this.saveDatabase()})}if(this._throttledSavePending!==null){return this._throttledSavePending}this._throttledSaveRunning=this._saveDatabase().then(()=>{this._throttledSaveRunning=null});return this._throttledSaveRunning}deleteDatabase(){if(this._persistenceAdapter===null){return Promise.reject(new Error("persistenceAdapter not configured"))}return Promise.resolve(this._persistenceAdapter.deleteDatabase(this.filename))}autosaveEnable(){if(this._autosaveHandle){return}let running=true;this._autosave=true;this._autosaveHandle=(()=>{running=false;this._autosaveHandle=undefined});setTimeout(()=>{if(running){this.saveDatabase().then(this.saveDatabase,this.saveDatabase)}},this._autosaveInterval)}autosaveDisable(){this._autosave=false;if(this._autosaveHandle){this._autosaveHandle()}}}__webpack_exports__["a"]=Loki}).call(__webpack_exports__,__webpack_require__(2))},function(module,__webpack_exports__,__webpack_require__){"use strict";class UniqueIndex{constructor(propertyField){this._field=propertyField;this._keyMap={}}set(doc,row){const fieldValue=doc[this._field];if(fieldValue!==null&&fieldValue!==undefined){if(this._keyMap[fieldValue]!==undefined){throw new Error("Duplicate key for property "+this._field+": "+fieldValue)}else{this._keyMap[fieldValue]=row}}}get(index){return this._keyMap[index]}update(doc,row){const uniqueNames=Object.keys(this._keyMap);for(let i=0;i=0){this._filterPipeline[idx]=filter;return this.reapplyFilters()}this._cachedResultSet=null;if(this._persistent){this._resultData=[];this._resultDirty=true}this._addFilter(filter);if(this._sortFunction||this._sortCriteria||this._sortByScoring!==null){this._queueSortPhase()}else{this._queueRebuildEvent()}return this}applyFind(query,uid=""){this.applyFilter({type:"find",val:query,uid:uid});return this}applyWhere(fun,uid){this.applyFilter({type:"where",val:fun,uid:uid});return this}removeFilter(uid){const idx=this._indexOfFilterWithId(uid);if(idx<0){throw new Error("Dynamic view does not contain a filter with ID: "+uid)}this._filterPipeline.splice(idx,1);this.reapplyFilters();return this}count(){if(this._resultDirty){this._resultData=this._resultSet.data()}return this._resultSet.count()}data(options={}){if(this._sortDirty||this._resultDirty){this._performSortPhase({suppressRebuildEvent:true})}return this._persistent?this._resultData:this._resultSet.data(options)}_queueRebuildEvent(){if(this._rebuildPending){return}this._rebuildPending=true;setTimeout(()=>{if(this._rebuildPending){this._rebuildPending=false;this.emit("rebuild",this)}},this._minRebuildInterval)}_queueSortPhase(){if(this._sortDirty){return}this._sortDirty=true;if(this._sortPriority==="active"){setTimeout(()=>{this._performSortPhase()},this._minRebuildInterval)}else{this._queueRebuildEvent()}}_performSortPhase(options={}){if(!this._sortDirty&&!this._resultDirty){return}if(this._sortDirty){if(this._sortFunction){this._resultSet.sort(this._sortFunction)}else if(this._sortCriteria){this._resultSet.compoundsort(this._sortCriteria)}else if(this._sortByScoring!==null){this._resultSet.sortByScoring(this._sortByScoring)}this._sortDirty=false}if(this._persistent){this._resultData=this._resultSet.data();this._resultDirty=false}if(!options.suppressRebuildEvent){this.emit("rebuild",this)}}_evaluateDocument(objIndex,isNew){if(!this._resultSet._filterInitialized){if(this._persistent){this._resultData=this._resultSet.data()}if(this._sortFunction||this._sortCriteria){this._queueSortPhase()}else{this._queueRebuildEvent()}return}const ofr=this._resultSet._filteredRows;const oldPos=isNew?-1:ofr.indexOf(+objIndex);const oldlen=ofr.length;const evalResultSet=new __WEBPACK_IMPORTED_MODULE_1__result_set__["a"](this._collection);evalResultSet._filteredRows=[objIndex];evalResultSet._filterInitialized=true;let filter;for(let idx=0,len=this._filterPipeline.length;idxobjIndex){ofr[idx]--}}}mapReduce(mapFunction,reduceFunction){try{return reduceFunction(this.data().map(mapFunction))}catch(err){throw err}}}__webpack_exports__["a"]=DynamicView}])}); \ No newline at end of file diff --git a/dist/packages/loki/types/common/types.d.ts b/dist/packages/loki/types/common/types.d.ts index 846847e6..b8a936c6 100644 --- a/dist/packages/loki/types/common/types.d.ts +++ b/dist/packages/loki/types/common/types.d.ts @@ -1,10 +1,13 @@ -export declare type ANY = any; +/** + * @hidden + */ +import { Loki } from "../loki/src"; export interface StorageAdapter { loadDatabase(dbname: string): Promise; saveDatabase?(dbname: string, serialization: string): Promise; deleteDatabase?(dbname: string): Promise; mode?: string; - exportDatabase?(dbname: string, dbref: ANY): Promise; + exportDatabase?(dbname: string, dbref: Loki): Promise; } export declare type Doc = T & { $loki: number; @@ -14,10 +17,3 @@ export interface Dict { [index: string]: T; [index: number]: T; } -export interface Query { -} -export interface Filter { - type: string; - val: Query | ((obj: E, index: number, array: E[]) => boolean); - uid: number | string; -} diff --git a/dist/packages/loki/types/fs-storage/src/fs_storage.d.ts b/dist/packages/loki/types/fs-storage/src/fs_storage.d.ts index a92567ea..9930c0d0 100644 --- a/dist/packages/loki/types/fs-storage/src/fs_storage.d.ts +++ b/dist/packages/loki/types/fs-storage/src/fs_storage.d.ts @@ -2,7 +2,7 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists using node fs module. */ -export declare class LokiFSStorage implements StorageAdapter { +export declare class FSStorage implements StorageAdapter { /** * Registers the fs storage as plugin. */ @@ -32,4 +32,3 @@ export declare class LokiFSStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiFSStorage; diff --git a/dist/packages/loki/types/fs-storage/src/index.d.ts b/dist/packages/loki/types/fs-storage/src/index.d.ts new file mode 100644 index 00000000..e6b33d6c --- /dev/null +++ b/dist/packages/loki/types/fs-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { FSStorage } from "./fs_storage"; +export { FSStorage }; +export default FSStorage; diff --git a/dist/packages/loki/types/full-text-search-language-de/src/index.d.ts b/dist/packages/loki/types/full-text-search-language-de/src/index.d.ts new file mode 100644 index 00000000..a2665427 --- /dev/null +++ b/dist/packages/loki/types/full-text-search-language-de/src/index.d.ts @@ -0,0 +1,3 @@ +import { DE } from "./de"; +export { DE }; +export default DE; diff --git a/dist/packages/loki/types/full-text-search-language-en/src/index.d.ts b/dist/packages/loki/types/full-text-search-language-en/src/index.d.ts new file mode 100644 index 00000000..8313cf98 --- /dev/null +++ b/dist/packages/loki/types/full-text-search-language-en/src/index.d.ts @@ -0,0 +1,3 @@ +import { EN } from "./en"; +export { EN }; +export default EN; diff --git a/dist/packages/loki/types/full-text-search-language/src/index.d.ts b/dist/packages/loki/types/full-text-search-language/src/index.d.ts new file mode 100644 index 00000000..e52d1a42 --- /dev/null +++ b/dist/packages/loki/types/full-text-search-language/src/index.d.ts @@ -0,0 +1 @@ +export { generateStopWordFilter, generateTrimmer, Among, SnowballProgram } from "./language"; diff --git a/dist/packages/loki/types/full-text-search/src/full_text_search.d.ts b/dist/packages/loki/types/full-text-search/src/full_text_search.d.ts index a4752c88..65a26bef 100644 --- a/dist/packages/loki/types/full-text-search/src/full_text_search.d.ts +++ b/dist/packages/loki/types/full-text-search/src/full_text_search.d.ts @@ -2,7 +2,7 @@ import { InvertedIndex } from "./inverted_index"; import { Tokenizer } from "./tokenizer"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; export declare class FullTextSearch { private _id; private _docs; @@ -21,14 +21,14 @@ export declare class FullTextSearch { * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized * (requires more memory but performs better) * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field - * @param {string=$loki} id - the property name of the document index + * @param {string} [id] - the property name of the document index */ constructor(fields?: FullTextSearch.FieldOptions[], id?: string); addDocument(doc: object, id?: number): void; removeDocument(doc: object, id?: number): void; updateDocument(doc: object, id?: number): void; clear(): void; - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; toJSON(): FullTextSearch.Serialization; static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers?: Dict): FullTextSearch; } diff --git a/dist/packages/loki/types/full-text-search/src/index.d.ts b/dist/packages/loki/types/full-text-search/src/index.d.ts index f03dde09..b901b108 100644 --- a/dist/packages/loki/types/full-text-search/src/index.d.ts +++ b/dist/packages/loki/types/full-text-search/src/index.d.ts @@ -1,6 +1,5 @@ import { FullTextSearch } from "./full_text_search"; -export { Tokenizer } from "./tokenizer"; -export { QueryBuilder } from "./query_builder"; -export { InvertedIndex } from "./inverted_index"; -export { FullTextSearch }; +import { Tokenizer } from "./tokenizer"; +import { QueryBuilder } from "./query_builder"; +export { FullTextSearch, Tokenizer, QueryBuilder }; export default FullTextSearch; diff --git a/dist/packages/loki/types/full-text-search/src/index_searcher.d.ts b/dist/packages/loki/types/full-text-search/src/index_searcher.d.ts index d3cf7f93..00b99f2f 100644 --- a/dist/packages/loki/types/full-text-search/src/index_searcher.d.ts +++ b/dist/packages/loki/types/full-text-search/src/index_searcher.d.ts @@ -1,4 +1,4 @@ -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; import { InvertedIndex } from "./inverted_index"; import { Query } from "./query_builder"; import { Dict } from "../../common/types"; @@ -13,9 +13,9 @@ export declare class IndexSearcher { * @param {object} invIdxs */ constructor(invIdxs: Dict, docs: Set); - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; setDirty(): void; private _recursive(query, doScoring); - private _getUnique(queries, doScoring, docResults); + private _getUnique(queries, doScoring, queryResults); private _getAll(queries, doScoring); } diff --git a/dist/packages/loki/types/full-text-search/src/query_builder.d.ts b/dist/packages/loki/types/full-text-search/src/query_builder.d.ts index 923317f6..6f324e15 100644 --- a/dist/packages/loki/types/full-text-search/src/query_builder.d.ts +++ b/dist/packages/loki/types/full-text-search/src/query_builder.d.ts @@ -24,8 +24,8 @@ export declare class BaseQueryBuilder { */ build(): any; } -export interface BaseQuery { - type: string; +export interface BaseQuery { + type: Type; boost?: number; } /** @@ -51,7 +51,7 @@ export declare class TermQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, term: string, data?: any); } -export interface TermQuery extends BaseQuery { +export interface TermQuery extends BaseQuery<"term"> { field: string; value: string; } @@ -78,7 +78,7 @@ export declare class TermsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, terms: Array, data?: any); } -export interface TermsQuery extends BaseQuery { +export interface TermsQuery extends BaseQuery<"terms"> { field: string; value: string[]; } @@ -119,7 +119,7 @@ export declare class WildcardQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface WildcardQuery extends BaseQuery { +export interface WildcardQuery extends BaseQuery<"wildcard"> { field: string; value: string; enable_scoring?: boolean; @@ -169,7 +169,7 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { * * @return {FuzzyQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the initial word length. * @param {number} prefixLength - the positive prefix length @@ -183,10 +183,10 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface FuzzyQuery extends BaseQuery { +export interface FuzzyQuery extends BaseQuery<"fuzzy"> { field: string; value: string; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -221,7 +221,7 @@ export declare class PrefixQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface PrefixQuery extends BaseQuery { +export interface PrefixQuery extends BaseQuery<"prefix"> { field: string; value: string; enable_scoring?: boolean; @@ -247,7 +247,7 @@ export declare class ExistsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, data?: any); } -export interface ExistsQuery extends BaseQuery { +export interface ExistsQuery extends BaseQuery<"exists"> { field: string; } /** @@ -315,7 +315,7 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { * * @return {MatchQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the starting word length which should not be considered for fuzziness. * @param {number} prefixLength - the positive prefix length @@ -329,12 +329,12 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface MatchQuery extends BaseQuery { +export interface MatchQuery extends BaseQuery<"match"> { field: string; value: string; minimum_should_match?: number; operator?: "and" | "or"; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -360,7 +360,7 @@ export interface MatchQuery extends BaseQuery { export declare class MatchAllQueryBuilder extends BaseQueryBuilder { constructor(data?: any); } -export interface MatchQueryAll extends BaseQuery { +export interface MatchQueryAll extends BaseQuery<"match_all"> { } /** * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter. @@ -388,9 +388,11 @@ export declare class ConstantScoreQueryBuilder extends BaseQueryBuilder { * Starts an array of queries. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): ConstantScoreQueryBuilder; + }; } -export interface ConstantScoreQuery extends BaseQuery { +export interface ConstantScoreQuery extends BaseQuery<"constant_score"> { filter: ArrayQuery; } /** @@ -442,22 +444,30 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { * Starts an array of queries for must clause. Use endMust() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginMust(): ArrayQueryBuilder; + beginMust(): ArrayQueryBuilder & { + endMust(): BoolQueryBuilder; + }; /** * Starts an array of queries for filter clause. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): BoolQueryBuilder; + }; /** * Starts an array of queries for should clause. Use endShould() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginShould(): ArrayQueryBuilder; + beginShould(): ArrayQueryBuilder & { + endShould(): BoolQueryBuilder; + }; /** * Starts an array of queries for not clause. Use endNot() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginNot(): ArrayQueryBuilder; + beginNot(): ArrayQueryBuilder & { + endNot(): BoolQueryBuilder; + }; /** * Controls the amount of minimum matching sub queries before a document will be considered. * @param {number} minShouldMatch - number of minimum matching sub queries @@ -472,7 +482,7 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { */ minimumShouldMatch(minShouldMatch: number): this; } -export interface BoolQuery extends BaseQuery { +export interface BoolQuery extends BaseQuery<"bool"> { must?: ArrayQuery; filter?: ArrayQuery; should?: ArrayQuery; @@ -497,8 +507,8 @@ export declare class ArrayQueryBuilder extends BaseQueryBuilder { prefix(field: string, prefix: string): any; exists(field: string): any; } -export interface ArrayQuery { - values: any[]; +export interface ArrayQuery extends BaseQuery<"array"> { + values: QueryTypes[]; } /** * This query builder is the root of each query search. @@ -525,9 +535,15 @@ export declare class QueryBuilder { /** * The query performs a final scoring over all scored sub queries. * @param {boolean} enable - flag to enable or disable final scoring - * @return {QueryBuilder} + * @return {this} */ enableFinalScoring(enable: boolean): this; + /** + * Adds an explanation of the scoring of each document for all matched terms. + * @param {boolean} enable -flag to enable or disable explanation + * @returns {this} + */ + explain(enable: boolean): this; /** * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model. * @@ -535,10 +551,10 @@ export declare class QueryBuilder { * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}. * * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation. - * Lower values result in quicker saturation, and higher values in slower saturation. + * Lower values result in quicker saturation, and higher values in slower saturation * @param {number} [b=0.75] - controls how much effect field-length normalization should have. - * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully. - * @return {QueryBuilder} + * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully + * @return {this} */ BM25Similarity(k1?: number, b?: number): this; bool(): BoolQueryBuilder; @@ -553,9 +569,11 @@ export declare class QueryBuilder { exists(field: string): ExistsQueryBuilder; private _prepare(queryType, ...args); } +export declare type QueryTypes = BoolQuery | ConstantScoreQuery | TermQuery | TermsQuery | WildcardQuery | FuzzyQuery | MatchQuery | MatchQueryAll | PrefixQuery | ExistsQuery; export interface Query { - query: any; + query: QueryTypes; final_scoring?: boolean; + explain?: boolean; bm25?: { k1: number; b: number; diff --git a/dist/packages/loki/types/full-text-search/src/scorer.d.ts b/dist/packages/loki/types/full-text-search/src/scorer.d.ts index aed3e619..dacdc753 100644 --- a/dist/packages/loki/types/full-text-search/src/scorer.d.ts +++ b/dist/packages/loki/types/full-text-search/src/scorer.d.ts @@ -1,7 +1,6 @@ import { InvertedIndex } from "./inverted_index"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -export declare type ScoreResult = Dict; /** * @hidden */ @@ -10,9 +9,9 @@ export declare class Scorer { private _cache; constructor(invIdxs: Dict); setDirty(): void; - score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, docResults: Scorer.DocResults, term: number[]): void; - scoreConstant(boost: number, docId: number, docResults: Scorer.DocResults): Map; - finalScore(query: Query, docResults: Scorer.DocResults): ScoreResult; + score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, queryResults: Scorer.QueryResults, term: number[]): void; + scoreConstant(boost: number, docId: number, queryResults: Scorer.QueryResults): Map; + finalScore(query: Query, queryResults: Scorer.QueryResults): Scorer.ScoreResult; private static _calculateFieldLength(fieldLength); private _getCache(fieldName); /** @@ -30,12 +29,33 @@ export declare namespace Scorer { idfs: Dict; avgFieldLength: number; } - interface DocResult { + interface QueryResult { tf?: number; idf?: number; boost: number; fieldName?: string; term?: number[]; } - type DocResults = Map; + type QueryResults = Map; + interface BM25Explanation { + boost: number; + score: number; + docID: number; + fieldName: string; + index: string; + idf: number; + tfNorm: number; + tf: number; + fieldLength: number; + avgFieldLength: number; + } + interface ConstantExplanation { + boost: number; + score: number; + } + type ScoreExplanation = BM25Explanation | ConstantExplanation; + type ScoreResult = Dict<{ + score: number; + explanation?: ScoreExplanation[]; + }>; } diff --git a/dist/packages/loki/types/indexed-storage/src/index.d.ts b/dist/packages/loki/types/indexed-storage/src/index.d.ts new file mode 100644 index 00000000..bf453632 --- /dev/null +++ b/dist/packages/loki/types/indexed-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { IndexedStorage } from "./indexed_storage"; +export { IndexedStorage }; +export default IndexedStorage; diff --git a/dist/packages/loki/types/indexed-storage/src/indexed_storage.d.ts b/dist/packages/loki/types/indexed-storage/src/indexed_storage.d.ts index 457b01a0..adaeaef1 100644 --- a/dist/packages/loki/types/indexed-storage/src/indexed_storage.d.ts +++ b/dist/packages/loki/types/indexed-storage/src/indexed_storage.d.ts @@ -6,7 +6,7 @@ import { StorageAdapter } from "../../common/types"; * IndexedDb storage is provided per-domain, so we implement app/key/value database to * allow separate contexts for separate apps within a domain. */ -export declare class LokiIndexedStorage implements StorageAdapter { +export declare class IndexedStorage implements StorageAdapter { private _appname; private catalog; /** @@ -98,4 +98,4 @@ export interface Entry { key: string; size: number; } -export default LokiIndexedStorage; +export default IndexedStorage; diff --git a/dist/packages/loki/types/local-storage/src/index.d.ts b/dist/packages/loki/types/local-storage/src/index.d.ts new file mode 100644 index 00000000..2b74e8c0 --- /dev/null +++ b/dist/packages/loki/types/local-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { LocalStorage } from "./local_storage"; +export { LocalStorage }; +export default LocalStorage; diff --git a/dist/packages/loki/types/local-storage/src/local_storage.d.ts b/dist/packages/loki/types/local-storage/src/local_storage.d.ts index 2337eb12..380d8be9 100644 --- a/dist/packages/loki/types/local-storage/src/local_storage.d.ts +++ b/dist/packages/loki/types/local-storage/src/local_storage.d.ts @@ -1,9 +1,9 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists to web browser's local storage object - * @constructor LokiLocalStorageAdapter + * @constructor LocalStorageAdapter */ -export declare class LokiLocalStorage implements StorageAdapter { +export declare class LocalStorage implements StorageAdapter { /** * Registers the local storage as plugin. */ @@ -33,4 +33,4 @@ export declare class LokiLocalStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiLocalStorage; +export default LocalStorage; diff --git a/dist/packages/loki/types/loki/src/clone.d.ts b/dist/packages/loki/types/loki/src/clone.d.ts index 03b650d7..c74a17bd 100644 --- a/dist/packages/loki/types/loki/src/clone.d.ts +++ b/dist/packages/loki/types/loki/src/clone.d.ts @@ -1,10 +1,4 @@ -export declare enum CloneMethod { - PARSE_STRINGIFY = 0, - DEEP = 1, - SHALLOW = 2, - SHALLOW_ASSIGN = 3, - SHALLOW_RECURSE_OBJECTS = 4, -} +export declare type CloneMethod = "parse-stringify" | "deep" | "shallow" | "shallow-recurse-objects"; /** * @hidden */ diff --git a/dist/packages/loki/types/loki/src/collection.d.ts b/dist/packages/loki/types/loki/src/collection.d.ts index 8b44c82f..9bd5e091 100644 --- a/dist/packages/loki/types/loki/src/collection.d.ts +++ b/dist/packages/loki/types/loki/src/collection.d.ts @@ -1,34 +1,39 @@ import { LokiEventEmitter } from "./event_emitter"; import { UniqueIndex } from "./unique_index"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { DynamicView } from "./dynamic_view"; import { CloneMethod } from "./clone"; -import { Doc, Dict, Query } from "../../common/types"; +import { Doc, Dict } from "../../common/types"; import { FullTextSearch } from "../../full-text-search/src/full_text_search"; import { Tokenizer } from "../../full-text-search/src/tokenizer"; -export declare type ANY = any; export { CloneMethod } from "./clone"; /** * Collection class that handles documents of same type * @extends LokiEventEmitter + * @param - the data type + * @param - nested properties of data type */ -export declare class Collection extends LokiEventEmitter { +export declare class Collection extends LokiEventEmitter { name: string; - data: Doc[]; + _data: Doc[]; private idIndex; - binaryIndices: Dict; + binaryIndices: { + [P in keyof TData]?: Collection.BinaryIndex; + }; /** - * Unique contraints contain duplicate object references, so they are not persisted. - * We will keep track of properties which have unique contraint applied here, and regenerate on load. + * Unique constraints contain duplicate object references, so they are not persisted. + * We will keep track of properties which have unique constraints applied here, and regenerate on load. */ constraints: { - unique: {}; + unique: { + [P in keyof TData]?: UniqueIndex; + }; }; /** * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along * with the database. */ - transforms: {}; + transforms: Dict[]>; /** * In autosave scenarios we will use collection level dirty flags to determine whether save is needed. * currently, if any collection is dirty we will autosave the whole database if autosave is configured. @@ -62,7 +67,7 @@ export declare class Collection extends LokiEventEmit /** * Disable delta update object style on changes. */ - disableDeltaChangesApi: ANY; + disableDeltaChangesApi: boolean; /** * By default, if you insert a document into a collection with binary indices, if those indexed properties contain * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the @@ -72,7 +77,7 @@ export declare class Collection extends LokiEventEmit /** * Option to activate a cleaner daemon - clears "aged" documents at set intervals. */ - ttl: ANY; + ttl: Collection.TTL; private maxId; private _dynamicViews; /** @@ -81,7 +86,15 @@ export declare class Collection extends LokiEventEmit private changes; private insertHandler; private updateHandler; - console: ANY; + console: { + log(...args: any[]): void; + warn(...args: any[]): void; + error(...args: any[]): void; + }; + /** + * stages: a map of uniquely identified 'stages', which hold copies of objects to be + * manipulated without affecting the data in the original collection + */ private stages; private commitLog; _fullTextSearch: FullTextSearch; @@ -97,69 +110,50 @@ export declare class Collection extends LokiEventEmit * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable - * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method + * @param {string} [options.cloneMethod="deep"] - the clone method * @param {number} [options.transactional=false] - ? * @param {number} options.ttl - ? * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @see {@link Loki#addCollection} for normal creation of collections */ - constructor(name: string, options?: Collection.Options); - toJSON(): { - name: string; - _dynamicViews: DynamicView[]; - uniqueNames: string[]; - transforms: {}; - binaryIndices: Dict; - data: Doc[]; - idIndex: number[]; - maxId: number; - dirty: boolean; - adaptiveBinaryIndices: boolean; - transactional: boolean; - asyncListeners: boolean; - disableChangesApi: boolean; - cloneObjects: boolean; - cloneMethod: CloneMethod; - changes: any[]; - _fullTextSearch: FullTextSearch; - }; - static fromJSONObject(obj: ANY, options?: Collection.DeserializeOptions): Collection; + constructor(name: string, options?: Collection.Options); + toJSON(): Collection.Serialized; + static fromJSONObject(obj: Collection.Serialized, options?: Collection.DeserializeOptions): Collection; /** * Adds a named collection transform to the collection * @param {string} name - name to associate with transform * @param {array} transform - an array of transformation 'step' objects to save into the collection */ - addTransform(name: string, transform: ANY[]): void; + addTransform(name: string, transform: Collection.Transform[]): void; /** * Retrieves a named transform from the collection. * @param {string} name - name of the transform to lookup. */ - getTransform(name: string): any; + getTransform(name: string): Collection.Transform[]; /** * Updates a named collection transform to the collection * @param {string} name - name to associate with transform * @param {object} transform - a transformation object to save into collection */ - setTransform(name: string, transform: ANY[]): void; + setTransform(name: string, transform: Collection.Transform[]): void; /** * Removes a named collection transform from the collection * @param {string} name - name of collection transform to remove */ removeTransform(name: string): void; - ttlDaemonFuncGen(): () => void; private setTTL(age, interval); /** * create a row filter that covers all documents in the collection */ - prepareFullDocIndex(): any[]; + _prepareFullDocIndex(): number[]; /** * Ensure binary index on a certain field * @param {string} property - name of property to create binary index on - * @param {boolean} force - (Optional) flag indicating whether to construct index immediately + * @param {boolean} [force=false] - flag indicating whether to construct index immediately */ - ensureIndex(property: string, force?: boolean): void; - getSequencedIndexValues(property: string): string; - ensureUniqueIndex(field: string): UniqueIndex; + ensureIndex(property: keyof TData, force?: boolean): void; + getSequencedIndexValues(property: keyof TData): string; + ensureUniqueIndex(field: keyof TData): UniqueIndex; /** * Ensure all binary indices */ @@ -171,11 +165,11 @@ export declare class Collection extends LokiEventEmit * @param {object} query - (optional) query object to count results of * @returns {number} number of documents in the collection */ - count(query?: object): number; + count(query?: ResultSet.Query & TNested>): number; /** * Rebuild idIndex */ - ensureId(): void; + private _ensureId(); /** * Add a dynamic view to the collection * @param {string} name - name of dynamic view to add @@ -185,7 +179,7 @@ export declare class Collection extends LokiEventEmit * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here) * @returns {DynamicView} reference to the dynamic view added **/ - addDynamicView(name: string, options?: DynamicView.Options): DynamicView; + addDynamicView(name: string, options?: DynamicView.Options): DynamicView; /** * Remove a dynamic view from the collection * @param {string} name - name of dynamic view to remove @@ -196,7 +190,7 @@ export declare class Collection extends LokiEventEmit * @param {string} name - name of dynamic view to retrieve reference of * @returns {DynamicView} A reference to the dynamic view with that name **/ - getDynamicView(name: string): DynamicView; + getDynamicView(name: string): DynamicView; /** * Applies a 'mongo-like' find query object and passes all results to an update function. * For filter function querying you should migrate to [ @@ -205,38 +199,39 @@ export declare class Collection extends LokiEventEmit * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode) * @param {function} updateFunction - update function to run against filtered documents */ - findAndUpdate(filterObject: Query | ((obj: E) => boolean), updateFunction: (obj: E) => E): void; + findAndUpdate(filterObject: ResultSet.Query & TNested> | ((obj: Doc) => boolean), updateFunction: (obj: Doc) => any): void; /** * Applies a 'mongo-like' find query object removes all documents which match that filter. * * @param {object} filterObject - 'mongo-like' query object */ - findAndRemove(filterObject: object): void; + findAndRemove(filterObject: ResultSet.Query & TNested>): void; /** * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc. * @param {(object|array)} doc - the document (or array of documents) to be inserted * @returns {(object|array)} document or documents inserted */ - insert(doc: E | E[]): Doc; - insert(doc: E[]): Doc[]; + insert(doc: TData): Doc; + insert(doc: TData[]): Doc[]; /** * Adds a single object, ensures it has meta properties, clone it if necessary, etc. * @param {object} doc - the document to be inserted * @param {boolean} bulkInsert - quiet pre-insert and insert event emits * @returns {object} document or 'undefined' if there was a problem inserting it */ - insertOne(doc: E, bulkInsert?: boolean): Doc; + insertOne(doc: TData, bulkInsert?: boolean): Doc; /** * Empties the collection. - * @param {object} options - configure clear behavior - * @param {boolean} options.removeIndices - (default: false) + * @param {boolean} [removeIndices=false] - remove indices */ - clear(options?: ANY): void; + clear({removeIndices: removeIndices}?: { + removeIndices?: boolean; + }): void; /** * Updates an object and notifies collection that the document has changed. * @param {object} doc - document to update within the collection */ - update(doc: ANY): any; + update(doc: Doc | Doc[]): void; /** * Add object to collection */ @@ -247,24 +242,24 @@ export declare class Collection extends LokiEventEmit * @param {function} filterFunction - filter function whose results will execute update * @param {function} updateFunction - update function to run against filtered documents */ - updateWhere(filterFunction: (obj: E) => boolean, updateFunction: (obj: E) => E): void; + updateWhere(filterFunction: (obj: Doc) => boolean, updateFunction: (obj: Doc) => any): void; /** * Remove all documents matching supplied filter function. * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}. * @param {function|object} query - query object to filter on */ - removeWhere(query: Query | ((obj: E) => boolean)): void; + removeWhere(query: ResultSet.Query & TNested> | ((obj: Doc) => boolean)): void; removeDataOnly(): void; /** * Remove a document from the collection - * @param {object} doc - document to remove from collection + * @param {number|object} doc - document to remove from collection */ - remove(doc: ANY): any; + remove(doc: number | Doc | Doc[]): void; /** * Returns all changes. - * @returns {ANY} + * @returns {Collection.Change[]} */ - getChanges(): any[]; + getChanges(): Collection.Change[]; /** * Enables/disables changes api. * @param {boolean} disableChangesApi @@ -301,34 +296,35 @@ export declare class Collection extends LokiEventEmit * @returns {(object|array|null)} Object reference if document was found, null if not, * or an array if 'returnPosition' was passed. */ - get(id: number): Doc; - get(id: number, returnPosition: boolean): Doc | [Doc, number]; + get(id: number): Doc; + get(id: number, returnPosition: boolean): Doc | [Doc, number]; /** * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value * Since multiple documents may contain the same value (which the index is sorted on), * we hone in on range and then linear scan range to find exact index array position. - * @param {int} dataPosition : coll.data array index/position + * @param {int} dataPosition : data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - getBinaryIndexPosition(dataPosition: number, binaryIndexName: string): number; + getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData): number; /** * Adaptively insert a selected item to the index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively update a selected item within an index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively remove a selected item from the index. - * @param {int} dataPosition : coll.data array index/position + * @param {number} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in + * @param {boolean} removedFromIndexOnly - remove from index only */ - adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: string, removedFromIndexOnly?: boolean): ANY; + adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly?: boolean): void; /** * Internal method used for index maintenance and indexed searching. * Calculates the beginning of an index range for a given value. @@ -351,7 +347,7 @@ export declare class Collection extends LokiEventEmit private _calculateRangeEnd(prop, val); /** * Binary Search utility method to find range/segment of values matching criteria. - * this is used for collection.find() and first find filter of resultset/dynview + * this is used for collection.find() and first find filter of ResultSet/dynview * slightly different than get() binary search in that get() hones in on 1 value, * but we have to hone in on many (range) * @param {string} op - operation, such as $eq @@ -359,29 +355,29 @@ export declare class Collection extends LokiEventEmit * @param {object} val - value to use for range calculation. * @returns {array} [start, end] index array positions */ - calculateRange(op: string, prop: string, val: ANY): [number, number]; + calculateRange(op: string, prop: keyof TData, val: any): [number, number]; /** * Retrieve doc by Unique index * @param {string} field - name of uniquely indexed property to use when doing lookup * @param {any} value - unique value to search for * @returns {object} document matching the value passed */ - by(field: string, value: ANY): Doc; + by(field: string, value: any): Doc; /** * Find one object by index property, by property equal to value * @param {object} query - query object used to perform search with * @returns {(object|null)} First matching document, or null if none */ - findOne(query: object): Doc; + findOne(query: ResultSet.Query & TNested>): Doc; /** * Chain method, used for beginning a series of chained find() and/or view() operations * on a collection. * * @param {array} transform - Ordered array of transform step objects similar to chain * @param {object} parameters - Object containing properties representing parameters to substitute - * @returns {Resultset} (this) resultset, or data array if any map or join functions where called + * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called */ - chain(transform?: string | ANY[], parameters?: ANY): Resultset; + chain(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** * Find method, api is similar to mongodb. * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}. @@ -389,20 +385,26 @@ export declare class Collection extends LokiEventEmit * @param {object} query - 'mongo-like' query object * @returns {array} Array of matching documents */ - find(query?: Query): Doc[]; + find(query?: ResultSet.Query & TNested>): Doc[]; /** * Find object by unindexed field by property equal to value, * simply iterates and returns the first element matching the query */ - findOneUnindexed(prop: string, value: ANY): Doc; + findOneUnindexed(prop: string, value: any): Doc; /** * Transaction methods */ - /** start the transation */ + /** + * start the transation + */ startTransaction(): void; - /** commit the transation */ + /** + * commit the transation + */ commit(): void; - /** roll back the transation */ + /** + * roll back the transation + */ rollback(): void; /** * Query the collection by supplying a javascript filter function. @@ -414,14 +416,14 @@ export declare class Collection extends LokiEventEmit * @param {function} fun - filter function to run against all collection docs * @returns {array} all documents which pass your filter function */ - where(fun: (obj: E) => boolean): Doc[]; + where(fun: (obj: Doc) => boolean): Doc[]; /** * Map Reduce operation * @param {function} mapFunction - function to use as map function * @param {function} reduceFunction - function to use as reduce function * @returns {data} The result of your mapReduce operation */ - mapReduce(mapFunction: (value: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (value: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Join two collections on specified properties * @@ -429,13 +431,13 @@ export declare class Collection extends LokiEventEmit * @param {string} leftJoinProp - property name in collection * @param {string} rightJoinProp - property name in joinData * @param {function} mapFun - (Optional) map function to use - * @returns {Resultset} Result of the mapping operation - */ - eqJoin(joinData: ANY[], leftJoinProp: string, rightJoinProp: string, mapFun?: Function): Resultset; - /** - * stages: a map of uniquely identified 'stages', which hold copies of objects to be - * manipulated without affecting the data in the original collection + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method + * @returns {ResultSet} Result of the mapping operation */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinProp: string | ((obj: any) => string), rightJoinProp: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * (Staging API) create a stage and/or retrieve it */ @@ -446,7 +448,7 @@ export declare class Collection extends LokiEventEmit /** * (Staging API) create a copy of an object and insert it into a stage */ - stage(stageName: string, obj: ANY): any; + stage(stageName: string, obj: Doc): F; /** * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt * then create a message to be inserted in the commitlog @@ -459,10 +461,10 @@ export declare class Collection extends LokiEventEmit extract(field: string): any[]; /** */ - max(field: string): any; + max(field: string): number; /** */ - min(field: string): any; + min(field: string): number; /** */ maxRecord(field: string): { @@ -500,9 +502,9 @@ export declare class Collection extends LokiEventEmit median(field: string): number; } export declare namespace Collection { - interface Options { - unique?: string[]; - indices?: string[]; + interface Options { + unique?: (keyof TData)[]; + indices?: (keyof TData)[]; adaptiveBinaryIndices?: boolean; asyncListeners?: boolean; disableChangesApi?: boolean; @@ -518,10 +520,89 @@ export declare namespace Collection { interface DeserializeOptions { retainDirtyFlags?: boolean; fullTextSearch?: Dict; + [collName: string]: any | { + proto?: any; + inflate?: (src: object, dest?: object) => void; + }; } interface BinaryIndex { dirty: boolean; values: any; } - type Change = any; + interface Change { + name: string; + operation: string; + obj: any; + } + interface Serialized { + name: string; + _dynamicViews: DynamicView[]; + uniqueNames: string[]; + transforms: Dict; + binaryIndices: Dict; + _data: Doc[]; + idIndex: number[]; + maxId: number; + dirty: boolean; + adaptiveBinaryIndices: boolean; + transactional: boolean; + asyncListeners: boolean; + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + cloneObjects: boolean; + cloneMethod: CloneMethod; + changes: any; + _fullTextSearch: FullTextSearch; + } + type Transform = { + type: "find"; + value: ResultSet.Query & TNested> | string; + } | { + type: "where"; + value: ((obj: Doc) => boolean) | string; + } | { + type: "simplesort"; + property: keyof (TData & TNested); + desc?: boolean; + } | { + type: "compoundsort"; + value: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]; + } | { + type: "sort"; + value: (a: Doc, b: Doc) => number; + } | { + type: "sortByScoring"; + desc?: boolean; + } | { + type: "limit"; + value: number; + } | { + type: "offset"; + value: number; + } | { + type: "map"; + value: (obj: TData, index: number, array: TData[]) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "eqJoin"; + joinData: Collection | ResultSet; + leftJoinKey: string | ((obj: any) => string); + rightJoinKey: string | ((obj: any) => string); + mapFun?: (left: any, right: any) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "mapReduce"; + mapFunction: (item: TData, index: number, array: TData[]) => any; + reduceFunction: (array: any[]) => any; + } | { + type: "update"; + value: (obj: Doc) => any; + } | { + type: "remove"; + }; + interface TTL { + age: number; + ttlInterval: number; + daemon: any; + } } diff --git a/dist/packages/loki/types/loki/src/dynamic_view.d.ts b/dist/packages/loki/types/loki/src/dynamic_view.d.ts index 1aeab3a4..5cda4b13 100644 --- a/dist/packages/loki/types/loki/src/dynamic_view.d.ts +++ b/dist/packages/loki/types/loki/src/dynamic_view.d.ts @@ -1,9 +1,8 @@ import { LokiEventEmitter } from "./event_emitter"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { Collection } from "./collection"; -import { Doc, Filter } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; /** * DynamicView class is a versatile 'live' view class which can have filters and sorts applied. * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it @@ -18,18 +17,21 @@ export declare type ANY = any; * @extends LokiEventEmitter * @see {@link Collection#addDynamicView} to construct instances of DynamicView + * + * @param - the data type + * @param - nested properties of data type */ -export declare class DynamicView extends LokiEventEmitter { +export declare class DynamicView extends LokiEventEmitter { private _collection; private _persistent; private _sortPriority; private _minRebuildInterval; name: string; private _rebuildPending; - private _resultset; - private _resultdata; - private _resultsdirty; - private _cachedresultset; + private _resultSet; + private _resultData; + private _resultDirty; + private _cachedResultSet; private _filterPipeline; private _sortFunction; private _sortCriteria; @@ -41,10 +43,10 @@ export declare class DynamicView extends LokiEventEmi * @param {string} name - the name of this dynamic view * @param {object} options - the options * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' - * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority + * @param {string} [options.sortPriority="passive"] - the sort priority * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here) */ - constructor(collection: Collection, name: string, options?: DynamicView.Options); + constructor(collection: Collection, name: string, options?: DynamicView.Options); /** * Internally used immediately after deserialization (loading) * This will clear out and reapply filterPipeline ops, recreating the view. @@ -57,34 +59,22 @@ export declare class DynamicView extends LokiEventEmi */ _rematerialize({removeWhereFilters}: { removeWhereFilters?: boolean; - }): DynamicView; + }): this; /** - * Makes a copy of the internal resultset for branched queries. - * Unlike this dynamic view, the branched resultset will not be 'live' updated, + * Makes a copy of the internal ResultSet for branched queries. + * Unlike this dynamic view, the branched ResultSet will not be 'live' updated, * so your branched query should be immediately resolved and not held for future evaluation. * * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps * @param {object} parameters - optional parameters (if optional transform requires them) - * @returns {Resultset} A copy of the internal resultset for branched queries. + * @returns {ResultSet} A copy of the internal ResultSet for branched queries. */ - branchResultset(transform: string | any[], parameters?: object): Resultset; + branchResultSet(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** - * toJSON() - Override of toJSON to avoid circular references - * + * Override of toJSON to avoid circular references. */ - toJSON(): { - name: string; - _persistent: boolean; - _sortPriority: DynamicView.SortPriority; - _minRebuildInterval: number; - _resultset: Resultset; - _resultsdirty: boolean; - _filterPipeline: Filter[]; - _sortCriteria: (string | [string, boolean])[]; - _sortByScoring: boolean; - _sortDirty: boolean; - }; - static fromJSONObject(collection: ANY, obj: ANY): DynamicView; + toJSON(): DynamicView.Serialized; + static fromJSONObject(collection: Collection, obj: DynamicView.Serialized): DynamicView; /** * Used to clear pipeline and reset dynamic view to initial state. * Existing options should be retained. @@ -105,7 +95,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} comparefun - a javascript compare function used for sorting * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySort(comparefun: (lhs: E, rhs: E) => number): DynamicView; + applySort(comparefun: (lhs: Doc, rhs: Doc) => number): this; /** * Used to specify a property used for view translation. * @example @@ -115,9 +105,9 @@ export declare class DynamicView extends LokiEventEmi * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySimpleSort(propname: string, isdesc?: boolean): DynamicView; + applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * dv.applySortCriteria(['age', 'name']); @@ -129,32 +119,32 @@ export declare class DynamicView extends LokiEventEmi * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations. */ - applySortCriteria(criteria: (string | [string, boolean])[]): DynamicView; + applySortCriteria(criteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Used to apply a sort by the latest full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending */ - applySortByScoring(ascending?: boolean): DynamicView; + applySortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** * Marks the beginning of a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - startTransaction(): DynamicView; + startTransaction(): this; /** * Commits a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - commit(): DynamicView; + commit(): this; /** * Rolls back a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - rollback(): DynamicView; + rollback(): this; /** * Find the index of a filter in the pipeline, by that filter's ID. * @@ -163,7 +153,7 @@ export declare class DynamicView extends LokiEventEmi */ private _indexOfFilterWithId(uid); /** - * Add the filter object to the end of view's filter pipeline and apply the filter to the resultset. + * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet. * * @param {object} filter - The filter object. Refer to applyFilter() for extra details. */ @@ -173,7 +163,7 @@ export declare class DynamicView extends LokiEventEmi * * @returns {DynamicView} this DynamicView object, for further chain ops. */ - reapplyFilters(): DynamicView; + reapplyFilters(): this; /** * Adds or updates a filter in the DynamicView filter pipeline * @@ -181,7 +171,7 @@ export declare class DynamicView extends LokiEventEmi * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id } * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFilter(filter: Filter): DynamicView; + applyFilter(filter: DynamicView.Filter): this; /** * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline * @@ -189,7 +179,7 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFind(query: object, uid?: string | number): DynamicView; + applyFind(query: object, uid?: string | number): this; /** * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline * @@ -197,14 +187,14 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyWhere(fun: (obj: E) => boolean, uid?: string | number): DynamicView; + applyWhere(fun: (obj: Doc) => boolean, uid?: string | number): this; /** * removeFilter() - Remove the specified filter from the DynamicView filter pipeline * * @param {(string|number)} uid - The unique ID of the filter to be removed. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - removeFilter(uid: string | number): DynamicView; + removeFilter(uid: string | number): this; /** * Returns the number of documents representing the current DynamicView contents. * @returns {number} The number of documents representing the current DynamicView contents. @@ -213,16 +203,16 @@ export declare class DynamicView extends LokiEventEmi /** * Resolves and pending filtering and sorting, then returns document array as result. * - * @param {object} options - optional parameters to pass to resultset.data() if non-persistent - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * * @returns {Array} An array of documents representing the current DynamicView contents. */ - data(options?: object): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** * When the view is not sorted we may still wish to be notified of rebuild events. * This event will throttle and queue a single rebuild event when batches of updates affect the view. @@ -257,7 +247,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; } export declare namespace DynamicView { interface Options { @@ -265,8 +255,25 @@ export declare namespace DynamicView { sortPriority?: SortPriority; minRebuildInterval?: number; } - enum SortPriority { - PASSIVE = 0, - ACTIVE = 1, + type SortPriority = "passive" | "active"; + interface Serialized { + name: string; + _persistent: boolean; + _sortPriority: SortPriority; + _minRebuildInterval: number; + _resultSet: ResultSet; + _filterPipeline: Filter[]; + _sortCriteria: (string | [string, boolean])[]; + _sortByScoring: boolean; + _sortDirty: boolean; } + type Filter = { + type: "find"; + val: ResultSet.Query & TNested>; + uid: number | string; + } | { + type: "where"; + val: (obj: Doc) => boolean; + uid: number | string; + }; } diff --git a/dist/packages/loki/types/loki/src/event_emitter.d.ts b/dist/packages/loki/types/loki/src/event_emitter.d.ts index f422ee35..e55515e9 100644 --- a/dist/packages/loki/types/loki/src/event_emitter.d.ts +++ b/dist/packages/loki/types/loki/src/event_emitter.d.ts @@ -1,4 +1,3 @@ -export declare type ANY = any; /** * LokiEventEmitter is a minimalist version of EventEmitter. It enables any * constructor that inherits EventEmitter to emit events and trigger @@ -31,7 +30,7 @@ export declare class LokiEventEmitter { * @param {string} eventName - the name of the event * @param {object} data - optional object passed with the event */ - emit(eventName: string, ...data: ANY[]): void; + emit(eventName: string, ...data: any[]): void; /** * Alias of LokiEventEmitter.prototype.on * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event diff --git a/dist/packages/loki/types/loki/src/helper.d.ts b/dist/packages/loki/types/loki/src/helper.d.ts index 9a25de66..44b72305 100644 --- a/dist/packages/loki/types/loki/src/helper.d.ts +++ b/dist/packages/loki/types/loki/src/helper.d.ts @@ -1,8 +1,5 @@ /** - * @hidden - */ -export declare type ANY = any; -/** Helper function for determining 'loki' abstract equality which is a little more abstract than == + * Helper function for determining 'loki' abstract equality which is a little more abstract than == * aeqHelper(5, '5') === true * aeqHelper(5.0, '5') === true * aeqHelper(new Date("1/1/2011"), new Date("1/1/2011")) === true @@ -10,34 +7,33 @@ export declare type ANY = any; * aeqHelper([1, 2, 3], [1, 3]) === false * aeqHelper([1, 2, 3], [1, 2, 3]) === true * aeqHelper(undefined, null) === true - */ -/** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @returns {boolean} + * @hidden */ -export declare function aeqHelper(prop1: ANY, prop2: ANY): boolean; -/** Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. +export declare function aeqHelper(prop1: any, prop2: any): boolean; +/** + * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. * In the future we might want $lt and $gt ops to use their own functionality/helper. * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another. * @hidden */ -export declare function ltHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function ltHelper(prop1: any, prop2: any, equal: boolean): boolean; /** * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @param {boolean} equal * @returns {boolean} */ -export declare function gtHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function gtHelper(prop1: any, prop2: any, equal: boolean): boolean; /** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 - * @param {ANY} desc + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} descending * @returns {number} + * @hidden */ -export declare function sortHelper(prop1: ANY, prop2: ANY, desc: ANY): 1 | -1 | 0; +export declare function sortHelper(prop1: any, prop2: any, descending: boolean): number; diff --git a/dist/packages/loki/types/loki/src/index.d.ts b/dist/packages/loki/types/loki/src/index.d.ts index dee82236..17ee6df4 100644 --- a/dist/packages/loki/types/loki/src/index.d.ts +++ b/dist/packages/loki/types/loki/src/index.d.ts @@ -1,7 +1,4 @@ import { Loki } from "./loki"; import { Collection } from "./collection"; export { Loki, Collection }; -declare const _default: { - Loki: typeof Loki; -}; -export default _default; +export default Loki; diff --git a/dist/packages/loki/types/loki/src/loki.d.ts b/dist/packages/loki/types/loki/src/loki.d.ts index 10e81b65..f2deafd2 100644 --- a/dist/packages/loki/types/loki/src/loki.d.ts +++ b/dist/packages/loki/types/loki/src/loki.d.ts @@ -1,7 +1,6 @@ import { LokiEventEmitter } from "./event_emitter"; import { Collection } from "./collection"; import { Doc, StorageAdapter } from "../../common/types"; -export declare type ANY = any; export declare class Loki extends LokiEventEmitter { private filename; private databaseVersion; @@ -23,7 +22,7 @@ export declare class Loki extends LokiEventEmitter { * Constructs the main database class. * @param {string} filename - name of the file to be saved to * @param {object} [options={}] - options - * @param {Loki.Environment} [options.env=auto] - overrides environment detection + * @param {Loki.Environment} [options.env] - the javascript environment * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method * @param {string} [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization * @param {boolean} [options.verbose=false] - enable console output @@ -64,21 +63,21 @@ export declare class Loki extends LokiEventEmitter { * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @returns {Collection} a reference to the collection which was just added */ - addCollection(name: string, options?: Collection.Options): Collection; + addCollection(name: string, options?: Collection.Options): Collection; loadCollection(collection: Collection): void; /** * Retrieves reference to a collection by name. * @param {string} collectionName - name of collection to look up * @returns {Collection} Reference to collection in database by that name, or null if not found */ - getCollection(collectionName: string): Collection; + getCollection(collectionName: string): Collection; /** * Renames an existing loki collection * @param {string} oldName - name of collection to rename * @param {string} newName - new name of collection * @returns {Collection} reference to the newly renamed collection */ - renameCollection(oldName: string, newName: string): Collection<{}>; + renameCollection(oldName: string, newName: string): Collection; listCollections(): { name: string; count: number; @@ -95,20 +94,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {string} Stringified representation of the loki database. */ serialize(options?: Loki.SerializeOptions): string | string[]; - toJSON(): { - _env: Loki.Environment; - _serializationMethod: Loki.SerializationMethod; - _autosave: boolean; - _autosaveInterval: number; - _collections: Collection[]; - databaseVersion: number; - engineVersion: number; - filename: string; - _persistenceAdapter: StorageAdapter; - _persistenceMethod: Loki.PersistenceMethod; - _throttledSaves: boolean; - _verbose: boolean; - }; + toJSON(): Loki.Serialized; /** * Database level destructured JSON serialization routine to allow alternate serialization methods. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -134,7 +120,11 @@ export declare class Loki extends LokiEventEmitter { * * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection. */ - serializeCollection(options?: ANY): string | string[]; + serializeCollection(options?: { + delimited?: boolean; + collectionIndex?: number; + delimiter?: string; + }): string | string[]; /** * Database level destructured JSON deserialization routine to minimize memory overhead. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -150,7 +140,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array */ - deserializeDestructured(destructuredSource: ANY, options?: Loki.SerializeDestructuredOptions): any; + deserializeDestructured(destructuredSource: string | string[], options?: Loki.SerializeDestructuredOptions): any; /** * Collection level utility function to deserializes a destructured collection. * @@ -161,7 +151,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {Array} an array of documents to attach to collection.data. */ - deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc; + deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc[]; /** * Inflates a loki database from a serialized JSON string * @@ -169,15 +159,16 @@ export declare class Loki extends LokiEventEmitter { * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSON(serializedDb: string | string[], options?: ANY): void; + loadJSON(serializedDb: string | string[], options?: Collection.DeserializeOptions): void; /** * Inflates a loki database from a JS object * - * @param {object} dbObject - a serialized loki database string + * @param {object} dbObject - a serialized loki database object * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSONObject(dbObject: ANY, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki.Serialized, options?: Collection.DeserializeOptions): void; /** * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer. * Does not actually destroy the db. @@ -201,7 +192,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {Array} array of changes * @see private method _createChange() in Collection */ - generateChangesNotification(arrayOfCollectionNames?: string[]): any[]; + generateChangesNotification(arrayOfCollectionNames?: string[]): Collection.Change[]; /** * (Changes API) - stringify changes for network transmission * @returns {string} string representation of the changes @@ -310,24 +301,22 @@ export declare namespace Loki { recursiveWaitLimitDuration?: number; started?: Date; } - type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; - enum SerializationMethod { - NORMAL = 0, - PRETTY = 1, - DESTRUCTURED = 2, - } - enum PersistenceMethod { - FS_STORAGE = 0, - LOCAL_STORAGE = 1, - INDEXED_STORAGE = 2, - MEMORY_STORAGE = 3, - ADAPTER = 4, - } - enum Environment { - NODE_JS = 0, - NATIVE_SCRIPT = 1, - BROWSER = 2, - CORDOVA = 3, - MEMORY = 4, + interface Serialized { + _env: Environment; + _serializationMethod: SerializationMethod; + _autosave: boolean; + _autosaveInterval: number; + _collections: Collection[]; + databaseVersion: number; + engineVersion: number; + filename: string; + _persistenceAdapter: StorageAdapter; + _persistenceMethod: PersistenceMethod; + _throttledSaves: boolean; + _verbose: boolean; } + type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; + type SerializationMethod = "normal" | "pretty" | "destructured"; + type PersistenceMethod = "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter"; + type Environment = "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "MEMORY"; } diff --git a/dist/packages/loki/types/loki/src/memory_adapter.d.ts b/dist/packages/loki/types/loki/src/memory_adapter.d.ts deleted file mode 100644 index 7b97c7f7..00000000 --- a/dist/packages/loki/types/loki/src/memory_adapter.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { StorageAdapter } from "../../common/types"; -export declare type ANY = any; -/** - * In in-memory persistence adapter for an in-memory database. - * This simple 'key/value' adapter is intended for unit testing and diagnostics. - */ -export declare class LokiMemoryAdapter implements StorageAdapter { - private hashStore; - private options; - /** - * @param {object} options - memory adapter options - * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) - * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) - * @param {ANY} options - */ - constructor(options?: ANY); - /** - * Loads a serialized database from its in-memory store. - * (Loki persistence adapter interface function) - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was loaded - */ - loadDatabase(dbname: string): Promise; - /** - * Saves a serialized database to its in-memory store. - * (Loki persistence adapter interface function) - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was persisted - */ - saveDatabase(dbname: string, dbstring: string): Promise; - /** - * Deletes a database from its in-memory store. - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was deleted - */ - deleteDatabase(dbname: string): Promise; -} diff --git a/dist/packages/loki/types/loki/src/result_set.d.ts b/dist/packages/loki/types/loki/src/result_set.d.ts new file mode 100644 index 00000000..b29e3a52 --- /dev/null +++ b/dist/packages/loki/types/loki/src/result_set.d.ts @@ -0,0 +1,302 @@ +import { Collection } from "./collection"; +import { CloneMethod } from "./clone"; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; +import { Query as FullTextSearchQuery } from "../../full-text-search/src/query_builder"; +/** + * @hidden + */ +export declare const LokiOps: { + $eq(a: any, b: any): boolean; + $aeq(a: any, b: any): boolean; + $ne(a: any, b: any): boolean; + $dteq(a: any, b: any): boolean; + $gt(a: any, b: any): boolean; + $gte(a: any, b: any): boolean; + $lt(a: any, b: any): boolean; + $lte(a: any, b: any): boolean; + $between(a: any, range: [any, any]): boolean; + $in(a: any, b: any): boolean; + $nin(a: any, b: any): boolean; + $keyin(a: string, b: object): boolean; + $nkeyin(a: string, b: object): boolean; + $definedin(a: string, b: object): boolean; + $undefinedin(a: string, b: object): boolean; + $regex(a: string, b: RegExp): boolean; + $containsString(a: any, b: string): boolean; + $containsNone(a: any, b: any): boolean; + $containsAny(a: any, b: any): boolean; + $contains(a: any, b: any): boolean; + $type(a: any, b: any): boolean; + $finite(a: number, b: boolean): boolean; + $size(a: any, b: any): boolean; + $len(a: any, b: any): boolean; + $where(a: any, b: any): boolean; + $not(a: any, b: any): boolean; + $and(a: any, b: any): boolean; + $or(a: any, b: any): boolean; +}; +/** + * ResultSet class allowing chainable queries. Intended to be instanced internally. + * Collection.find(), Collection.where(), and Collection.chain() instantiate this. + * + * @example + * mycollection.chain() + * .find({ 'doors' : 4 }) + * .where(function(obj) { return obj.name === 'Toyota' }) + * .data(); + * + * @param - the data type + * @param - nested properties of data type + */ +export declare class ResultSet { + _collection: Collection; + _filteredRows: number[]; + _filterInitialized: boolean; + private _scoring; + /** + * Constructor. + * @param {Collection} collection - the collection which this ResultSet will query against + */ + constructor(collection: Collection); + /** + * reset() - Reset the ResultSet to its initial state. + * + * @returns {ResultSet} Reference to this ResultSet, for future chain operations. + */ + reset(): this; + /** + * Override of toJSON to avoid circular references + * + */ + toJSON(): ResultSet; + /** + * Allows you to limit the number of documents passed to next chain operation. + * A ResultSet copy() is made to avoid altering original ResultSet. + * + * @param {int} qty - The number of documents to return. + * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops. + */ + limit(qty: number): this; + /** + * Used for skipping 'pos' number of documents in the ResultSet. + * + * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. + * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops. + */ + offset(pos: number): this; + /** + * copy() - To support reuse of ResultSet in branched query situations. + * + * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same. + */ + copy(): ResultSet; + /** + * Alias of copy() + */ + branch(): ResultSet; + /** + * Executes a named collection transform or raw array of transform steps against the ResultSet. + * + * @param {(string|array)} transform - name of collection transform or raw transform array + * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. + * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps) + */ + transform(transform: string | Collection.Transform[], parameters?: object): this; + /** + * User supplied compare function is provided two documents to compare. (chainable) + * @example + * rslt.sort(function(obj1, obj2) { + * if (obj1.name === obj2.name) return 0; + * if (obj1.name > obj2.name) return 1; + * if (obj1.name < obj2.name) return -1; + * }); + * + * @param {function} comparefun - A javascript compare function used for sorting. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + sort(comparefun: (a: Doc, b: Doc) => number): this; + /** + * Simpler, loose evaluation for user to sort based on a property name. (chainable). + * Sorting based on the same lt/gt helper functions used for binary indices. + * + * @param {string} propname - name of property to sort by. + * @param {boolean} [descending=false] - if true, the property will be sorted in descending order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + simplesort(propname: keyof (TData & TNested), descending?: boolean): this; + /** + * Allows sorting a ResultSet based on multiple columns. + * @example + * // to sort by age and then name (both ascending) + * rs.compoundsort(['age', 'name']); + * // to sort by age (ascending) and then by name (descending) + * rs.compoundsort(['age', ['name', true]); + * + * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + compoundsort(properties: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; + /** + * Helper function for compoundsort(), performing individual object comparisons + * + * @param {Array} properties - array of property names, in order, by which to evaluate sort order + * @param {object} obj1 - first object to compare + * @param {object} obj2 - second object to compare + * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first + */ + private _compoundeval(properties, obj1, obj2); + /** + * Sorts the ResultSet based on the last full-text-search scoring. + * @param {boolean} [ascending=false] - sort ascending + * @returns {ResultSet} + */ + sortByScoring(ascending?: boolean): this; + /** + * Returns the scoring of the last full-text-search. + * @returns {ScoreResult} + */ + getScoring(): Scorer.ScoreResult; + /** + * Oversee the operation of OR'ed query expressions. + * OR'ed expression evaluation runs each expression individually against the full collection, + * and finally does a set OR on each expression's results. + * Each evaluation can utilize a binary index to prevent multiple linear array scans. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findOr(expressionArray: ResultSet.Query & TNested>[]): this; + $or(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Oversee the operation of AND'ed query expressions. + * AND'ed expression evaluation runs each expression progressively against the full collection, + * internally utilizing existing chained ResultSet functionality. + * Only the first filter can utilize a binary index. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findAnd(expressionArray: ResultSet.Query & TNested>[]): this; + $and(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Used for querying via a mongo-style query object. + * + * @param {object} query - A mongo-style query object used for filtering current results. + * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() + * @returns {ResultSet} this ResultSet for further chain ops. + */ + find(query?: ResultSet.Query & TNested>, firstOnly?: boolean): this; + /** + * Used for filtering via a javascript filter function. + * + * @param {function} fun - A javascript function used for filtering current results by. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + where(fun: (obj: Doc) => boolean): this; + /** + * Returns the number of documents in the ResultSet. + * @returns {number} The number of documents in the ResultSet. + */ + count(): number; + /** + * Terminates the chain and returns array of filtered documents + * @param {object} options + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when + * the collection is not configured for clone object. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values 'parse-stringify', 'deep', and 'shallow' and + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents + * + * @returns {Array} Array of documents in the ResultSet + */ + data(options?: ResultSet.DataOptions): Doc[]; + /** + * Used to run an update operation on all documents currently in the ResultSet. + * + * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + update(updateFunction: (obj: Doc) => TData): this; + /** + * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet) + * + * @returns {ResultSet} this (empty) ResultSet for further chain ops. + */ + remove(): this; + /** + * data transformation via user supplied functions + * + * @param {function} mapFunction - this function accepts a single document for you to transform and return + * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value + * @returns {value} The output of your reduceFunction + */ + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; + /** + * Left joining two sets of data. Join keys can be defined or calculated properties + * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key + * @param {Array|ResultSet|Collection} joinData - Data array to join to. + * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on + * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on + * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} + * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method + * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}] + */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinKey: string | ((obj: any) => string), rightJoinKey: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; + /** + * Applies a map function into a new collection for further chaining. + * @param {function} mapFun - javascript map function + * @param {object} [dataOptions=] - options to data() before input to your map function + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method + * @return {ResultSet} + */ + map(mapFun: (obj: TData, index: number, array: TData[]) => U, dataOptions?: ResultSet.DataOptions): ResultSet; +} +export declare namespace ResultSet { + interface DataOptions { + forceClones?: boolean; + forceCloneMethod?: CloneMethod; + removeMeta?: boolean; + } + type LokiOps = { + $eq?: R; + $aeq?: R; + $ne?: R; + $dteq?: R; + $gt?: R; + $gte?: R; + $lt?: R; + $lte?: R; + $between?: [R, R]; + $in?: R[]; + $nin?: R[]; + $keyin?: object; + $nkeyin?: object; + $definedin?: object; + $undefinedin?: object; + $regex?: RegExp | string | [string, string]; + $containsString?: string; + $containsNone?: R[] | R; + $containsAny?: R[] | R; + $contains?: any; + $type?: string; + $finite?: boolean; + $size?: number; + $len?: number; + $where?: (val?: R) => boolean; + }; + type Query = { + [P in keyof TData]?: LokiOps | TData[P]; + } & { + $and?: Query[]; + } & { + $or?: Query[]; + } & { + $fts?: FullTextSearchQuery; + }; +} diff --git a/dist/packages/loki/types/loki/src/resultset.d.ts b/dist/packages/loki/types/loki/src/resultset.d.ts deleted file mode 100644 index 8ee6b343..00000000 --- a/dist/packages/loki/types/loki/src/resultset.d.ts +++ /dev/null @@ -1,262 +0,0 @@ -import { Collection } from "./collection"; -import { CloneMethod } from "./clone"; -import { Doc, Query } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; -/** - * @hidden - */ -export declare const LokiOps: { - $eq(a: any, b: any): boolean; - $aeq(a: any, b: any): boolean; - $ne(a: any, b: any): boolean; - $dteq(a: any, b: any): boolean; - $gt(a: any, b: any): boolean; - $gte(a: any, b: any): boolean; - $lt(a: any, b: any): boolean; - $lte(a: any, b: any): boolean; - $between(a: any, vals: any): boolean; - $in(a: any, b: any): boolean; - $nin(a: any, b: any): boolean; - $keyin(a: any, b: any): boolean; - $nkeyin(a: any, b: any): boolean; - $definedin(a: any, b: any): boolean; - $undefinedin(a: any, b: any): boolean; - $regex(a: any, b: any): any; - $containsString(a: any, b: any): boolean; - $containsNone(a: any, b: any): boolean; - $containsAny(a: any, b: any): any; - $contains(a: any, b: any): any; - $type(a: any, b: any): any; - $finite(a: any, b: any): boolean; - $size(a: any, b: any): any; - $len(a: any, b: any): any; - $where(a: any, b: any): boolean; - $not(a: any, b: any): boolean; - $and(a: any, b: any): boolean; - $or(a: any, b: any): boolean; -}; -/** - * Resultset class allowing chainable queries. Intended to be instanced internally. - * Collection.find(), Collection.where(), and Collection.chain() instantiate this. - * - * @example - * mycollection.chain() - * .find({ 'doors' : 4 }) - * .where(function(obj) { return obj.name === 'Toyota' }) - * .data(); - */ -export declare class Resultset { - collection: Collection; - filteredrows: number[]; - filterInitialized: boolean; - private _scoring; - /** - * Constructor. - * @param {Collection} collection - the collection which this Resultset will query against - */ - constructor(collection: Collection); - /** - * reset() - Reset the resultset to its initial state. - * - * @returns {Resultset} Reference to this resultset, for future chain operations. - */ - reset(): Resultset; - /** - * toJSON() - Override of toJSON to avoid circular references - * - */ - toJSON(): Resultset; - /** - * Allows you to limit the number of documents passed to next chain operation. - * A resultset copy() is made to avoid altering original resultset. - * - * @param {int} qty - The number of documents to return. - * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops. - */ - limit(qty: number): Resultset; - /** - * Used for skipping 'pos' number of documents in the resultset. - * - * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. - * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. - */ - offset(pos: number): Resultset; - /** - * copy() - To support reuse of resultset in branched query situations. - * - * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same. - */ - copy(): Resultset; - /** - * Alias of copy() - */ - branch(): Resultset; - /** - * Executes a named collection transform or raw array of transform steps against the resultset. - * - * @param {(string|array)} transform - name of collection transform or raw transform array - * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. - * @returns {Resultset} either (this) resultset or a clone of of this resultset (depending on steps) - */ - transform(transform: string | any[], parameters?: object): Resultset; - /** - * User supplied compare function is provided two documents to compare. (chainable) - * @example - * rslt.sort(function(obj1, obj2) { - * if (obj1.name === obj2.name) return 0; - * if (obj1.name > obj2.name) return 1; - * if (obj1.name < obj2.name) return -1; - * }); - * - * @param {function} comparefun - A javascript compare function used for sorting. - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - sort(comparefun: (a: E, b: E) => number): Resultset; - /** - * Simpler, loose evaluation for user to sort based on a property name. (chainable). - * Sorting based on the same lt/gt helper functions used for binary indices. - * - * @param {string} propname - name of property to sort by. - * @param {boolean} isdesc - (Optional) If true, the property will be sorted in descending order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - simplesort(propname: string, isdesc?: boolean): Resultset; - /** - * Allows sorting a resultset based on multiple columns. - * @example - * // to sort by age and then name (both ascending) - * rs.compoundsort(['age', 'name']); - * // to sort by age (ascending) and then by name (descending) - * rs.compoundsort(['age', ['name', true]); - * - * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - compoundsort(properties: (string | [string, boolean])[]): Resultset; - /** - * Helper function for compoundsort(), performing individual object comparisons - * - * @param {Array} properties - array of property names, in order, by which to evaluate sort order - * @param {object} obj1 - first object to compare - * @param {object} obj2 - second object to compare - * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first - */ - private _compoundeval(properties, obj1, obj2); - /** - * Sorts the resultset based on the last full-text-search scoring. - * @param {boolean} [ascending=false] - sort ascending - * @returns {Resultset} - */ - sortByScoring(ascending?: boolean): Resultset; - /** - * Returns the scoring of the last full-text-search. - * @returns {ScoreResult} - */ - getScoring(): ScoreResult; - /** - * findOr() - oversee the operation of OR'ed query expressions. - * OR'ed expression evaluation runs each expression individually against the full collection, - * and finally does a set OR on each expression's results. - * Each evaluation can utilize a binary index to prevent multiple linear array scans. - * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. - */ - findOr(expressionArray: Query[]): Resultset; - $or(expressionArray: Query[]): Resultset; - /** - * findAnd() - oversee the operation of AND'ed query expressions. - * AND'ed expression evaluation runs each expression progressively against the full collection, - * internally utilizing existing chained resultset functionality. - * Only the first filter can utilize a binary index. - * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. - */ - findAnd(expressionArray: Query[]): Resultset; - $and(expressionArray: Query[]): Resultset; - /** - * Used for querying via a mongo-style query object. - * - * @param {object} query - A mongo-style query object used for filtering current results. - * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() - * @returns {Resultset} this resultset for further chain ops. - */ - find(query?: Query, firstOnly?: boolean): Resultset; - /** - * Used for filtering via a javascript filter function. - * - * @param {function} fun - A javascript function used for filtering current results by. - * @returns {Resultset} this resultset for further chain ops. - */ - where(fun: (obj: E) => boolean): Resultset; - /** - * Returns the number of documents in the resultset. - * @returns {number} The number of documents in the resultset. - */ - count(): number; - /** - * Terminates the chain and returns array of filtered documents - * @param {object} options - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when - * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents - * - * @returns {Array} Array of documents in the resultset - */ - data(options?: Resultset.DataOptions): Doc[]; - /** - * Used to run an update operation on all documents currently in the resultset. - * - * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. - * @returns {Resultset} this resultset for further chain ops. - */ - update(updateFunction: (obj: E) => E): Resultset; - /** - * Removes all document objects which are currently in resultset from collection (as well as resultset) - * - * @returns {Resultset} this (empty) resultset for further chain ops. - */ - remove(): Resultset; - /** - * data transformation via user supplied functions - * - * @param {function} mapFunction - this function accepts a single document for you to transform and return - * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value - * @returns {value} The output of your reduceFunction - */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; - /** - * Left joining two sets of data. Join keys can be defined or calculated properties - * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key - * @param {Array|Resultset|Collection} joinData - Data array to join to. - * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on - * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on - * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} - * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides - * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun - * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}] - */ - eqJoin(joinData: ANY, leftJoinKey: string | Function, rightJoinKey: string | Function, mapFun?: Function, dataOptions?: ANY): ANY; - /** - * Applies a map function into a new collection for further chaining. - * @param {function} mapFun - javascript map function - * @param {object} [dataOptions=] - options to data() before input to your map function - * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun - * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - */ - map(mapFun: (obj: E, index: number, array: E[]) => U, dataOptions?: Resultset.DataOptions): Resultset; -} -export declare namespace Resultset { - interface DataOptions { - forceClones?: boolean; - forceCloneMethod?: CloneMethod; - removeMeta?: boolean; - } -} diff --git a/dist/packages/loki/types/loki/src/unique_index.d.ts b/dist/packages/loki/types/loki/src/unique_index.d.ts index 40312618..55284c11 100644 --- a/dist/packages/loki/types/loki/src/unique_index.d.ts +++ b/dist/packages/loki/types/loki/src/unique_index.d.ts @@ -1,30 +1,30 @@ import { Doc } from "../../common/types"; -export declare class UniqueIndex { +export declare class UniqueIndex { private _field; private _keyMap; /** * Constructs an unique index object. * @param {number|string} propertyField - the property field to index */ - constructor(propertyField: number | string); + constructor(propertyField: keyof E); /** * Sets a document's unique index. * @param {Doc} doc - the document * @param {number} row - the data row of the document */ - set(doc: Doc, row: number): void; + set(doc: Doc, row: number): void; /** * Returns the data row of an unique index. * @param {number|string} index - the index * @returns {number | string} - the row */ - get(index: number | string): number; + get(index: keyof E): number; /** * Updates a document's unique index. * @param {Object} doc - the document * @param {number} row - the data row of the document */ - update(doc: Doc, row: number): void; + update(doc: Doc, row: number): void; /** * Removes an unique index. * @param {number|string} index - the unique index diff --git a/dist/packages/loki/types/memory-storage/src/index.d.ts b/dist/packages/loki/types/memory-storage/src/index.d.ts new file mode 100644 index 00000000..5330aa7d --- /dev/null +++ b/dist/packages/loki/types/memory-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { MemoryStorage } from "./memory_storage"; +export { MemoryStorage }; +export default MemoryStorage; diff --git a/dist/packages/loki/types/memory-storage/src/memory_storage.d.ts b/dist/packages/loki/types/memory-storage/src/memory_storage.d.ts new file mode 100644 index 00000000..0066a1de --- /dev/null +++ b/dist/packages/loki/types/memory-storage/src/memory_storage.d.ts @@ -0,0 +1,57 @@ +import { Dict, StorageAdapter } from "../../common/types"; +/** + * An in-memory persistence adapter for an in-memory database. + * This simple 'key/value' adapter is intended for unit testing and diagnostics. + */ +export declare class MemoryStorage implements StorageAdapter { + hashStore: Dict<{ + savecount: number; + lastsave: Date; + value: string; + }>; + options: MemoryStorage.Options; + /** + * Registers the local storage as plugin. + */ + static register(): void; + /** + * Deregisters the local storage as plugin. + */ + static deregister(): void; + /** + * @param {object} options - memory storage options + * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) + * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) + */ + constructor(options?: MemoryStorage.Options); + /** + * Loads a serialized database from its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was loaded + */ + loadDatabase(dbname: string): Promise; + /** + * Saves a serialized database to its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @param {string} dbstring - the database content + * @returns {Promise} a Promise that resolves after the database was persisted + */ + saveDatabase(dbname: string, dbstring: string): Promise; + /** + * Deletes a database from its in-memory store. + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was deleted + */ + deleteDatabase(dbname: string): Promise; +} +export declare namespace MemoryStorage { + interface Options { + asyncResponses?: boolean; + asyncTimeout?: number; + } +} diff --git a/dist/packages/loki/types/partitioning-adapter/src/index.d.ts b/dist/packages/loki/types/partitioning-adapter/src/index.d.ts new file mode 100644 index 00000000..bf49882f --- /dev/null +++ b/dist/packages/loki/types/partitioning-adapter/src/index.d.ts @@ -0,0 +1,3 @@ +import { PartitioningAdapter } from "./partitioning_adapter"; +export { PartitioningAdapter }; +export default PartitioningAdapter; diff --git a/dist/packages/loki/types/partitioning-adapter/src/partitioning_adapter.d.ts b/dist/packages/loki/types/partitioning-adapter/src/partitioning_adapter.d.ts index ff9568cf..45e14850 100644 --- a/dist/packages/loki/types/partitioning-adapter/src/partitioning_adapter.d.ts +++ b/dist/packages/loki/types/partitioning-adapter/src/partitioning_adapter.d.ts @@ -1,4 +1,5 @@ -import { ANY, StorageAdapter } from "../../common/types"; +import { Loki } from "../../loki/src/loki"; +import { StorageAdapter } from "../../common/types"; /** * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and @@ -9,7 +10,7 @@ import { ANY, StorageAdapter } from "../../common/types"; * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all * of that collection's pages will be written on next save. */ -export declare class LokiPartitioningAdapter implements StorageAdapter { +export declare class PartitioningAdapter implements StorageAdapter { mode: string; private _adapter; private _dbref; @@ -68,7 +69,7 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { * @returns {Promise} a Promise that resolves after the database was deleted * */ - exportDatabase(dbname: string, dbref: ANY): Promise; + exportDatabase(dbname: string, dbref: Loki): Promise; /** * Helper method used internally to save each dirty collection, one at a time. * @@ -82,11 +83,3 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { */ private _saveNextPage(); } -declare namespace LokiPartitioningAdapter { - interface PageIterator { - collection?: ANY; - docIndex?: number; - pageIndex?: number; - } -} -export default LokiPartitioningAdapter; diff --git a/dist/packages/memory-storage/lokijs.memory-storage.js b/dist/packages/memory-storage/lokijs.memory-storage.js new file mode 100644 index 00000000..e70955a7 --- /dev/null +++ b/dist/packages/memory-storage/lokijs.memory-storage.js @@ -0,0 +1,264 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["@lokijs/memory-storage"] = factory(); + else +{ root["@lokijs/memory-storage"] = factory(); root["LokiMemoryStorage"] = root["@lokijs/memory-storage"].default;} +})(typeof self !== 'undefined' ? self : this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__memory_storage__ = __webpack_require__(1); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MemoryStorage", function() { return __WEBPACK_IMPORTED_MODULE_0__memory_storage__["a"]; }); + + +/* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__memory_storage__["a" /* MemoryStorage */]); + + +/***/ }), +/* 1 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common_plugin__ = __webpack_require__(2); + +/** + * An in-memory persistence adapter for an in-memory database. + * This simple 'key/value' adapter is intended for unit testing and diagnostics. + */ +class MemoryStorage { + /** + * Registers the local storage as plugin. + */ + static register() { + __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["MemoryStorage"] = MemoryStorage; + } + /** + * Deregisters the local storage as plugin. + */ + static deregister() { + delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["MemoryStorage"]; + } + /** + * @param {object} options - memory storage options + * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) + * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) + */ + constructor(options) { + this.hashStore = {}; + this.options = options || {}; + if (this.options.asyncResponses === undefined) { + this.options.asyncResponses = false; + } + if (this.options.asyncTimeout === undefined) { + this.options.asyncTimeout = 50; // 50 ms default + } + } + /** + * Loads a serialized database from its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was loaded + */ + loadDatabase(dbname) { + if (this.options.asyncResponses) { + return new Promise((resolve, reject) => { + setTimeout(() => { + if (this.hashStore[dbname] !== undefined) { + resolve(this.hashStore[dbname].value); + } + else { + reject(new Error("unable to load database, " + dbname + " was not found in memory storage")); + } + }, this.options.asyncTimeout); + }); + } + else { + if (this.hashStore[dbname] !== undefined) { + return Promise.resolve(this.hashStore[dbname].value); + } + else { + return Promise.reject(new Error("unable to load database, " + dbname + " was not found in memory storage")); + } + } + } + /** + * Saves a serialized database to its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @param {string} dbstring - the database content + * @returns {Promise} a Promise that resolves after the database was persisted + */ + saveDatabase(dbname, dbstring) { + if (this.options.asyncResponses) { + return new Promise((resolve) => { + setTimeout(() => { + const saveCount = (this.hashStore[dbname] !== undefined ? this.hashStore[dbname].savecount : 0); + this.hashStore[dbname] = { + savecount: saveCount + 1, + lastsave: new Date(), + value: dbstring + }; + resolve(); + }, this.options.asyncTimeout); + return Promise.resolve(); + }); + } + else { + const saveCount = (this.hashStore[dbname] !== undefined ? this.hashStore[dbname].savecount : 0); + this.hashStore[dbname] = { + savecount: saveCount + 1, + lastsave: new Date(), + value: dbstring + }; + return Promise.resolve(); + } + } + /** + * Deletes a database from its in-memory store. + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was deleted + */ + deleteDatabase(dbname) { + delete this.hashStore[dbname]; + return Promise.resolve(); + } +} +/* harmony export (immutable) */ __webpack_exports__["a"] = MemoryStorage; + + + +/***/ }), +/* 2 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) {function getGlobal() { + let glob; + (function (global) { + glob = global; + })(global !== undefined && global || this); + return glob; +} +function create() { + const global = getGlobal(); + const sym = Symbol.for("LOKI"); + if (global[sym] === undefined) { + global[sym] = {}; + } + return global[sym]; +} +/** + * @hidden + */ +const PLUGINS = create(); +/* harmony export (immutable) */ __webpack_exports__["a"] = PLUGINS; + + +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(3))) + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }) +/******/ ]); +}); +//# sourceMappingURL=lokijs.memory-storage.js.map \ No newline at end of file diff --git a/dist/packages/memory-storage/lokijs.memory-storage.js.map b/dist/packages/memory-storage/lokijs.memory-storage.js.map new file mode 100644 index 00000000..09782fa2 --- /dev/null +++ b/dist/packages/memory-storage/lokijs.memory-storage.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 4e31006ae4dcb250b4e1","webpack:///./packages/memory-storage/src/index.ts","webpack:///./packages/memory-storage/src/memory_storage.ts","webpack:///./packages/common/plugin.ts","webpack:///(webpack)/buildin/global.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;AC7D+C;AAExB;AACvB,+DAAe,sEAAa,EAAC;;;;;;;;;ACHe;AAG5C;;;GAGG;AACG;IASJ;;OAEG;IACH,MAAM,CAAC,QAAQ;QACb,+DAAO,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU;QACf,OAAO,+DAA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hG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG;gBACvB,SAAS,EAAE,SAAS,GAAG,CAAC;gBACxB,QAAQ,EAAE,IAAI,IAAI,EAAE;gBACpB,KAAK,EAAE,QAAQ;aAChB,CAAC;YAEF,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,cAAc,CAAC,MAAc;QAClC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF;AAAA;AAAA;;;;;;;;AC7HD;IACE,IAAI,IAAI,CAAC;IACT,CAAC,UAAU,MAAM;QACf,IAAI,GAAG,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,IAAI,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,IAAI,CAAC;AACd,CAAC;AAGD;IACE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAQ,CAAC;IACtC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,EACb,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACI,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAAA;AAAA;;;;;;;;ACtBhC;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"lokijs.memory-storage.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/memory-storage\"] = factory();\n\telse\n\t\troot[\"@lokijs/memory-storage\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 4e31006ae4dcb250b4e1","import {MemoryStorage} from \"./memory_storage\";\n\nexport {MemoryStorage};\nexport default MemoryStorage;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/memory-storage/src/index.ts","import {PLUGINS} from \"../../common/plugin\";\nimport {Dict, StorageAdapter} from \"../../common/types\";\n\n/**\n * An in-memory persistence adapter for an in-memory database.\n * This simple 'key/value' adapter is intended for unit testing and diagnostics.\n */\nexport class MemoryStorage implements StorageAdapter {\n\n public hashStore: Dict<{\n savecount: number;\n lastsave: Date;\n value: string;\n }>;\n public options: MemoryStorage.Options;\n\n /**\n * Registers the local storage as plugin.\n */\n static register(): void {\n PLUGINS[\"MemoryStorage\"] = MemoryStorage;\n }\n\n /**\n * Deregisters the local storage as plugin.\n */\n static deregister(): void {\n delete PLUGINS[\"MemoryStorage\"];\n }\n\n /**\n * @param {object} options - memory storage options\n * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false)\n * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50)\n */\n constructor(options?: MemoryStorage.Options) {\n this.hashStore = {};\n this.options = options || {};\n\n if (this.options.asyncResponses === undefined) {\n this.options.asyncResponses = false;\n }\n\n if (this.options.asyncTimeout === undefined) {\n this.options.asyncTimeout = 50; // 50 ms default\n }\n }\n\n /**\n * Loads a serialized database from its in-memory store.\n * (Loki persistence adapter interface function)\n *\n * @param {string} dbname - name of the database (filename/keyname)\n * @returns {Promise} a Promise that resolves after the database was loaded\n */\n public loadDatabase(dbname: string): Promise {\n if (this.options.asyncResponses) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n if (this.hashStore[dbname] !== undefined) {\n resolve(this.hashStore[dbname].value);\n }\n else {\n reject(new Error(\"unable to load database, \" + dbname + \" was not found in memory storage\"));\n }\n }, this.options.asyncTimeout);\n });\n }\n else {\n if (this.hashStore[dbname] !== undefined) {\n return Promise.resolve(this.hashStore[dbname].value);\n }\n else {\n return Promise.reject(new Error(\"unable to load database, \" + dbname + \" was not found in memory storage\"));\n }\n }\n }\n\n /**\n * Saves a serialized database to its in-memory store.\n * (Loki persistence adapter interface function)\n *\n * @param {string} dbname - name of the database (filename/keyname)\n * @param {string} dbstring - the database content\n * @returns {Promise} a Promise that resolves after the database was persisted\n */\n public saveDatabase(dbname: string, dbstring: string): Promise {\n if (this.options.asyncResponses) {\n return new Promise((resolve) => {\n setTimeout(() => {\n const saveCount = (this.hashStore[dbname] !== undefined ? this.hashStore[dbname].savecount : 0);\n\n this.hashStore[dbname] = {\n savecount: saveCount + 1,\n lastsave: new Date(),\n value: dbstring\n };\n\n resolve();\n }, this.options.asyncTimeout);\n return Promise.resolve();\n });\n } else {\n const saveCount = (this.hashStore[dbname] !== undefined ? this.hashStore[dbname].savecount : 0);\n\n this.hashStore[dbname] = {\n savecount: saveCount + 1,\n lastsave: new Date(),\n value: dbstring\n };\n\n return Promise.resolve();\n }\n }\n\n /**\n * Deletes a database from its in-memory store.\n *\n * @param {string} dbname - name of the database (filename/keyname)\n * @returns {Promise} a Promise that resolves after the database was deleted\n */\n public deleteDatabase(dbname: string): Promise {\n delete this.hashStore[dbname];\n return Promise.resolve();\n }\n}\n\nexport namespace MemoryStorage {\n export interface Options {\n asyncResponses?: boolean;\n asyncTimeout?: number;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/memory-storage/src/memory_storage.ts","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/packages/memory-storage/lokijs.memory-storage.min.js b/dist/packages/memory-storage/lokijs.memory-storage.min.js new file mode 100644 index 00000000..3f9708bd --- /dev/null +++ b/dist/packages/memory-storage/lokijs.memory-storage.min.js @@ -0,0 +1 @@ +(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["@lokijs/memory-storage"]=factory();else{root["@lokijs/memory-storage"]=factory();root["LokiMemoryStorage"]=root["@lokijs/memory-storage"].default}})(typeof self!=="undefined"?self:this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__memory_storage__=__webpack_require__(1);__webpack_require__.d(__webpack_exports__,"MemoryStorage",function(){return __WEBPACK_IMPORTED_MODULE_0__memory_storage__["a"]});__webpack_exports__["default"]=__WEBPACK_IMPORTED_MODULE_0__memory_storage__["a"]},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__common_plugin__=__webpack_require__(2);class MemoryStorage{static register(){__WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["MemoryStorage"]=MemoryStorage}static deregister(){delete __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a"]["MemoryStorage"]}constructor(options){this.hashStore={};this.options=options||{};if(this.options.asyncResponses===undefined){this.options.asyncResponses=false}if(this.options.asyncTimeout===undefined){this.options.asyncTimeout=50}}loadDatabase(dbname){if(this.options.asyncResponses){return new Promise((resolve,reject)=>{setTimeout(()=>{if(this.hashStore[dbname]!==undefined){resolve(this.hashStore[dbname].value)}else{reject(new Error("unable to load database, "+dbname+" was not found in memory storage"))}},this.options.asyncTimeout)})}else{if(this.hashStore[dbname]!==undefined){return Promise.resolve(this.hashStore[dbname].value)}else{return Promise.reject(new Error("unable to load database, "+dbname+" was not found in memory storage"))}}}saveDatabase(dbname,dbstring){if(this.options.asyncResponses){return new Promise(resolve=>{setTimeout(()=>{const saveCount=this.hashStore[dbname]!==undefined?this.hashStore[dbname].savecount:0;this.hashStore[dbname]={savecount:saveCount+1,lastsave:new Date,value:dbstring};resolve()},this.options.asyncTimeout);return Promise.resolve()})}else{const saveCount=this.hashStore[dbname]!==undefined?this.hashStore[dbname].savecount:0;this.hashStore[dbname]={savecount:saveCount+1,lastsave:new Date,value:dbstring};return Promise.resolve()}}deleteDatabase(dbname){delete this.hashStore[dbname];return Promise.resolve()}}__webpack_exports__["a"]=MemoryStorage},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){function getGlobal(){let glob;(function(global){glob=global})(global!==undefined&&global||this);return glob}function create(){const global=getGlobal();const sym=Symbol.for("LOKI");if(global[sym]===undefined){global[sym]={}}return global[sym]}const PLUGINS=create();__webpack_exports__["a"]=PLUGINS}).call(__webpack_exports__,__webpack_require__(3))},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(1,eval)("this")}catch(e){if(typeof window==="object")g=window}module.exports=g}])}); \ No newline at end of file diff --git a/dist/packages/memory-storage/types/common/plugin.d.ts b/dist/packages/memory-storage/types/common/plugin.d.ts new file mode 100644 index 00000000..98d77b7d --- /dev/null +++ b/dist/packages/memory-storage/types/common/plugin.d.ts @@ -0,0 +1,4 @@ +/** + * @hidden + */ +export declare const PLUGINS: void; diff --git a/dist/packages/memory-storage/types/common/types.d.ts b/dist/packages/memory-storage/types/common/types.d.ts new file mode 100644 index 00000000..b8a936c6 --- /dev/null +++ b/dist/packages/memory-storage/types/common/types.d.ts @@ -0,0 +1,19 @@ +/** + * @hidden + */ +import { Loki } from "../loki/src"; +export interface StorageAdapter { + loadDatabase(dbname: string): Promise; + saveDatabase?(dbname: string, serialization: string): Promise; + deleteDatabase?(dbname: string): Promise; + mode?: string; + exportDatabase?(dbname: string, dbref: Loki): Promise; +} +export declare type Doc = T & { + $loki: number; + meta: any; +}; +export interface Dict { + [index: string]: T; + [index: number]: T; +} diff --git a/dist/packages/memory-storage/types/fs-storage/src/fs_storage.d.ts b/dist/packages/memory-storage/types/fs-storage/src/fs_storage.d.ts new file mode 100644 index 00000000..9930c0d0 --- /dev/null +++ b/dist/packages/memory-storage/types/fs-storage/src/fs_storage.d.ts @@ -0,0 +1,34 @@ +import { StorageAdapter } from "../../common/types"; +/** + * A loki persistence adapter which persists using node fs module. + */ +export declare class FSStorage implements StorageAdapter { + /** + * Registers the fs storage as plugin. + */ + static register(): void; + /** + * Deregisters the fs storage as plugin. + */ + static deregister(): void; + /** + * Load data from file, will throw an error if the file does not exist + * @param {string} dbname - the filename of the database to load + * @returns {Promise} a Promise that resolves after the database was loaded + */ + loadDatabase(dbname: string): Promise; + /** + * Save data to file, will throw an error if the file can't be saved + * might want to expand this to avoid dataloss on partial save + * @param {string} dbname - the filename of the database to load + * @returns {Promise} a Promise that resolves after the database was persisted + */ + saveDatabase(dbname: string, dbstring: string): Promise; + /** + * Delete the database file, will throw an error if the + * file can't be deleted + * @param {string} dbname - the filename of the database to delete + * @returns {Promise} a Promise that resolves after the database was deleted + */ + deleteDatabase(dbname: string): Promise; +} diff --git a/dist/packages/memory-storage/types/fs-storage/src/index.d.ts b/dist/packages/memory-storage/types/fs-storage/src/index.d.ts new file mode 100644 index 00000000..e6b33d6c --- /dev/null +++ b/dist/packages/memory-storage/types/fs-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { FSStorage } from "./fs_storage"; +export { FSStorage }; +export default FSStorage; diff --git a/dist/packages/memory-storage/types/full-text-search-language-de/src/de.d.ts b/dist/packages/memory-storage/types/full-text-search-language-de/src/de.d.ts new file mode 100644 index 00000000..54c13463 --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search-language-de/src/de.d.ts @@ -0,0 +1,2 @@ +import { Tokenizer } from "../../full-text-search/src/index"; +export declare const DE: Tokenizer; diff --git a/dist/packages/memory-storage/types/full-text-search-language-de/src/index.d.ts b/dist/packages/memory-storage/types/full-text-search-language-de/src/index.d.ts new file mode 100644 index 00000000..a2665427 --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search-language-de/src/index.d.ts @@ -0,0 +1,3 @@ +import { DE } from "./de"; +export { DE }; +export default DE; diff --git a/dist/packages/memory-storage/types/full-text-search-language-en/src/en.d.ts b/dist/packages/memory-storage/types/full-text-search-language-en/src/en.d.ts new file mode 100644 index 00000000..ef6adb62 --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search-language-en/src/en.d.ts @@ -0,0 +1,2 @@ +import { Tokenizer } from "../../full-text-search/src/index"; +export declare const EN: Tokenizer; diff --git a/dist/packages/memory-storage/types/full-text-search-language-en/src/index.d.ts b/dist/packages/memory-storage/types/full-text-search-language-en/src/index.d.ts new file mode 100644 index 00000000..8313cf98 --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search-language-en/src/index.d.ts @@ -0,0 +1,3 @@ +import { EN } from "./en"; +export { EN }; +export default EN; diff --git a/dist/packages/memory-storage/types/full-text-search-language/src/index.d.ts b/dist/packages/memory-storage/types/full-text-search-language/src/index.d.ts new file mode 100644 index 00000000..e52d1a42 --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search-language/src/index.d.ts @@ -0,0 +1 @@ +export { generateStopWordFilter, generateTrimmer, Among, SnowballProgram } from "./language"; diff --git a/dist/packages/memory-storage/types/full-text-search-language/src/language.d.ts b/dist/packages/memory-storage/types/full-text-search-language/src/language.d.ts new file mode 100644 index 00000000..0866a0ba --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search-language/src/language.d.ts @@ -0,0 +1,36 @@ +export declare function generateTrimmer(wordCharacters: string): (token: string) => string; +export declare function generateStopWordFilter(stopWords: string[]): (token: string) => string; +export declare class Among { + s_size: number; + s: number[]; + substring_i: number; + result: number; + method: any; + constructor(s: string, substring_i: number, result: number, method?: any); +} +export declare class SnowballProgram { + current: string; + bra: number; + ket: number; + limit: number; + cursor: number; + limit_backward: number; + constructor(); + setCurrent(word: string): void; + getCurrent(): string; + in_grouping(s: number[], min: number, max: number): boolean; + in_grouping_b(s: number[], min: number, max: number): boolean; + out_grouping(s: number[], min: number, max: number): boolean; + out_grouping_b(s: number[], min: number, max: number): boolean; + eq_s(s_size: number, s: string): boolean; + eq_s_b(s_size: number, s: string): boolean; + find_among(v: Among[], v_size: number): number; + find_among_b(v: Among[], v_size: number): number; + replace_s(c_bra: number, c_ket: number, s: string): number; + slice_check(): void; + slice_from(s: string): void; + slice_del(): void; + insert(c_bra: number, c_ket: number, s: string): void; + slice_to(): string; + eq_v_b(s: string): boolean; +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/full_text_search.d.ts b/dist/packages/memory-storage/types/full-text-search/src/full_text_search.d.ts new file mode 100644 index 00000000..65a26bef --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/full_text_search.d.ts @@ -0,0 +1,43 @@ +import { InvertedIndex } from "./inverted_index"; +import { Tokenizer } from "./tokenizer"; +import { Dict } from "../../common/types"; +import { Query } from "./query_builder"; +import { Scorer } from "./scorer"; +export declare class FullTextSearch { + private _id; + private _docs; + private _idxSearcher; + private _invIdxs; + /** + * Registers the full-text search as plugin. + */ + static register(): void; + /** + * Initialize the full-text search for the given fields. + * @param {object[]} fields - the field options + * @param {string} fields.name - the name of the field + * @param {boolean=true} fields.store - flag to indicate if the full-text search should be stored on serialization or + * rebuild on deserialization + * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized + * (requires more memory but performs better) + * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field + * @param {string} [id] - the property name of the document index + */ + constructor(fields?: FullTextSearch.FieldOptions[], id?: string); + addDocument(doc: object, id?: number): void; + removeDocument(doc: object, id?: number): void; + updateDocument(doc: object, id?: number): void; + clear(): void; + search(query: Query): Scorer.ScoreResult; + toJSON(): FullTextSearch.Serialization; + static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers?: Dict): FullTextSearch; +} +export declare namespace FullTextSearch { + interface FieldOptions extends InvertedIndex.FieldOptions { + name: string; + } + interface Serialization { + id: string; + ii: Dict; + } +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/fuzzy/automaton.d.ts b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/automaton.d.ts new file mode 100644 index 00000000..17566e0b --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/automaton.d.ts @@ -0,0 +1,36 @@ +/** + * Transition with dest, min and max. + * @hidden + */ +export declare type Transition = [number, number, number]; +/** + * @type {number} + * @hidden + */ +export declare const MIN_CODE_POINT = 0; +/** + * @type {number} + * @hidden + */ +export declare const MAX_CODE_POINT = 1114111; +/** + * From org/apache/lucene/util/automaton/Automaton.java + * @hidden + */ +export declare class Automaton { + private _stateTransitions; + private _accept; + private _nextState; + private _currState; + private _transitions; + constructor(); + isAccept(n: number): boolean; + createState(): number; + setAccept(state: number, accept: boolean): void; + finishState(): void; + private _finishCurrentState(); + getStartPoints(): number[]; + step(state: number, label: number): number; + getNumStates(): number; + addTransition(source: number, dest: number, min: number, max: number): void; +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/fuzzy/lev1t_parametric_description.d.ts b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/lev1t_parametric_description.d.ts new file mode 100644 index 00000000..8ecb58ba --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/lev1t_parametric_description.d.ts @@ -0,0 +1,9 @@ +import { ParametricDescription } from "./parametric_description"; +/** + * From org/apache/lucene/util/automaton/Lev1TParametricDescription.java + * @hidden + */ +export declare class Lev1TParametricDescription extends ParametricDescription { + constructor(w: number); + transition(absState: number, position: number, vector: number): number; +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/fuzzy/lev2t_parametric_description.d.ts b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/lev2t_parametric_description.d.ts new file mode 100644 index 00000000..2cd81e19 --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/lev2t_parametric_description.d.ts @@ -0,0 +1,9 @@ +import { ParametricDescription } from "./parametric_description"; +/** + * From org/apache/lucene/util/automaton/Lev2TParametricDescription.java + * @hidden + */ +export declare class Lev2TParametricDescription extends ParametricDescription { + constructor(w: number); + transition(absState: number, position: number, vector: number): number; +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/fuzzy/levenshtein_automata.d.ts b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/levenshtein_automata.d.ts new file mode 100644 index 00000000..646a6a5e --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/levenshtein_automata.d.ts @@ -0,0 +1,21 @@ +import { Automaton } from "./automaton"; +/** + * From org/apache/lucene/util/automaton/LevenshteinAutomata.java + * @hidden + */ +export declare class LevenshteinAutomata { + private _word; + private _numRanges; + private _rangeLower; + private _rangeUpper; + private _description; + private _alphabet; + private _editDistance; + constructor(input: number[], editDistance: number); + /** + * Transforms the NDFA to a DFA. + * @returns {Automaton} + */ + toAutomaton(): Automaton; + private getVector(x, pos, end); +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/fuzzy/long.d.ts b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/long.d.ts new file mode 100644 index 00000000..85a0fd0d --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/long.d.ts @@ -0,0 +1,33 @@ +/** + * Class supports 64Bit integer operations. + * A cut-down version of dcodeIO/long.js. + * @hidden + */ +export declare class Long { + private _low; + private _high; + constructor(low?: number, high?: number); + /** + * Returns this long with bits arithmetically shifted to the right by the given amount. + * @param {number} numBits - number of bits + * @returns {Long} the long + */ + shiftRight(numBits: number): Long; + /** + * Returns this long with bits arithmetically shifted to the left by the given amount. + * @param {number} numBits - number of bits + * @returns {Long} the long + */ + shiftLeft(numBits: number): Long; + /** + * Returns the bitwise AND of this Long and the specified. + * @param {Long} other - the other Long + * @returns {Long} the long + */ + and(other: Long): Long; + /** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + * @returns {number} + */ + toInt(): number; +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/fuzzy/parametric_description.d.ts b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/parametric_description.d.ts new file mode 100644 index 00000000..f22c6b76 --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/parametric_description.d.ts @@ -0,0 +1,25 @@ +import { Long } from "./long"; +/** + * From org/apache/lucene/util/automaton/LevenshteinAutomata.java#ParametricDescription + * @hidden + */ +export declare class ParametricDescription { + protected _w: number; + private _n; + private _minErrors; + constructor(w: number, n: number, minErrors: number[]); + /** + * Return the number of states needed to compute a Levenshtein DFA + */ + size(): number; + /** + * Returns true if the state in any Levenshtein DFA is an accept state (final state). + */ + isAccept(absState: number): boolean; + /** + * Returns the position in the input word for a given state. + * This is the minimal boundary for the state. + */ + getPosition(absState: number): number; + unpack(data: Long[], index: number, bitsPerValue: number): number; +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/fuzzy/run_automaton.d.ts b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/run_automaton.d.ts new file mode 100644 index 00000000..439fc206 --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/fuzzy/run_automaton.d.ts @@ -0,0 +1,15 @@ +import { Automaton } from "./automaton"; +/** + * From org/apache/lucene/util/automaton/RunAutomaton.java + * @hidden + */ +export declare class RunAutomaton { + private _points; + private _accept; + private _transitions; + private _classmap; + constructor(automaton: Automaton); + getCharClass(c: number): number; + step(state: number, c: number): number; + isAccept(state: number): boolean; +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/index.d.ts b/dist/packages/memory-storage/types/full-text-search/src/index.d.ts new file mode 100644 index 00000000..b901b108 --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/index.d.ts @@ -0,0 +1,5 @@ +import { FullTextSearch } from "./full_text_search"; +import { Tokenizer } from "./tokenizer"; +import { QueryBuilder } from "./query_builder"; +export { FullTextSearch, Tokenizer, QueryBuilder }; +export default FullTextSearch; diff --git a/dist/packages/memory-storage/types/full-text-search/src/index_searcher.d.ts b/dist/packages/memory-storage/types/full-text-search/src/index_searcher.d.ts new file mode 100644 index 00000000..00b99f2f --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/index_searcher.d.ts @@ -0,0 +1,21 @@ +import { Scorer } from "./scorer"; +import { InvertedIndex } from "./inverted_index"; +import { Query } from "./query_builder"; +import { Dict } from "../../common/types"; +/** + * @hidden + */ +export declare class IndexSearcher { + private _invIdxs; + private _docs; + private _scorer; + /** + * @param {object} invIdxs + */ + constructor(invIdxs: Dict, docs: Set); + search(query: Query): Scorer.ScoreResult; + setDirty(): void; + private _recursive(query, doScoring); + private _getUnique(queries, doScoring, queryResults); + private _getAll(queries, doScoring); +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/inverted_index.d.ts b/dist/packages/memory-storage/types/full-text-search/src/inverted_index.d.ts new file mode 100644 index 00000000..cdd9055c --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/inverted_index.d.ts @@ -0,0 +1,139 @@ +import { Tokenizer } from "./tokenizer"; +import Index = InvertedIndex.Index; +/** + * Converts a string into an array of code points. + * @param str - the string + * @returns {number[]} to code points + * @hidden + */ +export declare function toCodePoints(str: string): number[]; +/** + * Inverted index class handles featured text search for specific document fields. + * @hidden + */ +export declare class InvertedIndex { + private _store; + private _optimizeChanges; + private _tokenizer; + private _docCount; + private _docStore; + private _totalFieldLength; + private _root; + /** + * @param {boolean} [options.store=true] - inverted index will be stored at serialization rather than rebuilt on load. + * @param {boolean} optimizeChanges + * @param {Tokenizer} tokenizer + */ + constructor(options?: InvertedIndex.FieldOptions); + store: boolean; + readonly tokenizer: Tokenizer; + readonly documentCount: number; + readonly documentStore: Map; + readonly totalFieldLength: number; + readonly root: Index; + /** + * Adds defined fields of a document to the inverted index. + * @param {string} field - the field to add + * @param {number} docId - the doc id of the field + */ + insert(field: string, docId: number): void; + /** + * Removes all relevant terms of a document from the inverted index. + * @param {number} docId - the document. + */ + remove(docId: number): void; + /** + * Gets the term index of a term. + * @param {string} term - the term + * @param {object} root - the term index to start from + * @param {number} start - the position of the term string to start from + * @return {object} - The term index or null if the term is not in the term tree. + */ + static getTermIndex(term: number[], root: Index, start?: number): Index; + /** + * Extends a term index to all available term leafs. + * @param {object} idx - the term index to start from + * @param {number[]} [term=[]] - the current term + * @param {Array} termIndices - all extended indices with their term + * @returns {Array} - Array with term indices and extension + */ + static extendTermIndex(idx: Index, term?: number[], termIndices?: InvertedIndex.IndexTerm[]): InvertedIndex.IndexTerm[]; + /** + * Serialize the inverted index. + * @returns {{docStore: *, _fields: *, index: *}} + */ + toJSON(): { + _store: boolean; + _optimizeChanges: boolean; + _tokenizer: Tokenizer; + _docCount: number; + _docStore: [number, InvertedIndex.DocStore][]; + _totalFieldLength: number; + _root: InvertedIndex.SerializedIndex; + } | { + _store: boolean; + _optimizeChanges: boolean; + _tokenizer: Tokenizer; + }; + /** + * Deserialize the inverted index. + * @param {{docStore: *, _fields: *, index: *}} serialized - The serialized inverted index. + * @param {Object.|Tokenizer} funcTok[undefined] - the depending functions with labels + * or an equivalent tokenizer + */ + static fromJSONObject(serialized: InvertedIndex.Serialization, funcTok?: Tokenizer.FunctionSerialization): InvertedIndex; + private static serializeIndex(idx); + private static deserializeIndex(serialized); + /** + * Set parent of to each index and regenerate the indexRef. + * @param {Index} index - the index + * @param {Index} parent - the parent + */ + private _regenerate(index, parent); + /** + * Iterate over the whole inverted index and remove the document. + * Delete branch if not needed anymore. + * Function is needed if index is used without optimization. + * @param {Index} idx - the index + * @param {number} docId - the doc id + * @returns {boolean} true if index is empty + */ + private _remove(idx, docId); +} +export declare namespace InvertedIndex { + interface FieldOptions { + store?: boolean; + optimizeChanges?: boolean; + tokenizer?: Tokenizer; + } + type Index = Map & { + dc?: Map; + df?: number; + pa?: Index; + }; + type IndexTerm = { + index: Index; + term: number[]; + }; + interface SerializedIndex { + d?: { + df: number; + dc: [number, number][]; + }; + k?: number[]; + v?: SerializedIndex[]; + } + interface Serialization { + _store: boolean; + _optimizeChanges: boolean; + _tokenizer: Tokenizer.Serialization; + _docCount?: number; + _docStore?: Map; + _totalFieldLength?: number; + _root?: SerializedIndex; + } + interface DocStore { + fieldLength?: number; + indexRef?: Index[]; + } +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/query_builder.d.ts b/dist/packages/memory-storage/types/full-text-search/src/query_builder.d.ts new file mode 100644 index 00000000..6f324e15 --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/query_builder.d.ts @@ -0,0 +1,581 @@ +/** + * The base query class to enable boost to a query type. + */ +export declare class BaseQueryBuilder { + protected _data: any; + /** + * @param {string} type - the type name of the query + * @param data + */ + constructor(type: string, data?: any); + /** + * Boosts the query result. + * + * See also [Lucene#BoostQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/BoostQuery.html} + * and [Elasticsearch#boost]{@link https://www.elastic.co/guide/en/elasticsearch/reference/5.2/mapping-boost.html}. + * + * @param {number} value - the positive boost + * @return {BaseQueryBuilder} object itself for cascading + */ + boost(value: number): this; + /** + * Build the final query. + * @return {Object} - the final query + */ + build(): any; +} +export interface BaseQuery { + type: Type; + boost?: number; +} +/** + * A query which finds documents where a document field contains a term. + * + * See also [Lucene#TermQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/TermQuery.html} + * and [Elasticsearch#TermQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html}. + * + * @example + * new QueryBuilder() + * .term("name", "infinity"]) + * .build(); + * // The resulting documents: + * // contains the term infinity + * + * @extends BaseQueryBuilder + */ +export declare class TermQueryBuilder extends BaseQueryBuilder { + /** + * @param {string} field - the field name of the document + * @param {string} term - the term + * @param data + */ + constructor(field: string, term: string, data?: any); +} +export interface TermQuery extends BaseQuery<"term"> { + field: string; + value: string; +} +/** + * A query which finds documents where a document field contains any of the terms. + * + * See also [Lucene#TermRangeQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/TermRangeQuery.html} + * and [Elasticsearch#TermsQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html}. + * + * @example + * new QueryBuilder() + * .terms("quotes", ["infinity", "atom", "energy"]) + * .build(); + * // The resulting documents: + * // contains the terms infinity, atom or energy + * + * @extends BaseQueryBuilder + */ +export declare class TermsQueryBuilder extends BaseQueryBuilder { + /** + * @param {string} field - the field name of the document + * @param {string[]} terms - the terms + * @param data + */ + constructor(field: string, terms: Array, data?: any); +} +export interface TermsQuery extends BaseQuery<"terms"> { + field: string; + value: string[]; +} +/** + * A query which finds documents where the wildcard term can be applied at an existing document field term. + * + * Wildcard | Description + * -------- | ------------ + * ? (question mark) | Skips a single character. + * + * To escape a wildcard character, use _\_ (backslash), e.g. \?. + * + * * To enable scoring for wildcard queries, use {@link WildcardQueryBuilder#enableScoring}. + * + * See also [Lucene#WildcardQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/WildcardQuery.html} + * and [Elasticsearch#WildcardQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html}. + * + * @example + * new QueryBuilder() + * .wildcard("question", "e?nst*n\?") + * .build(); + * // The resulting documents: + * // contains the wildcard surname e?nst*n\? (like Einstein? or Eynsteyn? but not Einsteine or Ensten?) + * + * @extends BaseQueryBuilder + */ +export declare class WildcardQueryBuilder extends BaseQueryBuilder { + /** + * @param {string} field - the field name of the document + * @param {string} wildcard - the wildcard term + * @param data + */ + constructor(field: string, wildcard: string, data?: any); + /** + * This flag enables scoring for wildcard results, similar to {@link TermQueryBuilder}. + * @param {boolean} enable - flag to enable or disable scoring + * @return {WildcardQueryBuilder} + */ + enableScoring(enable: boolean): this; +} +export interface WildcardQuery extends BaseQuery<"wildcard"> { + field: string; + value: string; + enable_scoring?: boolean; +} +/** + * A query which finds documents where the fuzzy term can be transformed into an existing document field term within a + * given edit distance. + * ([Damerau–Levenshtein distance]{@link https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance}). + * + * The edit distance is the minimum number of an insertion, deletion or substitution of a single character + * or a transposition of two adjacent characters. + * + * * To set the maximal allowed edit distance, use {@link FuzzyQueryBuilder#fuzziness} (default is AUTO). + * * To set the initial word length, which should ignored for fuzziness, use {@link FuzzyQueryBuilder#prefixLength}. + * * To include longer document field terms than the fuzzy term and edit distance together, use + * {@link FuzzyQueryBuilder#extended}. + * + * See also [Lucene#FuzzyQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/FuzzyQuery.html} + * and [Elasticsearch#FuzzyQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html}. + * + * @example + * new QueryBuilder() + * .fuzzy("surname", "einsten") + * .fuzziness(2) + * .prefixLength(3) + * .build(); + * // The resulting documents: + * // contains the fuzzy surname einstn (like Einstein or Einst but not Eisstein or Insten) + * + * @extends BaseQueryBuilder + */ +export declare class FuzzyQueryBuilder extends BaseQueryBuilder { + /** + * @param {string} field - the field name of the document + * @param {string} fuzzy - the fuzzy term + * @param data + */ + constructor(field: string, fuzzy: string, data?: any); + /** + * Sets the maximal allowed fuzziness. + * @param {number|string} fuzziness - the edit distance 0, 1, 2 or AUTO + * + * AUTO generates an edit distance based on the length of the term: + * * 0..2 -> must match exactly + * * 3..5 -> one edit allowed + * * >5 two edits allowed + * + * @return {FuzzyQueryBuilder} - object itself for cascading + */ + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; + /** + * Sets the initial word length. + * @param {number} prefixLength - the positive prefix length + * @return {FuzzyQueryBuilder} object itself for cascading + */ + prefixLength(prefixLength: number): this; + /** + * This flag allows longer document field terms than the actual fuzzy. + * @param {boolean} extended - flag to enable or disable extended search + * @return {FuzzyQueryBuilder} + */ + extended(extended: boolean): this; +} +export interface FuzzyQuery extends BaseQuery<"fuzzy"> { + field: string; + value: string; + fuzziness?: 0 | 1 | 2 | "AUTO"; + prefix_length?: number; + extended?: boolean; +} +/** + * A query which matches documents containing the prefix of a term inside a field. + * + * * To enable scoring for wildcard queries, use {@link WildcardQueryBuilder#enableScoring}. + * + * See also [Lucene#PrefixQueryBuilder]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/PrefixQuery.html} + * and [Elasticsearch#MatchQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-prefix-query.html} + * + * @example + * new QueryBuilder() + * .prefix("surname", "alb") + * .build() + * // The resulting documents: + * // contains the term prefix alb as surname + * + * @extends BaseQueryBuilder + */ +export declare class PrefixQueryBuilder extends BaseQueryBuilder { + /** + * @param {string} field - the field name of the document + * @param {string} prefix - the prefix of a term + * @param data + */ + constructor(field: string, prefix: string, data?: any); + /** + * This flag enables scoring for prefix results, similar to {@link TermQueryBuilder}. + * @param {boolean} enable - flag to enable or disable scoring + * @return {PrefixQueryBuilder} + */ + enableScoring(enable: boolean): this; +} +export interface PrefixQuery extends BaseQuery<"prefix"> { + field: string; + value: string; + enable_scoring?: boolean; +} +/** + * A query which matches all documents with a given field. + * + * See also [Elasticsearch#ExistsQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html}. + * + * @example + * new QueryBuilder() + * .exists("name") + * .build() + * // The resulting documents: + * // has the field "name" + * + * @extends BaseQueryBuilder + */ +export declare class ExistsQueryBuilder extends BaseQueryBuilder { + /** + * @param {string} field - the field name of the document + * @param data + */ + constructor(field: string, data?: any); +} +export interface ExistsQuery extends BaseQuery<"exists"> { + field: string; +} +/** + * A query which tokenizes the given query text, performs a query foreach token and combines the results using a boolean + * operator. + * + * Operator | Description + * ------------- | ------------- + * or (default) | Finds documents which matches some tokens. The minimum amount of matches can be controlled with [minimumShouldMatch]{@link MatchQueryBuilder#minimumShouldMatch} (default is 1). + * and | Finds documents which matches all tokens. + * + * To enable a [fuzzy query]{@link FuzzyQueryBuilder} for the tokens, use {@link MatchQueryBuilder#fuzziness}, + * {@link MatchQueryBuilder#prefixLength} and {@link MatchQueryBuilder#extended} + * + * See also [Lucene#?]{@link ?} + * and [Elasticsearch#MatchQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html}. + * + * @example + * new QueryBuilder() + * .match("name", "albrt einsten") + * .boost(2.5) + * .operator("and") + * .fuzziness(2) + * .prefixLength(3) + * .build(); + * // The resulting documents: + * // contains the fuzzy name albrt einsten (like Albert Einstein) with a boost of 2.5 + * + * @extends BaseQueryBuilder + */ +export declare class MatchQueryBuilder extends BaseQueryBuilder { + /** + * @param {string} field - the field name of the document + * @param {string} query - the query text + * @param data + */ + constructor(field: string, query: string, data?: any); + /** + * Controls the amount of minimum matching sub queries before a document will be considered. + * @param {number} minShouldMatch - number of minimum matching sub queries + * minShouldMatch >= 1: Indicates a fixed value regardless of the number of sub queries. + * minShouldMatch <= -1: Indicates that the number of sub queries, minus this number should be mandatory. + * minShouldMatch < 0: Indicates that this percent of the total number of sub queries can be missing. + * The number computed from the percentage is rounded down, before being subtracted from the total to determine + * the minimum. + * minShouldMatch < 1: Indicates that this percent of the total number of sub queries are necessary. + * The number computed from the percentage is rounded down and used as the minimum. + * @return {MatchQueryBuilder} object itself for cascading + */ + minimumShouldMatch(minShouldMatch: number): this; + /** + * Sets the boolean operator. + * @param {string} op - the operator ("or" || "and") + * @return {MatchQueryBuilder} object itself for cascading + */ + operator(op: string): this; + /** + * Sets the maximal allowed fuzziness. + * @param {number|string} fuzziness - the edit distance 0, 1, 2 or AUTO + * + * AUTO generates an edit distance based on the length of the term: + * * 0..2 -> must match exactly + * * 3..5 -> one edit allowed + * * >5 two edits allowed + * + * @return {MatchQueryBuilder} - object itself for cascading + */ + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; + /** + * Sets the starting word length which should not be considered for fuzziness. + * @param {number} prefixLength - the positive prefix length + * @return {MatchQueryBuilder} - object itself for cascading + */ + prefixLength(prefixLength: number): this; + /** + * This flag allows longer document field terms than the actual fuzzy. + * @param {boolean} extended - flag to enable or disable extended search + * @return {MatchQueryBuilder} + */ + extended(extended: boolean): this; +} +export interface MatchQuery extends BaseQuery<"match"> { + field: string; + value: string; + minimum_should_match?: number; + operator?: "and" | "or"; + fuzziness?: 0 | 1 | 2 | "AUTO"; + prefix_length?: number; + extended?: boolean; +} +/** + * A query that matches all documents and giving them a constant score equal to the query boost. + * + * Typically used inside a must clause of a {@link BoolQueryBuilder} to subsequently reject non matching documents with the not + * clause. + * + * See also [Lucene#MatchAllDocsQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/MatchAllDocsQuery.html} + * and [Elasticsearch#MatchAllQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-all-query.html}. + * + * @example + * new QueryBuilder() + * .matchAll() + * .boost(2.5) + * .build() + * // The resulting documents: + * // all documents and giving a score of 2.5 + * + * @extends BaseQueryBuilder + */ +export declare class MatchAllQueryBuilder extends BaseQueryBuilder { + constructor(data?: any); +} +export interface MatchQueryAll extends BaseQuery<"match_all"> { +} +/** + * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter. + * + * See also [Lucene#BooleanQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/ConstantScoreQuery.html} + * and [Elasticsearch#ConstantScoreQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-constant-score-query.html}. + * + * @example + * new QueryBuilder() + * .constantScore() + * .boost(1.5) + * .beginFilter() + * .term("first_name", "albert") + * .term("surname", "einstein") + * .endFilter() + * .build() + * // The resulting documents: + * // * contains albert as first name, einstein as surname and the document score is 42. + * + * @extends BaseQueryBuilder + */ +export declare class ConstantScoreQueryBuilder extends BaseQueryBuilder { + constructor(data?: any); + /** + * Starts an array of queries. Use endFilter() to finish the array. + * @return {ArrayQueryBuilder} array query for holding sub queries + */ + beginFilter(): ArrayQueryBuilder & { + endFilter(): ConstantScoreQueryBuilder; + }; +} +export interface ConstantScoreQuery extends BaseQuery<"constant_score"> { + filter: ArrayQuery; +} +/** + * A query that matches documents matching boolean combinations of sub queries. + * + * This query consists of one or more boolean clauses with different behavior but interrelated to each other. + * + * Occur | Description + * ------------- | ------------- + * must | Finds documents which matches all sub queries. + * filter | Finds documents which matches all sub queries but these documents do not contribute to the score. + * should | Finds documents which matches some sub queries. The minimum amount of matches can be controlled with [minimumShouldMatch]{@link BoolQueryBuilder#minimumShouldMatch} (default is 1). + * not | Documents which match any sub query will be ignored. + * + * A sub query can be any other query type and also the bool query itself. + * + * See also [Lucene#BooleanQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/BooleanQuery.html} + * and [Elasticsearch#BoolQueryBuilder]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html}. + * + * @example + * new QueryBuilder() + * .bool() + * .beginMust().boost(2) + * .term("first_name", "albert") + * .endMust() + * .beginFilter() + * .term("birthplace", "ulm") + * .endFilter() + * .beginShould().minimumShouldMatch(2) + * .fuzzy("surname", "einstin") + * .wildcard("name", "geni?s") + * .term("quotes", "infinity") + * .endShould() + * .beginNot() + * .terms("research_field", ["biology", "geography"]) + * .endNot() + * .build(); + * // The resulting documents: + * // contains the name albert (must: contribute to the score with a boost of 2) + * // contains the birthplace ulm (filter: not contribute to the score) + * // contains a minimum of two matches from the fuzzy, wildcard and/or term query (should: contribute to the score) + * // do not contains biology or geography as research field (not: not contribute to the score) + * + * @extends BaseQueryBuilder + */ +export declare class BoolQueryBuilder extends BaseQueryBuilder { + constructor(data?: any); + /** + * Starts an array of queries for must clause. Use endMust() to finish the array. + * @return {ArrayQueryBuilder} array query for holding sub queries + */ + beginMust(): ArrayQueryBuilder & { + endMust(): BoolQueryBuilder; + }; + /** + * Starts an array of queries for filter clause. Use endFilter() to finish the array. + * @return {ArrayQueryBuilder} array query for holding sub queries + */ + beginFilter(): ArrayQueryBuilder & { + endFilter(): BoolQueryBuilder; + }; + /** + * Starts an array of queries for should clause. Use endShould() to finish the array. + * @return {ArrayQueryBuilder} array query for holding sub queries + */ + beginShould(): ArrayQueryBuilder & { + endShould(): BoolQueryBuilder; + }; + /** + * Starts an array of queries for not clause. Use endNot() to finish the array. + * @return {ArrayQueryBuilder} array query for holding sub queries + */ + beginNot(): ArrayQueryBuilder & { + endNot(): BoolQueryBuilder; + }; + /** + * Controls the amount of minimum matching sub queries before a document will be considered. + * @param {number} minShouldMatch - number of minimum matching sub queries + * minShouldMatch >= 1: Indicates a fixed value regardless of the number of sub queries. + * minShouldMatch <= -1: Indicates that the number of sub queries, minus this number should be mandatory. + * minShouldMatch < 0: Indicates that this percent of the total number of sub queries can be missing. + * The number computed from the percentage is rounded down, before being subtracted from the total to determine + * the minimum. + * minShouldMatch < 1: Indicates that this percent of the total number of sub queries are necessary. + * The number computed from the percentage is rounded down and used as the minimum. + * @return {BoolQueryBuilder} object itself for cascading + */ + minimumShouldMatch(minShouldMatch: number): this; +} +export interface BoolQuery extends BaseQuery<"bool"> { + must?: ArrayQuery; + filter?: ArrayQuery; + should?: ArrayQuery; + not?: ArrayQuery; + minimum_should_match?: number; +} +/** + * A query which holds all sub queries like an array. + */ +export declare class ArrayQueryBuilder extends BaseQueryBuilder { + private _callbackName; + private _prepare; + constructor(callbackName: string, callback: Function, data?: any); + bool(): any; + constantScore(): any; + term(field: string, term: string): any; + terms(field: string, terms: Array): any; + wildcard(field: string, wildcard: string): any; + fuzzy(field: string, fuzzy: string): any; + match(field: string, query: string): any; + matchAll(): any; + prefix(field: string, prefix: string): any; + exists(field: string): any; +} +export interface ArrayQuery extends BaseQuery<"array"> { + values: QueryTypes[]; +} +/** + * This query builder is the root of each query search. + * The query contains a sub query and parameters for setup scoring and search options. + * + * Possible sub query types are: + * {@link TermQueryBuilder}, {@link TermsQueryBuilder}, {@link FuzzyQueryBuilder}, {@link WildcardQueryBuilder}, + * {@link MatchQueryBuilder}, {@link MatchAllQueryBuilder}, {@link PrefixQueryBuilder}, {@link BoolQueryBuilder}, + * {@link ConstantScoreQueryBuilder}, {@link ExistsQueryBuilder} + * + * @example + * new QueryBuilder() + * .finalScoring(true) + * .useBM25(1.5, 0.5) + * .term("first_name", "albert") + * .build(); + * // The resulting documents: + * // contains the first name albert + * // are scored and ranked using BM25 with k1=1.5 and b=0.5 + */ +export declare class QueryBuilder { + private _data; + constructor(); + /** + * The query performs a final scoring over all scored sub queries. + * @param {boolean} enable - flag to enable or disable final scoring + * @return {this} + */ + enableFinalScoring(enable: boolean): this; + /** + * Adds an explanation of the scoring of each document for all matched terms. + * @param {boolean} enable -flag to enable or disable explanation + * @returns {this} + */ + explain(enable: boolean): this; + /** + * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model. + * + * See also [Lucene#MatchAllDocsQuery]{@link https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/search/similarities/BM25Similarity.html} + * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}. + * + * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation. + * Lower values result in quicker saturation, and higher values in slower saturation + * @param {number} [b=0.75] - controls how much effect field-length normalization should have. + * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully + * @return {this} + */ + BM25Similarity(k1?: number, b?: number): this; + bool(): BoolQueryBuilder; + constantScore(): ConstantScoreQueryBuilder; + term(field: string, term: string): TermQueryBuilder; + terms(field: string, terms: Array): TermsQueryBuilder; + wildcard(field: string, wildcard: string): WildcardQueryBuilder; + fuzzy(field: string, fuzzy: string): FuzzyQueryBuilder; + match(field: string, query: string): MatchQueryBuilder; + matchAll(): MatchAllQueryBuilder; + prefix(field: string, prefix: string): PrefixQueryBuilder; + exists(field: string): ExistsQueryBuilder; + private _prepare(queryType, ...args); +} +export declare type QueryTypes = BoolQuery | ConstantScoreQuery | TermQuery | TermsQuery | WildcardQuery | FuzzyQuery | MatchQuery | MatchQueryAll | PrefixQuery | ExistsQuery; +export interface Query { + query: QueryTypes; + final_scoring?: boolean; + explain?: boolean; + bm25?: { + k1: number; + b: number; + }; +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/scorer.d.ts b/dist/packages/memory-storage/types/full-text-search/src/scorer.d.ts new file mode 100644 index 00000000..dacdc753 --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/scorer.d.ts @@ -0,0 +1,61 @@ +import { InvertedIndex } from "./inverted_index"; +import { Dict } from "../../common/types"; +import { Query } from "./query_builder"; +/** + * @hidden + */ +export declare class Scorer { + private _invIdxs; + private _cache; + constructor(invIdxs: Dict); + setDirty(): void; + score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, queryResults: Scorer.QueryResults, term: number[]): void; + scoreConstant(boost: number, docId: number, queryResults: Scorer.QueryResults): Map; + finalScore(query: Query, queryResults: Scorer.QueryResults): Scorer.ScoreResult; + private static _calculateFieldLength(fieldLength); + private _getCache(fieldName); + /** + * Returns the idf by either calculate it or use a cached one. + * @param {string} fieldName - the name of the field + * @param {number} docFreq - the doc frequency of the term + * @returns {number} the idf + * @private + */ + private _idf(fieldName, docFreq); + private _avgFieldLength(fieldName); +} +export declare namespace Scorer { + interface IDFCache { + idfs: Dict; + avgFieldLength: number; + } + interface QueryResult { + tf?: number; + idf?: number; + boost: number; + fieldName?: string; + term?: number[]; + } + type QueryResults = Map; + interface BM25Explanation { + boost: number; + score: number; + docID: number; + fieldName: string; + index: string; + idf: number; + tfNorm: number; + tf: number; + fieldLength: number; + avgFieldLength: number; + } + interface ConstantExplanation { + boost: number; + score: number; + } + type ScoreExplanation = BM25Explanation | ConstantExplanation; + type ScoreResult = Dict<{ + score: number; + explanation?: ScoreExplanation[]; + }>; +} diff --git a/dist/packages/memory-storage/types/full-text-search/src/tokenizer.d.ts b/dist/packages/memory-storage/types/full-text-search/src/tokenizer.d.ts new file mode 100644 index 00000000..c334035f --- /dev/null +++ b/dist/packages/memory-storage/types/full-text-search/src/tokenizer.d.ts @@ -0,0 +1,139 @@ +/** + * Splits a string at non-alphanumeric characters into lower case tokens. + * @param {string} str - the string + * @returns {string[]} - the tokens + * @private + */ +import { Dict } from "../../common/types"; +/** + * The tokenizer is used to prepare the string content of a document field for the inverted index. + * Firstly the string gets split into tokens. + * After that the tokens will be trimmed/stemmed with defined functions from the queue. + * + * * To change the splitter function, use {@link Tokenizer#setSplitter}. + * * To add functions to the queue, use {@link Tokenizer#add}, {@link Tokenizer#addBefore} and + * {@link Tokenizer#addAfter}. + * * To remove a function from the queue, use {@link Tokenizer#remove}. + * * To reset the tokenizer, use {@link Tokenizer#reset}. + */ +export declare class Tokenizer { + private _splitter; + private _queue; + private _symbol; + /** + * Initializes the tokenizer with a splitter, which splits a string at non-alphanumeric characters. + * The queue is empty. + */ + constructor(); + /** + * Sets a function with defined label as the splitter function. + * The function must take a string as argument and return an array of tokens. + * + * @param {string} label - the label + * @param {function} func - the function + */ + setSplitter(label: string, func: Tokenizer.SplitterFunction): void; + /** + * Gets the splitter. + * @return {Array.} - tuple with label and function + */ + getSplitter(): any[]; + /** + * Resets the splitter to default. + */ + resetSplitter(): void; + /** + * Checks if a function is inside the queue. + * @param {string|function} labelFunc - an existing label or function + * @returns {boolean} true if exists, otherwise false + */ + has(labelFunc: string | Tokenizer.TokinizeFunction): boolean; + /** + * Gets a function from the queue. + * Only the first found function gets returned if a label or a function is multiple used. + * + * @param {string|function} labelFunc - an existing label or function + * @return {Array.} - tuple with label and function + */ + get(labelFunc: string | Tokenizer.TokinizeFunction): any[]; + /** + * Adds a function with defined label to the end of the queue. + * The function must take a token string as argument and return a token. + * + * @param {string} label - the label + * @param {function} func - the function + */ + add(label: string, func: Tokenizer.TokinizeFunction): void; + /** + * Adds a function with defined label before an existing function to the queue. + * The function must take a token string as argument and return a token. + * + * @param {string|function} labelFunc - an existing label or function + * @param {string} label - the label + * @param {function} func - the function + */ + addBefore(labelFunc: string | Tokenizer.TokinizeFunction, label: string, func: Tokenizer.TokinizeFunction): void; + /** + * Adds a function with defined label after an existing function to the queue. + * The function must take a token string as argument and return a token. + * + * @param {string|function} labelFunc - an existing label or function + * @param {string} label - the label + * @param {function} func - the function + */ + addAfter(labelFunc: string | Tokenizer.TokinizeFunction, label: string, func: Tokenizer.TokinizeFunction): void; + /** + * Removes a function from the queue. + * @param {string|function} labelFunc - an existing label or function + */ + remove(labelFunc: string | Tokenizer.TokinizeFunction): void; + /** + * Resets the splitter and tokenize queue to default. + */ + reset(): void; + /** + * Tokenizes a string into tokens. + * @param {string} str - the string + * @return {string[]} the tokens + */ + tokenize(str: string): string[]; + /** + * Serializes the tokenizer by returning the labels of the used functions. + * @returns {{splitter: string?, tokenizers: string[]}} - the serialization + */ + toJSON(): Tokenizer.Serialization; + /** + * Deserializes the tokenizer by reassign the correct function to each label. + * @param {{splitter: string, tokenizers: string[]}} serialized - the serialized labels + * @param {Object.|Tokenizer} funcTok - the depending functions with labels + * or an equivalent tokenizer + */ + static fromJSONObject(serialized: Tokenizer.Serialization, funcTok?: Tokenizer.FunctionSerialization): Tokenizer; + /** + * Returns the position of a function inside the queue. + * @param {string|function} labelFunc - an existing label or function + * @return {number} the position + * @private + */ + private _getPosition(labelFunc); + /** + * Adds a function with defined label at a specific position to the queue. + * @param {string} label - the label + * @param {function} func - the function + * @param {number} pos - the position + * @private + */ + private _addFunction(label, func, pos); +} +export declare namespace Tokenizer { + type SplitterFunction = (word: string) => string[]; + type TokinizeFunction = (word: string) => string; + interface Serialization { + splitter?: string; + tokenizers: string[]; + } + type FunctionSerialization = { + splitters: Dict; + tokenizers: Dict; + } | Tokenizer; +} diff --git a/dist/packages/memory-storage/types/indexed-storage/src/index.d.ts b/dist/packages/memory-storage/types/indexed-storage/src/index.d.ts new file mode 100644 index 00000000..bf453632 --- /dev/null +++ b/dist/packages/memory-storage/types/indexed-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { IndexedStorage } from "./indexed_storage"; +export { IndexedStorage }; +export default IndexedStorage; diff --git a/dist/packages/memory-storage/types/indexed-storage/src/indexed_storage.d.ts b/dist/packages/memory-storage/types/indexed-storage/src/indexed_storage.d.ts new file mode 100644 index 00000000..adaeaef1 --- /dev/null +++ b/dist/packages/memory-storage/types/indexed-storage/src/indexed_storage.d.ts @@ -0,0 +1,101 @@ +import { StorageAdapter } from "../../common/types"; +/** + * Loki persistence adapter class for indexedDb. + * This class fulfills abstract adapter interface which can be applied to other storage methods. + * Utilizes the included LokiCatalog app/key/value database for actual database persistence. + * IndexedDb storage is provided per-domain, so we implement app/key/value database to + * allow separate contexts for separate apps within a domain. + */ +export declare class IndexedStorage implements StorageAdapter { + private _appname; + private catalog; + /** + * Registers the indexed storage as plugin. + */ + static register(): void; + /** + * Deregisters the indexed storage as plugin. + */ + static deregister(): void; + /** + * @param {string} [appname=loki] - Application name context can be used to distinguish subdomains, "loki" by default + */ + constructor(appname?: string); + /** + * Retrieves a serialized db string from the catalog. + * + * @example + * // LOAD + * var idbAdapter = new LokiIndexedAdapter("finance"); + * var db = new loki("test", { adapter: idbAdapter }); + * db.base(function(result) { + * console.log("done"); + * }); + * + * @param {string} dbname - the name of the database to retrieve. + * @returns {Promise} a Promise that resolves after the database was loaded + */ + loadDatabase(dbname: string): Promise<{}>; + /** + * Saves a serialized db to the catalog. + * + * @example + * // SAVE : will save App/Key/Val as "finance"/"test"/{serializedDb} + * let idbAdapter = new LokiIndexedAdapter("finance"); + * let db = new loki("test", { adapter: idbAdapter }); + * let coll = db.addCollection("testColl"); + * coll.insert({test: "val"}); + * db.saveDatabase(); // could pass callback if needed for async complete + * + * @param {string} dbname - the name to give the serialized database within the catalog. + * @param {string} dbstring - the serialized db string to save. + * @returns {Promise} a Promise that resolves after the database was persisted + */ + saveDatabase(dbname: string, dbstring: string): Promise; + /** + * Deletes a serialized db from the catalog. + * + * @example + * // DELETE DATABASE + * // delete "finance"/"test" value from catalog + * idbAdapter.deleteDatabase("test", function { + * // database deleted + * }); + * + * @param {string} dbname - the name of the database to delete from the catalog. + * @returns {Promise} a Promise that resolves after the database was deleted + */ + deleteDatabase(dbname: string): Promise; + /** + * Removes all database partitions and pages with the base filename passed in. + * This utility method does not (yet) guarantee async deletions will be completed before returning + * + * @param {string} dbname - the base filename which container, partitions, or pages are derived + */ + deleteDatabasePartitions(dbname: string): void; + /** + * Retrieves object array of catalog entries for current app. + * + * @example + * idbAdapter.getDatabaseList(function(result) { + * // result is array of string names for that appcontext ("finance") + * result.forEach(function(str) { + * console.log(str); + * }); + * }); + * + * @param {function} callback - should accept array of database names in the catalog for current app. + */ + getDatabaseList(callback: (names: string[]) => void): void; + /** + * Allows retrieval of list of all keys in catalog along with size + * @param {function} callback - (Optional) callback to accept result array. + */ + getCatalogSummary(callback: (entry: Entry[]) => void): void; +} +export interface Entry { + app: string; + key: string; + size: number; +} +export default IndexedStorage; diff --git a/dist/packages/memory-storage/types/local-storage/src/index.d.ts b/dist/packages/memory-storage/types/local-storage/src/index.d.ts new file mode 100644 index 00000000..2b74e8c0 --- /dev/null +++ b/dist/packages/memory-storage/types/local-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { LocalStorage } from "./local_storage"; +export { LocalStorage }; +export default LocalStorage; diff --git a/dist/packages/memory-storage/types/local-storage/src/local_storage.d.ts b/dist/packages/memory-storage/types/local-storage/src/local_storage.d.ts new file mode 100644 index 00000000..380d8be9 --- /dev/null +++ b/dist/packages/memory-storage/types/local-storage/src/local_storage.d.ts @@ -0,0 +1,36 @@ +import { StorageAdapter } from "../../common/types"; +/** + * A loki persistence adapter which persists to web browser's local storage object + * @constructor LocalStorageAdapter + */ +export declare class LocalStorage implements StorageAdapter { + /** + * Registers the local storage as plugin. + */ + static register(): void; + /** + * Deregisters the local storage as plugin. + */ + static deregister(): void; + /** + * loadDatabase() - Load data from localstorage + * @param {string} dbname - the name of the database to load + * @returns {Promise} a Promise that resolves after the database was loaded + */ + loadDatabase(dbname: string): Promise; + /** + * saveDatabase() - save data to localstorage, will throw an error if the file can't be saved + * might want to expand this to avoid dataloss on partial save + * @param {string} dbname - the filename of the database to load + * @returns {Promise} a Promise that resolves after the database was saved + */ + saveDatabase(dbname: string, dbstring: string): Promise; + /** + * deleteDatabase() - delete the database from localstorage, will throw an error if it + * can't be deleted + * @param {string} dbname - the filename of the database to delete + * @returns {Promise} a Promise that resolves after the database was deleted + */ + deleteDatabase(dbname: string): Promise; +} +export default LocalStorage; diff --git a/dist/packages/memory-storage/types/loki/src/clone.d.ts b/dist/packages/memory-storage/types/loki/src/clone.d.ts new file mode 100644 index 00000000..c74a17bd --- /dev/null +++ b/dist/packages/memory-storage/types/loki/src/clone.d.ts @@ -0,0 +1,5 @@ +export declare type CloneMethod = "parse-stringify" | "deep" | "shallow" | "shallow-recurse-objects"; +/** + * @hidden + */ +export declare function clone(data: T, method?: CloneMethod): T; diff --git a/dist/packages/memory-storage/types/loki/src/collection.d.ts b/dist/packages/memory-storage/types/loki/src/collection.d.ts new file mode 100644 index 00000000..9bd5e091 --- /dev/null +++ b/dist/packages/memory-storage/types/loki/src/collection.d.ts @@ -0,0 +1,608 @@ +import { LokiEventEmitter } from "./event_emitter"; +import { UniqueIndex } from "./unique_index"; +import { ResultSet } from "./result_set"; +import { DynamicView } from "./dynamic_view"; +import { CloneMethod } from "./clone"; +import { Doc, Dict } from "../../common/types"; +import { FullTextSearch } from "../../full-text-search/src/full_text_search"; +import { Tokenizer } from "../../full-text-search/src/tokenizer"; +export { CloneMethod } from "./clone"; +/** + * Collection class that handles documents of same type + * @extends LokiEventEmitter + * @param - the data type + * @param - nested properties of data type + */ +export declare class Collection extends LokiEventEmitter { + name: string; + _data: Doc[]; + private idIndex; + binaryIndices: { + [P in keyof TData]?: Collection.BinaryIndex; + }; + /** + * Unique constraints contain duplicate object references, so they are not persisted. + * We will keep track of properties which have unique constraints applied here, and regenerate on load. + */ + constraints: { + unique: { + [P in keyof TData]?: UniqueIndex; + }; + }; + /** + * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along + * with the database. + */ + transforms: Dict[]>; + /** + * In autosave scenarios we will use collection level dirty flags to determine whether save is needed. + * currently, if any collection is dirty we will autosave the whole database if autosave is configured. + * Defaulting to true since this is called from addCollection and adding a collection should trigger save. + */ + dirty: boolean; + private cachedIndex; + private cachedBinaryIndex; + private cachedData; + /** + * If set to true we will optimally keep indices 'fresh' during insert/update/remove ops (never dirty/never needs rebuild). + * If you frequently intersperse insert/update/remove ops between find ops this will likely be significantly faster option. + */ + adaptiveBinaryIndices: boolean; + /** + * Is collection transactional. + */ + private transactional; + /** + * Options to clone objects when inserting them. + */ + cloneObjects: boolean; + /** + * Default clone method (if enabled) is parse-stringify. + */ + cloneMethod: CloneMethod; + /** + * Disable track changes. + */ + private disableChangesApi; + /** + * Disable delta update object style on changes. + */ + disableDeltaChangesApi: boolean; + /** + * By default, if you insert a document into a collection with binary indices, if those indexed properties contain + * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the + * same 'after' serialization as it was 'before'. + */ + private serializableIndices; + /** + * Option to activate a cleaner daemon - clears "aged" documents at set intervals. + */ + ttl: Collection.TTL; + private maxId; + private _dynamicViews; + /** + * Changes are tracked by collection and aggregated by the db. + */ + private changes; + private insertHandler; + private updateHandler; + console: { + log(...args: any[]): void; + warn(...args: any[]): void; + error(...args: any[]): void; + }; + /** + * stages: a map of uniquely identified 'stages', which hold copies of objects to be + * manipulated without affecting the data in the original collection + */ + private stages; + private commitLog; + _fullTextSearch: FullTextSearch; + /** + * @param {string} name - collection name + * @param {(object)} [options={}] - a configuration object + * @param {string[]} [options.unique=[]] - array of property names to define unique constraints for + * @param {string[]} [options.exact=[]] - array of property names to define exact constraints for + * @param {string[]} [options.indices=[]] - array property names to define binary indexes for + * @param {boolean} [options.adaptiveBinaryIndices=true] - collection indices will be actively rebuilt rather than lazily + * @param {boolean} [options.asyncListeners=false] - whether listeners are invoked asynchronously + * @param {boolean} [options.disableChangesApi=true] - set to false to enable Changes API + * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) + * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user + * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable + * @param {string} [options.cloneMethod="deep"] - the clone method + * @param {number} [options.transactional=false] - ? + * @param {number} options.ttl - ? + * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. + * @see {@link Loki#addCollection} for normal creation of collections + */ + constructor(name: string, options?: Collection.Options); + toJSON(): Collection.Serialized; + static fromJSONObject(obj: Collection.Serialized, options?: Collection.DeserializeOptions): Collection; + /** + * Adds a named collection transform to the collection + * @param {string} name - name to associate with transform + * @param {array} transform - an array of transformation 'step' objects to save into the collection + */ + addTransform(name: string, transform: Collection.Transform[]): void; + /** + * Retrieves a named transform from the collection. + * @param {string} name - name of the transform to lookup. + */ + getTransform(name: string): Collection.Transform[]; + /** + * Updates a named collection transform to the collection + * @param {string} name - name to associate with transform + * @param {object} transform - a transformation object to save into collection + */ + setTransform(name: string, transform: Collection.Transform[]): void; + /** + * Removes a named collection transform from the collection + * @param {string} name - name of collection transform to remove + */ + removeTransform(name: string): void; + private setTTL(age, interval); + /** + * create a row filter that covers all documents in the collection + */ + _prepareFullDocIndex(): number[]; + /** + * Ensure binary index on a certain field + * @param {string} property - name of property to create binary index on + * @param {boolean} [force=false] - flag indicating whether to construct index immediately + */ + ensureIndex(property: keyof TData, force?: boolean): void; + getSequencedIndexValues(property: keyof TData): string; + ensureUniqueIndex(field: keyof TData): UniqueIndex; + /** + * Ensure all binary indices + */ + ensureAllIndexes(force?: boolean): void; + flagBinaryIndexesDirty(): void; + flagBinaryIndexDirty(index: string): void; + /** + * Quickly determine number of documents in collection (or query) + * @param {object} query - (optional) query object to count results of + * @returns {number} number of documents in the collection + */ + count(query?: ResultSet.Query & TNested>): number; + /** + * Rebuild idIndex + */ + private _ensureId(); + /** + * Add a dynamic view to the collection + * @param {string} name - name of dynamic view to add + * @param {object} options - (optional) options to configure dynamic view with + * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' + * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority + * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here) + * @returns {DynamicView} reference to the dynamic view added + **/ + addDynamicView(name: string, options?: DynamicView.Options): DynamicView; + /** + * Remove a dynamic view from the collection + * @param {string} name - name of dynamic view to remove + **/ + removeDynamicView(name: string): void; + /** + * Look up dynamic view reference from within the collection + * @param {string} name - name of dynamic view to retrieve reference of + * @returns {DynamicView} A reference to the dynamic view with that name + **/ + getDynamicView(name: string): DynamicView; + /** + * Applies a 'mongo-like' find query object and passes all results to an update function. + * For filter function querying you should migrate to [ + * Where()]{@link Collection#updateWhere}. + * + * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode) + * @param {function} updateFunction - update function to run against filtered documents + */ + findAndUpdate(filterObject: ResultSet.Query & TNested> | ((obj: Doc) => boolean), updateFunction: (obj: Doc) => any): void; + /** + * Applies a 'mongo-like' find query object removes all documents which match that filter. + * + * @param {object} filterObject - 'mongo-like' query object + */ + findAndRemove(filterObject: ResultSet.Query & TNested>): void; + /** + * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc. + * @param {(object|array)} doc - the document (or array of documents) to be inserted + * @returns {(object|array)} document or documents inserted + */ + insert(doc: TData): Doc; + insert(doc: TData[]): Doc[]; + /** + * Adds a single object, ensures it has meta properties, clone it if necessary, etc. + * @param {object} doc - the document to be inserted + * @param {boolean} bulkInsert - quiet pre-insert and insert event emits + * @returns {object} document or 'undefined' if there was a problem inserting it + */ + insertOne(doc: TData, bulkInsert?: boolean): Doc; + /** + * Empties the collection. + * @param {boolean} [removeIndices=false] - remove indices + */ + clear({removeIndices: removeIndices}?: { + removeIndices?: boolean; + }): void; + /** + * Updates an object and notifies collection that the document has changed. + * @param {object} doc - document to update within the collection + */ + update(doc: Doc | Doc[]): void; + /** + * Add object to collection + */ + private add(obj); + /** + * Applies a filter function and passes all results to an update function. + * + * @param {function} filterFunction - filter function whose results will execute update + * @param {function} updateFunction - update function to run against filtered documents + */ + updateWhere(filterFunction: (obj: Doc) => boolean, updateFunction: (obj: Doc) => any): void; + /** + * Remove all documents matching supplied filter function. + * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}. + * @param {function|object} query - query object to filter on + */ + removeWhere(query: ResultSet.Query & TNested> | ((obj: Doc) => boolean)): void; + removeDataOnly(): void; + /** + * Remove a document from the collection + * @param {number|object} doc - document to remove from collection + */ + remove(doc: number | Doc | Doc[]): void; + /** + * Returns all changes. + * @returns {Collection.Change[]} + */ + getChanges(): Collection.Change[]; + /** + * Enables/disables changes api. + * @param {boolean} disableChangesApi + * @param {boolean} disableDeltaChangesApi + */ + setChangesApi(disableChangesApi: boolean, disableDeltaChangesApi?: boolean): void; + /** + * Clears all the changes. + */ + flushChanges(): void; + private _getObjectDelta(oldObject, newObject); + /** + * Compare changed object (which is a forced clone) with existing object and return the delta + */ + private _getChangeDelta(obj, old); + /** + * This method creates a clone of the current status of an object and associates operation and collection name, + * so the parent db can aggregate and generate a changes object for the entire db + */ + private _createChange(name, op, obj, old?); + private _createInsertChange(obj); + /** + * If the changes API is disabled make sure only metadata is added without re-evaluating everytime if the changesApi is enabled + */ + private _insertMeta(obj); + private _updateMeta(obj); + private _createUpdateChange(obj, old); + private _insertMetaWithChange(obj); + private _updateMetaWithChange(obj, old); + /** + * Get by Id - faster than other methods because of the searching algorithm + * @param {int} id - $loki id of document you want to retrieve + * @param {boolean} returnPosition - if 'true' we will return [object, position] + * @returns {(object|array|null)} Object reference if document was found, null if not, + * or an array if 'returnPosition' was passed. + */ + get(id: number): Doc; + get(id: number, returnPosition: boolean): Doc | [Doc, number]; + /** + * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value + * Since multiple documents may contain the same value (which the index is sorted on), + * we hone in on range and then linear scan range to find exact index array position. + * @param {int} dataPosition : data array index/position + * @param {string} binaryIndexName : index to search for dataPosition in + */ + getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData): number; + /** + * Adaptively insert a selected item to the index. + * @param {int} dataPosition : coll.data array index/position + * @param {string} binaryIndexName : index to search for dataPosition in + */ + adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData): void; + /** + * Adaptively update a selected item within an index. + * @param {int} dataPosition : coll.data array index/position + * @param {string} binaryIndexName : index to search for dataPosition in + */ + adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData): void; + /** + * Adaptively remove a selected item from the index. + * @param {number} dataPosition : coll.data array index/position + * @param {string} binaryIndexName : index to search for dataPosition in + * @param {boolean} removedFromIndexOnly - remove from index only + */ + adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly?: boolean): void; + /** + * Internal method used for index maintenance and indexed searching. + * Calculates the beginning of an index range for a given value. + * For index maintainance (adaptive:true), we will return a valid index position to insert to. + * For querying (adaptive:false/undefined), we will : + * return lower bound/index of range of that value (if found) + * return next lower index position if not found (hole) + * If index is empty it is assumed to be handled at higher level, so + * this method assumes there is at least 1 document in index. + * + * @param {string} prop - name of property which has binary index + * @param {any} val - value to find within index + * @param {bool?} adaptive - if true, we will return insert position + */ + private _calculateRangeStart(prop, val, adaptive?); + /** + * Internal method used for indexed $between. Given a prop (index name), and a value + * (which may or may not yet exist) this will find the final position of that upper range value. + */ + private _calculateRangeEnd(prop, val); + /** + * Binary Search utility method to find range/segment of values matching criteria. + * this is used for collection.find() and first find filter of ResultSet/dynview + * slightly different than get() binary search in that get() hones in on 1 value, + * but we have to hone in on many (range) + * @param {string} op - operation, such as $eq + * @param {string} prop - name of property to calculate range for + * @param {object} val - value to use for range calculation. + * @returns {array} [start, end] index array positions + */ + calculateRange(op: string, prop: keyof TData, val: any): [number, number]; + /** + * Retrieve doc by Unique index + * @param {string} field - name of uniquely indexed property to use when doing lookup + * @param {any} value - unique value to search for + * @returns {object} document matching the value passed + */ + by(field: string, value: any): Doc; + /** + * Find one object by index property, by property equal to value + * @param {object} query - query object used to perform search with + * @returns {(object|null)} First matching document, or null if none + */ + findOne(query: ResultSet.Query & TNested>): Doc; + /** + * Chain method, used for beginning a series of chained find() and/or view() operations + * on a collection. + * + * @param {array} transform - Ordered array of transform step objects similar to chain + * @param {object} parameters - Object containing properties representing parameters to substitute + * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called + */ + chain(transform?: string | Collection.Transform[], parameters?: object): ResultSet; + /** + * Find method, api is similar to mongodb. + * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}. + * @example {@tutorial Query Examples} + * @param {object} query - 'mongo-like' query object + * @returns {array} Array of matching documents + */ + find(query?: ResultSet.Query & TNested>): Doc[]; + /** + * Find object by unindexed field by property equal to value, + * simply iterates and returns the first element matching the query + */ + findOneUnindexed(prop: string, value: any): Doc; + /** + * Transaction methods + */ + /** + * start the transation + */ + startTransaction(): void; + /** + * commit the transation + */ + commit(): void; + /** + * roll back the transation + */ + rollback(): void; + /** + * Query the collection by supplying a javascript filter function. + * @example + * let results = coll.where(function(obj) { + * return obj.legs === 8; + * }); + * + * @param {function} fun - filter function to run against all collection docs + * @returns {array} all documents which pass your filter function + */ + where(fun: (obj: Doc) => boolean): Doc[]; + /** + * Map Reduce operation + * @param {function} mapFunction - function to use as map function + * @param {function} reduceFunction - function to use as reduce function + * @returns {data} The result of your mapReduce operation + */ + mapReduce(mapFunction: (value: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; + /** + * Join two collections on specified properties + * + * @param {array} joinData - array of documents to 'join' to this collection + * @param {string} leftJoinProp - property name in collection + * @param {string} rightJoinProp - property name in joinData + * @param {function} mapFun - (Optional) map function to use + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method + * @returns {ResultSet} Result of the mapping operation + */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinProp: string | ((obj: any) => string), rightJoinProp: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; + /** + * (Staging API) create a stage and/or retrieve it + */ + getStage(name: string): any; + /** + * a collection of objects recording the changes applied through a commmitStage + */ + /** + * (Staging API) create a copy of an object and insert it into a stage + */ + stage(stageName: string, obj: Doc): F; + /** + * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt + * then create a message to be inserted in the commitlog + * @param {string} stageName - name of stage + * @param {string} message + */ + commitStage(stageName: string, message: string): void; + /** + */ + extract(field: string): any[]; + /** + */ + max(field: string): number; + /** + */ + min(field: string): number; + /** + */ + maxRecord(field: string): { + index: number; + value: number; + }; + /** + */ + minRecord(field: string): { + index: number; + value: number; + }; + /** + */ + extractNumerical(field: string): number[]; + /** + * Calculates the average numerical value of a property + * + * @param {string} field - name of property in docs to average + * @returns {number} average of property in all docs in the collection + */ + avg(field: string): number; + /** + * Calculate standard deviation of a field + * @param {string} field + */ + stdDev(field: string): number; + /** + * @param {string} field + */ + mode(field: string): string; + /** + * @param {string} field - property name + */ + median(field: string): number; +} +export declare namespace Collection { + interface Options { + unique?: (keyof TData)[]; + indices?: (keyof TData)[]; + adaptiveBinaryIndices?: boolean; + asyncListeners?: boolean; + disableChangesApi?: boolean; + disableDeltaChangesApi?: boolean; + clone?: boolean; + serializableIndices?: boolean; + cloneMethod?: CloneMethod; + transactional?: boolean; + ttl?: number; + ttlInterval?: number; + fullTextSearch?: FullTextSearch.FieldOptions[]; + } + interface DeserializeOptions { + retainDirtyFlags?: boolean; + fullTextSearch?: Dict; + [collName: string]: any | { + proto?: any; + inflate?: (src: object, dest?: object) => void; + }; + } + interface BinaryIndex { + dirty: boolean; + values: any; + } + interface Change { + name: string; + operation: string; + obj: any; + } + interface Serialized { + name: string; + _dynamicViews: DynamicView[]; + uniqueNames: string[]; + transforms: Dict; + binaryIndices: Dict; + _data: Doc[]; + idIndex: number[]; + maxId: number; + dirty: boolean; + adaptiveBinaryIndices: boolean; + transactional: boolean; + asyncListeners: boolean; + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + cloneObjects: boolean; + cloneMethod: CloneMethod; + changes: any; + _fullTextSearch: FullTextSearch; + } + type Transform = { + type: "find"; + value: ResultSet.Query & TNested> | string; + } | { + type: "where"; + value: ((obj: Doc) => boolean) | string; + } | { + type: "simplesort"; + property: keyof (TData & TNested); + desc?: boolean; + } | { + type: "compoundsort"; + value: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]; + } | { + type: "sort"; + value: (a: Doc, b: Doc) => number; + } | { + type: "sortByScoring"; + desc?: boolean; + } | { + type: "limit"; + value: number; + } | { + type: "offset"; + value: number; + } | { + type: "map"; + value: (obj: TData, index: number, array: TData[]) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "eqJoin"; + joinData: Collection | ResultSet; + leftJoinKey: string | ((obj: any) => string); + rightJoinKey: string | ((obj: any) => string); + mapFun?: (left: any, right: any) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "mapReduce"; + mapFunction: (item: TData, index: number, array: TData[]) => any; + reduceFunction: (array: any[]) => any; + } | { + type: "update"; + value: (obj: Doc) => any; + } | { + type: "remove"; + }; + interface TTL { + age: number; + ttlInterval: number; + daemon: any; + } +} diff --git a/dist/packages/memory-storage/types/loki/src/dynamic_view.d.ts b/dist/packages/memory-storage/types/loki/src/dynamic_view.d.ts new file mode 100644 index 00000000..5cda4b13 --- /dev/null +++ b/dist/packages/memory-storage/types/loki/src/dynamic_view.d.ts @@ -0,0 +1,279 @@ +import { LokiEventEmitter } from "./event_emitter"; +import { ResultSet } from "./result_set"; +import { Collection } from "./collection"; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; +/** + * DynamicView class is a versatile 'live' view class which can have filters and sorts applied. + * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it + * whenever documents are add/updated/removed so it can remain up-to-date. (chainable) + * + * @example + * let mydv = mycollection.addDynamicView('test'); // default is non-persistent + * mydv.applyFind({ 'doors' : 4 }); + * mydv.applyWhere(function(obj) { return obj.name === 'Toyota'; }); + * let results = mydv.data(); + * + * @extends LokiEventEmitter + + * @see {@link Collection#addDynamicView} to construct instances of DynamicView + * + * @param - the data type + * @param - nested properties of data type + */ +export declare class DynamicView extends LokiEventEmitter { + private _collection; + private _persistent; + private _sortPriority; + private _minRebuildInterval; + name: string; + private _rebuildPending; + private _resultSet; + private _resultData; + private _resultDirty; + private _cachedResultSet; + private _filterPipeline; + private _sortFunction; + private _sortCriteria; + private _sortByScoring; + private _sortDirty; + /** + * Constructor. + * @param {Collection} collection - a reference to the collection to work agains + * @param {string} name - the name of this dynamic view + * @param {object} options - the options + * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' + * @param {string} [options.sortPriority="passive"] - the sort priority + * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here) + */ + constructor(collection: Collection, name: string, options?: DynamicView.Options); + /** + * Internally used immediately after deserialization (loading) + * This will clear out and reapply filterPipeline ops, recreating the view. + * Since where filters do not persist correctly, this method allows + * restoring the view to state where user can re-apply those where filters. + * + * @param removeWhereFilters + * @returns {DynamicView} This dynamic view for further chained ops. + * @fires DynamicView.rebuild + */ + _rematerialize({removeWhereFilters}: { + removeWhereFilters?: boolean; + }): this; + /** + * Makes a copy of the internal ResultSet for branched queries. + * Unlike this dynamic view, the branched ResultSet will not be 'live' updated, + * so your branched query should be immediately resolved and not held for future evaluation. + * + * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps + * @param {object} parameters - optional parameters (if optional transform requires them) + * @returns {ResultSet} A copy of the internal ResultSet for branched queries. + */ + branchResultSet(transform?: string | Collection.Transform[], parameters?: object): ResultSet; + /** + * Override of toJSON to avoid circular references. + */ + toJSON(): DynamicView.Serialized; + static fromJSONObject(collection: Collection, obj: DynamicView.Serialized): DynamicView; + /** + * Used to clear pipeline and reset dynamic view to initial state. + * Existing options should be retained. + * @param {boolean} queueSortPhase - (default: false) if true we will async rebuild view (maybe set default to true in future?) + */ + removeFilters({queueSortPhase}?: { + queueSortPhase?: boolean; + }): void; + /** + * Used to apply a sort to the dynamic view + * @example + * dv.applySort(function(obj1, obj2) { + * if (obj1.name === obj2.name) return 0; + * if (obj1.name > obj2.name) return 1; + * if (obj1.name < obj2.name) return -1; + * }); + * + * @param {function} comparefun - a javascript compare function used for sorting + * @returns {DynamicView} this DynamicView object, for further chain ops. + */ + applySort(comparefun: (lhs: Doc, rhs: Doc) => number): this; + /** + * Used to specify a property used for view translation. + * @example + * dv.applySimpleSort("name"); + * + * @param {string} propname - Name of property by which to sort. + * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order. + * @returns {DynamicView} this DynamicView object, for further chain ops. + */ + applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this; + /** + * Allows sorting a ResultSet based on multiple columns. + * @example + * // to sort by age and then name (both ascending) + * dv.applySortCriteria(['age', 'name']); + * // to sort by age (ascending) and then by name (descending) + * dv.applySortCriteria(['age', ['name', true]); + * // to sort by age (descending) and then by name (descending) + * dv.applySortCriteria(['age', true], ['name', true]); + * + * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order + * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations. + */ + applySortCriteria(criteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; + /** + * Used to apply a sort by the latest full-text-search scoring. + * @param {boolean} [ascending=false] - sort ascending + */ + applySortByScoring(ascending?: boolean): this; + /** + * Returns the scoring of the last full-text-search. + * @returns {ScoreResult} + */ + getScoring(): Scorer.ScoreResult; + /** + * Marks the beginning of a transaction. + * @returns {DynamicView} this DynamicView object, for further chain ops. + */ + startTransaction(): this; + /** + * Commits a transaction. + * @returns {DynamicView} this DynamicView object, for further chain ops. + */ + commit(): this; + /** + * Rolls back a transaction. + * @returns {DynamicView} this DynamicView object, for further chain ops. + */ + rollback(): this; + /** + * Find the index of a filter in the pipeline, by that filter's ID. + * + * @param {(string|number)} uid - The unique ID of the filter. + * @returns {number}: index of the referenced filter in the pipeline; -1 if not found. + */ + private _indexOfFilterWithId(uid); + /** + * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet. + * + * @param {object} filter - The filter object. Refer to applyFilter() for extra details. + */ + private _addFilter(filter); + /** + * Reapply all the filters in the current pipeline. + * + * @returns {DynamicView} this DynamicView object, for further chain ops. + */ + reapplyFilters(): this; + /** + * Adds or updates a filter in the DynamicView filter pipeline + * + * @param {object} filter - A filter object to add to the pipeline. + * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id } + * @returns {DynamicView} this DynamicView object, for further chain ops. + */ + applyFilter(filter: DynamicView.Filter): this; + /** + * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline + * + * @param {object} query - A mongo-style query object to apply to pipeline + * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. + * @returns {DynamicView} this DynamicView object, for further chain ops. + */ + applyFind(query: object, uid?: string | number): this; + /** + * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline + * + * @param {function} fun - A javascript filter function to apply to pipeline + * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. + * @returns {DynamicView} this DynamicView object, for further chain ops. + */ + applyWhere(fun: (obj: Doc) => boolean, uid?: string | number): this; + /** + * removeFilter() - Remove the specified filter from the DynamicView filter pipeline + * + * @param {(string|number)} uid - The unique ID of the filter to be removed. + * @returns {DynamicView} this DynamicView object, for further chain ops. + */ + removeFilter(uid: string | number): this; + /** + * Returns the number of documents representing the current DynamicView contents. + * @returns {number} The number of documents representing the current DynamicView contents. + */ + count(): number; + /** + * Resolves and pending filtering and sorting, then returns document array as result. + * + * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when + * the collection is not configured for clone object. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents + * + * @returns {Array} An array of documents representing the current DynamicView contents. + */ + data(options?: ResultSet.DataOptions): Doc[]; + /** + * When the view is not sorted we may still wish to be notified of rebuild events. + * This event will throttle and queue a single rebuild event when batches of updates affect the view. + */ + private _queueRebuildEvent(); + /** + * If the view is sorted we will throttle sorting to either : + * (1) passive - when the user calls data(), or + * (2) active - once they stop updating and yield js thread control + */ + private _queueSortPhase(); + /** + * Invoked synchronously or asynchronously to perform final sort phase (if needed) + */ + private _performSortPhase(options?); + /** + * (Re)evaluating document inclusion. + * Called by : collection.insert() and collection.update(). + * + * @param {int} objIndex - index of document to (re)run through filter pipeline. + * @param {boolean} isNew - true if the document was just added to the collection. + */ + _evaluateDocument(objIndex: number, isNew: boolean): void; + /** + * internal function called on collection.delete() + */ + _removeDocument(objIndex: number): void; + /** + * Data transformation via user supplied functions + * + * @param {function} mapFunction - this function accepts a single document for you to transform and return + * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value + * @returns The output of your reduceFunction + */ + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; +} +export declare namespace DynamicView { + interface Options { + persistent?: boolean; + sortPriority?: SortPriority; + minRebuildInterval?: number; + } + type SortPriority = "passive" | "active"; + interface Serialized { + name: string; + _persistent: boolean; + _sortPriority: SortPriority; + _minRebuildInterval: number; + _resultSet: ResultSet; + _filterPipeline: Filter[]; + _sortCriteria: (string | [string, boolean])[]; + _sortByScoring: boolean; + _sortDirty: boolean; + } + type Filter = { + type: "find"; + val: ResultSet.Query & TNested>; + uid: number | string; + } | { + type: "where"; + val: (obj: Doc) => boolean; + uid: number | string; + }; +} diff --git a/dist/packages/memory-storage/types/loki/src/event_emitter.d.ts b/dist/packages/memory-storage/types/loki/src/event_emitter.d.ts new file mode 100644 index 00000000..e55515e9 --- /dev/null +++ b/dist/packages/memory-storage/types/loki/src/event_emitter.d.ts @@ -0,0 +1,48 @@ +/** + * LokiEventEmitter is a minimalist version of EventEmitter. It enables any + * constructor that inherits EventEmitter to emit events and trigger + * listeners that have been added to the event through the on(event, callback) method + * + * @constructor LokiEventEmitter + */ +export declare class LokiEventEmitter { + /** + * A map, with each property being an array of callbacks. + */ + protected events: object; + /** + * Determines whether or not the callbacks associated with each event should happen in an async fashion or not. + * Default is false, which means events are synchronous + */ + protected asyncListeners: boolean; + constructor(); + /** + * on(eventName, listener) - adds a listener to the queue of callbacks associated to an event + * @param {string|string[]} eventName - the name(s) of the event(s) to listen to + * @param {function} listener - callback function of listener to attach + * @returns {int} the index of the callback in the array of listeners for a particular event + */ + on(eventName: string | string[], listener: Function): Function; + /** + * emit(eventName, data) - emits a particular event + * with the option of passing optional parameters which are going to be processed by the callback + * provided signatures match (i.e. if passing emit(event, arg0, arg1) the listener should take two parameters) + * @param {string} eventName - the name of the event + * @param {object} data - optional object passed with the event + */ + emit(eventName: string, ...data: any[]): void; + /** + * Alias of LokiEventEmitter.prototype.on + * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event + * @param {string|string[]} eventName - the name(s) of the event(s) to listen to + * @param {function} listener - callback function of listener to attach + * @returns {int} the index of the callback in the array of listeners for a particular event + */ + addListener(eventName: string | string[], listener: Function): Function; + /** + * removeListener() - removes the listener at position 'index' from the event 'eventName' + * @param {string|string[]} eventName - the name(s) of the event(s) which the listener is attached to + * @param {function} listener - the listener callback function to remove from emitter + */ + removeListener(eventName: string | string[], listener: Function): void; +} diff --git a/dist/packages/memory-storage/types/loki/src/helper.d.ts b/dist/packages/memory-storage/types/loki/src/helper.d.ts new file mode 100644 index 00000000..44b72305 --- /dev/null +++ b/dist/packages/memory-storage/types/loki/src/helper.d.ts @@ -0,0 +1,39 @@ +/** + * Helper function for determining 'loki' abstract equality which is a little more abstract than == + * aeqHelper(5, '5') === true + * aeqHelper(5.0, '5') === true + * aeqHelper(new Date("1/1/2011"), new Date("1/1/2011")) === true + * aeqHelper({a:1}, {z:4}) === true (all objects sorted equally) + * aeqHelper([1, 2, 3], [1, 3]) === false + * aeqHelper([1, 2, 3], [1, 2, 3]) === true + * aeqHelper(undefined, null) === true + * @param {any} prop1 + * @param {any} prop2 + * @returns {boolean} + * @hidden + */ +export declare function aeqHelper(prop1: any, prop2: any): boolean; +/** + * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. + * In the future we might want $lt and $gt ops to use their own functionality/helper. + * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we + * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another. + * @hidden + */ +export declare function ltHelper(prop1: any, prop2: any, equal: boolean): boolean; +/** + * @hidden + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} equal + * @returns {boolean} + */ +export declare function gtHelper(prop1: any, prop2: any, equal: boolean): boolean; +/** + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} descending + * @returns {number} + * @hidden + */ +export declare function sortHelper(prop1: any, prop2: any, descending: boolean): number; diff --git a/dist/packages/memory-storage/types/loki/src/index.d.ts b/dist/packages/memory-storage/types/loki/src/index.d.ts new file mode 100644 index 00000000..17ee6df4 --- /dev/null +++ b/dist/packages/memory-storage/types/loki/src/index.d.ts @@ -0,0 +1,4 @@ +import { Loki } from "./loki"; +import { Collection } from "./collection"; +export { Loki, Collection }; +export default Loki; diff --git a/dist/packages/memory-storage/types/loki/src/loki.d.ts b/dist/packages/memory-storage/types/loki/src/loki.d.ts new file mode 100644 index 00000000..f2deafd2 --- /dev/null +++ b/dist/packages/memory-storage/types/loki/src/loki.d.ts @@ -0,0 +1,322 @@ +import { LokiEventEmitter } from "./event_emitter"; +import { Collection } from "./collection"; +import { Doc, StorageAdapter } from "../../common/types"; +export declare class Loki extends LokiEventEmitter { + private filename; + private databaseVersion; + private engineVersion; + private _collections; + private _verbose; + private _env; + private _serializationMethod; + private _destructureDelimiter; + private _persistenceMethod; + private _persistenceAdapter; + private _throttledSaves; + private _throttledSaveRunning; + private _throttledSavePending; + private _autosave; + private _autosaveInterval; + private _autosaveHandle; + /** + * Constructs the main database class. + * @param {string} filename - name of the file to be saved to + * @param {object} [options={}] - options + * @param {Loki.Environment} [options.env] - the javascript environment + * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method + * @param {string} [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization + * @param {boolean} [options.verbose=false] - enable console output + */ + constructor(filename?: string, options?: Loki.Options); + /** + * configures options related to database persistence. + * + * @param {Loki.PersistenceOptions} [options={}] - options + * @param {adapter} [options.adapter=auto] - an instance of a loki persistence adapter + * @param {boolean} [options.autosave=false] - enables autosave + * @param {int} [options.autosaveInterval=5000] - time interval (in milliseconds) between saves (if dirty) + * @param {boolean} [options.autoload=false] - enables autoload on loki instantiation + * @param {object} options.inflate - options that are passed to loadDatabase if autoload enabled + * @param {boolean} [options.throttledSaves=true] - if true, it batches multiple calls to to saveDatabase reducing number of + * disk I/O operations and guaranteeing proper serialization of the calls. Default value is true. + * @param {Loki.PersistenceMethod} options.persistenceMethod - a persistence method which should be used (FS_STORAGE, LOCAL_STORAGE...) + * @returns {Promise} a Promise that resolves after initialization and (if enabled) autoloading the database + */ + initializePersistence(options?: Loki.PersistenceOptions): Promise; + /** + * Copies 'this' database into a new Loki instance. Object references are shared to make lightweight. + * @param {object} options - options + * @param {boolean} options.removeNonSerializable - nulls properties not safe for serialization. + */ + copy(options?: Loki.CopyOptions): Loki; + /** + * Adds a collection to the database. + * @param {string} name - name of collection to add + * @param {object} [options={}] - options to configure collection with. + * @param {array} [options.unique=[]] - array of property names to define unique constraints for + * @param {array} [options.exact=[]] - array of property names to define exact constraints for + * @param {array} [options.indices=[]] - array property names to define binary indexes for + * @param {boolean} [options.asyncListeners=false] - whether listeners are called asynchronously + * @param {boolean} [options.disableChangesApi=true] - set to false to enable Changes Api + * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user + * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method + * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. + * @returns {Collection} a reference to the collection which was just added + */ + addCollection(name: string, options?: Collection.Options): Collection; + loadCollection(collection: Collection): void; + /** + * Retrieves reference to a collection by name. + * @param {string} collectionName - name of collection to look up + * @returns {Collection} Reference to collection in database by that name, or null if not found + */ + getCollection(collectionName: string): Collection; + /** + * Renames an existing loki collection + * @param {string} oldName - name of collection to rename + * @param {string} newName - new name of collection + * @returns {Collection} reference to the newly renamed collection + */ + renameCollection(oldName: string, newName: string): Collection; + listCollections(): { + name: string; + count: number; + }[]; + /** + * Removes a collection from the database. + * @param {string} collectionName - name of collection to remove + */ + removeCollection(collectionName: string): void; + getName(): string; + /** + * Serialize database to a string which can be loaded via {@link Loki#loadJSON} + * + * @returns {string} Stringified representation of the loki database. + */ + serialize(options?: Loki.SerializeOptions): string | string[]; + toJSON(): Loki.Serialized; + /** + * Database level destructured JSON serialization routine to allow alternate serialization methods. + * Internally, Loki supports destructuring via loki "serializationMethod' option and + * the optional LokiPartitioningAdapter class. It is also available if you wish to do + * your own structured persistence or data exchange. + * + * @param {object} options - output format options for use externally to loki + * @param {boolean} [options.partitioned=false] - whether db and each collection are separate + * @param {int} options.partition - can be used to only output an individual collection or db (-1) + * @param {boolean} [options.delimited=true] - whether subitems are delimited or subarrays + * @param {string} options.delimiter - override default delimiter + * + * @returns {string|Array} A custom, restructured aggregation of independent serializations. + */ + serializeDestructured(options?: Loki.SerializeDestructuredOptions): string | string[]; + /** + * Collection level utility method to serialize a collection in a 'destructured' format + * + * @param {object} options - used to determine output of method + * @param {int} options.delimited - whether to return single delimited string or an array + * @param {string} options.delimiter - (optional) if delimited, this is delimiter to use + * @param {int} options.collectionIndex - specify which collection to serialize data for + * + * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection. + */ + serializeCollection(options?: { + delimited?: boolean; + collectionIndex?: number; + delimiter?: string; + }): string | string[]; + /** + * Database level destructured JSON deserialization routine to minimize memory overhead. + * Internally, Loki supports destructuring via loki "serializationMethod' option and + * the optional LokiPartitioningAdapter class. It is also available if you wish to do + * your own structured persistence or data exchange. + * + * @param {string|array} destructuredSource - destructured json or array to deserialize from + * @param {object} options - source format options + * @param {boolean} [options.partitioned=false] - whether db and each collection are separate + * @param {int} options.partition - can be used to deserialize only a single partition + * @param {boolean} [options.delimited=true] - whether subitems are delimited or subarrays + * @param {string} options.delimiter - override default delimiter + * + * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array + */ + deserializeDestructured(destructuredSource: string | string[], options?: Loki.SerializeDestructuredOptions): any; + /** + * Collection level utility function to deserializes a destructured collection. + * + * @param {string|string[]} destructuredSource - destructured representation of collection to inflate + * @param {object} options - used to describe format of destructuredSource input + * @param {int} [options.delimited=false] - whether source is delimited string or an array + * @param {string} options.delimiter - if delimited, this is delimiter to use (if other than default) + * + * @returns {Array} an array of documents to attach to collection.data. + */ + deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc[]; + /** + * Inflates a loki database from a serialized JSON string + * + * @param {string} serializedDb - a serialized loki database string + * @param {object} options - apply or override collection level settings + * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved + */ + loadJSON(serializedDb: string | string[], options?: Collection.DeserializeOptions): void; + /** + * Inflates a loki database from a JS object + * + * @param {object} dbObject - a serialized loki database object + * @param {object} options - apply or override collection level settings + * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved + */ + loadJSONObject(dbObject: Loki, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki.Serialized, options?: Collection.DeserializeOptions): void; + /** + * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer. + * Does not actually destroy the db. + * + * @returns {Promise} a Promise that resolves after closing the database succeeded + */ + close(): Promise; + /**-------------------------+ + | Changes API | + +--------------------------*/ + /** + * The Changes API enables the tracking the changes occurred in the collections since the beginning of the session, + * so it's possible to create a differential dataset for synchronization purposes (possibly to a remote db) + */ + /** + * (Changes API) : takes all the changes stored in each + * collection and creates a single array for the entire database. If an array of names + * of collections is passed then only the included collections will be tracked. + * + * @param {Array} [arrayOfCollectionNames=] - array of collection names. No arg means all collections are processed. + * @returns {Array} array of changes + * @see private method _createChange() in Collection + */ + generateChangesNotification(arrayOfCollectionNames?: string[]): Collection.Change[]; + /** + * (Changes API) - stringify changes for network transmission + * @returns {string} string representation of the changes + */ + serializeChanges(collectionNamesArray?: string[]): string; + /** + * (Changes API) : clears all the changes in all collections. + */ + clearChanges(): void; + /** + * Wait for throttledSaves to complete and invoke your callback when drained or duration is met. + * + * @param {object} options - configuration options + * @param {boolean} [options.recursiveWait=true] - if after queue is drained, another save was kicked off, wait for it + * @param {boolean} [options.recursiveWaitLimit=false] - limit our recursive waiting to a duration + * @param {number} [options.recursiveWaitLimitDuration=2000] - cutoff in ms to stop recursively re-draining + * @param {Date} [options.started=now()] - the start time of the recursive wait duration + * @returns {Promise} a Promise that resolves when save queue is drained, it is passed a sucess parameter value + */ + throttledSaveDrain(options?: Loki.ThrottledDrainOptions): Promise; + /** + * Internal load logic, decoupled from throttling/contention logic + * + * @param {object} options - an object containing inflation options for each collection + * @returns {Promise} a Promise that resolves after the database is loaded + */ + private _loadDatabase(options?); + /** + * Handles manually loading from an adapter storage (such as fs-storage) + * This method utilizes loki configuration options (if provided) to determine which + * persistence method to use, or environment detection (if configuration was not provided). + * To avoid contention with any throttledSaves, we will drain the save queue first. + * + * If you are configured with autosave, you do not need to call this method yourself. + * + * @param {object} [options={}] - if throttling saves and loads, this controls how we drain save queue before loading + * @param {boolean} [options.recursiveWait=true] wait recursively until no saves are queued + * @param {boolean} [options.recursiveWaitLimit=false] limit our recursive waiting to a duration + * @param {number} [options.recursiveWaitLimitDelay=2000] cutoff in ms to stop recursively re-draining + * @param {Date} [options.started=now()] - the start time of the recursive wait duration + * @returns {Promise} a Promise that resolves after the database is loaded + */ + loadDatabase(options?: Loki.LoadDatabaseOptions): Promise; + private _saveDatabase(); + /** + * Handles manually saving to an adapter storage (such as fs-storage) + * This method utilizes loki configuration options (if provided) to determine which + * persistence method to use, or environment detection (if configuration was not provided). + * + * If you are configured with autosave, you do not need to call this method yourself. + * + * @returns {Promise} a Promise that resolves after the database is persisted + */ + saveDatabase(): Promise; + /** + * Handles deleting a database from the underlying storage adapter + * + * @returns {Promise} a Promise that resolves after the database is deleted + */ + deleteDatabase(): Promise; + /** + * Starts periodically saves to the underlying storage adapter. + */ + autosaveEnable(): void; + /** + * Stops the autosave interval timer. + */ + autosaveDisable(): void; +} +export declare namespace Loki { + interface Options { + env?: Environment; + serializationMethod?: SerializationMethod; + destructureDelimiter?: string; + verbose?: boolean; + } + interface PersistenceOptions { + adapter?: StorageAdapter; + autosave?: boolean; + autosaveInterval?: number; + autoload?: boolean; + throttledSaves?: boolean; + persistenceMethod?: Loki.PersistenceMethod; + inflate?: any; + } + interface CopyOptions { + removeNonSerializable?: boolean; + } + interface SerializeOptions { + serializationMethod?: SerializationMethod; + } + interface SerializeDestructuredOptions { + partitioned?: boolean; + partition?: number; + delimited?: boolean; + delimiter?: string; + } + interface DeserializeCollectionOptions { + partitioned?: boolean; + delimited?: boolean; + delimiter?: string; + } + interface ThrottledDrainOptions { + recursiveWait?: boolean; + recursiveWaitLimit?: boolean; + recursiveWaitLimitDuration?: number; + started?: Date; + } + interface Serialized { + _env: Environment; + _serializationMethod: SerializationMethod; + _autosave: boolean; + _autosaveInterval: number; + _collections: Collection[]; + databaseVersion: number; + engineVersion: number; + filename: string; + _persistenceAdapter: StorageAdapter; + _persistenceMethod: PersistenceMethod; + _throttledSaves: boolean; + _verbose: boolean; + } + type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; + type SerializationMethod = "normal" | "pretty" | "destructured"; + type PersistenceMethod = "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter"; + type Environment = "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "MEMORY"; +} diff --git a/dist/packages/memory-storage/types/loki/src/result_set.d.ts b/dist/packages/memory-storage/types/loki/src/result_set.d.ts new file mode 100644 index 00000000..b29e3a52 --- /dev/null +++ b/dist/packages/memory-storage/types/loki/src/result_set.d.ts @@ -0,0 +1,302 @@ +import { Collection } from "./collection"; +import { CloneMethod } from "./clone"; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; +import { Query as FullTextSearchQuery } from "../../full-text-search/src/query_builder"; +/** + * @hidden + */ +export declare const LokiOps: { + $eq(a: any, b: any): boolean; + $aeq(a: any, b: any): boolean; + $ne(a: any, b: any): boolean; + $dteq(a: any, b: any): boolean; + $gt(a: any, b: any): boolean; + $gte(a: any, b: any): boolean; + $lt(a: any, b: any): boolean; + $lte(a: any, b: any): boolean; + $between(a: any, range: [any, any]): boolean; + $in(a: any, b: any): boolean; + $nin(a: any, b: any): boolean; + $keyin(a: string, b: object): boolean; + $nkeyin(a: string, b: object): boolean; + $definedin(a: string, b: object): boolean; + $undefinedin(a: string, b: object): boolean; + $regex(a: string, b: RegExp): boolean; + $containsString(a: any, b: string): boolean; + $containsNone(a: any, b: any): boolean; + $containsAny(a: any, b: any): boolean; + $contains(a: any, b: any): boolean; + $type(a: any, b: any): boolean; + $finite(a: number, b: boolean): boolean; + $size(a: any, b: any): boolean; + $len(a: any, b: any): boolean; + $where(a: any, b: any): boolean; + $not(a: any, b: any): boolean; + $and(a: any, b: any): boolean; + $or(a: any, b: any): boolean; +}; +/** + * ResultSet class allowing chainable queries. Intended to be instanced internally. + * Collection.find(), Collection.where(), and Collection.chain() instantiate this. + * + * @example + * mycollection.chain() + * .find({ 'doors' : 4 }) + * .where(function(obj) { return obj.name === 'Toyota' }) + * .data(); + * + * @param - the data type + * @param - nested properties of data type + */ +export declare class ResultSet { + _collection: Collection; + _filteredRows: number[]; + _filterInitialized: boolean; + private _scoring; + /** + * Constructor. + * @param {Collection} collection - the collection which this ResultSet will query against + */ + constructor(collection: Collection); + /** + * reset() - Reset the ResultSet to its initial state. + * + * @returns {ResultSet} Reference to this ResultSet, for future chain operations. + */ + reset(): this; + /** + * Override of toJSON to avoid circular references + * + */ + toJSON(): ResultSet; + /** + * Allows you to limit the number of documents passed to next chain operation. + * A ResultSet copy() is made to avoid altering original ResultSet. + * + * @param {int} qty - The number of documents to return. + * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops. + */ + limit(qty: number): this; + /** + * Used for skipping 'pos' number of documents in the ResultSet. + * + * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. + * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops. + */ + offset(pos: number): this; + /** + * copy() - To support reuse of ResultSet in branched query situations. + * + * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same. + */ + copy(): ResultSet; + /** + * Alias of copy() + */ + branch(): ResultSet; + /** + * Executes a named collection transform or raw array of transform steps against the ResultSet. + * + * @param {(string|array)} transform - name of collection transform or raw transform array + * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. + * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps) + */ + transform(transform: string | Collection.Transform[], parameters?: object): this; + /** + * User supplied compare function is provided two documents to compare. (chainable) + * @example + * rslt.sort(function(obj1, obj2) { + * if (obj1.name === obj2.name) return 0; + * if (obj1.name > obj2.name) return 1; + * if (obj1.name < obj2.name) return -1; + * }); + * + * @param {function} comparefun - A javascript compare function used for sorting. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + sort(comparefun: (a: Doc, b: Doc) => number): this; + /** + * Simpler, loose evaluation for user to sort based on a property name. (chainable). + * Sorting based on the same lt/gt helper functions used for binary indices. + * + * @param {string} propname - name of property to sort by. + * @param {boolean} [descending=false] - if true, the property will be sorted in descending order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + simplesort(propname: keyof (TData & TNested), descending?: boolean): this; + /** + * Allows sorting a ResultSet based on multiple columns. + * @example + * // to sort by age and then name (both ascending) + * rs.compoundsort(['age', 'name']); + * // to sort by age (ascending) and then by name (descending) + * rs.compoundsort(['age', ['name', true]); + * + * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + compoundsort(properties: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; + /** + * Helper function for compoundsort(), performing individual object comparisons + * + * @param {Array} properties - array of property names, in order, by which to evaluate sort order + * @param {object} obj1 - first object to compare + * @param {object} obj2 - second object to compare + * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first + */ + private _compoundeval(properties, obj1, obj2); + /** + * Sorts the ResultSet based on the last full-text-search scoring. + * @param {boolean} [ascending=false] - sort ascending + * @returns {ResultSet} + */ + sortByScoring(ascending?: boolean): this; + /** + * Returns the scoring of the last full-text-search. + * @returns {ScoreResult} + */ + getScoring(): Scorer.ScoreResult; + /** + * Oversee the operation of OR'ed query expressions. + * OR'ed expression evaluation runs each expression individually against the full collection, + * and finally does a set OR on each expression's results. + * Each evaluation can utilize a binary index to prevent multiple linear array scans. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findOr(expressionArray: ResultSet.Query & TNested>[]): this; + $or(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Oversee the operation of AND'ed query expressions. + * AND'ed expression evaluation runs each expression progressively against the full collection, + * internally utilizing existing chained ResultSet functionality. + * Only the first filter can utilize a binary index. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findAnd(expressionArray: ResultSet.Query & TNested>[]): this; + $and(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Used for querying via a mongo-style query object. + * + * @param {object} query - A mongo-style query object used for filtering current results. + * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() + * @returns {ResultSet} this ResultSet for further chain ops. + */ + find(query?: ResultSet.Query & TNested>, firstOnly?: boolean): this; + /** + * Used for filtering via a javascript filter function. + * + * @param {function} fun - A javascript function used for filtering current results by. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + where(fun: (obj: Doc) => boolean): this; + /** + * Returns the number of documents in the ResultSet. + * @returns {number} The number of documents in the ResultSet. + */ + count(): number; + /** + * Terminates the chain and returns array of filtered documents + * @param {object} options + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when + * the collection is not configured for clone object. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values 'parse-stringify', 'deep', and 'shallow' and + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents + * + * @returns {Array} Array of documents in the ResultSet + */ + data(options?: ResultSet.DataOptions): Doc[]; + /** + * Used to run an update operation on all documents currently in the ResultSet. + * + * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + update(updateFunction: (obj: Doc) => TData): this; + /** + * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet) + * + * @returns {ResultSet} this (empty) ResultSet for further chain ops. + */ + remove(): this; + /** + * data transformation via user supplied functions + * + * @param {function} mapFunction - this function accepts a single document for you to transform and return + * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value + * @returns {value} The output of your reduceFunction + */ + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; + /** + * Left joining two sets of data. Join keys can be defined or calculated properties + * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key + * @param {Array|ResultSet|Collection} joinData - Data array to join to. + * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on + * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on + * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} + * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method + * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}] + */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinKey: string | ((obj: any) => string), rightJoinKey: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; + /** + * Applies a map function into a new collection for further chaining. + * @param {function} mapFun - javascript map function + * @param {object} [dataOptions=] - options to data() before input to your map function + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method + * @return {ResultSet} + */ + map(mapFun: (obj: TData, index: number, array: TData[]) => U, dataOptions?: ResultSet.DataOptions): ResultSet; +} +export declare namespace ResultSet { + interface DataOptions { + forceClones?: boolean; + forceCloneMethod?: CloneMethod; + removeMeta?: boolean; + } + type LokiOps = { + $eq?: R; + $aeq?: R; + $ne?: R; + $dteq?: R; + $gt?: R; + $gte?: R; + $lt?: R; + $lte?: R; + $between?: [R, R]; + $in?: R[]; + $nin?: R[]; + $keyin?: object; + $nkeyin?: object; + $definedin?: object; + $undefinedin?: object; + $regex?: RegExp | string | [string, string]; + $containsString?: string; + $containsNone?: R[] | R; + $containsAny?: R[] | R; + $contains?: any; + $type?: string; + $finite?: boolean; + $size?: number; + $len?: number; + $where?: (val?: R) => boolean; + }; + type Query = { + [P in keyof TData]?: LokiOps | TData[P]; + } & { + $and?: Query[]; + } & { + $or?: Query[]; + } & { + $fts?: FullTextSearchQuery; + }; +} diff --git a/dist/packages/memory-storage/types/loki/src/unique_index.d.ts b/dist/packages/memory-storage/types/loki/src/unique_index.d.ts new file mode 100644 index 00000000..55284c11 --- /dev/null +++ b/dist/packages/memory-storage/types/loki/src/unique_index.d.ts @@ -0,0 +1,37 @@ +import { Doc } from "../../common/types"; +export declare class UniqueIndex { + private _field; + private _keyMap; + /** + * Constructs an unique index object. + * @param {number|string} propertyField - the property field to index + */ + constructor(propertyField: keyof E); + /** + * Sets a document's unique index. + * @param {Doc} doc - the document + * @param {number} row - the data row of the document + */ + set(doc: Doc, row: number): void; + /** + * Returns the data row of an unique index. + * @param {number|string} index - the index + * @returns {number | string} - the row + */ + get(index: keyof E): number; + /** + * Updates a document's unique index. + * @param {Object} doc - the document + * @param {number} row - the data row of the document + */ + update(doc: Doc, row: number): void; + /** + * Removes an unique index. + * @param {number|string} index - the unique index + */ + remove(index: number | string): void; + /** + * Clears all unique indexes. + */ + clear(): void; +} diff --git a/dist/packages/memory-storage/types/memory-storage/src/index.d.ts b/dist/packages/memory-storage/types/memory-storage/src/index.d.ts new file mode 100644 index 00000000..5330aa7d --- /dev/null +++ b/dist/packages/memory-storage/types/memory-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { MemoryStorage } from "./memory_storage"; +export { MemoryStorage }; +export default MemoryStorage; diff --git a/dist/packages/memory-storage/types/memory-storage/src/memory_storage.d.ts b/dist/packages/memory-storage/types/memory-storage/src/memory_storage.d.ts new file mode 100644 index 00000000..0066a1de --- /dev/null +++ b/dist/packages/memory-storage/types/memory-storage/src/memory_storage.d.ts @@ -0,0 +1,57 @@ +import { Dict, StorageAdapter } from "../../common/types"; +/** + * An in-memory persistence adapter for an in-memory database. + * This simple 'key/value' adapter is intended for unit testing and diagnostics. + */ +export declare class MemoryStorage implements StorageAdapter { + hashStore: Dict<{ + savecount: number; + lastsave: Date; + value: string; + }>; + options: MemoryStorage.Options; + /** + * Registers the local storage as plugin. + */ + static register(): void; + /** + * Deregisters the local storage as plugin. + */ + static deregister(): void; + /** + * @param {object} options - memory storage options + * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) + * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) + */ + constructor(options?: MemoryStorage.Options); + /** + * Loads a serialized database from its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was loaded + */ + loadDatabase(dbname: string): Promise; + /** + * Saves a serialized database to its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @param {string} dbstring - the database content + * @returns {Promise} a Promise that resolves after the database was persisted + */ + saveDatabase(dbname: string, dbstring: string): Promise; + /** + * Deletes a database from its in-memory store. + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was deleted + */ + deleteDatabase(dbname: string): Promise; +} +export declare namespace MemoryStorage { + interface Options { + asyncResponses?: boolean; + asyncTimeout?: number; + } +} diff --git a/dist/packages/memory-storage/types/partitioning-adapter/src/index.d.ts b/dist/packages/memory-storage/types/partitioning-adapter/src/index.d.ts new file mode 100644 index 00000000..bf49882f --- /dev/null +++ b/dist/packages/memory-storage/types/partitioning-adapter/src/index.d.ts @@ -0,0 +1,3 @@ +import { PartitioningAdapter } from "./partitioning_adapter"; +export { PartitioningAdapter }; +export default PartitioningAdapter; diff --git a/dist/packages/memory-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts b/dist/packages/memory-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts new file mode 100644 index 00000000..45e14850 --- /dev/null +++ b/dist/packages/memory-storage/types/partitioning-adapter/src/partitioning_adapter.d.ts @@ -0,0 +1,85 @@ +import { Loki } from "../../loki/src/loki"; +import { StorageAdapter } from "../../common/types"; +/** + * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter + * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and + * only dirty collections will be saved. If you turn on paging with default page size of 25megs and save + * a 75 meg collection it should use up roughly 3 save slots (key/value pairs sent to inner adapter). + * A dirty collection that spans three pages will save all three pages again + * Paging mode was added mainly because Chrome has issues saving 'too large' of a string within a + * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all + * of that collection's pages will be written on next save. + */ +export declare class PartitioningAdapter implements StorageAdapter { + mode: string; + private _adapter; + private _dbref; + private _dbname; + private _pageIterator; + private _paging; + private _pageSize; + private _delimiter; + private _dirtyPartitions; + /** + * Registers the partitioning adapter as plugin. + */ + static register(): void; + /** + * Deregisters the partitioning storage as plugin. + */ + static deregister(): void; + /** + * @param {object} adapter - reference to a 'non-reference' mode loki adapter instance. + * @param {boolean} paging - (default: false) set to true to enable paging collection data. + * @param {number} pageSize - (default : 25MB) you can use this to limit size of strings passed to inner adapter. + * @param {string} delimiter - allows you to override the default delimiter + */ + constructor(adapter: StorageAdapter, {paging, pageSize, delimiter}?: { + paging?: boolean; + pageSize?: number; + delimiter?: string; + }); + /** + * Loads a database which was partitioned into several key/value saves. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was loaded + */ + loadDatabase(dbname: string): Promise; + /** + * Used to sequentially load each collection partition, one at a time. + * + * @param {int} partition - ordinal collection position to load next + * @returns {Promise} a Promise that resolves after the next partition is loaded + */ + private _loadNextPartition(partition); + /** + * Used to sequentially load the next page of collection partition, one at a time. + * + * @returns {Promise} a Promise that resolves after the next page is loaded + */ + private _loadNextPage(); + /** + * Saves a database by partioning into separate key/value saves. + * (Loki 'reference mode' persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @param {object} dbref - reference to database which we will partition and save. + * @returns {Promise} a Promise that resolves after the database was deleted + * + */ + exportDatabase(dbname: string, dbref: Loki): Promise; + /** + * Helper method used internally to save each dirty collection, one at a time. + * + * @returns {Promise} a Promise that resolves after the next partition is saved + */ + private _saveNextPartition(); + /** + * Helper method used internally to generate and save the next page of the current (dirty) partition. + * + * @returns {Promise} a Promise that resolves after the next partition is saved + */ + private _saveNextPage(); +} diff --git a/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.js b/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.js index 37247813..07affb77 100644 --- a/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.js +++ b/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.js @@ -7,7 +7,7 @@ exports["@lokijs/partitioning-adapter"] = factory(require("@lokijs/loki")); else { root["@lokijs/partitioning-adapter"] = factory(root["@lokijs/loki"]); root["LokiPartitioningAdapter"] = root["@lokijs/partitioning-adapter"].default;} -})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__) { +})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_2__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -79,9 +79,21 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__loki_src_loki__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partitioning_adapter__ = __webpack_require__(1); +/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "PartitioningAdapter", function() { return __WEBPACK_IMPORTED_MODULE_0__partitioning_adapter__["a"]; }); + + +/* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__partitioning_adapter__["a" /* PartitioningAdapter */]); + + +/***/ }), +/* 1 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__loki_src_loki__ = __webpack_require__(2); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__loki_src_loki___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__loki_src_loki__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_plugin__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_plugin__ = __webpack_require__(3); /** @@ -94,18 +106,18 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all * of that collection's pages will be written on next save. */ -class LokiPartitioningAdapter { +class PartitioningAdapter { /** * Registers the partitioning adapter as plugin. */ static register() { - __WEBPACK_IMPORTED_MODULE_1__common_plugin__["a" /* PLUGINS */]["LokiPartitioningAdapter"] = LokiPartitioningAdapter; + __WEBPACK_IMPORTED_MODULE_1__common_plugin__["a" /* PLUGINS */]["PartitioningAdapter"] = PartitioningAdapter; } /** * Deregisters the partitioning storage as plugin. */ static deregister() { - delete __WEBPACK_IMPORTED_MODULE_1__common_plugin__["a" /* PLUGINS */]["LokiPartitioningAdapter"]; + delete __WEBPACK_IMPORTED_MODULE_1__common_plugin__["a" /* PLUGINS */]["PartitioningAdapter"]; } /** * @param {object} adapter - reference to a 'non-reference' mode loki adapter instance. @@ -154,7 +166,7 @@ class LokiPartitioningAdapter { let db = JSON.parse(result); this._dbref.loadJSONObject(db); db = null; - if (this._dbref._collections.length === 0) { + if (this._dbref["_collections"].length === 0) { return this._dbref; } this._pageIterator = { @@ -171,18 +183,16 @@ class LokiPartitioningAdapter { * @returns {Promise} a Promise that resolves after the next partition is loaded */ _loadNextPartition(partition) { - const keyname = this._dbname + "." + partition; if (this._paging === true) { this._pageIterator.pageIndex = 0; return this._loadNextPage(); } + const keyname = this._dbname + "." + partition; return this._adapter.loadDatabase(keyname).then((result) => { - const data = this._dbref.deserializeCollection(result, { - delimited: true, - collectionIndex: partition + this._dbref["_collections"][partition]._data = this._dbref.deserializeCollection(result, { + delimited: true }); - this._dbref._collections[partition].data = data; - if (++partition < this._dbref._collections.length) { + if (++partition < this._dbref["_collections"].length) { return this._loadNextPartition(partition); } }); @@ -200,7 +210,6 @@ class LokiPartitioningAdapter { let data = result.split(this._delimiter); result = ""; // free up memory now that we have split it into array let dlen = data.length; - let idx; // detect if last page by presence of final empty string element and remove it if so const isLastPage = (data[dlen - 1] === ""); if (isLastPage) { @@ -213,15 +222,15 @@ class LokiPartitioningAdapter { } } // convert stringified array elements to object instances and push to collection data - for (idx = 0; idx < dlen; idx++) { - this._dbref._collections[this._pageIterator.collection].data.push(JSON.parse(data[idx])); + for (let idx = 0; idx < dlen; idx++) { + this._dbref["_collections"][this._pageIterator.collection]._data.push(JSON.parse(data[idx])); data[idx] = null; } data = []; // if last page, we are done with this partition if (isLastPage) { // if there are more partitions, kick off next partition load - if (++this._pageIterator.collection < this._dbref._collections.length) { + if (++this._pageIterator.collection < this._dbref["_collections"].length) { return this._loadNextPartition(this._pageIterator.collection); } } @@ -241,14 +250,12 @@ class LokiPartitioningAdapter { * */ exportDatabase(dbname, dbref) { - let idx; - const clen = dbref._collections.length; this._dbref = dbref; this._dbname = dbname; // queue up dirty partitions to be saved this._dirtyPartitions = [-1]; - for (idx = 0; idx < clen; idx++) { - if (dbref._collections[idx].dirty) { + for (let idx = 0; idx < dbref["_collections"].length; idx++) { + if (dbref["_collections"][idx].dirty) { this._dirtyPartitions.push(idx); } } @@ -294,10 +301,10 @@ class LokiPartitioningAdapter { * @returns {Promise} a Promise that resolves after the next partition is saved */ _saveNextPage() { - const coll = this._dbref._collections[this._pageIterator.collection]; + const coll = this._dbref["_collections"][this._pageIterator.collection]; const keyname = this._dbname + "." + this._pageIterator.collection + "." + this._pageIterator.pageIndex; let pageLen = 0; - const cdlen = coll.data.length; + const cdlen = coll._data.length; const delimlen = this._delimiter.length; let serializedObject = ""; let pageBuilder = ""; @@ -311,13 +318,13 @@ class LokiPartitioningAdapter { return this._saveNextPage(); } }; - if (coll.data.length === 0) { + if (coll._data.length === 0) { doneWithPartition = true; } while (!doneWithPartition && !doneWithPage) { if (!doneWithPartition) { // serialize object - serializedObject = JSON.stringify(coll.data[this._pageIterator.docIndex]); + serializedObject = JSON.stringify(coll._data[this._pageIterator.docIndex]); pageBuilder += serializedObject; pageLen += serializedObject.length; // if no more documents in collection to add, we are done with partition @@ -338,18 +345,18 @@ class LokiPartitioningAdapter { return this._adapter.saveDatabase(keyname, pageBuilder).then(pageSaveCallback); } } -/* harmony export (immutable) */ __webpack_exports__["LokiPartitioningAdapter"] = LokiPartitioningAdapter; +/* harmony export (immutable) */ __webpack_exports__["a"] = PartitioningAdapter; /***/ }), -/* 1 */ +/* 2 */ /***/ (function(module, exports) { -module.exports = __WEBPACK_EXTERNAL_MODULE_1__; +module.exports = __WEBPACK_EXTERNAL_MODULE_2__; /***/ }), -/* 2 */ +/* 3 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -375,10 +382,10 @@ const PLUGINS = create(); /* harmony export (immutable) */ __webpack_exports__["a"] = PLUGINS; -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(3))) +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(4))) /***/ }), -/* 3 */ +/* 4 */ /***/ (function(module, exports) { var g; diff --git a/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.js.map b/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.js.map index 02c4d735..3d809852 100644 --- a/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.js.map +++ b/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 277e3978ee2f4d6bc094","webpack:///./packages/partitioning-adapter/src/partitioning_adapter.ts","webpack:///external \"@lokijs/loki\"","webpack:///./packages/common/plugin.ts","webpack:///(webpack)/buildin/global.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;AC7DyC;AAEG;AAE5C;;;;;;;;;GASG;AACG;IAYJ;;OAEG;IACH,MAAM,CAAC,QAAQ;QACb,+DAAO,CAAC,yBAAyB,CAAC,GAAG,uBAAuB,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU;QACf,OAAO,+DAAO,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,YAAY,OAAuB,EAAE,EAAC,MAAM,GAAG,KAAK,EAAE,QAAQ,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,SAAS,GAAG,MAAM,EAAC,GAAG,EAAE;QACzG,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAA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,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACI,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAAA;AAAA;;;;;;;;ACtBhC;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"lokijs.partitioning-adapter.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@lokijs/loki\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@lokijs/loki\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/partitioning-adapter\"] = factory(require(\"@lokijs/loki\"));\n\telse\n\t\troot[\"@lokijs/partitioning-adapter\"] = factory(root[\"@lokijs/loki\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 277e3978ee2f4d6bc094","import {Loki} from \"../../loki/src/loki\";\nimport {ANY, StorageAdapter} from \"../../common/types\";\nimport {PLUGINS} from \"../../common/plugin\";\n\n/**\n * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter\n * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and\n * only dirty collections will be saved. If you turn on paging with default page size of 25megs and save\n * a 75 meg collection it should use up roughly 3 save slots (key/value pairs sent to inner adapter).\n * A dirty collection that spans three pages will save all three pages again\n * Paging mode was added mainly because Chrome has issues saving 'too large' of a string within a\n * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all\n * of that collection's pages will be written on next save.\n */\nexport class LokiPartitioningAdapter implements StorageAdapter {\n\n public mode: string;\n private _adapter: StorageAdapter;\n private _dbref: ANY;\n private _dbname: string;\n private _pageIterator: LokiPartitioningAdapter.PageIterator;\n private _paging: boolean;\n private _pageSize: number;\n private _delimiter: string;\n private _dirtyPartitions: number[];\n\n /**\n * Registers the partitioning adapter as plugin.\n */\n static register(): void {\n PLUGINS[\"LokiPartitioningAdapter\"] = LokiPartitioningAdapter;\n }\n\n /**\n * Deregisters the partitioning storage as plugin.\n */\n static deregister(): void {\n delete PLUGINS[\"LokiPartitioningAdapter\"];\n }\n\n /**\n * @param {object} adapter - reference to a 'non-reference' mode loki adapter instance.\n * @param {boolean} paging - (default: false) set to true to enable paging collection data.\n * @param {number} pageSize - (default : 25MB) you can use this to limit size of strings passed to inner adapter.\n * @param {string} delimiter - allows you to override the default delimiter\n */\n constructor(adapter: StorageAdapter, {paging = false, pageSize = 25 * 1024 * 1024, delimiter = \"$<\\n\"} = {}) {\n this.mode = \"reference\";\n this._adapter = null;\n this._dbref = null;\n this._dbname = \"\";\n this._pageIterator = {};\n\n // verify user passed an appropriate adapter\n if (adapter) {\n if (adapter.mode === \"reference\") {\n throw new Error(\"LokiPartitioningAdapter cannot be instantiated with a reference mode adapter.\");\n } else {\n this._adapter = adapter;\n }\n } else {\n throw new Error(\"LokiPartitioningAdapter requires a (non-reference mode) adapter on construction.\");\n }\n\n this._paging = paging;\n this._pageSize = pageSize;\n this._delimiter = delimiter;\n }\n\n /**\n * Loads a database which was partitioned into several key/value saves.\n * (Loki persistence adapter interface function)\n *\n * @param {string} dbname - name of the database (filename/keyname)\n * @returns {Promise} a Promise that resolves after the database was loaded\n */\n public loadDatabase(dbname: string): Promise {\n this._dbname = dbname;\n this._dbref = new Loki(dbname);\n\n // load the db container (without data)\n return this._adapter.loadDatabase(dbname).then((result: string) => {\n if (typeof result !== \"string\") {\n throw new Error(\"LokiPartitioningAdapter received an unexpected response from inner adapter loadDatabase()\");\n }\n\n // I will want to use loki destructuring helper methods so i will inflate into typed instance\n let db = JSON.parse(result);\n this._dbref.loadJSONObject(db);\n db = null;\n\n if (this._dbref._collections.length === 0) {\n return this._dbref;\n }\n\n this._pageIterator = {\n collection: 0,\n pageIndex: 0\n };\n\n return this._loadNextPartition(0).then(() => this._dbref);\n });\n }\n\n /**\n * Used to sequentially load each collection partition, one at a time.\n *\n * @param {int} partition - ordinal collection position to load next\n * @returns {Promise} a Promise that resolves after the next partition is loaded\n */\n private _loadNextPartition(partition: number): Promise {\n const keyname = this._dbname + \".\" + partition;\n\n if (this._paging === true) {\n this._pageIterator.pageIndex = 0;\n return this._loadNextPage();\n }\n\n return this._adapter.loadDatabase(keyname).then((result: string) => {\n const data = this._dbref.deserializeCollection(result, {\n delimited: true,\n collectionIndex: partition\n });\n this._dbref._collections[partition].data = data;\n\n if (++partition < this._dbref._collections.length) {\n return this._loadNextPartition(partition);\n }\n });\n }\n\n /**\n * Used to sequentially load the next page of collection partition, one at a time.\n *\n * @returns {Promise} a Promise that resolves after the next page is loaded\n */\n private _loadNextPage(): Promise {\n // calculate name for next saved page in sequence\n const keyname = this._dbname + \".\" + this._pageIterator.collection + \".\" + this._pageIterator.pageIndex;\n\n // load whatever page is next in sequence\n return this._adapter.loadDatabase(keyname).then((result: string) => {\n let data = result.split(this._delimiter);\n result = \"\"; // free up memory now that we have split it into array\n let dlen = data.length;\n let idx;\n\n // detect if last page by presence of final empty string element and remove it if so\n const isLastPage = (data[dlen - 1] === \"\");\n if (isLastPage) {\n data.pop();\n dlen = data.length;\n // empty collections are just a delimiter meaning two blank items\n if (data[dlen - 1] === \"\" && dlen === 1) {\n data.pop();\n dlen = data.length;\n }\n }\n\n // convert stringified array elements to object instances and push to collection data\n for (idx = 0; idx < dlen; idx++) {\n this._dbref._collections[this._pageIterator.collection].data.push(JSON.parse(data[idx]));\n data[idx] = null;\n }\n data = [];\n\n // if last page, we are done with this partition\n if (isLastPage) {\n // if there are more partitions, kick off next partition load\n if (++this._pageIterator.collection < this._dbref._collections.length) {\n return this._loadNextPartition(this._pageIterator.collection);\n }\n } else {\n this._pageIterator.pageIndex++;\n return this._loadNextPage();\n }\n });\n }\n\n /**\n * Saves a database by partioning into separate key/value saves.\n * (Loki 'reference mode' persistence adapter interface function)\n *\n * @param {string} dbname - name of the database (filename/keyname)\n * @param {object} dbref - reference to database which we will partition and save.\n * @returns {Promise} a Promise that resolves after the database was deleted\n *\n */\n public exportDatabase(dbname: string, dbref: ANY): Promise {\n let idx;\n const clen = dbref._collections.length;\n\n this._dbref = dbref;\n this._dbname = dbname;\n\n // queue up dirty partitions to be saved\n this._dirtyPartitions = [-1];\n for (idx = 0; idx < clen; idx++) {\n if (dbref._collections[idx].dirty) {\n this._dirtyPartitions.push(idx);\n }\n }\n\n return this._saveNextPartition();\n }\n\n /**\n * Helper method used internally to save each dirty collection, one at a time.\n *\n * @returns {Promise} a Promise that resolves after the next partition is saved\n */\n private _saveNextPartition(): Promise {\n const partition = this._dirtyPartitions.shift();\n const keyname = this._dbname + ((partition === -1) ? \"\" : (\".\" + partition));\n\n // if we are doing paging and this is collection partition\n if (this._paging && partition !== -1) {\n this._pageIterator = {\n collection: partition,\n docIndex: 0,\n pageIndex: 0\n };\n\n // since saveNextPage recursively calls itself until done, our callback means this whole paged partition is finished\n return this._saveNextPage().then(() => {\n if (this._dirtyPartitions.length !== 0) {\n return this._saveNextPartition();\n }\n });\n }\n\n // otherwise this is 'non-paged' partioning...\n const result = this._dbref.serializeDestructured({\n partitioned: true,\n delimited: true,\n partition\n });\n\n return this._adapter.saveDatabase(keyname, result).then(() => {\n if (this._dirtyPartitions.length !== 0) {\n return this._saveNextPartition();\n }\n });\n }\n\n /**\n * Helper method used internally to generate and save the next page of the current (dirty) partition.\n *\n * @returns {Promise} a Promise that resolves after the next partition is saved\n */\n private _saveNextPage(): Promise {\n const coll = this._dbref._collections[this._pageIterator.collection];\n const keyname = this._dbname + \".\" + this._pageIterator.collection + \".\" + this._pageIterator.pageIndex;\n let pageLen = 0;\n const cdlen = coll.data.length;\n const delimlen = this._delimiter.length;\n let serializedObject = \"\";\n let pageBuilder = \"\";\n let doneWithPartition = false;\n let doneWithPage = false;\n\n const pageSaveCallback = () => {\n pageBuilder = \"\";\n\n // update meta properties then continue process by invoking callback\n if (!doneWithPartition) {\n this._pageIterator.pageIndex++;\n return this._saveNextPage();\n }\n };\n\n if (coll.data.length === 0) {\n doneWithPartition = true;\n }\n\n while (!doneWithPartition && !doneWithPage) {\n if (!doneWithPartition) {\n // serialize object\n serializedObject = JSON.stringify(coll.data[this._pageIterator.docIndex]);\n pageBuilder += serializedObject;\n pageLen += serializedObject.length;\n\n // if no more documents in collection to add, we are done with partition\n if (++this._pageIterator.docIndex >= cdlen) doneWithPartition = true;\n }\n // if our current page is bigger than defined pageSize, we are done with page\n if (pageLen >= this._pageSize) doneWithPage = true;\n\n // if not done with current page, need delimiter before next item\n // if done with partition we also want a delmiter to indicate 'end of pages' final empty row\n if (!doneWithPage || doneWithPartition) {\n pageBuilder += this._delimiter;\n pageLen += delimlen;\n }\n }\n // if we are done with page save it and pass off to next recursive call or callback\n return this._adapter.saveDatabase(keyname, pageBuilder).then(pageSaveCallback);\n }\n}\n\nnamespace LokiPartitioningAdapter {\n export interface PageIterator {\n collection?: ANY;\n docIndex?: number;\n pageIndex?: number;\n }\n}\n\nexport default LokiPartitioningAdapter;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/partitioning-adapter/src/partitioning_adapter.ts","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@lokijs/loki\"\n// module id = 1\n// module chunks = 0","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 0b7d29396ecc6bfff3e5","webpack:///./packages/partitioning-adapter/src/index.ts","webpack:///./packages/partitioning-adapter/src/partitioning_adapter.ts","webpack:///external \"@lokijs/loki\"","webpack:///./packages/common/plugin.ts","webpack:///(webpack)/buildin/global.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;AC7D2D;AAE9B;AAC7B,+DAAe,kFAAmB,EAAC;;;;;;;;;;;ACHM;AAEG;AAE5C;;;;;;;;;GASG;AACG;IAYJ;;OAEG;IACH,MAAM,CAAC,QAAQ;QACb,+DAAO,CAAC,qBAAqB,CAAC,GAAG,mBAAmB,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU;QACf,OAAO,+DAAO,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,YAAY,OAAuB,EAAE,EAAC,MAAM,GAAG,KAAK,EAAE,QAAQ,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,SAAS,GAAG,M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GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACI,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAAA;AAAA;;;;;;;;ACtBhC;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"lokijs.partitioning-adapter.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@lokijs/loki\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@lokijs/loki\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@lokijs/partitioning-adapter\"] = factory(require(\"@lokijs/loki\"));\n\telse\n\t\troot[\"@lokijs/partitioning-adapter\"] = factory(root[\"@lokijs/loki\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_2__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 0b7d29396ecc6bfff3e5","import {PartitioningAdapter} from \"./partitioning_adapter\";\n\nexport {PartitioningAdapter};\nexport default PartitioningAdapter;\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/partitioning-adapter/src/index.ts","import {Loki} from \"../../loki/src/loki\";\nimport {StorageAdapter} from \"../../common/types\";\nimport {PLUGINS} from \"../../common/plugin\";\n\n/**\n * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter\n * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and\n * only dirty collections will be saved. If you turn on paging with default page size of 25megs and save\n * a 75 meg collection it should use up roughly 3 save slots (key/value pairs sent to inner adapter).\n * A dirty collection that spans three pages will save all three pages again\n * Paging mode was added mainly because Chrome has issues saving 'too large' of a string within a\n * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all\n * of that collection's pages will be written on next save.\n */\nexport class PartitioningAdapter implements StorageAdapter {\n\n public mode: string;\n private _adapter: StorageAdapter;\n private _dbref: Loki;\n private _dbname: string;\n private _pageIterator: PartitioningAdapter.PageIterator;\n private _paging: boolean;\n private _pageSize: number;\n private _delimiter: string;\n private _dirtyPartitions: number[];\n\n /**\n * Registers the partitioning adapter as plugin.\n */\n static register(): void {\n PLUGINS[\"PartitioningAdapter\"] = PartitioningAdapter;\n }\n\n /**\n * Deregisters the partitioning storage as plugin.\n */\n static deregister(): void {\n delete PLUGINS[\"PartitioningAdapter\"];\n }\n\n /**\n * @param {object} adapter - reference to a 'non-reference' mode loki adapter instance.\n * @param {boolean} paging - (default: false) set to true to enable paging collection data.\n * @param {number} pageSize - (default : 25MB) you can use this to limit size of strings passed to inner adapter.\n * @param {string} delimiter - allows you to override the default delimiter\n */\n constructor(adapter: StorageAdapter, {paging = false, pageSize = 25 * 1024 * 1024, delimiter = \"$<\\n\"} = {}) {\n this.mode = \"reference\";\n this._adapter = null;\n this._dbref = null;\n this._dbname = \"\";\n this._pageIterator = {};\n\n // verify user passed an appropriate adapter\n if (adapter) {\n if (adapter.mode === \"reference\") {\n throw new Error(\"LokiPartitioningAdapter cannot be instantiated with a reference mode adapter.\");\n } else {\n this._adapter = adapter;\n }\n } else {\n throw new Error(\"LokiPartitioningAdapter requires a (non-reference mode) adapter on construction.\");\n }\n\n this._paging = paging;\n this._pageSize = pageSize;\n this._delimiter = delimiter;\n }\n\n /**\n * Loads a database which was partitioned into several key/value saves.\n * (Loki persistence adapter interface function)\n *\n * @param {string} dbname - name of the database (filename/keyname)\n * @returns {Promise} a Promise that resolves after the database was loaded\n */\n public loadDatabase(dbname: string): Promise {\n this._dbname = dbname;\n this._dbref = new Loki(dbname);\n\n // load the db container (without data)\n return this._adapter.loadDatabase(dbname).then((result: string) => {\n if (typeof result !== \"string\") {\n throw new Error(\"LokiPartitioningAdapter received an unexpected response from inner adapter loadDatabase()\");\n }\n\n // I will want to use loki destructuring helper methods so i will inflate into typed instance\n let db = JSON.parse(result);\n this._dbref.loadJSONObject(db);\n db = null;\n\n if (this._dbref[\"_collections\"].length === 0) {\n return this._dbref;\n }\n\n this._pageIterator = {\n collection: 0,\n pageIndex: 0\n };\n\n return this._loadNextPartition(0).then(() => this._dbref);\n });\n }\n\n /**\n * Used to sequentially load each collection partition, one at a time.\n *\n * @param {int} partition - ordinal collection position to load next\n * @returns {Promise} a Promise that resolves after the next partition is loaded\n */\n private _loadNextPartition(partition: number): Promise {\n if (this._paging === true) {\n this._pageIterator.pageIndex = 0;\n return this._loadNextPage();\n }\n\n const keyname = this._dbname + \".\" + partition;\n return this._adapter.loadDatabase(keyname).then((result: string) => {\n this._dbref[\"_collections\"][partition]._data = this._dbref.deserializeCollection(result, {\n delimited: true\n });\n\n if (++partition < this._dbref[\"_collections\"].length) {\n return this._loadNextPartition(partition);\n }\n });\n }\n\n /**\n * Used to sequentially load the next page of collection partition, one at a time.\n *\n * @returns {Promise} a Promise that resolves after the next page is loaded\n */\n private _loadNextPage(): Promise {\n // calculate name for next saved page in sequence\n const keyname = this._dbname + \".\" + this._pageIterator.collection + \".\" + this._pageIterator.pageIndex;\n\n // load whatever page is next in sequence\n return this._adapter.loadDatabase(keyname).then((result: string) => {\n let data = result.split(this._delimiter);\n result = \"\"; // free up memory now that we have split it into array\n let dlen = data.length;\n\n // detect if last page by presence of final empty string element and remove it if so\n const isLastPage = (data[dlen - 1] === \"\");\n if (isLastPage) {\n data.pop();\n dlen = data.length;\n // empty collections are just a delimiter meaning two blank items\n if (data[dlen - 1] === \"\" && dlen === 1) {\n data.pop();\n dlen = data.length;\n }\n }\n\n // convert stringified array elements to object instances and push to collection data\n for (let idx = 0; idx < dlen; idx++) {\n this._dbref[\"_collections\"][this._pageIterator.collection]._data.push(JSON.parse(data[idx]));\n data[idx] = null;\n }\n data = [];\n\n // if last page, we are done with this partition\n if (isLastPage) {\n // if there are more partitions, kick off next partition load\n if (++this._pageIterator.collection < this._dbref[\"_collections\"].length) {\n return this._loadNextPartition(this._pageIterator.collection);\n }\n } else {\n this._pageIterator.pageIndex++;\n return this._loadNextPage();\n }\n });\n }\n\n /**\n * Saves a database by partioning into separate key/value saves.\n * (Loki 'reference mode' persistence adapter interface function)\n *\n * @param {string} dbname - name of the database (filename/keyname)\n * @param {object} dbref - reference to database which we will partition and save.\n * @returns {Promise} a Promise that resolves after the database was deleted\n *\n */\n public exportDatabase(dbname: string, dbref: Loki): Promise {\n this._dbref = dbref;\n this._dbname = dbname;\n\n // queue up dirty partitions to be saved\n this._dirtyPartitions = [-1];\n for (let idx = 0; idx < dbref[\"_collections\"].length; idx++) {\n if (dbref[\"_collections\"][idx].dirty) {\n this._dirtyPartitions.push(idx);\n }\n }\n\n return this._saveNextPartition();\n }\n\n /**\n * Helper method used internally to save each dirty collection, one at a time.\n *\n * @returns {Promise} a Promise that resolves after the next partition is saved\n */\n private _saveNextPartition(): Promise {\n const partition = this._dirtyPartitions.shift();\n const keyname = this._dbname + ((partition === -1) ? \"\" : (\".\" + partition));\n\n // if we are doing paging and this is collection partition\n if (this._paging && partition !== -1) {\n this._pageIterator = {\n collection: partition,\n docIndex: 0,\n pageIndex: 0\n };\n\n // since saveNextPage recursively calls itself until done, our callback means this whole paged partition is finished\n return this._saveNextPage().then(() => {\n if (this._dirtyPartitions.length !== 0) {\n return this._saveNextPartition();\n }\n });\n }\n\n // otherwise this is 'non-paged' partioning...\n const result = this._dbref.serializeDestructured({\n partitioned: true,\n delimited: true,\n partition\n });\n\n return this._adapter.saveDatabase(keyname, result as string).then(() => {\n if (this._dirtyPartitions.length !== 0) {\n return this._saveNextPartition();\n }\n });\n }\n\n /**\n * Helper method used internally to generate and save the next page of the current (dirty) partition.\n *\n * @returns {Promise} a Promise that resolves after the next partition is saved\n */\n private _saveNextPage(): Promise {\n const coll = this._dbref[\"_collections\"][this._pageIterator.collection];\n const keyname = this._dbname + \".\" + this._pageIterator.collection + \".\" + this._pageIterator.pageIndex;\n let pageLen = 0;\n const cdlen = coll._data.length;\n const delimlen = this._delimiter.length;\n let serializedObject = \"\";\n let pageBuilder = \"\";\n let doneWithPartition = false;\n let doneWithPage = false;\n\n const pageSaveCallback = () => {\n pageBuilder = \"\";\n\n // update meta properties then continue process by invoking callback\n if (!doneWithPartition) {\n this._pageIterator.pageIndex++;\n return this._saveNextPage();\n }\n };\n\n if (coll._data.length === 0) {\n doneWithPartition = true;\n }\n\n while (!doneWithPartition && !doneWithPage) {\n if (!doneWithPartition) {\n // serialize object\n serializedObject = JSON.stringify(coll._data[this._pageIterator.docIndex]);\n pageBuilder += serializedObject;\n pageLen += serializedObject.length;\n\n // if no more documents in collection to add, we are done with partition\n if (++this._pageIterator.docIndex >= cdlen) doneWithPartition = true;\n }\n // if our current page is bigger than defined pageSize, we are done with page\n if (pageLen >= this._pageSize) doneWithPage = true;\n\n // if not done with current page, need delimiter before next item\n // if done with partition we also want a delmiter to indicate 'end of pages' final empty row\n if (!doneWithPage || doneWithPartition) {\n pageBuilder += this._delimiter;\n pageLen += delimlen;\n }\n }\n // if we are done with page save it and pass off to next recursive call or callback\n return this._adapter.saveDatabase(keyname, pageBuilder).then(pageSaveCallback);\n }\n}\n\nnamespace PartitioningAdapter {\n export interface PageIterator {\n collection?: number;\n docIndex?: number;\n pageIndex?: number;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/partitioning-adapter/src/partitioning_adapter.ts","module.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@lokijs/loki\"\n// module id = 2\n// module chunks = 0","function getGlobal(): any {\n let glob;\n (function (global) {\n glob = global;\n })(global !== undefined && global || this);\n return glob;\n}\n\n\nfunction create(): void {\n const global = getGlobal();\n const sym = Symbol.for(\"LOKI\") as any;\n if (global[sym] === undefined) {\n global[sym] = {\n };\n }\n return global[sym];\n}\n\n/**\n * @hidden\n */\nexport const PLUGINS = create();\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/tslint-loader??ref--0!./packages/common/plugin.ts","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 4\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.min.js b/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.min.js index 5a16208b..ed1f1484 100644 --- a/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.min.js +++ b/dist/packages/partitioning-adapter/lokijs.partitioning-adapter.min.js @@ -1 +1 @@ -(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory(require("@lokijs/loki"));else if(typeof define==="function"&&define.amd)define(["@lokijs/loki"],factory);else if(typeof exports==="object")exports["@lokijs/partitioning-adapter"]=factory(require("@lokijs/loki"));else{root["@lokijs/partitioning-adapter"]=factory(root["@lokijs/loki"]);root["LokiPartitioningAdapter"]=root["@lokijs/partitioning-adapter"].default}})(typeof self!=="undefined"?self:this,function(__WEBPACK_EXTERNAL_MODULE_1__){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__loki_src_loki__=__webpack_require__(1);var __WEBPACK_IMPORTED_MODULE_0__loki_src_loki___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__loki_src_loki__);var __WEBPACK_IMPORTED_MODULE_1__common_plugin__=__webpack_require__(2);class LokiPartitioningAdapter{static register(){__WEBPACK_IMPORTED_MODULE_1__common_plugin__["a"]["LokiPartitioningAdapter"]=LokiPartitioningAdapter}static deregister(){delete __WEBPACK_IMPORTED_MODULE_1__common_plugin__["a"]["LokiPartitioningAdapter"]}constructor(adapter,{paging:paging=false,pageSize:pageSize=25*1024*1024,delimiter:delimiter="$<\n"}={}){this.mode="reference";this._adapter=null;this._dbref=null;this._dbname="";this._pageIterator={};if(adapter){if(adapter.mode==="reference"){throw new Error("LokiPartitioningAdapter cannot be instantiated with a reference mode adapter.")}else{this._adapter=adapter}}else{throw new Error("LokiPartitioningAdapter requires a (non-reference mode) adapter on construction.")}this._paging=paging;this._pageSize=pageSize;this._delimiter=delimiter}loadDatabase(dbname){this._dbname=dbname;this._dbref=new __WEBPACK_IMPORTED_MODULE_0__loki_src_loki__["Loki"](dbname);return this._adapter.loadDatabase(dbname).then(result=>{if(typeof result!=="string"){throw new Error("LokiPartitioningAdapter received an unexpected response from inner adapter loadDatabase()")}let db=JSON.parse(result);this._dbref.loadJSONObject(db);db=null;if(this._dbref._collections.length===0){return this._dbref}this._pageIterator={collection:0,pageIndex:0};return this._loadNextPartition(0).then(()=>this._dbref)})}_loadNextPartition(partition){const keyname=this._dbname+"."+partition;if(this._paging===true){this._pageIterator.pageIndex=0;return this._loadNextPage()}return this._adapter.loadDatabase(keyname).then(result=>{const data=this._dbref.deserializeCollection(result,{delimited:true,collectionIndex:partition});this._dbref._collections[partition].data=data;if(++partition{let data=result.split(this._delimiter);result="";let dlen=data.length;let idx;const isLastPage=data[dlen-1]==="";if(isLastPage){data.pop();dlen=data.length;if(data[dlen-1]===""&&dlen===1){data.pop();dlen=data.length}}for(idx=0;idx{if(this._dirtyPartitions.length!==0){return this._saveNextPartition()}})}const result=this._dbref.serializeDestructured({partitioned:true,delimited:true,partition:partition});return this._adapter.saveDatabase(keyname,result).then(()=>{if(this._dirtyPartitions.length!==0){return this._saveNextPartition()}})}_saveNextPage(){const coll=this._dbref._collections[this._pageIterator.collection];const keyname=this._dbname+"."+this._pageIterator.collection+"."+this._pageIterator.pageIndex;let pageLen=0;const cdlen=coll.data.length;const delimlen=this._delimiter.length;let serializedObject="";let pageBuilder="";let doneWithPartition=false;let doneWithPage=false;const pageSaveCallback=()=>{pageBuilder="";if(!doneWithPartition){this._pageIterator.pageIndex++;return this._saveNextPage()}};if(coll.data.length===0){doneWithPartition=true}while(!doneWithPartition&&!doneWithPage){if(!doneWithPartition){serializedObject=JSON.stringify(coll.data[this._pageIterator.docIndex]);pageBuilder+=serializedObject;pageLen+=serializedObject.length;if(++this._pageIterator.docIndex>=cdlen)doneWithPartition=true}if(pageLen>=this._pageSize)doneWithPage=true;if(!doneWithPage||doneWithPartition){pageBuilder+=this._delimiter;pageLen+=delimlen}}return this._adapter.saveDatabase(keyname,pageBuilder).then(pageSaveCallback)}}__webpack_exports__["LokiPartitioningAdapter"]=LokiPartitioningAdapter},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE_1__},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){function getGlobal(){let glob;(function(global){glob=global})(global!==undefined&&global||this);return glob}function create(){const global=getGlobal();const sym=Symbol.for("LOKI");if(global[sym]===undefined){global[sym]={}}return global[sym]}const PLUGINS=create();__webpack_exports__["a"]=PLUGINS}).call(__webpack_exports__,__webpack_require__(3))},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(1,eval)("this")}catch(e){if(typeof window==="object")g=window}module.exports=g}])}); \ No newline at end of file +(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory(require("@lokijs/loki"));else if(typeof define==="function"&&define.amd)define(["@lokijs/loki"],factory);else if(typeof exports==="object")exports["@lokijs/partitioning-adapter"]=factory(require("@lokijs/loki"));else{root["@lokijs/partitioning-adapter"]=factory(root["@lokijs/loki"]);root["LokiPartitioningAdapter"]=root["@lokijs/partitioning-adapter"].default}})(typeof self!=="undefined"?self:this,function(__WEBPACK_EXTERNAL_MODULE_2__){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";Object.defineProperty(__webpack_exports__,"__esModule",{value:true});var __WEBPACK_IMPORTED_MODULE_0__partitioning_adapter__=__webpack_require__(1);__webpack_require__.d(__webpack_exports__,"PartitioningAdapter",function(){return __WEBPACK_IMPORTED_MODULE_0__partitioning_adapter__["a"]});__webpack_exports__["default"]=__WEBPACK_IMPORTED_MODULE_0__partitioning_adapter__["a"]},function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0__loki_src_loki__=__webpack_require__(2);var __WEBPACK_IMPORTED_MODULE_0__loki_src_loki___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__loki_src_loki__);var __WEBPACK_IMPORTED_MODULE_1__common_plugin__=__webpack_require__(3);class PartitioningAdapter{static register(){__WEBPACK_IMPORTED_MODULE_1__common_plugin__["a"]["PartitioningAdapter"]=PartitioningAdapter}static deregister(){delete __WEBPACK_IMPORTED_MODULE_1__common_plugin__["a"]["PartitioningAdapter"]}constructor(adapter,{paging:paging=false,pageSize:pageSize=25*1024*1024,delimiter:delimiter="$<\n"}={}){this.mode="reference";this._adapter=null;this._dbref=null;this._dbname="";this._pageIterator={};if(adapter){if(adapter.mode==="reference"){throw new Error("LokiPartitioningAdapter cannot be instantiated with a reference mode adapter.")}else{this._adapter=adapter}}else{throw new Error("LokiPartitioningAdapter requires a (non-reference mode) adapter on construction.")}this._paging=paging;this._pageSize=pageSize;this._delimiter=delimiter}loadDatabase(dbname){this._dbname=dbname;this._dbref=new __WEBPACK_IMPORTED_MODULE_0__loki_src_loki__["Loki"](dbname);return this._adapter.loadDatabase(dbname).then(result=>{if(typeof result!=="string"){throw new Error("LokiPartitioningAdapter received an unexpected response from inner adapter loadDatabase()")}let db=JSON.parse(result);this._dbref.loadJSONObject(db);db=null;if(this._dbref["_collections"].length===0){return this._dbref}this._pageIterator={collection:0,pageIndex:0};return this._loadNextPartition(0).then(()=>this._dbref)})}_loadNextPartition(partition){if(this._paging===true){this._pageIterator.pageIndex=0;return this._loadNextPage()}const keyname=this._dbname+"."+partition;return this._adapter.loadDatabase(keyname).then(result=>{this._dbref["_collections"][partition]._data=this._dbref.deserializeCollection(result,{delimited:true});if(++partition{let data=result.split(this._delimiter);result="";let dlen=data.length;const isLastPage=data[dlen-1]==="";if(isLastPage){data.pop();dlen=data.length;if(data[dlen-1]===""&&dlen===1){data.pop();dlen=data.length}}for(let idx=0;idx{if(this._dirtyPartitions.length!==0){return this._saveNextPartition()}})}const result=this._dbref.serializeDestructured({partitioned:true,delimited:true,partition:partition});return this._adapter.saveDatabase(keyname,result).then(()=>{if(this._dirtyPartitions.length!==0){return this._saveNextPartition()}})}_saveNextPage(){const coll=this._dbref["_collections"][this._pageIterator.collection];const keyname=this._dbname+"."+this._pageIterator.collection+"."+this._pageIterator.pageIndex;let pageLen=0;const cdlen=coll._data.length;const delimlen=this._delimiter.length;let serializedObject="";let pageBuilder="";let doneWithPartition=false;let doneWithPage=false;const pageSaveCallback=()=>{pageBuilder="";if(!doneWithPartition){this._pageIterator.pageIndex++;return this._saveNextPage()}};if(coll._data.length===0){doneWithPartition=true}while(!doneWithPartition&&!doneWithPage){if(!doneWithPartition){serializedObject=JSON.stringify(coll._data[this._pageIterator.docIndex]);pageBuilder+=serializedObject;pageLen+=serializedObject.length;if(++this._pageIterator.docIndex>=cdlen)doneWithPartition=true}if(pageLen>=this._pageSize)doneWithPage=true;if(!doneWithPage||doneWithPartition){pageBuilder+=this._delimiter;pageLen+=delimlen}}return this._adapter.saveDatabase(keyname,pageBuilder).then(pageSaveCallback)}}__webpack_exports__["a"]=PartitioningAdapter},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE_2__},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){function getGlobal(){let glob;(function(global){glob=global})(global!==undefined&&global||this);return glob}function create(){const global=getGlobal();const sym=Symbol.for("LOKI");if(global[sym]===undefined){global[sym]={}}return global[sym]}const PLUGINS=create();__webpack_exports__["a"]=PLUGINS}).call(__webpack_exports__,__webpack_require__(4))},function(module,exports){var g;g=function(){return this}();try{g=g||Function("return this")()||(1,eval)("this")}catch(e){if(typeof window==="object")g=window}module.exports=g}])}); \ No newline at end of file diff --git a/dist/packages/partitioning-adapter/types/common/types.d.ts b/dist/packages/partitioning-adapter/types/common/types.d.ts index 846847e6..b8a936c6 100644 --- a/dist/packages/partitioning-adapter/types/common/types.d.ts +++ b/dist/packages/partitioning-adapter/types/common/types.d.ts @@ -1,10 +1,13 @@ -export declare type ANY = any; +/** + * @hidden + */ +import { Loki } from "../loki/src"; export interface StorageAdapter { loadDatabase(dbname: string): Promise; saveDatabase?(dbname: string, serialization: string): Promise; deleteDatabase?(dbname: string): Promise; mode?: string; - exportDatabase?(dbname: string, dbref: ANY): Promise; + exportDatabase?(dbname: string, dbref: Loki): Promise; } export declare type Doc = T & { $loki: number; @@ -14,10 +17,3 @@ export interface Dict { [index: string]: T; [index: number]: T; } -export interface Query { -} -export interface Filter { - type: string; - val: Query | ((obj: E, index: number, array: E[]) => boolean); - uid: number | string; -} diff --git a/dist/packages/partitioning-adapter/types/fs-storage/src/fs_storage.d.ts b/dist/packages/partitioning-adapter/types/fs-storage/src/fs_storage.d.ts index a92567ea..9930c0d0 100644 --- a/dist/packages/partitioning-adapter/types/fs-storage/src/fs_storage.d.ts +++ b/dist/packages/partitioning-adapter/types/fs-storage/src/fs_storage.d.ts @@ -2,7 +2,7 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists using node fs module. */ -export declare class LokiFSStorage implements StorageAdapter { +export declare class FSStorage implements StorageAdapter { /** * Registers the fs storage as plugin. */ @@ -32,4 +32,3 @@ export declare class LokiFSStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiFSStorage; diff --git a/dist/packages/partitioning-adapter/types/fs-storage/src/index.d.ts b/dist/packages/partitioning-adapter/types/fs-storage/src/index.d.ts new file mode 100644 index 00000000..e6b33d6c --- /dev/null +++ b/dist/packages/partitioning-adapter/types/fs-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { FSStorage } from "./fs_storage"; +export { FSStorage }; +export default FSStorage; diff --git a/dist/packages/partitioning-adapter/types/full-text-search-language-de/src/index.d.ts b/dist/packages/partitioning-adapter/types/full-text-search-language-de/src/index.d.ts new file mode 100644 index 00000000..a2665427 --- /dev/null +++ b/dist/packages/partitioning-adapter/types/full-text-search-language-de/src/index.d.ts @@ -0,0 +1,3 @@ +import { DE } from "./de"; +export { DE }; +export default DE; diff --git a/dist/packages/partitioning-adapter/types/full-text-search-language-en/src/index.d.ts b/dist/packages/partitioning-adapter/types/full-text-search-language-en/src/index.d.ts new file mode 100644 index 00000000..8313cf98 --- /dev/null +++ b/dist/packages/partitioning-adapter/types/full-text-search-language-en/src/index.d.ts @@ -0,0 +1,3 @@ +import { EN } from "./en"; +export { EN }; +export default EN; diff --git a/dist/packages/partitioning-adapter/types/full-text-search-language/src/index.d.ts b/dist/packages/partitioning-adapter/types/full-text-search-language/src/index.d.ts new file mode 100644 index 00000000..e52d1a42 --- /dev/null +++ b/dist/packages/partitioning-adapter/types/full-text-search-language/src/index.d.ts @@ -0,0 +1 @@ +export { generateStopWordFilter, generateTrimmer, Among, SnowballProgram } from "./language"; diff --git a/dist/packages/partitioning-adapter/types/full-text-search/src/full_text_search.d.ts b/dist/packages/partitioning-adapter/types/full-text-search/src/full_text_search.d.ts index a4752c88..65a26bef 100644 --- a/dist/packages/partitioning-adapter/types/full-text-search/src/full_text_search.d.ts +++ b/dist/packages/partitioning-adapter/types/full-text-search/src/full_text_search.d.ts @@ -2,7 +2,7 @@ import { InvertedIndex } from "./inverted_index"; import { Tokenizer } from "./tokenizer"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; export declare class FullTextSearch { private _id; private _docs; @@ -21,14 +21,14 @@ export declare class FullTextSearch { * @param {boolean=true} fields.optimizeChanges - flag to indicate if deleting/updating a document should be optimized * (requires more memory but performs better) * @param {Tokenizer=Tokenizer} fields.tokenizer - the tokenizer of the field - * @param {string=$loki} id - the property name of the document index + * @param {string} [id] - the property name of the document index */ constructor(fields?: FullTextSearch.FieldOptions[], id?: string); addDocument(doc: object, id?: number): void; removeDocument(doc: object, id?: number): void; updateDocument(doc: object, id?: number): void; clear(): void; - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; toJSON(): FullTextSearch.Serialization; static fromJSONObject(serialized: FullTextSearch.Serialization, tokenizers?: Dict): FullTextSearch; } diff --git a/dist/packages/partitioning-adapter/types/full-text-search/src/index.d.ts b/dist/packages/partitioning-adapter/types/full-text-search/src/index.d.ts index f03dde09..b901b108 100644 --- a/dist/packages/partitioning-adapter/types/full-text-search/src/index.d.ts +++ b/dist/packages/partitioning-adapter/types/full-text-search/src/index.d.ts @@ -1,6 +1,5 @@ import { FullTextSearch } from "./full_text_search"; -export { Tokenizer } from "./tokenizer"; -export { QueryBuilder } from "./query_builder"; -export { InvertedIndex } from "./inverted_index"; -export { FullTextSearch }; +import { Tokenizer } from "./tokenizer"; +import { QueryBuilder } from "./query_builder"; +export { FullTextSearch, Tokenizer, QueryBuilder }; export default FullTextSearch; diff --git a/dist/packages/partitioning-adapter/types/full-text-search/src/index_searcher.d.ts b/dist/packages/partitioning-adapter/types/full-text-search/src/index_searcher.d.ts index d3cf7f93..00b99f2f 100644 --- a/dist/packages/partitioning-adapter/types/full-text-search/src/index_searcher.d.ts +++ b/dist/packages/partitioning-adapter/types/full-text-search/src/index_searcher.d.ts @@ -1,4 +1,4 @@ -import { ScoreResult } from "./scorer"; +import { Scorer } from "./scorer"; import { InvertedIndex } from "./inverted_index"; import { Query } from "./query_builder"; import { Dict } from "../../common/types"; @@ -13,9 +13,9 @@ export declare class IndexSearcher { * @param {object} invIdxs */ constructor(invIdxs: Dict, docs: Set); - search(query: Query): ScoreResult; + search(query: Query): Scorer.ScoreResult; setDirty(): void; private _recursive(query, doScoring); - private _getUnique(queries, doScoring, docResults); + private _getUnique(queries, doScoring, queryResults); private _getAll(queries, doScoring); } diff --git a/dist/packages/partitioning-adapter/types/full-text-search/src/query_builder.d.ts b/dist/packages/partitioning-adapter/types/full-text-search/src/query_builder.d.ts index 923317f6..6f324e15 100644 --- a/dist/packages/partitioning-adapter/types/full-text-search/src/query_builder.d.ts +++ b/dist/packages/partitioning-adapter/types/full-text-search/src/query_builder.d.ts @@ -24,8 +24,8 @@ export declare class BaseQueryBuilder { */ build(): any; } -export interface BaseQuery { - type: string; +export interface BaseQuery { + type: Type; boost?: number; } /** @@ -51,7 +51,7 @@ export declare class TermQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, term: string, data?: any); } -export interface TermQuery extends BaseQuery { +export interface TermQuery extends BaseQuery<"term"> { field: string; value: string; } @@ -78,7 +78,7 @@ export declare class TermsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, terms: Array, data?: any); } -export interface TermsQuery extends BaseQuery { +export interface TermsQuery extends BaseQuery<"terms"> { field: string; value: string[]; } @@ -119,7 +119,7 @@ export declare class WildcardQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface WildcardQuery extends BaseQuery { +export interface WildcardQuery extends BaseQuery<"wildcard"> { field: string; value: string; enable_scoring?: boolean; @@ -169,7 +169,7 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { * * @return {FuzzyQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the initial word length. * @param {number} prefixLength - the positive prefix length @@ -183,10 +183,10 @@ export declare class FuzzyQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface FuzzyQuery extends BaseQuery { +export interface FuzzyQuery extends BaseQuery<"fuzzy"> { field: string; value: string; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -221,7 +221,7 @@ export declare class PrefixQueryBuilder extends BaseQueryBuilder { */ enableScoring(enable: boolean): this; } -export interface PrefixQuery extends BaseQuery { +export interface PrefixQuery extends BaseQuery<"prefix"> { field: string; value: string; enable_scoring?: boolean; @@ -247,7 +247,7 @@ export declare class ExistsQueryBuilder extends BaseQueryBuilder { */ constructor(field: string, data?: any); } -export interface ExistsQuery extends BaseQuery { +export interface ExistsQuery extends BaseQuery<"exists"> { field: string; } /** @@ -315,7 +315,7 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { * * @return {MatchQueryBuilder} - object itself for cascading */ - fuzziness(fuzziness: number | "AUTO"): this; + fuzziness(fuzziness: 0 | 1 | 2 | "AUTO"): this; /** * Sets the starting word length which should not be considered for fuzziness. * @param {number} prefixLength - the positive prefix length @@ -329,12 +329,12 @@ export declare class MatchQueryBuilder extends BaseQueryBuilder { */ extended(extended: boolean): this; } -export interface MatchQuery extends BaseQuery { +export interface MatchQuery extends BaseQuery<"match"> { field: string; value: string; minimum_should_match?: number; operator?: "and" | "or"; - fuzziness?: number | "AUTO"; + fuzziness?: 0 | 1 | 2 | "AUTO"; prefix_length?: number; extended?: boolean; } @@ -360,7 +360,7 @@ export interface MatchQuery extends BaseQuery { export declare class MatchAllQueryBuilder extends BaseQueryBuilder { constructor(data?: any); } -export interface MatchQueryAll extends BaseQuery { +export interface MatchQueryAll extends BaseQuery<"match_all"> { } /** * A query that wraps sub queries and returns a constant score equal to the query boost for every document in the filter. @@ -388,9 +388,11 @@ export declare class ConstantScoreQueryBuilder extends BaseQueryBuilder { * Starts an array of queries. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): ConstantScoreQueryBuilder; + }; } -export interface ConstantScoreQuery extends BaseQuery { +export interface ConstantScoreQuery extends BaseQuery<"constant_score"> { filter: ArrayQuery; } /** @@ -442,22 +444,30 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { * Starts an array of queries for must clause. Use endMust() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginMust(): ArrayQueryBuilder; + beginMust(): ArrayQueryBuilder & { + endMust(): BoolQueryBuilder; + }; /** * Starts an array of queries for filter clause. Use endFilter() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginFilter(): ArrayQueryBuilder; + beginFilter(): ArrayQueryBuilder & { + endFilter(): BoolQueryBuilder; + }; /** * Starts an array of queries for should clause. Use endShould() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginShould(): ArrayQueryBuilder; + beginShould(): ArrayQueryBuilder & { + endShould(): BoolQueryBuilder; + }; /** * Starts an array of queries for not clause. Use endNot() to finish the array. * @return {ArrayQueryBuilder} array query for holding sub queries */ - beginNot(): ArrayQueryBuilder; + beginNot(): ArrayQueryBuilder & { + endNot(): BoolQueryBuilder; + }; /** * Controls the amount of minimum matching sub queries before a document will be considered. * @param {number} minShouldMatch - number of minimum matching sub queries @@ -472,7 +482,7 @@ export declare class BoolQueryBuilder extends BaseQueryBuilder { */ minimumShouldMatch(minShouldMatch: number): this; } -export interface BoolQuery extends BaseQuery { +export interface BoolQuery extends BaseQuery<"bool"> { must?: ArrayQuery; filter?: ArrayQuery; should?: ArrayQuery; @@ -497,8 +507,8 @@ export declare class ArrayQueryBuilder extends BaseQueryBuilder { prefix(field: string, prefix: string): any; exists(field: string): any; } -export interface ArrayQuery { - values: any[]; +export interface ArrayQuery extends BaseQuery<"array"> { + values: QueryTypes[]; } /** * This query builder is the root of each query search. @@ -525,9 +535,15 @@ export declare class QueryBuilder { /** * The query performs a final scoring over all scored sub queries. * @param {boolean} enable - flag to enable or disable final scoring - * @return {QueryBuilder} + * @return {this} */ enableFinalScoring(enable: boolean): this; + /** + * Adds an explanation of the scoring of each document for all matched terms. + * @param {boolean} enable -flag to enable or disable explanation + * @returns {this} + */ + explain(enable: boolean): this; /** * Configures the [Okapi BM25]{@link https://en.wikipedia.org/wiki/Okapi_BM25} as scoring model. * @@ -535,10 +551,10 @@ export declare class QueryBuilder { * and [Elasticsearch#BM25]{@link https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html#bm25}. * * @param {number} [k1=1.2] - controls how quickly an increase in term frequency results in term-frequency saturation. - * Lower values result in quicker saturation, and higher values in slower saturation. + * Lower values result in quicker saturation, and higher values in slower saturation * @param {number} [b=0.75] - controls how much effect field-length normalization should have. - * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully. - * @return {QueryBuilder} + * A value of 0.0 disables normalization completely, and a value of 1.0 normalizes fully + * @return {this} */ BM25Similarity(k1?: number, b?: number): this; bool(): BoolQueryBuilder; @@ -553,9 +569,11 @@ export declare class QueryBuilder { exists(field: string): ExistsQueryBuilder; private _prepare(queryType, ...args); } +export declare type QueryTypes = BoolQuery | ConstantScoreQuery | TermQuery | TermsQuery | WildcardQuery | FuzzyQuery | MatchQuery | MatchQueryAll | PrefixQuery | ExistsQuery; export interface Query { - query: any; + query: QueryTypes; final_scoring?: boolean; + explain?: boolean; bm25?: { k1: number; b: number; diff --git a/dist/packages/partitioning-adapter/types/full-text-search/src/scorer.d.ts b/dist/packages/partitioning-adapter/types/full-text-search/src/scorer.d.ts index aed3e619..dacdc753 100644 --- a/dist/packages/partitioning-adapter/types/full-text-search/src/scorer.d.ts +++ b/dist/packages/partitioning-adapter/types/full-text-search/src/scorer.d.ts @@ -1,7 +1,6 @@ import { InvertedIndex } from "./inverted_index"; import { Dict } from "../../common/types"; import { Query } from "./query_builder"; -export declare type ScoreResult = Dict; /** * @hidden */ @@ -10,9 +9,9 @@ export declare class Scorer { private _cache; constructor(invIdxs: Dict); setDirty(): void; - score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, docResults: Scorer.DocResults, term: number[]): void; - scoreConstant(boost: number, docId: number, docResults: Scorer.DocResults): Map; - finalScore(query: Query, docResults: Scorer.DocResults): ScoreResult; + score(fieldName: string, boost: number, termIdx: InvertedIndex.Index, doScoring: boolean, queryResults: Scorer.QueryResults, term: number[]): void; + scoreConstant(boost: number, docId: number, queryResults: Scorer.QueryResults): Map; + finalScore(query: Query, queryResults: Scorer.QueryResults): Scorer.ScoreResult; private static _calculateFieldLength(fieldLength); private _getCache(fieldName); /** @@ -30,12 +29,33 @@ export declare namespace Scorer { idfs: Dict; avgFieldLength: number; } - interface DocResult { + interface QueryResult { tf?: number; idf?: number; boost: number; fieldName?: string; term?: number[]; } - type DocResults = Map; + type QueryResults = Map; + interface BM25Explanation { + boost: number; + score: number; + docID: number; + fieldName: string; + index: string; + idf: number; + tfNorm: number; + tf: number; + fieldLength: number; + avgFieldLength: number; + } + interface ConstantExplanation { + boost: number; + score: number; + } + type ScoreExplanation = BM25Explanation | ConstantExplanation; + type ScoreResult = Dict<{ + score: number; + explanation?: ScoreExplanation[]; + }>; } diff --git a/dist/packages/partitioning-adapter/types/indexed-storage/src/index.d.ts b/dist/packages/partitioning-adapter/types/indexed-storage/src/index.d.ts new file mode 100644 index 00000000..bf453632 --- /dev/null +++ b/dist/packages/partitioning-adapter/types/indexed-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { IndexedStorage } from "./indexed_storage"; +export { IndexedStorage }; +export default IndexedStorage; diff --git a/dist/packages/partitioning-adapter/types/indexed-storage/src/indexed_storage.d.ts b/dist/packages/partitioning-adapter/types/indexed-storage/src/indexed_storage.d.ts index 457b01a0..adaeaef1 100644 --- a/dist/packages/partitioning-adapter/types/indexed-storage/src/indexed_storage.d.ts +++ b/dist/packages/partitioning-adapter/types/indexed-storage/src/indexed_storage.d.ts @@ -6,7 +6,7 @@ import { StorageAdapter } from "../../common/types"; * IndexedDb storage is provided per-domain, so we implement app/key/value database to * allow separate contexts for separate apps within a domain. */ -export declare class LokiIndexedStorage implements StorageAdapter { +export declare class IndexedStorage implements StorageAdapter { private _appname; private catalog; /** @@ -98,4 +98,4 @@ export interface Entry { key: string; size: number; } -export default LokiIndexedStorage; +export default IndexedStorage; diff --git a/dist/packages/partitioning-adapter/types/local-storage/src/index.d.ts b/dist/packages/partitioning-adapter/types/local-storage/src/index.d.ts new file mode 100644 index 00000000..2b74e8c0 --- /dev/null +++ b/dist/packages/partitioning-adapter/types/local-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { LocalStorage } from "./local_storage"; +export { LocalStorage }; +export default LocalStorage; diff --git a/dist/packages/partitioning-adapter/types/local-storage/src/local_storage.d.ts b/dist/packages/partitioning-adapter/types/local-storage/src/local_storage.d.ts index 2337eb12..380d8be9 100644 --- a/dist/packages/partitioning-adapter/types/local-storage/src/local_storage.d.ts +++ b/dist/packages/partitioning-adapter/types/local-storage/src/local_storage.d.ts @@ -1,9 +1,9 @@ import { StorageAdapter } from "../../common/types"; /** * A loki persistence adapter which persists to web browser's local storage object - * @constructor LokiLocalStorageAdapter + * @constructor LocalStorageAdapter */ -export declare class LokiLocalStorage implements StorageAdapter { +export declare class LocalStorage implements StorageAdapter { /** * Registers the local storage as plugin. */ @@ -33,4 +33,4 @@ export declare class LokiLocalStorage implements StorageAdapter { */ deleteDatabase(dbname: string): Promise; } -export default LokiLocalStorage; +export default LocalStorage; diff --git a/dist/packages/partitioning-adapter/types/loki/src/clone.d.ts b/dist/packages/partitioning-adapter/types/loki/src/clone.d.ts index 03b650d7..c74a17bd 100644 --- a/dist/packages/partitioning-adapter/types/loki/src/clone.d.ts +++ b/dist/packages/partitioning-adapter/types/loki/src/clone.d.ts @@ -1,10 +1,4 @@ -export declare enum CloneMethod { - PARSE_STRINGIFY = 0, - DEEP = 1, - SHALLOW = 2, - SHALLOW_ASSIGN = 3, - SHALLOW_RECURSE_OBJECTS = 4, -} +export declare type CloneMethod = "parse-stringify" | "deep" | "shallow" | "shallow-recurse-objects"; /** * @hidden */ diff --git a/dist/packages/partitioning-adapter/types/loki/src/collection.d.ts b/dist/packages/partitioning-adapter/types/loki/src/collection.d.ts index 8b44c82f..9bd5e091 100644 --- a/dist/packages/partitioning-adapter/types/loki/src/collection.d.ts +++ b/dist/packages/partitioning-adapter/types/loki/src/collection.d.ts @@ -1,34 +1,39 @@ import { LokiEventEmitter } from "./event_emitter"; import { UniqueIndex } from "./unique_index"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { DynamicView } from "./dynamic_view"; import { CloneMethod } from "./clone"; -import { Doc, Dict, Query } from "../../common/types"; +import { Doc, Dict } from "../../common/types"; import { FullTextSearch } from "../../full-text-search/src/full_text_search"; import { Tokenizer } from "../../full-text-search/src/tokenizer"; -export declare type ANY = any; export { CloneMethod } from "./clone"; /** * Collection class that handles documents of same type * @extends LokiEventEmitter + * @param - the data type + * @param - nested properties of data type */ -export declare class Collection extends LokiEventEmitter { +export declare class Collection extends LokiEventEmitter { name: string; - data: Doc[]; + _data: Doc[]; private idIndex; - binaryIndices: Dict; + binaryIndices: { + [P in keyof TData]?: Collection.BinaryIndex; + }; /** - * Unique contraints contain duplicate object references, so they are not persisted. - * We will keep track of properties which have unique contraint applied here, and regenerate on load. + * Unique constraints contain duplicate object references, so they are not persisted. + * We will keep track of properties which have unique constraints applied here, and regenerate on load. */ constraints: { - unique: {}; + unique: { + [P in keyof TData]?: UniqueIndex; + }; }; /** * Transforms will be used to store frequently used query chains as a series of steps which itself can be stored along * with the database. */ - transforms: {}; + transforms: Dict[]>; /** * In autosave scenarios we will use collection level dirty flags to determine whether save is needed. * currently, if any collection is dirty we will autosave the whole database if autosave is configured. @@ -62,7 +67,7 @@ export declare class Collection extends LokiEventEmit /** * Disable delta update object style on changes. */ - disableDeltaChangesApi: ANY; + disableDeltaChangesApi: boolean; /** * By default, if you insert a document into a collection with binary indices, if those indexed properties contain * a DateTime we will convert to epoch time format so that (across serializations) its value position will be the @@ -72,7 +77,7 @@ export declare class Collection extends LokiEventEmit /** * Option to activate a cleaner daemon - clears "aged" documents at set intervals. */ - ttl: ANY; + ttl: Collection.TTL; private maxId; private _dynamicViews; /** @@ -81,7 +86,15 @@ export declare class Collection extends LokiEventEmit private changes; private insertHandler; private updateHandler; - console: ANY; + console: { + log(...args: any[]): void; + warn(...args: any[]): void; + error(...args: any[]): void; + }; + /** + * stages: a map of uniquely identified 'stages', which hold copies of objects to be + * manipulated without affecting the data in the original collection + */ private stages; private commitLog; _fullTextSearch: FullTextSearch; @@ -97,69 +110,50 @@ export declare class Collection extends LokiEventEmit * @param {boolean} [options.disableDeltaChangesApi=true] - set to false to enable Delta Changes API (requires Changes API, forces cloning) * @param {boolean} [options.clone=false] - specify whether inserts and queries clone to/from user * @param {boolean} [options.serializableIndices =true] - converts date values on binary indexed property values are serializable - * @param {string} [options.cloneMethod=CloneMethod.DEEP] - the clone method + * @param {string} [options.cloneMethod="deep"] - the clone method * @param {number} [options.transactional=false] - ? * @param {number} options.ttl - ? * @param {number} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @see {@link Loki#addCollection} for normal creation of collections */ - constructor(name: string, options?: Collection.Options); - toJSON(): { - name: string; - _dynamicViews: DynamicView[]; - uniqueNames: string[]; - transforms: {}; - binaryIndices: Dict; - data: Doc[]; - idIndex: number[]; - maxId: number; - dirty: boolean; - adaptiveBinaryIndices: boolean; - transactional: boolean; - asyncListeners: boolean; - disableChangesApi: boolean; - cloneObjects: boolean; - cloneMethod: CloneMethod; - changes: any[]; - _fullTextSearch: FullTextSearch; - }; - static fromJSONObject(obj: ANY, options?: Collection.DeserializeOptions): Collection; + constructor(name: string, options?: Collection.Options); + toJSON(): Collection.Serialized; + static fromJSONObject(obj: Collection.Serialized, options?: Collection.DeserializeOptions): Collection; /** * Adds a named collection transform to the collection * @param {string} name - name to associate with transform * @param {array} transform - an array of transformation 'step' objects to save into the collection */ - addTransform(name: string, transform: ANY[]): void; + addTransform(name: string, transform: Collection.Transform[]): void; /** * Retrieves a named transform from the collection. * @param {string} name - name of the transform to lookup. */ - getTransform(name: string): any; + getTransform(name: string): Collection.Transform[]; /** * Updates a named collection transform to the collection * @param {string} name - name to associate with transform * @param {object} transform - a transformation object to save into collection */ - setTransform(name: string, transform: ANY[]): void; + setTransform(name: string, transform: Collection.Transform[]): void; /** * Removes a named collection transform from the collection * @param {string} name - name of collection transform to remove */ removeTransform(name: string): void; - ttlDaemonFuncGen(): () => void; private setTTL(age, interval); /** * create a row filter that covers all documents in the collection */ - prepareFullDocIndex(): any[]; + _prepareFullDocIndex(): number[]; /** * Ensure binary index on a certain field * @param {string} property - name of property to create binary index on - * @param {boolean} force - (Optional) flag indicating whether to construct index immediately + * @param {boolean} [force=false] - flag indicating whether to construct index immediately */ - ensureIndex(property: string, force?: boolean): void; - getSequencedIndexValues(property: string): string; - ensureUniqueIndex(field: string): UniqueIndex; + ensureIndex(property: keyof TData, force?: boolean): void; + getSequencedIndexValues(property: keyof TData): string; + ensureUniqueIndex(field: keyof TData): UniqueIndex; /** * Ensure all binary indices */ @@ -171,11 +165,11 @@ export declare class Collection extends LokiEventEmit * @param {object} query - (optional) query object to count results of * @returns {number} number of documents in the collection */ - count(query?: object): number; + count(query?: ResultSet.Query & TNested>): number; /** * Rebuild idIndex */ - ensureId(): void; + private _ensureId(); /** * Add a dynamic view to the collection * @param {string} name - name of dynamic view to add @@ -185,7 +179,7 @@ export declare class Collection extends LokiEventEmit * @param {number} options.minRebuildInterval - minimum rebuild interval (need clarification to docs here) * @returns {DynamicView} reference to the dynamic view added **/ - addDynamicView(name: string, options?: DynamicView.Options): DynamicView; + addDynamicView(name: string, options?: DynamicView.Options): DynamicView; /** * Remove a dynamic view from the collection * @param {string} name - name of dynamic view to remove @@ -196,7 +190,7 @@ export declare class Collection extends LokiEventEmit * @param {string} name - name of dynamic view to retrieve reference of * @returns {DynamicView} A reference to the dynamic view with that name **/ - getDynamicView(name: string): DynamicView; + getDynamicView(name: string): DynamicView; /** * Applies a 'mongo-like' find query object and passes all results to an update function. * For filter function querying you should migrate to [ @@ -205,38 +199,39 @@ export declare class Collection extends LokiEventEmit * @param {object|function} filterObject - 'mongo-like' query object (or deprecated filterFunction mode) * @param {function} updateFunction - update function to run against filtered documents */ - findAndUpdate(filterObject: Query | ((obj: E) => boolean), updateFunction: (obj: E) => E): void; + findAndUpdate(filterObject: ResultSet.Query & TNested> | ((obj: Doc) => boolean), updateFunction: (obj: Doc) => any): void; /** * Applies a 'mongo-like' find query object removes all documents which match that filter. * * @param {object} filterObject - 'mongo-like' query object */ - findAndRemove(filterObject: object): void; + findAndRemove(filterObject: ResultSet.Query & TNested>): void; /** * Adds object(s) to collection, ensure object(s) have meta properties, clone it if necessary, etc. * @param {(object|array)} doc - the document (or array of documents) to be inserted * @returns {(object|array)} document or documents inserted */ - insert(doc: E | E[]): Doc; - insert(doc: E[]): Doc[]; + insert(doc: TData): Doc; + insert(doc: TData[]): Doc[]; /** * Adds a single object, ensures it has meta properties, clone it if necessary, etc. * @param {object} doc - the document to be inserted * @param {boolean} bulkInsert - quiet pre-insert and insert event emits * @returns {object} document or 'undefined' if there was a problem inserting it */ - insertOne(doc: E, bulkInsert?: boolean): Doc; + insertOne(doc: TData, bulkInsert?: boolean): Doc; /** * Empties the collection. - * @param {object} options - configure clear behavior - * @param {boolean} options.removeIndices - (default: false) + * @param {boolean} [removeIndices=false] - remove indices */ - clear(options?: ANY): void; + clear({removeIndices: removeIndices}?: { + removeIndices?: boolean; + }): void; /** * Updates an object and notifies collection that the document has changed. * @param {object} doc - document to update within the collection */ - update(doc: ANY): any; + update(doc: Doc | Doc[]): void; /** * Add object to collection */ @@ -247,24 +242,24 @@ export declare class Collection extends LokiEventEmit * @param {function} filterFunction - filter function whose results will execute update * @param {function} updateFunction - update function to run against filtered documents */ - updateWhere(filterFunction: (obj: E) => boolean, updateFunction: (obj: E) => E): void; + updateWhere(filterFunction: (obj: Doc) => boolean, updateFunction: (obj: Doc) => any): void; /** * Remove all documents matching supplied filter function. * For 'mongo-like' querying you should migrate to [findAndRemove()]{@link Collection#findAndRemove}. * @param {function|object} query - query object to filter on */ - removeWhere(query: Query | ((obj: E) => boolean)): void; + removeWhere(query: ResultSet.Query & TNested> | ((obj: Doc) => boolean)): void; removeDataOnly(): void; /** * Remove a document from the collection - * @param {object} doc - document to remove from collection + * @param {number|object} doc - document to remove from collection */ - remove(doc: ANY): any; + remove(doc: number | Doc | Doc[]): void; /** * Returns all changes. - * @returns {ANY} + * @returns {Collection.Change[]} */ - getChanges(): any[]; + getChanges(): Collection.Change[]; /** * Enables/disables changes api. * @param {boolean} disableChangesApi @@ -301,34 +296,35 @@ export declare class Collection extends LokiEventEmit * @returns {(object|array|null)} Object reference if document was found, null if not, * or an array if 'returnPosition' was passed. */ - get(id: number): Doc; - get(id: number, returnPosition: boolean): Doc | [Doc, number]; + get(id: number): Doc; + get(id: number, returnPosition: boolean): Doc | [Doc, number]; /** * Perform binary range lookup for the data[dataPosition][binaryIndexName] property value * Since multiple documents may contain the same value (which the index is sorted on), * we hone in on range and then linear scan range to find exact index array position. - * @param {int} dataPosition : coll.data array index/position + * @param {int} dataPosition : data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - getBinaryIndexPosition(dataPosition: number, binaryIndexName: string): number; + getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData): number; /** * Adaptively insert a selected item to the index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively update a selected item within an index. * @param {int} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in */ - adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: string): void; + adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData): void; /** * Adaptively remove a selected item from the index. - * @param {int} dataPosition : coll.data array index/position + * @param {number} dataPosition : coll.data array index/position * @param {string} binaryIndexName : index to search for dataPosition in + * @param {boolean} removedFromIndexOnly - remove from index only */ - adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: string, removedFromIndexOnly?: boolean): ANY; + adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly?: boolean): void; /** * Internal method used for index maintenance and indexed searching. * Calculates the beginning of an index range for a given value. @@ -351,7 +347,7 @@ export declare class Collection extends LokiEventEmit private _calculateRangeEnd(prop, val); /** * Binary Search utility method to find range/segment of values matching criteria. - * this is used for collection.find() and first find filter of resultset/dynview + * this is used for collection.find() and first find filter of ResultSet/dynview * slightly different than get() binary search in that get() hones in on 1 value, * but we have to hone in on many (range) * @param {string} op - operation, such as $eq @@ -359,29 +355,29 @@ export declare class Collection extends LokiEventEmit * @param {object} val - value to use for range calculation. * @returns {array} [start, end] index array positions */ - calculateRange(op: string, prop: string, val: ANY): [number, number]; + calculateRange(op: string, prop: keyof TData, val: any): [number, number]; /** * Retrieve doc by Unique index * @param {string} field - name of uniquely indexed property to use when doing lookup * @param {any} value - unique value to search for * @returns {object} document matching the value passed */ - by(field: string, value: ANY): Doc; + by(field: string, value: any): Doc; /** * Find one object by index property, by property equal to value * @param {object} query - query object used to perform search with * @returns {(object|null)} First matching document, or null if none */ - findOne(query: object): Doc; + findOne(query: ResultSet.Query & TNested>): Doc; /** * Chain method, used for beginning a series of chained find() and/or view() operations * on a collection. * * @param {array} transform - Ordered array of transform step objects similar to chain * @param {object} parameters - Object containing properties representing parameters to substitute - * @returns {Resultset} (this) resultset, or data array if any map or join functions where called + * @returns {ResultSet} (this) ResultSet, or data array if any map or join functions where called */ - chain(transform?: string | ANY[], parameters?: ANY): Resultset; + chain(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** * Find method, api is similar to mongodb. * for more complex queries use [chain()]{@link Collection#chain} or [where()]{@link Collection#where}. @@ -389,20 +385,26 @@ export declare class Collection extends LokiEventEmit * @param {object} query - 'mongo-like' query object * @returns {array} Array of matching documents */ - find(query?: Query): Doc[]; + find(query?: ResultSet.Query & TNested>): Doc[]; /** * Find object by unindexed field by property equal to value, * simply iterates and returns the first element matching the query */ - findOneUnindexed(prop: string, value: ANY): Doc; + findOneUnindexed(prop: string, value: any): Doc; /** * Transaction methods */ - /** start the transation */ + /** + * start the transation + */ startTransaction(): void; - /** commit the transation */ + /** + * commit the transation + */ commit(): void; - /** roll back the transation */ + /** + * roll back the transation + */ rollback(): void; /** * Query the collection by supplying a javascript filter function. @@ -414,14 +416,14 @@ export declare class Collection extends LokiEventEmit * @param {function} fun - filter function to run against all collection docs * @returns {array} all documents which pass your filter function */ - where(fun: (obj: E) => boolean): Doc[]; + where(fun: (obj: Doc) => boolean): Doc[]; /** * Map Reduce operation * @param {function} mapFunction - function to use as map function * @param {function} reduceFunction - function to use as reduce function * @returns {data} The result of your mapReduce operation */ - mapReduce(mapFunction: (value: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (value: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; /** * Join two collections on specified properties * @@ -429,13 +431,13 @@ export declare class Collection extends LokiEventEmit * @param {string} leftJoinProp - property name in collection * @param {string} rightJoinProp - property name in joinData * @param {function} mapFun - (Optional) map function to use - * @returns {Resultset} Result of the mapping operation - */ - eqJoin(joinData: ANY[], leftJoinProp: string, rightJoinProp: string, mapFun?: Function): Resultset; - /** - * stages: a map of uniquely identified 'stages', which hold copies of objects to be - * manipulated without affecting the data in the original collection + * @param dataOptions - options to data() before input to your map function + * @param [dataOptions.removeMeta] - allows removing meta before calling mapFun + * @param [dataOptions.forceClones] - forcing the return of cloned objects to your map object + * @param [dataOptions.forceCloneMethod] - allows overriding the default or collection specified cloning method + * @returns {ResultSet} Result of the mapping operation */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinProp: string | ((obj: any) => string), rightJoinProp: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; /** * (Staging API) create a stage and/or retrieve it */ @@ -446,7 +448,7 @@ export declare class Collection extends LokiEventEmit /** * (Staging API) create a copy of an object and insert it into a stage */ - stage(stageName: string, obj: ANY): any; + stage(stageName: string, obj: Doc): F; /** * (Staging API) re-attach all objects to the original collection, so indexes and views can be rebuilt * then create a message to be inserted in the commitlog @@ -459,10 +461,10 @@ export declare class Collection extends LokiEventEmit extract(field: string): any[]; /** */ - max(field: string): any; + max(field: string): number; /** */ - min(field: string): any; + min(field: string): number; /** */ maxRecord(field: string): { @@ -500,9 +502,9 @@ export declare class Collection extends LokiEventEmit median(field: string): number; } export declare namespace Collection { - interface Options { - unique?: string[]; - indices?: string[]; + interface Options { + unique?: (keyof TData)[]; + indices?: (keyof TData)[]; adaptiveBinaryIndices?: boolean; asyncListeners?: boolean; disableChangesApi?: boolean; @@ -518,10 +520,89 @@ export declare namespace Collection { interface DeserializeOptions { retainDirtyFlags?: boolean; fullTextSearch?: Dict; + [collName: string]: any | { + proto?: any; + inflate?: (src: object, dest?: object) => void; + }; } interface BinaryIndex { dirty: boolean; values: any; } - type Change = any; + interface Change { + name: string; + operation: string; + obj: any; + } + interface Serialized { + name: string; + _dynamicViews: DynamicView[]; + uniqueNames: string[]; + transforms: Dict; + binaryIndices: Dict; + _data: Doc[]; + idIndex: number[]; + maxId: number; + dirty: boolean; + adaptiveBinaryIndices: boolean; + transactional: boolean; + asyncListeners: boolean; + disableChangesApi: boolean; + disableDeltaChangesApi: boolean; + cloneObjects: boolean; + cloneMethod: CloneMethod; + changes: any; + _fullTextSearch: FullTextSearch; + } + type Transform = { + type: "find"; + value: ResultSet.Query & TNested> | string; + } | { + type: "where"; + value: ((obj: Doc) => boolean) | string; + } | { + type: "simplesort"; + property: keyof (TData & TNested); + desc?: boolean; + } | { + type: "compoundsort"; + value: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]; + } | { + type: "sort"; + value: (a: Doc, b: Doc) => number; + } | { + type: "sortByScoring"; + desc?: boolean; + } | { + type: "limit"; + value: number; + } | { + type: "offset"; + value: number; + } | { + type: "map"; + value: (obj: TData, index: number, array: TData[]) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "eqJoin"; + joinData: Collection | ResultSet; + leftJoinKey: string | ((obj: any) => string); + rightJoinKey: string | ((obj: any) => string); + mapFun?: (left: any, right: any) => any; + dataOptions?: ResultSet.DataOptions; + } | { + type: "mapReduce"; + mapFunction: (item: TData, index: number, array: TData[]) => any; + reduceFunction: (array: any[]) => any; + } | { + type: "update"; + value: (obj: Doc) => any; + } | { + type: "remove"; + }; + interface TTL { + age: number; + ttlInterval: number; + daemon: any; + } } diff --git a/dist/packages/partitioning-adapter/types/loki/src/dynamic_view.d.ts b/dist/packages/partitioning-adapter/types/loki/src/dynamic_view.d.ts index 1aeab3a4..5cda4b13 100644 --- a/dist/packages/partitioning-adapter/types/loki/src/dynamic_view.d.ts +++ b/dist/packages/partitioning-adapter/types/loki/src/dynamic_view.d.ts @@ -1,9 +1,8 @@ import { LokiEventEmitter } from "./event_emitter"; -import { Resultset } from "./resultset"; +import { ResultSet } from "./result_set"; import { Collection } from "./collection"; -import { Doc, Filter } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; /** * DynamicView class is a versatile 'live' view class which can have filters and sorts applied. * Collection.addDynamicView(name) instantiates this DynamicView object and notifies it @@ -18,18 +17,21 @@ export declare type ANY = any; * @extends LokiEventEmitter * @see {@link Collection#addDynamicView} to construct instances of DynamicView + * + * @param - the data type + * @param - nested properties of data type */ -export declare class DynamicView extends LokiEventEmitter { +export declare class DynamicView extends LokiEventEmitter { private _collection; private _persistent; private _sortPriority; private _minRebuildInterval; name: string; private _rebuildPending; - private _resultset; - private _resultdata; - private _resultsdirty; - private _cachedresultset; + private _resultSet; + private _resultData; + private _resultDirty; + private _cachedResultSet; private _filterPipeline; private _sortFunction; private _sortCriteria; @@ -41,10 +43,10 @@ export declare class DynamicView extends LokiEventEmi * @param {string} name - the name of this dynamic view * @param {object} options - the options * @param {boolean} [options.persistent=false] - indicates if view is to main internal results array in 'resultdata' - * @param {string} [options.sortPriority=SortPriority.PASSIVE] - the sort priority + * @param {string} [options.sortPriority="passive"] - the sort priority * @param {number} [options.minRebuildInterval=1] - minimum rebuild interval (need clarification to docs here) */ - constructor(collection: Collection, name: string, options?: DynamicView.Options); + constructor(collection: Collection, name: string, options?: DynamicView.Options); /** * Internally used immediately after deserialization (loading) * This will clear out and reapply filterPipeline ops, recreating the view. @@ -57,34 +59,22 @@ export declare class DynamicView extends LokiEventEmi */ _rematerialize({removeWhereFilters}: { removeWhereFilters?: boolean; - }): DynamicView; + }): this; /** - * Makes a copy of the internal resultset for branched queries. - * Unlike this dynamic view, the branched resultset will not be 'live' updated, + * Makes a copy of the internal ResultSet for branched queries. + * Unlike this dynamic view, the branched ResultSet will not be 'live' updated, * so your branched query should be immediately resolved and not held for future evaluation. * * @param {(string|array=)} transform - Optional name of collection transform, or an array of transform steps * @param {object} parameters - optional parameters (if optional transform requires them) - * @returns {Resultset} A copy of the internal resultset for branched queries. + * @returns {ResultSet} A copy of the internal ResultSet for branched queries. */ - branchResultset(transform: string | any[], parameters?: object): Resultset; + branchResultSet(transform?: string | Collection.Transform[], parameters?: object): ResultSet; /** - * toJSON() - Override of toJSON to avoid circular references - * + * Override of toJSON to avoid circular references. */ - toJSON(): { - name: string; - _persistent: boolean; - _sortPriority: DynamicView.SortPriority; - _minRebuildInterval: number; - _resultset: Resultset; - _resultsdirty: boolean; - _filterPipeline: Filter[]; - _sortCriteria: (string | [string, boolean])[]; - _sortByScoring: boolean; - _sortDirty: boolean; - }; - static fromJSONObject(collection: ANY, obj: ANY): DynamicView; + toJSON(): DynamicView.Serialized; + static fromJSONObject(collection: Collection, obj: DynamicView.Serialized): DynamicView; /** * Used to clear pipeline and reset dynamic view to initial state. * Existing options should be retained. @@ -105,7 +95,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} comparefun - a javascript compare function used for sorting * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySort(comparefun: (lhs: E, rhs: E) => number): DynamicView; + applySort(comparefun: (lhs: Doc, rhs: Doc) => number): this; /** * Used to specify a property used for view translation. * @example @@ -115,9 +105,9 @@ export declare class DynamicView extends LokiEventEmi * @param {boolean} isdesc - (Optional) If true, the sort will be in descending order. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applySimpleSort(propname: string, isdesc?: boolean): DynamicView; + applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this; /** - * Allows sorting a resultset based on multiple columns. + * Allows sorting a ResultSet based on multiple columns. * @example * // to sort by age and then name (both ascending) * dv.applySortCriteria(['age', 'name']); @@ -129,32 +119,32 @@ export declare class DynamicView extends LokiEventEmi * @param {Array} criteria - array of property names or subarray of [propertyname, isdesc] used evaluate sort order * @returns {DynamicView} Reference to this DynamicView, sorted, for future chain operations. */ - applySortCriteria(criteria: (string | [string, boolean])[]): DynamicView; + applySortCriteria(criteria: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; /** * Used to apply a sort by the latest full-text-search scoring. * @param {boolean} [ascending=false] - sort ascending */ - applySortByScoring(ascending?: boolean): DynamicView; + applySortByScoring(ascending?: boolean): this; /** * Returns the scoring of the last full-text-search. * @returns {ScoreResult} */ - getScoring(): ScoreResult; + getScoring(): Scorer.ScoreResult; /** * Marks the beginning of a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - startTransaction(): DynamicView; + startTransaction(): this; /** * Commits a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - commit(): DynamicView; + commit(): this; /** * Rolls back a transaction. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - rollback(): DynamicView; + rollback(): this; /** * Find the index of a filter in the pipeline, by that filter's ID. * @@ -163,7 +153,7 @@ export declare class DynamicView extends LokiEventEmi */ private _indexOfFilterWithId(uid); /** - * Add the filter object to the end of view's filter pipeline and apply the filter to the resultset. + * Add the filter object to the end of view's filter pipeline and apply the filter to the ResultSet. * * @param {object} filter - The filter object. Refer to applyFilter() for extra details. */ @@ -173,7 +163,7 @@ export declare class DynamicView extends LokiEventEmi * * @returns {DynamicView} this DynamicView object, for further chain ops. */ - reapplyFilters(): DynamicView; + reapplyFilters(): this; /** * Adds or updates a filter in the DynamicView filter pipeline * @@ -181,7 +171,7 @@ export declare class DynamicView extends LokiEventEmi * The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id } * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFilter(filter: Filter): DynamicView; + applyFilter(filter: DynamicView.Filter): this; /** * applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline * @@ -189,7 +179,7 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyFind(query: object, uid?: string | number): DynamicView; + applyFind(query: object, uid?: string | number): this; /** * applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline * @@ -197,14 +187,14 @@ export declare class DynamicView extends LokiEventEmi * @param {(string|number)} uid - Optional: The unique ID of this filter, to reference it in the future. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - applyWhere(fun: (obj: E) => boolean, uid?: string | number): DynamicView; + applyWhere(fun: (obj: Doc) => boolean, uid?: string | number): this; /** * removeFilter() - Remove the specified filter from the DynamicView filter pipeline * * @param {(string|number)} uid - The unique ID of the filter to be removed. * @returns {DynamicView} this DynamicView object, for further chain ops. */ - removeFilter(uid: string | number): DynamicView; + removeFilter(uid: string | number): this; /** * Returns the number of documents representing the current DynamicView contents. * @returns {number} The number of documents representing the current DynamicView contents. @@ -213,16 +203,16 @@ export declare class DynamicView extends LokiEventEmi /** * Resolves and pending filtering and sorting, then returns document array as result. * - * @param {object} options - optional parameters to pass to resultset.data() if non-persistent - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when + * @param {object} options - optional parameters to pass to ResultSet.data() if non-persistent + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. * Possible values include 'parse-stringify', 'jquery-extend-deep', 'shallow', 'shallow-assign' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents * * @returns {Array} An array of documents representing the current DynamicView contents. */ - data(options?: object): Doc[]; + data(options?: ResultSet.DataOptions): Doc[]; /** * When the view is not sorted we may still wish to be notified of rebuild events. * This event will throttle and queue a single rebuild event when batches of updates affect the view. @@ -257,7 +247,7 @@ export declare class DynamicView extends LokiEventEmi * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value * @returns The output of your reduceFunction */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; } export declare namespace DynamicView { interface Options { @@ -265,8 +255,25 @@ export declare namespace DynamicView { sortPriority?: SortPriority; minRebuildInterval?: number; } - enum SortPriority { - PASSIVE = 0, - ACTIVE = 1, + type SortPriority = "passive" | "active"; + interface Serialized { + name: string; + _persistent: boolean; + _sortPriority: SortPriority; + _minRebuildInterval: number; + _resultSet: ResultSet; + _filterPipeline: Filter[]; + _sortCriteria: (string | [string, boolean])[]; + _sortByScoring: boolean; + _sortDirty: boolean; } + type Filter = { + type: "find"; + val: ResultSet.Query & TNested>; + uid: number | string; + } | { + type: "where"; + val: (obj: Doc) => boolean; + uid: number | string; + }; } diff --git a/dist/packages/partitioning-adapter/types/loki/src/event_emitter.d.ts b/dist/packages/partitioning-adapter/types/loki/src/event_emitter.d.ts index f422ee35..e55515e9 100644 --- a/dist/packages/partitioning-adapter/types/loki/src/event_emitter.d.ts +++ b/dist/packages/partitioning-adapter/types/loki/src/event_emitter.d.ts @@ -1,4 +1,3 @@ -export declare type ANY = any; /** * LokiEventEmitter is a minimalist version of EventEmitter. It enables any * constructor that inherits EventEmitter to emit events and trigger @@ -31,7 +30,7 @@ export declare class LokiEventEmitter { * @param {string} eventName - the name of the event * @param {object} data - optional object passed with the event */ - emit(eventName: string, ...data: ANY[]): void; + emit(eventName: string, ...data: any[]): void; /** * Alias of LokiEventEmitter.prototype.on * addListener(eventName, listener) - adds a listener to the queue of callbacks associated to an event diff --git a/dist/packages/partitioning-adapter/types/loki/src/helper.d.ts b/dist/packages/partitioning-adapter/types/loki/src/helper.d.ts index b187e0eb..44b72305 100644 --- a/dist/packages/partitioning-adapter/types/loki/src/helper.d.ts +++ b/dist/packages/partitioning-adapter/types/loki/src/helper.d.ts @@ -1,8 +1,5 @@ /** - * @hidden - */ -export declare type ANY = any; -/** Helper function for determining 'loki' abstract equality which is a little more abstract than == + * Helper function for determining 'loki' abstract equality which is a little more abstract than == * aeqHelper(5, '5') === true * aeqHelper(5.0, '5') === true * aeqHelper(new Date("1/1/2011"), new Date("1/1/2011")) === true @@ -10,34 +7,33 @@ export declare type ANY = any; * aeqHelper([1, 2, 3], [1, 3]) === false * aeqHelper([1, 2, 3], [1, 2, 3]) === true * aeqHelper(undefined, null) === true - */ -/** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @returns {boolean} + * @hidden */ -export declare function aeqHelper(prop1: ANY, prop2: ANY): boolean; -/** Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. +export declare function aeqHelper(prop1: any, prop2: any): boolean; +/** + * Helper function for determining 'less-than' conditions for ops, sorting, and binary indices. * In the future we might want $lt and $gt ops to use their own functionality/helper. * Since binary indices on a property might need to index [12, NaN, new Date(), Infinity], we * need this function (as well as gtHelper) to always ensure one value is LT, GT, or EQ to another. * @hidden */ -export declare function ltHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function ltHelper(prop1: any, prop2: any, equal: boolean): boolean; /** * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 + * @param {any} prop1 + * @param {any} prop2 * @param {boolean} equal * @returns {boolean} */ -export declare function gtHelper(prop1: ANY, prop2: ANY, equal: boolean): boolean; +export declare function gtHelper(prop1: any, prop2: any, equal: boolean): boolean; /** - * @hidden - * @param {ANY} prop1 - * @param {ANY} prop2 - * @param {ANY} desc + * @param {any} prop1 + * @param {any} prop2 + * @param {boolean} descending * @returns {number} + * @hidden */ -export declare function sortHelper(prop1: ANY, prop2: ANY, desc: ANY): 0 | 1 | -1; +export declare function sortHelper(prop1: any, prop2: any, descending: boolean): number; diff --git a/dist/packages/partitioning-adapter/types/loki/src/index.d.ts b/dist/packages/partitioning-adapter/types/loki/src/index.d.ts index dee82236..17ee6df4 100644 --- a/dist/packages/partitioning-adapter/types/loki/src/index.d.ts +++ b/dist/packages/partitioning-adapter/types/loki/src/index.d.ts @@ -1,7 +1,4 @@ import { Loki } from "./loki"; import { Collection } from "./collection"; export { Loki, Collection }; -declare const _default: { - Loki: typeof Loki; -}; -export default _default; +export default Loki; diff --git a/dist/packages/partitioning-adapter/types/loki/src/loki.d.ts b/dist/packages/partitioning-adapter/types/loki/src/loki.d.ts index 10e81b65..f2deafd2 100644 --- a/dist/packages/partitioning-adapter/types/loki/src/loki.d.ts +++ b/dist/packages/partitioning-adapter/types/loki/src/loki.d.ts @@ -1,7 +1,6 @@ import { LokiEventEmitter } from "./event_emitter"; import { Collection } from "./collection"; import { Doc, StorageAdapter } from "../../common/types"; -export declare type ANY = any; export declare class Loki extends LokiEventEmitter { private filename; private databaseVersion; @@ -23,7 +22,7 @@ export declare class Loki extends LokiEventEmitter { * Constructs the main database class. * @param {string} filename - name of the file to be saved to * @param {object} [options={}] - options - * @param {Loki.Environment} [options.env=auto] - overrides environment detection + * @param {Loki.Environment} [options.env] - the javascript environment * @param {Loki.SerializationMethod} [options.serializationMethod=NORMAL] - the serialization method * @param {string} [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization * @param {boolean} [options.verbose=false] - enable console output @@ -64,21 +63,21 @@ export declare class Loki extends LokiEventEmitter { * @param {int} options.ttlInterval - time interval for clearing out 'aged' documents; not set by default. * @returns {Collection} a reference to the collection which was just added */ - addCollection(name: string, options?: Collection.Options): Collection; + addCollection(name: string, options?: Collection.Options): Collection; loadCollection(collection: Collection): void; /** * Retrieves reference to a collection by name. * @param {string} collectionName - name of collection to look up * @returns {Collection} Reference to collection in database by that name, or null if not found */ - getCollection(collectionName: string): Collection; + getCollection(collectionName: string): Collection; /** * Renames an existing loki collection * @param {string} oldName - name of collection to rename * @param {string} newName - new name of collection * @returns {Collection} reference to the newly renamed collection */ - renameCollection(oldName: string, newName: string): Collection<{}>; + renameCollection(oldName: string, newName: string): Collection; listCollections(): { name: string; count: number; @@ -95,20 +94,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {string} Stringified representation of the loki database. */ serialize(options?: Loki.SerializeOptions): string | string[]; - toJSON(): { - _env: Loki.Environment; - _serializationMethod: Loki.SerializationMethod; - _autosave: boolean; - _autosaveInterval: number; - _collections: Collection[]; - databaseVersion: number; - engineVersion: number; - filename: string; - _persistenceAdapter: StorageAdapter; - _persistenceMethod: Loki.PersistenceMethod; - _throttledSaves: boolean; - _verbose: boolean; - }; + toJSON(): Loki.Serialized; /** * Database level destructured JSON serialization routine to allow alternate serialization methods. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -134,7 +120,11 @@ export declare class Loki extends LokiEventEmitter { * * @returns {string|array} A custom, restructured aggregation of independent serializations for a single collection. */ - serializeCollection(options?: ANY): string | string[]; + serializeCollection(options?: { + delimited?: boolean; + collectionIndex?: number; + delimiter?: string; + }): string | string[]; /** * Database level destructured JSON deserialization routine to minimize memory overhead. * Internally, Loki supports destructuring via loki "serializationMethod' option and @@ -150,7 +140,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {object|array} An object representation of the deserialized database, not yet applied to 'this' db or document array */ - deserializeDestructured(destructuredSource: ANY, options?: Loki.SerializeDestructuredOptions): any; + deserializeDestructured(destructuredSource: string | string[], options?: Loki.SerializeDestructuredOptions): any; /** * Collection level utility function to deserializes a destructured collection. * @@ -161,7 +151,7 @@ export declare class Loki extends LokiEventEmitter { * * @returns {Array} an array of documents to attach to collection.data. */ - deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc; + deserializeCollection(destructuredSource: string | string[], options?: Loki.DeserializeCollectionOptions): Doc[]; /** * Inflates a loki database from a serialized JSON string * @@ -169,15 +159,16 @@ export declare class Loki extends LokiEventEmitter { * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSON(serializedDb: string | string[], options?: ANY): void; + loadJSON(serializedDb: string | string[], options?: Collection.DeserializeOptions): void; /** * Inflates a loki database from a JS object * - * @param {object} dbObject - a serialized loki database string + * @param {object} dbObject - a serialized loki database object * @param {object} options - apply or override collection level settings * @param {boolean} options.retainDirtyFlags - whether collection dirty flags will be preserved */ - loadJSONObject(dbObject: ANY, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki, options?: Collection.DeserializeOptions): void; + loadJSONObject(dbObject: Loki.Serialized, options?: Collection.DeserializeOptions): void; /** * Emits the close event. In autosave scenarios, if the database is dirty, this will save and disable timer. * Does not actually destroy the db. @@ -201,7 +192,7 @@ export declare class Loki extends LokiEventEmitter { * @returns {Array} array of changes * @see private method _createChange() in Collection */ - generateChangesNotification(arrayOfCollectionNames?: string[]): any[]; + generateChangesNotification(arrayOfCollectionNames?: string[]): Collection.Change[]; /** * (Changes API) - stringify changes for network transmission * @returns {string} string representation of the changes @@ -310,24 +301,22 @@ export declare namespace Loki { recursiveWaitLimitDuration?: number; started?: Date; } - type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; - enum SerializationMethod { - NORMAL = 0, - PRETTY = 1, - DESTRUCTURED = 2, - } - enum PersistenceMethod { - FS_STORAGE = 0, - LOCAL_STORAGE = 1, - INDEXED_STORAGE = 2, - MEMORY_STORAGE = 3, - ADAPTER = 4, - } - enum Environment { - NODE_JS = 0, - NATIVE_SCRIPT = 1, - BROWSER = 2, - CORDOVA = 3, - MEMORY = 4, + interface Serialized { + _env: Environment; + _serializationMethod: SerializationMethod; + _autosave: boolean; + _autosaveInterval: number; + _collections: Collection[]; + databaseVersion: number; + engineVersion: number; + filename: string; + _persistenceAdapter: StorageAdapter; + _persistenceMethod: PersistenceMethod; + _throttledSaves: boolean; + _verbose: boolean; } + type LoadDatabaseOptions = Collection.DeserializeOptions & ThrottledDrainOptions; + type SerializationMethod = "normal" | "pretty" | "destructured"; + type PersistenceMethod = "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter"; + type Environment = "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "MEMORY"; } diff --git a/dist/packages/partitioning-adapter/types/loki/src/memory_adapter.d.ts b/dist/packages/partitioning-adapter/types/loki/src/memory_adapter.d.ts deleted file mode 100644 index 7b97c7f7..00000000 --- a/dist/packages/partitioning-adapter/types/loki/src/memory_adapter.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { StorageAdapter } from "../../common/types"; -export declare type ANY = any; -/** - * In in-memory persistence adapter for an in-memory database. - * This simple 'key/value' adapter is intended for unit testing and diagnostics. - */ -export declare class LokiMemoryAdapter implements StorageAdapter { - private hashStore; - private options; - /** - * @param {object} options - memory adapter options - * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) - * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) - * @param {ANY} options - */ - constructor(options?: ANY); - /** - * Loads a serialized database from its in-memory store. - * (Loki persistence adapter interface function) - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was loaded - */ - loadDatabase(dbname: string): Promise; - /** - * Saves a serialized database to its in-memory store. - * (Loki persistence adapter interface function) - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was persisted - */ - saveDatabase(dbname: string, dbstring: string): Promise; - /** - * Deletes a database from its in-memory store. - * - * @param {string} dbname - name of the database (filename/keyname) - * @returns {Promise} a Promise that resolves after the database was deleted - */ - deleteDatabase(dbname: string): Promise; -} diff --git a/dist/packages/partitioning-adapter/types/loki/src/result_set.d.ts b/dist/packages/partitioning-adapter/types/loki/src/result_set.d.ts new file mode 100644 index 00000000..b29e3a52 --- /dev/null +++ b/dist/packages/partitioning-adapter/types/loki/src/result_set.d.ts @@ -0,0 +1,302 @@ +import { Collection } from "./collection"; +import { CloneMethod } from "./clone"; +import { Doc } from "../../common/types"; +import { Scorer } from "../../full-text-search/src/scorer"; +import { Query as FullTextSearchQuery } from "../../full-text-search/src/query_builder"; +/** + * @hidden + */ +export declare const LokiOps: { + $eq(a: any, b: any): boolean; + $aeq(a: any, b: any): boolean; + $ne(a: any, b: any): boolean; + $dteq(a: any, b: any): boolean; + $gt(a: any, b: any): boolean; + $gte(a: any, b: any): boolean; + $lt(a: any, b: any): boolean; + $lte(a: any, b: any): boolean; + $between(a: any, range: [any, any]): boolean; + $in(a: any, b: any): boolean; + $nin(a: any, b: any): boolean; + $keyin(a: string, b: object): boolean; + $nkeyin(a: string, b: object): boolean; + $definedin(a: string, b: object): boolean; + $undefinedin(a: string, b: object): boolean; + $regex(a: string, b: RegExp): boolean; + $containsString(a: any, b: string): boolean; + $containsNone(a: any, b: any): boolean; + $containsAny(a: any, b: any): boolean; + $contains(a: any, b: any): boolean; + $type(a: any, b: any): boolean; + $finite(a: number, b: boolean): boolean; + $size(a: any, b: any): boolean; + $len(a: any, b: any): boolean; + $where(a: any, b: any): boolean; + $not(a: any, b: any): boolean; + $and(a: any, b: any): boolean; + $or(a: any, b: any): boolean; +}; +/** + * ResultSet class allowing chainable queries. Intended to be instanced internally. + * Collection.find(), Collection.where(), and Collection.chain() instantiate this. + * + * @example + * mycollection.chain() + * .find({ 'doors' : 4 }) + * .where(function(obj) { return obj.name === 'Toyota' }) + * .data(); + * + * @param - the data type + * @param - nested properties of data type + */ +export declare class ResultSet { + _collection: Collection; + _filteredRows: number[]; + _filterInitialized: boolean; + private _scoring; + /** + * Constructor. + * @param {Collection} collection - the collection which this ResultSet will query against + */ + constructor(collection: Collection); + /** + * reset() - Reset the ResultSet to its initial state. + * + * @returns {ResultSet} Reference to this ResultSet, for future chain operations. + */ + reset(): this; + /** + * Override of toJSON to avoid circular references + * + */ + toJSON(): ResultSet; + /** + * Allows you to limit the number of documents passed to next chain operation. + * A ResultSet copy() is made to avoid altering original ResultSet. + * + * @param {int} qty - The number of documents to return. + * @returns {ResultSet} Returns a copy of the ResultSet, limited by qty, for subsequent chain ops. + */ + limit(qty: number): this; + /** + * Used for skipping 'pos' number of documents in the ResultSet. + * + * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. + * @returns {ResultSet} Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops. + */ + offset(pos: number): this; + /** + * copy() - To support reuse of ResultSet in branched query situations. + * + * @returns {ResultSet} Returns a copy of the ResultSet (set) but the underlying document references will be the same. + */ + copy(): ResultSet; + /** + * Alias of copy() + */ + branch(): ResultSet; + /** + * Executes a named collection transform or raw array of transform steps against the ResultSet. + * + * @param {(string|array)} transform - name of collection transform or raw transform array + * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. + * @returns {ResultSet} either (this) ResultSet or a clone of of this ResultSet (depending on steps) + */ + transform(transform: string | Collection.Transform[], parameters?: object): this; + /** + * User supplied compare function is provided two documents to compare. (chainable) + * @example + * rslt.sort(function(obj1, obj2) { + * if (obj1.name === obj2.name) return 0; + * if (obj1.name > obj2.name) return 1; + * if (obj1.name < obj2.name) return -1; + * }); + * + * @param {function} comparefun - A javascript compare function used for sorting. + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + sort(comparefun: (a: Doc, b: Doc) => number): this; + /** + * Simpler, loose evaluation for user to sort based on a property name. (chainable). + * Sorting based on the same lt/gt helper functions used for binary indices. + * + * @param {string} propname - name of property to sort by. + * @param {boolean} [descending=false] - if true, the property will be sorted in descending order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + simplesort(propname: keyof (TData & TNested), descending?: boolean): this; + /** + * Allows sorting a ResultSet based on multiple columns. + * @example + * // to sort by age and then name (both ascending) + * rs.compoundsort(['age', 'name']); + * // to sort by age (ascending) and then by name (descending) + * rs.compoundsort(['age', ['name', true]); + * + * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order + * @returns {ResultSet} Reference to this ResultSet, sorted, for future chain operations. + */ + compoundsort(properties: (keyof (TData & TNested) | [keyof (TData & TNested), boolean])[]): this; + /** + * Helper function for compoundsort(), performing individual object comparisons + * + * @param {Array} properties - array of property names, in order, by which to evaluate sort order + * @param {object} obj1 - first object to compare + * @param {object} obj2 - second object to compare + * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first + */ + private _compoundeval(properties, obj1, obj2); + /** + * Sorts the ResultSet based on the last full-text-search scoring. + * @param {boolean} [ascending=false] - sort ascending + * @returns {ResultSet} + */ + sortByScoring(ascending?: boolean): this; + /** + * Returns the scoring of the last full-text-search. + * @returns {ScoreResult} + */ + getScoring(): Scorer.ScoreResult; + /** + * Oversee the operation of OR'ed query expressions. + * OR'ed expression evaluation runs each expression individually against the full collection, + * and finally does a set OR on each expression's results. + * Each evaluation can utilize a binary index to prevent multiple linear array scans. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findOr(expressionArray: ResultSet.Query & TNested>[]): this; + $or(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Oversee the operation of AND'ed query expressions. + * AND'ed expression evaluation runs each expression progressively against the full collection, + * internally utilizing existing chained ResultSet functionality. + * Only the first filter can utilize a binary index. + * + * @param {array} expressionArray - array of expressions + * @returns {ResultSet} this ResultSet for further chain ops. + */ + findAnd(expressionArray: ResultSet.Query & TNested>[]): this; + $and(expressionArray: ResultSet.Query & TNested>[]): this; + /** + * Used for querying via a mongo-style query object. + * + * @param {object} query - A mongo-style query object used for filtering current results. + * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() + * @returns {ResultSet} this ResultSet for further chain ops. + */ + find(query?: ResultSet.Query & TNested>, firstOnly?: boolean): this; + /** + * Used for filtering via a javascript filter function. + * + * @param {function} fun - A javascript function used for filtering current results by. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + where(fun: (obj: Doc) => boolean): this; + /** + * Returns the number of documents in the ResultSet. + * @returns {number} The number of documents in the ResultSet. + */ + count(): number; + /** + * Terminates the chain and returns array of filtered documents + * @param {object} options + * @param {boolean} [options.forceClones] - Allows forcing the return of cloned objects even when + * the collection is not configured for clone object. + * @param {string} [options.forceCloneMethod] - Allows overriding the default or collection specified cloning method. + * Possible values 'parse-stringify', 'deep', and 'shallow' and + * @param {boolean} [options.removeMeta] - will force clones and strip $loki and meta properties from documents + * + * @returns {Array} Array of documents in the ResultSet + */ + data(options?: ResultSet.DataOptions): Doc[]; + /** + * Used to run an update operation on all documents currently in the ResultSet. + * + * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. + * @returns {ResultSet} this ResultSet for further chain ops. + */ + update(updateFunction: (obj: Doc) => TData): this; + /** + * Removes all document objects which are currently in ResultSet from collection (as well as ResultSet) + * + * @returns {ResultSet} this (empty) ResultSet for further chain ops. + */ + remove(): this; + /** + * data transformation via user supplied functions + * + * @param {function} mapFunction - this function accepts a single document for you to transform and return + * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value + * @returns {value} The output of your reduceFunction + */ + mapReduce(mapFunction: (item: TData, index: number, array: TData[]) => T, reduceFunction: (array: T[]) => U): U; + /** + * Left joining two sets of data. Join keys can be defined or calculated properties + * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key + * @param {Array|ResultSet|Collection} joinData - Data array to join to. + * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on + * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on + * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} + * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - allows overriding the default or collection specified cloning method + * @returns {ResultSet} A ResultSet with data in the format [{left: leftObj, right: rightObj}] + */ + eqJoin(joinData: Collection | ResultSet | any[], leftJoinKey: string | ((obj: any) => string), rightJoinKey: string | ((obj: any) => string), mapFun?: (left: any, right: any) => any, dataOptions?: ResultSet.DataOptions): ResultSet; + /** + * Applies a map function into a new collection for further chaining. + * @param {function} mapFun - javascript map function + * @param {object} [dataOptions=] - options to data() before input to your map function + * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun + * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object + * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method + * @return {ResultSet} + */ + map(mapFun: (obj: TData, index: number, array: TData[]) => U, dataOptions?: ResultSet.DataOptions): ResultSet; +} +export declare namespace ResultSet { + interface DataOptions { + forceClones?: boolean; + forceCloneMethod?: CloneMethod; + removeMeta?: boolean; + } + type LokiOps = { + $eq?: R; + $aeq?: R; + $ne?: R; + $dteq?: R; + $gt?: R; + $gte?: R; + $lt?: R; + $lte?: R; + $between?: [R, R]; + $in?: R[]; + $nin?: R[]; + $keyin?: object; + $nkeyin?: object; + $definedin?: object; + $undefinedin?: object; + $regex?: RegExp | string | [string, string]; + $containsString?: string; + $containsNone?: R[] | R; + $containsAny?: R[] | R; + $contains?: any; + $type?: string; + $finite?: boolean; + $size?: number; + $len?: number; + $where?: (val?: R) => boolean; + }; + type Query = { + [P in keyof TData]?: LokiOps | TData[P]; + } & { + $and?: Query[]; + } & { + $or?: Query[]; + } & { + $fts?: FullTextSearchQuery; + }; +} diff --git a/dist/packages/partitioning-adapter/types/loki/src/resultset.d.ts b/dist/packages/partitioning-adapter/types/loki/src/resultset.d.ts deleted file mode 100644 index 8ee6b343..00000000 --- a/dist/packages/partitioning-adapter/types/loki/src/resultset.d.ts +++ /dev/null @@ -1,262 +0,0 @@ -import { Collection } from "./collection"; -import { CloneMethod } from "./clone"; -import { Doc, Query } from "../../common/types"; -import { ScoreResult } from "../../full-text-search/src/scorer"; -export declare type ANY = any; -/** - * @hidden - */ -export declare const LokiOps: { - $eq(a: any, b: any): boolean; - $aeq(a: any, b: any): boolean; - $ne(a: any, b: any): boolean; - $dteq(a: any, b: any): boolean; - $gt(a: any, b: any): boolean; - $gte(a: any, b: any): boolean; - $lt(a: any, b: any): boolean; - $lte(a: any, b: any): boolean; - $between(a: any, vals: any): boolean; - $in(a: any, b: any): boolean; - $nin(a: any, b: any): boolean; - $keyin(a: any, b: any): boolean; - $nkeyin(a: any, b: any): boolean; - $definedin(a: any, b: any): boolean; - $undefinedin(a: any, b: any): boolean; - $regex(a: any, b: any): any; - $containsString(a: any, b: any): boolean; - $containsNone(a: any, b: any): boolean; - $containsAny(a: any, b: any): any; - $contains(a: any, b: any): any; - $type(a: any, b: any): any; - $finite(a: any, b: any): boolean; - $size(a: any, b: any): any; - $len(a: any, b: any): any; - $where(a: any, b: any): boolean; - $not(a: any, b: any): boolean; - $and(a: any, b: any): boolean; - $or(a: any, b: any): boolean; -}; -/** - * Resultset class allowing chainable queries. Intended to be instanced internally. - * Collection.find(), Collection.where(), and Collection.chain() instantiate this. - * - * @example - * mycollection.chain() - * .find({ 'doors' : 4 }) - * .where(function(obj) { return obj.name === 'Toyota' }) - * .data(); - */ -export declare class Resultset { - collection: Collection; - filteredrows: number[]; - filterInitialized: boolean; - private _scoring; - /** - * Constructor. - * @param {Collection} collection - the collection which this Resultset will query against - */ - constructor(collection: Collection); - /** - * reset() - Reset the resultset to its initial state. - * - * @returns {Resultset} Reference to this resultset, for future chain operations. - */ - reset(): Resultset; - /** - * toJSON() - Override of toJSON to avoid circular references - * - */ - toJSON(): Resultset; - /** - * Allows you to limit the number of documents passed to next chain operation. - * A resultset copy() is made to avoid altering original resultset. - * - * @param {int} qty - The number of documents to return. - * @returns {Resultset} Returns a copy of the resultset, limited by qty, for subsequent chain ops. - */ - limit(qty: number): Resultset; - /** - * Used for skipping 'pos' number of documents in the resultset. - * - * @param {int} pos - Number of documents to skip; all preceding documents are filtered out. - * @returns {Resultset} Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops. - */ - offset(pos: number): Resultset; - /** - * copy() - To support reuse of resultset in branched query situations. - * - * @returns {Resultset} Returns a copy of the resultset (set) but the underlying document references will be the same. - */ - copy(): Resultset; - /** - * Alias of copy() - */ - branch(): Resultset; - /** - * Executes a named collection transform or raw array of transform steps against the resultset. - * - * @param {(string|array)} transform - name of collection transform or raw transform array - * @param {object} [parameters=] - object property hash of parameters, if the transform requires them. - * @returns {Resultset} either (this) resultset or a clone of of this resultset (depending on steps) - */ - transform(transform: string | any[], parameters?: object): Resultset; - /** - * User supplied compare function is provided two documents to compare. (chainable) - * @example - * rslt.sort(function(obj1, obj2) { - * if (obj1.name === obj2.name) return 0; - * if (obj1.name > obj2.name) return 1; - * if (obj1.name < obj2.name) return -1; - * }); - * - * @param {function} comparefun - A javascript compare function used for sorting. - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - sort(comparefun: (a: E, b: E) => number): Resultset; - /** - * Simpler, loose evaluation for user to sort based on a property name. (chainable). - * Sorting based on the same lt/gt helper functions used for binary indices. - * - * @param {string} propname - name of property to sort by. - * @param {boolean} isdesc - (Optional) If true, the property will be sorted in descending order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - simplesort(propname: string, isdesc?: boolean): Resultset; - /** - * Allows sorting a resultset based on multiple columns. - * @example - * // to sort by age and then name (both ascending) - * rs.compoundsort(['age', 'name']); - * // to sort by age (ascending) and then by name (descending) - * rs.compoundsort(['age', ['name', true]); - * - * @param {array} properties - array of property names or subarray of [propertyname, isdesc] used evaluate sort order - * @returns {Resultset} Reference to this resultset, sorted, for future chain operations. - */ - compoundsort(properties: (string | [string, boolean])[]): Resultset; - /** - * Helper function for compoundsort(), performing individual object comparisons - * - * @param {Array} properties - array of property names, in order, by which to evaluate sort order - * @param {object} obj1 - first object to compare - * @param {object} obj2 - second object to compare - * @returns {number} 0, -1, or 1 to designate if identical (sortwise) or which should be first - */ - private _compoundeval(properties, obj1, obj2); - /** - * Sorts the resultset based on the last full-text-search scoring. - * @param {boolean} [ascending=false] - sort ascending - * @returns {Resultset} - */ - sortByScoring(ascending?: boolean): Resultset; - /** - * Returns the scoring of the last full-text-search. - * @returns {ScoreResult} - */ - getScoring(): ScoreResult; - /** - * findOr() - oversee the operation of OR'ed query expressions. - * OR'ed expression evaluation runs each expression individually against the full collection, - * and finally does a set OR on each expression's results. - * Each evaluation can utilize a binary index to prevent multiple linear array scans. - * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. - */ - findOr(expressionArray: Query[]): Resultset; - $or(expressionArray: Query[]): Resultset; - /** - * findAnd() - oversee the operation of AND'ed query expressions. - * AND'ed expression evaluation runs each expression progressively against the full collection, - * internally utilizing existing chained resultset functionality. - * Only the first filter can utilize a binary index. - * - * @param {array} expressionArray - array of expressions - * @returns {Resultset} this resultset for further chain ops. - */ - findAnd(expressionArray: Query[]): Resultset; - $and(expressionArray: Query[]): Resultset; - /** - * Used for querying via a mongo-style query object. - * - * @param {object} query - A mongo-style query object used for filtering current results. - * @param {boolean} firstOnly - (Optional) Used by collection.findOne() - flag if this was invoked via findOne() - * @returns {Resultset} this resultset for further chain ops. - */ - find(query?: Query, firstOnly?: boolean): Resultset; - /** - * Used for filtering via a javascript filter function. - * - * @param {function} fun - A javascript function used for filtering current results by. - * @returns {Resultset} this resultset for further chain ops. - */ - where(fun: (obj: E) => boolean): Resultset; - /** - * Returns the number of documents in the resultset. - * @returns {number} The number of documents in the resultset. - */ - count(): number; - /** - * Terminates the chain and returns array of filtered documents - * @param {object} options - * @param {boolean} options.forceClones - Allows forcing the return of cloned objects even when - * the collection is not configured for clone object. - * @param {string} options.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow' - * @param {boolean} options.removeMeta - Will force clones and strip $loki and meta properties from documents - * - * @returns {Array} Array of documents in the resultset - */ - data(options?: Resultset.DataOptions): Doc[]; - /** - * Used to run an update operation on all documents currently in the resultset. - * - * @param {function} updateFunction - User supplied updateFunction(obj) will be executed for each document object. - * @returns {Resultset} this resultset for further chain ops. - */ - update(updateFunction: (obj: E) => E): Resultset; - /** - * Removes all document objects which are currently in resultset from collection (as well as resultset) - * - * @returns {Resultset} this (empty) resultset for further chain ops. - */ - remove(): Resultset; - /** - * data transformation via user supplied functions - * - * @param {function} mapFunction - this function accepts a single document for you to transform and return - * @param {function} reduceFunction - this function accepts many (array of map outputs) and returns single value - * @returns {value} The output of your reduceFunction - */ - mapReduce(mapFunction: (item: E, index: number, array: E[]) => T, reduceFunction: (array: T[]) => U): U; - /** - * Left joining two sets of data. Join keys can be defined or calculated properties - * eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key - * @param {Array|Resultset|Collection} joinData - Data array to join to. - * @param {(string|function)} leftJoinKey - Property name in this result set to join on or a function to produce a value to join on - * @param {(string|function)} rightJoinKey - Property name in the joinData to join on or a function to produce a value to join on - * @param {function} [mapFun=] - a function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject} - * @param {object} [dataOptions=] - optional options to apply to data() calls for left and right sides - * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun - * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - * @returns {Resultset} A resultset with data in the format [{left: leftObj, right: rightObj}] - */ - eqJoin(joinData: ANY, leftJoinKey: string | Function, rightJoinKey: string | Function, mapFun?: Function, dataOptions?: ANY): ANY; - /** - * Applies a map function into a new collection for further chaining. - * @param {function} mapFun - javascript map function - * @param {object} [dataOptions=] - options to data() before input to your map function - * @param {boolean} dataOptions.removeMeta - allows removing meta before calling mapFun - * @param {boolean} dataOptions.forceClones - forcing the return of cloned objects to your map object - * @param {string} dataOptions.forceCloneMethod - Allows overriding the default or collection specified cloning method. - */ - map(mapFun: (obj: E, index: number, array: E[]) => U, dataOptions?: Resultset.DataOptions): Resultset; -} -export declare namespace Resultset { - interface DataOptions { - forceClones?: boolean; - forceCloneMethod?: CloneMethod; - removeMeta?: boolean; - } -} diff --git a/dist/packages/partitioning-adapter/types/loki/src/unique_index.d.ts b/dist/packages/partitioning-adapter/types/loki/src/unique_index.d.ts index 40312618..55284c11 100644 --- a/dist/packages/partitioning-adapter/types/loki/src/unique_index.d.ts +++ b/dist/packages/partitioning-adapter/types/loki/src/unique_index.d.ts @@ -1,30 +1,30 @@ import { Doc } from "../../common/types"; -export declare class UniqueIndex { +export declare class UniqueIndex { private _field; private _keyMap; /** * Constructs an unique index object. * @param {number|string} propertyField - the property field to index */ - constructor(propertyField: number | string); + constructor(propertyField: keyof E); /** * Sets a document's unique index. * @param {Doc} doc - the document * @param {number} row - the data row of the document */ - set(doc: Doc, row: number): void; + set(doc: Doc, row: number): void; /** * Returns the data row of an unique index. * @param {number|string} index - the index * @returns {number | string} - the row */ - get(index: number | string): number; + get(index: keyof E): number; /** * Updates a document's unique index. * @param {Object} doc - the document * @param {number} row - the data row of the document */ - update(doc: Doc, row: number): void; + update(doc: Doc, row: number): void; /** * Removes an unique index. * @param {number|string} index - the unique index diff --git a/dist/packages/partitioning-adapter/types/memory-storage/src/index.d.ts b/dist/packages/partitioning-adapter/types/memory-storage/src/index.d.ts new file mode 100644 index 00000000..5330aa7d --- /dev/null +++ b/dist/packages/partitioning-adapter/types/memory-storage/src/index.d.ts @@ -0,0 +1,3 @@ +import { MemoryStorage } from "./memory_storage"; +export { MemoryStorage }; +export default MemoryStorage; diff --git a/dist/packages/partitioning-adapter/types/memory-storage/src/memory_storage.d.ts b/dist/packages/partitioning-adapter/types/memory-storage/src/memory_storage.d.ts new file mode 100644 index 00000000..0066a1de --- /dev/null +++ b/dist/packages/partitioning-adapter/types/memory-storage/src/memory_storage.d.ts @@ -0,0 +1,57 @@ +import { Dict, StorageAdapter } from "../../common/types"; +/** + * An in-memory persistence adapter for an in-memory database. + * This simple 'key/value' adapter is intended for unit testing and diagnostics. + */ +export declare class MemoryStorage implements StorageAdapter { + hashStore: Dict<{ + savecount: number; + lastsave: Date; + value: string; + }>; + options: MemoryStorage.Options; + /** + * Registers the local storage as plugin. + */ + static register(): void; + /** + * Deregisters the local storage as plugin. + */ + static deregister(): void; + /** + * @param {object} options - memory storage options + * @param {boolean} [options.asyncResponses=false] - whether callbacks are invoked asynchronously (default: false) + * @param {int} [options.asyncTimeout=50] - timeout in ms to queue callbacks (default: 50) + */ + constructor(options?: MemoryStorage.Options); + /** + * Loads a serialized database from its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was loaded + */ + loadDatabase(dbname: string): Promise; + /** + * Saves a serialized database to its in-memory store. + * (Loki persistence adapter interface function) + * + * @param {string} dbname - name of the database (filename/keyname) + * @param {string} dbstring - the database content + * @returns {Promise} a Promise that resolves after the database was persisted + */ + saveDatabase(dbname: string, dbstring: string): Promise; + /** + * Deletes a database from its in-memory store. + * + * @param {string} dbname - name of the database (filename/keyname) + * @returns {Promise} a Promise that resolves after the database was deleted + */ + deleteDatabase(dbname: string): Promise; +} +export declare namespace MemoryStorage { + interface Options { + asyncResponses?: boolean; + asyncTimeout?: number; + } +} diff --git a/dist/packages/partitioning-adapter/types/partitioning-adapter/src/index.d.ts b/dist/packages/partitioning-adapter/types/partitioning-adapter/src/index.d.ts new file mode 100644 index 00000000..bf49882f --- /dev/null +++ b/dist/packages/partitioning-adapter/types/partitioning-adapter/src/index.d.ts @@ -0,0 +1,3 @@ +import { PartitioningAdapter } from "./partitioning_adapter"; +export { PartitioningAdapter }; +export default PartitioningAdapter; diff --git a/dist/packages/partitioning-adapter/types/partitioning-adapter/src/partitioning_adapter.d.ts b/dist/packages/partitioning-adapter/types/partitioning-adapter/src/partitioning_adapter.d.ts index ff9568cf..45e14850 100644 --- a/dist/packages/partitioning-adapter/types/partitioning-adapter/src/partitioning_adapter.d.ts +++ b/dist/packages/partitioning-adapter/types/partitioning-adapter/src/partitioning_adapter.d.ts @@ -1,4 +1,5 @@ -import { ANY, StorageAdapter } from "../../common/types"; +import { Loki } from "../../loki/src/loki"; +import { StorageAdapter } from "../../common/types"; /** * An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter * which can perform destructuring and partitioning. Each collection will be stored in its own key/save and @@ -9,7 +10,7 @@ import { ANY, StorageAdapter } from "../../common/types"; * single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all * of that collection's pages will be written on next save. */ -export declare class LokiPartitioningAdapter implements StorageAdapter { +export declare class PartitioningAdapter implements StorageAdapter { mode: string; private _adapter; private _dbref; @@ -68,7 +69,7 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { * @returns {Promise} a Promise that resolves after the database was deleted * */ - exportDatabase(dbname: string, dbref: ANY): Promise; + exportDatabase(dbname: string, dbref: Loki): Promise; /** * Helper method used internally to save each dirty collection, one at a time. * @@ -82,11 +83,3 @@ export declare class LokiPartitioningAdapter implements StorageAdapter { */ private _saveNextPage(); } -declare namespace LokiPartitioningAdapter { - interface PageIterator { - collection?: ANY; - docIndex?: number; - pageIndex?: number; - } -} -export default LokiPartitioningAdapter; diff --git a/docs/api/assets/js/search.js b/docs/api/assets/js/search.js index 1e606136..94efbb2d 100644 --- a/docs/api/assets/js/search.js +++ b/docs/api/assets/js/search.js @@ -1,3 +1,3 @@ var typedoc = typedoc || {}; typedoc.search = typedoc.search || {}; - typedoc.search.data = {"kinds":{"4":"Enumeration","16":"Enumeration member","32":"Variable","64":"Function","128":"Class","256":"Interface","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","2097152":"Object literal","4194304":"Type alias"},"rows":[{"id":0,"kind":128,"name":"LokiEventEmitter","url":"classes/lokieventemitter.html","classes":"tsd-kind-class"},{"id":1,"kind":1024,"name":"events","url":"classes/lokieventemitter.html#events","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"LokiEventEmitter"},{"id":2,"kind":1024,"name":"asyncListeners","url":"classes/lokieventemitter.html#asynclisteners","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"LokiEventEmitter"},{"id":3,"kind":512,"name":"constructor","url":"classes/lokieventemitter.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"LokiEventEmitter"},{"id":4,"kind":2048,"name":"on","url":"classes/lokieventemitter.html#on","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiEventEmitter"},{"id":5,"kind":2048,"name":"emit","url":"classes/lokieventemitter.html#emit","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiEventEmitter"},{"id":6,"kind":2048,"name":"addListener","url":"classes/lokieventemitter.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiEventEmitter"},{"id":7,"kind":2048,"name":"removeListener","url":"classes/lokieventemitter.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiEventEmitter"},{"id":8,"kind":128,"name":"UniqueIndex","url":"classes/uniqueindex.html","classes":"tsd-kind-class"},{"id":9,"kind":512,"name":"constructor","url":"classes/uniqueindex.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"UniqueIndex"},{"id":10,"kind":2048,"name":"set","url":"classes/uniqueindex.html#set","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UniqueIndex"},{"id":11,"kind":2048,"name":"get","url":"classes/uniqueindex.html#get","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UniqueIndex"},{"id":12,"kind":2048,"name":"update","url":"classes/uniqueindex.html#update","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UniqueIndex"},{"id":13,"kind":2048,"name":"remove","url":"classes/uniqueindex.html#remove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UniqueIndex"},{"id":14,"kind":2048,"name":"clear","url":"classes/uniqueindex.html#clear","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UniqueIndex"},{"id":15,"kind":4,"name":"CloneMethod","url":"enums/clonemethod.html","classes":"tsd-kind-enum"},{"id":16,"kind":16,"name":"PARSE_STRINGIFY","url":"enums/clonemethod.html#parse_stringify","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"CloneMethod"},{"id":17,"kind":16,"name":"DEEP","url":"enums/clonemethod.html#deep","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"CloneMethod"},{"id":18,"kind":16,"name":"SHALLOW","url":"enums/clonemethod.html#shallow","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"CloneMethod"},{"id":19,"kind":16,"name":"SHALLOW_ASSIGN","url":"enums/clonemethod.html#shallow_assign","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"CloneMethod"},{"id":20,"kind":16,"name":"SHALLOW_RECURSE_OBJECTS","url":"enums/clonemethod.html#shallow_recurse_objects","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"CloneMethod"},{"id":21,"kind":128,"name":"Tokenizer","url":"classes/tokenizer.html","classes":"tsd-kind-class"},{"id":22,"kind":512,"name":"constructor","url":"classes/tokenizer.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"Tokenizer"},{"id":23,"kind":2048,"name":"setSplitter","url":"classes/tokenizer.html#setsplitter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":24,"kind":2048,"name":"getSplitter","url":"classes/tokenizer.html#getsplitter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":25,"kind":2048,"name":"resetSplitter","url":"classes/tokenizer.html#resetsplitter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":26,"kind":2048,"name":"has","url":"classes/tokenizer.html#has","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":27,"kind":2048,"name":"get","url":"classes/tokenizer.html#get","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":28,"kind":2048,"name":"add","url":"classes/tokenizer.html#add","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":29,"kind":2048,"name":"addBefore","url":"classes/tokenizer.html#addbefore","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":30,"kind":2048,"name":"addAfter","url":"classes/tokenizer.html#addafter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":31,"kind":2048,"name":"remove","url":"classes/tokenizer.html#remove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":32,"kind":2048,"name":"reset","url":"classes/tokenizer.html#reset","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":33,"kind":2048,"name":"tokenize","url":"classes/tokenizer.html#tokenize","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":34,"kind":2048,"name":"toJSON","url":"classes/tokenizer.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":35,"kind":2048,"name":"fromJSONObject","url":"classes/tokenizer.html#fromjsonobject","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"Tokenizer"},{"id":36,"kind":256,"name":"Serialization","url":"interfaces/tokenizer.serialization.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Tokenizer"},{"id":37,"kind":1024,"name":"splitter","url":"interfaces/tokenizer.serialization.html#splitter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Tokenizer.Serialization"},{"id":38,"kind":1024,"name":"tokenizers","url":"interfaces/tokenizer.serialization.html#tokenizers","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Tokenizer.Serialization"},{"id":39,"kind":4194304,"name":"SplitterFunction","url":"classes/tokenizer.html#splitterfunction","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Tokenizer"},{"id":40,"kind":65536,"name":"__type","url":"classes/tokenizer.html#splitterfunction.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"Tokenizer.SplitterFunction"},{"id":41,"kind":4194304,"name":"TokinizeFunction","url":"classes/tokenizer.html#tokinizefunction","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Tokenizer"},{"id":42,"kind":65536,"name":"__type","url":"classes/tokenizer.html#tokinizefunction.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"Tokenizer.TokinizeFunction"},{"id":43,"kind":4194304,"name":"FunctionSerialization","url":"classes/tokenizer.html#functionserialization","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Tokenizer"},{"id":44,"kind":128,"name":"BaseQueryBuilder","url":"classes/basequerybuilder.html","classes":"tsd-kind-class"},{"id":45,"kind":1024,"name":"_data","url":"classes/basequerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"BaseQueryBuilder"},{"id":46,"kind":512,"name":"constructor","url":"classes/basequerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"BaseQueryBuilder"},{"id":47,"kind":2048,"name":"boost","url":"classes/basequerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BaseQueryBuilder"},{"id":48,"kind":2048,"name":"build","url":"classes/basequerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BaseQueryBuilder"},{"id":49,"kind":256,"name":"BaseQuery","url":"interfaces/basequery.html","classes":"tsd-kind-interface"},{"id":50,"kind":1024,"name":"type","url":"interfaces/basequery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BaseQuery"},{"id":51,"kind":1024,"name":"boost","url":"interfaces/basequery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BaseQuery"},{"id":52,"kind":128,"name":"TermQueryBuilder","url":"classes/termquerybuilder.html","classes":"tsd-kind-class"},{"id":53,"kind":512,"name":"constructor","url":"classes/termquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"TermQueryBuilder"},{"id":54,"kind":1024,"name":"_data","url":"classes/termquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"TermQueryBuilder"},{"id":55,"kind":2048,"name":"boost","url":"classes/termquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TermQueryBuilder"},{"id":56,"kind":2048,"name":"build","url":"classes/termquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TermQueryBuilder"},{"id":57,"kind":256,"name":"TermQuery","url":"interfaces/termquery.html","classes":"tsd-kind-interface"},{"id":58,"kind":1024,"name":"field","url":"interfaces/termquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TermQuery"},{"id":59,"kind":1024,"name":"value","url":"interfaces/termquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TermQuery"},{"id":60,"kind":1024,"name":"type","url":"interfaces/termquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"TermQuery"},{"id":61,"kind":1024,"name":"boost","url":"interfaces/termquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"TermQuery"},{"id":62,"kind":128,"name":"TermsQueryBuilder","url":"classes/termsquerybuilder.html","classes":"tsd-kind-class"},{"id":63,"kind":512,"name":"constructor","url":"classes/termsquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"TermsQueryBuilder"},{"id":64,"kind":1024,"name":"_data","url":"classes/termsquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"TermsQueryBuilder"},{"id":65,"kind":2048,"name":"boost","url":"classes/termsquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TermsQueryBuilder"},{"id":66,"kind":2048,"name":"build","url":"classes/termsquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TermsQueryBuilder"},{"id":67,"kind":256,"name":"TermsQuery","url":"interfaces/termsquery.html","classes":"tsd-kind-interface"},{"id":68,"kind":1024,"name":"field","url":"interfaces/termsquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TermsQuery"},{"id":69,"kind":1024,"name":"value","url":"interfaces/termsquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TermsQuery"},{"id":70,"kind":1024,"name":"type","url":"interfaces/termsquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"TermsQuery"},{"id":71,"kind":1024,"name":"boost","url":"interfaces/termsquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"TermsQuery"},{"id":72,"kind":128,"name":"WildcardQueryBuilder","url":"classes/wildcardquerybuilder.html","classes":"tsd-kind-class"},{"id":73,"kind":512,"name":"constructor","url":"classes/wildcardquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"WildcardQueryBuilder"},{"id":74,"kind":2048,"name":"enableScoring","url":"classes/wildcardquerybuilder.html#enablescoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"WildcardQueryBuilder"},{"id":75,"kind":1024,"name":"_data","url":"classes/wildcardquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"WildcardQueryBuilder"},{"id":76,"kind":2048,"name":"boost","url":"classes/wildcardquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"WildcardQueryBuilder"},{"id":77,"kind":2048,"name":"build","url":"classes/wildcardquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"WildcardQueryBuilder"},{"id":78,"kind":256,"name":"WildcardQuery","url":"interfaces/wildcardquery.html","classes":"tsd-kind-interface"},{"id":79,"kind":1024,"name":"field","url":"interfaces/wildcardquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WildcardQuery"},{"id":80,"kind":1024,"name":"value","url":"interfaces/wildcardquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WildcardQuery"},{"id":81,"kind":1024,"name":"enable_scoring","url":"interfaces/wildcardquery.html#enable_scoring","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WildcardQuery"},{"id":82,"kind":1024,"name":"type","url":"interfaces/wildcardquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"WildcardQuery"},{"id":83,"kind":1024,"name":"boost","url":"interfaces/wildcardquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"WildcardQuery"},{"id":84,"kind":128,"name":"FuzzyQueryBuilder","url":"classes/fuzzyquerybuilder.html","classes":"tsd-kind-class"},{"id":85,"kind":512,"name":"constructor","url":"classes/fuzzyquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"FuzzyQueryBuilder"},{"id":86,"kind":2048,"name":"fuzziness","url":"classes/fuzzyquerybuilder.html#fuzziness","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FuzzyQueryBuilder"},{"id":87,"kind":2048,"name":"prefixLength","url":"classes/fuzzyquerybuilder.html#prefixlength","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FuzzyQueryBuilder"},{"id":88,"kind":2048,"name":"extended","url":"classes/fuzzyquerybuilder.html#extended","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FuzzyQueryBuilder"},{"id":89,"kind":1024,"name":"_data","url":"classes/fuzzyquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"FuzzyQueryBuilder"},{"id":90,"kind":2048,"name":"boost","url":"classes/fuzzyquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"FuzzyQueryBuilder"},{"id":91,"kind":2048,"name":"build","url":"classes/fuzzyquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"FuzzyQueryBuilder"},{"id":92,"kind":256,"name":"FuzzyQuery","url":"interfaces/fuzzyquery.html","classes":"tsd-kind-interface"},{"id":93,"kind":1024,"name":"field","url":"interfaces/fuzzyquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FuzzyQuery"},{"id":94,"kind":1024,"name":"value","url":"interfaces/fuzzyquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FuzzyQuery"},{"id":95,"kind":1024,"name":"fuzziness","url":"interfaces/fuzzyquery.html#fuzziness","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FuzzyQuery"},{"id":96,"kind":1024,"name":"prefix_length","url":"interfaces/fuzzyquery.html#prefix_length","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FuzzyQuery"},{"id":97,"kind":1024,"name":"extended","url":"interfaces/fuzzyquery.html#extended","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FuzzyQuery"},{"id":98,"kind":1024,"name":"type","url":"interfaces/fuzzyquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"FuzzyQuery"},{"id":99,"kind":1024,"name":"boost","url":"interfaces/fuzzyquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"FuzzyQuery"},{"id":100,"kind":128,"name":"PrefixQueryBuilder","url":"classes/prefixquerybuilder.html","classes":"tsd-kind-class"},{"id":101,"kind":512,"name":"constructor","url":"classes/prefixquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"PrefixQueryBuilder"},{"id":102,"kind":2048,"name":"enableScoring","url":"classes/prefixquerybuilder.html#enablescoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"PrefixQueryBuilder"},{"id":103,"kind":1024,"name":"_data","url":"classes/prefixquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"PrefixQueryBuilder"},{"id":104,"kind":2048,"name":"boost","url":"classes/prefixquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"PrefixQueryBuilder"},{"id":105,"kind":2048,"name":"build","url":"classes/prefixquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"PrefixQueryBuilder"},{"id":106,"kind":256,"name":"PrefixQuery","url":"interfaces/prefixquery.html","classes":"tsd-kind-interface"},{"id":107,"kind":1024,"name":"field","url":"interfaces/prefixquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"PrefixQuery"},{"id":108,"kind":1024,"name":"value","url":"interfaces/prefixquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"PrefixQuery"},{"id":109,"kind":1024,"name":"enable_scoring","url":"interfaces/prefixquery.html#enable_scoring","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"PrefixQuery"},{"id":110,"kind":1024,"name":"type","url":"interfaces/prefixquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"PrefixQuery"},{"id":111,"kind":1024,"name":"boost","url":"interfaces/prefixquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"PrefixQuery"},{"id":112,"kind":128,"name":"ExistsQueryBuilder","url":"classes/existsquerybuilder.html","classes":"tsd-kind-class"},{"id":113,"kind":512,"name":"constructor","url":"classes/existsquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"ExistsQueryBuilder"},{"id":114,"kind":1024,"name":"_data","url":"classes/existsquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"ExistsQueryBuilder"},{"id":115,"kind":2048,"name":"boost","url":"classes/existsquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ExistsQueryBuilder"},{"id":116,"kind":2048,"name":"build","url":"classes/existsquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ExistsQueryBuilder"},{"id":117,"kind":256,"name":"ExistsQuery","url":"interfaces/existsquery.html","classes":"tsd-kind-interface"},{"id":118,"kind":1024,"name":"field","url":"interfaces/existsquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ExistsQuery"},{"id":119,"kind":1024,"name":"type","url":"interfaces/existsquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"ExistsQuery"},{"id":120,"kind":1024,"name":"boost","url":"interfaces/existsquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"ExistsQuery"},{"id":121,"kind":128,"name":"MatchQueryBuilder","url":"classes/matchquerybuilder.html","classes":"tsd-kind-class"},{"id":122,"kind":512,"name":"constructor","url":"classes/matchquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"MatchQueryBuilder"},{"id":123,"kind":2048,"name":"minimumShouldMatch","url":"classes/matchquerybuilder.html#minimumshouldmatch","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MatchQueryBuilder"},{"id":124,"kind":2048,"name":"operator","url":"classes/matchquerybuilder.html#operator","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MatchQueryBuilder"},{"id":125,"kind":2048,"name":"fuzziness","url":"classes/matchquerybuilder.html#fuzziness","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MatchQueryBuilder"},{"id":126,"kind":2048,"name":"prefixLength","url":"classes/matchquerybuilder.html#prefixlength","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MatchQueryBuilder"},{"id":127,"kind":2048,"name":"extended","url":"classes/matchquerybuilder.html#extended","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MatchQueryBuilder"},{"id":128,"kind":1024,"name":"_data","url":"classes/matchquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"MatchQueryBuilder"},{"id":129,"kind":2048,"name":"boost","url":"classes/matchquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MatchQueryBuilder"},{"id":130,"kind":2048,"name":"build","url":"classes/matchquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MatchQueryBuilder"},{"id":131,"kind":256,"name":"MatchQuery","url":"interfaces/matchquery.html","classes":"tsd-kind-interface"},{"id":132,"kind":1024,"name":"field","url":"interfaces/matchquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":133,"kind":1024,"name":"value","url":"interfaces/matchquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":134,"kind":1024,"name":"minimum_should_match","url":"interfaces/matchquery.html#minimum_should_match","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":135,"kind":1024,"name":"operator","url":"interfaces/matchquery.html#operator","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":136,"kind":1024,"name":"fuzziness","url":"interfaces/matchquery.html#fuzziness","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":137,"kind":1024,"name":"prefix_length","url":"interfaces/matchquery.html#prefix_length","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":138,"kind":1024,"name":"extended","url":"interfaces/matchquery.html#extended","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":139,"kind":1024,"name":"type","url":"interfaces/matchquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"MatchQuery"},{"id":140,"kind":1024,"name":"boost","url":"interfaces/matchquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"MatchQuery"},{"id":141,"kind":128,"name":"MatchAllQueryBuilder","url":"classes/matchallquerybuilder.html","classes":"tsd-kind-class"},{"id":142,"kind":512,"name":"constructor","url":"classes/matchallquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"MatchAllQueryBuilder"},{"id":143,"kind":1024,"name":"_data","url":"classes/matchallquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"MatchAllQueryBuilder"},{"id":144,"kind":2048,"name":"boost","url":"classes/matchallquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MatchAllQueryBuilder"},{"id":145,"kind":2048,"name":"build","url":"classes/matchallquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MatchAllQueryBuilder"},{"id":146,"kind":256,"name":"MatchQueryAll","url":"interfaces/matchqueryall.html","classes":"tsd-kind-interface"},{"id":147,"kind":1024,"name":"type","url":"interfaces/matchqueryall.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"MatchQueryAll"},{"id":148,"kind":1024,"name":"boost","url":"interfaces/matchqueryall.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"MatchQueryAll"},{"id":149,"kind":128,"name":"ConstantScoreQueryBuilder","url":"classes/constantscorequerybuilder.html","classes":"tsd-kind-class"},{"id":150,"kind":512,"name":"constructor","url":"classes/constantscorequerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"ConstantScoreQueryBuilder"},{"id":151,"kind":2048,"name":"beginFilter","url":"classes/constantscorequerybuilder.html#beginfilter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ConstantScoreQueryBuilder"},{"id":152,"kind":1024,"name":"_data","url":"classes/constantscorequerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"ConstantScoreQueryBuilder"},{"id":153,"kind":2048,"name":"boost","url":"classes/constantscorequerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ConstantScoreQueryBuilder"},{"id":154,"kind":2048,"name":"build","url":"classes/constantscorequerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ConstantScoreQueryBuilder"},{"id":155,"kind":256,"name":"ConstantScoreQuery","url":"interfaces/constantscorequery.html","classes":"tsd-kind-interface"},{"id":156,"kind":1024,"name":"filter","url":"interfaces/constantscorequery.html#filter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ConstantScoreQuery"},{"id":157,"kind":1024,"name":"type","url":"interfaces/constantscorequery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"ConstantScoreQuery"},{"id":158,"kind":1024,"name":"boost","url":"interfaces/constantscorequery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"ConstantScoreQuery"},{"id":159,"kind":128,"name":"BoolQueryBuilder","url":"classes/boolquerybuilder.html","classes":"tsd-kind-class"},{"id":160,"kind":512,"name":"constructor","url":"classes/boolquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"BoolQueryBuilder"},{"id":161,"kind":2048,"name":"beginMust","url":"classes/boolquerybuilder.html#beginmust","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BoolQueryBuilder"},{"id":162,"kind":2048,"name":"beginFilter","url":"classes/boolquerybuilder.html#beginfilter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BoolQueryBuilder"},{"id":163,"kind":2048,"name":"beginShould","url":"classes/boolquerybuilder.html#beginshould","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BoolQueryBuilder"},{"id":164,"kind":2048,"name":"beginNot","url":"classes/boolquerybuilder.html#beginnot","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BoolQueryBuilder"},{"id":165,"kind":2048,"name":"minimumShouldMatch","url":"classes/boolquerybuilder.html#minimumshouldmatch","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BoolQueryBuilder"},{"id":166,"kind":1024,"name":"_data","url":"classes/boolquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"BoolQueryBuilder"},{"id":167,"kind":2048,"name":"boost","url":"classes/boolquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"BoolQueryBuilder"},{"id":168,"kind":2048,"name":"build","url":"classes/boolquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"BoolQueryBuilder"},{"id":169,"kind":256,"name":"BoolQuery","url":"interfaces/boolquery.html","classes":"tsd-kind-interface"},{"id":170,"kind":1024,"name":"must","url":"interfaces/boolquery.html#must","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BoolQuery"},{"id":171,"kind":1024,"name":"filter","url":"interfaces/boolquery.html#filter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BoolQuery"},{"id":172,"kind":1024,"name":"should","url":"interfaces/boolquery.html#should","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BoolQuery"},{"id":173,"kind":1024,"name":"not","url":"interfaces/boolquery.html#not","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BoolQuery"},{"id":174,"kind":1024,"name":"minimum_should_match","url":"interfaces/boolquery.html#minimum_should_match","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BoolQuery"},{"id":175,"kind":1024,"name":"type","url":"interfaces/boolquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"BoolQuery"},{"id":176,"kind":1024,"name":"boost","url":"interfaces/boolquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"BoolQuery"},{"id":177,"kind":128,"name":"ArrayQueryBuilder","url":"classes/arrayquerybuilder.html","classes":"tsd-kind-class"},{"id":178,"kind":512,"name":"constructor","url":"classes/arrayquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"ArrayQueryBuilder"},{"id":179,"kind":2048,"name":"bool","url":"classes/arrayquerybuilder.html#bool","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":180,"kind":2048,"name":"constantScore","url":"classes/arrayquerybuilder.html#constantscore","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":181,"kind":2048,"name":"term","url":"classes/arrayquerybuilder.html#term","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":182,"kind":2048,"name":"terms","url":"classes/arrayquerybuilder.html#terms","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":183,"kind":2048,"name":"wildcard","url":"classes/arrayquerybuilder.html#wildcard","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":184,"kind":2048,"name":"fuzzy","url":"classes/arrayquerybuilder.html#fuzzy","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":185,"kind":2048,"name":"match","url":"classes/arrayquerybuilder.html#match","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":186,"kind":2048,"name":"matchAll","url":"classes/arrayquerybuilder.html#matchall","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":187,"kind":2048,"name":"prefix","url":"classes/arrayquerybuilder.html#prefix","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":188,"kind":2048,"name":"exists","url":"classes/arrayquerybuilder.html#exists","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":189,"kind":1024,"name":"_data","url":"classes/arrayquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"ArrayQueryBuilder"},{"id":190,"kind":2048,"name":"boost","url":"classes/arrayquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ArrayQueryBuilder"},{"id":191,"kind":2048,"name":"build","url":"classes/arrayquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ArrayQueryBuilder"},{"id":192,"kind":256,"name":"ArrayQuery","url":"interfaces/arrayquery.html","classes":"tsd-kind-interface"},{"id":193,"kind":1024,"name":"values","url":"interfaces/arrayquery.html#values","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ArrayQuery"},{"id":194,"kind":128,"name":"QueryBuilder","url":"classes/querybuilder.html","classes":"tsd-kind-class"},{"id":195,"kind":512,"name":"constructor","url":"classes/querybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"QueryBuilder"},{"id":196,"kind":2048,"name":"enableFinalScoring","url":"classes/querybuilder.html#enablefinalscoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":197,"kind":2048,"name":"BM25Similarity","url":"classes/querybuilder.html#bm25similarity","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":198,"kind":2048,"name":"bool","url":"classes/querybuilder.html#bool","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":199,"kind":2048,"name":"constantScore","url":"classes/querybuilder.html#constantscore","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":200,"kind":2048,"name":"term","url":"classes/querybuilder.html#term","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":201,"kind":2048,"name":"terms","url":"classes/querybuilder.html#terms","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":202,"kind":2048,"name":"wildcard","url":"classes/querybuilder.html#wildcard","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":203,"kind":2048,"name":"fuzzy","url":"classes/querybuilder.html#fuzzy","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":204,"kind":2048,"name":"match","url":"classes/querybuilder.html#match","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":205,"kind":2048,"name":"matchAll","url":"classes/querybuilder.html#matchall","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":206,"kind":2048,"name":"prefix","url":"classes/querybuilder.html#prefix","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":207,"kind":2048,"name":"exists","url":"classes/querybuilder.html#exists","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":208,"kind":256,"name":"Query","url":"interfaces/query.html","classes":"tsd-kind-interface"},{"id":209,"kind":1024,"name":"query","url":"interfaces/query.html#query-1","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Query"},{"id":210,"kind":1024,"name":"final_scoring","url":"interfaces/query.html#final_scoring","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Query"},{"id":211,"kind":1024,"name":"bm25","url":"interfaces/query.html#bm25","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Query"},{"id":212,"kind":65536,"name":"__type","url":"interfaces/query.html#bm25.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"Query.bm25"},{"id":213,"kind":4194304,"name":"ScoreResult","url":"globals.html#scoreresult","classes":"tsd-kind-type-alias"},{"id":214,"kind":128,"name":"Resultset","url":"classes/resultset.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":215,"kind":1024,"name":"collection","url":"classes/resultset.html#collection","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Resultset"},{"id":216,"kind":1024,"name":"filteredrows","url":"classes/resultset.html#filteredrows","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Resultset"},{"id":217,"kind":1024,"name":"filterInitialized","url":"classes/resultset.html#filterinitialized","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Resultset"},{"id":218,"kind":512,"name":"constructor","url":"classes/resultset.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"Resultset"},{"id":219,"kind":2048,"name":"reset","url":"classes/resultset.html#reset","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":220,"kind":2048,"name":"toJSON","url":"classes/resultset.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":221,"kind":2048,"name":"limit","url":"classes/resultset.html#limit","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":222,"kind":2048,"name":"offset","url":"classes/resultset.html#offset","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":223,"kind":2048,"name":"copy","url":"classes/resultset.html#copy","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":224,"kind":2048,"name":"branch","url":"classes/resultset.html#branch","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":225,"kind":2048,"name":"transform","url":"classes/resultset.html#transform","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":226,"kind":2048,"name":"sort","url":"classes/resultset.html#sort","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":227,"kind":2048,"name":"simplesort","url":"classes/resultset.html#simplesort","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":228,"kind":2048,"name":"compoundsort","url":"classes/resultset.html#compoundsort","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":229,"kind":2048,"name":"sortByScoring","url":"classes/resultset.html#sortbyscoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":230,"kind":2048,"name":"getScoring","url":"classes/resultset.html#getscoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":231,"kind":2048,"name":"findOr","url":"classes/resultset.html#findor","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":232,"kind":2048,"name":"$or","url":"classes/resultset.html#_or","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":233,"kind":2048,"name":"findAnd","url":"classes/resultset.html#findand","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":234,"kind":2048,"name":"$and","url":"classes/resultset.html#_and","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":235,"kind":2048,"name":"find","url":"classes/resultset.html#find","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":236,"kind":2048,"name":"where","url":"classes/resultset.html#where","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":237,"kind":2048,"name":"count","url":"classes/resultset.html#count","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":238,"kind":2048,"name":"data","url":"classes/resultset.html#data","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":239,"kind":2048,"name":"update","url":"classes/resultset.html#update","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":240,"kind":2048,"name":"remove","url":"classes/resultset.html#remove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":241,"kind":2048,"name":"mapReduce","url":"classes/resultset.html#mapreduce","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Resultset"},{"id":242,"kind":2048,"name":"eqJoin","url":"classes/resultset.html#eqjoin","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Resultset"},{"id":243,"kind":2048,"name":"map","url":"classes/resultset.html#map","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Resultset"},{"id":244,"kind":256,"name":"DataOptions","url":"interfaces/resultset.dataoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Resultset"},{"id":245,"kind":1024,"name":"forceClones","url":"interfaces/resultset.dataoptions.html#forceclones","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Resultset.DataOptions"},{"id":246,"kind":1024,"name":"forceCloneMethod","url":"interfaces/resultset.dataoptions.html#forceclonemethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Resultset.DataOptions"},{"id":247,"kind":1024,"name":"removeMeta","url":"interfaces/resultset.dataoptions.html#removemeta","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Resultset.DataOptions"},{"id":248,"kind":128,"name":"DynamicView","url":"classes/dynamicview.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":249,"kind":1024,"name":"name","url":"classes/dynamicview.html#name","classes":"tsd-kind-property tsd-parent-kind-class","parent":"DynamicView"},{"id":250,"kind":512,"name":"constructor","url":"classes/dynamicview.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"DynamicView"},{"id":251,"kind":2048,"name":"_rematerialize","url":"classes/dynamicview.html#_rematerialize","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":252,"kind":2048,"name":"branchResultset","url":"classes/dynamicview.html#branchresultset","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":253,"kind":2048,"name":"toJSON","url":"classes/dynamicview.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":254,"kind":2048,"name":"fromJSONObject","url":"classes/dynamicview.html#fromjsonobject","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"DynamicView"},{"id":255,"kind":2048,"name":"removeFilters","url":"classes/dynamicview.html#removefilters","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":256,"kind":2048,"name":"applySort","url":"classes/dynamicview.html#applysort","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":257,"kind":2048,"name":"applySimpleSort","url":"classes/dynamicview.html#applysimplesort","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":258,"kind":2048,"name":"applySortCriteria","url":"classes/dynamicview.html#applysortcriteria","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":259,"kind":2048,"name":"applySortByScoring","url":"classes/dynamicview.html#applysortbyscoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":260,"kind":2048,"name":"getScoring","url":"classes/dynamicview.html#getscoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":261,"kind":2048,"name":"startTransaction","url":"classes/dynamicview.html#starttransaction","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":262,"kind":2048,"name":"commit","url":"classes/dynamicview.html#commit","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":263,"kind":2048,"name":"rollback","url":"classes/dynamicview.html#rollback","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":264,"kind":2048,"name":"reapplyFilters","url":"classes/dynamicview.html#reapplyfilters","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":265,"kind":2048,"name":"applyFilter","url":"classes/dynamicview.html#applyfilter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":266,"kind":2048,"name":"applyFind","url":"classes/dynamicview.html#applyfind","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":267,"kind":2048,"name":"applyWhere","url":"classes/dynamicview.html#applywhere","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":268,"kind":2048,"name":"removeFilter","url":"classes/dynamicview.html#removefilter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":269,"kind":2048,"name":"count","url":"classes/dynamicview.html#count","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":270,"kind":2048,"name":"data","url":"classes/dynamicview.html#data","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":271,"kind":2048,"name":"_evaluateDocument","url":"classes/dynamicview.html#_evaluatedocument","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":272,"kind":2048,"name":"_removeDocument","url":"classes/dynamicview.html#_removedocument","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":273,"kind":2048,"name":"mapReduce","url":"classes/dynamicview.html#mapreduce","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"DynamicView"},{"id":274,"kind":1024,"name":"events","url":"classes/dynamicview.html#events","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"DynamicView"},{"id":275,"kind":1024,"name":"asyncListeners","url":"classes/dynamicview.html#asynclisteners","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"DynamicView"},{"id":276,"kind":2048,"name":"on","url":"classes/dynamicview.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"DynamicView"},{"id":277,"kind":2048,"name":"emit","url":"classes/dynamicview.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"DynamicView"},{"id":278,"kind":2048,"name":"addListener","url":"classes/dynamicview.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"DynamicView"},{"id":279,"kind":2048,"name":"removeListener","url":"classes/dynamicview.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"DynamicView"},{"id":280,"kind":256,"name":"Options","url":"interfaces/dynamicview.options.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"DynamicView"},{"id":281,"kind":1024,"name":"persistent","url":"interfaces/dynamicview.options.html#persistent","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Options"},{"id":282,"kind":1024,"name":"sortPriority","url":"interfaces/dynamicview.options.html#sortpriority","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Options"},{"id":283,"kind":1024,"name":"minRebuildInterval","url":"interfaces/dynamicview.options.html#minrebuildinterval","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Options"},{"id":284,"kind":4,"name":"SortPriority","url":"enums/dynamicview.sortpriority.html","classes":"tsd-kind-enum tsd-parent-kind-class tsd-is-static","parent":"DynamicView"},{"id":285,"kind":16,"name":"PASSIVE","url":"enums/dynamicview.sortpriority.html#passive","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"DynamicView.SortPriority"},{"id":286,"kind":16,"name":"ACTIVE","url":"enums/dynamicview.sortpriority.html#active","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"DynamicView.SortPriority"},{"id":287,"kind":128,"name":"FullTextSearch","url":"classes/fulltextsearch.html","classes":"tsd-kind-class"},{"id":288,"kind":2048,"name":"register","url":"classes/fulltextsearch.html#register","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"FullTextSearch"},{"id":289,"kind":512,"name":"constructor","url":"classes/fulltextsearch.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"FullTextSearch"},{"id":290,"kind":2048,"name":"addDocument","url":"classes/fulltextsearch.html#adddocument","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":291,"kind":2048,"name":"removeDocument","url":"classes/fulltextsearch.html#removedocument","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":292,"kind":2048,"name":"updateDocument","url":"classes/fulltextsearch.html#updatedocument","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":293,"kind":2048,"name":"clear","url":"classes/fulltextsearch.html#clear","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":294,"kind":2048,"name":"search","url":"classes/fulltextsearch.html#search","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":295,"kind":2048,"name":"toJSON","url":"classes/fulltextsearch.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":296,"kind":2048,"name":"fromJSONObject","url":"classes/fulltextsearch.html#fromjsonobject","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"FullTextSearch"},{"id":297,"kind":256,"name":"FieldOptions","url":"interfaces/fulltextsearch.fieldoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"FullTextSearch"},{"id":298,"kind":1024,"name":"name","url":"interfaces/fulltextsearch.fieldoptions.html#name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FullTextSearch.FieldOptions"},{"id":299,"kind":1024,"name":"store","url":"interfaces/fulltextsearch.fieldoptions.html#store","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"FullTextSearch.FieldOptions"},{"id":300,"kind":1024,"name":"optimizeChanges","url":"interfaces/fulltextsearch.fieldoptions.html#optimizechanges","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"FullTextSearch.FieldOptions"},{"id":301,"kind":1024,"name":"tokenizer","url":"interfaces/fulltextsearch.fieldoptions.html#tokenizer","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"FullTextSearch.FieldOptions"},{"id":302,"kind":256,"name":"Serialization","url":"interfaces/fulltextsearch.serialization.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"FullTextSearch"},{"id":303,"kind":1024,"name":"id","url":"interfaces/fulltextsearch.serialization.html#id","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FullTextSearch.Serialization"},{"id":304,"kind":1024,"name":"ii","url":"interfaces/fulltextsearch.serialization.html#ii","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FullTextSearch.Serialization"},{"id":305,"kind":128,"name":"Collection","url":"classes/collection.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":306,"kind":1024,"name":"name","url":"classes/collection.html#name","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":307,"kind":1024,"name":"data","url":"classes/collection.html#data","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":308,"kind":1024,"name":"binaryIndices","url":"classes/collection.html#binaryindices","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":309,"kind":2097152,"name":"constraints","url":"classes/collection.html#constraints","classes":"tsd-kind-object-literal tsd-parent-kind-class","parent":"Collection"},{"id":310,"kind":32,"name":"unique","url":"classes/collection.html#constraints.unique","classes":"tsd-kind-variable tsd-parent-kind-object-literal","parent":"Collection.constraints"},{"id":311,"kind":65536,"name":"__type","url":"classes/collection.html#constraints.unique.__type","classes":"tsd-kind-type-literal tsd-parent-kind-variable tsd-is-not-exported","parent":"Collection.constraints.unique"},{"id":312,"kind":1024,"name":"transforms","url":"classes/collection.html#transforms","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":313,"kind":1024,"name":"dirty","url":"classes/collection.html#dirty","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":314,"kind":1024,"name":"adaptiveBinaryIndices","url":"classes/collection.html#adaptivebinaryindices","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":315,"kind":1024,"name":"cloneObjects","url":"classes/collection.html#cloneobjects","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":316,"kind":1024,"name":"cloneMethod","url":"classes/collection.html#clonemethod","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":317,"kind":1024,"name":"disableDeltaChangesApi","url":"classes/collection.html#disabledeltachangesapi","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":318,"kind":1024,"name":"ttl","url":"classes/collection.html#ttl","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":319,"kind":1024,"name":"console","url":"classes/collection.html#console","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":320,"kind":1024,"name":"_fullTextSearch","url":"classes/collection.html#_fulltextsearch","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":321,"kind":512,"name":"constructor","url":"classes/collection.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"Collection"},{"id":322,"kind":2048,"name":"toJSON","url":"classes/collection.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":323,"kind":2048,"name":"fromJSONObject","url":"classes/collection.html#fromjsonobject","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"Collection"},{"id":324,"kind":2048,"name":"addTransform","url":"classes/collection.html#addtransform","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":325,"kind":2048,"name":"getTransform","url":"classes/collection.html#gettransform","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":326,"kind":2048,"name":"setTransform","url":"classes/collection.html#settransform","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":327,"kind":2048,"name":"removeTransform","url":"classes/collection.html#removetransform","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":328,"kind":2048,"name":"ttlDaemonFuncGen","url":"classes/collection.html#ttldaemonfuncgen","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":329,"kind":2048,"name":"prepareFullDocIndex","url":"classes/collection.html#preparefulldocindex","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":330,"kind":2048,"name":"ensureIndex","url":"classes/collection.html#ensureindex","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":331,"kind":2048,"name":"getSequencedIndexValues","url":"classes/collection.html#getsequencedindexvalues","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":332,"kind":2048,"name":"ensureUniqueIndex","url":"classes/collection.html#ensureuniqueindex","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":333,"kind":2048,"name":"ensureAllIndexes","url":"classes/collection.html#ensureallindexes","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":334,"kind":2048,"name":"flagBinaryIndexesDirty","url":"classes/collection.html#flagbinaryindexesdirty","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":335,"kind":2048,"name":"flagBinaryIndexDirty","url":"classes/collection.html#flagbinaryindexdirty","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":336,"kind":2048,"name":"count","url":"classes/collection.html#count","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":337,"kind":2048,"name":"ensureId","url":"classes/collection.html#ensureid","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":338,"kind":2048,"name":"addDynamicView","url":"classes/collection.html#adddynamicview","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":339,"kind":2048,"name":"removeDynamicView","url":"classes/collection.html#removedynamicview","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":340,"kind":2048,"name":"getDynamicView","url":"classes/collection.html#getdynamicview","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":341,"kind":2048,"name":"findAndUpdate","url":"classes/collection.html#findandupdate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":342,"kind":2048,"name":"findAndRemove","url":"classes/collection.html#findandremove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":343,"kind":2048,"name":"insert","url":"classes/collection.html#insert","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":344,"kind":2048,"name":"insertOne","url":"classes/collection.html#insertone","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":345,"kind":2048,"name":"clear","url":"classes/collection.html#clear","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":346,"kind":2048,"name":"update","url":"classes/collection.html#update","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":347,"kind":2048,"name":"updateWhere","url":"classes/collection.html#updatewhere","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":348,"kind":2048,"name":"removeWhere","url":"classes/collection.html#removewhere","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":349,"kind":2048,"name":"removeDataOnly","url":"classes/collection.html#removedataonly","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":350,"kind":2048,"name":"remove","url":"classes/collection.html#remove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":351,"kind":2048,"name":"getChanges","url":"classes/collection.html#getchanges","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":352,"kind":2048,"name":"setChangesApi","url":"classes/collection.html#setchangesapi","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":353,"kind":2048,"name":"flushChanges","url":"classes/collection.html#flushchanges","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":354,"kind":2048,"name":"get","url":"classes/collection.html#get","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":355,"kind":2048,"name":"getBinaryIndexPosition","url":"classes/collection.html#getbinaryindexposition","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":356,"kind":2048,"name":"adaptiveBinaryIndexInsert","url":"classes/collection.html#adaptivebinaryindexinsert","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":357,"kind":2048,"name":"adaptiveBinaryIndexUpdate","url":"classes/collection.html#adaptivebinaryindexupdate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":358,"kind":2048,"name":"adaptiveBinaryIndexRemove","url":"classes/collection.html#adaptivebinaryindexremove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":359,"kind":2048,"name":"calculateRange","url":"classes/collection.html#calculaterange","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":360,"kind":2048,"name":"by","url":"classes/collection.html#by","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":361,"kind":2048,"name":"findOne","url":"classes/collection.html#findone","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":362,"kind":2048,"name":"chain","url":"classes/collection.html#chain","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":363,"kind":2048,"name":"find","url":"classes/collection.html#find","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":364,"kind":2048,"name":"findOneUnindexed","url":"classes/collection.html#findoneunindexed","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":365,"kind":2048,"name":"startTransaction","url":"classes/collection.html#starttransaction","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":366,"kind":2048,"name":"commit","url":"classes/collection.html#commit","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":367,"kind":2048,"name":"rollback","url":"classes/collection.html#rollback","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":368,"kind":2048,"name":"where","url":"classes/collection.html#where","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":369,"kind":2048,"name":"mapReduce","url":"classes/collection.html#mapreduce","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Collection"},{"id":370,"kind":2048,"name":"eqJoin","url":"classes/collection.html#eqjoin","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":371,"kind":2048,"name":"getStage","url":"classes/collection.html#getstage","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":372,"kind":2048,"name":"stage","url":"classes/collection.html#stage","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":373,"kind":2048,"name":"commitStage","url":"classes/collection.html#commitstage","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":374,"kind":2048,"name":"extract","url":"classes/collection.html#extract","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":375,"kind":2048,"name":"max","url":"classes/collection.html#max","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":376,"kind":2048,"name":"min","url":"classes/collection.html#min","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":377,"kind":2048,"name":"maxRecord","url":"classes/collection.html#maxrecord","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":378,"kind":2048,"name":"minRecord","url":"classes/collection.html#minrecord","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":379,"kind":2048,"name":"extractNumerical","url":"classes/collection.html#extractnumerical","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":380,"kind":2048,"name":"avg","url":"classes/collection.html#avg","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":381,"kind":2048,"name":"stdDev","url":"classes/collection.html#stddev","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":382,"kind":2048,"name":"mode","url":"classes/collection.html#mode","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":383,"kind":2048,"name":"median","url":"classes/collection.html#median","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":384,"kind":1024,"name":"events","url":"classes/collection.html#events","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"Collection"},{"id":385,"kind":1024,"name":"asyncListeners","url":"classes/collection.html#asynclisteners","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"Collection"},{"id":386,"kind":2048,"name":"on","url":"classes/collection.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Collection"},{"id":387,"kind":2048,"name":"emit","url":"classes/collection.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Collection"},{"id":388,"kind":2048,"name":"addListener","url":"classes/collection.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Collection"},{"id":389,"kind":2048,"name":"removeListener","url":"classes/collection.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Collection"},{"id":390,"kind":256,"name":"Options","url":"interfaces/collection.options.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Collection"},{"id":391,"kind":1024,"name":"unique","url":"interfaces/collection.options.html#unique","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":392,"kind":1024,"name":"indices","url":"interfaces/collection.options.html#indices","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":393,"kind":1024,"name":"adaptiveBinaryIndices","url":"interfaces/collection.options.html#adaptivebinaryindices","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":394,"kind":1024,"name":"asyncListeners","url":"interfaces/collection.options.html#asynclisteners","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":395,"kind":1024,"name":"disableChangesApi","url":"interfaces/collection.options.html#disablechangesapi","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":396,"kind":1024,"name":"disableDeltaChangesApi","url":"interfaces/collection.options.html#disabledeltachangesapi","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":397,"kind":1024,"name":"clone","url":"interfaces/collection.options.html#clone","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":398,"kind":1024,"name":"serializableIndices","url":"interfaces/collection.options.html#serializableindices","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":399,"kind":1024,"name":"cloneMethod","url":"interfaces/collection.options.html#clonemethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":400,"kind":1024,"name":"transactional","url":"interfaces/collection.options.html#transactional","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":401,"kind":1024,"name":"ttl","url":"interfaces/collection.options.html#ttl","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":402,"kind":1024,"name":"ttlInterval","url":"interfaces/collection.options.html#ttlinterval","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":403,"kind":1024,"name":"fullTextSearch","url":"interfaces/collection.options.html#fulltextsearch","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":404,"kind":256,"name":"DeserializeOptions","url":"interfaces/collection.deserializeoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Collection"},{"id":405,"kind":1024,"name":"retainDirtyFlags","url":"interfaces/collection.deserializeoptions.html#retaindirtyflags","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.DeserializeOptions"},{"id":406,"kind":1024,"name":"fullTextSearch","url":"interfaces/collection.deserializeoptions.html#fulltextsearch","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.DeserializeOptions"},{"id":407,"kind":256,"name":"BinaryIndex","url":"interfaces/collection.binaryindex.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Collection"},{"id":408,"kind":1024,"name":"dirty","url":"interfaces/collection.binaryindex.html#dirty","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.BinaryIndex"},{"id":409,"kind":1024,"name":"values","url":"interfaces/collection.binaryindex.html#values","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.BinaryIndex"},{"id":410,"kind":4194304,"name":"Change","url":"classes/collection.html#change","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Collection"},{"id":411,"kind":128,"name":"Loki","url":"classes/loki.html","classes":"tsd-kind-class"},{"id":412,"kind":512,"name":"constructor","url":"classes/loki.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"Loki"},{"id":413,"kind":2048,"name":"initializePersistence","url":"classes/loki.html#initializepersistence","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":414,"kind":2048,"name":"copy","url":"classes/loki.html#copy","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":415,"kind":2048,"name":"addCollection","url":"classes/loki.html#addcollection","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Loki"},{"id":416,"kind":2048,"name":"loadCollection","url":"classes/loki.html#loadcollection","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":417,"kind":2048,"name":"getCollection","url":"classes/loki.html#getcollection","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Loki"},{"id":418,"kind":2048,"name":"renameCollection","url":"classes/loki.html#renamecollection","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":419,"kind":2048,"name":"listCollections","url":"classes/loki.html#listcollections","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":420,"kind":2048,"name":"removeCollection","url":"classes/loki.html#removecollection","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":421,"kind":2048,"name":"getName","url":"classes/loki.html#getname","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":422,"kind":2048,"name":"serialize","url":"classes/loki.html#serialize","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":423,"kind":2048,"name":"toJSON","url":"classes/loki.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":424,"kind":2048,"name":"serializeDestructured","url":"classes/loki.html#serializedestructured","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":425,"kind":2048,"name":"serializeCollection","url":"classes/loki.html#serializecollection","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":426,"kind":2048,"name":"deserializeDestructured","url":"classes/loki.html#deserializedestructured","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":427,"kind":2048,"name":"deserializeCollection","url":"classes/loki.html#deserializecollection","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Loki"},{"id":428,"kind":2048,"name":"loadJSON","url":"classes/loki.html#loadjson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":429,"kind":2048,"name":"loadJSONObject","url":"classes/loki.html#loadjsonobject","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":430,"kind":2048,"name":"close","url":"classes/loki.html#close","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":431,"kind":2048,"name":"generateChangesNotification","url":"classes/loki.html#generatechangesnotification","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":432,"kind":2048,"name":"serializeChanges","url":"classes/loki.html#serializechanges","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":433,"kind":2048,"name":"clearChanges","url":"classes/loki.html#clearchanges","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":434,"kind":2048,"name":"throttledSaveDrain","url":"classes/loki.html#throttledsavedrain","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":435,"kind":2048,"name":"loadDatabase","url":"classes/loki.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":436,"kind":2048,"name":"saveDatabase","url":"classes/loki.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":437,"kind":2048,"name":"deleteDatabase","url":"classes/loki.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":438,"kind":2048,"name":"autosaveEnable","url":"classes/loki.html#autosaveenable","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":439,"kind":2048,"name":"autosaveDisable","url":"classes/loki.html#autosavedisable","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":440,"kind":1024,"name":"events","url":"classes/loki.html#events","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"Loki"},{"id":441,"kind":1024,"name":"asyncListeners","url":"classes/loki.html#asynclisteners","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"Loki"},{"id":442,"kind":2048,"name":"on","url":"classes/loki.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Loki"},{"id":443,"kind":2048,"name":"emit","url":"classes/loki.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Loki"},{"id":444,"kind":2048,"name":"addListener","url":"classes/loki.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Loki"},{"id":445,"kind":2048,"name":"removeListener","url":"classes/loki.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Loki"},{"id":446,"kind":256,"name":"Options","url":"interfaces/loki.options.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":447,"kind":1024,"name":"env","url":"interfaces/loki.options.html#env","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Options"},{"id":448,"kind":1024,"name":"serializationMethod","url":"interfaces/loki.options.html#serializationmethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Options"},{"id":449,"kind":1024,"name":"destructureDelimiter","url":"interfaces/loki.options.html#destructuredelimiter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Options"},{"id":450,"kind":1024,"name":"verbose","url":"interfaces/loki.options.html#verbose","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Options"},{"id":451,"kind":256,"name":"PersistenceOptions","url":"interfaces/loki.persistenceoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":452,"kind":1024,"name":"adapter","url":"interfaces/loki.persistenceoptions.html#adapter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":453,"kind":1024,"name":"autosave","url":"interfaces/loki.persistenceoptions.html#autosave","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":454,"kind":1024,"name":"autosaveInterval","url":"interfaces/loki.persistenceoptions.html#autosaveinterval","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":455,"kind":1024,"name":"autoload","url":"interfaces/loki.persistenceoptions.html#autoload","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":456,"kind":1024,"name":"throttledSaves","url":"interfaces/loki.persistenceoptions.html#throttledsaves","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":457,"kind":1024,"name":"persistenceMethod","url":"interfaces/loki.persistenceoptions.html#persistencemethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":458,"kind":1024,"name":"inflate","url":"interfaces/loki.persistenceoptions.html#inflate","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":459,"kind":256,"name":"CopyOptions","url":"interfaces/loki.copyoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":460,"kind":1024,"name":"removeNonSerializable","url":"interfaces/loki.copyoptions.html#removenonserializable","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.CopyOptions"},{"id":461,"kind":256,"name":"SerializeOptions","url":"interfaces/loki.serializeoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":462,"kind":1024,"name":"serializationMethod","url":"interfaces/loki.serializeoptions.html#serializationmethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.SerializeOptions"},{"id":463,"kind":256,"name":"SerializeDestructuredOptions","url":"interfaces/loki.serializedestructuredoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":464,"kind":1024,"name":"partitioned","url":"interfaces/loki.serializedestructuredoptions.html#partitioned","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.SerializeDestructuredOptions"},{"id":465,"kind":1024,"name":"partition","url":"interfaces/loki.serializedestructuredoptions.html#partition","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.SerializeDestructuredOptions"},{"id":466,"kind":1024,"name":"delimited","url":"interfaces/loki.serializedestructuredoptions.html#delimited","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.SerializeDestructuredOptions"},{"id":467,"kind":1024,"name":"delimiter","url":"interfaces/loki.serializedestructuredoptions.html#delimiter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.SerializeDestructuredOptions"},{"id":468,"kind":256,"name":"DeserializeCollectionOptions","url":"interfaces/loki.deserializecollectionoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":469,"kind":1024,"name":"partitioned","url":"interfaces/loki.deserializecollectionoptions.html#partitioned","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.DeserializeCollectionOptions"},{"id":470,"kind":1024,"name":"delimited","url":"interfaces/loki.deserializecollectionoptions.html#delimited","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.DeserializeCollectionOptions"},{"id":471,"kind":1024,"name":"delimiter","url":"interfaces/loki.deserializecollectionoptions.html#delimiter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.DeserializeCollectionOptions"},{"id":472,"kind":256,"name":"ThrottledDrainOptions","url":"interfaces/loki.throttleddrainoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":473,"kind":1024,"name":"recursiveWait","url":"interfaces/loki.throttleddrainoptions.html#recursivewait","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.ThrottledDrainOptions"},{"id":474,"kind":1024,"name":"recursiveWaitLimit","url":"interfaces/loki.throttleddrainoptions.html#recursivewaitlimit","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.ThrottledDrainOptions"},{"id":475,"kind":1024,"name":"recursiveWaitLimitDuration","url":"interfaces/loki.throttleddrainoptions.html#recursivewaitlimitduration","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.ThrottledDrainOptions"},{"id":476,"kind":1024,"name":"started","url":"interfaces/loki.throttleddrainoptions.html#started","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.ThrottledDrainOptions"},{"id":477,"kind":4,"name":"SerializationMethod","url":"enums/loki.serializationmethod.html","classes":"tsd-kind-enum tsd-parent-kind-class tsd-is-static","parent":"Loki"},{"id":478,"kind":16,"name":"NORMAL","url":"enums/loki.serializationmethod.html#normal","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.SerializationMethod"},{"id":479,"kind":16,"name":"PRETTY","url":"enums/loki.serializationmethod.html#pretty","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.SerializationMethod"},{"id":480,"kind":16,"name":"DESTRUCTURED","url":"enums/loki.serializationmethod.html#destructured","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.SerializationMethod"},{"id":481,"kind":4,"name":"PersistenceMethod","url":"enums/loki.persistencemethod.html","classes":"tsd-kind-enum tsd-parent-kind-class tsd-is-static","parent":"Loki"},{"id":482,"kind":16,"name":"FS_STORAGE","url":"enums/loki.persistencemethod.html#fs_storage","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.PersistenceMethod"},{"id":483,"kind":16,"name":"LOCAL_STORAGE","url":"enums/loki.persistencemethod.html#local_storage","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.PersistenceMethod"},{"id":484,"kind":16,"name":"INDEXED_STORAGE","url":"enums/loki.persistencemethod.html#indexed_storage","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.PersistenceMethod"},{"id":485,"kind":16,"name":"MEMORY_STORAGE","url":"enums/loki.persistencemethod.html#memory_storage","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.PersistenceMethod"},{"id":486,"kind":16,"name":"ADAPTER","url":"enums/loki.persistencemethod.html#adapter","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.PersistenceMethod"},{"id":487,"kind":4,"name":"Environment","url":"enums/loki.environment.html","classes":"tsd-kind-enum tsd-parent-kind-class tsd-is-static","parent":"Loki"},{"id":488,"kind":16,"name":"NODE_JS","url":"enums/loki.environment.html#node_js","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.Environment"},{"id":489,"kind":16,"name":"NATIVE_SCRIPT","url":"enums/loki.environment.html#native_script","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.Environment"},{"id":490,"kind":16,"name":"BROWSER","url":"enums/loki.environment.html#browser","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.Environment"},{"id":491,"kind":16,"name":"CORDOVA","url":"enums/loki.environment.html#cordova","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.Environment"},{"id":492,"kind":16,"name":"MEMORY","url":"enums/loki.environment.html#memory","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Loki.Environment"},{"id":493,"kind":4194304,"name":"LoadDatabaseOptions","url":"classes/loki.html#loaddatabaseoptions","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Loki"},{"id":494,"kind":256,"name":"StorageAdapter","url":"interfaces/storageadapter.html","classes":"tsd-kind-interface"},{"id":495,"kind":2048,"name":"loadDatabase","url":"interfaces/storageadapter.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"StorageAdapter"},{"id":496,"kind":2048,"name":"saveDatabase","url":"interfaces/storageadapter.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"StorageAdapter"},{"id":497,"kind":2048,"name":"deleteDatabase","url":"interfaces/storageadapter.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"StorageAdapter"},{"id":498,"kind":1024,"name":"mode","url":"interfaces/storageadapter.html#mode","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"StorageAdapter"},{"id":499,"kind":2048,"name":"exportDatabase","url":"interfaces/storageadapter.html#exportdatabase","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"StorageAdapter"},{"id":500,"kind":256,"name":"Dict","url":"interfaces/dict.html","classes":"tsd-kind-interface tsd-has-type-parameter"},{"id":501,"kind":256,"name":"Filter","url":"interfaces/filter.html","classes":"tsd-kind-interface tsd-has-type-parameter"},{"id":502,"kind":1024,"name":"type","url":"interfaces/filter.html#type","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Filter"},{"id":503,"kind":1024,"name":"val","url":"interfaces/filter.html#val","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Filter"},{"id":504,"kind":1024,"name":"uid","url":"interfaces/filter.html#uid","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Filter"},{"id":505,"kind":4194304,"name":"Doc","url":"globals.html#doc","classes":"tsd-kind-type-alias"},{"id":506,"kind":128,"name":"LokiFSStorage","url":"classes/lokifsstorage.html","classes":"tsd-kind-class"},{"id":507,"kind":2048,"name":"register","url":"classes/lokifsstorage.html#register","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"LokiFSStorage"},{"id":508,"kind":2048,"name":"deregister","url":"classes/lokifsstorage.html#deregister","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"LokiFSStorage"},{"id":509,"kind":2048,"name":"loadDatabase","url":"classes/lokifsstorage.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiFSStorage"},{"id":510,"kind":2048,"name":"saveDatabase","url":"classes/lokifsstorage.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiFSStorage"},{"id":511,"kind":2048,"name":"deleteDatabase","url":"classes/lokifsstorage.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiFSStorage"},{"id":512,"kind":128,"name":"Among","url":"classes/among.html","classes":"tsd-kind-class"},{"id":513,"kind":1024,"name":"s_size","url":"classes/among.html#s_size","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Among"},{"id":514,"kind":1024,"name":"s","url":"classes/among.html#s","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Among"},{"id":515,"kind":1024,"name":"substring_i","url":"classes/among.html#substring_i","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Among"},{"id":516,"kind":1024,"name":"result","url":"classes/among.html#result","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Among"},{"id":517,"kind":1024,"name":"method","url":"classes/among.html#method","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Among"},{"id":518,"kind":512,"name":"constructor","url":"classes/among.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"Among"},{"id":519,"kind":128,"name":"SnowballProgram","url":"classes/snowballprogram.html","classes":"tsd-kind-class"},{"id":520,"kind":1024,"name":"current","url":"classes/snowballprogram.html#current","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":521,"kind":1024,"name":"bra","url":"classes/snowballprogram.html#bra","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":522,"kind":1024,"name":"ket","url":"classes/snowballprogram.html#ket","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":523,"kind":1024,"name":"limit","url":"classes/snowballprogram.html#limit","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":524,"kind":1024,"name":"cursor","url":"classes/snowballprogram.html#cursor","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":525,"kind":1024,"name":"limit_backward","url":"classes/snowballprogram.html#limit_backward","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":526,"kind":512,"name":"constructor","url":"classes/snowballprogram.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"SnowballProgram"},{"id":527,"kind":2048,"name":"setCurrent","url":"classes/snowballprogram.html#setcurrent","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":528,"kind":2048,"name":"getCurrent","url":"classes/snowballprogram.html#getcurrent","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":529,"kind":2048,"name":"in_grouping","url":"classes/snowballprogram.html#in_grouping","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":530,"kind":2048,"name":"in_grouping_b","url":"classes/snowballprogram.html#in_grouping_b","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":531,"kind":2048,"name":"out_grouping","url":"classes/snowballprogram.html#out_grouping","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":532,"kind":2048,"name":"out_grouping_b","url":"classes/snowballprogram.html#out_grouping_b","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":533,"kind":2048,"name":"eq_s","url":"classes/snowballprogram.html#eq_s","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":534,"kind":2048,"name":"eq_s_b","url":"classes/snowballprogram.html#eq_s_b","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":535,"kind":2048,"name":"find_among","url":"classes/snowballprogram.html#find_among","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":536,"kind":2048,"name":"find_among_b","url":"classes/snowballprogram.html#find_among_b","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":537,"kind":2048,"name":"replace_s","url":"classes/snowballprogram.html#replace_s","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":538,"kind":2048,"name":"slice_check","url":"classes/snowballprogram.html#slice_check","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":539,"kind":2048,"name":"slice_from","url":"classes/snowballprogram.html#slice_from","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":540,"kind":2048,"name":"slice_del","url":"classes/snowballprogram.html#slice_del","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":541,"kind":2048,"name":"insert","url":"classes/snowballprogram.html#insert","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":542,"kind":2048,"name":"slice_to","url":"classes/snowballprogram.html#slice_to","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":543,"kind":2048,"name":"eq_v_b","url":"classes/snowballprogram.html#eq_v_b","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":544,"kind":64,"name":"generateTrimmer","url":"globals.html#generatetrimmer","classes":"tsd-kind-function"},{"id":545,"kind":64,"name":"generateStopWordFilter","url":"globals.html#generatestopwordfilter","classes":"tsd-kind-function"},{"id":546,"kind":32,"name":"DE","url":"globals.html#de","classes":"tsd-kind-variable"},{"id":547,"kind":32,"name":"EN","url":"globals.html#en","classes":"tsd-kind-variable"},{"id":548,"kind":128,"name":"LokiIndexedStorage","url":"classes/lokiindexedstorage.html","classes":"tsd-kind-class"},{"id":549,"kind":2048,"name":"register","url":"classes/lokiindexedstorage.html#register","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"LokiIndexedStorage"},{"id":550,"kind":2048,"name":"deregister","url":"classes/lokiindexedstorage.html#deregister","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"LokiIndexedStorage"},{"id":551,"kind":512,"name":"constructor","url":"classes/lokiindexedstorage.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"LokiIndexedStorage"},{"id":552,"kind":2048,"name":"loadDatabase","url":"classes/lokiindexedstorage.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiIndexedStorage"},{"id":553,"kind":2048,"name":"saveDatabase","url":"classes/lokiindexedstorage.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiIndexedStorage"},{"id":554,"kind":2048,"name":"deleteDatabase","url":"classes/lokiindexedstorage.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiIndexedStorage"},{"id":555,"kind":2048,"name":"deleteDatabasePartitions","url":"classes/lokiindexedstorage.html#deletedatabasepartitions","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiIndexedStorage"},{"id":556,"kind":2048,"name":"getDatabaseList","url":"classes/lokiindexedstorage.html#getdatabaselist","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiIndexedStorage"},{"id":557,"kind":2048,"name":"getCatalogSummary","url":"classes/lokiindexedstorage.html#getcatalogsummary","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiIndexedStorage"},{"id":558,"kind":256,"name":"Entry","url":"interfaces/entry.html","classes":"tsd-kind-interface"},{"id":559,"kind":1024,"name":"app","url":"interfaces/entry.html#app","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Entry"},{"id":560,"kind":1024,"name":"key","url":"interfaces/entry.html#key","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Entry"},{"id":561,"kind":1024,"name":"size","url":"interfaces/entry.html#size","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Entry"},{"id":562,"kind":128,"name":"LokiLocalStorage","url":"classes/lokilocalstorage.html","classes":"tsd-kind-class"},{"id":563,"kind":2048,"name":"register","url":"classes/lokilocalstorage.html#register","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"LokiLocalStorage"},{"id":564,"kind":2048,"name":"deregister","url":"classes/lokilocalstorage.html#deregister","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"LokiLocalStorage"},{"id":565,"kind":2048,"name":"loadDatabase","url":"classes/lokilocalstorage.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiLocalStorage"},{"id":566,"kind":2048,"name":"saveDatabase","url":"classes/lokilocalstorage.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiLocalStorage"},{"id":567,"kind":2048,"name":"deleteDatabase","url":"classes/lokilocalstorage.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiLocalStorage"},{"id":568,"kind":128,"name":"LokiMemoryAdapter","url":"classes/lokimemoryadapter.html","classes":"tsd-kind-class"},{"id":569,"kind":512,"name":"constructor","url":"classes/lokimemoryadapter.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"LokiMemoryAdapter"},{"id":570,"kind":2048,"name":"loadDatabase","url":"classes/lokimemoryadapter.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiMemoryAdapter"},{"id":571,"kind":2048,"name":"saveDatabase","url":"classes/lokimemoryadapter.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiMemoryAdapter"},{"id":572,"kind":2048,"name":"deleteDatabase","url":"classes/lokimemoryadapter.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiMemoryAdapter"},{"id":573,"kind":128,"name":"LokiPartitioningAdapter","url":"classes/lokipartitioningadapter.html","classes":"tsd-kind-class"},{"id":574,"kind":1024,"name":"mode","url":"classes/lokipartitioningadapter.html#mode","classes":"tsd-kind-property tsd-parent-kind-class","parent":"LokiPartitioningAdapter"},{"id":575,"kind":2048,"name":"register","url":"classes/lokipartitioningadapter.html#register","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"LokiPartitioningAdapter"},{"id":576,"kind":2048,"name":"deregister","url":"classes/lokipartitioningadapter.html#deregister","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"LokiPartitioningAdapter"},{"id":577,"kind":512,"name":"constructor","url":"classes/lokipartitioningadapter.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"LokiPartitioningAdapter"},{"id":578,"kind":2048,"name":"loadDatabase","url":"classes/lokipartitioningadapter.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiPartitioningAdapter"},{"id":579,"kind":2048,"name":"exportDatabase","url":"classes/lokipartitioningadapter.html#exportdatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiPartitioningAdapter"}]}; \ No newline at end of file + typedoc.search.data = {"kinds":{"32":"Variable","64":"Function","128":"Class","256":"Interface","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":128,"name":"LokiEventEmitter","url":"classes/lokieventemitter.html","classes":"tsd-kind-class"},{"id":1,"kind":1024,"name":"events","url":"classes/lokieventemitter.html#events","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"LokiEventEmitter"},{"id":2,"kind":1024,"name":"asyncListeners","url":"classes/lokieventemitter.html#asynclisteners","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"LokiEventEmitter"},{"id":3,"kind":512,"name":"constructor","url":"classes/lokieventemitter.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"LokiEventEmitter"},{"id":4,"kind":2048,"name":"on","url":"classes/lokieventemitter.html#on","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiEventEmitter"},{"id":5,"kind":2048,"name":"emit","url":"classes/lokieventemitter.html#emit","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiEventEmitter"},{"id":6,"kind":2048,"name":"addListener","url":"classes/lokieventemitter.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiEventEmitter"},{"id":7,"kind":2048,"name":"removeListener","url":"classes/lokieventemitter.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LokiEventEmitter"},{"id":8,"kind":128,"name":"UniqueIndex","url":"classes/uniqueindex.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":9,"kind":512,"name":"constructor","url":"classes/uniqueindex.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"UniqueIndex"},{"id":10,"kind":2048,"name":"set","url":"classes/uniqueindex.html#set","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UniqueIndex"},{"id":11,"kind":2048,"name":"get","url":"classes/uniqueindex.html#get","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UniqueIndex"},{"id":12,"kind":2048,"name":"update","url":"classes/uniqueindex.html#update","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UniqueIndex"},{"id":13,"kind":2048,"name":"remove","url":"classes/uniqueindex.html#remove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UniqueIndex"},{"id":14,"kind":2048,"name":"clear","url":"classes/uniqueindex.html#clear","classes":"tsd-kind-method tsd-parent-kind-class","parent":"UniqueIndex"},{"id":15,"kind":4194304,"name":"CloneMethod","url":"globals.html#clonemethod","classes":"tsd-kind-type-alias"},{"id":16,"kind":128,"name":"Tokenizer","url":"classes/tokenizer.html","classes":"tsd-kind-class"},{"id":17,"kind":512,"name":"constructor","url":"classes/tokenizer.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"Tokenizer"},{"id":18,"kind":2048,"name":"setSplitter","url":"classes/tokenizer.html#setsplitter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":19,"kind":2048,"name":"getSplitter","url":"classes/tokenizer.html#getsplitter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":20,"kind":2048,"name":"resetSplitter","url":"classes/tokenizer.html#resetsplitter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":21,"kind":2048,"name":"has","url":"classes/tokenizer.html#has","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":22,"kind":2048,"name":"get","url":"classes/tokenizer.html#get","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":23,"kind":2048,"name":"add","url":"classes/tokenizer.html#add","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":24,"kind":2048,"name":"addBefore","url":"classes/tokenizer.html#addbefore","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":25,"kind":2048,"name":"addAfter","url":"classes/tokenizer.html#addafter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":26,"kind":2048,"name":"remove","url":"classes/tokenizer.html#remove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":27,"kind":2048,"name":"reset","url":"classes/tokenizer.html#reset","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":28,"kind":2048,"name":"tokenize","url":"classes/tokenizer.html#tokenize","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":29,"kind":2048,"name":"toJSON","url":"classes/tokenizer.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Tokenizer"},{"id":30,"kind":2048,"name":"fromJSONObject","url":"classes/tokenizer.html#fromjsonobject","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"Tokenizer"},{"id":31,"kind":256,"name":"Serialization","url":"interfaces/tokenizer.serialization.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Tokenizer"},{"id":32,"kind":1024,"name":"splitter","url":"interfaces/tokenizer.serialization.html#splitter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Tokenizer.Serialization"},{"id":33,"kind":1024,"name":"tokenizers","url":"interfaces/tokenizer.serialization.html#tokenizers","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Tokenizer.Serialization"},{"id":34,"kind":4194304,"name":"SplitterFunction","url":"classes/tokenizer.html#splitterfunction","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Tokenizer"},{"id":35,"kind":65536,"name":"__type","url":"classes/tokenizer.html#splitterfunction.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"Tokenizer.SplitterFunction"},{"id":36,"kind":4194304,"name":"TokinizeFunction","url":"classes/tokenizer.html#tokinizefunction","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Tokenizer"},{"id":37,"kind":65536,"name":"__type","url":"classes/tokenizer.html#tokinizefunction.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"Tokenizer.TokinizeFunction"},{"id":38,"kind":4194304,"name":"FunctionSerialization","url":"classes/tokenizer.html#functionserialization","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Tokenizer"},{"id":39,"kind":128,"name":"BaseQueryBuilder","url":"classes/basequerybuilder.html","classes":"tsd-kind-class"},{"id":40,"kind":1024,"name":"_data","url":"classes/basequerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"BaseQueryBuilder"},{"id":41,"kind":512,"name":"constructor","url":"classes/basequerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"BaseQueryBuilder"},{"id":42,"kind":2048,"name":"boost","url":"classes/basequerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BaseQueryBuilder"},{"id":43,"kind":2048,"name":"build","url":"classes/basequerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BaseQueryBuilder"},{"id":44,"kind":256,"name":"BaseQuery","url":"interfaces/basequery.html","classes":"tsd-kind-interface tsd-has-type-parameter"},{"id":45,"kind":1024,"name":"type","url":"interfaces/basequery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BaseQuery"},{"id":46,"kind":1024,"name":"boost","url":"interfaces/basequery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BaseQuery"},{"id":47,"kind":128,"name":"TermQueryBuilder","url":"classes/termquerybuilder.html","classes":"tsd-kind-class"},{"id":48,"kind":512,"name":"constructor","url":"classes/termquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"TermQueryBuilder"},{"id":49,"kind":1024,"name":"_data","url":"classes/termquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"TermQueryBuilder"},{"id":50,"kind":2048,"name":"boost","url":"classes/termquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TermQueryBuilder"},{"id":51,"kind":2048,"name":"build","url":"classes/termquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TermQueryBuilder"},{"id":52,"kind":256,"name":"TermQuery","url":"interfaces/termquery.html","classes":"tsd-kind-interface"},{"id":53,"kind":1024,"name":"field","url":"interfaces/termquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TermQuery"},{"id":54,"kind":1024,"name":"value","url":"interfaces/termquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TermQuery"},{"id":55,"kind":1024,"name":"type","url":"interfaces/termquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"TermQuery"},{"id":56,"kind":1024,"name":"boost","url":"interfaces/termquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"TermQuery"},{"id":57,"kind":128,"name":"TermsQueryBuilder","url":"classes/termsquerybuilder.html","classes":"tsd-kind-class"},{"id":58,"kind":512,"name":"constructor","url":"classes/termsquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"TermsQueryBuilder"},{"id":59,"kind":1024,"name":"_data","url":"classes/termsquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"TermsQueryBuilder"},{"id":60,"kind":2048,"name":"boost","url":"classes/termsquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TermsQueryBuilder"},{"id":61,"kind":2048,"name":"build","url":"classes/termsquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"TermsQueryBuilder"},{"id":62,"kind":256,"name":"TermsQuery","url":"interfaces/termsquery.html","classes":"tsd-kind-interface"},{"id":63,"kind":1024,"name":"field","url":"interfaces/termsquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TermsQuery"},{"id":64,"kind":1024,"name":"value","url":"interfaces/termsquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"TermsQuery"},{"id":65,"kind":1024,"name":"type","url":"interfaces/termsquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"TermsQuery"},{"id":66,"kind":1024,"name":"boost","url":"interfaces/termsquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"TermsQuery"},{"id":67,"kind":128,"name":"WildcardQueryBuilder","url":"classes/wildcardquerybuilder.html","classes":"tsd-kind-class"},{"id":68,"kind":512,"name":"constructor","url":"classes/wildcardquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"WildcardQueryBuilder"},{"id":69,"kind":2048,"name":"enableScoring","url":"classes/wildcardquerybuilder.html#enablescoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"WildcardQueryBuilder"},{"id":70,"kind":1024,"name":"_data","url":"classes/wildcardquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"WildcardQueryBuilder"},{"id":71,"kind":2048,"name":"boost","url":"classes/wildcardquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"WildcardQueryBuilder"},{"id":72,"kind":2048,"name":"build","url":"classes/wildcardquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"WildcardQueryBuilder"},{"id":73,"kind":256,"name":"WildcardQuery","url":"interfaces/wildcardquery.html","classes":"tsd-kind-interface"},{"id":74,"kind":1024,"name":"field","url":"interfaces/wildcardquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WildcardQuery"},{"id":75,"kind":1024,"name":"value","url":"interfaces/wildcardquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WildcardQuery"},{"id":76,"kind":1024,"name":"enable_scoring","url":"interfaces/wildcardquery.html#enable_scoring","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"WildcardQuery"},{"id":77,"kind":1024,"name":"type","url":"interfaces/wildcardquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"WildcardQuery"},{"id":78,"kind":1024,"name":"boost","url":"interfaces/wildcardquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"WildcardQuery"},{"id":79,"kind":128,"name":"FuzzyQueryBuilder","url":"classes/fuzzyquerybuilder.html","classes":"tsd-kind-class"},{"id":80,"kind":512,"name":"constructor","url":"classes/fuzzyquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"FuzzyQueryBuilder"},{"id":81,"kind":2048,"name":"fuzziness","url":"classes/fuzzyquerybuilder.html#fuzziness","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FuzzyQueryBuilder"},{"id":82,"kind":2048,"name":"prefixLength","url":"classes/fuzzyquerybuilder.html#prefixlength","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FuzzyQueryBuilder"},{"id":83,"kind":2048,"name":"extended","url":"classes/fuzzyquerybuilder.html#extended","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FuzzyQueryBuilder"},{"id":84,"kind":1024,"name":"_data","url":"classes/fuzzyquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"FuzzyQueryBuilder"},{"id":85,"kind":2048,"name":"boost","url":"classes/fuzzyquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"FuzzyQueryBuilder"},{"id":86,"kind":2048,"name":"build","url":"classes/fuzzyquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"FuzzyQueryBuilder"},{"id":87,"kind":256,"name":"FuzzyQuery","url":"interfaces/fuzzyquery.html","classes":"tsd-kind-interface"},{"id":88,"kind":1024,"name":"field","url":"interfaces/fuzzyquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FuzzyQuery"},{"id":89,"kind":1024,"name":"value","url":"interfaces/fuzzyquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FuzzyQuery"},{"id":90,"kind":1024,"name":"fuzziness","url":"interfaces/fuzzyquery.html#fuzziness","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FuzzyQuery"},{"id":91,"kind":1024,"name":"prefix_length","url":"interfaces/fuzzyquery.html#prefix_length","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FuzzyQuery"},{"id":92,"kind":1024,"name":"extended","url":"interfaces/fuzzyquery.html#extended","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FuzzyQuery"},{"id":93,"kind":1024,"name":"type","url":"interfaces/fuzzyquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"FuzzyQuery"},{"id":94,"kind":1024,"name":"boost","url":"interfaces/fuzzyquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"FuzzyQuery"},{"id":95,"kind":128,"name":"PrefixQueryBuilder","url":"classes/prefixquerybuilder.html","classes":"tsd-kind-class"},{"id":96,"kind":512,"name":"constructor","url":"classes/prefixquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"PrefixQueryBuilder"},{"id":97,"kind":2048,"name":"enableScoring","url":"classes/prefixquerybuilder.html#enablescoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"PrefixQueryBuilder"},{"id":98,"kind":1024,"name":"_data","url":"classes/prefixquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"PrefixQueryBuilder"},{"id":99,"kind":2048,"name":"boost","url":"classes/prefixquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"PrefixQueryBuilder"},{"id":100,"kind":2048,"name":"build","url":"classes/prefixquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"PrefixQueryBuilder"},{"id":101,"kind":256,"name":"PrefixQuery","url":"interfaces/prefixquery.html","classes":"tsd-kind-interface"},{"id":102,"kind":1024,"name":"field","url":"interfaces/prefixquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"PrefixQuery"},{"id":103,"kind":1024,"name":"value","url":"interfaces/prefixquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"PrefixQuery"},{"id":104,"kind":1024,"name":"enable_scoring","url":"interfaces/prefixquery.html#enable_scoring","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"PrefixQuery"},{"id":105,"kind":1024,"name":"type","url":"interfaces/prefixquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"PrefixQuery"},{"id":106,"kind":1024,"name":"boost","url":"interfaces/prefixquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"PrefixQuery"},{"id":107,"kind":128,"name":"ExistsQueryBuilder","url":"classes/existsquerybuilder.html","classes":"tsd-kind-class"},{"id":108,"kind":512,"name":"constructor","url":"classes/existsquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"ExistsQueryBuilder"},{"id":109,"kind":1024,"name":"_data","url":"classes/existsquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"ExistsQueryBuilder"},{"id":110,"kind":2048,"name":"boost","url":"classes/existsquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ExistsQueryBuilder"},{"id":111,"kind":2048,"name":"build","url":"classes/existsquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ExistsQueryBuilder"},{"id":112,"kind":256,"name":"ExistsQuery","url":"interfaces/existsquery.html","classes":"tsd-kind-interface"},{"id":113,"kind":1024,"name":"field","url":"interfaces/existsquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ExistsQuery"},{"id":114,"kind":1024,"name":"type","url":"interfaces/existsquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"ExistsQuery"},{"id":115,"kind":1024,"name":"boost","url":"interfaces/existsquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"ExistsQuery"},{"id":116,"kind":128,"name":"MatchQueryBuilder","url":"classes/matchquerybuilder.html","classes":"tsd-kind-class"},{"id":117,"kind":512,"name":"constructor","url":"classes/matchquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"MatchQueryBuilder"},{"id":118,"kind":2048,"name":"minimumShouldMatch","url":"classes/matchquerybuilder.html#minimumshouldmatch","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MatchQueryBuilder"},{"id":119,"kind":2048,"name":"operator","url":"classes/matchquerybuilder.html#operator","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MatchQueryBuilder"},{"id":120,"kind":2048,"name":"fuzziness","url":"classes/matchquerybuilder.html#fuzziness","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MatchQueryBuilder"},{"id":121,"kind":2048,"name":"prefixLength","url":"classes/matchquerybuilder.html#prefixlength","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MatchQueryBuilder"},{"id":122,"kind":2048,"name":"extended","url":"classes/matchquerybuilder.html#extended","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MatchQueryBuilder"},{"id":123,"kind":1024,"name":"_data","url":"classes/matchquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"MatchQueryBuilder"},{"id":124,"kind":2048,"name":"boost","url":"classes/matchquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MatchQueryBuilder"},{"id":125,"kind":2048,"name":"build","url":"classes/matchquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MatchQueryBuilder"},{"id":126,"kind":256,"name":"MatchQuery","url":"interfaces/matchquery.html","classes":"tsd-kind-interface"},{"id":127,"kind":1024,"name":"field","url":"interfaces/matchquery.html#field","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":128,"kind":1024,"name":"value","url":"interfaces/matchquery.html#value","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":129,"kind":1024,"name":"minimum_should_match","url":"interfaces/matchquery.html#minimum_should_match","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":130,"kind":1024,"name":"operator","url":"interfaces/matchquery.html#operator","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":131,"kind":1024,"name":"fuzziness","url":"interfaces/matchquery.html#fuzziness","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":132,"kind":1024,"name":"prefix_length","url":"interfaces/matchquery.html#prefix_length","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":133,"kind":1024,"name":"extended","url":"interfaces/matchquery.html#extended","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MatchQuery"},{"id":134,"kind":1024,"name":"type","url":"interfaces/matchquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"MatchQuery"},{"id":135,"kind":1024,"name":"boost","url":"interfaces/matchquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"MatchQuery"},{"id":136,"kind":128,"name":"MatchAllQueryBuilder","url":"classes/matchallquerybuilder.html","classes":"tsd-kind-class"},{"id":137,"kind":512,"name":"constructor","url":"classes/matchallquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"MatchAllQueryBuilder"},{"id":138,"kind":1024,"name":"_data","url":"classes/matchallquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"MatchAllQueryBuilder"},{"id":139,"kind":2048,"name":"boost","url":"classes/matchallquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MatchAllQueryBuilder"},{"id":140,"kind":2048,"name":"build","url":"classes/matchallquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"MatchAllQueryBuilder"},{"id":141,"kind":256,"name":"MatchQueryAll","url":"interfaces/matchqueryall.html","classes":"tsd-kind-interface"},{"id":142,"kind":1024,"name":"type","url":"interfaces/matchqueryall.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"MatchQueryAll"},{"id":143,"kind":1024,"name":"boost","url":"interfaces/matchqueryall.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"MatchQueryAll"},{"id":144,"kind":128,"name":"ConstantScoreQueryBuilder","url":"classes/constantscorequerybuilder.html","classes":"tsd-kind-class"},{"id":145,"kind":512,"name":"constructor","url":"classes/constantscorequerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"ConstantScoreQueryBuilder"},{"id":146,"kind":2048,"name":"beginFilter","url":"classes/constantscorequerybuilder.html#beginfilter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ConstantScoreQueryBuilder"},{"id":147,"kind":1024,"name":"_data","url":"classes/constantscorequerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"ConstantScoreQueryBuilder"},{"id":148,"kind":2048,"name":"boost","url":"classes/constantscorequerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ConstantScoreQueryBuilder"},{"id":149,"kind":2048,"name":"build","url":"classes/constantscorequerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ConstantScoreQueryBuilder"},{"id":150,"kind":256,"name":"ConstantScoreQuery","url":"interfaces/constantscorequery.html","classes":"tsd-kind-interface"},{"id":151,"kind":1024,"name":"filter","url":"interfaces/constantscorequery.html#filter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ConstantScoreQuery"},{"id":152,"kind":1024,"name":"type","url":"interfaces/constantscorequery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"ConstantScoreQuery"},{"id":153,"kind":1024,"name":"boost","url":"interfaces/constantscorequery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"ConstantScoreQuery"},{"id":154,"kind":128,"name":"BoolQueryBuilder","url":"classes/boolquerybuilder.html","classes":"tsd-kind-class"},{"id":155,"kind":512,"name":"constructor","url":"classes/boolquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"BoolQueryBuilder"},{"id":156,"kind":2048,"name":"beginMust","url":"classes/boolquerybuilder.html#beginmust","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BoolQueryBuilder"},{"id":157,"kind":2048,"name":"beginFilter","url":"classes/boolquerybuilder.html#beginfilter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BoolQueryBuilder"},{"id":158,"kind":2048,"name":"beginShould","url":"classes/boolquerybuilder.html#beginshould","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BoolQueryBuilder"},{"id":159,"kind":2048,"name":"beginNot","url":"classes/boolquerybuilder.html#beginnot","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BoolQueryBuilder"},{"id":160,"kind":2048,"name":"minimumShouldMatch","url":"classes/boolquerybuilder.html#minimumshouldmatch","classes":"tsd-kind-method tsd-parent-kind-class","parent":"BoolQueryBuilder"},{"id":161,"kind":1024,"name":"_data","url":"classes/boolquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"BoolQueryBuilder"},{"id":162,"kind":2048,"name":"boost","url":"classes/boolquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"BoolQueryBuilder"},{"id":163,"kind":2048,"name":"build","url":"classes/boolquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"BoolQueryBuilder"},{"id":164,"kind":256,"name":"BoolQuery","url":"interfaces/boolquery.html","classes":"tsd-kind-interface"},{"id":165,"kind":1024,"name":"must","url":"interfaces/boolquery.html#must","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BoolQuery"},{"id":166,"kind":1024,"name":"filter","url":"interfaces/boolquery.html#filter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BoolQuery"},{"id":167,"kind":1024,"name":"should","url":"interfaces/boolquery.html#should","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BoolQuery"},{"id":168,"kind":1024,"name":"not","url":"interfaces/boolquery.html#not","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BoolQuery"},{"id":169,"kind":1024,"name":"minimum_should_match","url":"interfaces/boolquery.html#minimum_should_match","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"BoolQuery"},{"id":170,"kind":1024,"name":"type","url":"interfaces/boolquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"BoolQuery"},{"id":171,"kind":1024,"name":"boost","url":"interfaces/boolquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"BoolQuery"},{"id":172,"kind":128,"name":"ArrayQueryBuilder","url":"classes/arrayquerybuilder.html","classes":"tsd-kind-class"},{"id":173,"kind":512,"name":"constructor","url":"classes/arrayquerybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"ArrayQueryBuilder"},{"id":174,"kind":2048,"name":"bool","url":"classes/arrayquerybuilder.html#bool","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":175,"kind":2048,"name":"constantScore","url":"classes/arrayquerybuilder.html#constantscore","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":176,"kind":2048,"name":"term","url":"classes/arrayquerybuilder.html#term","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":177,"kind":2048,"name":"terms","url":"classes/arrayquerybuilder.html#terms","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":178,"kind":2048,"name":"wildcard","url":"classes/arrayquerybuilder.html#wildcard","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":179,"kind":2048,"name":"fuzzy","url":"classes/arrayquerybuilder.html#fuzzy","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":180,"kind":2048,"name":"match","url":"classes/arrayquerybuilder.html#match","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":181,"kind":2048,"name":"matchAll","url":"classes/arrayquerybuilder.html#matchall","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":182,"kind":2048,"name":"prefix","url":"classes/arrayquerybuilder.html#prefix","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":183,"kind":2048,"name":"exists","url":"classes/arrayquerybuilder.html#exists","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ArrayQueryBuilder"},{"id":184,"kind":1024,"name":"_data","url":"classes/arrayquerybuilder.html#_data","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"ArrayQueryBuilder"},{"id":185,"kind":2048,"name":"boost","url":"classes/arrayquerybuilder.html#boost","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ArrayQueryBuilder"},{"id":186,"kind":2048,"name":"build","url":"classes/arrayquerybuilder.html#build","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"ArrayQueryBuilder"},{"id":187,"kind":256,"name":"ArrayQuery","url":"interfaces/arrayquery.html","classes":"tsd-kind-interface"},{"id":188,"kind":1024,"name":"values","url":"interfaces/arrayquery.html#values","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ArrayQuery"},{"id":189,"kind":1024,"name":"type","url":"interfaces/arrayquery.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"ArrayQuery"},{"id":190,"kind":1024,"name":"boost","url":"interfaces/arrayquery.html#boost","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"ArrayQuery"},{"id":191,"kind":128,"name":"QueryBuilder","url":"classes/querybuilder.html","classes":"tsd-kind-class"},{"id":192,"kind":512,"name":"constructor","url":"classes/querybuilder.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"QueryBuilder"},{"id":193,"kind":2048,"name":"enableFinalScoring","url":"classes/querybuilder.html#enablefinalscoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":194,"kind":2048,"name":"explain","url":"classes/querybuilder.html#explain","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":195,"kind":2048,"name":"BM25Similarity","url":"classes/querybuilder.html#bm25similarity","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":196,"kind":2048,"name":"bool","url":"classes/querybuilder.html#bool","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":197,"kind":2048,"name":"constantScore","url":"classes/querybuilder.html#constantscore","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":198,"kind":2048,"name":"term","url":"classes/querybuilder.html#term","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":199,"kind":2048,"name":"terms","url":"classes/querybuilder.html#terms","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":200,"kind":2048,"name":"wildcard","url":"classes/querybuilder.html#wildcard","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":201,"kind":2048,"name":"fuzzy","url":"classes/querybuilder.html#fuzzy","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":202,"kind":2048,"name":"match","url":"classes/querybuilder.html#match","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":203,"kind":2048,"name":"matchAll","url":"classes/querybuilder.html#matchall","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":204,"kind":2048,"name":"prefix","url":"classes/querybuilder.html#prefix","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":205,"kind":2048,"name":"exists","url":"classes/querybuilder.html#exists","classes":"tsd-kind-method tsd-parent-kind-class","parent":"QueryBuilder"},{"id":206,"kind":256,"name":"Query","url":"interfaces/query.html","classes":"tsd-kind-interface"},{"id":207,"kind":1024,"name":"query","url":"interfaces/query.html#query-1","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Query"},{"id":208,"kind":1024,"name":"final_scoring","url":"interfaces/query.html#final_scoring","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Query"},{"id":209,"kind":1024,"name":"explain","url":"interfaces/query.html#explain","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Query"},{"id":210,"kind":1024,"name":"bm25","url":"interfaces/query.html#bm25","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Query"},{"id":211,"kind":65536,"name":"__type","url":"interfaces/query.html#bm25.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"Query.bm25"},{"id":212,"kind":4194304,"name":"QueryTypes","url":"globals.html#querytypes","classes":"tsd-kind-type-alias"},{"id":213,"kind":128,"name":"ResultSet","url":"classes/resultset.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":214,"kind":1024,"name":"_collection","url":"classes/resultset.html#_collection","classes":"tsd-kind-property tsd-parent-kind-class","parent":"ResultSet"},{"id":215,"kind":1024,"name":"_filteredRows","url":"classes/resultset.html#_filteredrows","classes":"tsd-kind-property tsd-parent-kind-class","parent":"ResultSet"},{"id":216,"kind":1024,"name":"_filterInitialized","url":"classes/resultset.html#_filterinitialized","classes":"tsd-kind-property tsd-parent-kind-class","parent":"ResultSet"},{"id":217,"kind":512,"name":"constructor","url":"classes/resultset.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"ResultSet"},{"id":218,"kind":2048,"name":"reset","url":"classes/resultset.html#reset","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":219,"kind":2048,"name":"toJSON","url":"classes/resultset.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":220,"kind":2048,"name":"limit","url":"classes/resultset.html#limit","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":221,"kind":2048,"name":"offset","url":"classes/resultset.html#offset","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":222,"kind":2048,"name":"copy","url":"classes/resultset.html#copy","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":223,"kind":2048,"name":"branch","url":"classes/resultset.html#branch","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":224,"kind":2048,"name":"transform","url":"classes/resultset.html#transform","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":225,"kind":2048,"name":"sort","url":"classes/resultset.html#sort","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":226,"kind":2048,"name":"simplesort","url":"classes/resultset.html#simplesort","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":227,"kind":2048,"name":"compoundsort","url":"classes/resultset.html#compoundsort","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":228,"kind":2048,"name":"sortByScoring","url":"classes/resultset.html#sortbyscoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":229,"kind":2048,"name":"getScoring","url":"classes/resultset.html#getscoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":230,"kind":2048,"name":"findOr","url":"classes/resultset.html#findor","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":231,"kind":2048,"name":"$or","url":"classes/resultset.html#_or","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":232,"kind":2048,"name":"findAnd","url":"classes/resultset.html#findand","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":233,"kind":2048,"name":"$and","url":"classes/resultset.html#_and","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":234,"kind":2048,"name":"find","url":"classes/resultset.html#find","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":235,"kind":2048,"name":"where","url":"classes/resultset.html#where","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":236,"kind":2048,"name":"count","url":"classes/resultset.html#count","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":237,"kind":2048,"name":"data","url":"classes/resultset.html#data","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":238,"kind":2048,"name":"update","url":"classes/resultset.html#update","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":239,"kind":2048,"name":"remove","url":"classes/resultset.html#remove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":240,"kind":2048,"name":"mapReduce","url":"classes/resultset.html#mapreduce","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"ResultSet"},{"id":241,"kind":2048,"name":"eqJoin","url":"classes/resultset.html#eqjoin","classes":"tsd-kind-method tsd-parent-kind-class","parent":"ResultSet"},{"id":242,"kind":2048,"name":"map","url":"classes/resultset.html#map","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"ResultSet"},{"id":243,"kind":256,"name":"DataOptions","url":"interfaces/resultset.dataoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"ResultSet"},{"id":244,"kind":1024,"name":"forceClones","url":"interfaces/resultset.dataoptions.html#forceclones","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ResultSet.DataOptions"},{"id":245,"kind":1024,"name":"forceCloneMethod","url":"interfaces/resultset.dataoptions.html#forceclonemethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ResultSet.DataOptions"},{"id":246,"kind":1024,"name":"removeMeta","url":"interfaces/resultset.dataoptions.html#removemeta","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ResultSet.DataOptions"},{"id":247,"kind":4194304,"name":"LokiOps","url":"classes/resultset.html#lokiops","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"ResultSet"},{"id":248,"kind":65536,"name":"__type","url":"classes/resultset.html#lokiops.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"ResultSet.LokiOps"},{"id":249,"kind":4194304,"name":"Query","url":"classes/resultset.html#query","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"ResultSet"},{"id":250,"kind":128,"name":"DynamicView","url":"classes/dynamicview.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":251,"kind":1024,"name":"name","url":"classes/dynamicview.html#name","classes":"tsd-kind-property tsd-parent-kind-class","parent":"DynamicView"},{"id":252,"kind":512,"name":"constructor","url":"classes/dynamicview.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"DynamicView"},{"id":253,"kind":2048,"name":"_rematerialize","url":"classes/dynamicview.html#_rematerialize","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":254,"kind":2048,"name":"branchResultSet","url":"classes/dynamicview.html#branchresultset","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":255,"kind":2048,"name":"toJSON","url":"classes/dynamicview.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":256,"kind":2048,"name":"fromJSONObject","url":"classes/dynamicview.html#fromjsonobject","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"DynamicView"},{"id":257,"kind":2048,"name":"removeFilters","url":"classes/dynamicview.html#removefilters","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":258,"kind":2048,"name":"applySort","url":"classes/dynamicview.html#applysort","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":259,"kind":2048,"name":"applySimpleSort","url":"classes/dynamicview.html#applysimplesort","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":260,"kind":2048,"name":"applySortCriteria","url":"classes/dynamicview.html#applysortcriteria","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":261,"kind":2048,"name":"applySortByScoring","url":"classes/dynamicview.html#applysortbyscoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":262,"kind":2048,"name":"getScoring","url":"classes/dynamicview.html#getscoring","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":263,"kind":2048,"name":"startTransaction","url":"classes/dynamicview.html#starttransaction","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":264,"kind":2048,"name":"commit","url":"classes/dynamicview.html#commit","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":265,"kind":2048,"name":"rollback","url":"classes/dynamicview.html#rollback","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":266,"kind":2048,"name":"reapplyFilters","url":"classes/dynamicview.html#reapplyfilters","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":267,"kind":2048,"name":"applyFilter","url":"classes/dynamicview.html#applyfilter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":268,"kind":2048,"name":"applyFind","url":"classes/dynamicview.html#applyfind","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":269,"kind":2048,"name":"applyWhere","url":"classes/dynamicview.html#applywhere","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":270,"kind":2048,"name":"removeFilter","url":"classes/dynamicview.html#removefilter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":271,"kind":2048,"name":"count","url":"classes/dynamicview.html#count","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":272,"kind":2048,"name":"data","url":"classes/dynamicview.html#data","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":273,"kind":2048,"name":"_evaluateDocument","url":"classes/dynamicview.html#_evaluatedocument","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":274,"kind":2048,"name":"_removeDocument","url":"classes/dynamicview.html#_removedocument","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DynamicView"},{"id":275,"kind":2048,"name":"mapReduce","url":"classes/dynamicview.html#mapreduce","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"DynamicView"},{"id":276,"kind":1024,"name":"events","url":"classes/dynamicview.html#events","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"DynamicView"},{"id":277,"kind":1024,"name":"asyncListeners","url":"classes/dynamicview.html#asynclisteners","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"DynamicView"},{"id":278,"kind":2048,"name":"on","url":"classes/dynamicview.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"DynamicView"},{"id":279,"kind":2048,"name":"emit","url":"classes/dynamicview.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"DynamicView"},{"id":280,"kind":2048,"name":"addListener","url":"classes/dynamicview.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"DynamicView"},{"id":281,"kind":2048,"name":"removeListener","url":"classes/dynamicview.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"DynamicView"},{"id":282,"kind":256,"name":"Options","url":"interfaces/dynamicview.options.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"DynamicView"},{"id":283,"kind":1024,"name":"persistent","url":"interfaces/dynamicview.options.html#persistent","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Options"},{"id":284,"kind":1024,"name":"sortPriority","url":"interfaces/dynamicview.options.html#sortpriority","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Options"},{"id":285,"kind":1024,"name":"minRebuildInterval","url":"interfaces/dynamicview.options.html#minrebuildinterval","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Options"},{"id":286,"kind":256,"name":"Serialized","url":"interfaces/dynamicview.serialized.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"DynamicView"},{"id":287,"kind":1024,"name":"name","url":"interfaces/dynamicview.serialized.html#name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Serialized"},{"id":288,"kind":1024,"name":"_persistent","url":"interfaces/dynamicview.serialized.html#_persistent","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Serialized"},{"id":289,"kind":1024,"name":"_sortPriority","url":"interfaces/dynamicview.serialized.html#_sortpriority","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Serialized"},{"id":290,"kind":1024,"name":"_minRebuildInterval","url":"interfaces/dynamicview.serialized.html#_minrebuildinterval","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Serialized"},{"id":291,"kind":1024,"name":"_resultSet","url":"interfaces/dynamicview.serialized.html#_resultset","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Serialized"},{"id":292,"kind":1024,"name":"_filterPipeline","url":"interfaces/dynamicview.serialized.html#_filterpipeline","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Serialized"},{"id":293,"kind":1024,"name":"_sortCriteria","url":"interfaces/dynamicview.serialized.html#_sortcriteria","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Serialized"},{"id":294,"kind":1024,"name":"_sortByScoring","url":"interfaces/dynamicview.serialized.html#_sortbyscoring","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Serialized"},{"id":295,"kind":1024,"name":"_sortDirty","url":"interfaces/dynamicview.serialized.html#_sortdirty","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DynamicView.Serialized"},{"id":296,"kind":4194304,"name":"SortPriority","url":"classes/dynamicview.html#sortpriority","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"DynamicView"},{"id":297,"kind":4194304,"name":"Filter","url":"classes/dynamicview.html#filter","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"DynamicView"},{"id":298,"kind":128,"name":"FullTextSearch","url":"classes/fulltextsearch.html","classes":"tsd-kind-class"},{"id":299,"kind":2048,"name":"register","url":"classes/fulltextsearch.html#register","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"FullTextSearch"},{"id":300,"kind":512,"name":"constructor","url":"classes/fulltextsearch.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"FullTextSearch"},{"id":301,"kind":2048,"name":"addDocument","url":"classes/fulltextsearch.html#adddocument","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":302,"kind":2048,"name":"removeDocument","url":"classes/fulltextsearch.html#removedocument","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":303,"kind":2048,"name":"updateDocument","url":"classes/fulltextsearch.html#updatedocument","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":304,"kind":2048,"name":"clear","url":"classes/fulltextsearch.html#clear","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":305,"kind":2048,"name":"search","url":"classes/fulltextsearch.html#search","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":306,"kind":2048,"name":"toJSON","url":"classes/fulltextsearch.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FullTextSearch"},{"id":307,"kind":2048,"name":"fromJSONObject","url":"classes/fulltextsearch.html#fromjsonobject","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"FullTextSearch"},{"id":308,"kind":256,"name":"FieldOptions","url":"interfaces/fulltextsearch.fieldoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"FullTextSearch"},{"id":309,"kind":1024,"name":"name","url":"interfaces/fulltextsearch.fieldoptions.html#name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FullTextSearch.FieldOptions"},{"id":310,"kind":1024,"name":"store","url":"interfaces/fulltextsearch.fieldoptions.html#store","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"FullTextSearch.FieldOptions"},{"id":311,"kind":1024,"name":"optimizeChanges","url":"interfaces/fulltextsearch.fieldoptions.html#optimizechanges","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"FullTextSearch.FieldOptions"},{"id":312,"kind":1024,"name":"tokenizer","url":"interfaces/fulltextsearch.fieldoptions.html#tokenizer","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"FullTextSearch.FieldOptions"},{"id":313,"kind":256,"name":"Serialization","url":"interfaces/fulltextsearch.serialization.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"FullTextSearch"},{"id":314,"kind":1024,"name":"id","url":"interfaces/fulltextsearch.serialization.html#id","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FullTextSearch.Serialization"},{"id":315,"kind":1024,"name":"ii","url":"interfaces/fulltextsearch.serialization.html#ii","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"FullTextSearch.Serialization"},{"id":316,"kind":128,"name":"Collection","url":"classes/collection.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":317,"kind":1024,"name":"name","url":"classes/collection.html#name","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":318,"kind":1024,"name":"_data","url":"classes/collection.html#_data","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":319,"kind":1024,"name":"binaryIndices","url":"classes/collection.html#binaryindices","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":320,"kind":65536,"name":"__type","url":"classes/collection.html#binaryindices.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"Collection.binaryIndices"},{"id":321,"kind":1024,"name":"constraints","url":"classes/collection.html#constraints","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":322,"kind":65536,"name":"__type","url":"classes/collection.html#constraints.__type-2","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"Collection.constraints"},{"id":323,"kind":1024,"name":"transforms","url":"classes/collection.html#transforms","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":324,"kind":1024,"name":"dirty","url":"classes/collection.html#dirty","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":325,"kind":1024,"name":"adaptiveBinaryIndices","url":"classes/collection.html#adaptivebinaryindices","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":326,"kind":1024,"name":"cloneObjects","url":"classes/collection.html#cloneobjects","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":327,"kind":1024,"name":"cloneMethod","url":"classes/collection.html#clonemethod","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":328,"kind":1024,"name":"disableDeltaChangesApi","url":"classes/collection.html#disabledeltachangesapi","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":329,"kind":1024,"name":"ttl","url":"classes/collection.html#ttl-1","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":330,"kind":1024,"name":"console","url":"classes/collection.html#console","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":331,"kind":65536,"name":"__type","url":"classes/collection.html#console.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"Collection.console"},{"id":332,"kind":1024,"name":"_fullTextSearch","url":"classes/collection.html#_fulltextsearch","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Collection"},{"id":333,"kind":512,"name":"constructor","url":"classes/collection.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"Collection"},{"id":334,"kind":2048,"name":"toJSON","url":"classes/collection.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":335,"kind":2048,"name":"fromJSONObject","url":"classes/collection.html#fromjsonobject","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"Collection"},{"id":336,"kind":2048,"name":"addTransform","url":"classes/collection.html#addtransform","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":337,"kind":2048,"name":"getTransform","url":"classes/collection.html#gettransform","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":338,"kind":2048,"name":"setTransform","url":"classes/collection.html#settransform","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":339,"kind":2048,"name":"removeTransform","url":"classes/collection.html#removetransform","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":340,"kind":2048,"name":"_prepareFullDocIndex","url":"classes/collection.html#_preparefulldocindex","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":341,"kind":2048,"name":"ensureIndex","url":"classes/collection.html#ensureindex","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":342,"kind":2048,"name":"getSequencedIndexValues","url":"classes/collection.html#getsequencedindexvalues","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":343,"kind":2048,"name":"ensureUniqueIndex","url":"classes/collection.html#ensureuniqueindex","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":344,"kind":2048,"name":"ensureAllIndexes","url":"classes/collection.html#ensureallindexes","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":345,"kind":2048,"name":"flagBinaryIndexesDirty","url":"classes/collection.html#flagbinaryindexesdirty","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":346,"kind":2048,"name":"flagBinaryIndexDirty","url":"classes/collection.html#flagbinaryindexdirty","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":347,"kind":2048,"name":"count","url":"classes/collection.html#count","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":348,"kind":2048,"name":"addDynamicView","url":"classes/collection.html#adddynamicview","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":349,"kind":2048,"name":"removeDynamicView","url":"classes/collection.html#removedynamicview","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":350,"kind":2048,"name":"getDynamicView","url":"classes/collection.html#getdynamicview","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":351,"kind":2048,"name":"findAndUpdate","url":"classes/collection.html#findandupdate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":352,"kind":2048,"name":"findAndRemove","url":"classes/collection.html#findandremove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":353,"kind":2048,"name":"insert","url":"classes/collection.html#insert","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":354,"kind":2048,"name":"insertOne","url":"classes/collection.html#insertone","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":355,"kind":2048,"name":"clear","url":"classes/collection.html#clear","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":356,"kind":2048,"name":"update","url":"classes/collection.html#update","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":357,"kind":2048,"name":"updateWhere","url":"classes/collection.html#updatewhere","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":358,"kind":2048,"name":"removeWhere","url":"classes/collection.html#removewhere","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":359,"kind":2048,"name":"removeDataOnly","url":"classes/collection.html#removedataonly","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":360,"kind":2048,"name":"remove","url":"classes/collection.html#remove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":361,"kind":2048,"name":"getChanges","url":"classes/collection.html#getchanges","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":362,"kind":2048,"name":"setChangesApi","url":"classes/collection.html#setchangesapi","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":363,"kind":2048,"name":"flushChanges","url":"classes/collection.html#flushchanges","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":364,"kind":2048,"name":"get","url":"classes/collection.html#get","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":365,"kind":2048,"name":"getBinaryIndexPosition","url":"classes/collection.html#getbinaryindexposition","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":366,"kind":2048,"name":"adaptiveBinaryIndexInsert","url":"classes/collection.html#adaptivebinaryindexinsert","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":367,"kind":2048,"name":"adaptiveBinaryIndexUpdate","url":"classes/collection.html#adaptivebinaryindexupdate","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":368,"kind":2048,"name":"adaptiveBinaryIndexRemove","url":"classes/collection.html#adaptivebinaryindexremove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":369,"kind":2048,"name":"calculateRange","url":"classes/collection.html#calculaterange","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":370,"kind":2048,"name":"by","url":"classes/collection.html#by","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":371,"kind":2048,"name":"findOne","url":"classes/collection.html#findone","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":372,"kind":2048,"name":"chain","url":"classes/collection.html#chain","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":373,"kind":2048,"name":"find","url":"classes/collection.html#find","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":374,"kind":2048,"name":"findOneUnindexed","url":"classes/collection.html#findoneunindexed","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":375,"kind":2048,"name":"startTransaction","url":"classes/collection.html#starttransaction","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":376,"kind":2048,"name":"commit","url":"classes/collection.html#commit","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":377,"kind":2048,"name":"rollback","url":"classes/collection.html#rollback","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":378,"kind":2048,"name":"where","url":"classes/collection.html#where","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":379,"kind":2048,"name":"mapReduce","url":"classes/collection.html#mapreduce","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Collection"},{"id":380,"kind":2048,"name":"eqJoin","url":"classes/collection.html#eqjoin","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":381,"kind":2048,"name":"getStage","url":"classes/collection.html#getstage","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":382,"kind":2048,"name":"stage","url":"classes/collection.html#stage","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Collection"},{"id":383,"kind":2048,"name":"commitStage","url":"classes/collection.html#commitstage","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":384,"kind":2048,"name":"extract","url":"classes/collection.html#extract","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":385,"kind":2048,"name":"max","url":"classes/collection.html#max","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":386,"kind":2048,"name":"min","url":"classes/collection.html#min","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":387,"kind":2048,"name":"maxRecord","url":"classes/collection.html#maxrecord","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":388,"kind":2048,"name":"minRecord","url":"classes/collection.html#minrecord","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":389,"kind":2048,"name":"extractNumerical","url":"classes/collection.html#extractnumerical","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":390,"kind":2048,"name":"avg","url":"classes/collection.html#avg","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":391,"kind":2048,"name":"stdDev","url":"classes/collection.html#stddev","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":392,"kind":2048,"name":"mode","url":"classes/collection.html#mode","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":393,"kind":2048,"name":"median","url":"classes/collection.html#median","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Collection"},{"id":394,"kind":1024,"name":"events","url":"classes/collection.html#events","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"Collection"},{"id":395,"kind":1024,"name":"asyncListeners","url":"classes/collection.html#asynclisteners","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"Collection"},{"id":396,"kind":2048,"name":"on","url":"classes/collection.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Collection"},{"id":397,"kind":2048,"name":"emit","url":"classes/collection.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Collection"},{"id":398,"kind":2048,"name":"addListener","url":"classes/collection.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Collection"},{"id":399,"kind":2048,"name":"removeListener","url":"classes/collection.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Collection"},{"id":400,"kind":256,"name":"Options","url":"interfaces/collection.options.html","classes":"tsd-kind-interface tsd-parent-kind-class tsd-has-type-parameter","parent":"Collection"},{"id":401,"kind":1024,"name":"unique","url":"interfaces/collection.options.html#unique","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":402,"kind":1024,"name":"indices","url":"interfaces/collection.options.html#indices","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":403,"kind":1024,"name":"adaptiveBinaryIndices","url":"interfaces/collection.options.html#adaptivebinaryindices","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":404,"kind":1024,"name":"asyncListeners","url":"interfaces/collection.options.html#asynclisteners","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":405,"kind":1024,"name":"disableChangesApi","url":"interfaces/collection.options.html#disablechangesapi","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":406,"kind":1024,"name":"disableDeltaChangesApi","url":"interfaces/collection.options.html#disabledeltachangesapi","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":407,"kind":1024,"name":"clone","url":"interfaces/collection.options.html#clone","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":408,"kind":1024,"name":"serializableIndices","url":"interfaces/collection.options.html#serializableindices","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":409,"kind":1024,"name":"cloneMethod","url":"interfaces/collection.options.html#clonemethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":410,"kind":1024,"name":"transactional","url":"interfaces/collection.options.html#transactional","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":411,"kind":1024,"name":"ttl","url":"interfaces/collection.options.html#ttl","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":412,"kind":1024,"name":"ttlInterval","url":"interfaces/collection.options.html#ttlinterval","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":413,"kind":1024,"name":"fullTextSearch","url":"interfaces/collection.options.html#fulltextsearch","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Options"},{"id":414,"kind":256,"name":"DeserializeOptions","url":"interfaces/collection.deserializeoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Collection"},{"id":415,"kind":1024,"name":"retainDirtyFlags","url":"interfaces/collection.deserializeoptions.html#retaindirtyflags","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.DeserializeOptions"},{"id":416,"kind":1024,"name":"fullTextSearch","url":"interfaces/collection.deserializeoptions.html#fulltextsearch","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.DeserializeOptions"},{"id":417,"kind":256,"name":"BinaryIndex","url":"interfaces/collection.binaryindex.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Collection"},{"id":418,"kind":1024,"name":"dirty","url":"interfaces/collection.binaryindex.html#dirty","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.BinaryIndex"},{"id":419,"kind":1024,"name":"values","url":"interfaces/collection.binaryindex.html#values","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.BinaryIndex"},{"id":420,"kind":256,"name":"Change","url":"interfaces/collection.change.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Collection"},{"id":421,"kind":1024,"name":"name","url":"interfaces/collection.change.html#name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Change"},{"id":422,"kind":1024,"name":"operation","url":"interfaces/collection.change.html#operation","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Change"},{"id":423,"kind":1024,"name":"obj","url":"interfaces/collection.change.html#obj","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Change"},{"id":424,"kind":256,"name":"Serialized","url":"interfaces/collection.serialized.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Collection"},{"id":425,"kind":1024,"name":"name","url":"interfaces/collection.serialized.html#name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":426,"kind":1024,"name":"_dynamicViews","url":"interfaces/collection.serialized.html#_dynamicviews","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":427,"kind":1024,"name":"uniqueNames","url":"interfaces/collection.serialized.html#uniquenames","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":428,"kind":1024,"name":"transforms","url":"interfaces/collection.serialized.html#transforms","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":429,"kind":1024,"name":"binaryIndices","url":"interfaces/collection.serialized.html#binaryindices","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":430,"kind":1024,"name":"_data","url":"interfaces/collection.serialized.html#_data","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":431,"kind":1024,"name":"idIndex","url":"interfaces/collection.serialized.html#idindex","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":432,"kind":1024,"name":"maxId","url":"interfaces/collection.serialized.html#maxid","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":433,"kind":1024,"name":"dirty","url":"interfaces/collection.serialized.html#dirty","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":434,"kind":1024,"name":"adaptiveBinaryIndices","url":"interfaces/collection.serialized.html#adaptivebinaryindices","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":435,"kind":1024,"name":"transactional","url":"interfaces/collection.serialized.html#transactional","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":436,"kind":1024,"name":"asyncListeners","url":"interfaces/collection.serialized.html#asynclisteners","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":437,"kind":1024,"name":"disableChangesApi","url":"interfaces/collection.serialized.html#disablechangesapi","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":438,"kind":1024,"name":"disableDeltaChangesApi","url":"interfaces/collection.serialized.html#disabledeltachangesapi","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":439,"kind":1024,"name":"cloneObjects","url":"interfaces/collection.serialized.html#cloneobjects","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":440,"kind":1024,"name":"cloneMethod","url":"interfaces/collection.serialized.html#clonemethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":441,"kind":1024,"name":"changes","url":"interfaces/collection.serialized.html#changes","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":442,"kind":1024,"name":"_fullTextSearch","url":"interfaces/collection.serialized.html#_fulltextsearch","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.Serialized"},{"id":443,"kind":256,"name":"TTL","url":"interfaces/collection.ttl.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Collection"},{"id":444,"kind":1024,"name":"age","url":"interfaces/collection.ttl.html#age","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.TTL"},{"id":445,"kind":1024,"name":"ttlInterval","url":"interfaces/collection.ttl.html#ttlinterval","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.TTL"},{"id":446,"kind":1024,"name":"daemon","url":"interfaces/collection.ttl.html#daemon","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Collection.TTL"},{"id":447,"kind":4194304,"name":"Transform","url":"classes/collection.html#transform","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Collection"},{"id":448,"kind":128,"name":"Loki","url":"classes/loki.html","classes":"tsd-kind-class"},{"id":449,"kind":512,"name":"constructor","url":"classes/loki.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"Loki"},{"id":450,"kind":2048,"name":"initializePersistence","url":"classes/loki.html#initializepersistence","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":451,"kind":2048,"name":"copy","url":"classes/loki.html#copy","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":452,"kind":2048,"name":"addCollection","url":"classes/loki.html#addcollection","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Loki"},{"id":453,"kind":2048,"name":"loadCollection","url":"classes/loki.html#loadcollection","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":454,"kind":2048,"name":"getCollection","url":"classes/loki.html#getcollection","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Loki"},{"id":455,"kind":2048,"name":"renameCollection","url":"classes/loki.html#renamecollection","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Loki"},{"id":456,"kind":2048,"name":"listCollections","url":"classes/loki.html#listcollections","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":457,"kind":2048,"name":"removeCollection","url":"classes/loki.html#removecollection","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":458,"kind":2048,"name":"getName","url":"classes/loki.html#getname","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":459,"kind":2048,"name":"serialize","url":"classes/loki.html#serialize","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":460,"kind":2048,"name":"toJSON","url":"classes/loki.html#tojson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":461,"kind":2048,"name":"serializeDestructured","url":"classes/loki.html#serializedestructured","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":462,"kind":2048,"name":"serializeCollection","url":"classes/loki.html#serializecollection","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":463,"kind":2048,"name":"deserializeDestructured","url":"classes/loki.html#deserializedestructured","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":464,"kind":2048,"name":"deserializeCollection","url":"classes/loki.html#deserializecollection","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"Loki"},{"id":465,"kind":2048,"name":"loadJSON","url":"classes/loki.html#loadjson","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":466,"kind":2048,"name":"loadJSONObject","url":"classes/loki.html#loadjsonobject","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":467,"kind":2048,"name":"close","url":"classes/loki.html#close","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":468,"kind":2048,"name":"generateChangesNotification","url":"classes/loki.html#generatechangesnotification","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":469,"kind":2048,"name":"serializeChanges","url":"classes/loki.html#serializechanges","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":470,"kind":2048,"name":"clearChanges","url":"classes/loki.html#clearchanges","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":471,"kind":2048,"name":"throttledSaveDrain","url":"classes/loki.html#throttledsavedrain","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":472,"kind":2048,"name":"loadDatabase","url":"classes/loki.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":473,"kind":2048,"name":"saveDatabase","url":"classes/loki.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":474,"kind":2048,"name":"deleteDatabase","url":"classes/loki.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":475,"kind":2048,"name":"autosaveEnable","url":"classes/loki.html#autosaveenable","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":476,"kind":2048,"name":"autosaveDisable","url":"classes/loki.html#autosavedisable","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Loki"},{"id":477,"kind":1024,"name":"events","url":"classes/loki.html#events","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"Loki"},{"id":478,"kind":1024,"name":"asyncListeners","url":"classes/loki.html#asynclisteners","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected","parent":"Loki"},{"id":479,"kind":2048,"name":"on","url":"classes/loki.html#on","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Loki"},{"id":480,"kind":2048,"name":"emit","url":"classes/loki.html#emit","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Loki"},{"id":481,"kind":2048,"name":"addListener","url":"classes/loki.html#addlistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Loki"},{"id":482,"kind":2048,"name":"removeListener","url":"classes/loki.html#removelistener","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"Loki"},{"id":483,"kind":256,"name":"Options","url":"interfaces/loki.options.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":484,"kind":1024,"name":"env","url":"interfaces/loki.options.html#env","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Options"},{"id":485,"kind":1024,"name":"serializationMethod","url":"interfaces/loki.options.html#serializationmethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Options"},{"id":486,"kind":1024,"name":"destructureDelimiter","url":"interfaces/loki.options.html#destructuredelimiter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Options"},{"id":487,"kind":1024,"name":"verbose","url":"interfaces/loki.options.html#verbose","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Options"},{"id":488,"kind":256,"name":"PersistenceOptions","url":"interfaces/loki.persistenceoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":489,"kind":1024,"name":"adapter","url":"interfaces/loki.persistenceoptions.html#adapter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":490,"kind":1024,"name":"autosave","url":"interfaces/loki.persistenceoptions.html#autosave","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":491,"kind":1024,"name":"autosaveInterval","url":"interfaces/loki.persistenceoptions.html#autosaveinterval","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":492,"kind":1024,"name":"autoload","url":"interfaces/loki.persistenceoptions.html#autoload","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":493,"kind":1024,"name":"throttledSaves","url":"interfaces/loki.persistenceoptions.html#throttledsaves","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":494,"kind":1024,"name":"persistenceMethod","url":"interfaces/loki.persistenceoptions.html#persistencemethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":495,"kind":1024,"name":"inflate","url":"interfaces/loki.persistenceoptions.html#inflate","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.PersistenceOptions"},{"id":496,"kind":256,"name":"CopyOptions","url":"interfaces/loki.copyoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":497,"kind":1024,"name":"removeNonSerializable","url":"interfaces/loki.copyoptions.html#removenonserializable","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.CopyOptions"},{"id":498,"kind":256,"name":"SerializeOptions","url":"interfaces/loki.serializeoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":499,"kind":1024,"name":"serializationMethod","url":"interfaces/loki.serializeoptions.html#serializationmethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.SerializeOptions"},{"id":500,"kind":256,"name":"SerializeDestructuredOptions","url":"interfaces/loki.serializedestructuredoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":501,"kind":1024,"name":"partitioned","url":"interfaces/loki.serializedestructuredoptions.html#partitioned","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.SerializeDestructuredOptions"},{"id":502,"kind":1024,"name":"partition","url":"interfaces/loki.serializedestructuredoptions.html#partition","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.SerializeDestructuredOptions"},{"id":503,"kind":1024,"name":"delimited","url":"interfaces/loki.serializedestructuredoptions.html#delimited","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.SerializeDestructuredOptions"},{"id":504,"kind":1024,"name":"delimiter","url":"interfaces/loki.serializedestructuredoptions.html#delimiter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.SerializeDestructuredOptions"},{"id":505,"kind":256,"name":"DeserializeCollectionOptions","url":"interfaces/loki.deserializecollectionoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":506,"kind":1024,"name":"partitioned","url":"interfaces/loki.deserializecollectionoptions.html#partitioned","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.DeserializeCollectionOptions"},{"id":507,"kind":1024,"name":"delimited","url":"interfaces/loki.deserializecollectionoptions.html#delimited","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.DeserializeCollectionOptions"},{"id":508,"kind":1024,"name":"delimiter","url":"interfaces/loki.deserializecollectionoptions.html#delimiter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.DeserializeCollectionOptions"},{"id":509,"kind":256,"name":"ThrottledDrainOptions","url":"interfaces/loki.throttleddrainoptions.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":510,"kind":1024,"name":"recursiveWait","url":"interfaces/loki.throttleddrainoptions.html#recursivewait","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.ThrottledDrainOptions"},{"id":511,"kind":1024,"name":"recursiveWaitLimit","url":"interfaces/loki.throttleddrainoptions.html#recursivewaitlimit","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.ThrottledDrainOptions"},{"id":512,"kind":1024,"name":"recursiveWaitLimitDuration","url":"interfaces/loki.throttleddrainoptions.html#recursivewaitlimitduration","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.ThrottledDrainOptions"},{"id":513,"kind":1024,"name":"started","url":"interfaces/loki.throttleddrainoptions.html#started","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.ThrottledDrainOptions"},{"id":514,"kind":256,"name":"Serialized","url":"interfaces/loki.serialized.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"Loki"},{"id":515,"kind":1024,"name":"_env","url":"interfaces/loki.serialized.html#_env","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":516,"kind":1024,"name":"_serializationMethod","url":"interfaces/loki.serialized.html#_serializationmethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":517,"kind":1024,"name":"_autosave","url":"interfaces/loki.serialized.html#_autosave","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":518,"kind":1024,"name":"_autosaveInterval","url":"interfaces/loki.serialized.html#_autosaveinterval","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":519,"kind":1024,"name":"_collections","url":"interfaces/loki.serialized.html#_collections","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":520,"kind":1024,"name":"databaseVersion","url":"interfaces/loki.serialized.html#databaseversion","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":521,"kind":1024,"name":"engineVersion","url":"interfaces/loki.serialized.html#engineversion","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":522,"kind":1024,"name":"filename","url":"interfaces/loki.serialized.html#filename","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":523,"kind":1024,"name":"_persistenceAdapter","url":"interfaces/loki.serialized.html#_persistenceadapter","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":524,"kind":1024,"name":"_persistenceMethod","url":"interfaces/loki.serialized.html#_persistencemethod","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":525,"kind":1024,"name":"_throttledSaves","url":"interfaces/loki.serialized.html#_throttledsaves","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":526,"kind":1024,"name":"_verbose","url":"interfaces/loki.serialized.html#_verbose","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Loki.Serialized"},{"id":527,"kind":4194304,"name":"LoadDatabaseOptions","url":"classes/loki.html#loaddatabaseoptions","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Loki"},{"id":528,"kind":4194304,"name":"SerializationMethod","url":"classes/loki.html#serializationmethod","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Loki"},{"id":529,"kind":4194304,"name":"PersistenceMethod","url":"classes/loki.html#persistencemethod","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Loki"},{"id":530,"kind":4194304,"name":"Environment","url":"classes/loki.html#environment","classes":"tsd-kind-type-alias tsd-parent-kind-class tsd-is-static","parent":"Loki"},{"id":531,"kind":256,"name":"StorageAdapter","url":"interfaces/storageadapter.html","classes":"tsd-kind-interface"},{"id":532,"kind":2048,"name":"loadDatabase","url":"interfaces/storageadapter.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"StorageAdapter"},{"id":533,"kind":2048,"name":"saveDatabase","url":"interfaces/storageadapter.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"StorageAdapter"},{"id":534,"kind":2048,"name":"deleteDatabase","url":"interfaces/storageadapter.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"StorageAdapter"},{"id":535,"kind":1024,"name":"mode","url":"interfaces/storageadapter.html#mode","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"StorageAdapter"},{"id":536,"kind":2048,"name":"exportDatabase","url":"interfaces/storageadapter.html#exportdatabase","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"StorageAdapter"},{"id":537,"kind":256,"name":"Dict","url":"interfaces/dict.html","classes":"tsd-kind-interface tsd-has-type-parameter"},{"id":538,"kind":4194304,"name":"Doc","url":"globals.html#doc","classes":"tsd-kind-type-alias"},{"id":539,"kind":128,"name":"FSStorage","url":"classes/fsstorage.html","classes":"tsd-kind-class"},{"id":540,"kind":2048,"name":"register","url":"classes/fsstorage.html#register","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"FSStorage"},{"id":541,"kind":2048,"name":"deregister","url":"classes/fsstorage.html#deregister","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"FSStorage"},{"id":542,"kind":2048,"name":"loadDatabase","url":"classes/fsstorage.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FSStorage"},{"id":543,"kind":2048,"name":"saveDatabase","url":"classes/fsstorage.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FSStorage"},{"id":544,"kind":2048,"name":"deleteDatabase","url":"classes/fsstorage.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"FSStorage"},{"id":545,"kind":128,"name":"Among","url":"classes/among.html","classes":"tsd-kind-class"},{"id":546,"kind":1024,"name":"s_size","url":"classes/among.html#s_size","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Among"},{"id":547,"kind":1024,"name":"s","url":"classes/among.html#s","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Among"},{"id":548,"kind":1024,"name":"substring_i","url":"classes/among.html#substring_i","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Among"},{"id":549,"kind":1024,"name":"result","url":"classes/among.html#result","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Among"},{"id":550,"kind":1024,"name":"method","url":"classes/among.html#method","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Among"},{"id":551,"kind":512,"name":"constructor","url":"classes/among.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"Among"},{"id":552,"kind":128,"name":"SnowballProgram","url":"classes/snowballprogram.html","classes":"tsd-kind-class"},{"id":553,"kind":1024,"name":"current","url":"classes/snowballprogram.html#current","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":554,"kind":1024,"name":"bra","url":"classes/snowballprogram.html#bra","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":555,"kind":1024,"name":"ket","url":"classes/snowballprogram.html#ket","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":556,"kind":1024,"name":"limit","url":"classes/snowballprogram.html#limit","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":557,"kind":1024,"name":"cursor","url":"classes/snowballprogram.html#cursor","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":558,"kind":1024,"name":"limit_backward","url":"classes/snowballprogram.html#limit_backward","classes":"tsd-kind-property tsd-parent-kind-class","parent":"SnowballProgram"},{"id":559,"kind":512,"name":"constructor","url":"classes/snowballprogram.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"SnowballProgram"},{"id":560,"kind":2048,"name":"setCurrent","url":"classes/snowballprogram.html#setcurrent","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":561,"kind":2048,"name":"getCurrent","url":"classes/snowballprogram.html#getcurrent","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":562,"kind":2048,"name":"in_grouping","url":"classes/snowballprogram.html#in_grouping","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":563,"kind":2048,"name":"in_grouping_b","url":"classes/snowballprogram.html#in_grouping_b","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":564,"kind":2048,"name":"out_grouping","url":"classes/snowballprogram.html#out_grouping","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":565,"kind":2048,"name":"out_grouping_b","url":"classes/snowballprogram.html#out_grouping_b","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":566,"kind":2048,"name":"eq_s","url":"classes/snowballprogram.html#eq_s","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":567,"kind":2048,"name":"eq_s_b","url":"classes/snowballprogram.html#eq_s_b","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":568,"kind":2048,"name":"find_among","url":"classes/snowballprogram.html#find_among","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":569,"kind":2048,"name":"find_among_b","url":"classes/snowballprogram.html#find_among_b","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":570,"kind":2048,"name":"replace_s","url":"classes/snowballprogram.html#replace_s","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":571,"kind":2048,"name":"slice_check","url":"classes/snowballprogram.html#slice_check","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":572,"kind":2048,"name":"slice_from","url":"classes/snowballprogram.html#slice_from","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":573,"kind":2048,"name":"slice_del","url":"classes/snowballprogram.html#slice_del","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":574,"kind":2048,"name":"insert","url":"classes/snowballprogram.html#insert","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":575,"kind":2048,"name":"slice_to","url":"classes/snowballprogram.html#slice_to","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":576,"kind":2048,"name":"eq_v_b","url":"classes/snowballprogram.html#eq_v_b","classes":"tsd-kind-method tsd-parent-kind-class","parent":"SnowballProgram"},{"id":577,"kind":64,"name":"generateTrimmer","url":"globals.html#generatetrimmer","classes":"tsd-kind-function"},{"id":578,"kind":64,"name":"generateStopWordFilter","url":"globals.html#generatestopwordfilter","classes":"tsd-kind-function"},{"id":579,"kind":32,"name":"DE","url":"globals.html#de","classes":"tsd-kind-variable"},{"id":580,"kind":32,"name":"EN","url":"globals.html#en","classes":"tsd-kind-variable"},{"id":581,"kind":128,"name":"IndexedStorage","url":"classes/indexedstorage.html","classes":"tsd-kind-class"},{"id":582,"kind":2048,"name":"register","url":"classes/indexedstorage.html#register","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"IndexedStorage"},{"id":583,"kind":2048,"name":"deregister","url":"classes/indexedstorage.html#deregister","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"IndexedStorage"},{"id":584,"kind":512,"name":"constructor","url":"classes/indexedstorage.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"IndexedStorage"},{"id":585,"kind":2048,"name":"loadDatabase","url":"classes/indexedstorage.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"IndexedStorage"},{"id":586,"kind":2048,"name":"saveDatabase","url":"classes/indexedstorage.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"IndexedStorage"},{"id":587,"kind":2048,"name":"deleteDatabase","url":"classes/indexedstorage.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"IndexedStorage"},{"id":588,"kind":2048,"name":"deleteDatabasePartitions","url":"classes/indexedstorage.html#deletedatabasepartitions","classes":"tsd-kind-method tsd-parent-kind-class","parent":"IndexedStorage"},{"id":589,"kind":2048,"name":"getDatabaseList","url":"classes/indexedstorage.html#getdatabaselist","classes":"tsd-kind-method tsd-parent-kind-class","parent":"IndexedStorage"},{"id":590,"kind":2048,"name":"getCatalogSummary","url":"classes/indexedstorage.html#getcatalogsummary","classes":"tsd-kind-method tsd-parent-kind-class","parent":"IndexedStorage"},{"id":591,"kind":256,"name":"Entry","url":"interfaces/entry.html","classes":"tsd-kind-interface"},{"id":592,"kind":1024,"name":"app","url":"interfaces/entry.html#app","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Entry"},{"id":593,"kind":1024,"name":"key","url":"interfaces/entry.html#key","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Entry"},{"id":594,"kind":1024,"name":"size","url":"interfaces/entry.html#size","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"Entry"},{"id":595,"kind":128,"name":"LocalStorage","url":"classes/localstorage.html","classes":"tsd-kind-class"},{"id":596,"kind":2048,"name":"register","url":"classes/localstorage.html#register","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"LocalStorage"},{"id":597,"kind":2048,"name":"deregister","url":"classes/localstorage.html#deregister","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"LocalStorage"},{"id":598,"kind":2048,"name":"loadDatabase","url":"classes/localstorage.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LocalStorage"},{"id":599,"kind":2048,"name":"saveDatabase","url":"classes/localstorage.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LocalStorage"},{"id":600,"kind":2048,"name":"deleteDatabase","url":"classes/localstorage.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"LocalStorage"},{"id":601,"kind":128,"name":"MemoryStorage","url":"classes/memorystorage.html","classes":"tsd-kind-class"},{"id":602,"kind":1024,"name":"hashStore","url":"classes/memorystorage.html#hashstore","classes":"tsd-kind-property tsd-parent-kind-class","parent":"MemoryStorage"},{"id":603,"kind":1024,"name":"options","url":"classes/memorystorage.html#options-1","classes":"tsd-kind-property tsd-parent-kind-class","parent":"MemoryStorage"},{"id":604,"kind":2048,"name":"register","url":"classes/memorystorage.html#register","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"MemoryStorage"},{"id":605,"kind":2048,"name":"deregister","url":"classes/memorystorage.html#deregister","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"MemoryStorage"},{"id":606,"kind":512,"name":"constructor","url":"classes/memorystorage.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"MemoryStorage"},{"id":607,"kind":2048,"name":"loadDatabase","url":"classes/memorystorage.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MemoryStorage"},{"id":608,"kind":2048,"name":"saveDatabase","url":"classes/memorystorage.html#savedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MemoryStorage"},{"id":609,"kind":2048,"name":"deleteDatabase","url":"classes/memorystorage.html#deletedatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"MemoryStorage"},{"id":610,"kind":256,"name":"Options","url":"interfaces/memorystorage.options.html","classes":"tsd-kind-interface tsd-parent-kind-class","parent":"MemoryStorage"},{"id":611,"kind":1024,"name":"asyncResponses","url":"interfaces/memorystorage.options.html#asyncresponses","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MemoryStorage.Options"},{"id":612,"kind":1024,"name":"asyncTimeout","url":"interfaces/memorystorage.options.html#asynctimeout","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"MemoryStorage.Options"},{"id":613,"kind":128,"name":"PartitioningAdapter","url":"classes/partitioningadapter.html","classes":"tsd-kind-class"},{"id":614,"kind":1024,"name":"mode","url":"classes/partitioningadapter.html#mode","classes":"tsd-kind-property tsd-parent-kind-class","parent":"PartitioningAdapter"},{"id":615,"kind":2048,"name":"register","url":"classes/partitioningadapter.html#register","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"PartitioningAdapter"},{"id":616,"kind":2048,"name":"deregister","url":"classes/partitioningadapter.html#deregister","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"PartitioningAdapter"},{"id":617,"kind":512,"name":"constructor","url":"classes/partitioningadapter.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"PartitioningAdapter"},{"id":618,"kind":2048,"name":"loadDatabase","url":"classes/partitioningadapter.html#loaddatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"PartitioningAdapter"},{"id":619,"kind":2048,"name":"exportDatabase","url":"classes/partitioningadapter.html#exportdatabase","classes":"tsd-kind-method tsd-parent-kind-class","parent":"PartitioningAdapter"}]}; \ No newline at end of file diff --git a/docs/api/classes/among.html b/docs/api/classes/among.html index 1e64f471..b0efcbe4 100644 --- a/docs/api/classes/among.html +++ b/docs/api/classes/among.html @@ -107,7 +107,7 @@

constructor

  • Parameters

    @@ -138,7 +138,7 @@

    method

    method: any
    @@ -148,7 +148,7 @@

    result

    result: number
    @@ -158,7 +158,7 @@

    s

    s: number[]
    @@ -168,7 +168,7 @@

    s_size

    s_size: number
    @@ -178,7 +178,7 @@

    substring_i

    substring_i: number
    diff --git a/docs/api/classes/collection.html b/docs/api/classes/collection.html index d29efe0b..fa2cd212 100644 --- a/docs/api/classes/collection.html +++ b/docs/api/classes/collection.html @@ -57,7 +57,7 @@ Collection
  • -

    Class Collection<E>

    +

    Class Collection<TData, TNested>

    @@ -80,7 +80,20 @@

    Class Collection<E>

    Type parameters

    • -

      E: any

      +

      TData: any

      +
      +
      +

      the data type

      +
      +
      +
    • +
    • +

      TNested: any

      +
      +
      +

      nested properties of data type

      +
      +
    @@ -105,14 +118,17 @@

    Index

    Interfaces

    Type aliases

    @@ -124,6 +140,7 @@

    Constructors

    Properties

    Methods

    -
    -

    Object literals

    - -

    Type aliases

    - -

    Static Change

    -
    Change: any
    + +

    Static Transform

    +
    Transform: object | object | object | object | object | object | object | object | object | object | object | object | object
    @@ -239,14 +248,14 @@

    Constructors

    constructor

    Returns Collection

    @@ -277,13 +286,23 @@

    Returns

    Properties

    +
    + +

    _data

    +
    _data: Doc<TData>[]
    + +

    _fullTextSearch

    _fullTextSearch: FullTextSearch
    @@ -293,7 +312,7 @@

    adaptiveBinaryIndices

    adaptiveBinaryIndices: boolean
    @@ -310,7 +329,7 @@

    Protected asyncListeners
    @@ -323,20 +342,25 @@

    Protected asyncListeners

    binaryIndices

    -
    binaryIndices: Dict<BinaryIndex>
    +
    binaryIndices: object
    +
    +

    Type declaration

    +
      +
    +

    cloneMethod

    -
    cloneMethod: CloneMethod
    +
    cloneMethod: CloneMethod
    @@ -351,7 +375,7 @@

    cloneObjects

    cloneObjects: boolean
    @@ -363,22 +387,38 @@

    cloneObjects

    console

    -
    console: ANY
    +
    console: object
    +
    +

    Type declaration

    +
      +
    +
    - -

    data

    -
    data: Doc<E>[]
    + +

    constraints

    +
    constraints: object
    +
    +
    +

    Unique constraints contain duplicate object references, so they are not persisted. + We will keep track of properties which have unique constraints applied here, and regenerate on load.

    +
    +
    +
    +

    Type declaration

    +
      +
    +
    @@ -386,7 +426,7 @@

    dirty

    dirty: boolean
    @@ -400,10 +440,10 @@

    dirty

    disableDeltaChangesApi

    -
    disableDeltaChangesApi: ANY
    +
    disableDeltaChangesApi: boolean
    @@ -419,7 +459,7 @@

    Protected events

    @@ -434,17 +474,17 @@

    name

    name: string

    transforms

    -
    transforms: __type
    +
    transforms: Dict<Transform<TData, TNested>[]>
    @@ -455,12 +495,12 @@

    transforms

    - +

    ttl

    -
    ttl: ANY
    +
    ttl: TTL
    @@ -472,17 +512,39 @@

    ttl

    Methods

    +
    + +

    _prepareFullDocIndex

    +
      +
    • _prepareFullDocIndex(): number[]
    • +
    +
      +
    • + +
      +
      +

      create a row filter that covers all documents in the collection

      +
      +
      +

      Returns number[]

      +
    • +
    +

    adaptiveBinaryIndexInsert

      -
    • adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: string): void
    • +
    • adaptiveBinaryIndexInsert(dataPosition: number, binaryIndexName: keyof TData): void
    • @@ -499,7 +561,7 @@
      dataPosition: number
    • -
      binaryIndexName: string
      +
      binaryIndexName: keyof TData

      : index to search for dataPosition in

      @@ -513,13 +575,13 @@

      Returns void

      adaptiveBinaryIndexRemove

        -
      • adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: string, removedFromIndexOnly?: boolean): ANY
      • +
      • adaptiveBinaryIndexRemove(dataPosition: number, binaryIndexName: keyof TData, removedFromIndexOnly?: boolean): void
      • @@ -536,16 +598,19 @@
        dataPosition: number
      • -
        binaryIndexName: string
        +
        binaryIndexName: keyof TData

        : index to search for dataPosition in

      • Default value removedFromIndexOnly: boolean = false
        +
        +

        remove from index only

        +
      -

      Returns ANY

      +

      Returns void

    @@ -553,13 +618,13 @@

    Returns ANY

    adaptiveBinaryIndexUpdate

      -
    • adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: string): void
    • +
    • adaptiveBinaryIndexUpdate(dataPosition: number, binaryIndexName: keyof TData): void
    • @@ -576,7 +641,7 @@
      dataPosition: number
    • -
      binaryIndexName: string
      +
      binaryIndexName: keyof TData

      : index to search for dataPosition in

      @@ -590,13 +655,13 @@

      Returns void

      addDynamicView

      @@ -635,7 +700,7 @@

      addListener

      @@ -668,13 +733,13 @@

      Returns Function<

      addTransform

        -
      • addTransform(name: string, transform: ANY[]): void
      • +
      • addTransform(name: string, transform: Transform<TData, TNested>[]): void
      @@ -775,19 +840,19 @@

      Returns

      calculateRange

        -
      • calculateRange(op: string, prop: string, val: ANY): [number, number]
      • +
      • calculateRange(op: string, prop: keyof TData, val: any): [number, number]
      • Binary Search utility method to find range/segment of values matching criteria. - this is used for collection.find() and first find filter of resultset/dynview + this is used for collection.find() and first find filter of ResultSet/dynview slightly different than get() binary search in that get() hones in on 1 value, but we have to hone in on many (range)

        @@ -801,13 +866,13 @@
        op: string
      • -
        prop: string
        +
        prop: keyof TData

        name of property to calculate range for

      • -
        val: ANY
        +
        val: any

        value to use for range calculation.

        @@ -822,13 +887,13 @@

        Returns [

        chain

          -
        • chain(transform?: string | ANY[], parameters?: ANY): Resultset<E>
        • +
        • chain(transform?: string | Transform<TData, TNested>[], parameters?: object): ResultSet<TData, TNested>
        • @@ -840,20 +905,20 @@

          chain

          Parameters

          • -
            Optional transform: string | ANY[]
            +
            Optional transform: string | Transform<TData, TNested>[]

            Ordered array of transform step objects similar to chain

          • -
            Optional parameters: ANY
            +
            Optional parameters: object

            Object containing properties representing parameters to substitute

          -

          Returns Resultset<E>

          -

          (this) resultset, or data array if any map or join functions where called

          +

          Returns ResultSet<TData, TNested>

          +

          (this) ResultSet, or data array if any map or join functions where called

    @@ -861,13 +926,13 @@

    Returns

    clear

      -
    • clear(options?: ANY): void
    • +
    • clear(__namedParameters?: object): void
    -
    - -

    ensureId

    -
      -
    • ensureId(): void
    • -
    - -

    ensureIndex

      -
    • ensureIndex(property: string, force?: boolean): void
    • +
    • ensureIndex(property: keyof TData, force?: boolean): void
    @@ -1133,13 +1172,13 @@

    Returns

    eqJoin

      -
    • eqJoin(joinData: ANY[], leftJoinProp: string, rightJoinProp: string, mapFun?: Function): Resultset
    • +
    • eqJoin(joinData: Collection<any> | ResultSet<any> | any[], leftJoinProp: string | function, rightJoinProp: string | function, mapFun?: function, dataOptions?: DataOptions): ResultSet<any>
    • @@ -1150,31 +1189,58 @@

      eqJoin

      Parameters

      • -
        joinData: ANY[]
        +
        joinData: Collection<any> | ResultSet<any> | any[]

        array of documents to 'join' to this collection

      • -
        leftJoinProp: string
        +
        leftJoinProp: string | function

        property name in collection

      • -
        rightJoinProp: string
        +
        rightJoinProp: string | function

        property name in joinData

      • -
        Optional mapFun: Function
        +
        Optional mapFun: function

        (Optional) map function to use

        +
          +
        • +
            +
          • (left: any, right: any): any
          • +
          +
            +
          • +

            Parameters

            +
              +
            • +
              left: any
              +
            • +
            • +
              right: any
              +
            • +
            +

            Returns any

            +
          • +
          +
        • +
        +
      • +
      • +
        Optional dataOptions: DataOptions
        +
        +

        options to data() before input to your map function

        +
      -

      Returns Resultset

      +

      Returns ResultSet<any>

      Result of the mapping operation

    @@ -1189,7 +1255,7 @@

    extract

  • Parameters

    @@ -1212,7 +1278,7 @@

    extractNumerical

  • Parameters

    @@ -1229,13 +1295,13 @@

    Returns number

    find

      -
    • find(query?: Query): Doc<E>[]
    • +
    • find(query?: Query<Doc<TData> & TNested>): Doc<TData>[]
    @@ -1267,13 +1333,13 @@

    Returns

    findAndRemove

      -
    • findAndRemove(filterObject: object): void
    • +
    • findAndRemove(filterObject: Query<Doc<TData> & TNested>): void
    • @@ -1284,7 +1350,7 @@

      findAndRemove

      Parameters

      • -
        filterObject: object
        +
        filterObject: Query<Doc<TData> & TNested>

        'mongo-like' query object

        @@ -1298,13 +1364,13 @@

        Returns void

        findAndUpdate

          -
        • findAndUpdate(filterObject: Query | function, updateFunction: function): void
        • +
        • findAndUpdate(filterObject: Query<Doc<TData> & TNested> | function, updateFunction: function): void
        • @@ -1317,7 +1383,7 @@

          findAndUpdate

          Parameters

          @@ -1538,13 +1604,13 @@

          Returns

          getBinaryIndexPosition

            -
          • getBinaryIndexPosition(dataPosition: number, binaryIndexName: string): number
          • +
          • getBinaryIndexPosition(dataPosition: number, binaryIndexName: keyof TData): number
          -

          Returns any[]

          +

          Returns Change[]

  • @@ -1599,13 +1665,13 @@

    Returns any

    getDynamicView

    -

    Returns DynamicView<E>

    +

    Returns DynamicView<TData, TNested>

    A reference to the dynamic view with that name

    @@ -1631,19 +1697,19 @@

    Returns

    getSequencedIndexValues

      -
    • getSequencedIndexValues(property: string): string
    • +
    • getSequencedIndexValues(property: keyof TData): string

    @@ -1713,14 +1779,14 @@

    Returns any

    insert

      -
    • insert(doc: E | E[]): Doc<E>
    • -
    • insert(doc: E[]): Doc<E>[]
    • +
    • insert(doc: TData): Doc<TData>
    • +
    • insert(doc: TData[]): Doc<TData>[]
    @@ -1760,13 +1826,13 @@

    Returns

    insertOne

      -
    • insertOne(doc: E, bulkInsert?: boolean): Doc<E>
    • +
    • insertOne(doc: TData, bulkInsert?: boolean): Doc<TData>
    -

    Returns Doc<E>

    +

    Returns Doc<TData>

    document or 'undefined' if there was a problem inserting it

    @@ -1804,7 +1870,7 @@

    mapReduce

  • @@ -1831,20 +1897,20 @@
    mapFunction: function
    @@ -1992,7 +2058,7 @@

    minRecord

  • Parameters

    @@ -2017,7 +2083,7 @@

    mode

  • @@ -2045,7 +2111,7 @@

    on

    @@ -2073,39 +2139,17 @@

    Returns Function<

  • -
    - -

    prepareFullDocIndex

    -
      -
    • prepareFullDocIndex(): any[]
    • -
    -
      -
    • - -
      -
      -

      create a row filter that covers all documents in the collection

      -
      -
      -

      Returns any[]

      -
    • -
    -

    remove

      -
    • remove(doc: ANY): any
    • +
    • remove(doc: number | Doc<TData> | Doc<TData>[]): void
    @@ -2136,7 +2180,7 @@

    removeDataOnly

  • Returns void

    @@ -2153,7 +2197,7 @@

    removeDynamicView

  • @@ -2185,7 +2229,7 @@

    removeListener

    @@ -2222,7 +2266,7 @@

    removeTransform

  • @@ -2247,13 +2291,13 @@

    Returns void

    removeWhere

      -
    • removeWhere(query: Query | function): void
    • +
    • removeWhere(query: Query<Doc<TData> & TNested> | function): void
    -

    Returns DynamicView<E>

    +

    Returns this

    This dynamic view for further chained ops.

  • @@ -361,7 +399,7 @@

    _removeDocument

  • @@ -390,7 +428,7 @@

    addListener

    @@ -423,13 +461,13 @@

    Returns Function<

    applyFilter

    • @@ -440,14 +478,14 @@

      applyFilter

      Parameters

      • -
        filter: Filter<E>
        +
        filter: Filter<TData, TNested>

        A filter object to add to the pipeline. The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id }

      -

      Returns DynamicView<E>

      +

      Returns this

      this DynamicView object, for further chain ops.

    @@ -456,13 +494,13 @@

    Returns

    applyFind

      -
    • applyFind(query: object, uid?: string | number): DynamicView<E>
    • +
    • applyFind(query: object, uid?: string | number): this
    -

    Returns DynamicView<E>

    +

    Returns this

    this DynamicView object, for further chain ops.

  • @@ -494,13 +532,13 @@

    Returns

    applySimpleSort

      -
    • applySimpleSort(propname: string, isdesc?: boolean): DynamicView<E>
    • +
    • applySimpleSort(propname: keyof (TData & TNested), isdesc?: boolean): this
    • @@ -516,7 +554,7 @@

      applySimpleSort

      Parameters

      • -
        propname: string
        +
        propname: keyof (TData & TNested)

        Name of property by which to sort.

        @@ -528,7 +566,7 @@
        Optional isdesc: Returns DynamicView<E>
        +

        Returns this

        this DynamicView object, for further chain ops.

      @@ -537,13 +575,13 @@

      Returns

      applySort

        -
      • applySort(comparefun: function): DynamicView<E>
      • +
      • applySort(comparefun: function): this
      @@ -627,18 +665,18 @@

      Returns

      applySortCriteria

        -
      • applySortCriteria(criteria: (string | Object)[]): DynamicView<E>
      • +
      • applySortCriteria(criteria: (keyof (TData & TNested) | Object)[]): this
      • -

        Allows sorting a resultset based on multiple columns.

        +

        Allows sorting a ResultSet based on multiple columns.

        example
        @@ -654,13 +692,13 @@

        applySortCriteria

        Parameters

        • -
          criteria: (string | Object)[]
          +
          criteria: (keyof (TData & TNested) | Object)[]

          array of property names or subarray of [propertyname, isdesc] used evaluate sort order

        -

        Returns DynamicView<E>

        +

        Returns this

        Reference to this DynamicView, sorted, for future chain operations.

      @@ -669,13 +707,13 @@

      Returns

      applyWhere

        -
      • applyWhere(fun: function, uid?: string | number): DynamicView<E>
      • +
      • applyWhere(fun: function, uid?: string | number): this
      • @@ -693,14 +731,14 @@
        fun: function
          • -
          • (obj: E): boolean
          • +
          • (obj: Doc<TData>): boolean
          • Parameters

            • -
              obj: E
              +
              obj: Doc<TData>

            Returns boolean

            @@ -716,35 +754,35 @@
            Optional uid: Returns DynamicView<E>
            +

            Returns this

            this DynamicView object, for further chain ops.

          -

          branchResultset

          +

          branchResultSet

            -
          • branchResultset(transform: string | any[], parameters?: object): Resultset<E>
          • +
          • branchResultSet(transform?: string | Transform<TData, TNested>[], parameters?: object): ResultSet<TData, TNested>
          • -

            Makes a copy of the internal resultset for branched queries. - Unlike this dynamic view, the branched resultset will not be 'live' updated, +

            Makes a copy of the internal ResultSet for branched queries. + Unlike this dynamic view, the branched ResultSet will not be 'live' updated, so your branched query should be immediately resolved and not held for future evaluation.

            Parameters

            • -
              transform: string | any[]
              +
              Optional transform: string | Transform<TData, TNested>[]

              Optional name of collection transform, or an array of transform steps

              @@ -756,8 +794,8 @@
              Optional parameters:
            -

            Returns Resultset<E>

            -

            A copy of the internal resultset for branched queries.

            +

            Returns ResultSet<TData, TNested>

            +

            A copy of the internal ResultSet for branched queries.

          @@ -765,13 +803,13 @@

          Returns

          commit

        -

        Returns DynamicView<E>

        +

        Returns this

        this DynamicView object, for further chain ops.

      @@ -794,7 +832,7 @@

      count

    • @@ -811,13 +849,13 @@

      Returns number

      data

      • @@ -828,13 +866,13 @@

        data

        Parameters

        • -
          Default value options: object = {}
          +
          Default value options: DataOptions = {}
          -

          optional parameters to pass to resultset.data() if non-persistent

          +

          optional parameters to pass to ResultSet.data() if non-persistent

        -

        Returns Doc<E>[]

        +

        Returns Doc<TData>[]

        An array of documents representing the current DynamicView contents.

      @@ -843,14 +881,14 @@

      Returns

      emit

        -
      • emit(eventName: string, ...data: ANY[]): void
      • +
      • emit(eventName: string, ...data: any[]): void

      -

      Returns ScoreResult

      +

      Returns ScoreResult

    @@ -911,7 +949,7 @@

    mapReduce

  • @@ -938,20 +976,20 @@
    mapFunction: function
    @@ -1180,13 +1218,13 @@

    Returns

    startTransaction

      -
    • startTransaction(): DynamicView<E>
    • +
    • startTransaction(): this
    -

    Returns DynamicView<E>

    +

    Returns this

    this DynamicView object, for further chain ops.

  • @@ -1203,23 +1241,21 @@

    Returns

    toJSON

    @@ -1227,22 +1263,22 @@

    Returns object

    Static fromJSONObject

    @@ -253,7 +248,7 @@

    toJSON

  • Returns Serialization

    @@ -270,7 +265,7 @@

    updateDocument

  • Parameters

    @@ -296,7 +291,7 @@

    Static fromJSONObject

  • Parameters

    @@ -322,7 +317,7 @@

    Static register

  • diff --git a/docs/api/classes/loki.html b/docs/api/classes/loki.html index 9af2f255..d3df42d2 100644 --- a/docs/api/classes/loki.html +++ b/docs/api/classes/loki.html @@ -81,14 +81,6 @@

    Hierarchy

    Index

    -
    -

    Enumerations

    - -

    Interfaces

    Type aliases

    @@ -146,7 +142,7 @@

    Methods

  • on
  • removeCollection
  • removeListener
  • -
  • renameCollection
  • +
  • renameCollection
  • saveDatabase
  • serialize
  • serializeChanges
  • @@ -161,13 +157,43 @@

    Methods

    Type aliases

    +
    + +

    Static Environment

    +
    Environment: "NATIVESCRIPT" | "NODEJS" | "CORDOVA" | "BROWSER" | "MEMORY"
    + +

    Static LoadDatabaseOptions

    +
    +
    + +

    Static PersistenceMethod

    +
    PersistenceMethod: "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter"
    + +
    +
    + +

    Static SerializationMethod

    +
    SerializationMethod: "normal" | "pretty" | "destructured"
    +
    @@ -185,7 +211,7 @@

    constructor

    @@ -221,7 +247,7 @@

    Protected asyncListeners
    @@ -238,7 +264,7 @@

    Protected events

    @@ -254,13 +280,13 @@

    Methods

    addCollection

    Parameters

      @@ -283,10 +312,10 @@
      name: string

  • -
    Default value options: Options = {}
    +
    Default value options: Options<T> = {}
  • -

    Returns Collection<T>

    +

    Returns Collection<T, U>

    a reference to the collection which was just added

    @@ -302,7 +331,7 @@

    addListener

    @@ -341,7 +370,7 @@

    autosaveDisable

  • @@ -363,7 +392,7 @@

    autosaveEnable

  • @@ -385,7 +414,7 @@

    clearChanges

  • @@ -407,7 +436,7 @@

    close

  • @@ -431,7 +460,7 @@

    copy

  • @@ -462,7 +491,7 @@

    deleteDatabase

  • @@ -479,13 +508,13 @@

    Returns Promise

    deserializeCollection

    -

    Returns T - & - object -

    +

    Returns Doc<T>[]

    an array of documents to attach to collection.data.

  • @@ -526,13 +552,13 @@

    Returns T

    deserializeDestructured

    @@ -1026,7 +1076,7 @@

    saveDatabase

  • @@ -1052,7 +1102,7 @@

    serialize

  • @@ -1084,7 +1134,7 @@

    serializeChanges

  • @@ -1107,13 +1157,13 @@

    Returns string

    serializeCollection

      -
    • serializeCollection(options?: ANY): string | string[]
    • +
    • serializeCollection(options?: object): string | string[]
    • @@ -1124,10 +1174,12 @@

      serializeCollection

      Parameters

      • -
        Default value options: ANY = {}
        +
        Default value options: object = {}

        used to determine output of method

        +
          +

      Returns string @@ -1148,7 +1200,7 @@

      serializeDestructured

    • @@ -1186,7 +1238,7 @@

      throttledSaveDrain

    • @@ -1212,18 +1264,16 @@

      Returns Promise

      toJSON

      @@ -1244,15 +1294,6 @@

      Returns object Loki
        -
      • - Environment -
      • -
      • - PersistenceMethod -
      • -
      • - SerializationMethod -
      • CopyOptions
      • @@ -1271,12 +1312,24 @@

        Returns object SerializeOptions +
      • + Serialized +
      • ThrottledDrainOptions
      • +
      • + Environment +
      • LoadDatabaseOptions
      • +
      • + PersistenceMethod +
      • +
      • + SerializationMethod +
      • constructor
      • @@ -1355,7 +1408,7 @@

        Returns object removeListener -
      • +
      • renameCollection
      • diff --git a/docs/api/classes/lokieventemitter.html b/docs/api/classes/lokieventemitter.html index 0d3980d7..4644313d 100644 --- a/docs/api/classes/lokieventemitter.html +++ b/docs/api/classes/lokieventemitter.html @@ -138,7 +138,7 @@

        constructor

      • Returns LokiEventEmitter

        @@ -154,7 +154,7 @@

        Protected asyncListeners
        asyncListeners: boolean
        @@ -170,7 +170,7 @@

        Protected events

        events: object
        @@ -192,7 +192,7 @@

        addListener

      • @@ -225,13 +225,13 @@

        Returns Function<

        emit

          -
        • emit(eventName: string, ...data: ANY[]): void
        • +
        • emit(eventName: string, ...data: any[]): void
        • @@ -250,7 +250,7 @@
          eventName: string
        • -
          Rest ...data: ANY[]
          +
          Rest ...data: any[]

          optional object passed with the event

          @@ -270,7 +270,7 @@

          on

        • @@ -308,7 +308,7 @@

          removeListener

        • diff --git a/docs/api/classes/lokifsstorage.html b/docs/api/classes/lokifsstorage.html deleted file mode 100644 index 8049e794..00000000 --- a/docs/api/classes/lokifsstorage.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - LokiFSStorage | @lokijs/lokijs-src - - - - - -
          -
          -
          -
          - -
          -
          - Options -
          -
          - All -
            -
          • Public
          • -
          • Public/Protected
          • -
          • All
          • -
          -
          - - - - -
          -
          - Menu -
          -
          -
          -
          -
          -
          - -

          Class LokiFSStorage

          -
          -
          -
          -
          -
          -
          -
          -
          -
          -

          A loki persistence adapter which persists using node fs module.

          -
          -
          -
          -
          -

          Hierarchy

          -
            -
          • - LokiFSStorage -
          • -
          -
          -
          -

          Implements

          - -
          -
          -

          Index

          -
          - -
          -
          -
          -

          Methods

          -
          - -

          deleteDatabase

          -
            -
          • deleteDatabase(dbname: string): Promise<void>
          • -
          -
            -
          • - -
            -
            -

            Delete the database file, will throw an error if the - file can't be deleted

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              the filename of the database to delete

              -
              -
            • -
            -

            Returns Promise<void>

            -

            a Promise that resolves after the database was deleted

            -
          • -
          -
          -
          - -

          loadDatabase

          -
            -
          • loadDatabase(dbname: string): Promise<any>
          • -
          -
            -
          • - -
            -
            -

            Load data from file, will throw an error if the file does not exist

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              the filename of the database to load

              -
              -
            • -
            -

            Returns Promise<any>

            -

            a Promise that resolves after the database was loaded

            -
          • -
          -
          -
          - -

          saveDatabase

          -
            -
          • saveDatabase(dbname: string, dbstring: string): Promise<void>
          • -
          -
            -
          • - -
            -
            -

            Save data to file, will throw an error if the file can't be saved - might want to expand this to avoid dataloss on partial save

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              the filename of the database to load

              -
              -
            • -
            • -
              dbstring: string
              -
            • -
            -

            Returns Promise<void>

            -

            a Promise that resolves after the database was persisted

            -
          • -
          -
          -
          - -

          Static deregister

          -
            -
          • deregister(): void
          • -
          - -
          -
          - -

          Static register

          -
            -
          • register(): void
          • -
          - -
          -
          -
          - -
          -
          -
          -
          -

          Legend

          -
          -
            -
          • Module
          • -
          • Object literal
          • -
          • Variable
          • -
          • Function
          • -
          • Function with type parameter
          • -
          • Index signature
          • -
          • Type alias
          • -
          -
            -
          • Enumeration
          • -
          • Enumeration member
          • -
          • Property
          • -
          • Method
          • -
          -
            -
          • Interface
          • -
          • Interface with type parameter
          • -
          • Constructor
          • -
          • Property
          • -
          • Method
          • -
          • Index signature
          • -
          -
            -
          • Class
          • -
          • Class with type parameter
          • -
          • Constructor
          • -
          • Property
          • -
          • Method
          • -
          • Accessor
          • -
          • Index signature
          • -
          -
            -
          • Inherited constructor
          • -
          • Inherited property
          • -
          • Inherited method
          • -
          • Inherited accessor
          • -
          -
            -
          • Protected property
          • -
          • Protected method
          • -
          • Protected accessor
          • -
          -
            -
          • Private property
          • -
          • Private method
          • -
          • Private accessor
          • -
          -
            -
          • Static property
          • -
          • Static method
          • -
          -
          -
          -
          -
          -

          Generated using TypeDoc

          -
          -
          - - - - \ No newline at end of file diff --git a/docs/api/classes/lokiindexedstorage.html b/docs/api/classes/lokiindexedstorage.html deleted file mode 100644 index f23c6985..00000000 --- a/docs/api/classes/lokiindexedstorage.html +++ /dev/null @@ -1,585 +0,0 @@ - - - - - - LokiIndexedStorage | @lokijs/lokijs-src - - - - - -
          -
          -
          -
          - -
          -
          - Options -
          -
          - All -
            -
          • Public
          • -
          • Public/Protected
          • -
          • All
          • -
          -
          - - - - -
          -
          - Menu -
          -
          -
          -
          -
          -
          - -

          Class LokiIndexedStorage

          -
          -
          -
          -
          -
          -
          -
          -
          -
          -

          Loki persistence adapter class for indexedDb. - This class fulfills abstract adapter interface which can be applied to other storage methods. - Utilizes the included LokiCatalog app/key/value database for actual database persistence. - IndexedDb storage is provided per-domain, so we implement app/key/value database to - allow separate contexts for separate apps within a domain.

          -
          -
          -
          -
          -

          Hierarchy

          -
            -
          • - LokiIndexedStorage -
          • -
          -
          -
          -

          Implements

          - -
          -
          -

          Index

          -
          - -
          -
          -
          -

          Constructors

          -
          - -

          constructor

          - - -
          -
          -
          -

          Methods

          -
          - -

          deleteDatabase

          -
            -
          • deleteDatabase(dbname: string): Promise<void>
          • -
          -
            -
          • - -
            -
            -

            Deletes a serialized db from the catalog.

            -
            -
            -
            example
            -

            // DELETE DATABASE - // delete "finance"/"test" value from catalog - idbAdapter.deleteDatabase("test", function { - // database deleted - });

            -
            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              the name of the database to delete from the catalog.

              -
              -
            • -
            -

            Returns Promise<void>

            -

            a Promise that resolves after the database was deleted

            -
          • -
          -
          -
          - -

          deleteDatabasePartitions

          -
            -
          • deleteDatabasePartitions(dbname: string): void
          • -
          -
            -
          • - -
            -
            -

            Removes all database partitions and pages with the base filename passed in. - This utility method does not (yet) guarantee async deletions will be completed before returning

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              the base filename which container, partitions, or pages are derived

              -
              -
            • -
            -

            Returns void

            -
          • -
          -
          -
          - -

          getCatalogSummary

          -
            -
          • getCatalogSummary(callback: function): void
          • -
          -
            -
          • - -
            -
            -

            Allows retrieval of list of all keys in catalog along with size

            -
            -
            -

            Parameters

            -
              -
            • -
              callback: function
              -
              -

              (Optional) callback to accept result array.

              -
              -
                -
              • -
                  -
                • (entry: Entry[]): void
                • -
                -
                  -
                • -

                  Parameters

                  - -

                  Returns void

                  -
                • -
                -
              • -
              -
            • -
            -

            Returns void

            -
          • -
          -
          -
          - -

          getDatabaseList

          -
            -
          • getDatabaseList(callback: function): void
          • -
          -
            -
          • - -
            -
            -

            Retrieves object array of catalog entries for current app.

            -
            -
            -
            example
            -

            idbAdapter.getDatabaseList(function(result) { - // result is array of string names for that appcontext ("finance") - result.forEach(function(str) { - console.log(str); - }); - });

            -
            -
            -
            -

            Parameters

            -
              -
            • -
              callback: function
              -
              -

              should accept array of database names in the catalog for current app.

              -
              -
                -
              • -
                  -
                • (names: string[]): void
                • -
                -
                  -
                • -

                  Parameters

                  -
                    -
                  • -
                    names: string[]
                    -
                  • -
                  -

                  Returns void

                  -
                • -
                -
              • -
              -
            • -
            -

            Returns void

            -
          • -
          -
          -
          - -

          loadDatabase

          -
            -
          • loadDatabase(dbname: string): Promise<Object>
          • -
          -
            -
          • - -
            -
            -

            Retrieves a serialized db string from the catalog.

            -
            -
            -
            example
            -

            // LOAD - var idbAdapter = new LokiIndexedAdapter("finance"); - var db = new loki("test", { adapter: idbAdapter }); - db.base(function(result) { - console.log("done"); - });

            -
            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              the name of the database to retrieve.

              -
              -
            • -
            -

            Returns Promise<Object>

            -

            a Promise that resolves after the database was loaded

            -
          • -
          -
          -
          - -

          saveDatabase

          -
            -
          • saveDatabase(dbname: string, dbstring: string): Promise<void>
          • -
          -
            -
          • - -
            -
            -

            Saves a serialized db to the catalog.

            -
            -
            -
            example
            -

            // SAVE : will save App/Key/Val as "finance"/"test"/{serializedDb} - let idbAdapter = new LokiIndexedAdapter("finance"); - let db = new loki("test", { adapter: idbAdapter }); - let coll = db.addCollection("testColl"); - coll.insert({test: "val"}); - db.saveDatabase(); // could pass callback if needed for async complete

            -
            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              the name to give the serialized database within the catalog.

              -
              -
            • -
            • -
              dbstring: string
              -
              -

              the serialized db string to save.

              -
              -
            • -
            -

            Returns Promise<void>

            -

            a Promise that resolves after the database was persisted

            -
          • -
          -
          -
          - -

          Static deregister

          -
            -
          • deregister(): void
          • -
          - -
          -
          - -

          Static register

          -
            -
          • register(): void
          • -
          - -
          -
          -
          - -
          -
          -
          -
          -

          Legend

          -
          -
            -
          • Module
          • -
          • Object literal
          • -
          • Variable
          • -
          • Function
          • -
          • Function with type parameter
          • -
          • Index signature
          • -
          • Type alias
          • -
          -
            -
          • Enumeration
          • -
          • Enumeration member
          • -
          • Property
          • -
          • Method
          • -
          -
            -
          • Interface
          • -
          • Interface with type parameter
          • -
          • Constructor
          • -
          • Property
          • -
          • Method
          • -
          • Index signature
          • -
          -
            -
          • Class
          • -
          • Class with type parameter
          • -
          • Constructor
          • -
          • Property
          • -
          • Method
          • -
          • Accessor
          • -
          • Index signature
          • -
          -
            -
          • Inherited constructor
          • -
          • Inherited property
          • -
          • Inherited method
          • -
          • Inherited accessor
          • -
          -
            -
          • Protected property
          • -
          • Protected method
          • -
          • Protected accessor
          • -
          -
            -
          • Private property
          • -
          • Private method
          • -
          • Private accessor
          • -
          -
            -
          • Static property
          • -
          • Static method
          • -
          -
          -
          -
          -
          -

          Generated using TypeDoc

          -
          -
          - - - - \ No newline at end of file diff --git a/docs/api/classes/lokilocalstorage.html b/docs/api/classes/lokilocalstorage.html deleted file mode 100644 index 8805a1b3..00000000 --- a/docs/api/classes/lokilocalstorage.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - LokiLocalStorage | @lokijs/lokijs-src - - - - - -
          -
          -
          -
          - -
          -
          - Options -
          -
          - All -
            -
          • Public
          • -
          • Public/Protected
          • -
          • All
          • -
          -
          - - - - -
          -
          - Menu -
          -
          -
          -
          -
          -
          - -

          Class LokiLocalStorage

          -
          -
          -
          -
          -
          -
          -
          -
          -
          -

          A loki persistence adapter which persists to web browser's local storage object

          -
          -
          -
          constructor
          -

          LokiLocalStorageAdapter

          -
          -
          -
          -
          -
          -

          Hierarchy

          -
            -
          • - LokiLocalStorage -
          • -
          -
          -
          -

          Implements

          - -
          -
          -

          Index

          -
          - -
          -
          -
          -

          Methods

          -
          - -

          deleteDatabase

          -
            -
          • deleteDatabase(dbname: string): Promise<void>
          • -
          -
            -
          • - -
            -
            -

            deleteDatabase() - delete the database from localstorage, will throw an error if it - can't be deleted

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              the filename of the database to delete

              -
              -
            • -
            -

            Returns Promise<void>

            -

            a Promise that resolves after the database was deleted

            -
          • -
          -
          -
          - -

          loadDatabase

          -
            -
          • loadDatabase(dbname: string): Promise<string>
          • -
          -
            -
          • - -
            -
            -

            loadDatabase() - Load data from localstorage

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              the name of the database to load

              -
              -
            • -
            -

            Returns Promise<string>

            -

            a Promise that resolves after the database was loaded

            -
          • -
          -
          -
          - -

          saveDatabase

          -
            -
          • saveDatabase(dbname: string, dbstring: string): Promise<void>
          • -
          -
            -
          • - -
            -
            -

            saveDatabase() - save data to localstorage, will throw an error if the file can't be saved - might want to expand this to avoid dataloss on partial save

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              the filename of the database to load

              -
              -
            • -
            • -
              dbstring: string
              -
            • -
            -

            Returns Promise<void>

            -

            a Promise that resolves after the database was saved

            -
          • -
          -
          -
          - -

          Static deregister

          -
            -
          • deregister(): void
          • -
          - -
          -
          - -

          Static register

          -
            -
          • register(): void
          • -
          - -
          -
          -
          - -
          -
          -
          -
          -

          Legend

          -
          -
            -
          • Module
          • -
          • Object literal
          • -
          • Variable
          • -
          • Function
          • -
          • Function with type parameter
          • -
          • Index signature
          • -
          • Type alias
          • -
          -
            -
          • Enumeration
          • -
          • Enumeration member
          • -
          • Property
          • -
          • Method
          • -
          -
            -
          • Interface
          • -
          • Interface with type parameter
          • -
          • Constructor
          • -
          • Property
          • -
          • Method
          • -
          • Index signature
          • -
          -
            -
          • Class
          • -
          • Class with type parameter
          • -
          • Constructor
          • -
          • Property
          • -
          • Method
          • -
          • Accessor
          • -
          • Index signature
          • -
          -
            -
          • Inherited constructor
          • -
          • Inherited property
          • -
          • Inherited method
          • -
          • Inherited accessor
          • -
          -
            -
          • Protected property
          • -
          • Protected method
          • -
          • Protected accessor
          • -
          -
            -
          • Private property
          • -
          • Private method
          • -
          • Private accessor
          • -
          -
            -
          • Static property
          • -
          • Static method
          • -
          -
          -
          -
          -
          -

          Generated using TypeDoc

          -
          -
          - - - - \ No newline at end of file diff --git a/docs/api/classes/lokimemoryadapter.html b/docs/api/classes/lokimemoryadapter.html deleted file mode 100644 index cfa440b3..00000000 --- a/docs/api/classes/lokimemoryadapter.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - LokiMemoryAdapter | @lokijs/lokijs-src - - - - - -
          -
          -
          -
          - -
          -
          - Options -
          -
          - All -
            -
          • Public
          • -
          • Public/Protected
          • -
          • All
          • -
          -
          - - - - -
          -
          - Menu -
          -
          -
          -
          -
          -
          - -

          Class LokiMemoryAdapter

          -
          -
          -
          -
          -
          -
          -
          -
          -
          -

          In in-memory persistence adapter for an in-memory database. - This simple 'key/value' adapter is intended for unit testing and diagnostics.

          -
          -
          -
          -
          -

          Hierarchy

          -
            -
          • - LokiMemoryAdapter -
          • -
          -
          -
          -

          Implements

          - -
          -
          -

          Index

          -
          -
          -
          -

          Constructors

          - -
          -
          -

          Methods

          - -
          -
          -
          -
          -
          -

          Constructors

          -
          - -

          constructor

          - - -
          -
          -
          -

          Methods

          -
          - -

          deleteDatabase

          -
            -
          • deleteDatabase(dbname: string): Promise<void>
          • -
          -
            -
          • - -
            -
            -

            Deletes a database from its in-memory store.

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              name of the database (filename/keyname)

              -
              -
            • -
            -

            Returns Promise<void>

            -

            a Promise that resolves after the database was deleted

            -
          • -
          -
          -
          - -

          loadDatabase

          -
            -
          • loadDatabase(dbname: string): Promise<string>
          • -
          -
            -
          • - -
            -
            -

            Loads a serialized database from its in-memory store. - (Loki persistence adapter interface function)

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              name of the database (filename/keyname)

              -
              -
            • -
            -

            Returns Promise<string>

            -

            a Promise that resolves after the database was loaded

            -
          • -
          -
          -
          - -

          saveDatabase

          -
            -
          • saveDatabase(dbname: string, dbstring: string): Promise<void>
          • -
          -
            -
          • - -
            -
            -

            Saves a serialized database to its in-memory store. - (Loki persistence adapter interface function)

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              name of the database (filename/keyname)

              -
              -
            • -
            • -
              dbstring: string
              -
            • -
            -

            Returns Promise<void>

            -

            a Promise that resolves after the database was persisted

            -
          • -
          -
          -
          -
          - -
          -
          -
          -
          -

          Legend

          -
          -
            -
          • Module
          • -
          • Object literal
          • -
          • Variable
          • -
          • Function
          • -
          • Function with type parameter
          • -
          • Index signature
          • -
          • Type alias
          • -
          -
            -
          • Enumeration
          • -
          • Enumeration member
          • -
          • Property
          • -
          • Method
          • -
          -
            -
          • Interface
          • -
          • Interface with type parameter
          • -
          • Constructor
          • -
          • Property
          • -
          • Method
          • -
          • Index signature
          • -
          -
            -
          • Class
          • -
          • Class with type parameter
          • -
          • Constructor
          • -
          • Property
          • -
          • Method
          • -
          • Accessor
          • -
          • Index signature
          • -
          -
            -
          • Inherited constructor
          • -
          • Inherited property
          • -
          • Inherited method
          • -
          • Inherited accessor
          • -
          -
            -
          • Protected property
          • -
          • Protected method
          • -
          • Protected accessor
          • -
          -
            -
          • Private property
          • -
          • Private method
          • -
          • Private accessor
          • -
          -
            -
          • Static property
          • -
          • Static method
          • -
          -
          -
          -
          -
          -

          Generated using TypeDoc

          -
          -
          - - - - \ No newline at end of file diff --git a/docs/api/classes/lokipartitioningadapter.html b/docs/api/classes/lokipartitioningadapter.html deleted file mode 100644 index 4267f90a..00000000 --- a/docs/api/classes/lokipartitioningadapter.html +++ /dev/null @@ -1,405 +0,0 @@ - - - - - - LokiPartitioningAdapter | @lokijs/lokijs-src - - - - - -
          -
          -
          -
          - -
          -
          - Options -
          -
          - All -
            -
          • Public
          • -
          • Public/Protected
          • -
          • All
          • -
          -
          - - - - -
          -
          - Menu -
          -
          -
          -
          -
          -
          - -

          Class LokiPartitioningAdapter

          -
          -
          -
          -
          -
          -
          -
          -
          -
          -

          An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter - which can perform destructuring and partitioning. Each collection will be stored in its own key/save and - only dirty collections will be saved. If you turn on paging with default page size of 25megs and save - a 75 meg collection it should use up roughly 3 save slots (key/value pairs sent to inner adapter). - A dirty collection that spans three pages will save all three pages again - Paging mode was added mainly because Chrome has issues saving 'too large' of a string within a - single IndexedDB row. If a single document update causes the collection to be flagged as dirty, all - of that collection's pages will be written on next save.

          -
          -
          -
          -
          -

          Hierarchy

          -
            -
          • - LokiPartitioningAdapter -
          • -
          -
          -
          -

          Implements

          - -
          -
          -

          Index

          -
          -
          -
          -

          Constructors

          - -
          -
          -

          Properties

          - -
          -
          -

          Methods

          - -
          -
          -
          -
          -
          -

          Constructors

          -
          - -

          constructor

          - - -
          -
          -
          -

          Properties

          -
          - -

          mode

          -
          mode: string
          - -
          -
          -
          -

          Methods

          -
          - -

          exportDatabase

          -
            -
          • exportDatabase(dbname: string, dbref: ANY): Promise<void>
          • -
          -
            -
          • - -
            -
            -

            Saves a database by partioning into separate key/value saves. - (Loki 'reference mode' persistence adapter interface function)

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              name of the database (filename/keyname)

              -
              -
            • -
            • -
              dbref: ANY
              -
              -

              reference to database which we will partition and save.

              -
              -
            • -
            -

            Returns Promise<void>

            -

            a Promise that resolves after the database was deleted

            -
          • -
          -
          -
          - -

          loadDatabase

          -
            -
          • loadDatabase(dbname: string): Promise<any>
          • -
          -
            -
          • - -
            -
            -

            Loads a database which was partitioned into several key/value saves. - (Loki persistence adapter interface function)

            -
            -
            -

            Parameters

            -
              -
            • -
              dbname: string
              -
              -

              name of the database (filename/keyname)

              -
              -
            • -
            -

            Returns Promise<any>

            -

            a Promise that resolves after the database was loaded

            -
          • -
          -
          -
          - -

          Static deregister

          -
            -
          • deregister(): void
          • -
          - -
          -
          - -

          Static register

          -
            -
          • register(): void
          • -
          - -
          -
          -
          - -
          -
          -
          -
          -

          Legend

          -
          -
            -
          • Module
          • -
          • Object literal
          • -
          • Variable
          • -
          • Function
          • -
          • Function with type parameter
          • -
          • Index signature
          • -
          • Type alias
          • -
          -
            -
          • Enumeration
          • -
          • Enumeration member
          • -
          • Property
          • -
          • Method
          • -
          -
            -
          • Interface
          • -
          • Interface with type parameter
          • -
          • Constructor
          • -
          • Property
          • -
          • Method
          • -
          • Index signature
          • -
          -
            -
          • Class
          • -
          • Class with type parameter
          • -
          • Constructor
          • -
          • Property
          • -
          • Method
          • -
          • Accessor
          • -
          • Index signature
          • -
          -
            -
          • Inherited constructor
          • -
          • Inherited property
          • -
          • Inherited method
          • -
          • Inherited accessor
          • -
          -
            -
          • Protected property
          • -
          • Protected method
          • -
          • Protected accessor
          • -
          -
            -
          • Private property
          • -
          • Private method
          • -
          • Private accessor
          • -
          -
            -
          • Static property
          • -
          • Static method
          • -
          -
          -
          -
          -
          -

          Generated using TypeDoc

          -
          -
          - - - - \ No newline at end of file diff --git a/docs/api/classes/querybuilder.html b/docs/api/classes/querybuilder.html index 7aa1f89f..5bb25861 100644 --- a/docs/api/classes/querybuilder.html +++ b/docs/api/classes/querybuilder.html @@ -114,6 +114,7 @@

          Methods

        • constantScore
        • enableFinalScoring
        • exists
        • +
        • explain
        • fuzzy
        • match
        • matchAll
        • @@ -138,7 +139,7 @@

          constructor

        • Returns QueryBuilder

          @@ -158,7 +159,7 @@

          BM25Similarity

        • @@ -191,7 +192,7 @@

          bool

        • Returns BoolQueryBuilder

          @@ -208,7 +209,7 @@

          constantScore

        • Returns ConstantScoreQueryBuilder

          @@ -225,7 +226,7 @@

          enableFinalScoring

        • @@ -256,7 +257,7 @@

          exists

        • Parameters

          @@ -269,6 +270,37 @@

          Returns + +

          explain

          +
            +
          • explain(enable: boolean): this
          • +
          +
            +
          • + +
            +
            +

            Adds an explanation of the scoring of each document for all matched terms.

            +
            +
            +

            Parameters

            +
              +
            • +
              enable: boolean
              +
              +

              -flag to enable or disable explanation

              +
              +
            • +
            +

            Returns this

            +
          • +
          +

          fuzzy

          @@ -279,7 +311,7 @@

          fuzzy

        • Parameters

          @@ -305,7 +337,7 @@

          match

        • Parameters

          @@ -331,7 +363,7 @@

          matchAll

        • Returns MatchAllQueryBuilder

          @@ -348,7 +380,7 @@

          prefix

        • Parameters

          @@ -374,7 +406,7 @@

          term

        • Parameters

          @@ -400,7 +432,7 @@

          terms

        • Parameters

          @@ -426,7 +458,7 @@

          wildcard

        • Parameters

          @@ -477,6 +509,9 @@

          Returns exists

        • +
        • + explain +
        • fuzzy
        • diff --git a/docs/api/classes/resultset.html b/docs/api/classes/resultset.html index 67419e51..4fe59204 100644 --- a/docs/api/classes/resultset.html +++ b/docs/api/classes/resultset.html @@ -3,7 +3,7 @@ - Resultset | @lokijs/lokijs-src + ResultSet | @lokijs/lokijs-src @@ -54,10 +54,10 @@ Globals
        • - Resultset + ResultSet
        -

        Class Resultset<E>

        +

        Class ResultSet<TData, TNested>

      • @@ -67,7 +67,7 @@

        Class Resultset<E>

        -

        Resultset class allowing chainable queries. Intended to be instanced internally. +

        ResultSet class allowing chainable queries. Intended to be instanced internally. Collection.find(), Collection.where(), and Collection.chain() instantiate this.

        @@ -84,7 +84,20 @@

        Class Resultset<E>

        Type parameters

        • -

          E: any

          +

          TData: any

          +
          +
          +

          the data type

          +
          +
          +
        • +
        • +

          TNested: any

          +
          +
          +

          nested properties of data type

          +
          +
        @@ -92,7 +105,7 @@

        E:
      • - Resultset + ResultSet
      @@ -106,6 +119,13 @@

      Interfaces

    • DataOptions
    +
    +

    Type aliases

    + +

    Constructors

    +
    +

    Type aliases

    +
    + +

    Static LokiOps

    +
    LokiOps: object
    + +
    +

    Type declaration

    +
      +
    +
    +
    +
    + +

    Static Query

    +
    Query: object & object & object & object
    + +
    +

    Constructors

    constructor

    @@ -192,32 +240,32 @@

    Returns

    Properties

    - -

    collection

    -
    collection: Collection<E>
    + +

    _collection

    +
    _collection: Collection<TData, TNested>
    - -

    filterInitialized

    -
    filterInitialized: boolean
    + +

    _filterInitialized

    +
    _filterInitialized: boolean
    - -

    filteredrows

    -
    filteredrows: number[]
    + +

    _filteredRows

    +
    _filteredRows: number[]
    @@ -228,22 +276,22 @@

    Methods

    $and

      -
    • $and(expressionArray: Query[]): Resultset<E>
    • +
    • $and(expressionArray: Query<Doc<TData> & TNested>[]): this
    @@ -251,22 +299,22 @@

    Returns

    $or

      -
    • $or(expressionArray: Query[]): Resultset<E>
    • +
    • $or(expressionArray: Query<Doc<TData> & TNested>[]): this
    @@ -274,13 +322,13 @@

    Returns

    branch

  • -

    Returns Resultset<E>

    +

    Returns ResultSet<TData, TNested>

    @@ -296,18 +344,18 @@

    Returns

    compoundsort

      -
    • compoundsort(properties: (string | Object)[]): Resultset<E>
    • +
    • compoundsort(properties: (keyof (TData & TNested) | Object)[]): this
    • -

      Allows sorting a resultset based on multiple columns.

      +

      Allows sorting a ResultSet based on multiple columns.

      example
      @@ -321,14 +369,14 @@

      compoundsort

      Parameters

      • -
        properties: (string | Object)[]
        +
        properties: (keyof (TData & TNested) | Object)[]

        array of property names or subarray of [propertyname, isdesc] used evaluate sort order

      -

      Returns Resultset<E>

      -

      Reference to this resultset, sorted, for future chain operations.

      +

      Returns this

      +

      Reference to this ResultSet, sorted, for future chain operations.

    @@ -336,22 +384,22 @@

    Returns

    copy

    • -

      copy() - To support reuse of resultset in branched query situations.

      +

      copy() - To support reuse of ResultSet in branched query situations.

      -

      Returns Resultset<E>

      -

      Returns a copy of the resultset (set) but the underlying document references will be the same.

      +

      Returns ResultSet<TData, TNested>

      +

      Returns a copy of the ResultSet (set) but the underlying document references will be the same.

    @@ -365,16 +413,16 @@

    count

  • -

    Returns the number of documents in the resultset.

    +

    Returns the number of documents in the ResultSet.

    Returns number

    -

    The number of documents in the resultset.

    +

    The number of documents in the ResultSet.

  • @@ -382,13 +430,13 @@

    Returns number

    data

    -

    Returns Doc<E>[]

    -

    Array of documents in the resultset

    +

    Returns Doc<TData>[]

    +

    Array of documents in the ResultSet

    @@ -411,13 +459,13 @@

    Returns

    eqJoin

      -
    • eqJoin(joinData: ANY, leftJoinKey: string | Function, rightJoinKey: string | Function, mapFun?: Function, dataOptions?: ANY): ANY
    • +
    • eqJoin(joinData: Collection<any> | ResultSet<any> | any[], leftJoinKey: string | function, rightJoinKey: string | function, mapFun?: function, dataOptions?: DataOptions): ResultSet<any>
    • @@ -429,32 +477,53 @@

      eqJoin

      Parameters

      • -
        joinData: ANY
        +
        joinData: Collection<any> | ResultSet<any> | any[]

        Data array to join to.

      • -
        leftJoinKey: string | Function
        +
        leftJoinKey: string | function

        Property name in this result set to join on or a function to produce a value to join on

      • -
        rightJoinKey: string | Function
        +
        rightJoinKey: string | function

        Property name in the joinData to join on or a function to produce a value to join on

      • -
        Optional mapFun: Function
        +
        Optional mapFun: function
        +
          +
        • +
            +
          • (left: any, right: any): any
          • +
          +
            +
          • +

            Parameters

            +
              +
            • +
              left: any
              +
            • +
            • +
              right: any
              +
            • +
            +

            Returns any

            +
          • +
          +
        • +
      • -
        Optional dataOptions: ANY
        +
        Optional dataOptions: DataOptions
      -

      Returns ANY

      -

      A resultset with data in the format [{left: leftObj, right: rightObj}]

      +

      Returns ResultSet<any>

      +

      A ResultSet with data in the format [{left: leftObj, right: rightObj}]

    @@ -462,13 +531,13 @@

    Returns ANY

    find

      -
    • find(query?: Query, firstOnly?: boolean): Resultset<E>
    • +
    • find(query?: Query<Doc<TData> & TNested>, firstOnly?: boolean): this
    -

    Returns Resultset<E>

    -

    this resultset for further chain ops.

    +

    Returns this

    +

    this ResultSet for further chain ops.

    @@ -500,34 +569,34 @@

    Returns

    findAnd

      -
    • findAnd(expressionArray: Query[]): Resultset<E>
    • +
    • findAnd(expressionArray: Query<Doc<TData> & TNested>[]): this
    • -

      findAnd() - oversee the operation of AND'ed query expressions. +

      Oversee the operation of AND'ed query expressions. AND'ed expression evaluation runs each expression progressively against the full collection, - internally utilizing existing chained resultset functionality. + internally utilizing existing chained ResultSet functionality. Only the first filter can utilize a binary index.

      Parameters

      • -
        expressionArray: Query[]
        +
        expressionArray: Query<Doc<TData> & TNested>[]

        array of expressions

      -

      Returns Resultset<E>

      -

      this resultset for further chain ops.

      +

      Returns this

      +

      this ResultSet for further chain ops.

    @@ -535,18 +604,18 @@

    Returns

    findOr

      -
    • findOr(expressionArray: Query[]): Resultset<E>
    • +
    • findOr(expressionArray: Query<Doc<TData> & TNested>[]): this
    • -

      findOr() - oversee the operation of OR'ed query expressions. +

      Oversee the operation of OR'ed query expressions. OR'ed expression evaluation runs each expression individually against the full collection, and finally does a set OR on each expression's results. Each evaluation can utilize a binary index to prevent multiple linear array scans.

      @@ -555,14 +624,14 @@

      findOr

      Parameters

      • -
        expressionArray: Query[]
        +
        expressionArray: Query<Doc<TData> & TNested>[]

        array of expressions

      -

      Returns Resultset<E>

      -

      this resultset for further chain ops.

      +

      Returns this

      +

      this ResultSet for further chain ops.

    @@ -570,13 +639,13 @@

    Returns

    getScoring

    @@ -592,19 +661,19 @@

    Returns

    limit

      -
    • limit(qty: number): Resultset<E>
    • +
    • limit(qty: number): this
    • Allows you to limit the number of documents passed to next chain operation. - A resultset copy() is made to avoid altering original resultset.

      + A ResultSet copy() is made to avoid altering original ResultSet.

      Parameters

      @@ -616,8 +685,8 @@
      qty: number
    -

    Returns Resultset<E>

    -

    Returns a copy of the resultset, limited by qty, for subsequent chain ops.

    +

    Returns this

    +

    Returns a copy of the ResultSet, limited by qty, for subsequent chain ops.

    @@ -625,13 +694,13 @@

    Returns

    map

    • @@ -655,20 +724,20 @@
      mapFun: function
        • -
        • (obj: E, index: number, array: E[]): U
        • +
        • (obj: TData, index: number, array: TData[]): U
        • Parameters

          • -
            obj: E
            +
            obj: TData
          • index: number
          • -
            array: E[]
            +
            array: TData[]

          Returns U

          @@ -681,7 +750,7 @@

          Returns U<

          Optional dataOptions: DataOptions
        -

        Returns Resultset<U>

        +

        Returns ResultSet<U>

      @@ -695,7 +764,7 @@

      mapReduce

    • @@ -722,20 +791,20 @@
      mapFunction: function
        • -
        • (item: E, index: number, array: E[]): T
        • +
        • (item: TData, index: number, array: TData[]): T
        • Parameters

          • -
            item: E
            +
            item: TData
          • index: number
          • -
            array: E[]
            +
            array: TData[]

          Returns T

          @@ -778,18 +847,18 @@

          Returns U<

          offset

            -
          • offset(pos: number): Resultset<E>
          • +
          • offset(pos: number): this
    -

    Returns Resultset<E>

    -

    Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops.

    +

    Returns this

    +

    Returns a copy of the ResultSet, containing docs starting at 'pos' for subsequent chain ops.

    @@ -810,22 +879,22 @@

    Returns

    remove

    • -

      Removes all document objects which are currently in resultset from collection (as well as resultset)

      +

      Removes all document objects which are currently in ResultSet from collection (as well as ResultSet)

      -

      Returns Resultset<E>

      -

      this (empty) resultset for further chain ops.

      +

      Returns this

      +

      this (empty) ResultSet for further chain ops.

    @@ -833,22 +902,22 @@

    Returns

    reset

    • -

      reset() - Reset the resultset to its initial state.

      +

      reset() - Reset the ResultSet to its initial state.

      -

      Returns Resultset<E>

      -

      Reference to this resultset, for future chain operations.

      +

      Returns this

      +

      Reference to this ResultSet, for future chain operations.

    @@ -856,13 +925,13 @@

    Returns

    simplesort

      -
    • simplesort(propname: string, isdesc?: boolean): Resultset<E>
    • +
    • simplesort(propname: keyof (TData & TNested), descending?: boolean): this
    • @@ -874,20 +943,17 @@

      simplesort

      Parameters

      • -
        propname: string
        +
        propname: keyof (TData & TNested)

        name of property to sort by.

      • -
        Optional isdesc: boolean
        -
        -

        (Optional) If true, the property will be sorted in descending order

        -
        +
        Default value descending: boolean = false
      -

      Returns Resultset<E>

      -

      Reference to this resultset, sorted, for future chain operations.

      +

      Returns this

      +

      Reference to this ResultSet, sorted, for future chain operations.

    @@ -895,13 +961,13 @@

    Returns

    sort

      -
    • sort(comparefun: function): Resultset<E>
    • +
    • sort(comparefun: function): this
    • @@ -928,17 +994,17 @@
      comparefun: function
        • -
        • (a: E, b: E): number
        • +
        • (a: Doc<TData>, b: Doc<TData>): number
        • Parameters

          • -
            a: E
            +
            a: Doc<TData>
          • -
            b: E
            +
            b: Doc<TData>

          Returns number

          @@ -948,8 +1014,8 @@

          Returns number

        -

        Returns Resultset<E>

        -

        Reference to this resultset, sorted, for future chain operations.

        +

        Returns this

        +

        Reference to this ResultSet, sorted, for future chain operations.

      @@ -957,18 +1023,18 @@

      Returns

      sortByScoring

        -
      • sortByScoring(ascending?: boolean): Resultset<E>
      • +
      • sortByScoring(ascending?: boolean): this
      • -

        Sorts the resultset based on the last full-text-search scoring.

        +

        Sorts the ResultSet based on the last full-text-search scoring.

        Parameters

        @@ -977,7 +1043,7 @@

        Parameters

        Default value ascending: boolean = false
      -

      Returns Resultset<E>

      +

      Returns this

    @@ -985,21 +1051,21 @@

    Returns

    toJSON

    @@ -1007,24 +1073,24 @@

    Returns

    transform

      -
    • transform(transform: string | any[], parameters?: object): Resultset<E>
    • +
    • transform(transform: string | Transform<TData, TNested>[], parameters?: object): this
    • -

      Executes a named collection transform or raw array of transform steps against the resultset.

      +

      Executes a named collection transform or raw array of transform steps against the ResultSet.

      Parameters

      • -
        transform: string | any[]
        +
        transform: string | Transform<TData, TNested>[]

        name of collection transform or raw transform array

        @@ -1033,8 +1099,8 @@
        transform: stringOptional parameters: object
      -

      Returns Resultset<E>

      -

      either (this) resultset or a clone of of this resultset (depending on steps)

      +

      Returns this

      +

      either (this) ResultSet or a clone of of this ResultSet (depending on steps)

    @@ -1042,18 +1108,18 @@

    Returns

    update

      -
    • update(updateFunction: function): Resultset<E>
    • +
    • update(updateFunction: function): this
    • -

      Used to run an update operation on all documents currently in the resultset.

      +

      Used to run an update operation on all documents currently in the ResultSet.

      Parameters

      @@ -1066,25 +1132,25 @@
      updateFunction: function
        • -
        • (obj: E): E
        • +
        • (obj: Doc<TData>): TData
        • Parameters

          • -
            obj: E
            +
            obj: Doc<TData>
          -

          Returns E

          +

          Returns TData

    -

    Returns Resultset<E>

    -

    this resultset for further chain ops.

    +

    Returns this

    +

    this ResultSet for further chain ops.

    @@ -1092,13 +1158,13 @@

    Returns

    where

      -
    • where(fun: function): Resultset<E>
    • +
    • where(fun: function): this
    -

    Class UniqueIndex

    +

    Class UniqueIndex<E>

    +
    +

    Type parameters

    +
      +
    • +

      E: any

      +
    • +
    +

    Hierarchy

    @@ -107,7 +107,7 @@

    values

    values: any
    diff --git a/docs/api/interfaces/collection.deserializeoptions.html b/docs/api/interfaces/collection.deserializeoptions.html index 27c826f1..34704fb4 100644 --- a/docs/api/interfaces/collection.deserializeoptions.html +++ b/docs/api/interfaces/collection.deserializeoptions.html @@ -75,6 +75,10 @@

    Hierarchy

    +
    +

    Indexable

    +
    [collName: string]: any | object
    +

    Index

    @@ -97,7 +101,7 @@

    Optional fullTextSea
    fullTextSearch: Dict<FunctionSerialization>

    @@ -107,7 +111,7 @@

    Optional retainDirty
    retainDirtyFlags: boolean

    diff --git a/docs/api/interfaces/collection.options.html b/docs/api/interfaces/collection.options.html index 8eb20ed8..27ed2963 100644 --- a/docs/api/interfaces/collection.options.html +++ b/docs/api/interfaces/collection.options.html @@ -60,13 +60,21 @@ Options -

    Interface Options

    +

    Interface Options<TData>

    +
    +

    Type parameters

    +
      +
    • +

      TData

      +
    • +
    +

    Hierarchy

      @@ -108,7 +116,7 @@

      Optional adaptiveBinaryadaptiveBinaryIndices: boolean

    @@ -118,7 +126,7 @@

    Optional asyncListenersasyncListeners: boolean

    @@ -128,17 +136,17 @@

    Optional clone

    clone: boolean

    Optional cloneMethod

    -
    cloneMethod: CloneMethod
    +
    cloneMethod: CloneMethod
    @@ -148,7 +156,7 @@

    Optional disableChangesdisableChangesApi: boolean

    @@ -158,7 +166,7 @@

    Optional disableDeltadisableDeltaChangesApi: boolean

    @@ -168,17 +176,17 @@

    Optional fullTextSea
    fullTextSearch: FieldOptions[]

    Optional indices

    -
    indices: string[]
    +
    indices: keyof TData[]
    @@ -188,7 +196,7 @@

    Optional serializableIndi
    serializableIndices: boolean
    @@ -198,7 +206,7 @@

    Optional transactional

    transactional: boolean
    @@ -208,7 +216,7 @@

    Optional ttl

    ttl: number
    @@ -218,17 +226,17 @@

    Optional ttlInterval

    ttlInterval: number

    Optional unique

    -
    unique: string[]
    +
    unique: keyof TData[]
    @@ -249,7 +257,7 @@

    Optional unique

  • Collection