Skip to content

Commit a95fbd6

Browse files
committed
finally fix uuid import mess
1 parent dd368e6 commit a95fbd6

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

examples/with-prisma/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
"graphql-cli": "^2.16.4",
1111
"graphql-yoga": "^1.14.12",
1212
"prisma": "^1.11.1",
13-
"prisma-binding": "^2.1.0"
13+
"prisma-binding": "^2.1.0",
14+
"ts-node": "^7.0.0"
1415
},
1516
"scripts": {
16-
"start": "node server.js",
17+
"start": "ts-node server.ts",
1718
"prisma": "PRISMA_MANAGEMENT_API_SECRET=mymanagementsecret123 prisma"
1819
}
1920
}

examples/with-prisma/yarn.lock

+13
Original file line numberDiff line numberDiff line change
@@ -5229,6 +5229,19 @@ ts-node@^6.0.2:
52295229
source-map-support "^0.5.6"
52305230
yn "^2.0.0"
52315231

5232+
ts-node@^7.0.0:
5233+
version "7.0.0"
5234+
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-7.0.0.tgz#a94a13c75e5e1aa6b82814b84c68deb339ba7bff"
5235+
dependencies:
5236+
arrify "^1.0.0"
5237+
buffer-from "^1.1.0"
5238+
diff "^3.1.0"
5239+
make-error "^1.1.1"
5240+
minimist "^1.2.0"
5241+
mkdirp "^0.5.1"
5242+
source-map-support "^0.5.6"
5243+
yn "^2.0.0"
5244+
52325245
tunnel-agent@^0.6.0:
52335246
version "0.6.0"
52345247
resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"

packages/graphql-authentication/package.json

-5
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@
6969
"transform": {
7070
"^.+\\.ts$": "ts-jest"
7171
},
72-
"globals": {
73-
"ts-jest": {
74-
"skipBabel": true
75-
}
76-
},
7772
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(js|ts)$",
7873
"setupTestFrameworkScriptFile": "<rootDir>/src/__tests__/setup.ts",
7974
"moduleFileExtensions": [

packages/graphql-authentication/src/mutations.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as bcrypt from 'bcryptjs';
22
import * as jwt from 'jsonwebtoken';
33
import * as validator from 'validator';
4-
import * as uuidv4 from 'uuid/v4';
4+
import { v4 as uuid } from 'uuid';
55
import { getUser, Context } from './utils';
66
import { User } from './Adapter';
77
import {
@@ -96,7 +96,7 @@ export const mutations = {
9696

9797
validatePassword(data.password);
9898
const hashedPassword = await getHashedPassword(data.password);
99-
const emailConfirmToken = uuidv4();
99+
const emailConfirmToken = uuid();
100100

101101
const newUser = await ctx.graphqlAuthentication.adapter.createUserBySignup(
102102
ctx,
@@ -266,7 +266,7 @@ export const mutations = {
266266
// This token will be used in the email to the user.
267267
// According to https://gist.github.com/joepie91/7105003c3b26e65efcea63f3db82dfba
268268
// uuid v4 is safe to be used as random token generator.
269-
const inviteToken = uuidv4();
269+
const inviteToken = uuid();
270270

271271
const newUser = await ctx.graphqlAuthentication.adapter.createUserByInvite(
272272
ctx,
@@ -327,7 +327,7 @@ export const mutations = {
327327
// This token will be used in the email to the user.
328328
// According to https://gist.github.com/joepie91/7105003c3b26e65efcea63f3db82dfba
329329
// uuid v4 is safe to be used as random token generator.
330-
const resetToken = uuidv4();
330+
const resetToken = uuid();
331331
const now = new Date();
332332
// Expires in two hours
333333
const resetExpires = new Date(now.getTime() + 7200000).toISOString();

tsconfig.base.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"noUnusedLocals": false,
1010
"strictFunctionTypes": false,
1111
"noImplicitAny": false,
12-
"forceConsistentCasingInFileNames": true,
13-
"allowSyntheticDefaultImports": true
12+
"forceConsistentCasingInFileNames": true
1413
}
1514
}

0 commit comments

Comments
 (0)