auth0-deploy-cli 7.5.1 → 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.
Files changed (115) hide show
  1. package/.eslintrc +7 -41
  2. package/.husky/pre-commit +4 -0
  3. package/.husky/pre-push +3 -1
  4. package/.prettierignore +10 -0
  5. package/.prettierrc.json +4 -0
  6. package/CHANGELOG.md +209 -7
  7. package/CONTRIBUTING.md +2 -2
  8. package/README.md +3 -0
  9. package/lib/args.js +16 -17
  10. package/lib/commands/export.js +3 -3
  11. package/lib/commands/import.js +7 -6
  12. package/lib/commands/index.js +1 -1
  13. package/lib/configFactory.js +5 -1
  14. package/lib/context/defaults.js +4 -3
  15. package/lib/context/directory/handlers/actions.js +6 -5
  16. package/lib/context/directory/handlers/attackProtection.js +7 -6
  17. package/lib/context/directory/handlers/branding.js +60 -0
  18. package/lib/context/directory/handlers/clientGrants.js +6 -4
  19. package/lib/context/directory/handlers/clients.js +4 -3
  20. package/lib/context/directory/handlers/connections.js +7 -4
  21. package/lib/context/directory/handlers/databases.js +30 -22
  22. package/lib/context/directory/handlers/emailProvider.js +6 -4
  23. package/lib/context/directory/handlers/emailTemplates.js +13 -11
  24. package/lib/context/directory/handlers/guardianFactorProviders.js +6 -4
  25. package/lib/context/directory/handlers/guardianFactorTemplates.js +6 -4
  26. package/lib/context/directory/handlers/guardianFactors.js +6 -4
  27. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +4 -3
  28. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +4 -3
  29. package/lib/context/directory/handlers/guardianPolicies.js +4 -3
  30. package/lib/context/directory/handlers/hooks.js +5 -4
  31. package/lib/context/directory/handlers/index.js +5 -2
  32. package/lib/context/directory/handlers/migrations.js +8 -8
  33. package/lib/context/directory/handlers/organizations.js +4 -3
  34. package/lib/context/directory/handlers/pages.js +20 -20
  35. package/lib/context/directory/handlers/resourceServers.js +6 -4
  36. package/lib/context/directory/handlers/roles.js +4 -3
  37. package/lib/context/directory/handlers/rules.js +5 -4
  38. package/lib/context/directory/handlers/rulesConfigs.js +7 -5
  39. package/lib/context/directory/handlers/tenant.js +7 -4
  40. package/lib/context/directory/handlers/triggers.js +3 -2
  41. package/lib/context/directory/index.js +23 -22
  42. package/lib/context/index.js +66 -62
  43. package/lib/context/yaml/handlers/actions.js +12 -8
  44. package/lib/context/yaml/handlers/attackProtection.js +6 -12
  45. package/lib/context/yaml/handlers/branding.js +66 -0
  46. package/lib/context/yaml/handlers/clientGrants.js +5 -4
  47. package/lib/context/yaml/handlers/clients.js +9 -6
  48. package/lib/context/yaml/handlers/connections.js +10 -7
  49. package/lib/context/yaml/handlers/databases.js +15 -10
  50. package/lib/context/yaml/handlers/emailProvider.js +7 -5
  51. package/lib/context/yaml/handlers/emailTemplates.js +6 -5
  52. package/lib/context/yaml/handlers/guardianFactorProviders.js +6 -13
  53. package/lib/context/yaml/handlers/guardianFactorTemplates.js +6 -13
  54. package/lib/context/yaml/handlers/guardianFactors.js +6 -13
  55. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +6 -13
  56. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +6 -13
  57. package/lib/context/yaml/handlers/guardianPolicies.js +6 -13
  58. package/lib/context/yaml/handlers/hooks.js +7 -5
  59. package/lib/context/yaml/handlers/index.js +5 -2
  60. package/lib/context/yaml/handlers/migrations.js +3 -2
  61. package/lib/context/yaml/handlers/organizations.js +6 -5
  62. package/lib/context/yaml/handlers/pages.js +6 -5
  63. package/lib/context/yaml/handlers/resourceServers.js +5 -4
  64. package/lib/context/yaml/handlers/roles.js +6 -5
  65. package/lib/context/yaml/handlers/rules.js +6 -5
  66. package/lib/context/yaml/handlers/rulesConfigs.js +6 -5
  67. package/lib/context/yaml/handlers/tenant.js +7 -5
  68. package/lib/context/yaml/handlers/triggers.js +5 -4
  69. package/lib/context/yaml/index.js +33 -24
  70. package/lib/index.js +20 -15
  71. package/lib/logger.js +4 -3
  72. package/lib/readonly.js +11 -16
  73. package/lib/sessionDurationsToMinutes.js +15 -0
  74. package/lib/tools/auth0/client.js +6 -6
  75. package/lib/tools/auth0/handlers/actions.js +21 -23
  76. package/lib/tools/auth0/handlers/attackProtection.js +14 -17
  77. package/lib/tools/auth0/handlers/branding.js +71 -13
  78. package/lib/tools/auth0/handlers/clientGrants.js +17 -10
  79. package/lib/tools/auth0/handlers/clients.js +15 -8
  80. package/lib/tools/auth0/handlers/connections.js +30 -10
  81. package/lib/tools/auth0/handlers/databases.js +24 -12
  82. package/lib/tools/auth0/handlers/default.js +47 -29
  83. package/lib/tools/auth0/handlers/emailTemplates.js +8 -10
  84. package/lib/tools/auth0/handlers/guardianFactorProviders.js +3 -3
  85. package/lib/tools/auth0/handlers/guardianFactorTemplates.js +3 -3
  86. package/lib/tools/auth0/handlers/guardianFactors.js +3 -3
  87. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +11 -10
  88. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +10 -9
  89. package/lib/tools/auth0/handlers/guardianPolicies.js +5 -4
  90. package/lib/tools/auth0/handlers/hooks.js +34 -21
  91. package/lib/tools/auth0/handlers/index.js +31 -27
  92. package/lib/tools/auth0/handlers/migrations.js +2 -1
  93. package/lib/tools/auth0/handlers/organizations.js +67 -32
  94. package/lib/tools/auth0/handlers/pages.js +20 -14
  95. package/lib/tools/auth0/handlers/prompts.js +1 -0
  96. package/lib/tools/auth0/handlers/resourceServers.js +28 -15
  97. package/lib/tools/auth0/handlers/roles.js +61 -32
  98. package/lib/tools/auth0/handlers/rules.js +55 -32
  99. package/lib/tools/auth0/handlers/rulesConfigs.js +12 -6
  100. package/lib/tools/auth0/handlers/tenant.js +8 -4
  101. package/lib/tools/auth0/handlers/triggers.js +11 -12
  102. package/lib/tools/auth0/index.js +15 -31
  103. package/lib/tools/auth0/schema.js +7 -27
  104. package/lib/tools/calculateChanges.js +149 -0
  105. package/lib/tools/constants.js +162 -154
  106. package/lib/tools/deploy.js +1 -1
  107. package/lib/tools/index.js +1 -1
  108. package/lib/tools/logger.js +14 -8
  109. package/lib/tools/utils.js +3 -144
  110. package/lib/tools/{ValidationError.js → validationError.js} +3 -1
  111. package/lib/types.js +2 -0
  112. package/lib/utils.js +12 -22
  113. package/package.json +9 -2
  114. package/tsconfig.json +2 -3
  115. package/typescript-migration-progress.sh +1 -1
