From ab865b9fe25a069e0ff07dbad53075a57a36aa51 Mon Sep 17 00:00:00 2001 From: adueck Date: Fri, 25 Nov 2022 19:25:40 +0500 Subject: [PATCH] update for r field --- account/package-lock.json | 14 +++++++------- account/package.json | 2 +- account/yarn.lock | 8 ++++---- functions/package-lock.json | 14 +++++++------- functions/package.json | 2 +- functions/src/publish.ts | 35 ++++++++++++++++++----------------- website/package.json | 2 +- website/yarn.lock | 8 ++++---- 8 files changed, 43 insertions(+), 42 deletions(-) diff --git a/account/package-lock.json b/account/package-lock.json index 82ce674..c3fc5dd 100644 --- a/account/package-lock.json +++ b/account/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@lingdocs/inflect": "5.1.10", + "@lingdocs/inflect": "5.2.1", "base64url": "^3.0.1", "bcryptjs": "^2.4.3", "connect-redis": "^6.0.0", @@ -124,9 +124,9 @@ } }, "node_modules/@lingdocs/inflect": { - "version": "5.1.10", - "resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.10.tgz", - "integrity": "sha512-LPJqXSnb2zLWLfMXMTCs/1NOGYQnzPHbKu5h/SdvFYobCxnk2tgngtSWcCmeqYbNXKqQvbDwqmseLlcnUZKysA==", + "version": "5.2.1", + "resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.2.1.tgz", + "integrity": "sha512-A2Is03lIx8od0JfnHjAbreNeI1jsoRARRXnNhqaJ+Hw7DMPMXEkOlpZnY/luvTcUA7/E5FHKEEAtBOng//zcog==", "license": "MIT", "dependencies": { "pbf": "^3.2.1", @@ -2741,9 +2741,9 @@ } }, "@lingdocs/inflect": { - "version": "5.1.10", - "resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.10.tgz", - "integrity": "sha512-LPJqXSnb2zLWLfMXMTCs/1NOGYQnzPHbKu5h/SdvFYobCxnk2tgngtSWcCmeqYbNXKqQvbDwqmseLlcnUZKysA==", + "version": "5.2.1", + "resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.2.1.tgz", + "integrity": "sha512-A2Is03lIx8od0JfnHjAbreNeI1jsoRARRXnNhqaJ+Hw7DMPMXEkOlpZnY/luvTcUA7/E5FHKEEAtBOng//zcog==", "requires": { "pbf": "^3.2.1", "rambda": "^7.3.0" diff --git a/account/package.json b/account/package.json index fbc5c99..8e6fb72 100644 --- a/account/package.json +++ b/account/package.json @@ -11,7 +11,7 @@ "author": "", "license": "ISC", "dependencies": { - "@lingdocs/inflect": "5.1.10", + "@lingdocs/inflect": "5.2.1", "base64url": "^3.0.1", "bcryptjs": "^2.4.3", "connect-redis": "^6.0.0", diff --git a/account/yarn.lock b/account/yarn.lock index 691b178..7203f20 100644 --- a/account/yarn.lock +++ b/account/yarn.lock @@ -45,10 +45,10 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@lingdocs/inflect@5.1.10": - "integrity" "sha512-LPJqXSnb2zLWLfMXMTCs/1NOGYQnzPHbKu5h/SdvFYobCxnk2tgngtSWcCmeqYbNXKqQvbDwqmseLlcnUZKysA==" - "resolved" "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.10.tgz" - "version" "5.1.10" +"@lingdocs/inflect@5.2.1": + "integrity" "sha512-A2Is03lIx8od0JfnHjAbreNeI1jsoRARRXnNhqaJ+Hw7DMPMXEkOlpZnY/luvTcUA7/E5FHKEEAtBOng//zcog==" + "resolved" "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.2.1.tgz" + "version" "5.2.1" dependencies: "pbf" "^3.2.1" "rambda" "^7.3.0" diff --git a/functions/package-lock.json b/functions/package-lock.json index 32b5e28..90503c5 100644 --- a/functions/package-lock.json +++ b/functions/package-lock.json @@ -7,7 +7,7 @@ "name": "functions", "dependencies": { "@google-cloud/storage": "^5.8.1", - "@lingdocs/inflect": "5.1.10", + "@lingdocs/inflect": "5.2.1", "@types/cors": "^2.8.10", "@types/google-spreadsheet": "^3.0.2", "@types/react": "^18.0.21", @@ -391,9 +391,9 @@ } }, "node_modules/@lingdocs/inflect": { - "version": "5.1.10", - "resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.10.tgz", - "integrity": "sha512-LPJqXSnb2zLWLfMXMTCs/1NOGYQnzPHbKu5h/SdvFYobCxnk2tgngtSWcCmeqYbNXKqQvbDwqmseLlcnUZKysA==", + "version": "5.2.1", + "resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.2.1.tgz", + "integrity": "sha512-A2Is03lIx8od0JfnHjAbreNeI1jsoRARRXnNhqaJ+Hw7DMPMXEkOlpZnY/luvTcUA7/E5FHKEEAtBOng//zcog==", "license": "MIT", "dependencies": { "pbf": "^3.2.1", @@ -3499,9 +3499,9 @@ } }, "@lingdocs/inflect": { - "version": "5.1.10", - "resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.10.tgz", - "integrity": "sha512-LPJqXSnb2zLWLfMXMTCs/1NOGYQnzPHbKu5h/SdvFYobCxnk2tgngtSWcCmeqYbNXKqQvbDwqmseLlcnUZKysA==", + "version": "5.2.1", + "resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.2.1.tgz", + "integrity": "sha512-A2Is03lIx8od0JfnHjAbreNeI1jsoRARRXnNhqaJ+Hw7DMPMXEkOlpZnY/luvTcUA7/E5FHKEEAtBOng//zcog==", "requires": { "pbf": "^3.2.1", "rambda": "^7.3.0" diff --git a/functions/package.json b/functions/package.json index 05a6616..181a63a 100644 --- a/functions/package.json +++ b/functions/package.json @@ -14,7 +14,7 @@ "main": "lib/functions/src/index.js", "dependencies": { "@google-cloud/storage": "^5.8.1", - "@lingdocs/inflect": "5.1.10", + "@lingdocs/inflect": "5.2.1", "@types/cors": "^2.8.10", "@types/google-spreadsheet": "^3.0.2", "@types/react": "^18.0.21", diff --git a/functions/src/publish.ts b/functions/src/publish.ts index c81872e..0c4296f 100644 --- a/functions/src/publish.ts +++ b/functions/src/publish.ts @@ -26,8 +26,8 @@ const title = "LingDocs Pashto Dictionary" const license = "Copyright © 2021 lingdocs.com All Rights Reserved - Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License - https://creativecommons.org/licenses/by-nc-sa/4.0/"; const bucketName = "lingdocs"; const baseUrl = `https://storage.googleapis.com/${bucketName}/`; -const dictionaryFilename = "dictionary"; -const dictionaryInfoFilename = "dictionary-info"; +const dictionaryFilename = "dict"; +const dictionaryInfoFilename = "dict-info"; const hunspellAffFileFilename = "ps_AFF.aff"; const hunspellDicFileFilename = "ps_AFF.dic"; const url = `${baseUrl}${dictionaryFilename}`; @@ -84,29 +84,30 @@ async function doHunspell(entries: T.DictionaryEntry[]) { * @returns * */ + async function getRawEntries(): Promise { - const doc = new GoogleSpreadsheet( - functions.config().sheet.id, - ); - await doc.useServiceAccountAuth({ - client_email: functions.config().serviceacct.email, - private_key: functions.config().serviceacct.key, - }); - await doc.loadInfo(); - const sheet = doc.sheetsByIndex[0]; - const rows = await sheet.getRows(); + let rows: GoogleSpreadsheetRow[] = [] + async function getRows() { + const doc = new GoogleSpreadsheet( + functions.config().sheet.id, + ); + await doc.useServiceAccountAuth({ + client_email: functions.config().serviceacct.email, + private_key: functions.config().serviceacct.key, + }); + await doc.loadInfo(); + const sheet = doc.sheetsByIndex[0]; + rows = await sheet.getRows(); + rows.sort((a, b) => a.ts > b.ts ? -1 : a.ts < b.ts ? 1 : 0); + } + getRows() async function deleteRow(i: number) { console.log("WILL DELETE ROW", rows[i].p, rows[i].ts, rows[i].f); await rows[i].delete(); } - return await makeEntries(rows, deleteRow); -} - -async function makeEntries(rows: GoogleSpreadsheetRow[], deleteRow: (i: number) => Promise): Promise { const entries: T.DictionaryEntry[] = []; let sheetIndex = 0; // get the rows in order of ts for easy detection of duplicate entries - rows.sort((a, b) => a.ts > b.ts ? -1 : a.ts < b.ts ? 1 : 0); for (let i = 0; i < rows.length; i++) { function sameEntry(a: any, b: any): boolean { return a.p === b.p && a.f === b.f && a.e === b.e; diff --git a/website/package.json b/website/package.json index a31fdfa..081de5a 100644 --- a/website/package.json +++ b/website/package.json @@ -7,7 +7,7 @@ "private": true, "dependencies": { "@fortawesome/fontawesome-free": "^5.15.2", - "@lingdocs/ps-react": "5.1.10", + "@lingdocs/ps-react": "5.2.1", "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", diff --git a/website/yarn.lock b/website/yarn.lock index f71f34c..ac454bc 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -2349,10 +2349,10 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@lingdocs/ps-react@5.1.10": - version "5.1.10" - resolved "https://npm.lingdocs.com/@lingdocs%2fps-react/-/ps-react-5.1.10.tgz#155646c436c7dc2644c60815cef6b914ba7fef69" - integrity sha512-3PtfEZBmNCa6ptlWezLXpHrngcRmPc8QKguGiXI48TnVxSvAaSH63FTwRQJIDznYasq3bnDSH/7Sta8SX8vvBA== +"@lingdocs/ps-react@5.2.1": + version "5.2.1" + resolved "https://npm.lingdocs.com/@lingdocs%2fps-react/-/ps-react-5.2.1.tgz#e483ced9d12a1913564831f8b37fdb843b912e80" + integrity sha512-2gG2GVNISgjgiyOjyt1rjCPeJ+Bd+FWKZMPXHV98KFSWuuUEX5Jhf8K2FXzv0CGdTOviI++V1O07y86iCSlaXA== dependencies: "@formkit/auto-animate" "^1.0.0-beta.3" classnames "^2.2.6"