auth0-deploy-cli 7.6.0 → 7.8.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 +222 -7
- package/CONTRIBUTING.md +2 -2
- package/README.md +3 -0
- package/lib/args.d.ts +29 -0
- package/lib/args.js +16 -15
- package/lib/commands/export.d.ts +2 -0
- package/lib/commands/export.js +3 -3
- package/lib/commands/import.d.ts +2 -0
- package/lib/commands/import.js +6 -6
- package/lib/commands/index.d.ts +9 -0
- package/lib/commands/index.js +1 -1
- package/lib/configFactory.d.ts +7 -0
- package/lib/configFactory.js +5 -1
- package/lib/context/defaults.d.ts +1 -0
- package/lib/context/defaults.js +4 -3
- package/lib/context/directory/handlers/actions.d.ts +6 -0
- package/lib/context/directory/handlers/actions.js +3 -3
- package/lib/context/directory/handlers/attackProtection.d.ts +10 -0
- package/lib/context/directory/handlers/attackProtection.js +7 -7
- package/lib/context/directory/handlers/branding.d.ts +6 -0
- package/lib/context/directory/handlers/branding.js +6 -5
- package/lib/context/directory/handlers/clientGrants.d.ts +6 -0
- package/lib/context/directory/handlers/clientGrants.js +3 -2
- package/lib/context/directory/handlers/clients.d.ts +6 -0
- package/lib/context/directory/handlers/clients.js +1 -1
- package/lib/context/directory/handlers/connections.d.ts +6 -0
- package/lib/context/directory/handlers/connections.js +4 -2
- package/lib/context/directory/handlers/databases.d.ts +6 -0
- package/lib/context/directory/handlers/databases.js +13 -7
- package/lib/context/directory/handlers/emailProvider.d.ts +6 -0
- package/lib/context/directory/handlers/emailProvider.js +3 -2
- package/lib/context/directory/handlers/emailTemplates.d.ts +6 -0
- package/lib/context/directory/handlers/emailTemplates.js +2 -2
- package/lib/context/directory/handlers/guardianFactorProviders.d.ts +6 -0
- package/lib/context/directory/handlers/guardianFactorProviders.js +3 -2
- package/lib/context/directory/handlers/guardianFactorTemplates.d.ts +6 -0
- package/lib/context/directory/handlers/guardianFactorTemplates.js +3 -2
- package/lib/context/directory/handlers/guardianFactors.d.ts +6 -0
- package/lib/context/directory/handlers/guardianFactors.js +3 -2
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.d.ts +6 -0
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +1 -1
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.d.ts +6 -0
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +1 -1
- package/lib/context/directory/handlers/guardianPolicies.d.ts +6 -0
- package/lib/context/directory/handlers/guardianPolicies.js +1 -1
- package/lib/context/directory/handlers/hooks.d.ts +6 -0
- package/lib/context/directory/handlers/hooks.js +2 -2
- package/lib/context/directory/handlers/index.d.ts +12 -0
- package/lib/context/directory/handlers/index.js +3 -2
- package/lib/context/directory/handlers/migrations.d.ts +6 -0
- package/lib/context/directory/handlers/organizations.d.ts +6 -0
- package/lib/context/directory/handlers/organizations.js +1 -1
- package/lib/context/directory/handlers/pages.d.ts +6 -0
- package/lib/context/directory/handlers/pages.js +2 -2
- package/lib/context/directory/handlers/resourceServers.d.ts +6 -0
- package/lib/context/directory/handlers/resourceServers.js +3 -2
- package/lib/context/directory/handlers/roles.d.ts +6 -0
- package/lib/context/directory/handlers/roles.js +1 -1
- package/lib/context/directory/handlers/rules.d.ts +6 -0
- package/lib/context/directory/handlers/rules.js +2 -2
- package/lib/context/directory/handlers/rulesConfigs.d.ts +6 -0
- package/lib/context/directory/handlers/rulesConfigs.js +3 -2
- package/lib/context/directory/handlers/tenant.d.ts +10 -0
- package/lib/context/directory/handlers/tenant.js +3 -2
- package/lib/context/directory/handlers/triggers.d.ts +6 -0
- package/lib/context/directory/index.d.ts +17 -0
- package/lib/context/directory/index.js +21 -18
- package/lib/context/index.d.ts +4 -0
- package/lib/context/index.js +83 -61
- package/lib/context/yaml/handlers/actions.d.ts +6 -0
- package/lib/context/yaml/handlers/actions.js +9 -6
- package/lib/context/yaml/handlers/attackProtection.d.ts +6 -0
- package/lib/context/yaml/handlers/attackProtection.js +1 -1
- package/lib/context/yaml/handlers/branding.d.ts +6 -0
- package/lib/context/yaml/handlers/branding.js +5 -4
- package/lib/context/yaml/handlers/clientGrants.d.ts +6 -0
- package/lib/context/yaml/handlers/clientGrants.js +2 -2
- package/lib/context/yaml/handlers/clients.d.ts +6 -0
- package/lib/context/yaml/handlers/clients.js +6 -4
- package/lib/context/yaml/handlers/connections.d.ts +6 -0
- package/lib/context/yaml/handlers/connections.js +7 -5
- package/lib/context/yaml/handlers/databases.d.ts +6 -0
- package/lib/context/yaml/handlers/databases.js +12 -8
- package/lib/context/yaml/handlers/emailProvider.d.ts +6 -0
- package/lib/context/yaml/handlers/emailProvider.js +4 -3
- package/lib/context/yaml/handlers/emailTemplates.d.ts +6 -0
- package/lib/context/yaml/handlers/emailTemplates.js +3 -3
- package/lib/context/yaml/handlers/guardianFactorProviders.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianFactorProviders.js +1 -1
- package/lib/context/yaml/handlers/guardianFactorTemplates.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianFactorTemplates.js +1 -1
- package/lib/context/yaml/handlers/guardianFactors.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianFactors.js +1 -1
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +1 -1
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +1 -1
- package/lib/context/yaml/handlers/guardianPolicies.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianPolicies.js +1 -1
- package/lib/context/yaml/handlers/hooks.d.ts +6 -0
- package/lib/context/yaml/handlers/hooks.js +4 -3
- package/lib/context/yaml/handlers/index.d.ts +12 -0
- package/lib/context/yaml/handlers/index.js +3 -2
- package/lib/context/yaml/handlers/migrations.d.ts +6 -0
- package/lib/context/yaml/handlers/organizations.d.ts +6 -0
- package/lib/context/yaml/handlers/organizations.js +3 -3
- package/lib/context/yaml/handlers/pages.d.ts +6 -0
- package/lib/context/yaml/handlers/pages.js +3 -3
- package/lib/context/yaml/handlers/resourceServers.d.ts +6 -0
- package/lib/context/yaml/handlers/resourceServers.js +2 -2
- package/lib/context/yaml/handlers/roles.d.ts +6 -0
- package/lib/context/yaml/handlers/roles.js +3 -3
- package/lib/context/yaml/handlers/rules.d.ts +6 -0
- package/lib/context/yaml/handlers/rules.js +3 -3
- package/lib/context/yaml/handlers/rulesConfigs.d.ts +6 -0
- package/lib/context/yaml/handlers/rulesConfigs.js +2 -2
- package/lib/context/yaml/handlers/tenant.d.ts +6 -0
- package/lib/context/yaml/handlers/tenant.js +4 -3
- package/lib/context/yaml/handlers/triggers.d.ts +6 -0
- package/lib/context/yaml/handlers/triggers.js +2 -2
- package/lib/context/yaml/index.d.ts +13 -0
- package/lib/context/yaml/index.js +31 -23
- package/lib/index.d.ts +88 -0
- package/lib/index.js +25 -17
- package/lib/logger.d.ts +2 -0
- package/lib/logger.js +8 -17
- package/lib/readonly.d.ts +2 -0
- package/lib/readonly.js +11 -16
- package/lib/sessionDurationsToMinutes.d.ts +7 -0
- package/lib/sessionDurationsToMinutes.js +15 -0
- package/lib/tools/auth0/client.d.ts +2 -0
- package/lib/tools/auth0/client.js +12 -12
- package/lib/tools/auth0/handlers/actions.d.ts +95 -0
- package/lib/tools/auth0/handlers/actions.js +22 -24
- package/lib/tools/auth0/handlers/attackProtection.d.ts +28 -0
- package/lib/tools/auth0/handlers/attackProtection.js +14 -17
- package/lib/tools/auth0/handlers/branding.d.ts +27 -0
- package/lib/tools/auth0/handlers/branding.js +13 -9
- package/lib/tools/auth0/handlers/clientGrants.d.ts +32 -0
- package/lib/tools/auth0/handlers/clientGrants.js +17 -10
- package/lib/tools/auth0/handlers/clients.d.ts +23 -0
- package/lib/tools/auth0/handlers/clients.js +15 -8
- package/lib/tools/auth0/handlers/connections.d.ts +54 -0
- package/lib/tools/auth0/handlers/connections.js +30 -10
- package/lib/tools/auth0/handlers/databases.d.ts +36 -0
- package/lib/tools/auth0/handlers/databases.js +25 -13
- package/lib/tools/auth0/handlers/default.d.ts +54 -0
- package/lib/tools/auth0/handlers/default.js +62 -36
- package/lib/tools/auth0/handlers/emailProvider.d.ts +11 -0
- package/lib/tools/auth0/handlers/emailTemplates.d.ts +26 -0
- package/lib/tools/auth0/handlers/emailTemplates.js +8 -10
- package/lib/tools/auth0/handlers/guardianFactorProviders.d.ts +25 -0
- package/lib/tools/auth0/handlers/guardianFactorProviders.js +3 -3
- package/lib/tools/auth0/handlers/guardianFactorTemplates.d.ts +21 -0
- package/lib/tools/auth0/handlers/guardianFactorTemplates.js +3 -3
- package/lib/tools/auth0/handlers/guardianFactors.d.ts +21 -0
- package/lib/tools/auth0/handlers/guardianFactors.js +3 -3
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.d.ts +21 -0
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +11 -10
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.d.ts +18 -0
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +10 -9
- package/lib/tools/auth0/handlers/guardianPolicies.d.ts +23 -0
- package/lib/tools/auth0/handlers/guardianPolicies.js +5 -4
- package/lib/tools/auth0/handlers/hooks.d.ts +58 -0
- package/lib/tools/auth0/handlers/hooks.js +34 -21
- package/lib/tools/auth0/handlers/index.d.ts +129 -0
- package/lib/tools/auth0/handlers/index.js +31 -27
- package/lib/tools/auth0/handlers/migrations.d.ts +15 -0
- package/lib/tools/auth0/handlers/migrations.js +3 -2
- package/lib/tools/auth0/handlers/organizations.d.ts +51 -0
- package/lib/tools/auth0/handlers/organizations.js +62 -32
- package/lib/tools/auth0/handlers/pages.d.ts +42 -0
- package/lib/tools/auth0/handlers/pages.js +20 -14
- package/lib/tools/auth0/handlers/prompts.d.ts +11 -0
- package/lib/tools/auth0/handlers/prompts.js +1 -0
- package/lib/tools/auth0/handlers/resourceServers.d.ts +51 -0
- package/lib/tools/auth0/handlers/resourceServers.js +22 -14
- package/lib/tools/auth0/handlers/roles.d.ts +48 -0
- package/lib/tools/auth0/handlers/roles.js +56 -32
- package/lib/tools/auth0/handlers/rules.d.ts +55 -0
- package/lib/tools/auth0/handlers/rules.js +53 -36
- package/lib/tools/auth0/handlers/rulesConfigs.d.ts +25 -0
- package/lib/tools/auth0/handlers/rulesConfigs.js +12 -6
- package/lib/tools/auth0/handlers/tenant.d.ts +11 -0
- package/lib/tools/auth0/handlers/tenant.js +8 -4
- package/lib/tools/auth0/handlers/triggers.d.ts +35 -0
- package/lib/tools/auth0/handlers/triggers.js +12 -13
- package/lib/tools/auth0/index.d.ts +15 -0
- package/lib/tools/auth0/index.js +15 -31
- package/lib/tools/auth0/schema.d.ts +15 -0
- package/lib/tools/auth0/schema.js +7 -27
- package/lib/tools/calculateChanges.d.ts +26 -0
- package/lib/tools/calculateChanges.js +12 -7
- package/lib/tools/constants.d.ts +71 -0
- package/lib/tools/constants.js +164 -161
- package/lib/tools/deploy.d.ts +3 -0
- package/lib/tools/deploy.js +3 -3
- package/lib/tools/index.d.ts +82 -0
- package/lib/tools/index.js +1 -1
- package/lib/tools/utils.d.ts +18 -0
- package/lib/tools/utils.js +68 -10
- package/lib/tools/validationError.d.ts +5 -0
- package/lib/tools/{ValidationError.js → validationError.js} +3 -1
- package/lib/types.d.ts +255 -0
- package/lib/types.js +2 -0
- package/lib/utils.d.ts +66 -0
- package/lib/utils.js +18 -25
- package/package.json +16 -7
- package/tsconfig.json +3 -4
- package/typescript-migration-progress.sh +1 -1
- package/lib/tools/logger.js +0 -15
|
@@ -15,7 +15,7 @@ function parse(context) {
|
|
|
15
15
|
if (!context.assets.triggers)
|
|
16
16
|
return {};
|
|
17
17
|
return {
|
|
18
|
-
triggers: context.assets.triggers
|
|
18
|
+
triggers: context.assets.triggers,
|
|
19
19
|
};
|
|
20
20
|
});
|
|
21
21
|
}
|
|
@@ -26,7 +26,7 @@ function dump(context) {
|
|
|
26
26
|
if (!triggers)
|
|
27
27
|
return {};
|
|
28
28
|
return {
|
|
29
|
-
triggers: triggers
|
|
29
|
+
triggers: triggers,
|
|
30
30
|
};
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Assets, Config, Auth0APIClient, KeywordMappings } from '../../types';
|
|
2
|
+
export default class YAMLContext {
|
|
3
|
+
basePath: string;
|
|
4
|
+
configFile: string;
|
|
5
|
+
config: Config;
|
|
6
|
+
mappings: KeywordMappings;
|
|
7
|
+
mgmtClient: Auth0APIClient;
|
|
8
|
+
assets: Assets;
|
|
9
|
+
constructor(config: Config, mgmtClient: any);
|
|
10
|
+
loadFile(f: any): string;
|
|
11
|
+
load(): Promise<void>;
|
|
12
|
+
dump(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -20,28 +20,29 @@ const logger_1 = __importDefault(require("../../logger"));
|
|
|
20
20
|
const utils_1 = require("../../utils");
|
|
21
21
|
const handlers_1 = __importDefault(require("./handlers"));
|
|
22
22
|
const readonly_1 = __importDefault(require("../../readonly"));
|
|
23
|
-
class
|
|
23
|
+
class YAMLContext {
|
|
24
24
|
constructor(config, mgmtClient) {
|
|
25
25
|
this.configFile = config.AUTH0_INPUT_FILE;
|
|
26
26
|
this.config = config;
|
|
27
|
-
this.mappings = config.AUTH0_KEYWORD_REPLACE_MAPPINGS;
|
|
27
|
+
this.mappings = config.AUTH0_KEYWORD_REPLACE_MAPPINGS || {};
|
|
28
28
|
this.mgmtClient = mgmtClient;
|
|
29
|
+
//@ts-ignore because the assets property gets filled out throughout
|
|
30
|
+
this.assets = {};
|
|
29
31
|
// Get excluded rules
|
|
30
|
-
this.assets = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
defaults: config.AUTH0_EXCLUDED_DEFAULTS || []
|
|
38
|
-
}
|
|
32
|
+
this.assets.exclude = {
|
|
33
|
+
rules: config.AUTH0_EXCLUDED_RULES || [],
|
|
34
|
+
clients: config.AUTH0_EXCLUDED_CLIENTS || [],
|
|
35
|
+
databases: config.AUTH0_EXCLUDED_DATABASES || [],
|
|
36
|
+
connections: config.AUTH0_EXCLUDED_CONNECTIONS || [],
|
|
37
|
+
resourceServers: config.AUTH0_EXCLUDED_RESOURCE_SERVERS || [],
|
|
38
|
+
defaults: config.AUTH0_EXCLUDED_DEFAULTS || [],
|
|
39
39
|
};
|
|
40
|
-
this.basePath =
|
|
41
|
-
|
|
40
|
+
this.basePath = (() => {
|
|
41
|
+
if (!!config.AUTH0_BASE_PATH)
|
|
42
|
+
return config.AUTH0_BASE_PATH;
|
|
42
43
|
//@ts-ignore because this looks to be a bug, but do not want to introduce regression; more investigation needed
|
|
43
|
-
|
|
44
|
-
}
|
|
44
|
+
return typeof configFile === 'object' ? process.cwd() : path_1.default.dirname(this.configFile);
|
|
45
|
+
})();
|
|
45
46
|
}
|
|
46
47
|
loadFile(f) {
|
|
47
48
|
let toLoad = path_1.default.join(this.basePath, f);
|
|
@@ -75,8 +76,7 @@ class default_1 {
|
|
|
75
76
|
yield Promise.all(Object.entries(handlers_1.default).map(([name, handler]) => __awaiter(this, void 0, void 0, function* () {
|
|
76
77
|
try {
|
|
77
78
|
const parsed = yield handler.parse(this);
|
|
78
|
-
Object.entries(parsed)
|
|
79
|
-
.forEach(([k, v]) => {
|
|
79
|
+
Object.entries(parsed).forEach(([k, v]) => {
|
|
80
80
|
this.assets[k] = v;
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -97,17 +97,25 @@ class default_1 {
|
|
|
97
97
|
}
|
|
98
98
|
catch (err) {
|
|
99
99
|
const docUrl = 'https://auth0.com/docs/deploy/deploy-cli-tool/create-and-configure-the-deploy-cli-application#modify-deploy-cli-application-scopes';
|
|
100
|
-
const extraMessage = err.message.startsWith('Insufficient scope')
|
|
100
|
+
const extraMessage = err.message.startsWith('Insufficient scope')
|
|
101
|
+
? `\nSee ${docUrl} for more information`
|
|
102
|
+
: '';
|
|
101
103
|
throw new Error(`Problem loading tenant data from Auth0 ${err}${extraMessage}`);
|
|
102
104
|
}
|
|
103
|
-
yield Promise.all(Object.entries(handlers_1.default)
|
|
105
|
+
yield Promise.all(Object.entries(handlers_1.default)
|
|
106
|
+
.filter(([handlerName]) => {
|
|
107
|
+
const excludedAssetTypes = this.config.AUTH0_EXCLUDED || [];
|
|
108
|
+
return !excludedAssetTypes.includes(handlerName);
|
|
109
|
+
})
|
|
110
|
+
.map(([name, handler]) => __awaiter(this, void 0, void 0, function* () {
|
|
104
111
|
try {
|
|
105
112
|
const data = yield handler.dump(this);
|
|
106
113
|
if (data) {
|
|
107
114
|
logger_1.default.info(`Exporting ${name}`);
|
|
108
|
-
Object.entries(data)
|
|
109
|
-
.
|
|
110
|
-
|
|
115
|
+
Object.entries(data).forEach(([k, v]) => {
|
|
116
|
+
this.assets[k] = Array.isArray(v)
|
|
117
|
+
? v.map(utils_1.formatResults).sort(utils_1.recordsSorter)
|
|
118
|
+
: (0, utils_1.formatResults)(v);
|
|
111
119
|
});
|
|
112
120
|
}
|
|
113
121
|
}
|
|
@@ -131,4 +139,4 @@ class default_1 {
|
|
|
131
139
|
});
|
|
132
140
|
}
|
|
133
141
|
}
|
|
134
|
-
exports.default =
|
|
142
|
+
exports.default = YAMLContext;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import importCMD from './commands/import';
|
|
3
|
+
import exportCMD from './commands/export';
|
|
4
|
+
declare const _default: {
|
|
5
|
+
deploy: typeof importCMD;
|
|
6
|
+
dump: typeof exportCMD;
|
|
7
|
+
import: typeof importCMD;
|
|
8
|
+
export: typeof exportCMD;
|
|
9
|
+
tools: {
|
|
10
|
+
constants: {
|
|
11
|
+
CONCURRENT_CALLS: number;
|
|
12
|
+
RULES_DIRECTORY: string;
|
|
13
|
+
RULES_STAGES: string[];
|
|
14
|
+
DEFAULT_RULE_STAGE: string;
|
|
15
|
+
HOOKS_HIDDEN_SECRET_VALUE: string;
|
|
16
|
+
OBFUSCATED_SECRET_VALUE: string;
|
|
17
|
+
HOOKS_DIRECTORY: string;
|
|
18
|
+
ACTIONS_DIRECTORY: string;
|
|
19
|
+
TRIGGERS_DIRECTORY: string;
|
|
20
|
+
RULES_CONFIGS_DIRECTORY: string;
|
|
21
|
+
PAGES_DIRECTORY: string;
|
|
22
|
+
PAGE_LOGIN: string;
|
|
23
|
+
PAGE_GUARDIAN_MULTIFACTOR: string;
|
|
24
|
+
PAGE_PASSWORD_RESET: string;
|
|
25
|
+
PAGE_ERROR: string;
|
|
26
|
+
DATABASE_CONNECTIONS_DIRECTORY: string;
|
|
27
|
+
DATABASE_SCRIPTS_CHANGE_EMAIL: string;
|
|
28
|
+
DATABASE_SCRIPTS_GET_USER: string;
|
|
29
|
+
EMAIL_TEMPLATES_TYPES: string[];
|
|
30
|
+
ACTIONS_TRIGGERS: string[];
|
|
31
|
+
EMAIL_TEMPLATES_DIRECTORY: string;
|
|
32
|
+
EMAIL_VERIFY: string;
|
|
33
|
+
EMAIL_VERIFY_BY_CODE: string;
|
|
34
|
+
EMAIL_RESET: string;
|
|
35
|
+
EMAIL_WELCOME: string;
|
|
36
|
+
EMAIL_BLOCKED: string;
|
|
37
|
+
EMAIL_STOLEN_CREDENTIALS: string;
|
|
38
|
+
EMAIL_ENROLLMENT: string;
|
|
39
|
+
EMAIL_CHANGE_PASSWORD: string;
|
|
40
|
+
EMAIL_PASSWORD_RESET: string;
|
|
41
|
+
EMAIL_MFA_OOB_CODE: string;
|
|
42
|
+
EMAIL_USER_INVITATION: string;
|
|
43
|
+
GUARDIAN_DIRECTORY: string;
|
|
44
|
+
GUARDIAN_FACTORS_DIRECTORY: string;
|
|
45
|
+
GUARDIAN_PROVIDERS_DIRECTORY: string;
|
|
46
|
+
GUARDIAN_TEMPLATES_DIRECTORY: string;
|
|
47
|
+
UNIVERSAL_LOGIN_TEMPLATE: string;
|
|
48
|
+
RESOURCE_SERVERS_DIRECTORY: string;
|
|
49
|
+
RESOURCE_SERVERS_CLIENT_NAME: string;
|
|
50
|
+
RESOURCE_SERVERS_MANAGEMENT_API_NAME: string;
|
|
51
|
+
RESOURCE_SERVERS_ID_NAME: string;
|
|
52
|
+
CLIENTS_DIRECTORY: string;
|
|
53
|
+
CLIENTS_GRANTS_DIRECTORY: string;
|
|
54
|
+
BRANDING_DIRECTORY: string;
|
|
55
|
+
BRANDING_TEMPLATES_DIRECTORY: string;
|
|
56
|
+
BRANDING_TEMPLATES_YAML_DIRECTORY: string;
|
|
57
|
+
CLIENTS_CLIENT_NAME: string;
|
|
58
|
+
CLIENTS_CLIENT_ID_NAME: string;
|
|
59
|
+
CONNECTIONS_DIRECTORY: string;
|
|
60
|
+
CONNECTIONS_CLIENT_NAME: string;
|
|
61
|
+
CONNECTIONS_ID_NAME: string;
|
|
62
|
+
ROLES_DIRECTORY: string;
|
|
63
|
+
ATTACK_PROTECTION_DIRECTORY: string;
|
|
64
|
+
GUARDIAN_FACTORS: string[];
|
|
65
|
+
GUARDIAN_POLICIES: string[];
|
|
66
|
+
GUARDIAN_PHONE_PROVIDERS: string[];
|
|
67
|
+
GUARDIAN_PHONE_MESSAGE_TYPES: string[];
|
|
68
|
+
GUARDIAN_FACTOR_TEMPLATES: string[];
|
|
69
|
+
GUARDIAN_FACTOR_PROVIDERS: {
|
|
70
|
+
sms: string[];
|
|
71
|
+
'push-notification': string[];
|
|
72
|
+
};
|
|
73
|
+
PAGE_NAMES: string[];
|
|
74
|
+
DATABASE_SCRIPTS: string[];
|
|
75
|
+
DATABASE_SCRIPTS_NO_IMPORT: string[];
|
|
76
|
+
DATABASE_SCRIPTS_IMPORT: string[];
|
|
77
|
+
EMAIL_TEMPLATES_NAMES: string[];
|
|
78
|
+
SUPPORTED_BRANDING_TEMPLATES: string[];
|
|
79
|
+
};
|
|
80
|
+
deploy: typeof import("./tools").deploy;
|
|
81
|
+
keywordReplace: typeof import("./tools").keywordReplace;
|
|
82
|
+
loadFileAndReplaceKeywords: typeof import("./tools").loadFileAndReplaceKeywords;
|
|
83
|
+
Auth0: typeof import("./tools").Auth0;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export default _default;
|
|
87
|
+
export declare const dump: typeof exportCMD;
|
|
88
|
+
export declare const deploy: typeof importCMD;
|
package/lib/index.js
CHANGED
|
@@ -13,15 +13,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.deploy = exports.dump = void 0;
|
|
16
17
|
const global_agent_1 = require("global-agent");
|
|
17
18
|
const args_1 = require("./args");
|
|
18
|
-
const commands_1 = __importDefault(require("./commands"));
|
|
19
19
|
const logger_1 = __importDefault(require("./logger"));
|
|
20
20
|
const tools_1 = __importDefault(require("./tools"));
|
|
21
|
+
const import_1 = __importDefault(require("./commands/import"));
|
|
22
|
+
const export_1 = __importDefault(require("./commands/export"));
|
|
21
23
|
function run(params) {
|
|
22
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
25
|
// Run command
|
|
24
|
-
const
|
|
26
|
+
const command = params._[0];
|
|
25
27
|
const proxy = params.proxy_url;
|
|
26
28
|
if (proxy) {
|
|
27
29
|
const MAJOR_NODEJS_VERSION = parseInt(process.version.slice(1).split('.')[0], 10);
|
|
@@ -32,9 +34,14 @@ function run(params) {
|
|
|
32
34
|
process.env.GLOBAL_AGENT_HTTP_PROXY = proxy;
|
|
33
35
|
(0, global_agent_1.bootstrap)();
|
|
34
36
|
}
|
|
35
|
-
logger_1.default.debug(`Start command ${
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
logger_1.default.debug(`Start command ${command}`);
|
|
38
|
+
if (['deploy', 'import'].includes(command) && 'input_file' in params) {
|
|
39
|
+
yield (0, import_1.default)(params);
|
|
40
|
+
}
|
|
41
|
+
if (['dump', 'export'].includes(command) && 'output_folder' in params) {
|
|
42
|
+
yield (0, export_1.default)(params);
|
|
43
|
+
}
|
|
44
|
+
logger_1.default.debug(`Finished command ${command}`);
|
|
38
45
|
});
|
|
39
46
|
}
|
|
40
47
|
// Only run if from command line
|
|
@@ -42,10 +49,8 @@ if (require.main === module) {
|
|
|
42
49
|
// Load cli params
|
|
43
50
|
const params = (0, args_1.getParams)();
|
|
44
51
|
logger_1.default.debug('Starting Auth0 Deploy CLI Tool');
|
|
45
|
-
// Set log level
|
|
46
|
-
logger_1.default.transports.console.level = params.level;
|
|
47
52
|
if (params.debug) {
|
|
48
|
-
logger_1.default.
|
|
53
|
+
logger_1.default.level = 'debug';
|
|
49
54
|
// Set for tools
|
|
50
55
|
process.env.AUTH0_DEBUG = 'true';
|
|
51
56
|
process.env.AUTH0_LOG = 'debug';
|
|
@@ -53,15 +58,16 @@ if (require.main === module) {
|
|
|
53
58
|
run(params)
|
|
54
59
|
.then(() => process.exit(0))
|
|
55
60
|
.catch((error) => {
|
|
61
|
+
const command = params._[0];
|
|
56
62
|
if (error.type || error.stage) {
|
|
57
|
-
logger_1.default.error(`Problem running command ${
|
|
63
|
+
logger_1.default.error(`Problem running command ${command} during stage ${error.stage} when processing type ${error.type}`);
|
|
58
64
|
}
|
|
59
65
|
else {
|
|
60
|
-
logger_1.default.error(`Problem running command ${
|
|
66
|
+
logger_1.default.error(`Problem running command ${command}`);
|
|
61
67
|
}
|
|
62
68
|
const msg = error.message || error.toString();
|
|
63
69
|
logger_1.default.error(msg);
|
|
64
|
-
if (process.env.AUTH0_DEBUG === 'true') {
|
|
70
|
+
if (process.env.AUTH0_DEBUG === 'true' && error.stack) {
|
|
65
71
|
logger_1.default.debug(error.stack);
|
|
66
72
|
}
|
|
67
73
|
if (typeof msg === 'string' && msg.includes('Payload validation error')) {
|
|
@@ -71,10 +77,12 @@ if (require.main === module) {
|
|
|
71
77
|
});
|
|
72
78
|
}
|
|
73
79
|
// Export commands to be used programmatically
|
|
74
|
-
|
|
75
|
-
deploy:
|
|
76
|
-
dump:
|
|
77
|
-
import:
|
|
78
|
-
export:
|
|
79
|
-
tools: tools_1.default
|
|
80
|
+
exports.default = {
|
|
81
|
+
deploy: import_1.default,
|
|
82
|
+
dump: export_1.default,
|
|
83
|
+
import: import_1.default,
|
|
84
|
+
export: export_1.default,
|
|
85
|
+
tools: tools_1.default,
|
|
80
86
|
};
|
|
87
|
+
exports.dump = export_1.default;
|
|
88
|
+
exports.deploy = import_1.default;
|
package/lib/logger.d.ts
ADDED
package/lib/logger.js
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const winston_1 =
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
handleExceptions: true,
|
|
14
|
-
json: false,
|
|
15
|
-
colorize: true
|
|
16
|
-
})
|
|
17
|
-
],
|
|
18
|
-
exitOnError: false
|
|
3
|
+
const winston_1 = require("winston");
|
|
4
|
+
const { combine, timestamp, colorize } = winston_1.format;
|
|
5
|
+
const logger = (0, winston_1.createLogger)({
|
|
6
|
+
level: process.env.AUTH0_LOG || 'info',
|
|
7
|
+
format: combine(colorize(), timestamp(), winston_1.format.printf((info) => `${info.timestamp} - ${info.level}: ${info.message}`)),
|
|
8
|
+
transports: [new winston_1.transports.Console()],
|
|
9
|
+
exitOnError: false,
|
|
19
10
|
});
|
|
20
|
-
exports.default =
|
|
11
|
+
exports.default = logger;
|
package/lib/readonly.js
CHANGED
|
@@ -6,24 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const dot_prop_1 = __importDefault(require("dot-prop"));
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
// Filter out known read only fields during dump
|
|
9
|
-
const
|
|
10
|
-
guardianFactors: [
|
|
11
|
-
|
|
12
|
-
],
|
|
13
|
-
connections: [
|
|
14
|
-
'provisioning_ticket_url',
|
|
15
|
-
'realms'
|
|
16
|
-
],
|
|
17
|
-
databases: [
|
|
18
|
-
'options.configuration'
|
|
19
|
-
],
|
|
9
|
+
const readOnlyFields = {
|
|
10
|
+
guardianFactors: ['trial_expired'],
|
|
11
|
+
connections: ['provisioning_ticket_url', 'realms'],
|
|
12
|
+
databases: ['options.configuration'],
|
|
20
13
|
tenant: [
|
|
21
14
|
'sandbox_version',
|
|
22
15
|
'sandbox_versions_available',
|
|
23
16
|
'flags.allow_changing_enable_sso',
|
|
24
17
|
'flags.enable_sso',
|
|
25
18
|
'flags.disable_impersonation',
|
|
26
|
-
'flags.remove_stale_idp_attributes'
|
|
19
|
+
'flags.remove_stale_idp_attributes',
|
|
27
20
|
],
|
|
28
21
|
clients: [
|
|
29
22
|
'client_secret',
|
|
@@ -33,11 +26,11 @@ const readOnly = {
|
|
|
33
26
|
'tenant',
|
|
34
27
|
'custom_login_page_preview',
|
|
35
28
|
'config_route',
|
|
36
|
-
'owners'
|
|
37
|
-
]
|
|
29
|
+
'owners',
|
|
30
|
+
],
|
|
38
31
|
};
|
|
39
32
|
function getExcludedFields(config) {
|
|
40
|
-
const strippedFields = Object.assign({},
|
|
33
|
+
const strippedFields = Object.assign({}, readOnlyFields);
|
|
41
34
|
let { EXCLUDED_PROPS: excluded, INCLUDED_PROPS: included } = config;
|
|
42
35
|
if (typeof excluded !== 'object')
|
|
43
36
|
excluded = {};
|
|
@@ -45,7 +38,7 @@ function getExcludedFields(config) {
|
|
|
45
38
|
included = {};
|
|
46
39
|
Object.entries(excluded).forEach(([name, fields]) => {
|
|
47
40
|
// Do not allow same field to be included and excluded at the same time
|
|
48
|
-
const intersections = fields.filter((field) => included[name] && included[name].includes(field));
|
|
41
|
+
const intersections = fields.filter((field) => included && included[name] && included[name].includes(field));
|
|
49
42
|
if (intersections.length > 0) {
|
|
50
43
|
throw new Error(`EXCLUDED_PROPS should NOT have any intersections with INCLUDED_PROPS. Intersections found: ${name}: ${intersections.join(', ')}`);
|
|
51
44
|
}
|
|
@@ -71,9 +64,11 @@ function cleanAssets(assets, config) {
|
|
|
71
64
|
if (!obj)
|
|
72
65
|
return;
|
|
73
66
|
if (Array.isArray(obj)) {
|
|
67
|
+
//@ts-ignore because `message_types` and `policies` on guardianPhoneFactorMessageTypes and guardianPolicies don't adhere to the expect types
|
|
74
68
|
cleaned[name] = obj.map((o) => deleteKeys(o, fields));
|
|
75
69
|
}
|
|
76
70
|
else {
|
|
71
|
+
//@ts-ignore because `message_types` and `policies` on guardianPhoneFactorMessageTypes and guardianPolicies don't adhere to the expect types
|
|
77
72
|
cleaned[name] = deleteKeys(cleaned[name], fields);
|
|
78
73
|
}
|
|
79
74
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const sessionDurationsToMinutes: ({ session_lifetime, idle_session_lifetime, }: {
|
|
2
|
+
session_lifetime?: number | undefined;
|
|
3
|
+
idle_session_lifetime?: number | undefined;
|
|
4
|
+
}) => {
|
|
5
|
+
session_lifetime_in_minutes?: number;
|
|
6
|
+
idle_session_lifetime_in_minutes?: number;
|
|
7
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sessionDurationsToMinutes = void 0;
|
|
4
|
+
function hoursToMinutes(hours) {
|
|
5
|
+
return Math.round(hours * 60);
|
|
6
|
+
}
|
|
7
|
+
const sessionDurationsToMinutes = ({ session_lifetime, idle_session_lifetime, }) => {
|
|
8
|
+
const sessionDurations = {};
|
|
9
|
+
if (!!session_lifetime)
|
|
10
|
+
sessionDurations.session_lifetime_in_minutes = hoursToMinutes(session_lifetime);
|
|
11
|
+
if (!!idle_session_lifetime)
|
|
12
|
+
sessionDurations.idle_session_lifetime_in_minutes = hoursToMinutes(idle_session_lifetime);
|
|
13
|
+
return sessionDurations;
|
|
14
|
+
};
|
|
15
|
+
exports.sessionDurationsToMinutes = sessionDurationsToMinutes;
|
|
@@ -33,7 +33,7 @@ const API_FREQUENCY_PER_SECOND = 8;
|
|
|
33
33
|
const MAX_PAGE_SIZE = 100;
|
|
34
34
|
function getEntity(rsp) {
|
|
35
35
|
const found = Object.values(rsp).filter((a) => Array.isArray(a));
|
|
36
|
-
if (found.length === 1) {
|
|
36
|
+
if (Array.isArray(found) && found.length === 1) {
|
|
37
37
|
return found[0];
|
|
38
38
|
}
|
|
39
39
|
throw new Error('There was an error trying to find the entity within paginate');
|
|
@@ -48,7 +48,7 @@ function checkpointPaginator(client, target, name) {
|
|
|
48
48
|
const { total } = yield client.pool
|
|
49
49
|
.addSingleTask({
|
|
50
50
|
data: newArgs,
|
|
51
|
-
generator: (requestArgs) => target[name](requestArgs)
|
|
51
|
+
generator: (requestArgs) => target[name](requestArgs),
|
|
52
52
|
})
|
|
53
53
|
.promise();
|
|
54
54
|
let done = false;
|
|
@@ -58,7 +58,7 @@ function checkpointPaginator(client, target, name) {
|
|
|
58
58
|
const rsp = yield client.pool
|
|
59
59
|
.addSingleTask({
|
|
60
60
|
data: newArgs,
|
|
61
|
-
generator: (requestArgs) => target[name](requestArgs)
|
|
61
|
+
generator: (requestArgs) => target[name](requestArgs),
|
|
62
62
|
})
|
|
63
63
|
.promise();
|
|
64
64
|
data.push(...getEntity(rsp));
|
|
@@ -92,7 +92,7 @@ function pagePaginator(client, target, name) {
|
|
|
92
92
|
const rsp = yield client.pool
|
|
93
93
|
.addSingleTask({
|
|
94
94
|
data: lodash_1.default.cloneDeep(newArgs),
|
|
95
|
-
generator: (pageArgs) => target[name](...pageArgs)
|
|
95
|
+
generator: (pageArgs) => target[name](...pageArgs),
|
|
96
96
|
})
|
|
97
97
|
.promise();
|
|
98
98
|
data.push(...getEntity(rsp));
|
|
@@ -107,7 +107,7 @@ function pagePaginator(client, target, name) {
|
|
|
107
107
|
const pageArgs = lodash_1.default.cloneDeep(newArgs);
|
|
108
108
|
pageArgs[0].page = page + 1;
|
|
109
109
|
return target[name](...pageArgs).then((r) => getEntity(r));
|
|
110
|
-
}
|
|
110
|
+
},
|
|
111
111
|
})
|
|
112
112
|
.promise();
|
|
113
113
|
data.push(...(0, utils_1.flatten)(pages));
|
|
@@ -142,16 +142,16 @@ function pagedManager(client, manager) {
|
|
|
142
142
|
return pagedManager(client, nestedManager);
|
|
143
143
|
}
|
|
144
144
|
return nestedManager;
|
|
145
|
-
}
|
|
145
|
+
},
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
// Warp around the ManagementClient and detect when requesting specific pages to return all
|
|
149
149
|
function pagedClient(client) {
|
|
150
|
-
client
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return pagedManager(
|
|
150
|
+
const clientWithPooling = Object.assign(Object.assign({}, client), { pool: new promise_pool_executor_1.PromisePoolExecutor({
|
|
151
|
+
concurrencyLimit: API_CONCURRENCY,
|
|
152
|
+
frequencyLimit: API_FREQUENCY_PER_SECOND,
|
|
153
|
+
frequencyWindow: 1000, // 1 sec
|
|
154
|
+
}) });
|
|
155
|
+
return pagedManager(clientWithPooling, clientWithPooling);
|
|
156
156
|
}
|
|
157
157
|
exports.default = pagedClient;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import DefaultAPIHandler from './default';
|
|
2
|
+
import { Asset } from '../../../types';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
items: {
|
|
6
|
+
type: string;
|
|
7
|
+
required: string[];
|
|
8
|
+
additionalProperties: boolean;
|
|
9
|
+
properties: {
|
|
10
|
+
code: {
|
|
11
|
+
type: string;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
runtime: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
dependencies: {
|
|
18
|
+
type: string;
|
|
19
|
+
items: {
|
|
20
|
+
type: string;
|
|
21
|
+
additionalProperties: boolean;
|
|
22
|
+
properties: {
|
|
23
|
+
name: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
version: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
registry_url: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
secrets: {
|
|
36
|
+
type: string;
|
|
37
|
+
items: {
|
|
38
|
+
type: string;
|
|
39
|
+
properties: {
|
|
40
|
+
name: {
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
43
|
+
value: {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
updated_at: {
|
|
47
|
+
type: string;
|
|
48
|
+
format: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
name: {
|
|
54
|
+
type: string;
|
|
55
|
+
default: string;
|
|
56
|
+
};
|
|
57
|
+
supported_triggers: {
|
|
58
|
+
type: string;
|
|
59
|
+
items: {
|
|
60
|
+
type: string;
|
|
61
|
+
properties: {
|
|
62
|
+
id: {
|
|
63
|
+
type: string;
|
|
64
|
+
default: string;
|
|
65
|
+
};
|
|
66
|
+
version: {
|
|
67
|
+
type: string;
|
|
68
|
+
};
|
|
69
|
+
url: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
deployed: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
status: {
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export default class ActionHandler extends DefaultAPIHandler {
|
|
85
|
+
existing: Asset[] | null;
|
|
86
|
+
constructor(options: any);
|
|
87
|
+
createAction(action: any): Promise<Asset>;
|
|
88
|
+
deleteAction(action: any): Promise<void | never[]>;
|
|
89
|
+
objString(action: any): string;
|
|
90
|
+
deployActions(actions: any): Promise<void>;
|
|
91
|
+
deployAction(action: any): Promise<void>;
|
|
92
|
+
actionChanges(action: any, found: any): Promise<Asset>;
|
|
93
|
+
getType(): Promise<Asset[] | null>;
|
|
94
|
+
processChanges(assets: any): Promise<void>;
|
|
95
|
+
}
|