@@ -20,18 +20,20 @@ const utils_1 = require("../../../utils");
20
20
  const logger_1 = __importDefault(require("../../../logger"));
21
21
  function parseCode(context, code) {
22
22
  if (code) {
23
+ //@ts-ignore TODO: understand why two arguments are passed when context.loadFile only accepts one
23
24
  return context.loadFile(code, tools_1.constants.ACTIONS_DIRECTORY);
24
25
  }
25
26
  }
26
27
  function parse(context) {
27
28
  return __awaiter(this, void 0, void 0, function* () {
28
29
  // Load the script file for each action
30
+ //@ts-ignore TODO: understand if empty array is intentionally being returned
29
31
  if (!context.assets.actions)
30
32
  return [];
31
33
  const actions = {
32
34
  actions: [
33
- ...context.assets.actions.map((action) => (Object.assign(Object.assign({}, action), { code: parseCode(context, action.code) })))
34
- ]
35
+ ...context.assets.actions.map((action) => (Object.assign(Object.assign({}, action), { code: parseCode(context, action.code) }))),
36
+ ],
35
37
  };
36
38
  return actions;
37
39
  });
@@ -58,24 +60,26 @@ function mapActionCode(basePath, action) {
58
60
  function dump(context) {
59
61
  return __awaiter(this, void 0, void 0, function* () {
60
62
  const { actions } = context.assets;
61
- // Nothing to do
63
+ //@ts-ignore TODO: need to investigate why returning void here when other handlers do not
62
64
  if (!actions)
63
- return;
65
+ return; // Nothing to do
64
66
  return {
65
67
  actions: actions.map((action) => ({
66
68
  name: action.name,
67
69
  deployed: action.deployed || action.all_changes_deployed,
70
+ //@ts-ignore because Action resource needs to be typed more accurately
68
71
  code: mapActionCode(context.basePath, action),
69
72
  runtime: action.runtime,
70
73
  dependencies: action.dependencies || [],
71
74
  status: action.status,
72
75
  secrets: mapSecrets(action.secrets),
73
- supported_triggers: action.supported_triggers
74
- }))
76
+ supported_triggers: action.supported_triggers,
77
+ })),
75
78
  };
76
79
  });
