auth0-ext-compilers
Advanced tools
Comparing version 6.0.0 to 6.1.0
@@ -6,4 +6,13 @@ 'use strict'; | ||
module.exports = Factory.createCompiler(sendPhoneMessageHandler); | ||
const ExtensibilityUserError = require('../errors/ExtensibilityUserError'); | ||
class SendPhoneMessageError extends ExtensibilityUserError { | ||
constructor(message, friendlyMessage) { | ||
super(message); | ||
this.friendlyMessage = friendlyMessage || message; | ||
} | ||
} | ||
module.exports = Factory.createCompiler(sendPhoneMessageHandler, [SendPhoneMessageError]); | ||
function sendPhoneMessageHandler (func, webtaskContext, cb) { | ||
@@ -10,0 +19,0 @@ return Authz.is_authorized(webtaskContext, error => { |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"description": "Webtask compilers for Auth0 platform extensibility points", | ||
@@ -11,0 +11,0 @@ "engines": { |
@@ -589,3 +589,43 @@ /* eslint-env node, mocha */ | ||
}); | ||
it('provides a custom error object', function (done) { | ||
compiler({ | ||
nodejsCompiler, | ||
script: 'module.exports = function(recipient, text, context, cb) { cb(new SendPhoneMessageError("e1", "e2")); };' | ||
}, function (error, func) { | ||
Assert.ifError(error); | ||
simulate(func, { | ||
body: { | ||
recipient: '1-999-888-657-2134', text: 'dis iz a text', context: { | ||
message_type: 'sms', | ||
action: 'second-factor-authentication', | ||
language: 'korean', | ||
code: 'SOMEOTP12345', | ||
ip: '127.0.0.1', | ||
user_agent: 'someAgent', | ||
user: {}, | ||
client: { | ||
client_id: 'someClientId', | ||
name: 'Test Application', | ||
client_metadata: {} | ||
} | ||
} | ||
}, | ||
headers: {}, | ||
method: 'POST', | ||
}, function (error, envelope) { | ||
Assert.ifError(error); | ||
const { status, data } = envelope; | ||
Assert.equal(status, 'error'); | ||
Assert.equal(data.name, 'SendPhoneMessageError'); | ||
Assert.equal(data.message, 'e1'); | ||
Assert.equal(data.friendlyMessage, 'e2'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); // valid payload | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110359
2060
1