auth0-deploy-cli 7.5.2 → 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.
Files changed (68) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/args.js +0 -2
  3. package/lib/commands/import.js +1 -0
  4. package/lib/context/directory/handlers/actions.js +3 -2
  5. package/lib/context/directory/handlers/attackProtection.js +3 -2
  6. package/lib/context/directory/handlers/branding.js +59 -0
  7. package/lib/context/directory/handlers/clientGrants.js +3 -2
  8. package/lib/context/directory/handlers/clients.js +3 -2
  9. package/lib/context/directory/handlers/connections.js +3 -2
  10. package/lib/context/directory/handlers/databases.js +18 -16
  11. package/lib/context/directory/handlers/emailProvider.js +3 -2
  12. package/lib/context/directory/handlers/emailTemplates.js +11 -9
  13. package/lib/context/directory/handlers/guardianFactorProviders.js +3 -2
  14. package/lib/context/directory/handlers/guardianFactorTemplates.js +3 -2
  15. package/lib/context/directory/handlers/guardianFactors.js +3 -2
  16. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +3 -2
  17. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +3 -2
  18. package/lib/context/directory/handlers/guardianPolicies.js +3 -2
  19. package/lib/context/directory/handlers/hooks.js +3 -2
  20. package/lib/context/directory/handlers/index.js +3 -1
  21. package/lib/context/directory/handlers/migrations.js +8 -8
  22. package/lib/context/directory/handlers/organizations.js +3 -2
  23. package/lib/context/directory/handlers/pages.js +18 -18
  24. package/lib/context/directory/handlers/resourceServers.js +3 -2
  25. package/lib/context/directory/handlers/roles.js +3 -2
  26. package/lib/context/directory/handlers/rules.js +3 -2
  27. package/lib/context/directory/handlers/rulesConfigs.js +4 -3
  28. package/lib/context/directory/handlers/tenant.js +5 -3
  29. package/lib/context/directory/handlers/triggers.js +3 -2
  30. package/lib/context/directory/index.js +2 -4
  31. package/lib/context/yaml/handlers/actions.js +4 -3
  32. package/lib/context/yaml/handlers/attackProtection.js +5 -11
  33. package/lib/context/yaml/handlers/branding.js +65 -0
  34. package/lib/context/yaml/handlers/clientGrants.js +3 -2
  35. package/lib/context/yaml/handlers/clients.js +3 -2
  36. package/lib/context/yaml/handlers/connections.js +3 -2
  37. package/lib/context/yaml/handlers/databases.js +3 -2
  38. package/lib/context/yaml/handlers/emailProvider.js +3 -2
  39. package/lib/context/yaml/handlers/emailTemplates.js +3 -2
  40. package/lib/context/yaml/handlers/guardianFactorProviders.js +5 -12
  41. package/lib/context/yaml/handlers/guardianFactorTemplates.js +5 -12
  42. package/lib/context/yaml/handlers/guardianFactors.js +5 -12
  43. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +5 -12
  44. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +5 -12
  45. package/lib/context/yaml/handlers/guardianPolicies.js +5 -12
  46. package/lib/context/yaml/handlers/hooks.js +3 -2
  47. package/lib/context/yaml/handlers/index.js +3 -1
  48. package/lib/context/yaml/handlers/migrations.js +3 -2
  49. package/lib/context/yaml/handlers/organizations.js +3 -2
  50. package/lib/context/yaml/handlers/pages.js +3 -2
  51. package/lib/context/yaml/handlers/resourceServers.js +3 -2
  52. package/lib/context/yaml/handlers/roles.js +3 -2
  53. package/lib/context/yaml/handlers/rules.js +3 -2
  54. package/lib/context/yaml/handlers/rulesConfigs.js +4 -3
  55. package/lib/context/yaml/handlers/tenant.js +3 -2
  56. package/lib/context/yaml/handlers/triggers.js +3 -2
  57. package/lib/context/yaml/index.js +2 -1
  58. package/lib/tools/auth0/handlers/branding.js +67 -13
  59. package/lib/tools/auth0/handlers/default.js +7 -1
  60. package/lib/tools/auth0/handlers/organizations.js +7 -2
  61. package/lib/tools/auth0/handlers/resourceServers.js +7 -2
  62. package/lib/tools/auth0/handlers/roles.js +7 -2
  63. package/lib/tools/auth0/handlers/rules.js +7 -1
  64. package/lib/tools/calculateChanges.js +144 -0
  65. package/lib/tools/constants.js +7 -0
  66. package/lib/tools/utils.js +1 -142
  67. package/package.json +2 -2
  68. package/tsconfig.json +1 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ 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