77
80
  }
78
- exports.default = {
81
+ const ActionsHandler = {
79
82
  parse,
80
- dump
83
+ dump,
81
84
  };
85
+ 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
- attackProtection: context.assets.attackProtection || {}
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;
@@ -0,0 +1,66 @@
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
+ function parse(context) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ // Load the HTML file for each page
21
+ const { branding } = context.assets;
22
+ if (!branding || !branding.templates)
23
+ return { branding };
24
+ const templates = branding.templates.map((templateDefinition) => {
25
+ const markupFile = path_1.default.join(templateDefinition.body);
26
+ return {
27
+ template: templateDefinition.template,
28
+ body: (0, tools_1.loadFileAndReplaceKeywords)(markupFile, context.mappings),
29
+ };
30
+ });
31
+ return {
32
+ branding: Object.assign(Object.assign({}, branding), { templates }),
33
+ };
34
+ });
35
+ }
36
+ function dump(context) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ const { branding } = context.assets || { branding: undefined };
39
+ branding.templates = branding.templates || [];
40
+ // create templates folder
41
+ if (branding.templates.length) {
42
+ const brandingTemplatesFolder = path_1.default.join(context.basePath, tools_1.constants.BRANDING_TEMPLATES_YAML_DIRECTORY);
43
+ fs_extra_1.default.ensureDirSync(brandingTemplatesFolder);
44
+ branding.templates = branding.templates.map((templateDefinition) => {
45
+ const file = `${templateDefinition.template}.html`;
46
+ const templateMarkupFile = path_1.default.join(brandingTemplatesFolder, file);
47
+ const markup = templateDefinition.body;
48
+ try {
49
+ fs_extra_1.default.writeFileSync(templateMarkupFile, markup);
50
+ }
51
+ catch (e) {
52
+ throw new Error(`Error writing template file: ${templateDefinition.template}, because: ${e.message}`);
53
+ }
54
+ // save the location as relative file.
55
+ templateDefinition.body = `.${path_1.default.sep}${path_1.default.join(tools_1.constants.BRANDING_TEMPLATES_YAML_DIRECTORY, file)}`;
56
+ return templateDefinition;
57
+ });
58
+ }
59
+ return { branding };
60
+ });
61
+ }
62
+ const brandingHandler = {
63
+ parse,
64
+ dump,
65
+ };
66
+ exports.default = brandingHandler;
@@ -14,7 +14,7 @@ function parse(context) {
14
14
  return __awaiter(this, void 0, void 0, function* () {
15
15
  // nothing to do, set default empty
16
16
  return {
17
- clientGrants: context.assets.clientGrants
17
+ clientGrants: context.assets.clientGrants,
18
18
  };
19
19
  });
20
20
  }
@@ -30,11 +30,12 @@ function dump(context) {
30
30
  const dumpGrant = Object.assign({}, grant);
31
31
  dumpGrant.client_id = (0, utils_1.convertClientIdToName)(dumpGrant.client_id, context.assets.clients);
32
32
  return dumpGrant;
33
- })
33
+ }),
34
34
  };
35
35
  });
36
36
  }
37
- exports.default = {
37
+ const clientGrantsHandler = {
38
38
  parse,
39
- dump
39
+ dump,
40
40
  };
41
+ exports.default = clientGrantsHandler;
@@ -35,8 +35,8 @@ function parse(context) {
35
35
  }
36
36
  }
37
37
  return client;
