auth0-deploy-cli 7.6.0 → 7.7.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.
- package/.eslintrc +7 -41
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +3 -1
- package/.prettierignore +10 -0
- package/.prettierrc.json +4 -0
- package/CHANGELOG.md +194 -7
- package/CONTRIBUTING.md +2 -2
- package/README.md +3 -0
- package/lib/args.js +16 -15
- package/lib/commands/export.js +3 -3
- package/lib/commands/import.js +6 -6
- package/lib/commands/index.js +1 -1
- package/lib/configFactory.js +5 -1
- package/lib/context/defaults.js +4 -3
- package/lib/context/directory/handlers/actions.js +3 -3
- package/lib/context/directory/handlers/attackProtection.js +4 -4
- package/lib/context/directory/handlers/branding.js +6 -5
- package/lib/context/directory/handlers/clientGrants.js +3 -2
- package/lib/context/directory/handlers/clients.js +1 -1
- package/lib/context/directory/handlers/connections.js +4 -2
- package/lib/context/directory/handlers/databases.js +13 -7
- package/lib/context/directory/handlers/emailProvider.js +3 -2
- package/lib/context/directory/handlers/emailTemplates.js +2 -2
- package/lib/context/directory/handlers/guardianFactorProviders.js +3 -2
- package/lib/context/directory/handlers/guardianFactorTemplates.js +3 -2
- package/lib/context/directory/handlers/guardianFactors.js +3 -2
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +1 -1
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +1 -1
- package/lib/context/directory/handlers/guardianPolicies.js +1 -1
- package/lib/context/directory/handlers/hooks.js +2 -2
- package/lib/context/directory/handlers/index.js +3 -2
- package/lib/context/directory/handlers/organizations.js +1 -1
- package/lib/context/directory/handlers/pages.js +2 -2
- package/lib/context/directory/handlers/resourceServers.js +3 -2
- package/lib/context/directory/handlers/roles.js +1 -1
- package/lib/context/directory/handlers/rules.js +2 -2
- package/lib/context/directory/handlers/rulesConfigs.js +3 -2
- package/lib/context/directory/handlers/tenant.js +3 -2
- package/lib/context/directory/index.js +21 -18
- package/lib/context/index.js +66 -62
- package/lib/context/yaml/handlers/actions.js +9 -6
- package/lib/context/yaml/handlers/attackProtection.js +1 -1
- package/lib/context/yaml/handlers/branding.js +5 -4
- package/lib/context/yaml/handlers/clientGrants.js +2 -2
- package/lib/context/yaml/handlers/clients.js +6 -4
- package/lib/context/yaml/handlers/connections.js +7 -5
- package/lib/context/yaml/handlers/databases.js +12 -8
- package/lib/context/yaml/handlers/emailProvider.js +4 -3
- package/lib/context/yaml/handlers/emailTemplates.js +3 -3
- package/lib/context/yaml/handlers/guardianFactorProviders.js +1 -1
- package/lib/context/yaml/handlers/guardianFactorTemplates.js +1 -1
- package/lib/context/yaml/handlers/guardianFactors.js +1 -1
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +1 -1
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +1 -1
- package/lib/context/yaml/handlers/guardianPolicies.js +1 -1
- package/lib/context/yaml/handlers/hooks.js +4 -3
- package/lib/context/yaml/handlers/index.js +3 -2
- package/lib/context/yaml/handlers/organizations.js +3 -3
- package/lib/context/yaml/handlers/pages.js +3 -3
- package/lib/context/yaml/handlers/resourceServers.js +2 -2
- package/lib/context/yaml/handlers/roles.js +3 -3
- package/lib/context/yaml/handlers/rules.js +3 -3
- package/lib/context/yaml/handlers/rulesConfigs.js +2 -2
- package/lib/context/yaml/handlers/tenant.js +4 -3
- package/lib/context/yaml/handlers/triggers.js +2 -2
- package/lib/context/yaml/index.js +31 -23
- package/lib/index.js +20 -15
- package/lib/logger.js +4 -3
- package/lib/readonly.js +11 -16
- package/lib/sessionDurationsToMinutes.js +15 -0
- package/lib/tools/auth0/client.js +6 -6
- package/lib/tools/auth0/handlers/actions.js +21 -23
- package/lib/tools/auth0/handlers/attackProtection.js +14 -17
- package/lib/tools/auth0/handlers/branding.js +13 -9
- package/lib/tools/auth0/handlers/clientGrants.js +17 -10
- package/lib/tools/auth0/handlers/clients.js +15 -8
- package/lib/tools/auth0/handlers/connections.js +30 -10
- package/lib/tools/auth0/handlers/databases.js +24 -12
- package/lib/tools/auth0/handlers/default.js +41 -29
- package/lib/tools/auth0/handlers/emailTemplates.js +8 -10
- package/lib/tools/auth0/handlers/guardianFactorProviders.js +3 -3
- package/lib/tools/auth0/handlers/guardianFactorTemplates.js +3 -3
- package/lib/tools/auth0/handlers/guardianFactors.js +3 -3
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +11 -10
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +10 -9
- package/lib/tools/auth0/handlers/guardianPolicies.js +5 -4
- package/lib/tools/auth0/handlers/hooks.js +34 -21
- package/lib/tools/auth0/handlers/index.js +31 -27
- package/lib/tools/auth0/handlers/migrations.js +2 -1
- package/lib/tools/auth0/handlers/organizations.js +61 -31
- package/lib/tools/auth0/handlers/pages.js +20 -14
- package/lib/tools/auth0/handlers/prompts.js +1 -0
- package/lib/tools/auth0/handlers/resourceServers.js +22 -14
- package/lib/tools/auth0/handlers/roles.js +55 -31
- package/lib/tools/auth0/handlers/rules.js +49 -32
- package/lib/tools/auth0/handlers/rulesConfigs.js +12 -6
- package/lib/tools/auth0/handlers/tenant.js +8 -4
- package/lib/tools/auth0/handlers/triggers.js +11 -12
- package/lib/tools/auth0/index.js +15 -31
- package/lib/tools/auth0/schema.js +7 -27
- package/lib/tools/calculateChanges.js +11 -6
- package/lib/tools/constants.js +162 -161
- package/lib/tools/deploy.js +1 -1
- package/lib/tools/index.js +1 -1
- package/lib/tools/logger.js +14 -8
- package/lib/tools/utils.js +2 -2
- package/lib/tools/{ValidationError.js → validationError.js} +3 -1
- package/lib/types.js +2 -0
- package/lib/utils.js +12 -22
- package/package.json +8 -1
- package/tsconfig.json +1 -3
- package/typescript-migration-progress.sh +1 -1
package/lib/tools/constants.js
CHANGED
|
@@ -1,165 +1,166 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
'
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
]
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
'
|
|
91
|
-
'
|
|
92
|
-
'
|
|
93
|
-
'
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
'
|
|
105
|
-
'
|
|
106
|
-
'
|
|
107
|
-
'
|
|
108
|
-
|
|
109
|
-
]
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
]
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
3
|
+
const PAGE_GUARDIAN_MULTIFACTOR = 'guardian_multifactor';
|
|
4
|
+
const PAGE_PASSWORD_RESET = 'password_reset';
|
|
5
|
+
const PAGE_LOGIN = 'login';
|
|
6
|
+
const PAGE_ERROR = 'error_page';
|
|
7
|
+
const RULES_STAGES = ['login_success'];
|
|
8
|
+
const DATABASE_SCRIPTS_GET_USER = 'get_user';
|
|
9
|
+
const DATABASE_SCRIPTS_CHANGE_EMAIL = 'change_email';
|
|
10
|
+
const EMAIL_VERIFY = 'verify_email';
|
|
11
|
+
const EMAIL_VERIFY_BY_CODE = 'verify_email_by_code';
|
|
12
|
+
const EMAIL_RESET = 'reset_email';
|
|
13
|
+
const EMAIL_WELCOME = 'welcome_email';
|
|
14
|
+
const EMAIL_BLOCKED = 'blocked_account';
|
|
15
|
+
const EMAIL_STOLEN_CREDENTIALS = 'stolen_credentials';
|
|
16
|
+
const EMAIL_ENROLLMENT = 'enrollment_email';
|
|
17
|
+
const EMAIL_CHANGE_PASSWORD = 'change_password';
|
|
18
|
+
const EMAIL_PASSWORD_RESET = 'password_reset';
|
|
19
|
+
const EMAIL_MFA_OOB_CODE = 'mfa_oob_code';
|
|
20
|
+
const EMAIL_USER_INVITATION = 'user_invitation';
|
|
21
|
+
const UNIVERSAL_LOGIN_TEMPLATE = 'universal_login';
|
|
22
|
+
const constants = {
|
|
23
|
+
CONCURRENT_CALLS: 5,
|
|
24
|
+
RULES_DIRECTORY: 'rules',
|
|
25
|
+
RULES_STAGES,
|
|
26
|
+
DEFAULT_RULE_STAGE: RULES_STAGES[0],
|
|
27
|
+
HOOKS_HIDDEN_SECRET_VALUE: '_VALUE_NOT_SHOWN_',
|
|
28
|
+
HOOKS_DIRECTORY: 'hooks',
|
|
29
|
+
ACTIONS_DIRECTORY: 'actions',
|
|
30
|
+
TRIGGERS_DIRECTORY: 'triggers',
|
|
31
|
+
RULES_CONFIGS_DIRECTORY: 'rules-configs',
|
|
32
|
+
PAGES_DIRECTORY: 'pages',
|
|
33
|
+
PAGE_LOGIN,
|
|
34
|
+
PAGE_GUARDIAN_MULTIFACTOR,
|
|
35
|
+
PAGE_PASSWORD_RESET,
|
|
36
|
+
PAGE_ERROR,
|
|
37
|
+
DATABASE_CONNECTIONS_DIRECTORY: 'database-connections',
|
|
38
|
+
DATABASE_SCRIPTS_CHANGE_EMAIL,
|
|
39
|
+
DATABASE_SCRIPTS_GET_USER,
|
|
40
|
+
EMAIL_TEMPLATES_TYPES: [
|
|
41
|
+
'verify_email',
|
|
42
|
+
'verify_email_by_code',
|
|
43
|
+
'reset_email',
|
|
44
|
+
'welcome_email',
|
|
45
|
+
'blocked_account',
|
|
46
|
+
'stolen_credentials',
|
|
47
|
+
'enrollment_email',
|
|
48
|
+
'mfa_oob_code',
|
|
49
|
+
'change_password',
|
|
50
|
+
'password_reset',
|
|
51
|
+
'user_invitation',
|
|
52
|
+
],
|
|
53
|
+
ACTIONS_TRIGGERS: [
|
|
54
|
+
'post-login',
|
|
55
|
+
'credentials-exchange',
|
|
56
|
+
'pre-user-registration',
|
|
57
|
+
'post-user-registration',
|
|
58
|
+
'post-change-password',
|
|
59
|
+
'send-phone-message',
|
|
60
|
+
],
|
|
61
|
+
EMAIL_TEMPLATES_DIRECTORY: 'emails',
|
|
62
|
+
EMAIL_VERIFY,
|
|
63
|
+
EMAIL_VERIFY_BY_CODE,
|
|
64
|
+
EMAIL_RESET,
|
|
65
|
+
EMAIL_WELCOME,
|
|
66
|
+
EMAIL_BLOCKED,
|
|
67
|
+
EMAIL_STOLEN_CREDENTIALS,
|
|
68
|
+
EMAIL_ENROLLMENT,
|
|
69
|
+
EMAIL_CHANGE_PASSWORD,
|
|
70
|
+
EMAIL_PASSWORD_RESET,
|
|
71
|
+
EMAIL_MFA_OOB_CODE,
|
|
72
|
+
EMAIL_USER_INVITATION,
|
|
73
|
+
GUARDIAN_DIRECTORY: 'guardian',
|
|
74
|
+
GUARDIAN_FACTORS_DIRECTORY: 'factors',
|
|
75
|
+
GUARDIAN_PROVIDERS_DIRECTORY: 'providers',
|
|
76
|
+
GUARDIAN_TEMPLATES_DIRECTORY: 'templates',
|
|
77
|
+
UNIVERSAL_LOGIN_TEMPLATE,
|
|
78
|
+
RESOURCE_SERVERS_DIRECTORY: 'resource-servers',
|
|
79
|
+
RESOURCE_SERVERS_CLIENT_NAME: 'resourceServers',
|
|
80
|
+
RESOURCE_SERVERS_MANAGEMENT_API_NAME: 'Auth0 Management API',
|
|
81
|
+
RESOURCE_SERVERS_ID_NAME: 'id',
|
|
82
|
+
CLIENTS_DIRECTORY: 'clients',
|
|
83
|
+
CLIENTS_GRANTS_DIRECTORY: 'grants',
|
|
84
|
+
BRANDING_DIRECTORY: 'branding',
|
|
85
|
+
BRANDING_TEMPLATES_DIRECTORY: 'templates',
|
|
86
|
+
BRANDING_TEMPLATES_YAML_DIRECTORY: 'branding_templates',
|
|
87
|
+
CLIENTS_CLIENT_NAME: 'clients',
|
|
88
|
+
CLIENTS_CLIENT_ID_NAME: 'client_id',
|
|
89
|
+
CONNECTIONS_DIRECTORY: 'connections',
|
|
90
|
+
CONNECTIONS_CLIENT_NAME: 'connections',
|
|
91
|
+
CONNECTIONS_ID_NAME: 'id',
|
|
92
|
+
ROLES_DIRECTORY: 'roles',
|
|
93
|
+
ATTACK_PROTECTION_DIRECTORY: 'attack-protection',
|
|
94
|
+
GUARDIAN_FACTORS: [
|
|
95
|
+
'sms',
|
|
96
|
+
'push-notification',
|
|
97
|
+
'otp',
|
|
98
|
+
'email',
|
|
99
|
+
'duo',
|
|
100
|
+
'webauthn-roaming',
|
|
101
|
+
'webauthn-platform',
|
|
102
|
+
'recovery-code',
|
|
103
|
+
],
|
|
104
|
+
GUARDIAN_POLICIES: ['all-applications', 'confidence-score'],
|
|
105
|
+
GUARDIAN_PHONE_PROVIDERS: ['auth0', 'twilio', 'phone-message-hook'],
|
|
106
|
+
GUARDIAN_PHONE_MESSAGE_TYPES: ['sms', 'voice'],
|
|
107
|
+
GUARDIAN_FACTOR_TEMPLATES: ['sms'],
|
|
108
|
+
GUARDIAN_FACTOR_PROVIDERS: {
|
|
109
|
+
sms: ['twilio'],
|
|
110
|
+
'push-notification': ['sns'],
|
|
111
|
+
},
|
|
112
|
+
PAGE_NAMES: [
|
|
113
|
+
`${PAGE_GUARDIAN_MULTIFACTOR}.html`,
|
|
114
|
+
`${PAGE_GUARDIAN_MULTIFACTOR}.json`,
|
|
115
|
+
`${PAGE_PASSWORD_RESET}.html`,
|
|
116
|
+
`${PAGE_PASSWORD_RESET}.json`,
|
|
117
|
+
`${PAGE_LOGIN}.html`,
|
|
118
|
+
`${PAGE_LOGIN}.json`,
|
|
119
|
+
`${PAGE_ERROR}.html`,
|
|
120
|
+
`${PAGE_ERROR}.json`,
|
|
121
|
+
],
|
|
122
|
+
DATABASE_SCRIPTS: [
|
|
123
|
+
DATABASE_SCRIPTS_GET_USER,
|
|
124
|
+
'create',
|
|
125
|
+
'verify',
|
|
126
|
+
'login',
|
|
127
|
+
'change_password',
|
|
128
|
+
'delete',
|
|
129
|
+
DATABASE_SCRIPTS_CHANGE_EMAIL,
|
|
130
|
+
],
|
|
131
|
+
DATABASE_SCRIPTS_NO_IMPORT: [
|
|
132
|
+
DATABASE_SCRIPTS_GET_USER,
|
|
133
|
+
'create',
|
|
134
|
+
'verify',
|
|
135
|
+
'login',
|
|
136
|
+
'change_password',
|
|
137
|
+
'delete',
|
|
138
|
+
],
|
|
139
|
+
DATABASE_SCRIPTS_IMPORT: [DATABASE_SCRIPTS_GET_USER, 'login'],
|
|
140
|
+
EMAIL_TEMPLATES_NAMES: [
|
|
141
|
+
`${EMAIL_VERIFY}.json`,
|
|
142
|
+
`${EMAIL_VERIFY}.html`,
|
|
143
|
+
`${EMAIL_VERIFY_BY_CODE}.json`,
|
|
144
|
+
`${EMAIL_VERIFY_BY_CODE}.html`,
|
|
145
|
+
`${EMAIL_RESET}.json`,
|
|
146
|
+
`${EMAIL_RESET}.html`,
|
|
147
|
+
`${EMAIL_WELCOME}.json`,
|
|
148
|
+
`${EMAIL_WELCOME}.html`,
|
|
149
|
+
`${EMAIL_BLOCKED}.json`,
|
|
150
|
+
`${EMAIL_BLOCKED}.html`,
|
|
151
|
+
`${EMAIL_STOLEN_CREDENTIALS}.json`,
|
|
152
|
+
`${EMAIL_STOLEN_CREDENTIALS}.html`,
|
|
153
|
+
`${EMAIL_ENROLLMENT}.json`,
|
|
154
|
+
`${EMAIL_ENROLLMENT}.html`,
|
|
155
|
+
`${EMAIL_CHANGE_PASSWORD}.json`,
|
|
156
|
+
`${EMAIL_CHANGE_PASSWORD}.html`,
|
|
157
|
+
`${EMAIL_PASSWORD_RESET}.json`,
|
|
158
|
+
`${EMAIL_PASSWORD_RESET}.html`,
|
|
159
|
+
`${EMAIL_MFA_OOB_CODE}.json`,
|
|
160
|
+
`${EMAIL_MFA_OOB_CODE}.html`,
|
|
161
|
+
`${EMAIL_USER_INVITATION}.json`,
|
|
162
|
+
`${EMAIL_USER_INVITATION}.html`,
|
|
163
|
+
],
|
|
164
|
+
SUPPORTED_BRANDING_TEMPLATES: [UNIVERSAL_LOGIN_TEMPLATE],
|
|
143
165
|
};
|
|
144
|
-
constants.UNIVERSAL_LOGIN_TEMPLATE = 'universal_login';
|
|
145
|
-
constants.SUPPORTED_BRANDING_TEMPLATES = [
|
|
146
|
-
constants.UNIVERSAL_LOGIN_TEMPLATE
|
|
147
|
-
];
|
|
148
|
-
constants.RESOURCE_SERVERS_DIRECTORY = 'resource-servers';
|
|
149
|
-
constants.RESOURCE_SERVERS_CLIENT_NAME = 'resourceServers';
|
|
150
|
-
constants.RESOURCE_SERVERS_MANAGEMENT_API_NAME = 'Auth0 Management API';
|
|
151
|
-
constants.RESOURCE_SERVERS_ID_NAME = 'id';
|
|
152
|
-
constants.CLIENTS_DIRECTORY = 'clients';
|
|
153
|
-
constants.CLIENTS_GRANTS_DIRECTORY = 'grants';
|
|
154
|
-
constants.BRANDING_DIRECTORY = 'branding';
|
|
155
|
-
constants.BRANDING_TEMPLATES_DIRECTORY = 'templates';
|
|
156
|
-
constants.BRANDING_TEMPLATES_YAML_DIRECTORY = 'branding_templates';
|
|
157
|
-
constants.CLIENTS_CLIENT_NAME = 'clients';
|
|
158
|
-
constants.CLIENTS_CLIENT_ID_NAME = 'client_id';
|
|
159
|
-
constants.CONNECTIONS_DIRECTORY = 'connections';
|
|
160
|
-
constants.CONNECTIONS_CLIENT_NAME = 'connections';
|
|
161
|
-
constants.CONNECTIONS_ID_NAME = 'id';
|
|
162
|
-
constants.CONCURRENT_CALLS = 5;
|
|
163
|
-
constants.ROLES_DIRECTORY = 'roles';
|
|
164
|
-
constants.ATTACK_PROTECTION_DIRECTORY = 'attack-protection';
|
|
165
166
|
exports.default = constants;
|
package/lib/tools/deploy.js
CHANGED
package/lib/tools/index.js
CHANGED
package/lib/tools/logger.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const winston_1 = __importDefault(require("winston"));
|
|
7
|
+
//@ts-ignore because emitErrs is still supported
|
|
8
|
+
winston_1.default.emitErrs = true;
|
|
9
|
+
const logger = new winston_1.default.Logger({
|
|
4
10
|
transports: [
|
|
5
|
-
new
|
|
11
|
+
new winston_1.default.transports.Console({
|
|
6
12
|
timestamp: true,
|
|
7
13
|
level: 'info',
|
|
8
14
|
handleExceptions: true,
|
|
9
15
|
json: false,
|
|
10
|
-
colorize: true
|
|
11
|
-
})
|
|
16
|
+
colorize: true,
|
|
17
|
+
}),
|
|
12
18
|
],
|
|
13
|
-
exitOnError: false
|
|
19
|
+
exitOnError: false,
|
|
14
20
|
});
|
|
15
|
-
|
|
21
|
+
exports.default = logger;
|
package/lib/tools/utils.js
CHANGED
|
@@ -102,7 +102,7 @@ function getEnabledClients(assets, connection, existing, clients) {
|
|
|
102
102
|
const excludedClientsByNames = (assets.exclude && assets.exclude.clients) || [];
|
|
103
103
|
const excludedClients = convertClientNamesToIds(excludedClientsByNames, clients);
|
|
104
104
|
const enabledClients = [
|
|
105
|
-
...convertClientNamesToIds(connection.enabled_clients || [], clients).filter((item) => ![...excludedClientsByNames, ...excludedClients].includes(item))
|
|
105
|
+
...convertClientNamesToIds(connection.enabled_clients || [], clients).filter((item) => ![...excludedClientsByNames, ...excludedClients].includes(item)),
|
|
106
106
|
];
|
|
107
107
|
// If client is excluded and in the existing connection this client is enabled, it should keep enabled
|
|
108
108
|
// If client is excluded and in the existing connection this client is disabled, it should keep disabled
|
|
@@ -142,7 +142,7 @@ function filterExcluded(changes, exclude) {
|
|
|
142
142
|
del: filter(del),
|
|
143
143
|
update: filter(update),
|
|
144
144
|
create: filter(create),
|
|
145
|
-
conflicts: filter(conflicts)
|
|
145
|
+
conflicts: filter(conflicts),
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
exports.filterExcluded = filterExcluded;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
function ValidationError(message) {
|
|
2
4
|
Error.call(this, message);
|
|
3
5
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -9,4 +11,4 @@ function ValidationError(message) {
|
|
|
9
11
|
}
|
|
10
12
|
ValidationError.prototype = Object.create(Error.prototype);
|
|
11
13
|
ValidationError.prototype.constructor = ValidationError;
|
|
12
|
-
|
|
14
|
+
exports.default = ValidationError;
|
package/lib/types.js
ADDED
package/lib/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.mapClientID2NameSorted = exports.convertClientIdToName = exports.clearClientArrays = exports.ensureProp = exports.clearTenantFlags = exports.recordsSorter = exports.formatResults = exports.
|
|
6
|
+
exports.mapClientID2NameSorted = exports.convertClientIdToName = exports.clearClientArrays = exports.ensureProp = exports.clearTenantFlags = exports.recordsSorter = exports.formatResults = exports.sanitize = exports.stripIdentifiers = exports.toConfigFn = exports.existsMustBeDir = exports.dumpJSON = exports.loadJSON = exports.getFiles = exports.isFile = exports.isDirectory = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const sanitize_filename_1 = __importDefault(require("sanitize-filename"));
|
|
@@ -12,8 +12,7 @@ const tools_1 = require("./tools");
|
|
|
12
12
|
const logger_1 = __importDefault(require("./logger"));
|
|
13
13
|
function isDirectory(f) {
|
|
14
14
|
try {
|
|
15
|
-
return fs_extra_1.default.statSync(path_1.default.resolve(f))
|
|
16
|
-
.isDirectory();
|
|
15
|
+
return fs_extra_1.default.statSync(path_1.default.resolve(f)).isDirectory();
|
|
17
16
|
}
|
|
18
17
|
catch (err) {
|
|
19
18
|
return false;
|
|
@@ -22,8 +21,7 @@ function isDirectory(f) {
|
|
|
22
21
|
exports.isDirectory = isDirectory;
|
|
23
22
|
function isFile(f) {
|
|
24
23
|
try {
|
|
25
|
-
return fs_extra_1.default.statSync(path_1.default.resolve(f))
|
|
26
|
-
.isFile();
|
|
24
|
+
return fs_extra_1.default.statSync(path_1.default.resolve(f)).isFile();
|
|
27
25
|
}
|
|
28
26
|
catch (err) {
|
|
29
27
|
return false;
|
|
@@ -32,7 +30,8 @@ function isFile(f) {
|
|
|
32
30
|
exports.isFile = isFile;
|
|
33
31
|
function getFiles(folder, exts) {
|
|
34
32
|
if (isDirectory(folder)) {
|
|
35
|
-
return fs_extra_1.default
|
|
33
|
+
return fs_extra_1.default
|
|
34
|
+
.readdirSync(folder)
|
|
36
35
|
.map((f) => path_1.default.join(folder, f))
|
|
37
36
|
.filter((f) => isFile(f) && exts.includes(path_1.default.extname(f)));
|
|
38
37
|
}
|
|
@@ -84,7 +83,7 @@ function stripIdentifiers(auth0, assets) {
|
|
|
84
83
|
'emailTemplates',
|
|
85
84
|
'guardianFactors',
|
|
86
85
|
'guardianFactorProviders',
|
|
87
|
-
'guardianFactorTemplates'
|
|
86
|
+
'guardianFactorTemplates',
|
|
88
87
|
];
|
|
89
88
|
// Optionally Strip identifiers
|
|
90
89
|
auth0.handlers.forEach((h) => {
|
|
@@ -107,12 +106,6 @@ function sanitize(str) {
|
|
|
107
106
|
return (0, sanitize_filename_1.default)(str, { replacement: '-' });
|
|
108
107
|
}
|
|
109
108
|
exports.sanitize = sanitize;
|
|
110
|
-
function hoursAsInteger(property, hours) {
|
|
111
|
-
if (Number.isInteger(hours))
|
|
112
|
-
return { [property]: hours };
|
|
113
|
-
return { [`${property}_in_minutes`]: Math.round(hours * 60) };
|
|
114
|
-
}
|
|
115
|
-
exports.hoursAsInteger = hoursAsInteger;
|
|
116
109
|
function formatResults(item) {
|
|
117
110
|
if (typeof item !== 'object') {
|
|
118
111
|
return item;
|
|
@@ -126,10 +119,12 @@ function formatResults(item) {
|
|
|
126
119
|
strategy: null,
|
|
127
120
|
script: null,
|
|
128
121
|
stage: null,
|
|
129
|
-
id: null
|
|
122
|
+
id: null,
|
|
130
123
|
};
|
|
131
124
|
const result = Object.assign({}, importantFields);
|
|
132
|
-
Object.entries(item)
|
|
125
|
+
Object.entries(item)
|
|
126
|
+
.sort()
|
|
127
|
+
.forEach(([key, value]) => {
|
|
133
128
|
result[key] = value;
|
|
134
129
|
});
|
|
135
130
|
Object.keys(importantFields).forEach((key) => {
|
|
@@ -140,12 +135,7 @@ function formatResults(item) {
|
|
|
140
135
|
}
|
|
141
136
|
exports.formatResults = formatResults;
|
|
142
137
|
function recordsSorter(a, b) {
|
|
143
|
-
const importantFields = [
|
|
144
|
-
'name',
|
|
145
|
-
'key',
|
|
146
|
-
'client_id',
|
|
147
|
-
'template'
|
|
148
|
-
];
|
|
138
|
+
const importantFields = ['name', 'key', 'client_id', 'template'];
|
|
149
139
|
for (let i = 0; i < importantFields.length; i += 1) {
|
|
150
140
|
const key = importantFields[i];
|
|
151
141
|
if (a[key] && b[key]) {
|
|
@@ -189,7 +179,7 @@ function convertClientIdToName(clientId, knownClients = []) {
|
|
|
189
179
|
exports.convertClientIdToName = convertClientIdToName;
|
|
190
180
|
function mapClientID2NameSorted(enabledClients, knownClients) {
|
|
191
181
|
return [
|
|
192
|
-
...(enabledClients || []).map((clientId) => convertClientIdToName(clientId, knownClients))
|
|
182
|
+
...(enabledClients || []).map((clientId) => convertClientIdToName(clientId, knownClients)),
|
|
193
183
|
].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
|
194
184
|
}
|
|
195
185
|
exports.mapClientID2NameSorted = mapClientID2NameSorted;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth0-deploy-cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.0",
|
|
4
4
|
"description": "A command line tool for deploying updates to your Auth0 tenant",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"lint:fix": "eslint --fix --ignore-path .eslintignore --ignore-pattern webpack . && kacl lint",
|
|
11
11
|
"lint": "eslint --ignore-path .eslintignore --ignore-pattern webpack . && kacl lint",
|
|
12
|
+
"format": "npx prettier --write .",
|
|
12
13
|
"pretest": "rimraf ./.nyc_output",
|
|
13
14
|
"test": "ts-mocha -p tsconfig.json --recursive 'test/**/*.test*'",
|
|
14
15
|
"build": "rimraf ./lib && npx tsc",
|
|
@@ -29,6 +30,9 @@
|
|
|
29
30
|
"readme": "README.md",
|
|
30
31
|
"homepage": "https://github.com/auth0/auth0-deploy-cli#readme",
|
|
31
32
|
"dependencies": {
|
|
33
|
+
"@types/lodash": "^4.14.181",
|
|
34
|
+
"@types/nconf": "^0.10.2",
|
|
35
|
+
"@types/winston": "^2.4.4",
|
|
32
36
|
"ajv": "^6.12.6",
|
|
33
37
|
"auth0": "^2.40.0",
|
|
34
38
|
"dot-prop": "^5.2.0",
|
|
@@ -52,11 +56,14 @@
|
|
|
52
56
|
"cross-env": "^3.1.4",
|
|
53
57
|
"eslint": "^7.28.0",
|
|
54
58
|
"eslint-config-airbnb-base": "^14.2.1",
|
|
59
|
+
"eslint-config-prettier": "^8.5.0",
|
|
55
60
|
"eslint-plugin-import": "^2.20.2",
|
|
56
61
|
"husky": "^7.0.4",
|
|
57
62
|
"kacl": "^1.1.1",
|
|
58
63
|
"mocha": "^9.1.3",
|
|
59
64
|
"nyc": "^15.0.1",
|
|
65
|
+
"prettier": "^2.6.1",
|
|
66
|
+
"pretty-quick": "^3.1.3",
|
|
60
67
|
"rimraf": "^3.0.2",
|
|
61
68
|
"rmdir-sync": "^1.0.1",
|
|
62
69
|
"ts-mocha": "^9.0.2",
|
package/tsconfig.json
CHANGED
|
@@ -17,6 +17,6 @@ numJsFiles=$(find ./src -name "*.js" | wc -l | xargs)
|
|
|
17
17
|
totalNumFiles=$(expr ${numTsFiles} + ${numJsFiles})
|
|
18
18
|
percentFilesMigrated=$(expr $(expr ${numTsFiles} \* 100) / ${totalNumFiles})
|
|
19
19
|
|
|
20
|
-
echo "${numTsFiles} of ${
|
|
20
|
+
echo "${numTsFiles} of ${totalNumFiles} (${percentFilesMigrated}%) files migrated to Typescript"
|
|
21
21
|
|
|
22
22
|
echo "- - - - - - - - - - - - - - - - - - - - - -"
|