auth0-deploy-cli 7.5.2 → 7.7.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.
- package/.eslintrc +7 -41
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +3 -1
- package/.prettierignore +10 -0
- package/.prettierrc.json +4 -0
- package/CHANGELOG.md +219 -7
- package/CONTRIBUTING.md +2 -2
- package/README.md +3 -0
- package/lib/args.js +16 -17
- package/lib/commands/export.js +3 -3
- package/lib/commands/import.js +7 -6
- package/lib/commands/index.js +1 -1
- package/lib/configFactory.js +5 -1
- package/lib/context/defaults.js +4 -3
- package/lib/context/directory/handlers/actions.js +6 -5
- package/lib/context/directory/handlers/attackProtection.js +10 -9
- package/lib/context/directory/handlers/branding.js +60 -0
- package/lib/context/directory/handlers/clientGrants.js +6 -4
- package/lib/context/directory/handlers/clients.js +4 -3
- package/lib/context/directory/handlers/connections.js +7 -4
- package/lib/context/directory/handlers/databases.js +30 -22
- package/lib/context/directory/handlers/emailProvider.js +6 -4
- package/lib/context/directory/handlers/emailTemplates.js +13 -11
- package/lib/context/directory/handlers/guardianFactorProviders.js +6 -4
- package/lib/context/directory/handlers/guardianFactorTemplates.js +6 -4
- package/lib/context/directory/handlers/guardianFactors.js +6 -4
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +4 -3
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +4 -3
- package/lib/context/directory/handlers/guardianPolicies.js +4 -3
- package/lib/context/directory/handlers/hooks.js +5 -4
- package/lib/context/directory/handlers/index.js +5 -2
- package/lib/context/directory/handlers/migrations.js +8 -8
- package/lib/context/directory/handlers/organizations.js +4 -3
- package/lib/context/directory/handlers/pages.js +20 -20
- package/lib/context/directory/handlers/resourceServers.js +6 -4
- package/lib/context/directory/handlers/roles.js +4 -3
- package/lib/context/directory/handlers/rules.js +5 -4
- package/lib/context/directory/handlers/rulesConfigs.js +7 -5
- package/lib/context/directory/handlers/tenant.js +7 -4
- package/lib/context/directory/handlers/triggers.js +3 -2
- package/lib/context/directory/index.js +23 -22
- package/lib/context/index.js +83 -61
- package/lib/context/yaml/handlers/actions.js +12 -8
- package/lib/context/yaml/handlers/attackProtection.js +6 -12
- package/lib/context/yaml/handlers/branding.js +66 -0
- package/lib/context/yaml/handlers/clientGrants.js +5 -4
- package/lib/context/yaml/handlers/clients.js +9 -6
- package/lib/context/yaml/handlers/connections.js +10 -7
- package/lib/context/yaml/handlers/databases.js +15 -10
- package/lib/context/yaml/handlers/emailProvider.js +7 -5
- package/lib/context/yaml/handlers/emailTemplates.js +6 -5
- package/lib/context/yaml/handlers/guardianFactorProviders.js +6 -13
- package/lib/context/yaml/handlers/guardianFactorTemplates.js +6 -13
- package/lib/context/yaml/handlers/guardianFactors.js +6 -13
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +6 -13
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +6 -13
- package/lib/context/yaml/handlers/guardianPolicies.js +6 -13
- package/lib/context/yaml/handlers/hooks.js +7 -5
- package/lib/context/yaml/handlers/index.js +5 -2
- package/lib/context/yaml/handlers/migrations.js +3 -2
- package/lib/context/yaml/handlers/organizations.js +6 -5
- package/lib/context/yaml/handlers/pages.js +6 -5
- package/lib/context/yaml/handlers/resourceServers.js +5 -4
- package/lib/context/yaml/handlers/roles.js +6 -5
- package/lib/context/yaml/handlers/rules.js +6 -5
- package/lib/context/yaml/handlers/rulesConfigs.js +6 -5
- package/lib/context/yaml/handlers/tenant.js +7 -5
- package/lib/context/yaml/handlers/triggers.js +5 -4
- package/lib/context/yaml/index.js +33 -24
- package/lib/index.js +20 -15
- package/lib/logger.js +4 -3
- package/lib/readonly.js +11 -16
- package/lib/sessionDurationsToMinutes.js +15 -0
- package/lib/tools/auth0/client.js +12 -12
- package/lib/tools/auth0/handlers/actions.js +21 -23
- package/lib/tools/auth0/handlers/attackProtection.js +14 -17
- package/lib/tools/auth0/handlers/branding.js +71 -13
- package/lib/tools/auth0/handlers/clientGrants.js +17 -10
- package/lib/tools/auth0/handlers/clients.js +15 -8
- package/lib/tools/auth0/handlers/connections.js +30 -10
- package/lib/tools/auth0/handlers/databases.js +25 -13
- package/lib/tools/auth0/handlers/default.js +46 -28
- package/lib/tools/auth0/handlers/emailTemplates.js +8 -10
- package/lib/tools/auth0/handlers/guardianFactorProviders.js +3 -3
- package/lib/tools/auth0/handlers/guardianFactorTemplates.js +3 -3
- package/lib/tools/auth0/handlers/guardianFactors.js +3 -3
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +11 -10
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +10 -9
- package/lib/tools/auth0/handlers/guardianPolicies.js +5 -4
- package/lib/tools/auth0/handlers/hooks.js +34 -21
- package/lib/tools/auth0/handlers/index.js +31 -27
- package/lib/tools/auth0/handlers/migrations.js +2 -1
- package/lib/tools/auth0/handlers/organizations.js +67 -32
- package/lib/tools/auth0/handlers/pages.js +20 -14
- package/lib/tools/auth0/handlers/prompts.js +1 -0
- package/lib/tools/auth0/handlers/resourceServers.js +28 -15
- package/lib/tools/auth0/handlers/roles.js +61 -32
- package/lib/tools/auth0/handlers/rules.js +58 -35
- package/lib/tools/auth0/handlers/rulesConfigs.js +12 -6
- package/lib/tools/auth0/handlers/tenant.js +8 -4
- package/lib/tools/auth0/handlers/triggers.js +11 -12
- package/lib/tools/auth0/index.js +15 -31
- package/lib/tools/auth0/schema.js +7 -27
- package/lib/tools/calculateChanges.js +149 -0
- package/lib/tools/constants.js +162 -154
- package/lib/tools/deploy.js +1 -1
- package/lib/tools/index.js +1 -1
- package/lib/tools/logger.js +14 -8
- package/lib/tools/utils.js +34 -150
- package/lib/tools/{ValidationError.js → validationError.js} +3 -1
- package/lib/types.js +2 -0
- package/lib/utils.js +18 -25
- package/package.json +11 -2
- package/tsconfig.json +2 -3
- package/typescript-migration-progress.sh +1 -1
package/lib/utils.js
CHANGED
|
@@ -3,27 +3,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.mapClientID2NameSorted = exports.convertClientIdToName = exports.clearClientArrays = exports.ensureProp = exports.clearTenantFlags = exports.recordsSorter = exports.formatResults = exports.
|
|
6
|
+
exports.mapClientID2NameSorted = exports.convertClientIdToName = exports.clearClientArrays = exports.ensureProp = exports.clearTenantFlags = exports.recordsSorter = exports.formatResults = exports.sanitize = exports.stripIdentifiers = exports.toConfigFn = exports.existsMustBeDir = exports.dumpJSON = exports.loadJSON = exports.getFiles = exports.isFile = exports.isDirectory = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const sanitize_filename_1 = __importDefault(require("sanitize-filename"));
|
|
10
10
|
const dot_prop_1 = __importDefault(require("dot-prop"));
|
|
11
11
|
const tools_1 = require("./tools");
|
|
12
12
|
const logger_1 = __importDefault(require("./logger"));
|
|
13
|
-
function isDirectory(
|
|
13
|
+
function isDirectory(filePath) {
|
|
14
14
|
try {
|
|
15
|
-
return fs_extra_1.default.statSync(path_1.default.resolve(
|
|
16
|
-
.isDirectory();
|
|
15
|
+
return fs_extra_1.default.statSync(path_1.default.resolve(filePath)).isDirectory();
|
|
17
16
|
}
|
|
18
17
|
catch (err) {
|
|
19
18
|
return false;
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
exports.isDirectory = isDirectory;
|
|
23
|
-
function isFile(
|
|
22
|
+
function isFile(filePath) {
|
|
24
23
|
try {
|
|
25
|
-
return fs_extra_1.default.statSync(path_1.default.resolve(
|
|
26
|
-
.isFile();
|
|
24
|
+
return fs_extra_1.default.statSync(path_1.default.resolve(filePath)).isFile();
|
|
27
25
|
}
|
|
28
26
|
catch (err) {
|
|
29
27
|
return false;
|
|
@@ -32,7 +30,8 @@ function isFile(f) {
|
|
|
32
30
|
exports.isFile = isFile;
|
|
33
31
|
function getFiles(folder, exts) {
|
|
34
32
|
if (isDirectory(folder)) {
|
|
35
|
-
return fs_extra_1.default
|
|
33
|
+
return fs_extra_1.default
|
|
34
|
+
.readdirSync(folder)
|
|
36
35
|
.map((f) => path_1.default.join(folder, f))
|
|
37
36
|
.filter((f) => isFile(f) && exts.includes(path_1.default.extname(f)));
|
|
38
37
|
}
|
|
@@ -84,7 +83,7 @@ function stripIdentifiers(auth0, assets) {
|
|
|
84
83
|
'emailTemplates',
|
|
85
84
|
'guardianFactors',
|
|
86
85
|
'guardianFactorProviders',
|
|
87
|
-
'guardianFactorTemplates'
|
|
86
|
+
'guardianFactorTemplates',
|
|
88
87
|
];
|
|
89
88
|
// Optionally Strip identifiers
|
|
90
89
|
auth0.handlers.forEach((h) => {
|
|
@@ -107,12 +106,6 @@ function sanitize(str) {
|
|
|
107
106
|
return (0, sanitize_filename_1.default)(str, { replacement: '-' });
|
|
108
107
|
}
|
|
109
108
|
exports.sanitize = sanitize;
|
|
110
|
-
function hoursAsInteger(property, hours) {
|
|
111
|
-
if (Number.isInteger(hours))
|
|
112
|
-
return { [property]: hours };
|
|
113
|
-
return { [`${property}_in_minutes`]: Math.round(hours * 60) };
|
|
114
|
-
}
|
|
115
|
-
exports.hoursAsInteger = hoursAsInteger;
|
|
116
109
|
function formatResults(item) {
|
|
117
110
|
if (typeof item !== 'object') {
|
|
118
111
|
return item;
|
|
@@ -126,10 +119,12 @@ function formatResults(item) {
|
|
|
126
119
|
strategy: null,
|
|
127
120
|
script: null,
|
|
128
121
|
stage: null,
|
|
129
|
-
id: null
|
|
122
|
+
id: null,
|
|
130
123
|
};
|
|
131
124
|
const result = Object.assign({}, importantFields);
|
|
132
|
-
Object.entries(item)
|
|
125
|
+
Object.entries(item)
|
|
126
|
+
.sort()
|
|
127
|
+
.forEach(([key, value]) => {
|
|
133
128
|
result[key] = value;
|
|
134
129
|
});
|
|
135
130
|
Object.keys(importantFields).forEach((key) => {
|
|
@@ -140,12 +135,7 @@ function formatResults(item) {
|
|
|
140
135
|
}
|
|
141
136
|
exports.formatResults = formatResults;
|
|
142
137
|
function recordsSorter(a, b) {
|
|
143
|
-
const importantFields = [
|
|
144
|
-
'name',
|
|
145
|
-
'key',
|
|
146
|
-
'client_id',
|
|
147
|
-
'template'
|
|
148
|
-
];
|
|
138
|
+
const importantFields = ['name', 'key', 'client_id', 'template'];
|
|
149
139
|
for (let i = 0; i < importantFields.length; i += 1) {
|
|
150
140
|
const key = importantFields[i];
|
|
151
141
|
if (a[key] && b[key]) {
|
|
@@ -161,7 +151,8 @@ function clearTenantFlags(tenant) {
|
|
|
161
151
|
}
|
|
162
152
|
}
|
|
163
153
|
exports.clearTenantFlags = clearTenantFlags;
|
|
164
|
-
function ensureProp(obj, props
|
|
154
|
+
function ensureProp(obj, props) {
|
|
155
|
+
const value = '';
|
|
165
156
|
if (!dot_prop_1.default.has(obj, props)) {
|
|
166
157
|
dot_prop_1.default.set(obj, props, value);
|
|
167
158
|
}
|
|
@@ -169,8 +160,10 @@ function ensureProp(obj, props, value = '') {
|
|
|
169
160
|
exports.ensureProp = ensureProp;
|
|
170
161
|
function clearClientArrays(client) {
|
|
171
162
|
const propsToClear = ['allowed_clients', 'allowed_logout_urls', 'allowed_origins', 'callbacks'];
|
|
163
|
+
//If designated properties are null, set them as empty arrays instead
|
|
172
164
|
Object.keys(client).forEach((prop) => {
|
|
173
165
|
if (propsToClear.indexOf(prop) >= 0 && !client[prop]) {
|
|
166
|
+
//TODO: understand why setting as empty array instead of deleting null prop. Ex: `delete client[prop]`
|
|
174
167
|
client[prop] = [];
|
|
175
168
|
}
|
|
176
169
|
});
|
|
@@ -189,7 +182,7 @@ function convertClientIdToName(clientId, knownClients = []) {
|
|
|
189
182
|
exports.convertClientIdToName = convertClientIdToName;
|
|
190
183
|
function mapClientID2NameSorted(enabledClients, knownClients) {
|
|
191
184
|
return [
|
|
192
|
-
...(enabledClients || []).map((clientId) => convertClientIdToName(clientId, knownClients))
|
|
185
|
+
...(enabledClients || []).map((clientId) => convertClientIdToName(clientId, knownClients)),
|
|
193
186
|
].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
|
194
187
|
}
|
|
195
188
|
exports.mapClientID2NameSorted = mapClientID2NameSorted;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth0-deploy-cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.1",
|
|
4
4
|
"description": "A command line tool for deploying updates to your Auth0 tenant",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"lint:fix": "eslint --fix --ignore-path .eslintignore --ignore-pattern webpack . && kacl lint",
|
|
11
11
|
"lint": "eslint --ignore-path .eslintignore --ignore-pattern webpack . && kacl lint",
|
|
12
|
+
"format": "npx prettier --write .",
|
|
12
13
|
"pretest": "rimraf ./.nyc_output",
|
|
13
|
-
"test": "ts-mocha -p tsconfig.json --recursive 'test/**/*.test
|
|
14
|
+
"test": "ts-mocha -p tsconfig.json --recursive 'test/**/*.test*'",
|
|
14
15
|
"build": "rimraf ./lib && npx tsc",
|
|
15
16
|
"dev": "npx tsc --watch",
|
|
16
17
|
"prepare": "npm run build",
|
|
@@ -29,6 +30,9 @@
|
|
|
29
30
|
"readme": "README.md",
|
|
30
31
|
"homepage": "https://github.com/auth0/auth0-deploy-cli#readme",
|
|
31
32
|
"dependencies": {
|
|
33
|
+
"@types/lodash": "^4.14.181",
|
|
34
|
+
"@types/nconf": "^0.10.2",
|
|
35
|
+
"@types/winston": "^2.4.4",
|
|
32
36
|
"ajv": "^6.12.6",
|
|
33
37
|
"auth0": "^2.40.0",
|
|
34
38
|
"dot-prop": "^5.2.0",
|
|
@@ -40,6 +44,8 @@
|
|
|
40
44
|
"nconf": "^0.11.0",
|
|
41
45
|
"promise-pool-executor": "^1.1.1",
|
|
42
46
|
"sanitize-filename": "^1.6.1",
|
|
47
|
+
"sinon": "^13.0.1",
|
|
48
|
+
"sinon-chai": "^3.7.0",
|
|
43
49
|
"winston": "^2.3.0",
|
|
44
50
|
"yargs": "^15.3.1"
|
|
45
51
|
},
|
|
@@ -52,11 +58,14 @@
|
|
|
52
58
|
"cross-env": "^3.1.4",
|
|
53
59
|
"eslint": "^7.28.0",
|
|
54
60
|
"eslint-config-airbnb-base": "^14.2.1",
|
|
61
|
+
"eslint-config-prettier": "^8.5.0",
|
|
55
62
|
"eslint-plugin-import": "^2.20.2",
|
|
56
63
|
"husky": "^7.0.4",
|
|
57
64
|
"kacl": "^1.1.1",
|
|
58
65
|
"mocha": "^9.1.3",
|
|
59
66
|
"nyc": "^15.0.1",
|
|
67
|
+
"prettier": "^2.6.1",
|
|
68
|
+
"pretty-quick": "^3.1.3",
|
|
60
69
|
"rimraf": "^3.0.2",
|
|
61
70
|
"rmdir-sync": "^1.0.1",
|
|
62
71
|
"ts-mocha": "^9.0.2",
|
package/tsconfig.json
CHANGED
|
@@ -17,6 +17,6 @@ numJsFiles=$(find ./src -name "*.js" | wc -l | xargs)
|
|
|
17
17
|
totalNumFiles=$(expr ${numTsFiles} + ${numJsFiles})
|
|
18
18
|
percentFilesMigrated=$(expr $(expr ${numTsFiles} \* 100) / ${totalNumFiles})
|
|
19
19
|
|
|
20
|
-
echo "${numTsFiles} of ${
|
|
20
|
+
echo "${numTsFiles} of ${totalNumFiles} (${percentFilesMigrated}%) files migrated to Typescript"
|
|
21
21
|
|
|
22
22
|
echo "- - - - - - - - - - - - - - - - - - - - - -"
|