38
- })
39
- ]
38
+ }),
39
+ ],
40
40
  };
41
41
  });
42
42
  }
@@ -45,7 +45,8 @@ function dump(context) {
45
45
  // Save custom_login_page to a separate html file
46
46
  const clientsFolder = path_1.default.join(context.basePath, tools_1.constants.CLIENTS_DIRECTORY);
47
47
  return {
48
- clients: [...context.assets.clients.map((client) => {
48
+ clients: [
49
+ ...context.assets.clients.map((client) => {
49
50
  if (client.custom_login_page) {
50
51
  const clientName = (0, utils_1.sanitize)(client.name);
51
52
  const html = client.custom_login_page;
@@ -56,11 +57,13 @@ function dump(context) {
56
57
  client.custom_login_page = `./${clientName}_custom_login_page.html`;
57
58
  }
58
59
  return (0, utils_1.clearClientArrays)(client);
59
- })]
60
+ }),
61
+ ],
60
62
  };
61
63
  });
62
64
  }
63
- exports.default = {
65
+ const clientsHandler = {
64
66
  parse,
65
- dump
67
+ dump,
66
68
  };
69
+ exports.default = clientsHandler;
@@ -36,15 +36,15 @@ function parse(context) {
36
36
  }
37
37
  }
38
38
  return connection;
39
- })
40
- ]
39
+ }),
40
+ ],
41
41
  };
42
42
  });
43
43
  }
44
44
  const getFormattedOptions = (connection, clients) => {
45
45
  try {
46
46
  return {
47
- options: Object.assign(Object.assign({}, connection.options), { idpinitiated: Object.assign(Object.assign({}, connection.options.idpinitiated), { client_id: (0, utils_1.convertClientIdToName)(connection.options.idpinitiated.client_id, clients) }) })
47
+ options: Object.assign(Object.assign({}, connection.options), { idpinitiated: Object.assign(Object.assign({}, connection.options.idpinitiated), { client_id: (0, utils_1.convertClientIdToName)(connection.options.idpinitiated.client_id, clients) }) }),
48
48
  };
49
49
  }
50
50
  catch (e) {
@@ -60,7 +60,9 @@ function dump(context) {
60
60
  // nothing to do, set default if empty
61
61
  return {
62
62
  connections: connections.map((connection) => {
63
- const dumpedConnection = Object.assign(Object.assign(Object.assign({}, connection), getFormattedOptions(connection, context.assets.clients)), (connection.enabled_clients && { enabled_clients: (0, utils_1.mapClientID2NameSorted)(connection.enabled_clients, context.assets.clients) }));
63
+ const dumpedConnection = Object.assign(Object.assign(Object.assign({}, connection), getFormattedOptions(connection, context.assets.clients)), (connection.enabled_clients && {
64
+ enabled_clients: (0, utils_1.mapClientID2NameSorted)(connection.enabled_clients, context.assets.clients),
65
+ }));
64
66
  if (dumpedConnection.strategy === 'email') {
65
67
  (0, utils_1.ensureProp)(connection, 'options.email.body');
66
68
  const connectionsFolder = path_1.default.join(context.basePath, tools_1.constants.CONNECTIONS_DIRECTORY);
@@ -73,11 +75,12 @@ function dump(context) {
73
75
  dumpedConnection.options.email.body = `./${connectionName}.html`;
74
76
  }
75
77
  return dumpedConnection;
76
- })
78
+ }),
77
79
  };
78
80
  });
79
81
  }
80
- exports.default = {
82
+ const connectionsHandler = {
81
83
  parse,
82
- dump
84
+ dump,
83
85
  };
86
+ exports.default = connectionsHandler;
@@ -24,9 +24,9 @@ function parse(context) {
24
24
  return {
25
25
  databases: [
26
26
  ...context.assets.databases.map((database) => (Object.assign(Object.assign({}, database), { options: Object.assign(Object.assign({}, database.options), (database.options.customScripts && {
27
- customScripts: Object.entries(database.options.customScripts).reduce((scripts, [name, script]) => (Object.assign(Object.assign({}, scripts), { [name]: context.loadFile(script) })), {})
28
- })) })))
29
- ]
27
+ customScripts: Object.entries(database.options.customScripts).reduce((scripts, [name, script]) => (Object.assign(Object.assign({}, scripts), { [name]: context.loadFile(script) })), {}),
28
+ })) }))),
29
+ ],
30
30
  };
