Skip to content

Commit

Permalink
fix: deps, adopt changes in AsyncMemoCache interface
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Mar 30, 2024
1 parent 2833669 commit 68b7d71
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
13 changes: 4 additions & 9 deletions src/kv/commonKeyValueDaoMemoCache.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AsyncMemoCache } from '@naturalcycles/js-lib'
import { AsyncMemoCache, MISS } from '@naturalcycles/js-lib'
import { CommonKeyValueDao } from './commonKeyValueDao'

/**
Expand All @@ -12,16 +12,11 @@ import { CommonKeyValueDao } from './commonKeyValueDao'
export class CommonKeyValueDaoMemoCache<VALUE = any> implements AsyncMemoCache<string, VALUE> {
constructor(private dao: CommonKeyValueDao<VALUE>) {}

async get(k: string): Promise<VALUE | Error | undefined> {
return (await this.dao.getById(k)) || undefined
async get(k: string): Promise<VALUE | typeof MISS> {
return (await this.dao.getById(k)) || MISS
}

async set(k: string, v: VALUE | Error): Promise<void> {
if (v instanceof Error) {
// We currently don't persist errors there
return
}

async set(k: string, v: VALUE): Promise<void> {
await this.dao.save(k, v)
}

Expand Down
32 changes: 16 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,9 @@
yargs "^17.0.0"

"@naturalcycles/js-lib@^14.0.0", "@naturalcycles/js-lib@^14.116.0":
version "14.215.0"
resolved "https://registry.yarnpkg.com/@naturalcycles/js-lib/-/js-lib-14.215.0.tgz#7618086c6659420e2392c2b372daeed207d80eac"
integrity sha512-DsQcXVQniSG/IUxjmN6bBaDEiysPBdsHmWY+L4TR/v2uUtPlpeh1C+NJ6ZcWBn9zzs5pL5TofCqQ/FxL++opSg==
version "14.217.0"
resolved "https://registry.yarnpkg.com/@naturalcycles/js-lib/-/js-lib-14.217.0.tgz#766a3c6b4167438e22deac07f4d509fccda8ada5"
integrity sha512-KiXKtUW+EGpBMoudYwRAKRC9Q3rrJvNRbYDkh5XOj1oeOWqUmsqDRkt3jSA7zIpaReG2kDJVv9xvqPRJ5RSBCw==
dependencies:
tslib "^2.0.0"
zod "^3.20.2"
Expand Down Expand Up @@ -1062,9 +1062,9 @@
"@types/node" "*"

"@types/node@*", "@types/node@^20.1.0", "@types/node@^20.2.1":
version "20.11.30"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.30.tgz#9c33467fc23167a347e73834f788f4b9f399d66f"
integrity sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==
version "20.12.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.2.tgz#9facdd11102f38b21b4ebedd9d7999663343d72e"
integrity sha512-zQ0NYO87hyN6Xrclcqp7f8ZbXNbRfoGWNcMvHTPQp9UUrwI0mI7XBz+cu7/W6/VClYo2g63B0cjull/srU7LgQ==
dependencies:
undici-types "~5.26.4"

Expand Down Expand Up @@ -2172,9 +2172,9 @@ [email protected]:
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==

electron-to-chromium@^1.4.668:
version "1.4.719"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.719.tgz#22a94ce7a5150511ba88e900836039e159efe22c"
integrity sha512-FbWy2Q2YgdFzkFUW/W5jBjE9dj+804+98E4Pup78JBPnbdb3pv6IneY2JCPKdeKLh3AOKHQeYf+KwLr7mxGh6Q==
version "1.4.722"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.722.tgz#99ae3484c5fc0f387d39ad98d77e1f259b9f4074"
integrity sha512-5nLE0TWFFpZ80Crhtp4pIp8LXCztjYX41yUcV6b+bKR2PqzjskTMOOlBi1VjBHlvHwS+4gar7kNKOrsbsewEZQ==

emittery@^0.13.1:
version "0.13.1"
Expand Down Expand Up @@ -2209,9 +2209,9 @@ error-ex@^1.3.1:
is-arrayish "^0.2.1"

es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23.2:
version "1.23.2"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.23.2.tgz#693312f3940f967b8dd3eebacb590b01712622e0"
integrity sha512-60s3Xv2T2p1ICykc7c+DNDPLDMm9t4QxCOUU0K9JxiLjM3C1zB9YVdN7tjxrFd4+AkZ8CdX1ovUga4P2+1e+/w==
version "1.23.3"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.23.3.tgz#8f0c5a35cd215312573c5a27c87dfd6c881a0aa0"
integrity sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==
dependencies:
array-buffer-byte-length "^1.0.1"
arraybuffer.prototype.slice "^1.0.3"
Expand Down Expand Up @@ -2252,11 +2252,11 @@ es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23
safe-regex-test "^1.0.3"
string.prototype.trim "^1.2.9"
string.prototype.trimend "^1.0.8"
string.prototype.trimstart "^1.0.7"
string.prototype.trimstart "^1.0.8"
typed-array-buffer "^1.0.2"
typed-array-byte-length "^1.0.1"
typed-array-byte-offset "^1.0.2"
typed-array-length "^1.0.5"
typed-array-length "^1.0.6"
unbox-primitive "^1.0.2"
which-typed-array "^1.1.15"

Expand Down Expand Up @@ -5081,7 +5081,7 @@ string.prototype.trimend@^1.0.8:
define-properties "^1.2.1"
es-object-atoms "^1.0.0"

string.prototype.trimstart@^1.0.7:
string.prototype.trimstart@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz#7ee834dda8c7c17eff3118472bb35bfedaa34dde"
integrity sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==
Expand Down Expand Up @@ -5384,7 +5384,7 @@ typed-array-byte-offset@^1.0.2:
has-proto "^1.0.3"
is-typed-array "^1.1.13"

typed-array-length@^1.0.5:
typed-array-length@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.6.tgz#57155207c76e64a3457482dfdc1c9d1d3c4c73a3"
integrity sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==
Expand Down

0 comments on commit 68b7d71

Please sign in to comment.