auth0-deploy-cli 7.4.0 → 7.5.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 (112) hide show
  1. package/.circleci/config.yml +15 -0
  2. package/.github/CODEOWNERS +1 -0
  3. package/.husky/pre-commit +2 -0
  4. package/.nyc_output/60b76a45-577b-4171-9982-a8e836ab7fd6.json +1 -0
  5. package/.nyc_output/processinfo/60b76a45-577b-4171-9982-a8e836ab7fd6.json +1 -0
  6. package/.nyc_output/processinfo/index.json +1 -1
  7. package/CHANGELOG.md +13 -1
  8. package/lib/args.js +89 -81
  9. package/lib/commands/export.js +51 -77
  10. package/lib/commands/import.js +45 -69
  11. package/lib/commands/index.js +11 -20
  12. package/lib/configFactory.js +19 -27
  13. package/lib/context/defaults.js +18 -41
  14. package/lib/context/directory/handlers/actions.js +77 -107
  15. package/lib/context/directory/handlers/attackProtection.js +59 -0
  16. package/lib/context/directory/handlers/clientGrants.js +45 -54
  17. package/lib/context/directory/handlers/clients.js +60 -79
  18. package/lib/context/directory/handlers/connections.js +65 -89
  19. package/lib/context/directory/handlers/databases.js +91 -123
  20. package/lib/context/directory/handlers/emailProvider.js +46 -57
  21. package/lib/context/directory/handlers/emailTemplates.js +67 -80
  22. package/lib/context/directory/handlers/guardianFactorProviders.js +41 -49
  23. package/lib/context/directory/handlers/guardianFactorTemplates.js +41 -49
  24. package/lib/context/directory/handlers/guardianFactors.js +41 -49
  25. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +40 -50
  26. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +40 -50
  27. package/lib/context/directory/handlers/guardianPolicies.js +40 -50
  28. package/lib/context/directory/handlers/hooks.js +55 -70
  29. package/lib/context/directory/handlers/index.js +53 -123
  30. package/lib/context/directory/handlers/migrations.js +36 -41
  31. package/lib/context/directory/handlers/organizations.js +54 -69
  32. package/lib/context/directory/handlers/pages.js +72 -86
  33. package/lib/context/directory/handlers/resourceServers.js +41 -49
  34. package/lib/context/directory/handlers/roles.js +49 -62
  35. package/lib/context/directory/handlers/rules.js +52 -68
  36. package/lib/context/directory/handlers/rulesConfigs.js +33 -32
  37. package/lib/context/directory/handlers/tenant.js +52 -47
  38. package/lib/context/directory/handlers/triggers.js +39 -54
  39. package/lib/context/directory/index.js +113 -101
  40. package/lib/context/index.js +96 -105
  41. package/lib/context/yaml/handlers/actions.js +71 -88
  42. package/lib/context/yaml/handlers/attackProtection.js +29 -0
  43. package/lib/context/yaml/handlers/clientGrants.js +36 -29
  44. package/lib/context/yaml/handlers/clients.js +61 -76
  45. package/lib/context/yaml/handlers/connections.js +76 -103
  46. package/lib/context/yaml/handlers/databases.js +64 -79
  47. package/lib/context/yaml/handlers/emailProvider.js +33 -30
  48. package/lib/context/yaml/handlers/emailTemplates.js +45 -54
  49. package/lib/context/yaml/handlers/guardianFactorProviders.js +27 -18
  50. package/lib/context/yaml/handlers/guardianFactorTemplates.js +27 -18
  51. package/lib/context/yaml/handlers/guardianFactors.js +27 -18
  52. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +27 -20
  53. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +27 -20
  54. package/lib/context/yaml/handlers/guardianPolicies.js +27 -20
  55. package/lib/context/yaml/handlers/hooks.js +57 -67
  56. package/lib/context/yaml/handlers/index.js +53 -123
  57. package/lib/context/yaml/handlers/migrations.js +23 -24
  58. package/lib/context/yaml/handlers/organizations.js +40 -38
  59. package/lib/context/yaml/handlers/pages.js +49 -58
  60. package/lib/context/yaml/handlers/resourceServers.js +27 -18
  61. package/lib/context/yaml/handlers/roles.js +34 -24
  62. package/lib/context/yaml/handlers/rules.js +48 -58
  63. package/lib/context/yaml/handlers/rulesConfigs.js +27 -18
  64. package/lib/context/yaml/handlers/tenant.js +44 -30
  65. package/lib/context/yaml/handlers/triggers.js +32 -23
  66. package/lib/context/yaml/index.js +127 -142
  67. package/lib/index.js +73 -79
  68. package/lib/logger.js +18 -22
  69. package/lib/readonly.js +74 -66
  70. package/lib/tools/ValidationError.js +8 -13
  71. package/lib/tools/auth0/client.js +143 -133
  72. package/lib/tools/auth0/handlers/actions.js +231 -243
  73. package/lib/tools/auth0/handlers/attackProtection.js +86 -0
  74. package/lib/tools/auth0/handlers/branding.js +47 -46
  75. package/lib/tools/auth0/handlers/clientGrants.js +118 -116
  76. package/lib/tools/auth0/handlers/clients.js +72 -90
  77. package/lib/tools/auth0/handlers/connections.js +150 -118
  78. package/lib/tools/auth0/handlers/databases.js +127 -124
  79. package/lib/tools/auth0/handlers/default.js +186 -189
  80. package/lib/tools/auth0/handlers/emailProvider.js +67 -78
  81. package/lib/tools/auth0/handlers/emailTemplates.js +116 -92
  82. package/lib/tools/auth0/handlers/guardianFactorProviders.js +66 -81
  83. package/lib/tools/auth0/handlers/guardianFactorTemplates.js +60 -71
  84. package/lib/tools/auth0/handlers/guardianFactors.js +56 -63
  85. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +80 -79
  86. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +77 -76
  87. package/lib/tools/auth0/handlers/guardianPolicies.js +59 -62
  88. package/lib/tools/auth0/handlers/hooks.js +201 -227
  89. package/lib/tools/auth0/handlers/index.js +53 -111
  90. package/lib/tools/auth0/handlers/migrations.js +99 -79
  91. package/lib/tools/auth0/handlers/organizations.js +225 -247
  92. package/lib/tools/auth0/handlers/pages.js +116 -154
  93. package/lib/tools/auth0/handlers/prompts.js +47 -46
  94. package/lib/tools/auth0/handlers/resourceServers.js +88 -112
  95. package/lib/tools/auth0/handlers/roles.js +203 -220
  96. package/lib/tools/auth0/handlers/rules.js +168 -189
  97. package/lib/tools/auth0/handlers/rulesConfigs.js +54 -63
  98. package/lib/tools/auth0/handlers/tenant.js +88 -64
  99. package/lib/tools/auth0/handlers/triggers.js +126 -126
  100. package/lib/tools/auth0/index.js +92 -85
  101. package/lib/tools/auth0/schema.js +39 -31
  102. package/lib/tools/constants.js +111 -21
  103. package/lib/tools/deploy.js +35 -32
  104. package/lib/tools/index.js +19 -32
  105. package/lib/tools/logger.js +11 -12
  106. package/lib/tools/utils.js +255 -282
  107. package/lib/utils.js +167 -190
  108. package/package.json +4 -3
  109. package/tsconfig.json +96 -0
  110. package/typescript-migration-progress.sh +22 -0
  111. package/.nyc_output/597f412e-a239-4319-ad5b-ddb87fc39e67.json +0 -1
  112. package/.nyc_output/processinfo/597f412e-a239-4319-ad5b-ddb87fc39e67.json +0 -1