31
31
  });
32
32
  }
@@ -43,8 +43,12 @@ function dump(context) {
43
43
  };
44
44
  return {
45
45
  databases: [
46
- ...databases.map((database) => (Object.assign(Object.assign(Object.assign({}, database), (database.enabled_clients && { enabled_clients: (0, utils_1.mapClientID2NameSorted)(database.enabled_clients, context.assets.clients) })), { options: Object.assign(Object.assign({}, database.options), (database.options.customScripts && {
47
- customScripts: Object.entries(database.options.customScripts).sort(sortCustomScripts).reduce((scripts, [name, script]) => {
46
+ ...databases.map((database) => (Object.assign(Object.assign(Object.assign({}, database), (database.enabled_clients && {
47
+ enabled_clients: (0, utils_1.mapClientID2NameSorted)(database.enabled_clients, context.assets.clients),
48
+ })), { options: Object.assign(Object.assign({}, database.options), (database.options.customScripts && {
49
+ customScripts: Object.entries(database.options.customScripts)
50
+ .sort(sortCustomScripts)
51
+ .reduce((scripts, [name, script]) => {
48
52
  // Create Database folder
49
53
  const dbName = (0, utils_1.sanitize)(database.name);
50
54
  const dbFolder = path_1.default.join(context.basePath, 'databases', (0, utils_1.sanitize)(dbName));
@@ -56,13 +60,14 @@ function dump(context) {
56
60
  fs_extra_1.default.writeFileSync(scriptFile, script);
57
61
  scripts[name] = `./databases/${dbName}/${scriptName}.js`;
58
62
  return scripts;
59
- }, {})
60
- })) })))
61
- ]
63
+ }, {}),
64
+ })) }))),
65
+ ],
62
66
  };
63
67
  });
64
68
  }
65
- exports.default = {
69
+ const databasesHandler = {
66
70
  parse,
67
- dump
71
+ dump,
68
72
  };
73
+ exports.default = databasesHandler;
@@ -14,24 +14,26 @@ function parse(context) {
14
14
  return __awaiter(this, void 0, void 0, function* () {
15
15
  // nothing to do, set default if empty
16
16
  return {
17
- emailProvider: Object.assign({}, context.assets.emailProvider || {})
17
+ emailProvider: Object.assign({}, (context.assets.emailProvider || {})),
18
18
  };
19
19
  });
20
20
  }
21
21
  function dump(context) {
22
+ var _a;
22
23
  return __awaiter(this, void 0, void 0, function* () {
23
24
  let { emailProvider } = context.assets;
24
- const excludedDefaults = context.assets.exclude.defaults || [];
25
+ const excludedDefaults = ((_a = context.assets.exclude) === null || _a === void 0 ? void 0 : _a.defaults) || [];
25
26
  if (emailProvider && !excludedDefaults.includes('emailProvider')) {
26
27
  // Add placeholder for credentials as they cannot be exported
27
28
  emailProvider = (0, defaults_1.emailProviderDefaults)(emailProvider);
28
29
  }
29
30
  return {
30
- emailProvider: emailProvider || {}
31
+ emailProvider: emailProvider || {},
31
32
  };
32
33
  });
33
34
  }
34
- exports.default = {
35
+ const emailProviderHandler = {
35
36
  parse,
36
- dump
37
+ dump,
37
38
  };
39
+ exports.default = emailProviderHandler;
@@ -21,14 +21,14 @@ function parse(context) {
21
21
  const emailTemplates = context.assets.emailTemplates || [];
22
22
  return {
23
23
  emailTemplates: [
24
- ...emailTemplates.map((et) => (Object.assign(Object.assign({}, et), { body: context.loadFile(et.body) })))
25
- ]
24
+ ...emailTemplates.map((et) => (Object.assign(Object.assign({}, et), { body: context.loadFile(et.body) }))),
25
+ ],
26
26
  };
27
27
  });
28
28
  }
