Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"


npm run format
npm run lint:fix

npx pretty-quick --staged
Expand Down
6 changes: 0 additions & 6 deletions .husky/pre-push

This file was deleted.

1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#1062]: https://github.com/auth0/auth0-deploy-cli/issues/1062
[#1063]: https://github.com/auth0/auth0-deploy-cli/issues/1063
[#1064]: https://github.com/auth0/auth0-deploy-cli/issues/1064

[Unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v8.8.0...HEAD
[8.8.0]: https://github.com/auth0/auth0-deploy-cli/compare/v8.7.1...v8.8.0
[8.7.1]: https://github.com/auth0/auth0-deploy-cli/compare/v8.7.0...v8.7.1
Expand Down
19 changes: 10 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint:fix": "eslint --fix --ignore-path .eslintignore --ignore-pattern webpack . && kacl lint",
"lint": "eslint --ignore-path .eslintignore --ignore-pattern webpack . && kacl lint",
"format": "npx prettier --write .",
"test": "ts-mocha -p tsconfig.json --recursive 'test/**/*.test*' --exclude 'test/e2e/*' --timeout 7500",
"test": "ts-mocha -p tsconfig.json --recursive 'test/**/*.test*' --exclude 'test/e2e/*' --timeout 15000",
"test:e2e:node-module": "ts-mocha -p tsconfig.json --recursive 'test/e2e/*.test*' --timeout 120000",
"test:e2e:cli": "sh ./test/e2e/e2e-cli.sh",
"test:coverage": "nyc npm run test && nyc report --reporter=lcov",
Expand Down Expand Up @@ -58,7 +58,7 @@
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-import": "^2.31.0",
"husky": "^7.0.4",
"husky": "^9.1.7",
"kacl": "^1.1.1",
"mocha": "^10.8.2",
"nock": "^13.5.6",
Expand Down
9 changes: 8 additions & 1 deletion src/context/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ export function emailProviderDefaults(emailProvider) {
export function phoneProviderDefaults(phoneProvider) {
const updated = { ...phoneProvider };

const removeKeysFromOutput = ['id', 'created_at', 'updated_at', 'channel', 'tenant', 'credentials'];
const removeKeysFromOutput = [
'id',
'created_at',
'updated_at',
'channel',
'tenant',
'credentials',
];
removeKeysFromOutput.forEach((key) => {
if (key in updated) {
delete updated[key];
Expand Down
2 changes: 1 addition & 1 deletion src/context/directory/handlers/phoneProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function dump(context: DirectoryContext): Promise<void> {

if (!phoneProviders) {
return;
}// Skip, nothing to dump
} // Skip, nothing to dump

const phoneProvidersFolder = path.join(context.filePath, constants.PHONE_PROVIDER_DIRECTORY);
fs.ensureDirSync(phoneProvidersFolder);
Expand Down
4 changes: 2 additions & 2 deletions src/context/yaml/handlers/phoneProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { PhoneProvider } from '../../../tools/auth0/handlers/phoneProvider';
import { ParsedAsset } from '../../../types';
import { phoneProviderDefaults } from '../../defaults';

type ParsedPhoneProviders = ParsedAsset<'phoneProviders', PhoneProvider[] >;
type ParsedPhoneProviders = ParsedAsset<'phoneProviders', PhoneProvider[]>;

async function parse(context: YAMLContext): Promise<ParsedPhoneProviders> {
const { phoneProviders } = context.assets;
Expand All @@ -27,7 +27,7 @@ async function dump(context: YAMLContext): Promise<ParsedPhoneProviders> {
});

return {
phoneProviders
phoneProviders,
};
}

Expand Down
19 changes: 7 additions & 12 deletions src/tools/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,13 @@ const constants = {
'reset-password-mfa-sms-challenge',
'reset-password-mfa-phone-challenge',
'reset-password-mfa-voice-challenge',
'reset-password-mfa-recovery-code-challenge'
'reset-password-mfa-recovery-code-challenge',
],
'device-flow': [
'device-code-activation',
'device-code-activation-allowed',
'device-code-activation-denied',
'device-code-confirmation'
'device-code-confirmation',
],
mfa: [
'mfa-detect-browser-capabilities',
Expand All @@ -260,18 +260,13 @@ const constants = {
'mfa-push-list',
'mfa-push-welcome',
],
'mfa-phone':['mfa-phone-challenge', 'mfa-phone-enrollment'],
'mfa-phone': ['mfa-phone-challenge', 'mfa-phone-enrollment'],
'mfa-voice': ['mfa-voice-challenge', 'mfa-voice-enrollment'],
'invitation': ['accept-invitation'],
'organizations': ['organization-selection', 'organization-picker'],
'mfa-otp': [
'mfa-otp-challenge',
'mfa-otp-enrollment-code',
'mfa-otp-enrollment-qr'
],
invitation: ['accept-invitation'],
organizations: ['organization-selection', 'organization-picker'],
'mfa-otp': ['mfa-otp-challenge', 'mfa-otp-enrollment-code', 'mfa-otp-enrollment-qr'],
'mfa-recovery-code': ['mfa-recovery-code-challenge', 'mfa-recovery-code-enrollment'],
'common': ['redeem-ticket'],

common: ['redeem-ticket'],
} as PromptScreenMapping,
};

Expand Down
64 changes: 35 additions & 29 deletions test/context/directory/phoneProviders.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,45 +31,51 @@ describe('#directory context phone provider', () => {
const context = new Context(config, mockMgmtClient());
await context.loadAssetsFromLocal();

expect(context.assets.phoneProviders).to.deep.equal([{
disabled: false,
name: 'twilio',
configuration:{
sid: 'twilio_sid',
default_from: '++15673812247',
delivery_methods: ['text', 'voice']
}
}]);
expect(context.assets.phoneProviders).to.deep.equal([
{
disabled: false,
name: 'twilio',
configuration: {
sid: 'twilio_sid',
default_from: '++15673812247',
delivery_methods: ['text', 'voice'],
},
},
]);
});

it('should dump phone providers', async () => {
const dir = path.join(testDataDir, 'directory', 'phoneProviderDump');
cleanThenMkdir(dir);
const context = new Context({ AUTH0_INPUT_FILE: dir }, mockMgmtClient());

context.assets.phoneProviders = [{
disabled: false,
name: 'twilio',
configuration:{
sid: 'twilio_sid',
default_from: '++15673812247',
delivery_methods: ['text', 'voice']
}
}];
context.assets.phoneProviders = [
{
disabled: false,
name: 'twilio',
configuration: {
sid: 'twilio_sid',
default_from: '++15673812247',
delivery_methods: ['text', 'voice'],
},
},
];

await handler.dump(context);
const phoneTemplateFolder = path.join(dir, constants.PHONE_PROVIDER_DIRECTORY);
expect(loadJSON(path.join(phoneTemplateFolder, 'provider.json'))).to.deep.equal([{
disabled: false,
name: 'twilio',
configuration:{
sid: 'twilio_sid',
default_from: '++15673812247',
delivery_methods: ['text', 'voice']
},
credentials: {
auth_token: '##TWILIO_AUTH_TOKEN##'
expect(loadJSON(path.join(phoneTemplateFolder, 'provider.json'))).to.deep.equal([
{
disabled: false,
name: 'twilio',
configuration: {
sid: 'twilio_sid',
default_from: '++15673812247',
delivery_methods: ['text', 'voice'],
},
credentials: {
auth_token: '##TWILIO_AUTH_TOKEN##',
},
},
}]);
]);
});
});
6 changes: 3 additions & 3 deletions test/context/yaml/context.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('#YAML context validation', () => {
],
connections: [],
databases: [],
phoneProviders : [],
phoneProviders: [],
emailProvider: {
enabled: true,
name: 'smtp',
Expand Down Expand Up @@ -333,7 +333,7 @@ describe('#YAML context validation', () => {
],
connections: [],
databases: [],
phoneProviders : [],
phoneProviders: [],
emailProvider: {
enabled: true,
name: 'smtp',
Expand Down Expand Up @@ -460,7 +460,7 @@ describe('#YAML context validation', () => {
enabled: true,
name: 'smtp',
},
phoneProviders:[],
phoneProviders: [],
emailTemplates: [
{
body: './emailTemplates/blocked_account.html',
Expand Down
66 changes: 36 additions & 30 deletions test/context/yaml/phoneProviders.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@ phoneProviders:
const yamlFile = path.join(dir, 'config.yaml');
fs.writeFileSync(yamlFile, yaml);

const target = [{
credentials: {
auth_token : 'some_auth_token',
const target = [
{
credentials: {
auth_token: 'some_auth_token',
},
disabled: false,
name: 'twilio',
configuration: {
sid: 'twilio_sid',
default_from: '++15673812247',
delivery_methods: ['text', 'voice'],
},
},
disabled: false,
name: 'twilio',
configuration:{
sid: 'twilio_sid',
default_from: '++15673812247',
delivery_methods: ['text', 'voice']
}
}];
];

const config = { AUTH0_INPUT_FILE: yamlFile, AUTH0_KEYWORD_REPLACE_MAPPINGS: { ENV: 'test' } };
const context = new Context(config, mockMgmtClient());
Expand All @@ -48,30 +50,34 @@ phoneProviders:

it('should dump phone providers', async () => {
const context = new Context({ AUTH0_INPUT_FILE: './test.yml' }, mockMgmtClient());
context.assets.phoneProviders = [{
disabled: false,
name: 'twilio',
configuration:{
sid: 'twilio_sid',
default_from: '++15673812247',
delivery_methods: ['text', 'voice']
}
}];

const dumped = await handler.dump(context);
expect(dumped).to.deep.equal({
phoneProviders: [{
context.assets.phoneProviders = [
{
disabled: false,
name: 'twilio',
configuration:{
configuration: {
sid: 'twilio_sid',
default_from: '++15673812247',
delivery_methods: ['text', 'voice']
delivery_methods: ['text', 'voice'],
},
credentials: {
auth_token: '##TWILIO_AUTH_TOKEN##'
}
}],
},
];

const dumped = await handler.dump(context);
expect(dumped).to.deep.equal({
phoneProviders: [
{
disabled: false,
name: 'twilio',
configuration: {
sid: 'twilio_sid',
default_from: '++15673812247',
delivery_methods: ['text', 'voice'],
},
credentials: {
auth_token: '##TWILIO_AUTH_TOKEN##',
},
},
],
});
});
});