@@ -1,88 +1,108 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
5
17
  });
6
- exports.default = exports.schema = undefined;
7
-
8
- var _dec, _class;
9
-
10
- var _default = require("./default");
11
-
12
- var _default2 = _interopRequireDefault(_default);
13
-
14
- var _logger = require("../../logger");
15
-
16
- var _logger2 = _interopRequireDefault(_logger);
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
21
-
22
- const schema = exports.schema = {
23
- type: 'object',
24
- additionalProperties: {
25
- type: 'boolean'
26
- }
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
27
30
  };
28
- let MigrationsHandler = (_dec = (0, _default.order)('150'), (_class = class MigrationsHandler extends _default2.default {
29
- constructor(options) {
30
- super({ ...options,
31
- type: 'migrations'
31
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
32
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
33
+ return new (P || (P = Promise))(function (resolve, reject) {
34
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
35
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
36
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
37
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
38
  });
33
- }
34
-
35
- async getType() {
36
- try {
37
- const migrations = await this.client.migrations.getMigrations();
38
- return migrations.flags;
39
- } catch (err) {
40
- if (err.statusCode === 404) return {};
41
- throw err;
39
+ };
40
+ var __importDefault = (this && this.__importDefault) || function (mod) {
41
+ return (mod && mod.__esModule) ? mod : { "default": mod };
42
+ };
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.schema = void 0;
45
+ const default_1 = __importStar(require("./default"));
46
+ const logger_1 = __importDefault(require("../../logger"));
47
+ exports.schema = {
48
+ type: 'object',
49
+ additionalProperties: { type: 'boolean' }
50
+ };
51
+ class MigrationsHandler extends default_1.default {
52
+ constructor(options) {
53
+ super(Object.assign(Object.assign({}, options), { type: 'migrations' }));
54
+ }
55
+ getType() {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ try {
58
+ const migrations = yield this.client.migrations.getMigrations();
59
+ return migrations.flags;
60
+ }
61
+ catch (err) {
62
+ if (err.statusCode === 404)
63
+ return {};
64
+ throw err;
65
+ }
66
+ });
42
67
  }
43
- }
44
-
45
- async processChanges(assets) {
46
- const {
47
- migrations
48
- } = assets;
49
-
50
- if (migrations && Object.keys(migrations).length > 0) {
51
- const flags = await this.removeUnavailableMigrations(migrations);
52
-
53
- if (Object.keys(flags).length > 0) {
54
- await this.client.migrations.updateMigrations({
55
- flags
68
+ // Run at the end since switching a flag will depend on other applying other changes
69
+ processChanges(assets) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const { migrations } = assets;
72
+ if (migrations && Object.keys(migrations).length > 0) {
73
+ const flags = yield this.removeUnavailableMigrations(migrations);
74
+ if (Object.keys(flags).length > 0) {
75
+ yield this.client.migrations.updateMigrations({ flags });
76
+ this.updated += 1;
77
+ this.didUpdate(flags);
78
+ }
79
+ }
56
80
  });
57
- this.updated += 1;
58
- this.didUpdate(flags);
59
- }
60
81
  }
61
- }
62
-
63
- logUnavailableMigrations(ignoreUnavailableMigrations, ignoredMigrations) {
64
- if (ignoreUnavailableMigrations) {
65
- _logger2.default.info(`The following migrations are not available '${ignoredMigrations.join(',')}'. The migrations will be ignored because you have AUTH0_IGNORE_UNAVAILABLE_MIGRATIONS=true in your configuration.`);
66
- } else {
67
- _logger2.default.warn(`The following disabled migrations are not available '${ignoredMigrations.join(',')}'. The migrations will be ignored, remove the migrations to avoid future warnings.`);
82
+ logUnavailableMigrations(ignoreUnavailableMigrations, ignoredMigrations) {
83
+ if (ignoreUnavailableMigrations) {
84
+ logger_1.default.info(`The following migrations are not available '${ignoredMigrations.join(',')}'. The migrations will be ignored because you have AUTH0_IGNORE_UNAVAILABLE_MIGRATIONS=true in your configuration.`);
85
+ }
86
+ else {
87
+ logger_1.default.warn(`The following disabled migrations are not available '${ignoredMigrations.join(',')}'. The migrations will be ignored, remove the migrations to avoid future warnings.`);
88
+ }
68
89
  }
69
- }
70
-
71
- async removeUnavailableMigrations(migrations) {
72
- const flags = { ...migrations
73
- };
74
- const ignoreUnavailableMigrations = !!this.config('AUTH0_IGNORE_UNAVAILABLE_MIGRATIONS');
75
- const existingMigrations = await this.getType();
76
- const unavailableMigrations = Object.keys(flags).filter(flag => !(flag in existingMigrations));
77
- const ignoredMigrations = unavailableMigrations.filter(flag => ignoreUnavailableMigrations || flags[flag] === false);
78
-
79
- if (ignoredMigrations.length > 0) {
80
- this.logUnavailableMigrations(ignoreUnavailableMigrations, ignoredMigrations);
81
- ignoredMigrations.forEach(flag => delete flags[flag]);
90
+ removeUnavailableMigrations(migrations) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ const flags = Object.assign({}, migrations);
93
+ const ignoreUnavailableMigrations = !!this.config('AUTH0_IGNORE_UNAVAILABLE_MIGRATIONS');
94
+ const existingMigrations = yield this.getType();
95
+ const unavailableMigrations = Object.keys(flags).filter((flag) => !(flag in existingMigrations));
96
+ const ignoredMigrations = unavailableMigrations.filter((flag) => ignoreUnavailableMigrations || flags[flag] === false);
97
+ if (ignoredMigrations.length > 0) {
98
+ this.logUnavailableMigrations(ignoreUnavailableMigrations, ignoredMigrations);
99
+ ignoredMigrations.forEach((flag) => delete flags[flag]);
100
+ }
101
+ return flags;
102
+ });
82
103
  }
83
-
84
- return flags;
85
- }
86
-
87
- }, (_applyDecoratedDescriptor(_class.prototype, "processChanges", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "processChanges"), _class.prototype)), _class));
88
- exports.default = MigrationsHandler;
104
+ }
105
+ __decorate([
106
+ (0, default_1.order)('150')
107
+ ], MigrationsHandler.prototype, "processChanges", null);
108
+ exports.default = MigrationsHandler;