29
29
  function dump(context) {
30
30
  return __awaiter(this, void 0, void 0, function* () {
31
- let emailTemplates = [...context.assets.emailTemplates || []];
31
+ let emailTemplates = [...(context.assets.emailTemplates || [])];
32
32
  if (emailTemplates.length > 0) {
33
33
  // Create Templates folder
34
34
  const templatesFolder = path_1.default.join(context.basePath, 'emailTemplates');
@@ -44,7 +44,8 @@ function dump(context) {
44
44
  return { emailTemplates };
45
45
  });
46
46
  }
47
- exports.default = {
47
+ const emailTemplatesHandler = {
48
48
  parse,
49
- dump
49
+ dump,
50
50
  };
51
+ exports.default = emailTemplatesHandler;
@@ -9,23 +9,16 @@ 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) {
13
- return __awaiter(this, void 0, void 0, function* () {
14
- // nothing to do, set default if empty
15
- return {
16
- guardianFactorProviders: [...context.assets.guardianFactorProviders || []]
17
- };
18
- });
19
- }
20
- function dump(context) {
12
+ function parseAndDump(context) {
21
13
  return __awaiter(this, void 0, void 0, function* () {
22
14
  // nothing to do, set default empty
23
15
  return {
24
- guardianFactorProviders: [...context.assets.guardianFactorProviders || []]
16
+ guardianFactorProviders: [...(context.assets.guardianFactorProviders || [])],
25
17
  };
26
18
  });
27
19
  }
28
- exports.default = {
29
- parse,
30
- dump
20
+ const guardianFactorProvidersHandler = {
21
+ parse: parseAndDump,
22
+ dump: parseAndDump,
31
23
  };
24
+ exports.default = guardianFactorProvidersHandler;
@@ -9,23 +9,16 @@ 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
  // nothing to do, set default if empty
15
15
  return {
16
- guardianFactorTemplates: [...context.assets.guardianFactorTemplates || []]
16
+ guardianFactorTemplates: [...(context.assets.guardianFactorTemplates || [])],
17
17
  };
18
18
  });
19
19
  }
20
- function dump(context) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- // nothing to do, set default empty
23
- return {
24
- guardianFactorTemplates: [...context.assets.guardianFactorTemplates || []]
25
- };
26
- });
27
- }
28
- exports.default = {
29
- parse,
30
- dump
20
+ const guardianFactorTemplatesHandler = {
21
+ parse: parseAndDump,
22
+ dump: parseAndDump,
31
23
  };
24
+ exports.default = guardianFactorTemplatesHandler;
@@ -9,23 +9,16 @@ 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
  // nothing to do, set default if empty
15
15
  return {
16
- guardianFactors: [...context.assets.guardianFactors || []]
16
+ guardianFactors: [...(context.assets.guardianFactors || [])],
17
17
  };
18
18
  });
19
19
  }
20
- function dump(context) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- // nothing to do, set default empty
23
- return {
24
- guardianFactors: [...context.assets.guardianFactors || []]
25
- };
26
- });
27
- }
28
- exports.default = {
29
- parse,
30
- dump
20
+ const guardianFactorsHandler = {
21
+ parse: parseAndDump,
22
+ dump: parseAndDump,
31
23
  };
24
+ exports.default = guardianFactorsHandler;
@@ -9,23 +9,16 @@ 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
  // nothing to do, set default if empty
15
15
  return {
16
- guardianPhoneFactorMessageTypes: Object.assign({}, context.assets.guardianPhoneFactorMessageTypes || {})
16
+ guardianPhoneFactorMessageTypes: Object.assign({}, (context.assets.guardianPhoneFactorMessageTypes || {})),
17
17
  };
18
18
  });
19
19
  }
20
- function dump(context) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- // nothing to do, set default empty
23
- return {
24
- guardianPhoneFactorMessageTypes: Object.assign({}, context.assets.guardianPhoneFactorMessageTypes || {})
25
- };
26
- });
27
- }
28
- exports.default = {
29
- parse,
30
- dump
20
+ const guardianPhoneFactorMessageTypesHandler = {
21
+ parse: parseAndDump,
22
+ dump: parseAndDump,
31
23
  };
24
+ exports.default = guardianPhoneFactorMessageTypesHandler;
@@ -9,23 +9,16 @@ 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) {
13
- return __awaiter(this, void 0, void 0, function* () {
14
- // nothing to do, set default if empty
15
- return {
16
- guardianPhoneFactorSelectedProvider: Object.assign({}, context.assets.guardianPhoneFactorSelectedProvider || {})
17
- };
18
- });
19
- }
20
- function dump(context) {
12
+ function parseAndDump(context) {
21
13
  return __awaiter(this, void 0, void 0, function* () {
22
14
  // nothing to do, set default empty
23
15
  return {
24
- guardianPhoneFactorSelectedProvider: Object.assign({}, context.assets.guardianPhoneFactorSelectedProvider || {})
16
+ guardianPhoneFactorSelectedProvider: Object.assign({}, (context.assets.guardianPhoneFactorSelectedProvider || {})),
25
17
  };
26
18
  });
27
19
  }
28
- exports.default = {
29
- parse,
30
- dump
20
+ const guardianPhoneFactorSelectedProviderHandler = {
21
+ parse: parseAndDump,
22
+ dump: parseAndDump,
31
23
  };
24
+ exports.default = guardianPhoneFactorSelectedProviderHandler;
@@ -9,23 +9,16 @@ 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
  // nothing to do, set default if empty
15
15
  return {
16
- guardianPolicies: Object.assign({}, context.assets.guardianPolicies || {})
16
+ guardianPolicies: Object.assign({}, (context.assets.guardianPolicies || {})),
17
17
  };
18
18
  });
