deploy should be working again
This commit is contained in:
parent
19d2946741
commit
97180d0576
|
@ -18,7 +18,6 @@
|
||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
"ejs": "^3.1.6",
|
"ejs": "^3.1.6",
|
||||||
"express-session": "^1.17.2",
|
"express-session": "^1.17.2",
|
||||||
"froebel": "^0.22.0",
|
|
||||||
"lokijs": "^1.5.12",
|
"lokijs": "^1.5.12",
|
||||||
"nano": "^9.0.3",
|
"nano": "^9.0.3",
|
||||||
"node-fetch": "^2.6.7",
|
"node-fetch": "^2.6.7",
|
||||||
|
@ -1081,11 +1080,6 @@
|
||||||
"node": ">= 0.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": {
|
"node_modules/fs-extra": {
|
||||||
"version": "8.1.0",
|
"version": "8.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||||
|
@ -3564,11 +3558,6 @@
|
||||||
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
||||||
"dev": true
|
"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": {
|
"fs-extra": {
|
||||||
"version": "8.1.0",
|
"version": "8.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
"ejs": "^3.1.6",
|
"ejs": "^3.1.6",
|
||||||
"express-session": "^1.17.2",
|
"express-session": "^1.17.2",
|
||||||
"froebel": "^0.22.0",
|
|
||||||
"lokijs": "^1.5.12",
|
"lokijs": "^1.5.12",
|
||||||
"nano": "^9.0.3",
|
"nano": "^9.0.3",
|
||||||
"node-fetch": "^2.6.7",
|
"node-fetch": "^2.6.7",
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
Types as T,
|
Types as T,
|
||||||
typePredicates as tp,
|
typePredicates as tp,
|
||||||
entryOfFull,
|
entryOfFull,
|
||||||
|
standardizePashto,
|
||||||
} from "@lingdocs/inflect"
|
} from "@lingdocs/inflect"
|
||||||
|
|
||||||
export let collection: Collection<any> | undefined = undefined;
|
export let collection: Collection<any> | undefined = undefined;
|
||||||
|
@ -64,10 +65,11 @@ export async function getEntries(ids: (number | string)[]): Promise<{
|
||||||
if (!collection) {
|
if (!collection) {
|
||||||
throw new Error("dictionary not initialized");
|
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({
|
const results: (T.DictionaryEntry | T.VerbEntry)[] = collection.find({
|
||||||
"$or": [
|
"$or": [
|
||||||
{ "ts": { "$in": ids }},
|
{ "ts": { "$in": idsP }},
|
||||||
{ "p": { "$in": ids }},
|
{ "p": { "$in": idsP }},
|
||||||
],
|
],
|
||||||
}).map(x => {
|
}).map(x => {
|
||||||
const { $loki, meta, ...entry } = x;
|
const { $loki, meta, ...entry } = x;
|
||||||
|
|
|
@ -4,7 +4,6 @@ import {
|
||||||
getEntries,
|
getEntries,
|
||||||
updateDictionary,
|
updateDictionary,
|
||||||
} from "../lib/dictionary";
|
} from "../lib/dictionary";
|
||||||
import { unary } from "froebel";
|
|
||||||
|
|
||||||
const dictionaryRouter = express.Router();
|
const dictionaryRouter = express.Router();
|
||||||
|
|
||||||
|
@ -18,7 +17,6 @@ dictionaryRouter.post("/entries", async (req, res, next) => {
|
||||||
return res.send({ ok: false, message: "dictionary not ready" });
|
return res.send({ ok: false, message: "dictionary not ready" });
|
||||||
}
|
}
|
||||||
const ids = req.body.ids as (number | string)[];
|
const ids = req.body.ids as (number | string)[];
|
||||||
console.log({ ids });
|
|
||||||
if (!Array.isArray(ids)) {
|
if (!Array.isArray(ids)) {
|
||||||
return res.status(400).send({ ok: false, error: "invalid query" });
|
return res.status(400).send({ ok: false, error: "invalid query" });
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,5 +2,5 @@ POST https://account.lingdocs.com/dictionary/entries HTTP/1.1
|
||||||
content-type: application/json
|
content-type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
"ids": ["ليدل", 1527815306]
|
"ids": ["لیدل", 1527815306]
|
||||||
}
|
}
|
|
@ -755,11 +755,6 @@
|
||||||
"resolved" "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz"
|
"resolved" "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz"
|
||||||
"version" "0.5.2"
|
"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":
|
"fs-extra@^8.0.1":
|
||||||
"integrity" "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="
|
"integrity" "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="
|
||||||
"resolved" "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz"
|
"resolved" "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz"
|
||||||
|
|
Loading…
Reference in New Issue