auth0-deploy-cli 7.12.2 → 7.13.1

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.
@@ -76,3 +76,5 @@ workflows:
76
76
  ignore: /.*/
77
77
  tags:
78
78
  only: /^v.*/
79
+ context:
80
+ - publish-npm
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "npm"
9
+ directory: "/"
10
+ schedule:
11
+ interval: "daily"
package/CHANGELOG.md CHANGED
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [7.13.1] - 2022-06-13
11
+
12
+ ### Fixed
13
+
14
+ - Removing single usage of `flatMap` array method to prevent crashes with Node v10 [#577]
15
+
16
+ ## [7.13.0] - 2022-06-06
17
+
18
+ ### Added
19
+
20
+ - Themes support (if supported by tenant) [#554]
21
+
22
+ ### Fixed
23
+
24
+ - Omit `enabled_clients` from connection payload if not defined in resource configuration files [#563]
25
+
26
+ ## [7.12.3] - 2022-05-24
27
+
28
+ ### Fixed
29
+
30
+ - Resource exclusion respected during import even if resource configuration exists [#545]
31
+ - Environment variables ingested by default [#553]
32
+
10
33
  ## [7.12.2] - 2022-05-17
11
34
 
12
35
  ### Fixed
@@ -748,7 +771,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
748
771
  [#532]: https://github.com/auth0/auth0-deploy-cli/issues/532
749
772
  [#541]: https://github.com/auth0/auth0-deploy-cli/issues/541
750
773
  [#542]: https://github.com/auth0/auth0-deploy-cli/issues/542
751
- [unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v7.12.2...HEAD
774
+ [#545]: https://github.com/auth0/auth0-deploy-cli/issues/545
775
+ [#553]: https://github.com/auth0/auth0-deploy-cli/issues/553
776
+ [#554]: https://github.com/auth0/auth0-deploy-cli/issues/554
777
+ [#563]: https://github.com/auth0/auth0-deploy-cli/issues/563
778
+ [#577]: https://github.com/auth0/auth0-deploy-cli/issues/577
779
+ [unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v7.13.1...HEAD
780
+ [7.13.1]: https://github.com/auth0/auth0-deploy-cli/compare/v7.13.0...v7.13.1
781
+ [7.13.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.12.3...v7.13.0
782
+ [7.12.3]: https://github.com/auth0/auth0-deploy-cli/compare/v7.12.2...v7.12.3
752
783
  [7.12.2]: https://github.com/auth0/auth0-deploy-cli/compare/v7.12.1...v7.12.2
753
784
  [7.12.1]: https://github.com/auth0/auth0-deploy-cli/compare/v7.12.0...v7.12.1
754
785
  [7.12.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.11.1...v7.12.0
package/lib/args.js CHANGED
@@ -70,7 +70,7 @@ function getParams() {
70
70
  env: {
71
71
  describe: 'Override the mappings in config with environment variables.',
72
72
  boolean: true,
73
- default: false,
73
+ default: true,
74
74
  },
75
75
  export_ids: {
76
76
  alias: 'e',
@@ -31,6 +31,7 @@ const branding_1 = __importDefault(require("./branding"));
31
31
  const logStreams_1 = __importDefault(require("./logStreams"));
32
32
  const prompts_1 = __importDefault(require("./prompts"));
33
33
  const customDomains_1 = __importDefault(require("./customDomains"));
34
+ const themes_1 = __importDefault(require("./themes"));
34
35
  const directoryHandlers = {
35
36
  rules: rules_1.default,
36
37
  rulesConfigs: rulesConfigs_1.default,
@@ -60,5 +61,6 @@ const directoryHandlers = {
60
61
  logStreams: logStreams_1.default,
61
62
  prompts: prompts_1.default,
62
63
  customDomains: customDomains_1.default,
64
+ themes: themes_1.default,
63
65
  };
64
66
  exports.default = directoryHandlers;
@@ -0,0 +1,6 @@
1
+ import { DirectoryHandler } from '.';
2
+ import { ParsedAsset } from '../../../types';
3
+ import { Theme } from '../../../tools/auth0/handlers/themes';
4
+ declare type ParsedThemes = ParsedAsset<'themes', Theme[]>;
5
+ declare const themesHandler: DirectoryHandler<ParsedThemes>;
6
+ export default themesHandler;
@@ -0,0 +1,48 @@
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 path_1 = __importDefault(require("path"));
16
+ const fs_extra_1 = require("fs-extra");
17
+ const utils_1 = require("../../../utils");
18
+ const tools_1 = require("../../../tools");
19
+ function parse(context) {
20
+ const baseFolder = path_1.default.join(context.filePath, tools_1.constants.THEMES_DIRECTORY);
21
+ if (!(0, utils_1.existsMustBeDir)(baseFolder)) {
22
+ return { themes: null };
23
+ }
24
+ const themeDefinitionsFiles = (0, utils_1.getFiles)(baseFolder, ['.json']);
25
+ if (!themeDefinitionsFiles.length) {
26
+ return { themes: [] };
27
+ }
28
+ const themes = themeDefinitionsFiles.map((themeDefinitionsFile) => (0, utils_1.loadJSON)(themeDefinitionsFile, context.mappings));
29
+ return { themes };
30
+ }
31
+ function dump(context) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ const { themes } = context.assets;
34
+ if (!themes) {
35
+ return;
36
+ }
37
+ const baseFolder = path_1.default.join(context.filePath, tools_1.constants.THEMES_DIRECTORY);
38
+ (0, fs_extra_1.ensureDirSync)(baseFolder);
39
+ themes.forEach((themeDefinition, i) => {
40
+ (0, utils_1.dumpJSON)(path_1.default.join(baseFolder, `theme${i ? i : ''}.json`), themeDefinition);
41
+ });
42
+ });
43
+ }
44
+ const themesHandler = {
45
+ parse,
46
+ dump,
47
+ };
48
+ exports.default = themesHandler;
@@ -73,7 +73,12 @@ class DirectoryContext {
73
73
  if ((0, utils_1.isDirectory)(this.filePath)) {
74
74
  /* If this is a directory, look for each file in the directory */
75
75
  logger_1.default.info(`Processing directory ${this.filePath}`);
76
- Object.values(handlers_1.default).forEach((handler) => {
76
+ Object.entries(handlers_1.default)
77
+ .filter(([handlerName]) => {
78
+ const excludedAssetTypes = this.config.AUTH0_EXCLUDED || [];
79
+ return !excludedAssetTypes.includes(handlerName);
80
+ })
81
+ .forEach(([_name, handler]) => {
77
82
  const parsed = handler.parse(this);
78
83
  Object.entries(parsed).forEach(([k, v]) => {
79
84
  this.assets[k] = v;
@@ -31,6 +31,7 @@ const branding_1 = __importDefault(require("./branding"));
31
31
  const logStreams_1 = __importDefault(require("./logStreams"));
32
32
  const prompts_1 = __importDefault(require("./prompts"));
33
33
  const customDomains_1 = __importDefault(require("./customDomains"));
34
+ const themes_1 = __importDefault(require("./themes"));
34
35
  const yamlHandlers = {
35
36
  rules: rules_1.default,
36
37
  hooks: hooks_1.default,
@@ -60,5 +61,6 @@ const yamlHandlers = {
60
61
  logStreams: logStreams_1.default,
61
62
  prompts: prompts_1.default,
62
63
  customDomains: customDomains_1.default,
64
+ themes: themes_1.default,
63
65
  };
64
66
  exports.default = yamlHandlers;
@@ -0,0 +1,6 @@
1
+ import { YAMLHandler } from '.';
2
+ import { ParsedAsset } from '../../../types';
3
+ import { Theme } from '../../../tools/auth0/handlers/themes';
4
+ declare type ParsedThemes = ParsedAsset<'themes', Theme[]>;
5
+ declare const themesHandler: YAMLHandler<ParsedThemes>;
6
+ export default themesHandler;
@@ -0,0 +1,26 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ function parseAndDump(context) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ const { themes } = context.assets;
15
+ if (!themes)
16
+ return { themes: null };
17
+ return {
18
+ themes,
19
+ };
20
+ });
21
+ }
22
+ const themesHandler = {
23
+ parse: parseAndDump,
24
+ dump: parseAndDump,
25
+ };
26
+ exports.default = themesHandler;
@@ -69,6 +69,13 @@ class YAMLContext {
69
69
  throw new Error(`Problem loading ${this.configFile}\n${err}`);
70
70
  }
71
71
  }
72
+ const excludedAssetsFiltered = Object.keys(this.assets).reduce((acc, key) => {
73
+ const excludedAssetTypes = this.config.AUTH0_EXCLUDED || [];
74
+ if (excludedAssetTypes.includes(key))
75
+ return acc;
76
+ return Object.assign(Object.assign({}, acc), { [key]: this.assets[key] });
77
+ }, {});
78
+ this.assets = excludedAssetsFiltered;
72
79
  // Run initial schema check to ensure valid YAML
73
80
  const auth0 = new tools_1.Auth0(this.mgmtClient, this.assets, (0, utils_1.toConfigFn)(this.config));
74
81
  yield auth0.validate();
package/lib/index.d.ts CHANGED
@@ -79,6 +79,7 @@ declare const _default: {
79
79
  LOG_STREAMS_DIRECTORY: string;
80
80
  PROMPTS_DIRECTORY: string;
81
81
  CUSTOM_DOMAINS_DIRECTORY: string;
82
+ THEMES_DIRECTORY: string;
82
83
  };
83
84
  deploy: typeof import("./tools").deploy;
84
85
  keywordReplace: typeof import("./tools").keywordReplace;
@@ -55,6 +55,11 @@ declare const _default: {
55
55
  excludeSchema?: any;
56
56
  schema: any;
57
57
  };
58
+ themes: {
59
+ default: typeof APIHandler;
60
+ excludeSchema?: any;
61
+ schema: any;
62
+ };
58
63
  attackProtection: {
59
64
  default: typeof APIHandler;
60
65
  excludeSchema?: any;
@@ -52,6 +52,7 @@ const organizations = __importStar(require("./organizations"));
52
52
  const attackProtection = __importStar(require("./attackProtection"));
53
53
  const logStreams = __importStar(require("./logStreams"));
54
54
  const customDomains = __importStar(require("./customDomains"));
55
+ const themes = __importStar(require("./themes"));
55
56
  const auth0ApiHandlers = {
56
57
  rules,
57
58
  rulesConfigs,
@@ -82,5 +83,6 @@ const auth0ApiHandlers = {
82
83
  attackProtection,
83
84
  logStreams,
84
85
  customDomains,
86
+ themes,
85
87
  };
86
88
  exports.default = auth0ApiHandlers; // TODO: apply stronger types to schema properties
@@ -164,7 +164,8 @@ class PromptsHandler extends default_1.default {
164
164
  const supportedLanguages = yield this.client.tenant
165
165
  .getSettings()
166
166
  .then(({ enabled_locales }) => enabled_locales);
167
- const data = yield Promise.all(supportedLanguages.flatMap((language) => {
167
+ const data = yield Promise.all(supportedLanguages
168
+ .map((language) => {
168
169
  return promptTypes.map((promptType) => {
169
170
  return this.client.prompts
170
171
  .getCustomTextByLanguage({
@@ -180,7 +181,9 @@ class PromptsHandler extends default_1.default {
180
181
  };
181
182
  });
182
183
  });
183
- })).then((customTextData) => {
184
+ })
185
+ .reduce((acc, val) => acc.concat(val), []) // TODO: replace .map().reduce() with .flatMap() once we officially eliminate Node v10 support
186
+ ).then((customTextData) => {
184
187
  return customTextData
185
188
  .filter((customTextData) => {
186
189
  return customTextData !== null;