auth0-deploy-cli 7.4.0 → 7.5.2
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/.circleci/config.yml +15 -0
- package/.eslintrc +66 -17
- package/.github/CODEOWNERS +1 -0
- package/.husky/pre-commit +2 -0
- package/CHANGELOG.md +27 -2
- package/lib/args.js +94 -81
- package/lib/commands/export.js +54 -78
- package/lib/commands/import.js +46 -70
- package/lib/commands/index.js +11 -20
- package/lib/configFactory.js +19 -27
- package/lib/context/defaults.js +18 -41
- package/lib/context/directory/handlers/actions.js +77 -107
- package/lib/context/directory/handlers/attackProtection.js +59 -0
- package/lib/context/directory/handlers/clientGrants.js +45 -54
- package/lib/context/directory/handlers/clients.js +60 -79
- package/lib/context/directory/handlers/connections.js +65 -89
- package/lib/context/directory/handlers/databases.js +91 -123
- package/lib/context/directory/handlers/emailProvider.js +46 -57
- package/lib/context/directory/handlers/emailTemplates.js +67 -80
- package/lib/context/directory/handlers/guardianFactorProviders.js +41 -49
- package/lib/context/directory/handlers/guardianFactorTemplates.js +41 -49
- package/lib/context/directory/handlers/guardianFactors.js +41 -49
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +40 -50
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +40 -50
- package/lib/context/directory/handlers/guardianPolicies.js +40 -50
- package/lib/context/directory/handlers/hooks.js +55 -70
- package/lib/context/directory/handlers/index.js +53 -123
- package/lib/context/directory/handlers/migrations.js +36 -41
- package/lib/context/directory/handlers/organizations.js +54 -69
- package/lib/context/directory/handlers/pages.js +72 -86
- package/lib/context/directory/handlers/resourceServers.js +41 -49
- package/lib/context/directory/handlers/roles.js +49 -62
- package/lib/context/directory/handlers/rules.js +52 -68
- package/lib/context/directory/handlers/rulesConfigs.js +33 -32
- package/lib/context/directory/handlers/tenant.js +52 -47
- package/lib/context/directory/handlers/triggers.js +39 -54
- package/lib/context/directory/index.js +113 -101
- package/lib/context/index.js +96 -105
- package/lib/context/yaml/handlers/actions.js +71 -88
- package/lib/context/yaml/handlers/attackProtection.js +29 -0
- package/lib/context/yaml/handlers/clientGrants.js +36 -29
- package/lib/context/yaml/handlers/clients.js +61 -76
- package/lib/context/yaml/handlers/connections.js +76 -103
- package/lib/context/yaml/handlers/databases.js +64 -79
- package/lib/context/yaml/handlers/emailProvider.js +33 -30
- package/lib/context/yaml/handlers/emailTemplates.js +45 -54
- package/lib/context/yaml/handlers/guardianFactorProviders.js +27 -18
- package/lib/context/yaml/handlers/guardianFactorTemplates.js +27 -18
- package/lib/context/yaml/handlers/guardianFactors.js +27 -18
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +27 -20
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +27 -20
- package/lib/context/yaml/handlers/guardianPolicies.js +27 -20
- package/lib/context/yaml/handlers/hooks.js +57 -67
- package/lib/context/yaml/handlers/index.js +53 -123
- package/lib/context/yaml/handlers/migrations.js +23 -24
- package/lib/context/yaml/handlers/organizations.js +40 -38
- package/lib/context/yaml/handlers/pages.js +49 -58
- package/lib/context/yaml/handlers/resourceServers.js +27 -18
- package/lib/context/yaml/handlers/roles.js +34 -24
- package/lib/context/yaml/handlers/rules.js +48 -58
- package/lib/context/yaml/handlers/rulesConfigs.js +27 -18
- package/lib/context/yaml/handlers/tenant.js +44 -30
- package/lib/context/yaml/handlers/triggers.js +32 -23
- package/lib/context/yaml/index.js +127 -142
- package/lib/index.js +73 -79
- package/lib/logger.js +18 -22
- package/lib/readonly.js +74 -66
- package/lib/tools/ValidationError.js +8 -13
- package/lib/tools/auth0/client.js +143 -133
- package/lib/tools/auth0/handlers/actions.js +231 -243
- package/lib/tools/auth0/handlers/attackProtection.js +86 -0
- package/lib/tools/auth0/handlers/branding.js +47 -46
- package/lib/tools/auth0/handlers/clientGrants.js +118 -116
- package/lib/tools/auth0/handlers/clients.js +72 -90
- package/lib/tools/auth0/handlers/connections.js +150 -118
- package/lib/tools/auth0/handlers/databases.js +127 -124
- package/lib/tools/auth0/handlers/default.js +186 -189
- package/lib/tools/auth0/handlers/emailProvider.js +67 -78
- package/lib/tools/auth0/handlers/emailTemplates.js +116 -92
- package/lib/tools/auth0/handlers/guardianFactorProviders.js +66 -81
- package/lib/tools/auth0/handlers/guardianFactorTemplates.js +60 -71
- package/lib/tools/auth0/handlers/guardianFactors.js +56 -63
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +80 -79
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +77 -76
- package/lib/tools/auth0/handlers/guardianPolicies.js +59 -62
- package/lib/tools/auth0/handlers/hooks.js +201 -227
- package/lib/tools/auth0/handlers/index.js +53 -111
- package/lib/tools/auth0/handlers/migrations.js +99 -79
- package/lib/tools/auth0/handlers/organizations.js +225 -247
- package/lib/tools/auth0/handlers/pages.js +116 -154
- package/lib/tools/auth0/handlers/prompts.js +47 -46
- package/lib/tools/auth0/handlers/resourceServers.js +88 -112
- package/lib/tools/auth0/handlers/roles.js +203 -220
- package/lib/tools/auth0/handlers/rules.js +168 -189
- package/lib/tools/auth0/handlers/rulesConfigs.js +54 -63
- package/lib/tools/auth0/handlers/tenant.js +88 -64
- package/lib/tools/auth0/handlers/triggers.js +126 -126
- package/lib/tools/auth0/index.js +92 -85
- package/lib/tools/auth0/schema.js +39 -31
- package/lib/tools/constants.js +111 -21
- package/lib/tools/deploy.js +35 -32
- package/lib/tools/index.js +19 -32
- package/lib/tools/logger.js +11 -12
- package/lib/tools/utils.js +255 -282
- package/lib/utils.js +167 -190
- package/package.json +10 -16
- package/tsconfig.json +17 -0
- package/typescript-migration-progress.sh +22 -0
- package/.babelrc +0 -17
- package/.nyc_output/597f412e-a239-4319-ad5b-ddb87fc39e67.json +0 -1
- package/.nyc_output/processinfo/597f412e-a239-4319-ad5b-ddb87fc39e67.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
package/.circleci/config.yml
CHANGED
|
@@ -47,6 +47,15 @@ jobs:
|
|
|
47
47
|
- run:
|
|
48
48
|
name: Publish package
|
|
49
49
|
command: npm publish
|
|
50
|
+
|
|
51
|
+
ts_migration_progress:
|
|
52
|
+
machine:
|
|
53
|
+
image: ubuntu-2004:202111-02
|
|
54
|
+
steps:
|
|
55
|
+
- checkout
|
|
56
|
+
- run :
|
|
57
|
+
name: Typescript Migration Progress
|
|
58
|
+
command: sh typescript-migration-progress.sh
|
|
50
59
|
|
|
51
60
|
workflows:
|
|
52
61
|
version: 2
|
|
@@ -77,3 +86,9 @@ workflows:
|
|
|
77
86
|
ignore: /.*/
|
|
78
87
|
tags:
|
|
79
88
|
only: /^v.*/
|
|
89
|
+
ts_migration:
|
|
90
|
+
jobs:
|
|
91
|
+
- ts_migration_progress:
|
|
92
|
+
filters:
|
|
93
|
+
tags:
|
|
94
|
+
ignore: /.*/
|
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
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @auth0/dx-customer-dev-tools-engineer
|
package/.husky/pre-commit
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.5.2] - 2022-03-15
|
|
11
|
+
### Fixed
|
|
12
|
+
- Resetting this version to be latest on NPM
|
|
13
|
+
|
|
14
|
+
## [7.5.1] - 2022-03-11
|
|
15
|
+
### Fixed
|
|
16
|
+
- Updating dead link in logging output [#436]
|
|
17
|
+
- Fixing `--env` flag to properly dictate environment variable inheritance [#432]
|
|
18
|
+
|
|
19
|
+
## [7.5.0] - 2022-03-08
|
|
20
|
+
### Added
|
|
21
|
+
- Support for attack protection configuration management [#428]
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- Excluded connection properties from getting deleted upon update [#430]
|
|
25
|
+
- Organizations in YAML format are skipped when not defined [#388]
|
|
26
|
+
|
|
10
27
|
## [7.4.0] - 2022-02-24
|
|
11
28
|
### Added
|
|
12
29
|
- Allowing @@ array variable replacement to work when wrapped in quotes [#421]
|
|
@@ -426,6 +443,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
426
443
|
[#364]: https://github.com/auth0/auth0-deploy-cli/issues/364
|
|
427
444
|
[#367]: https://github.com/auth0/auth0-deploy-cli/issues/367
|
|
428
445
|
[#379]: https://github.com/auth0/auth0-deploy-cli/issues/379
|
|
446
|
+
[#388]: https://github.com/auth0/auth0-deploy-cli/issues/388
|
|
429
447
|
[#400]: https://github.com/auth0/auth0-deploy-cli/issues/400
|
|
430
448
|
[#401]: https://github.com/auth0/auth0-deploy-cli/issues/401
|
|
431
449
|
[#403]: https://github.com/auth0/auth0-deploy-cli/issues/403
|
|
@@ -434,8 +452,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
434
452
|
[#412]: https://github.com/auth0/auth0-deploy-cli/issues/412
|
|
435
453
|
[#416]: https://github.com/auth0/auth0-deploy-cli/issues/416
|
|
436
454
|
[#421]: https://github.com/auth0/auth0-deploy-cli/issues/421
|
|
437
|
-
|
|
438
|
-
[
|
|
455
|
+
[#428]: https://github.com/auth0/auth0-deploy-cli/issues/428
|
|
456
|
+
[#430]: https://github.com/auth0/auth0-deploy-cli/issues/430
|
|
457
|
+
[#432]: https://github.com/auth0/auth0-deploy-cli/issues/432
|
|
458
|
+
[#436]: https://github.com/auth0/auth0-deploy-cli/issues/436
|
|
459
|
+
|
|
460
|
+
[Unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v7.5.2...HEAD
|
|
461
|
+
[7.5.2]: https://github.com/auth0/auth0-deploy-cli/compare/v7.5.1...v7.5.2
|
|
462
|
+
[7.5.1]: https://github.com/auth0/auth0-deploy-cli/compare/v7.5.0...v7.5.1
|
|
463
|
+
[7.5.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.4.0...v7.5.0
|
|
439
464
|
[7.4.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.3.7...v7.4.0
|
|
440
465
|
[7.3.7]: https://github.com/auth0/auth0-deploy-cli/compare/v7.3.6...v7.3.7
|
|
441
466
|
[7.3.6]: https://github.com/auth0/auth0-deploy-cli/compare/v7.3.5...v7.3.6
|
package/lib/args.js
CHANGED
|
@@ -1,86 +1,99 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.getParams =
|
|
7
|
-
|
|
8
|
-
var _yargs = require("yargs");
|
|
9
|
-
|
|
10
|
-
var _yargs2 = _interopRequireDefault(_yargs);
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getParams = void 0;
|
|
7
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
14
8
|
function getParams() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
9
|
+
const args = yargs_1.default
|
|
10
|
+
.demandCommand(1, 'A command is required')
|
|
11
|
+
.usage('Auth0 Deploy CLI')
|
|
12
|
+
.option('debug', {
|
|
13
|
+
alias: 'd',
|
|
14
|
+
describe: 'Dump extra debug information.',
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
default: false
|
|
17
|
+
})
|
|
18
|
+
.option('proxy_url', {
|
|
19
|
+
alias: 'p',
|
|
20
|
+
describe: 'A url for proxying requests, only set this if you are behind a proxy.',
|
|
21
|
+
type: 'string'
|
|
22
|
+
})
|
|
23
|
+
.command(['import', 'deploy'], 'Deploy Configuration', {
|
|
24
|
+
input_file: {
|
|
25
|
+
alias: 'i',
|
|
26
|
+
describe: 'The updates to deploy. Either a JSON file, or directory that contains the correct file layout. See README and online for more info.',
|
|
27
|
+
type: 'string',
|
|
28
|
+
demandOption: true
|
|
29
|
+
},
|
|
30
|
+
config_file: {
|
|
31
|
+
alias: 'c',
|
|
32
|
+
describe: 'The JSON configuration file.',
|
|
33
|
+
type: 'string'
|
|
34
|
+
},
|
|
35
|
+
env: {
|
|
36
|
+
alias: 'e',
|
|
37
|
+
describe: 'Override the mappings in config with environment variables.',
|
|
38
|
+
boolean: true,
|
|
39
|
+
default: true
|
|
40
|
+
},
|
|
41
|
+
secret: {
|
|
42
|
+
alias: 'x',
|
|
43
|
+
describe: 'The client secret, this allows you to encrypt the secret in your build configuration instead of storing it in a config file',
|
|
44
|
+
type: 'string'
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
.command(['export', 'dump'], 'Export Auth0 Tenant Configuration', {
|
|
48
|
+
output_folder: {
|
|
49
|
+
alias: 'o',
|
|
50
|
+
describe: 'The output directory.',
|
|
51
|
+
type: 'string',
|
|
52
|
+
demandOption: true
|
|
53
|
+
},
|
|
54
|
+
format: {
|
|
55
|
+
alias: 'f',
|
|
56
|
+
describe: 'The output format.',
|
|
57
|
+
type: 'string',
|
|
58
|
+
choices: ['yaml', 'directory'],
|
|
59
|
+
demandOption: true
|
|
60
|
+
},
|
|
61
|
+
config_file: {
|
|
62
|
+
alias: 'c',
|
|
63
|
+
describe: 'The JSON configuration file.',
|
|
64
|
+
type: 'string'
|
|
65
|
+
},
|
|
66
|
+
secret: {
|
|
67
|
+
alias: 'x',
|
|
68
|
+
describe: 'The client secret, this allows you to encrypt the secret in your build configuration instead of storing it in a config file',
|
|
69
|
+
type: 'string'
|
|
70
|
+
},
|
|
71
|
+
env: {
|
|
72
|
+
alias: 'e',
|
|
73
|
+
describe: 'Override the mappings in config with environment variables.',
|
|
74
|
+
boolean: true,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
export_ids: {
|
|
78
|
+
alias: 'e',
|
|
79
|
+
describe: 'Export identifier field for each object type.',
|
|
80
|
+
type: 'boolean',
|
|
81
|
+
default: false
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
.example('$0 export -c config.json -f yaml -o path/to/export', 'Dump Auth0 config to folder in YAML format')
|
|
85
|
+
.example('$0 export -c config.json -f directory -o path/to/export', 'Dump Auth0 config to folder in directory format')
|
|
86
|
+
.example('$0 import -c config.json -i tenant.yaml', 'Deploy Auth0 via YAML')
|
|
87
|
+
.example('$0 import -c config.json -i path/to/files', 'Deploy Auth0 via Path')
|
|
88
|
+
.example('$0 dump -c config.json -f yaml -o path/to/export', 'Dump Auth0 config to folder in YAML format')
|
|
89
|
+
.example('$0 dump -c config.json -f directory -o path/to/export', 'Dump Auth0 config to folder in directory format')
|
|
90
|
+
.example('$0 deploy -c config.json -i tenant.yaml', 'Deploy Auth0 via YAML')
|
|
91
|
+
.example('$0 deploy -c config.json -i path/to/files', 'Deploy Auth0 via Path')
|
|
92
|
+
.epilogue('See README (https://github.com/auth0/auth0-deploy-cli) for more in-depth information on configuration and setup.')
|
|
93
|
+
.wrap(null);
|
|
94
|
+
return args.argv;
|
|
81
95
|
}
|
|
82
|
-
|
|
96
|
+
exports.getParams = getParams;
|
|
83
97
|
exports.default = {
|
|
84
|
-
|
|
98
|
+
getParams
|
|
85
99
|
};
|
|
86
|
-
exports.getParams = getParams;
|
package/lib/commands/export.js
CHANGED
|
@@ -1,79 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
overrides.AUTH0_CLIENT_SECRET = secret;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (exportIds) {
|
|
60
|
-
overrides.AUTH0_EXPORT_IDENTIFIERS = exportIds;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (!(0, _utils.isDirectory)(outputFolder)) {
|
|
64
|
-
_logger2.default.info(`Creating ${outputFolder}`);
|
|
65
|
-
|
|
66
|
-
_mkdirp2.default.sync(outputFolder);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (params.format === 'yaml') {
|
|
70
|
-
overrides.AUTH0_INPUT_FILE = _path2.default.join(outputFolder, 'tenant.yaml');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
_nconf2.default.overrides(overrides);
|
|
74
|
-
|
|
75
|
-
const context = await (0, _context2.default)(_nconf2.default.get());
|
|
76
|
-
await context.dump();
|
|
77
|
-
|
|
78
|
-
_logger2.default.info('Export Successful');
|
|
79
|
-
}
|
|
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 nconf_1 = __importDefault(require("nconf"));
|
|
17
|
+
const mkdirp_1 = __importDefault(require("mkdirp"));
|
|
18
|
+
const logger_1 = __importDefault(require("../logger"));
|
|
19
|
+
const utils_1 = require("../utils");
|
|
20
|
+
const context_1 = __importDefault(require("../context"));
|
|
21
|
+
function exportCMD(params) {
|
|
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: clientSecret, env: shouldInheritEnv = false, } = params;
|
|
24
|
+
if (shouldInheritEnv) {
|
|
25
|
+
nconf_1.default.env().use('memory');
|
|
26
|
+
}
|
|
27
|
+
if (configFile) {
|
|
28
|
+
nconf_1.default.file(configFile);
|
|
29
|
+
}
|
|
30
|
+
const overrides = Object.assign({ AUTH0_INPUT_FILE: outputFolder, AUTH0_BASE_PATH: basePath, AUTH0_CONFIG_FILE: configFile }, configObj || {});
|
|
31
|
+
// Prepare configuration by initializing nconf, then passing that as the provider to the config object
|
|
32
|
+
// Allow passed in secret to override the configured one
|
|
33
|
+
if (clientSecret) {
|
|
34
|
+
overrides.AUTH0_CLIENT_SECRET = clientSecret;
|
|
35
|
+
}
|
|
36
|
+
// Allow passed in export_ids to override the configured one
|
|
37
|
+
if (exportIds) {
|
|
38
|
+
overrides.AUTH0_EXPORT_IDENTIFIERS = exportIds;
|
|
39
|
+
}
|
|
40
|
+
// Check output folder
|
|
41
|
+
if (!(0, utils_1.isDirectory)(outputFolder)) {
|
|
42
|
+
logger_1.default.info(`Creating ${outputFolder}`);
|
|
43
|
+
mkdirp_1.default.sync(outputFolder);
|
|
44
|
+
}
|
|
45
|
+
if (params.format === 'yaml') {
|
|
46
|
+
overrides.AUTH0_INPUT_FILE = path_1.default.join(outputFolder, 'tenant.yaml');
|
|
47
|
+
}
|
|
48
|
+
nconf_1.default.overrides(overrides);
|
|
49
|
+
// Setup context and load
|
|
50
|
+
const context = yield (0, context_1.default)(nconf_1.default.get());
|
|
51
|
+
yield context.dump();
|
|
52
|
+
logger_1.default.info('Export Successful');
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.default = exportCMD;
|
package/lib/commands/import.js
CHANGED
|
@@ -1,71 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
AUTH0_KEYWORD_REPLACE_MAPPINGS: {},
|
|
49
|
-
...(configObj || {})
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
if (secret) {
|
|
53
|
-
overrides.AUTH0_CLIENT_SECRET = secret;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (env) {
|
|
57
|
-
const mappings = _nconf2.default.get('AUTH0_KEYWORD_REPLACE_MAPPINGS') || {};
|
|
58
|
-
|
|
59
|
-
_nconf2.default.set('AUTH0_KEYWORD_REPLACE_MAPPINGS', Object.assign(mappings, process.env));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
_nconf2.default.overrides(overrides);
|
|
63
|
-
|
|
64
|
-
const context = await (0, _context2.default)(_nconf2.default.get());
|
|
65
|
-
await context.load();
|
|
66
|
-
const config = (0, _configFactory2.default)();
|
|
67
|
-
config.setProvider(key => _nconf2.default.get(key));
|
|
68
|
-
await (0, _tools.deploy)(context.assets, context.mgmtClient, config);
|
|
69
|
-
|
|
70
|
-
_logger2.default.info('Import Successful');
|
|
71
|
-
}
|
|
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 nconf_1 = __importDefault(require("nconf"));
|
|
16
|
+
const configFactory_1 = __importDefault(require("../configFactory"));
|
|
17
|
+
const tools_1 = require("../tools");
|
|
18
|
+
const logger_1 = __importDefault(require("../logger"));
|
|
19
|
+
const context_1 = __importDefault(require("../context"));
|
|
20
|
+
function importCMD(params) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
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
|
+
}
|
|
28
|
+
if (configFile) {
|
|
29
|
+
nconf_1.default.file(configFile);
|
|
30
|
+
}
|
|
31
|
+
const overrides = Object.assign({ AUTH0_INPUT_FILE: inputFile, AUTH0_BASE_PATH: basePath, AUTH0_CONFIG_FILE: configFile, AUTH0_KEYWORD_REPLACE_MAPPINGS: {} }, configObj || {});
|
|
32
|
+
// Prepare configuration by initializing nconf, then passing that as the provider to the config object
|
|
33
|
+
// Allow passed in secret to override the configured one
|
|
34
|
+
if (clientSecret) {
|
|
35
|
+
overrides.AUTH0_CLIENT_SECRET = clientSecret;
|
|
36
|
+
}
|
|
37
|
+
nconf_1.default.overrides(overrides);
|
|
38
|
+
// Setup context and load
|
|
39
|
+
const context = yield (0, context_1.default)(nconf_1.default.get());
|
|
40
|
+
yield context.load();
|
|
41
|
+
const config = (0, configFactory_1.default)();
|
|
42
|
+
config.setProvider((key) => nconf_1.default.get(key));
|
|
43
|
+
yield (0, tools_1.deploy)(context.assets, context.mgmtClient, config);
|
|
44
|
+
logger_1.default.info('Import Successful');
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
exports.default = importCMD;
|