+
10
17
  ## [7.5.2] - 2022-03-15
11
18
  ### Fixed
12
19
  - Resetting this version to be latest on NPM
@@ -456,8 +463,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
456
463
  [#430]: https://github.com/auth0/auth0-deploy-cli/issues/430
457
464
  [#432]: https://github.com/auth0/auth0-deploy-cli/issues/432
458
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
459
468
 
460
- [Unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v7.5.2...HEAD
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
461
471
  [7.5.2]: https://github.com/auth0/auth0-deploy-cli/compare/v7.5.1...v7.5.2
462
472
  [7.5.1]: https://github.com/auth0/auth0-deploy-cli/compare/v7.5.0...v7.5.1
463
473
  [7.5.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.4.0...v7.5.0
package/lib/args.js CHANGED
@@ -33,7 +33,6 @@ function getParams() {
33
33
  type: 'string'
34
34
  },
35
35
  env: {
36
- alias: 'e',
37
36
  describe: 'Override the mappings in config with environment variables.',
38
37
  boolean: true,
39
38
  default: true
@@ -69,7 +68,6 @@ function getParams() {
69
68
  type: 'string'
70
69
  },
71
70
  env: {
72
- alias: 'e',
73
71
  describe: 'Override the mappings in config with environment variables.',
74
72
  boolean: true,
75
73
  default: false
@@ -40,6 +40,7 @@ function importCMD(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
  });
@@ -83,7 +83,8 @@ function dump(context) {
83
83
  });
84
84
  });
85
85
  }
86
- exports.default = {
86
+ const actionsHandler = {
87
87
  parse,
88
- dump
88
+ dump,
89
89
  };
90
+ exports.default = actionsHandler;
@@ -53,7 +53,8 @@ function dump(context) {
53
53
  (0, utils_1.dumpJSON)(files.suspiciousIpThrottling, attackProtection.suspiciousIpThrottling);
54
54
  });
55
55
  }
56
- exports.default = {
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
+ };
@@ -44,7 +44,8 @@ function dump(context) {
44
44
  });
45
45
  });
46
46
  }
47
- exports.default = {
47
+ const clientGrantsHandler = {
48
48
  parse,
49
- dump
49
+ dump,
50
50
  };
51
+ exports.default = clientGrantsHandler;
@@ -59,7 +59,8 @@ function dump(context) {
59
59
  });
60
60
  });
61
61
  }
62
- exports.default = {
62
+ const clientsHandler = {
63
63
  parse,
64
- dump
64
+ dump,
65
65
  };
66
+ exports.default = clientsHandler;
@@ -64,7 +64,8 @@ function dump(context) {
64
64
  });
65
65
  });
66
66
  }
