scrabble-solver 2.13.1 → 2.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build.yml +3 -4
- package/.github/workflows/eslint.yml +1 -1
- package/.github/workflows/test.yml +1 -2
- package/.nx/cache/file-map.json +2610 -0
- package/.nx/cache/lockfile.hash +1 -0
- package/.nx/cache/nx_files.nxt +0 -0
- package/.nx/cache/parsed-lock-file.json +32593 -0
- package/.nx/cache/project-graph.json +32416 -0
- package/README.md +8 -8
- package/lerna.json +1 -1
- package/package.json +36 -29
- package/packages/configs/package.json +4 -5
- package/packages/constants/package.json +2 -3
- package/packages/dictionaries/package-lock.json +2 -2
- package/packages/dictionaries/package.json +5 -6
- package/packages/logger/package-lock.json +15 -7
- package/packages/logger/package.json +3 -4
- package/packages/scrabble-solver/.next/BUILD_ID +1 -1
- package/packages/scrabble-solver/.next/build-manifest.json +16 -16
- package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
- package/packages/scrabble-solver/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/packages/scrabble-solver/.next/cache/webpack/client-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/next-minimal-server.js.nft.json +1 -0
- package/packages/scrabble-solver/.next/next-server.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/prerender-manifest.js +1 -0
- package/packages/scrabble-solver/.next/prerender-manifest.json +1 -1
- package/packages/scrabble-solver/.next/required-server-files.json +1 -1
- package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
- package/packages/scrabble-solver/.next/server/InjectManifest.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/chunks/28.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/331.js +6 -0
- package/packages/scrabble-solver/.next/server/chunks/577.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/911.js +1 -1083
- package/packages/scrabble-solver/.next/server/chunks/977.js +1 -0
- package/packages/scrabble-solver/.next/server/functions-config-manifest.json +1 -0
- package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/next-font-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/next-font-manifest.json +1 -6
- package/packages/scrabble-solver/.next/server/pages/404.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/404.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/500.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/_app.js +1 -380
- package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/_document.js +1 -212
- package/packages/scrabble-solver/.next/server/pages/_document.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/_error.js +1 -166
- package/packages/scrabble-solver/.next/server/pages/_error.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js +2 -836
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js +1 -192
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/solve.js +1 -1121
- package/packages/scrabble-solver/.next/server/pages/api/solve.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/verify.js +1 -213
- package/packages/scrabble-solver/.next/server/pages/api/verify.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/visit.js +1 -131
- package/packages/scrabble-solver/.next/server/pages/api/visit.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.js +1 -2088
- package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.json +1 -1
- package/packages/scrabble-solver/.next/server/pages-manifest.json +1 -12
- package/packages/scrabble-solver/.next/server/webpack-api-runtime.js +1 -172
- package/packages/scrabble-solver/.next/server/webpack-runtime.js +1 -229
- package/packages/scrabble-solver/.next/static/chunks/framework-1728d40275bc359a.js +49 -0
- package/packages/scrabble-solver/.next/static/chunks/main-5fb7abbfc135de15.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/404-b6e238bb4117d451.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-b95404c40a0092e6.js +17 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/_error-db043fa3544f8809.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/index-59d569ef79bc2580.js +1 -0
- package/packages/scrabble-solver/.next/static/css/8fa2fb99b90e109e.css +1 -0
- package/packages/scrabble-solver/.next/static/css/c80ebc6fd13311f1.css +2 -0
- package/packages/scrabble-solver/.next/static/r00VHxlMI-jbGWpg3nm2M/_buildManifest.js +1 -0
- package/packages/scrabble-solver/.next/trace +44 -51
- package/packages/scrabble-solver/package-lock.json +755 -524
- package/packages/scrabble-solver/package.json +30 -31
- package/packages/scrabble-solver/public/service-worker.js +2 -0
- package/packages/scrabble-solver/public/service-worker.js.map +1 -0
- package/packages/scrabble-solver/src/i18n/ro.json +5 -5
- package/packages/scrabble-solver/src/state/slices/boardSlice.ts +4 -4
- package/packages/scrabble-solver/src/state/store.ts +1 -1
- package/packages/solver/package-lock.json +2 -2
- package/packages/solver/package.json +6 -7
- package/packages/types/package.json +3 -4
- package/packages/word-definitions/package-lock.json +10 -10
- package/packages/word-definitions/package.json +5 -5
- package/packages/word-lists/build/getFrFrWordList.js +1 -5
- package/packages/word-lists/build/getRoRoWordList.js +1 -5
- package/packages/word-lists/build/lib/index.d.ts +2 -0
- package/packages/word-lists/build/lib/index.js +5 -1
- package/packages/word-lists/build/lib/latinizeDiacritics.d.ts +2 -0
- package/packages/word-lists/build/lib/latinizeDiacritics.js +11 -0
- package/packages/word-lists/build/lib/unique.d.ts +2 -0
- package/packages/word-lists/build/lib/unique.js +4 -0
- package/packages/word-lists/package-lock.json +22 -22
- package/packages/word-lists/package.json +8 -9
- package/packages/word-lists/src/getFrFrWordList.ts +2 -3
- package/packages/word-lists/src/getRoRoWordList.ts +2 -3
- package/packages/word-lists/src/lib/index.ts +2 -0
- package/packages/word-lists/src/lib/latinizeDiacritics.ts +9 -0
- package/packages/word-lists/src/lib/unique.ts +3 -0
- package/tsconfig.json +1 -1
- package/packages/configs/dictionaries/build/Dictionaries.d.ts +0 -13
- package/packages/configs/dictionaries/build/Dictionaries.js +0 -46
- package/packages/configs/dictionaries/build/constants/index.d.ts +0 -3
- package/packages/configs/dictionaries/build/constants/index.js +0 -11
- package/packages/configs/dictionaries/build/index.d.ts +0 -3
- package/packages/configs/dictionaries/build/index.js +0 -23
- package/packages/configs/dictionaries/build/lib/DiskCache.d.ts +0 -11
- package/packages/configs/dictionaries/build/lib/DiskCache.js +0 -48
- package/packages/configs/dictionaries/build/lib/LayeredCache.d.ts +0 -13
- package/packages/configs/dictionaries/build/lib/LayeredCache.js +0 -55
- package/packages/configs/dictionaries/build/lib/MemoryCache.d.ts +0 -13
- package/packages/configs/dictionaries/build/lib/MemoryCache.js +0 -32
- package/packages/configs/dictionaries/build/lib/createAsyncProxy.d.ts +0 -3
- package/packages/configs/dictionaries/build/lib/createAsyncProxy.js +0 -18
- package/packages/configs/dictionaries/build/lib/createCacheTimestampComparator.d.ts +0 -5
- package/packages/configs/dictionaries/build/lib/createCacheTimestampComparator.js +0 -19
- package/packages/configs/dictionaries/build/lib/downloadDictionary.d.ts +0 -4
- package/packages/configs/dictionaries/build/lib/downloadDictionary.js +0 -16
- package/packages/configs/dictionaries/build/lib/getDictionaryFilepath.d.ts +0 -3
- package/packages/configs/dictionaries/build/lib/getDictionaryFilepath.js +0 -11
- package/packages/configs/dictionaries/build/lib/index.d.ts +0 -7
- package/packages/configs/dictionaries/build/lib/index.js +0 -20
- package/packages/configs/dictionaries/build/types/Cache.d.ts +0 -8
- package/packages/configs/dictionaries/build/types/Cache.js +0 -2
- package/packages/configs/dictionaries/build/types/index.d.ts +0 -1
- package/packages/configs/dictionaries/build/types/index.js +0 -2
- package/packages/scrabble-solver/.next/cache/next-server.js.nft.json +0 -1
- package/packages/scrabble-solver/.next/server/chunks/210.js +0 -109
- package/packages/scrabble-solver/.next/server/chunks/277.js +0 -11942
- package/packages/scrabble-solver/.next/server/chunks/44.js +0 -1813
- package/packages/scrabble-solver/.next/server/chunks/50.js +0 -12119
- package/packages/scrabble-solver/.next/server/chunks/636.js +0 -286
- package/packages/scrabble-solver/.next/server/chunks/675.js +0 -572
- package/packages/scrabble-solver/.next/server/chunks/859.js +0 -835
- package/packages/scrabble-solver/.next/server/chunks/865.js +0 -20424
- package/packages/scrabble-solver/.next/server/chunks/907.js +0 -42530
- package/packages/scrabble-solver/.next/server/chunks/987.js +0 -91
- package/packages/scrabble-solver/.next/static/RJ5_dKU0dHcryeTVO6SSX/_buildManifest.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/framework-2c29dc3cd933590b.js +0 -49
- package/packages/scrabble-solver/.next/static/chunks/main-4dcb7f9b52833aba.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/404-b4b5ce15153d4825.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-b92880dde164b954.js +0 -32
- package/packages/scrabble-solver/.next/static/chunks/pages/_error-54de1933a164a1ff.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/index-f56eaa969a831c70.js +0 -1
- package/packages/scrabble-solver/.next/static/css/4e8b47fe382a8a8f.css +0 -2
- package/packages/scrabble-solver/.next/static/css/cfae5256f1689f57.css +0 -1
- /package/packages/scrabble-solver/.next/static/{RJ5_dKU0dHcryeTVO6SSX → r00VHxlMI-jbGWpg3nm2M}/_ssgManifest.js +0 -0
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const trie_1 = require("@kamilmielnik/trie");
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
const getDictionaryFilepath_1 = __importDefault(require("./getDictionaryFilepath"));
|
|
10
|
-
class DiskCache {
|
|
11
|
-
async get(locale) {
|
|
12
|
-
if (!this.has(locale)) {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
const filepath = (0, getDictionaryFilepath_1.default)(locale);
|
|
16
|
-
const serialized = await fs_1.default.promises.readFile(filepath, 'utf-8');
|
|
17
|
-
const trie = trie_1.Trie.deserialize(serialized);
|
|
18
|
-
return trie;
|
|
19
|
-
}
|
|
20
|
-
getLastModifiedTimestamp(locale) {
|
|
21
|
-
const filepath = (0, getDictionaryFilepath_1.default)(locale);
|
|
22
|
-
if (!fs_1.default.existsSync(filepath)) {
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
const stats = fs_1.default.statSync(filepath);
|
|
26
|
-
return stats.mtimeMs;
|
|
27
|
-
}
|
|
28
|
-
has(locale) {
|
|
29
|
-
const filepath = (0, getDictionaryFilepath_1.default)(locale);
|
|
30
|
-
return fs_1.default.existsSync(filepath);
|
|
31
|
-
}
|
|
32
|
-
isStale(locale) {
|
|
33
|
-
if (!this.has(locale)) {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
const lastModifiedTimestamp = this.getLastModifiedTimestamp(locale);
|
|
37
|
-
if (typeof lastModifiedTimestamp === 'undefined') {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
const timeSinceModification = Math.abs(lastModifiedTimestamp - Date.now());
|
|
41
|
-
return timeSinceModification > constants_1.CACHE_STALE_THRESHOLD;
|
|
42
|
-
}
|
|
43
|
-
async set(locale, trie) {
|
|
44
|
-
const filepath = (0, getDictionaryFilepath_1.default)(locale);
|
|
45
|
-
await fs_1.default.promises.writeFile(filepath, trie.serialize());
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.default = DiskCache;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Trie } from '@kamilmielnik/trie';
|
|
2
|
-
import { Locale } from '@scrabble-solver/types';
|
|
3
|
-
import { Cache } from '../types';
|
|
4
|
-
declare class LayeredCache implements Cache<Locale, Trie> {
|
|
5
|
-
private readonly layers;
|
|
6
|
-
get(locale: Locale): Promise<Trie | undefined>;
|
|
7
|
-
getLastModifiedTimestamp(locale: Locale): number | undefined;
|
|
8
|
-
has(locale: Locale): boolean;
|
|
9
|
-
isStale(locale: Locale): boolean | undefined;
|
|
10
|
-
set(locale: Locale, trie: Trie): Promise<void>;
|
|
11
|
-
private getLastModifiedLayer;
|
|
12
|
-
}
|
|
13
|
-
export default LayeredCache;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const createCacheTimestampComparator_1 = __importDefault(require("./createCacheTimestampComparator"));
|
|
7
|
-
const DiskCache_1 = __importDefault(require("./DiskCache"));
|
|
8
|
-
const MemoryCache_1 = __importDefault(require("./MemoryCache"));
|
|
9
|
-
class LayeredCache {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.layers = [new MemoryCache_1.default(), new DiskCache_1.default()];
|
|
12
|
-
}
|
|
13
|
-
async get(locale) {
|
|
14
|
-
const cache = this.getLastModifiedLayer(locale);
|
|
15
|
-
if (!cache) {
|
|
16
|
-
return Promise.resolve(undefined);
|
|
17
|
-
}
|
|
18
|
-
const [memoryCache, diskCache] = this.layers;
|
|
19
|
-
const value = await cache.get(locale);
|
|
20
|
-
if (cache === diskCache && typeof value !== 'undefined') {
|
|
21
|
-
await memoryCache.set(locale, value);
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
getLastModifiedTimestamp(locale) {
|
|
26
|
-
const cache = this.getLastModifiedLayer(locale);
|
|
27
|
-
if (!cache) {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
return cache.getLastModifiedTimestamp(locale);
|
|
31
|
-
}
|
|
32
|
-
has(locale) {
|
|
33
|
-
return this.layers.some((cache) => cache.has(locale));
|
|
34
|
-
}
|
|
35
|
-
isStale(locale) {
|
|
36
|
-
if (this.layers.some((cache) => cache.isStale(locale))) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
if (this.layers.every((cache) => typeof cache.isStale(locale) === 'undefined')) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
async set(locale, trie) {
|
|
45
|
-
const [memoryCache, diskCache] = this.layers;
|
|
46
|
-
await diskCache.set(locale, trie);
|
|
47
|
-
await memoryCache.set(locale, trie);
|
|
48
|
-
}
|
|
49
|
-
getLastModifiedLayer(locale) {
|
|
50
|
-
const layers = this.layers.filter((cache) => cache.has(locale));
|
|
51
|
-
const [cached] = [...layers].sort((0, createCacheTimestampComparator_1.default)(locale));
|
|
52
|
-
return cached;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.default = LayeredCache;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Trie } from '@kamilmielnik/trie';
|
|
2
|
-
import { Locale } from '@scrabble-solver/types';
|
|
3
|
-
import { Cache } from '../types';
|
|
4
|
-
declare class MemoryCache implements Cache<Locale, Trie> {
|
|
5
|
-
private readonly cache;
|
|
6
|
-
private readonly cacheTimestamps;
|
|
7
|
-
get(locale: Locale): Promise<Trie | undefined>;
|
|
8
|
-
getLastModifiedTimestamp(locale: Locale): number | undefined;
|
|
9
|
-
has(locale: Locale): boolean;
|
|
10
|
-
isStale(locale: Locale): boolean | undefined;
|
|
11
|
-
set(locale: Locale, trie: Trie): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
export default MemoryCache;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const constants_1 = require("../constants");
|
|
4
|
-
class MemoryCache {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.cache = {};
|
|
7
|
-
this.cacheTimestamps = {};
|
|
8
|
-
}
|
|
9
|
-
get(locale) {
|
|
10
|
-
return Promise.resolve(this.cache[locale]);
|
|
11
|
-
}
|
|
12
|
-
getLastModifiedTimestamp(locale) {
|
|
13
|
-
return this.cacheTimestamps[locale];
|
|
14
|
-
}
|
|
15
|
-
has(locale) {
|
|
16
|
-
return typeof this.cache[locale] !== 'undefined';
|
|
17
|
-
}
|
|
18
|
-
isStale(locale) {
|
|
19
|
-
const timestamp = this.getLastModifiedTimestamp(locale);
|
|
20
|
-
if (!this.has(locale) || typeof timestamp === 'undefined') {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
const timeSinceModification = Math.abs(timestamp - Date.now());
|
|
24
|
-
return timeSinceModification > constants_1.CACHE_STALE_THRESHOLD;
|
|
25
|
-
}
|
|
26
|
-
set(locale, trie) {
|
|
27
|
-
this.cacheTimestamps[locale] = Date.now();
|
|
28
|
-
this.cache[locale] = trie;
|
|
29
|
-
return Promise.resolve();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.default = MemoryCache;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const createAsyncProxy = (asyncCallback) => {
|
|
4
|
-
let promise = null;
|
|
5
|
-
return async () => {
|
|
6
|
-
if (promise) {
|
|
7
|
-
return promise;
|
|
8
|
-
}
|
|
9
|
-
try {
|
|
10
|
-
promise = asyncCallback();
|
|
11
|
-
return await promise;
|
|
12
|
-
}
|
|
13
|
-
finally {
|
|
14
|
-
promise = null;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
exports.default = createAsyncProxy;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Trie } from '@kamilmielnik/trie';
|
|
2
|
-
import { Locale } from '@scrabble-solver/types';
|
|
3
|
-
import { Cache } from '../types';
|
|
4
|
-
declare const createCacheTimestampComparator: (locale: Locale) => (a: Cache<Locale, Trie>, b: Cache<Locale, Trie>) => number;
|
|
5
|
-
export default createCacheTimestampComparator;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const createCacheTimestampComparator = (locale) => {
|
|
4
|
-
return (a, b) => {
|
|
5
|
-
const aTimestamp = a.getLastModifiedTimestamp(locale);
|
|
6
|
-
const bTimestamp = b.getLastModifiedTimestamp(locale);
|
|
7
|
-
if (aTimestamp === bTimestamp) {
|
|
8
|
-
return 0;
|
|
9
|
-
}
|
|
10
|
-
if (typeof aTimestamp === 'undefined') {
|
|
11
|
-
return 1;
|
|
12
|
-
}
|
|
13
|
-
if (typeof bTimestamp === 'undefined') {
|
|
14
|
-
return -1;
|
|
15
|
-
}
|
|
16
|
-
return bTimestamp - aTimestamp;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
exports.default = createCacheTimestampComparator;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const trie_1 = require("@kamilmielnik/trie");
|
|
7
|
-
const logger_1 = __importDefault(require("@scrabble-solver/logger"));
|
|
8
|
-
const word_lists_1 = require("@scrabble-solver/word-lists");
|
|
9
|
-
const downloadDictionary = async (locale) => {
|
|
10
|
-
logger_1.default.info('downloadDictionary', { locale });
|
|
11
|
-
const words = await (0, word_lists_1.getWordList)(locale);
|
|
12
|
-
logger_1.default.info('downloadDictionary - success', { locale });
|
|
13
|
-
const trie = trie_1.Trie.fromArray(words);
|
|
14
|
-
return trie;
|
|
15
|
-
};
|
|
16
|
-
exports.default = downloadDictionary;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const constants_1 = require("../constants");
|
|
8
|
-
const getDictionaryFilepath = (locale) => {
|
|
9
|
-
return path_1.default.resolve(constants_1.OUTPUT_DIRECTORY, `${locale}.txt`);
|
|
10
|
-
};
|
|
11
|
-
exports.default = getDictionaryFilepath;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default as createAsyncProxy } from './createAsyncProxy';
|
|
2
|
-
export { default as createCacheTimestampComparator } from './createCacheTimestampComparator';
|
|
3
|
-
export { default as DiskCache } from './DiskCache';
|
|
4
|
-
export { default as downloadDictionary } from './downloadDictionary';
|
|
5
|
-
export { default as getDictionaryFilepath } from './getDictionaryFilepath';
|
|
6
|
-
export { default as LayeredCache } from './LayeredCache';
|
|
7
|
-
export { default as MemoryCache } from './MemoryCache';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MemoryCache = exports.LayeredCache = exports.getDictionaryFilepath = exports.downloadDictionary = exports.DiskCache = exports.createCacheTimestampComparator = exports.createAsyncProxy = void 0;
|
|
7
|
-
var createAsyncProxy_1 = require("./createAsyncProxy");
|
|
8
|
-
Object.defineProperty(exports, "createAsyncProxy", { enumerable: true, get: function () { return __importDefault(createAsyncProxy_1).default; } });
|
|
9
|
-
var createCacheTimestampComparator_1 = require("./createCacheTimestampComparator");
|
|
10
|
-
Object.defineProperty(exports, "createCacheTimestampComparator", { enumerable: true, get: function () { return __importDefault(createCacheTimestampComparator_1).default; } });
|
|
11
|
-
var DiskCache_1 = require("./DiskCache");
|
|
12
|
-
Object.defineProperty(exports, "DiskCache", { enumerable: true, get: function () { return __importDefault(DiskCache_1).default; } });
|
|
13
|
-
var downloadDictionary_1 = require("./downloadDictionary");
|
|
14
|
-
Object.defineProperty(exports, "downloadDictionary", { enumerable: true, get: function () { return __importDefault(downloadDictionary_1).default; } });
|
|
15
|
-
var getDictionaryFilepath_1 = require("./getDictionaryFilepath");
|
|
16
|
-
Object.defineProperty(exports, "getDictionaryFilepath", { enumerable: true, get: function () { return __importDefault(getDictionaryFilepath_1).default; } });
|
|
17
|
-
var LayeredCache_1 = require("./LayeredCache");
|
|
18
|
-
Object.defineProperty(exports, "LayeredCache", { enumerable: true, get: function () { return __importDefault(LayeredCache_1).default; } });
|
|
19
|
-
var MemoryCache_1 = require("./MemoryCache");
|
|
20
|
-
Object.defineProperty(exports, "MemoryCache", { enumerable: true, get: function () { return __importDefault(MemoryCache_1).default; } });
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
interface Cache<Key extends string, Value> {
|
|
2
|
-
get(key: Key): Promise<Value | undefined>;
|
|
3
|
-
getLastModifiedTimestamp(key: Key): number | undefined;
|
|
4
|
-
has(key: Key): boolean;
|
|
5
|
-
isStale(key: Key): boolean | undefined;
|
|
6
|
-
set(key: Key, value: Value): Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
export default Cache;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Cache } from './Cache';
|