From 97180d05760971739bd522d200a00e547f12600c Mon Sep 17 00:00:00 2001 From: adueck Date: Wed, 9 Nov 2022 14:45:31 +0500 Subject: [PATCH] deploy should be working again --- account/package-lock.json | 11 ----------- account/package.json | 1 - account/src/lib/dictionary.ts | 6 ++++-- account/src/routers/dictionary-router.ts | 2 -- account/test.http | 2 +- account/yarn.lock | 5 ----- 6 files changed, 5 insertions(+), 22 deletions(-) diff --git a/account/package-lock.json b/account/package-lock.json index 3592c71..82ce674 100644 --- a/account/package-lock.json +++ b/account/package-lock.json @@ -18,7 +18,6 @@ "crypto": "^1.0.1", "ejs": "^3.1.6", "express-session": "^1.17.2", - "froebel": "^0.22.0", "lokijs": "^1.5.12", "nano": "^9.0.3", "node-fetch": "^2.6.7", @@ -1081,11 +1080,6 @@ "node": ">= 0.6" } }, - "node_modules/froebel": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/froebel/-/froebel-0.22.0.tgz", - "integrity": "sha512-BF0Qm4qq860UAr57wfgFqoy1Df+5VyuenDC/ZTJEcIqwsSBBTrsP0bFEhuIMNOB/+JYcfIpDG+lHFC595Eqonw==" - }, "node_modules/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -3564,11 +3558,6 @@ "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", "dev": true }, - "froebel": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/froebel/-/froebel-0.22.0.tgz", - "integrity": "sha512-BF0Qm4qq860UAr57wfgFqoy1Df+5VyuenDC/ZTJEcIqwsSBBTrsP0bFEhuIMNOB/+JYcfIpDG+lHFC595Eqonw==" - }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", diff --git a/account/package.json b/account/package.json index 296a9ce..fbc5c99 100644 --- a/account/package.json +++ b/account/package.json @@ -20,7 +20,6 @@ "crypto": "^1.0.1", "ejs": "^3.1.6", "express-session": "^1.17.2", - "froebel": "^0.22.0", "lokijs": "^1.5.12", "nano": "^9.0.3", "node-fetch": "^2.6.7", diff --git a/account/src/lib/dictionary.ts b/account/src/lib/dictionary.ts index 9ea2f69..41883bc 100644 --- a/account/src/lib/dictionary.ts +++ b/account/src/lib/dictionary.ts @@ -8,6 +8,7 @@ import { Types as T, typePredicates as tp, entryOfFull, + standardizePashto, } from "@lingdocs/inflect" export let collection: Collection | undefined = undefined; @@ -64,10 +65,11 @@ export async function getEntries(ids: (number | string)[]): Promise<{ if (!collection) { throw new Error("dictionary not initialized"); } + const idsP = ids.map(x => typeof x === "number" ? x : standardizePashto(x)) const results: (T.DictionaryEntry | T.VerbEntry)[] = collection.find({ "$or": [ - { "ts": { "$in": ids }}, - { "p": { "$in": ids }}, + { "ts": { "$in": idsP }}, + { "p": { "$in": idsP }}, ], }).map(x => { const { $loki, meta, ...entry } = x; diff --git a/account/src/routers/dictionary-router.ts b/account/src/routers/dictionary-router.ts index b3080e1..29b2aaf 100644 --- a/account/src/routers/dictionary-router.ts +++ b/account/src/routers/dictionary-router.ts @@ -4,7 +4,6 @@ import { getEntries, updateDictionary, } from "../lib/dictionary"; -import { unary } from "froebel"; const dictionaryRouter = express.Router(); @@ -18,7 +17,6 @@ dictionaryRouter.post("/entries", async (req, res, next) => { return res.send({ ok: false, message: "dictionary not ready" }); } const ids = req.body.ids as (number | string)[]; - console.log({ ids }); if (!Array.isArray(ids)) { return res.status(400).send({ ok: false, error: "invalid query" }); } diff --git a/account/test.http b/account/test.http index 40bae86..e8d9da3 100644 --- a/account/test.http +++ b/account/test.http @@ -2,5 +2,5 @@ POST https://account.lingdocs.com/dictionary/entries HTTP/1.1 content-type: application/json { - "ids": ["ليدل", 1527815306] + "ids": ["لیدل", 1527815306] } \ No newline at end of file diff --git a/account/yarn.lock b/account/yarn.lock index 7ff9aeb..691b178 100644 --- a/account/yarn.lock +++ b/account/yarn.lock @@ -755,11 +755,6 @@ "resolved" "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz" "version" "0.5.2" -"froebel@^0.22.0": - "integrity" "sha512-BF0Qm4qq860UAr57wfgFqoy1Df+5VyuenDC/ZTJEcIqwsSBBTrsP0bFEhuIMNOB/+JYcfIpDG+lHFC595Eqonw==" - "resolved" "https://registry.npmjs.org/froebel/-/froebel-0.22.0.tgz" - "version" "0.22.0" - "fs-extra@^8.0.1": "integrity" "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==" "resolved" "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz"