@auth/dgraph-adapter 1.3.3 → 1.5.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/lib/client.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,oJAAoJ;IACpJ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;IAChC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,IAAI,SAAsB;gBACd,MAAM,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG;CAIzD;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,kBAAkB;kBA4BpC,MAAM,cACD,OAAO,MAAM,EAAE,GAAG,CAAC;EAepC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/lib/client.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,oJAAoJ;IACpJ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;IAChC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,IAAI,SAAsB;gBACd,MAAM,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG;CAIzD;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,kBAAkB;kBA8BpC,MAAM,cACD,OAAO,MAAM,EAAE,GAAG,CAAC;EAepC"}
package/lib/client.js CHANGED
@@ -8,10 +8,10 @@ export class DgraphClientError extends Error {
8
8
  }
9
9
  export function client(params) {
10
10
  if (!params.authToken) {
11
- throw new Error("Dgraph client error: Please provide an api key");
11
+ throw new Error("Dgraph client error: Please provide an API key");
12
12
  }
13
13
  if (!params.endpoint) {
14
- throw new Error("Dgraph client error: Please provide a graphql endpoint");
14
+ throw new Error("Dgraph client error: Please provide a valid GraphQL endpoint");
15
15
  }
16
16
  const { endpoint, authToken, jwtSecret, jwtAlgorithm = "HS256", authHeader = "Authorization", } = params;
17
17
  const headers = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auth/dgraph-adapter",
3
- "version": "1.3.3",
3
+ "version": "1.5.0",
4
4
  "description": "Dgraph adapter for Auth.js",
5
5
  "homepage": "https://authjs.dev",
6
6
  "repository": "https://github.com/nextauthjs/next-auth",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "jsonwebtoken": "^9.0.0",
44
- "@auth/core": "0.26.3"
44
+ "@auth/core": "0.28.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsc",
package/src/lib/client.ts CHANGED
@@ -34,10 +34,12 @@ export class DgraphClientError extends Error {
34
34
 
35
35
  export function client(params: DgraphClientParams) {
36
36
  if (!params.authToken) {
37
- throw new Error("Dgraph client error: Please provide an api key")
37
+ throw new Error("Dgraph client error: Please provide an API key")
38
38
  }
39
39
  if (!params.endpoint) {
40
- throw new Error("Dgraph client error: Please provide a graphql endpoint")
40
+ throw new Error(
41
+ "Dgraph client error: Please provide a valid GraphQL endpoint"
42
+ )
41
43
  }
42
44
 
43
45
  const {
@@ -38,7 +38,7 @@ type User
38
38
  or: [
39
39
  {
40
40
  rule: """
41
- query ($userId: String!) {queryUser(filter: { id: { eq: $userId } } ) {id}}
41
+ query ($userId: ID!) {queryUser(filter: { id: [$userId] } ) {id}}
42
42
  """
43
43
  }
44
44
  { rule: "{$nextAuth: { eq: true } }" }
@@ -50,7 +50,7 @@ type User
50
50
  or: [
51
51
  {
52
52
  rule: """
53
- query ($userId: String!) {queryUser(filter: { id: { eq: $userId } } ) {id}}
53
+ query ($userId: ID!) {queryUser(filter: { id: [$userId] } ) {id}}
54
54
  """
55
55
  }
56
56
  { rule: "{$nextAuth: { eq: true } }" }