auth0-deploy-cli 7.5.0 → 7.6.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 +66 -17
- package/CHANGELOG.md +25 -2
- package/lib/args.js +6 -3
- package/lib/commands/export.js +8 -6
- package/lib/commands/import.js +11 -10
- package/lib/context/directory/handlers/actions.js +3 -2
- package/lib/context/directory/handlers/attackProtection.js +3 -2
- package/lib/context/directory/handlers/branding.js +59 -0
- package/lib/context/directory/handlers/clientGrants.js +3 -2
- package/lib/context/directory/handlers/clients.js +3 -2
- package/lib/context/directory/handlers/connections.js +3 -2
- package/lib/context/directory/handlers/databases.js +18 -16
- package/lib/context/directory/handlers/emailProvider.js +3 -2
- package/lib/context/directory/handlers/emailTemplates.js +11 -9
- 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 +3 -2
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +3 -2
- package/lib/context/directory/handlers/guardianPolicies.js +3 -2
- package/lib/context/directory/handlers/hooks.js +3 -2
- package/lib/context/directory/handlers/index.js +3 -1
- package/lib/context/directory/handlers/migrations.js +8 -8
- package/lib/context/directory/handlers/organizations.js +3 -2
- package/lib/context/directory/handlers/pages.js +18 -18
- package/lib/context/directory/handlers/resourceServers.js +3 -2
- package/lib/context/directory/handlers/roles.js +3 -2
- package/lib/context/directory/handlers/rules.js +3 -2
- package/lib/context/directory/handlers/rulesConfigs.js +4 -3
- package/lib/context/directory/handlers/tenant.js +5 -3
- package/lib/context/directory/handlers/triggers.js +3 -2
- package/lib/context/directory/index.js +2 -4
- package/lib/context/yaml/handlers/actions.js +4 -3
- package/lib/context/yaml/handlers/attackProtection.js +5 -11
- package/lib/context/yaml/handlers/branding.js +65 -0
- package/lib/context/yaml/handlers/clientGrants.js +3 -2
- package/lib/context/yaml/handlers/clients.js +3 -2
- package/lib/context/yaml/handlers/connections.js +3 -2
- package/lib/context/yaml/handlers/databases.js +3 -2
- package/lib/context/yaml/handlers/emailProvider.js +3 -2
- package/lib/context/yaml/handlers/emailTemplates.js +3 -2
- package/lib/context/yaml/handlers/guardianFactorProviders.js +5 -12
- package/lib/context/yaml/handlers/guardianFactorTemplates.js +5 -12
- package/lib/context/yaml/handlers/guardianFactors.js +5 -12
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +5 -12
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +5 -12
- package/lib/context/yaml/handlers/guardianPolicies.js +5 -12
- package/lib/context/yaml/handlers/hooks.js +3 -2
- package/lib/context/yaml/handlers/index.js +3 -1
- package/lib/context/yaml/handlers/migrations.js +3 -2
- package/lib/context/yaml/handlers/organizations.js +3 -2
- package/lib/context/yaml/handlers/pages.js +3 -2
- package/lib/context/yaml/handlers/resourceServers.js +3 -2
- package/lib/context/yaml/handlers/roles.js +3 -2
- package/lib/context/yaml/handlers/rules.js +3 -2
- package/lib/context/yaml/handlers/rulesConfigs.js +4 -3
- package/lib/context/yaml/handlers/tenant.js +3 -2
- package/lib/context/yaml/handlers/triggers.js +3 -2
- package/lib/context/yaml/index.js +2 -1
- package/lib/index.js +1 -1
- package/lib/tools/auth0/handlers/branding.js +67 -13
- package/lib/tools/auth0/handlers/default.js +7 -1
- package/lib/tools/auth0/handlers/organizations.js +7 -2
- package/lib/tools/auth0/handlers/resourceServers.js +7 -2
- package/lib/tools/auth0/handlers/roles.js +7 -2
- package/lib/tools/auth0/handlers/rules.js +7 -1
- package/lib/tools/calculateChanges.js +144 -0
- package/lib/tools/constants.js +7 -0
- package/lib/tools/utils.js +1 -142
- package/package.json +8 -15
- package/tsconfig.json +11 -89
- package/.babelrc +0 -17
- package/.nyc_output/60b76a45-577b-4171-9982-a8e836ab7fd6.json +0 -1
- package/.nyc_output/processinfo/60b76a45-577b-4171-9982-a8e836ab7fd6.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
package/.eslintrc
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"parser": "@
|
|
2
|
+
"parser": "@typescript-eslint/parser",
|
|
3
3
|
"parserOptions": {
|
|
4
4
|
"ecmaVersion": 2020
|
|
5
5
|
},
|
|
@@ -15,20 +15,40 @@
|
|
|
15
15
|
},
|
|
16
16
|
"settings": {
|
|
17
17
|
"import/resolver": {
|
|
18
|
-
"
|
|
18
|
+
"node": {
|
|
19
|
+
"extensions": [
|
|
20
|
+
".js",
|
|
21
|
+
".ts"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
},
|
|
21
26
|
"rules": {
|
|
22
27
|
"max-len": 0,
|
|
23
28
|
"react/display-name": 0,
|
|
24
|
-
"array-bracket-spacing": [
|
|
29
|
+
"array-bracket-spacing": [
|
|
30
|
+
2,
|
|
31
|
+
"always"
|
|
32
|
+
],
|
|
25
33
|
"class-methods-use-this": 0,
|
|
26
|
-
"comma-dangle": [
|
|
34
|
+
"comma-dangle": [
|
|
35
|
+
2,
|
|
36
|
+
"never"
|
|
37
|
+
],
|
|
27
38
|
"eol-last": 2,
|
|
28
|
-
"indent": [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
"indent": [
|
|
40
|
+
2,
|
|
41
|
+
2,
|
|
42
|
+
{
|
|
43
|
+
"SwitchCase": 1
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"import/no-extraneous-dependencies": [
|
|
47
|
+
"error",
|
|
48
|
+
{
|
|
49
|
+
"devDependencies": true
|
|
50
|
+
}
|
|
51
|
+
],
|
|
32
52
|
"import/no-dynamic-require": 0,
|
|
33
53
|
"prefer-arrow-callback": 0,
|
|
34
54
|
"object-shorthand": 0,
|
|
@@ -38,17 +58,46 @@
|
|
|
38
58
|
"no-await-in-loop": 0,
|
|
39
59
|
"no-param-reassign": 0,
|
|
40
60
|
"no-multiple-empty-lines": 2,
|
|
41
|
-
"no-plusplus": [
|
|
61
|
+
"no-plusplus": [
|
|
62
|
+
"error",
|
|
63
|
+
{
|
|
64
|
+
"allowForLoopAfterthoughts": true
|
|
65
|
+
}
|
|
66
|
+
],
|
|
42
67
|
"no-unused-vars": 2,
|
|
43
68
|
"no-var": 0,
|
|
44
|
-
"object-curly-spacing": [
|
|
45
|
-
|
|
46
|
-
|
|
69
|
+
"object-curly-spacing": [
|
|
70
|
+
2,
|
|
71
|
+
"always"
|
|
72
|
+
],
|
|
73
|
+
"quotes": [
|
|
74
|
+
2,
|
|
75
|
+
"single",
|
|
76
|
+
"avoid-escape"
|
|
77
|
+
],
|
|
78
|
+
"semi": [
|
|
79
|
+
2,
|
|
80
|
+
"always"
|
|
81
|
+
],
|
|
47
82
|
"strict": 0,
|
|
48
|
-
"space-before-blocks": [
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
83
|
+
"space-before-blocks": [
|
|
84
|
+
2,
|
|
85
|
+
"always"
|
|
86
|
+
],
|
|
87
|
+
"space-before-function-paren": [
|
|
88
|
+
2,
|
|
89
|
+
{
|
|
90
|
+
"anonymous": "never",
|
|
91
|
+
"named": "never"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"import/extensions": [
|
|
95
|
+
"error",
|
|
96
|
+
"ignorePackages",
|
|
97
|
+
{
|
|
98
|
+
"js": "never",
|
|
99
|
+
"ts": "never"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
53
102
|
}
|
|
54
103
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.6.0] - 2022-03-25
|
|
11
|
+
### Added
|
|
12
|
+
- New branding template feature support [#438]
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Colliding `e` parameter alias between `export_ids` and `env` [#453]
|
|
16
|
+
|
|
17
|
+
## [7.5.2] - 2022-03-15
|
|
18
|
+
### Fixed
|
|
19
|
+
- Resetting this version to be latest on NPM
|
|
20
|
+
|
|
21
|
+
## [7.5.1] - 2022-03-11
|
|
22
|
+
### Fixed
|
|
23
|
+
- Updating dead link in logging output [#436]
|
|
24
|
+
- Fixing `--env` flag to properly dictate environment variable inheritance [#432]
|
|
25
|
+
|
|
10
26
|
## [7.5.0] - 2022-03-08
|
|
11
27
|
### Added
|
|
12
28
|
- Support for attack protection configuration management [#428]
|
|
@@ -445,8 +461,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
445
461
|
[#421]: https://github.com/auth0/auth0-deploy-cli/issues/421
|
|
446
462
|
[#428]: https://github.com/auth0/auth0-deploy-cli/issues/428
|
|
447
463
|
[#430]: https://github.com/auth0/auth0-deploy-cli/issues/430
|
|
448
|
-
|
|
449
|
-
[
|
|
464
|
+
[#432]: https://github.com/auth0/auth0-deploy-cli/issues/432
|
|
465
|
+
[#436]: https://github.com/auth0/auth0-deploy-cli/issues/436
|
|
466
|
+
[#438]: https://github.com/auth0/auth0-deploy-cli/issues/438
|
|
467
|
+
[#453]: https://github.com/auth0/auth0-deploy-cli/issues/453
|
|
468
|
+
|
|
469
|
+
[Unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v7.6.0...HEAD
|
|
470
|
+
[7.6.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.5.2...v7.6.0
|
|
471
|
+
[7.5.2]: https://github.com/auth0/auth0-deploy-cli/compare/v7.5.1...v7.5.2
|
|
472
|
+
[7.5.1]: https://github.com/auth0/auth0-deploy-cli/compare/v7.5.0...v7.5.1
|
|
450
473
|
[7.5.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.4.0...v7.5.0
|
|
451
474
|
[7.4.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.3.7...v7.4.0
|
|
452
475
|
[7.3.7]: https://github.com/auth0/auth0-deploy-cli/compare/v7.3.6...v7.3.7
|
package/lib/args.js
CHANGED
|
@@ -33,9 +33,7 @@ function getParams() {
|
|
|
33
33
|
type: 'string'
|
|
34
34
|
},
|
|
35
35
|
env: {
|
|
36
|
-
|
|
37
|
-
describe: 'Override the mappings in config with process.env environment variables.',
|
|
38
|
-
type: 'string',
|
|
36
|
+
describe: 'Override the mappings in config with environment variables.',
|
|
39
37
|
boolean: true,
|
|
40
38
|
default: true
|
|
41
39
|
},
|
|
@@ -69,6 +67,11 @@ function getParams() {
|
|
|
69
67
|
describe: 'The client secret, this allows you to encrypt the secret in your build configuration instead of storing it in a config file',
|
|
70
68
|
type: 'string'
|
|
71
69
|
},
|
|
70
|
+
env: {
|
|
71
|
+
describe: 'Override the mappings in config with environment variables.',
|
|
72
|
+
boolean: true,
|
|
73
|
+
default: false
|
|
74
|
+
},
|
|
72
75
|
export_ids: {
|
|
73
76
|
alias: 'e',
|
|
74
77
|
describe: 'Export identifier field for each object type.',
|
package/lib/commands/export.js
CHANGED
|
@@ -18,18 +18,20 @@ const mkdirp_1 = __importDefault(require("mkdirp"));
|
|
|
18
18
|
const logger_1 = __importDefault(require("../logger"));
|
|
19
19
|
const utils_1 = require("../utils");
|
|
20
20
|
const context_1 = __importDefault(require("../context"));
|
|
21
|
-
function
|
|
21
|
+
function exportCMD(params) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const { output_folder: outputFolder, base_path: basePath, config_file: configFile, config: configObj, export_ids: exportIds, secret } = params;
|
|
24
|
-
|
|
23
|
+
const { output_folder: outputFolder, base_path: basePath, config_file: configFile, config: configObj, export_ids: exportIds, secret: clientSecret, env: shouldInheritEnv = false, } = params;
|
|
24
|
+
if (shouldInheritEnv) {
|
|
25
|
+
nconf_1.default.env().use('memory');
|
|
26
|
+
}
|
|
25
27
|
if (configFile) {
|
|
26
28
|
nconf_1.default.file(configFile);
|
|
27
29
|
}
|
|
28
30
|
const overrides = Object.assign({ AUTH0_INPUT_FILE: outputFolder, AUTH0_BASE_PATH: basePath, AUTH0_CONFIG_FILE: configFile }, configObj || {});
|
|
29
31
|
// Prepare configuration by initializing nconf, then passing that as the provider to the config object
|
|
30
32
|
// Allow passed in secret to override the configured one
|
|
31
|
-
if (
|
|
32
|
-
overrides.AUTH0_CLIENT_SECRET =
|
|
33
|
+
if (clientSecret) {
|
|
34
|
+
overrides.AUTH0_CLIENT_SECRET = clientSecret;
|
|
33
35
|
}
|
|
34
36
|
// Allow passed in export_ids to override the configured one
|
|
35
37
|
if (exportIds) {
|
|
@@ -50,4 +52,4 @@ function deploy(params) {
|
|
|
50
52
|
logger_1.default.info('Export Successful');
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
|
-
exports.default =
|
|
55
|
+
exports.default = exportCMD;
|
package/lib/commands/import.js
CHANGED
|
@@ -17,22 +17,22 @@ const configFactory_1 = __importDefault(require("../configFactory"));
|
|
|
17
17
|
const tools_1 = require("../tools");
|
|
18
18
|
const logger_1 = __importDefault(require("../logger"));
|
|
19
19
|
const context_1 = __importDefault(require("../context"));
|
|
20
|
-
function
|
|
20
|
+
function importCMD(params) {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const { input_file: inputFile, base_path: basePath, config_file: configFile, config: configObj, env, secret } = params;
|
|
23
|
-
|
|
22
|
+
const { input_file: inputFile, base_path: basePath, config_file: configFile, config: configObj, env: shouldInheritEnv = false, secret: clientSecret } = params;
|
|
23
|
+
if (shouldInheritEnv) {
|
|
24
|
+
nconf_1.default.env().use('memory');
|
|
25
|
+
const mappings = nconf_1.default.get('AUTH0_KEYWORD_REPLACE_MAPPINGS') || {};
|
|
26
|
+
nconf_1.default.set('AUTH0_KEYWORD_REPLACE_MAPPINGS', Object.assign(mappings, process.env));
|
|
27
|
+
}
|
|
24
28
|
if (configFile) {
|
|
25
29
|
nconf_1.default.file(configFile);
|
|
26
30
|
}
|
|
27
31
|
const overrides = Object.assign({ AUTH0_INPUT_FILE: inputFile, AUTH0_BASE_PATH: basePath, AUTH0_CONFIG_FILE: configFile, AUTH0_KEYWORD_REPLACE_MAPPINGS: {} }, configObj || {});
|
|
28
32
|
// Prepare configuration by initializing nconf, then passing that as the provider to the config object
|
|
29
33
|
// Allow passed in secret to override the configured one
|
|
30
|
-
if (
|
|
31
|
-
overrides.AUTH0_CLIENT_SECRET =
|
|
32
|
-
}
|
|
33
|
-
if (env) {
|
|
34
|
-
const mappings = nconf_1.default.get('AUTH0_KEYWORD_REPLACE_MAPPINGS') || {};
|
|
35
|
-
nconf_1.default.set('AUTH0_KEYWORD_REPLACE_MAPPINGS', Object.assign(mappings, process.env));
|
|
34
|
+
if (clientSecret) {
|
|
35
|
+
overrides.AUTH0_CLIENT_SECRET = clientSecret;
|
|
36
36
|
}
|
|
37
37
|
nconf_1.default.overrides(overrides);
|
|
38
38
|
// Setup context and load
|
|
@@ -40,8 +40,9 @@ function deploy(params) {
|
|
|
40
40
|
yield context.load();
|
|
41
41
|
const config = (0, configFactory_1.default)();
|
|
42
42
|
config.setProvider((key) => nconf_1.default.get(key));
|
|
43
|
+
//@ts-ignore because context and assets still need to be typed TODO: type assets and type context
|
|
43
44
|
yield (0, tools_1.deploy)(context.assets, context.mgmtClient, config);
|
|
44
45
|
logger_1.default.info('Import Successful');
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
|
-
exports.default =
|
|
48
|
+
exports.default = importCMD;
|
|
@@ -53,7 +53,8 @@ function dump(context) {
|
|
|
53
53
|
(0, utils_1.dumpJSON)(files.suspiciousIpThrottling, attackProtection.suspiciousIpThrottling);
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
const attackProtectionHandler = {
|
|
57
57
|
parse,
|
|
58
|
-
dump
|
|
58
|
+
dump,
|
|
59
59
|
};
|
|
60
|
+
exports.default = attackProtectionHandler;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
|
+
const path_1 = __importDefault(require("path"));
|
|
17
|
+
const tools_1 = require("../../../tools");
|
|
18
|
+
const utils_1 = require("../../../utils");
|
|
19
|
+
function parse(context) {
|
|
20
|
+
const brandingTemplatesFolder = path_1.default.join(context.filePath, tools_1.constants.BRANDING_DIRECTORY, tools_1.constants.BRANDING_TEMPLATES_DIRECTORY);
|
|
21
|
+
if (!(0, utils_1.existsMustBeDir)(brandingTemplatesFolder))
|
|
22
|
+
return { branding: context.branding };
|
|
23
|
+
const templatesDefinitionFiles = (0, utils_1.getFiles)(brandingTemplatesFolder, ['.json']);
|
|
24
|
+
const templates = templatesDefinitionFiles.map((templateDefinitionFile) => {
|
|
25
|
+
const definition = (0, utils_1.loadJSON)(templateDefinitionFile, context.mappings);
|
|
26
|
+
definition.body = (0, tools_1.loadFileAndReplaceKeywords)(path_1.default.join(brandingTemplatesFolder, definition.body), context.mappings);
|
|
27
|
+
return definition;
|
|
28
|
+
}, {});
|
|
29
|
+
return {
|
|
30
|
+
branding: {
|
|
31
|
+
templates
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function dump(context) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const { branding } = context.assets;
|
|
38
|
+
if (!branding || !branding.templates || !branding.templates)
|
|
39
|
+
return; // Skip, nothing to dump
|
|
40
|
+
const brandingTemplatesFolder = path_1.default.join(context.filePath, tools_1.constants.BRANDING_DIRECTORY, tools_1.constants.BRANDING_TEMPLATES_DIRECTORY);
|
|
41
|
+
fs_extra_1.default.ensureDirSync(brandingTemplatesFolder);
|
|
42
|
+
branding.templates.forEach((templateDefinition) => {
|
|
43
|
+
const markup = templateDefinition.body;
|
|
44
|
+
try {
|
|
45
|
+
fs_extra_1.default.writeFileSync(path_1.default.join(brandingTemplatesFolder, `${templateDefinition.template}.html`), markup);
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
throw new Error(`Error writing template file: ${templateDefinition.template}, because: ${e.message}`);
|
|
49
|
+
}
|
|
50
|
+
// save the location as relative file.
|
|
51
|
+
templateDefinition.body = `.${path_1.default.sep}${templateDefinition.template}.html`;
|
|
52
|
+
(0, utils_1.dumpJSON)(path_1.default.join(brandingTemplatesFolder, `${templateDefinition.template}.json`), templateDefinition);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
exports.default = {
|
|
57
|
+
parse,
|
|
58
|
+
dump
|
|
59
|
+
};
|
|
@@ -19,22 +19,20 @@ const logger_1 = __importDefault(require("../../../logger"));
|
|
|
19
19
|
const utils_1 = require("../../../utils");
|
|
20
20
|
function getDatabase(folder, mappings) {
|
|
21
21
|
const metaFile = path_1.default.join(folder, 'database.json');
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
22
|
+
const metaData = (() => {
|
|
23
|
+
try {
|
|
24
|
+
return (0, utils_1.loadJSON)(metaFile, mappings);
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
logger_1.default.warn(`Skipping database folder ${folder} as cannot find or read ${metaFile}`);
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
31
31
|
if (!metaData) {
|
|
32
32
|
logger_1.default.warn(`Skipping database folder ${folder} as ${metaFile} is empty`);
|
|
33
33
|
return {};
|
|
34
34
|
}
|
|
35
|
-
const database = Object.assign(Object.assign({}, metaData), { options: Object.assign(Object.assign({}, metaData.options), (metaData.customScripts && {
|
|
36
|
-
customScripts: metaData.customScripts
|
|
37
|
-
})) });
|
|
35
|
+
const database = Object.assign(Object.assign({}, metaData), { options: Object.assign(Object.assign({}, metaData.options), (metaData.customScripts && { customScripts: metaData.customScripts })) });
|
|
38
36
|
// If any customScripts configured then load content of files
|
|
39
37
|
if (database.options.customScripts) {
|
|
40
38
|
Object.entries(database.options.customScripts).forEach(([name, script]) => {
|
|
@@ -43,7 +41,9 @@ function getDatabase(folder, mappings) {
|
|
|
43
41
|
logger_1.default.warn('Skipping invalid database configuration: ' + name);
|
|
44
42
|
}
|
|
45
43
|
else {
|
|
46
|
-
database.options.customScripts[name] = (0, tools_1.loadFileAndReplaceKeywords)(
|
|
44
|
+
database.options.customScripts[name] = (0, tools_1.loadFileAndReplaceKeywords)(
|
|
45
|
+
//@ts-ignore
|
|
46
|
+
path_1.default.join(folder, script), mappings);
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
}
|
|
@@ -72,12 +72,13 @@ function dump(context) {
|
|
|
72
72
|
databases.forEach((database) => {
|
|
73
73
|
const dbFolder = path_1.default.join(databasesFolder, (0, utils_1.sanitize)(database.name));
|
|
74
74
|
fs_extra_1.default.ensureDirSync(dbFolder);
|
|
75
|
-
const sortCustomScripts = (
|
|
75
|
+
const sortCustomScripts = (name1, name2) => {
|
|
76
76
|
if (name1 === name2)
|
|
77
77
|
return 0;
|
|
78
78
|
return name1 > name2 ? 1 : -1;
|
|
79
79
|
};
|
|
80
80
|
const formatted = Object.assign(Object.assign(Object.assign({}, database), (database.enabled_clients && { enabled_clients: (0, utils_1.mapClientID2NameSorted)(database.enabled_clients, context.assets.clientsOrig) })), { options: Object.assign(Object.assign({}, database.options), (database.options.customScripts && {
|
|
81
|
+
//@ts-ignore
|
|
81
82
|
customScripts: Object.entries(database.options.customScripts).sort(sortCustomScripts).reduce((scripts, [name, script]) => {
|
|
82
83
|
// Dump custom script to file
|
|
83
84
|
const scriptName = (0, utils_1.sanitize)(`${name}.js`);
|
|
@@ -93,7 +94,8 @@ function dump(context) {
|
|
|
93
94
|
});
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
+
const databasesHandler = {
|
|
97
98
|
parse,
|
|
98
|
-
dump
|
|
99
|
+
dump,
|
|
99
100
|
};
|
|
101
|
+
exports.default = databasesHandler;
|
|
@@ -32,16 +32,17 @@ function parse(context) {
|
|
|
32
32
|
if (ext === '.html')
|
|
33
33
|
sorted[name].html = file;
|
|
34
34
|
});
|
|
35
|
-
const emailTemplates =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
const emailTemplates = Object.values(sorted).flatMap(({ meta, html }) => {
|
|
36
|
+
if (!meta) {
|
|
37
|
+
logger_1.default.warn(`Skipping email template file ${html} as missing the corresponding '.json' file`);
|
|
38
|
+
return [];
|
|
39
39
|
}
|
|
40
|
-
else if (!
|
|
41
|
-
logger_1.default.warn(`Skipping email template file ${
|
|
40
|
+
else if (!html) {
|
|
41
|
+
logger_1.default.warn(`Skipping email template file ${meta} as missing corresponding '.html' file`);
|
|
42
|
+
return [];
|
|
42
43
|
}
|
|
43
44
|
else {
|
|
44
|
-
|
|
45
|
+
return Object.assign(Object.assign({}, (0, utils_1.loadJSON)(meta, context.mappings)), { body: (0, tools_1.loadFileAndReplaceKeywords)(html, context.mappings) });
|
|
45
46
|
}
|
|
46
47
|
});
|
|
47
48
|
return {
|
|
@@ -67,7 +68,8 @@ function dump(context) {
|
|
|
67
68
|
});
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
|
-
|
|
71
|
+
const emailTemplatesHandler = {
|
|
71
72
|
parse,
|
|
72
|
-
dump
|
|
73
|
+
dump,
|
|
73
74
|
};
|
|
75
|
+
exports.default = emailTemplatesHandler;
|
|
@@ -39,7 +39,8 @@ function dump(context) {
|
|
|
39
39
|
(0, utils_1.dumpJSON)(file, guardianPhoneFactorMessageTypes);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
const guardianFactorMessageTypesHandler = {
|
|
43
43
|
parse,
|
|
44
|
-
dump
|
|
44
|
+
dump,
|
|
45
45
|
};
|
|
46
|
+
exports.default = guardianFactorMessageTypesHandler;
|
|
@@ -39,7 +39,8 @@ function dump(context) {
|
|
|
39
39
|
(0, utils_1.dumpJSON)(file, guardianPhoneFactorSelectedProvider);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
const guardianFactorSelectedProviderHandler = {
|
|
43
43
|
parse,
|
|
44
|
-
dump
|
|
44
|
+
dump,
|
|
45
45
|
};
|
|
46
|
+
exports.default = guardianFactorSelectedProviderHandler;
|
|
@@ -27,6 +27,7 @@ const actions_1 = __importDefault(require("./actions"));
|
|
|
27
27
|
const organizations_1 = __importDefault(require("./organizations"));
|
|
28
28
|
const triggers_1 = __importDefault(require("./triggers"));
|
|
29
29
|
const attackProtection_1 = __importDefault(require("./attackProtection"));
|
|
30
|
+
const branding_1 = __importDefault(require("./branding"));
|
|
30
31
|
exports.default = {
|
|
31
32
|
rules: rules_1.default,
|
|
32
33
|
rulesConfigs: rulesConfigs_1.default,
|
|
@@ -51,5 +52,6 @@ exports.default = {
|
|
|
51
52
|
actions: actions_1.default,
|
|
52
53
|
organizations: organizations_1.default,
|
|
53
54
|
triggers: triggers_1.default,
|
|
54
|
-
attackProtection: attackProtection_1.default
|
|
55
|
+
attackProtection: attackProtection_1.default,
|
|
56
|
+
branding: branding_1.default
|
|
55
57
|
};
|
|
@@ -19,12 +19,11 @@ function parse(context) {
|
|
|
19
19
|
if (!(0, utils_1.existsMustBeDir)(baseFolder))
|
|
20
20
|
return {}; // Skip
|
|
21
21
|
const migrationsFile = path_1.default.join(baseFolder, 'migrations.json');
|
|
22
|
-
if ((0, utils_1.isFile)(migrationsFile))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
return {};
|
|
22
|
+
if (!(0, utils_1.isFile)(migrationsFile))
|
|
23
|
+
return {};
|
|
24
|
+
/* eslint-disable camelcase */
|
|
25
|
+
const migrations = (0, utils_1.loadJSON)(migrationsFile, context.mappings);
|
|
26
|
+
return { migrations };
|
|
28
27
|
}
|
|
29
28
|
function dump(context) {
|
|
30
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -35,7 +34,8 @@ function dump(context) {
|
|
|
35
34
|
(0, utils_1.dumpJSON)(migrationsFile, migrations);
|
|
36
35
|
});
|
|
37
36
|
}
|
|
38
|
-
|
|
37
|
+
const migrationsHandler = {
|
|
39
38
|
parse,
|
|
40
|
-
dump
|
|
39
|
+
dump,
|
|
41
40
|
};
|
|
41
|
+
exports.default = migrationsHandler;
|