@openneuro/server 4.29.6 → 4.29.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openneuro/server",
3
- "version": "4.29.6",
3
+ "version": "4.29.8",
4
4
  "description": "Core service for the OpenNeuro platform.",
5
5
  "license": "MIT",
6
6
  "main": "src/server.js",
@@ -21,7 +21,7 @@
21
21
  "@elastic/elasticsearch": "8.13.1",
22
22
  "@graphql-tools/schema": "^10.0.0",
23
23
  "@keyv/redis": "^2.7.0",
24
- "@openneuro/search": "^4.29.6",
24
+ "@openneuro/search": "^4.29.8",
25
25
  "@sentry/node": "^8.25.0",
26
26
  "@sentry/profiling-node": "^8.25.0",
27
27
  "base64url": "^3.0.0",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "dc3b42368288fc820ea33e09d809d8249bc73a9c"
88
+ "gitHead": "1cf2284b38246032cf3eca1046e697301d7c78e1"
89
89
  }
@@ -0,0 +1,32 @@
1
+ import CacheItem from "../item"
2
+ import { CacheType } from "../types"
3
+
4
+ const redisMock = vi.fn(() => ({
5
+ getBuffer: vi.fn(),
6
+ setex: vi.fn(),
7
+ set: vi.fn(),
8
+ }))
9
+
10
+ describe("CacheItem", () => {
11
+ it("should succeed when the cache miss sets doNotCache but throws an exception", async () => {
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ const item = new CacheItem(redisMock() as any, CacheType.commitFiles, [
14
+ "ds000001",
15
+ "12345678",
16
+ ])
17
+ let fail = true
18
+ expect(
19
+ await item.get(async (doNotCache) => {
20
+ // On the first try
21
+ if (fail) {
22
+ fail = false
23
+ doNotCache(true)
24
+ throw new Error("expected failure")
25
+ } else {
26
+ doNotCache(false)
27
+ return true
28
+ }
29
+ }),
30
+ ).toBe(true)
31
+ })
32
+ })
package/src/cache/item.ts CHANGED
@@ -2,6 +2,7 @@ import type { Redis } from "ioredis"
2
2
  import * as zlib from "zlib"
3
3
  import { promisify } from "util"
4
4
  import type { CacheType } from "./types"
5
+ import * as Sentry from "@sentry/node"
5
6
  export { CacheType } from "./types"
6
7
 
7
8
  const compress = promisify(zlib.gzip)
@@ -77,9 +78,10 @@ class CacheItem {
77
78
  }
78
79
  return data
79
80
  }
80
- } catch {
81
+ } catch (err) {
82
+ Sentry.captureException(err)
81
83
  // Keep going as though we had a cache miss if there is a problem but don't cache it
82
- return miss()
84
+ return miss((_doNotCache: boolean) => {})
83
85
  }
84
86
  }
85
87
  /**
@@ -704,6 +704,7 @@ export const typeDefs = `
704
704
  severity: Severity
705
705
  rule: String
706
706
  issueMessage: String
707
+ affects: String
707
708
  }
708
709
 
709
710
  input ValidatorCodeMessageInput {