67
- exports.default = {
67
+ const connectionsHandler = {
68
68
  parse,
69
- dump
69
+ dump,
70
70
  };
71
+ exports.default = connectionsHandler;
@@ -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
- let metaData = {};
23
- // First load database.json
24
- try {
25
- metaData = (0, utils_1.loadJSON)(metaFile, mappings);
26
- }
27
- catch (err) {
28
- logger_1.default.warn(`Skipping database folder ${folder} as cannot find or read ${metaFile}`);
29
- return {};
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)(path_1.default.join(folder, script), mappings);
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 = ([name1], [name2]) => {
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
- exports.default = {
97
+ const databasesHandler = {
97
98
  parse,
98
- dump
99
+ dump,
99
100
  };
101
+ exports.default = databasesHandler;
@@ -45,7 +45,8 @@ function dump(context) {
45
45
  (0, utils_1.dumpJSON)(emailProviderFile, emailProvider);
46
46
  });
47
47
  }
48
- exports.default = {
48
+ const emailProviderHandler = {
49
49
  parse,
50
- dump
50
+ dump,
51
51
  };
52
+ exports.default = emailProviderHandler;
@@ -32,16 +32,17 @@ function parse(context) {
32
32
  if (ext === '.html')
33
33
  sorted[name].html = file;
34
34
  });
35
- const emailTemplates = [];
36
- Object.values(sorted).forEach((data) => {
37
- if (!data.meta) {
38
- logger_1.default.warn(`Skipping email template file ${data.html} as missing the corresponding '.json' file`);
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 (!data.html) {
41
- logger_1.default.warn(`Skipping email template file ${data.meta} as missing corresponding '.html' 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
- emailTemplates.push(Object.assign(Object.assign({}, (0, utils_1.loadJSON)(data.meta, context.mappings)), { body: (0, tools_1.loadFileAndReplaceKeywords)(data.html, context.mappings) }));
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
- exports.default = {
71
+ const emailTemplatesHandler = {
71
72
  parse,
72
- dump
73
+ dump,
73
74
  };
75
+ exports.default = emailTemplatesHandler;
@@ -40,7 +40,8 @@ function dump(context) {
40
40
  });
41
41
  });
42
42
  }
43
- exports.default = {
43
+ const guardianFactorProvidersHandler = {
44
44
  parse,
45
- dump
45
+ dump,
46
46
  };
47
+ exports.default = guardianFactorProvidersHandler;
@@ -40,7 +40,8 @@ function dump(context) {
40
40
  });
41
41
  });
42
42
  }
43
- exports.default = {
43
+ const guardianFactorTemplatesHandler = {
44
44
  parse,
45
- dump
45
+ dump,
46
46
  };
47
+ exports.default = guardianFactorTemplatesHandler;
@@ -40,7 +40,8 @@ function dump(context) {
40
40
  });
41
41
  });
42
42
  }
43
- exports.default = {
43
+ const guardianFactorsHandler = {
44
44
  parse,
45
- dump
45
+ dump,
46
46
  };
47
+ exports.default = guardianFactorsHandler;
@@ -39,7 +39,8 @@ function dump(context) {
39
39
  (0, utils_1.dumpJSON)(file, guardianPhoneFactorMessageTypes);
40
40
  });
41
41
  }
42
- exports.default = {
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
- exports.default = {
42
+ const guardianFactorSelectedProviderHandler = {
43
43
  parse,
44
- dump
44
+ dump,
45
45
  };
46
+ exports.default = guardianFactorSelectedProviderHandler;
@@ -39,7 +39,8 @@ function dump(context) {
39
39
  (0, utils_1.dumpJSON)(file, guardianPolicies);
40
40
  });
41
41
  }
42
- exports.default = {
42
+ const guardianPoliciesHandler = {
43
43
  parse,
44
- dump
44
+ dump,
45
45
  };
46
+ exports.default = guardianPoliciesHandler;
@@ -56,7 +56,8 @@ function dump(context) {
56
56
  });
57
57
  });
58
58
  }
59
- exports.default = {
59
+ const hooksHandler = {
60
60
  parse,
61
- dump
61
+ dump,
62
62
  };
63
+ exports.default = hooksHandler;
@@ -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
- /* eslint-disable camelcase */
24
- const migrations = (0, utils_1.loadJSON)(migrationsFile, context.mappings);
25
- return { migrations };
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
- exports.default = {
37
+ const migrationsHandler = {
39
38
  parse,
40
- dump
39
+ dump,
41
40
  };
41
+ exports.default = migrationsHandler;
@@ -54,7 +54,8 @@ function dump(context) {
54
54
  });
55
55
  });
56
56
  }
57
- exports.default = {
57
+ const organizationsHandler = {
58
58
  parse,
59
- dump
59
+ dump,
60
60
  };
61
+ exports.default = organizationsHandler;
@@ -22,27 +22,26 @@ function parse(context) {
22
22
  if (!(0, utils_1.existsMustBeDir)(pagesFolder))
23
23
  return { pages: undefined }; // Skip
24
24
  const files = (0, utils_1.getFiles)(pagesFolder, ['.json', '.html']);
25
- const sorted = {};
26
- files.forEach((file) => {
25
+ const sorted = files.reduce((acc, file) => {
27
26
  const { ext, name } = path_1.default.parse(file);
28
- if (!sorted[name])
29
- sorted[name] = {};
27
+ if (!acc[name])
28
+ acc[name] = {};
30
29
  if (ext === '.json')
31
- sorted[name].meta = file;
30
+ acc[name].meta = file;
32
31
  if (ext === '.html')
33
- sorted[name].html = file;
34
- });
35
- const pages = [];
36
- Object.values(sorted).forEach((data) => {
37
- if (!data.meta) {
38
- logger_1.default.warn(`Skipping pages file ${data.html} as missing the corresponding '.json' file`);
39
- }
40
- else if (!data.html) {
41
- logger_1.default.warn(`Skipping pages file ${data.meta} as missing corresponding '.html' file`);
32
+ acc[name].html = file;
33
+ return acc;
34
+ }, {});
35
+ const pages = Object.values(sorted).flatMap(({ meta, html }) => {
36
+ if (!meta) {
37
+ logger_1.default.warn(`Skipping pages file ${html} as missing the corresponding '.json' file`);
38
+ return [];
42
39
  }
43
- else {
44
- pages.push(Object.assign(Object.assign({}, (0, utils_1.loadJSON)(data.meta, context.mappings)), { html: (0, tools_1.loadFileAndReplaceKeywords)(data.html, context.mappings) }));
40
+ if (!html) {
41
+ logger_1.default.warn(`Skipping pages file ${meta} as missing corresponding '.html' file`);
42
+ return [];
45
43
  }
44
+ return Object.assign(Object.assign({}, (0, utils_1.loadJSON)(meta, context.mappings)), { html: (0, tools_1.loadFileAndReplaceKeywords)(html, context.mappings) });
46
45
  });
47
46
  return {
48
47
  pages
@@ -71,7 +70,8 @@ function dump(context) {
71
70
  });
72
71
  });
73
72
  }
74
- exports.default = {
73
+ const pagesHandler = {
75
74
  parse,
76
- dump
75
+ dump,
77
76
  };
77
+ exports.default = pagesHandler;
@@ -40,7 +40,8 @@ function dump(context) {
40
40
  });
41
41
  });
42
42
  }
43
- exports.default = {
43
+ const resourceServersHandler = {
44
44
  parse,
45
- dump
45
+ dump,
46
46
  };
47
+ exports.default = resourceServersHandler;
@@ -49,7 +49,8 @@ function dump(context) {
49
49
  });
50
50
  });
51
51
  }
52
- exports.default = {
52
+ const rolesHandler = {
53
53
  parse,
54
- dump
54
+ dump,
55
55
  };
56
+ exports.default = rolesHandler;
@@ -53,7 +53,8 @@ function dump(context) {
53
53
  });
54
54
  });
55
55
  }
56
- exports.default = {
56
+ const rulesHandler = {
57
57
  parse,
58
- dump
58
+ dump,
59
59
  };
60
+ exports.default = rulesHandler;
@@ -29,10 +29,11 @@ function parse(context) {
29
29
  function dump() {
30
30
  return __awaiter(this, void 0, void 0, function* () {
31
31
  // do not export rulesConfigs as its values cannot be extracted
32
- return null;
32
+ return;
33
33
  });
34
34
  }
35
- exports.default = {
35
+ const rulesConfigsHandler = {
36
36
  parse,
37
- dump
37
+ dump,
38
38
  };
39
+ exports.default = rulesConfigsHandler;
@@ -35,7 +35,7 @@ function parse(context) {
35
35
  const _a = (0, utils_1.loadJSON)(tenantFile, context.mappings), { session_lifetime, idle_session_lifetime } = _a, tenant = __rest(_a, ["session_lifetime", "idle_session_lifetime"]);
36
36
  (0, utils_1.clearTenantFlags)(tenant);
37
37
  return {
38
- tenant: Object.assign(tenant, session_lifetime && (0, utils_1.hoursAsInteger)('session_lifetime', session_lifetime), idle_session_lifetime && (0, utils_1.hoursAsInteger)('idle_session_lifetime', idle_session_lifetime))
38
+ tenant: Object.assign(Object.assign({}, tenant), { session_lifetime_in_minutes: (0, utils_1.hoursAsInteger)('session_lifetime', session_lifetime)['session_lifetime_in_minutes'], idle_session_lifetime_in_minutes: (0, utils_1.hoursAsInteger)('idle_session_lifetime', idle_session_lifetime)['idle_session_lifetime_in_minutes'] })
39
39
  };
40
40
  /* eslint-enable camelcase */
41
41
  }
@@ -49,9 +49,11 @@ function dump(context) {
49
49
  (0, utils_1.clearTenantFlags)(tenant);
50
50
  const tenantFile = path_1.default.join(context.filePath, 'tenant.json');
51
51
  (0, utils_1.dumpJSON)(tenantFile, tenant);
52
+ return;
52
53
  });
53
54
  }
54
- exports.default = {
55
+ const tenantHandler = {
55
56
  parse,
56
- dump
57
+ dump,
57
58
  };
59
+ exports.default = tenantHandler;
@@ -38,7 +38,8 @@ function dump(context) {
38
38
  fs_extra_1.default.writeFileSync(triggerFile, JSON.stringify(triggers, null, 2));
39
39
  });
40
40
  }
41
- exports.default = {
41
+ const triggersHandler = {
42
42
  parse,
43
- dump
43
+ dump,
44
44
  };
45
+ exports.default = triggersHandler;
@@ -96,6 +96,7 @@ class default_1 {
96
96
  this.assets = (0, readonly_1.default)(this.assets, this.config);
97
97
  // Copy clients to be used by handlers which require converting client_id to the name
98
98
  // Must copy as the client_id will be stripped if AUTH0_EXPORT_IDENTIFIERS is false
99
+ //@ts-ignore because assets haven't been typed yet TODO: type assets
99
100
  this.assets.clientsOrig = [...this.assets.clients];
100
101
  // Optionally Strip identifiers
101
102
  if (!this.config.AUTH0_EXPORT_IDENTIFIERS) {
@@ -103,10 +104,7 @@ class default_1 {
103
104
  }
104
105
  yield Promise.all(Object.entries(handlers_1.default).map(([name, handler]) => __awaiter(this, void 0, void 0, function* () {
105
106
  try {
106
- const data = yield handler.dump(this);
107
- if (data) {
108
- logger_1.default.info(`Exporting ${name}`);
109
- }
107
+ yield handler.dump(this);
110
108
  }
111
109
  catch (err) {
112
110
  logger_1.default.debug(err.stack);
@@ -58,9 +58,9 @@ function mapActionCode(basePath, action) {
58
58
  function dump(context) {
59
59
  return __awaiter(this, void 0, void 0, function* () {
60
60
  const { actions } = context.assets;
61
- // Nothing to do
61
+ //@ts-ignore but need to investigate why returning void here when other handlers do not
62
62
  if (!actions)
63
- return;
63
+ return; // Nothing to do
64
64
  return {
65
65
  actions: actions.map((action) => ({
66
66
  name: action.name,
@@ -75,7 +75,8 @@ function dump(context) {
75
75
  };
76
76
  });
77
77
  }
78
- exports.default = {
78
+ const ActionsHandler = {
79
79
  parse,
80
80
  dump
81
81
  };
82
+ exports.default = ActionsHandler;
@@ -9,21 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- function parse(context) {
12
+ function parseAndDump(context) {
13
13
  return __awaiter(this, void 0, void 0, function* () {
14
14
  return {
15
15
  attackProtection: context.assets.attackProtection || {}
16
16
  };
17
17
  });
18
18
  }
19
- function dump(context) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- return {
22
- attackProtection: context.assets.attackProtection || {}
23
- };
24
- });
25
- }
26
- exports.default = {
27
- parse,
28
- dump
19
+ const attackProtectionHandler = {
20
+ parse: parseAndDump,
21
+ dump: parseAndDump,
29
22
  };
23
+ exports.default = attackProtectionHandler;