rads-db 3.0.43 → 3.0.45

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.
@@ -26,16 +26,18 @@ function getRadsUiUser(radsAuthHeader, apiKey) {
26
26
  message: `Unauthorized - malformed authHeader`
27
27
  });
28
28
  }
29
- if (apiKey !== key) {
30
- throw (0, _h.createError)({
31
- statusCode: 401,
32
- message: `Unauthorized`
33
- });
29
+ if (key === apiKey) {
30
+ return {
31
+ email,
32
+ pretendAsUserId
33
+ };
34
+ }
35
+ if (key === "dev" && process.env.NODE_ENV === "development") {
36
+ return {
37
+ email,
38
+ pretendAsUserId
39
+ };
34
40
  }
35
- return {
36
- email,
37
- pretendAsUserId
38
- };
39
41
  }
40
42
  function getRestRoutes(options) {
41
43
  const {
@@ -12,10 +12,12 @@ export function getRadsUiUser(radsAuthHeader, apiKey) {
12
12
  if (!email || !keyType || !key || keyType !== "ApiKey") {
13
13
  throw createError({ statusCode: 401, message: `Unauthorized - malformed authHeader` });
14
14
  }
15
- if (apiKey !== key) {
16
- throw createError({ statusCode: 401, message: `Unauthorized` });
15
+ if (key === apiKey) {
16
+ return { email, pretendAsUserId };
17
+ }
18
+ if (key === "dev" && process.env.NODE_ENV === "development") {
19
+ return { email, pretendAsUserId };
17
20
  }
18
- return { email, pretendAsUserId };
19
21
  }
20
22
  export function getRestRoutes(options) {
21
23
  const { db, prefix = "/api/" } = options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rads-db",
3
- "version": "3.0.43",
3
+ "version": "3.0.45",
4
4
  "files": [
5
5
  "dist",
6
6
  "drivers",