@envelop/auth0 3.4.0-alpha-aca44e1.0 → 4.0.0-alpha-d0d0776.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.
Files changed (3) hide show
  1. package/index.js +27 -8
  2. package/index.mjs +3 -5
  3. package/package.json +19 -7
package/index.js CHANGED
@@ -2,19 +2,40 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
5
  const core = require('@envelop/core');
8
6
  const JwksRsa = require('jwks-rsa');
9
- const jwtPkg = _interopDefault(require('jsonwebtoken'));
7
+ const jwtPkg = require('jsonwebtoken');
10
8
  const graphql = require('graphql');
11
9
 
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ const n = Object.create(null);
15
+ if (e) {
16
+ for (const k in e) {
17
+ if (k !== 'default') {
18
+ const d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ }
25
+ }
26
+ n["default"] = e;
27
+ return Object.freeze(n);
28
+ }
29
+
30
+ const JwksRsa__namespace = /*#__PURE__*/_interopNamespace(JwksRsa);
31
+ const jwtPkg__default = /*#__PURE__*/_interopDefaultLegacy(jwtPkg);
32
+
12
33
  /* eslint-disable no-console */
13
- const { decode, verify } = jwtPkg;
34
+ const { decode, verify } = jwtPkg__default["default"];
14
35
  class UnauthenticatedError extends graphql.GraphQLError {
15
36
  }
16
37
  const useAuth0 = (options) => {
17
- const jkwsClient = new JwksRsa.JwksClient({
38
+ const jkwsClient = new JwksRsa__namespace.JwksClient({
18
39
  cache: true,
19
40
  rateLimit: true,
20
41
  jwksRequestsPerMinute: 5,
@@ -71,9 +92,7 @@ const useAuth0 = (options) => {
71
92
  });
72
93
  return decoded;
73
94
  }
74
- else {
75
- throw new Error(`Failed to decode authentication token!`);
76
- }
95
+ throw new Error(`Failed to decode authentication token!`);
77
96
  };
78
97
  return {
79
98
  async onContextBuilding({ context, extendContext }) {
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { EnvelopError } from '@envelop/core';
2
- import { JwksClient } from 'jwks-rsa';
2
+ import * as JwksRsa from 'jwks-rsa';
3
3
  import jwtPkg from 'jsonwebtoken';
4
4
  import { GraphQLError } from 'graphql';
5
5
 
@@ -8,7 +8,7 @@ const { decode, verify } = jwtPkg;
8
8
  class UnauthenticatedError extends GraphQLError {
9
9
  }
10
10
  const useAuth0 = (options) => {
11
- const jkwsClient = new JwksClient({
11
+ const jkwsClient = new JwksRsa.JwksClient({
12
12
  cache: true,
13
13
  rateLimit: true,
14
14
  jwksRequestsPerMinute: 5,
@@ -65,9 +65,7 @@ const useAuth0 = (options) => {
65
65
  });
66
66
  return decoded;
67
67
  }
68
- else {
69
- throw new Error(`Failed to decode authentication token!`);
70
- }
68
+ throw new Error(`Failed to decode authentication token!`);
71
69
  };
72
70
  return {
73
71
  async onContextBuilding({ context, extendContext }) {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@envelop/auth0",
3
- "version": "3.4.0-alpha-aca44e1.0",
3
+ "version": "4.0.0-alpha-d0d0776.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "2.4.0-alpha-aca44e1.0",
6
+ "@envelop/core": "3.0.0-alpha-d0d0776.0",
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://github.com/dotansimha/envelop.git",
15
+ "url": "https://github.com/n1ru4l/envelop.git",
16
16
  "directory": "packages/plugins/auth0"
17
17
  },
18
18
  "author": "Dotan Simha <dotansimha@gmail.com>",
@@ -25,12 +25,24 @@
25
25
  },
26
26
  "exports": {
27
27
  ".": {
28
- "require": "./index.js",
29
- "import": "./index.mjs"
28
+ "require": {
29
+ "default": "./index.js",
30
+ "types": "./index.d.ts"
31
+ },
32
+ "import": {
33
+ "default": "./index.mjs",
34
+ "types": "./index.d.ts"
35
+ }
30
36
  },
31
37
  "./*": {
32
- "require": "./*.js",
33
- "import": "./*.mjs"
38
+ "require": {
39
+ "default": "./*.js",
40
+ "types": "./*.d.ts"
41
+ },
42
+ "import": {
43
+ "default": "./*.mjs",
44
+ "types": "./*.d.ts"
45
+ }
34
46
  },
35
47
  "./package.json": "./package.json"
36
48
  }