19
19
  }
20
- function dump(context) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- // nothing to do, set default empty
23
- return {
24
- guardianPolicies: Object.assign({}, context.assets.guardianPolicies || {})
25
- };
26
- });
27
- }
28
- exports.default = {
29
- parse,
30
- dump
20
+ const guardianPoliciesHandler = {
21
+ parse: parseAndDump,
22
+ dump: parseAndDump,
31
23
  };
24
+ exports.default = guardianPoliciesHandler;
@@ -26,18 +26,19 @@ function parse(context) {
26
26
  hooks: [
27
27
  ...context.assets.hooks.map((hook) => {
28
28
  if (hook.script) {
29
+ //@ts-ignore TODO: understand why two arguments are passed when context.loadFile only accepts one
29
30
  hook.script = context.loadFile(hook.script, tools_1.constants.HOOKS_DIRECTORY);
30
31
  }
31
32
  hook.name = hook.name.toLowerCase().replace(/\s/g, '-');
32
33
  return Object.assign({}, hook);
33
- })
34
- ]
34
+ }),
35
+ ],
35
36
  };
36
37
  });
37
38
  }
38
39
  function dump(context) {
39
40
  return __awaiter(this, void 0, void 0, function* () {
40
- let hooks = [...context.assets.hooks || []];
41
+ let hooks = [...(context.assets.hooks || [])];
41
42
  if (hooks.length > 0) {
42
43
  // Create hooks folder
43
44
  const hooksFolder = path_1.default.join(context.basePath, 'hooks');
@@ -56,7 +57,8 @@ function dump(context) {
56
57
  return { hooks };
57
58
  });
58
59
  }
59
- exports.default = {
60
+ const hooksHandler = {
60
61
  parse,
61
- dump
62
+ dump,
62
63
  };
64
+ exports.default = hooksHandler;
@@ -27,7 +27,8 @@ const migrations_1 = __importDefault(require("./migrations"));
27
27
  const actions_1 = __importDefault(require("./actions"));
28
28
  const triggers_1 = __importDefault(require("./triggers"));
29
29
  const attackProtection_1 = __importDefault(require("./attackProtection"));
30
- exports.default = {
30
+ const branding_1 = __importDefault(require("./branding"));
31
+ const yamlHandlers = {
31
32
  rules: rules_1.default,
32
33
  hooks: hooks_1.default,
33
34
  rulesConfigs: rulesConfigs_1.default,
@@ -51,5 +52,7 @@ 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
  };
58
+ exports.default = yamlHandlers;
@@ -21,7 +21,8 @@ function dump(context) {
21
21
  return { migrations: migrations || {} };
22
22
  });
23
23
  }
24
- exports.default = {
24
+ const migrationsHandler = {
25
25
  parse,
26
- dump
26
+ dump,
27
27
  };
28
+ exports.default = migrationsHandler;
@@ -13,7 +13,7 @@ function parse(context) {
13
13
  return __awaiter(this, void 0, void 0, function* () {
14
14
  const { organizations } = context.assets;
15
15
  return {
16
- organizations: organizations
16
+ organizations: organizations,
17
17
  };
18
18
  });
19
19
  }
@@ -33,12 +33,13 @@ function dump(context) {
33
33
  });
34
34
  }
35
35
  return org;
36
- })
37
- ]
36
+ }),
37
+ ],
38
38
  };
39
39
  });
40
40
  }
41
- exports.default = {
41
+ const organizationsHandler = {
42
42
  parse,
43
- dump
43
+ dump,
44
44
  };
45
+ exports.default = organizationsHandler;