Skip to content

Commit

Permalink
fix uuid dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
yariksav committed May 5, 2020
1 parent 8ea3ed2 commit 31525e6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
29 changes: 23 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "adonis-smser",
"version": "0.0.2",
"version": "0.0.4",
"description": "Sms provider for adonis framework and has support for several common sms services to send sms",
"main": "index.js",
"directories": {
Expand Down Expand Up @@ -58,6 +58,7 @@
"debug": "^3.1.0",
"get-stream": "^3.0.0",
"got": "^8.3.0",
"uuid": "^8.0.0",
"xml-js": "^1.6.4"
},
"repository": {
Expand Down
9 changes: 5 additions & 4 deletions src/Smser/Activator.js
Expand Up @@ -10,7 +10,7 @@
*/

const GE = require('@adonisjs/generic-exceptions')
const uuidv1 = require('uuid/v1')
const uuidv1 = require('uuid').v1
const debug = require('debug')('adonis:smser')

/**
Expand Down Expand Up @@ -59,8 +59,8 @@ class Activator {
* ```
*/
async sendActivation (text, phone) {
debug('sendActivation', {text, phone})
const code = this.generator(this._codeSize)
debug('sendActivation', { text, phone, code })
const token = uuidv1()
if (typeof text === 'function') {
text = text(code)
Expand All @@ -81,7 +81,8 @@ class Activator {
await this._smser.send(text, obj.phone)
await this._nodeCache.set(token, obj)
return {
token: token
token,
code
}
}

Expand All @@ -100,7 +101,7 @@ class Activator {
* ```
*/
async resendActivation (token) {
debug('resendActivation', {token})
debug('resendActivation', { token })
const obj = await this._nodeCache.get(token)
if (!obj) {
throw new GE.LogicalException('Token not found', 400, 'E_INVALID_TOKEN')
Expand Down
2 changes: 1 addition & 1 deletion src/Smser/Drivers/Memory.js
Expand Up @@ -10,7 +10,7 @@
*/

const BaseDriver = require('./BaseDriver')
const uuidv1 = require('uuid/v1')
const uuidv1 = require('uuid').v1
/**
* Memory driver is used to get the message back as
* an object over sending it to a real user.
Expand Down

0 comments on commit 31525e6

Please sign in to comment.