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.
- 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 +209 -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 +7 -6
- 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 +66 -62
- 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 +6 -6
- 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 +24 -12
- package/lib/tools/auth0/handlers/default.js +47 -29
- 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 +55 -32
- 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 +3 -144
- package/lib/tools/{ValidationError.js → validationError.js} +3 -1
- package/lib/types.js +2 -0
- package/lib/utils.js +12 -22
- package/package.json +9 -2
- package/tsconfig.json +2 -3
- package/typescript-migration-progress.sh +1 -1
package/lib/tools/deploy.js
CHANGED
package/lib/tools/index.js
CHANGED
package/lib/tools/logger.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
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
|
+
const winston_1 = __importDefault(require("winston"));
|
|
7
|
+
//@ts-ignore because emitErrs is still supported
|
|
8
|
+
winston_1.default.emitErrs = true;
|
|
9
|
+
const logger = new winston_1.default.Logger({
|
|
4
10
|
transports: [
|
|
5
|
-
new
|
|
11
|
+
new winston_1.default.transports.Console({
|
|
6
12
|
timestamp: true,
|
|
7
13
|
level: 'info',
|
|
8
14
|
handleExceptions: true,
|
|
9
15
|
json: false,
|
|
10
|
-
colorize: true
|
|
11
|
-
})
|
|
16
|
+
colorize: true,
|
|
17
|
+
}),
|
|
12
18
|
],
|
|
13
|
-
exitOnError: false
|
|
19
|
+
exitOnError: false,
|
|
14
20
|
});
|
|
15
|
-
|
|
21
|
+
exports.default = logger;
|
package/lib/tools/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.areArraysEquals = exports.filterExcluded = exports.duplicateItems = exports.getEnabledClients = exports.stripFields = exports.
|
|
6
|
+
exports.areArraysEquals = exports.filterExcluded = exports.duplicateItems = exports.getEnabledClients = exports.stripFields = exports.dumpJSON = exports.flatten = exports.loadFileAndReplaceKeywords = exports.convertClientNamesToIds = exports.convertClientNameToId = exports.keywordReplace = exports.keywordStringReplace = exports.keywordArrayReplace = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const dot_prop_1 = __importDefault(require("dot-prop"));
|
|
@@ -80,147 +80,6 @@ function dumpJSON(obj, spacing = 0) {
|
|
|
80
80
|
return JSON.stringify(obj, null, spacing);
|
|
81
81
|
}
|
|
82
82
|
exports.dumpJSON = dumpJSON;
|
|
83
|
-
/**
|
|
84
|
-
* @template T
|
|
85
|
-
* @param {typeof import('./auth0/handlers/default').default} handler
|
|
86
|
-
* @param {T} desiredAssetState
|
|
87
|
-
* @param {T} currentAssetState
|
|
88
|
-
* @param {string[]} [objectFields=[]]
|
|
89
|
-
* @param {boolean} [allowDelete=false]
|
|
90
|
-
* @returns T
|
|
91
|
-
*/
|
|
92
|
-
function processChangedObjectFields({ handler, desiredAssetState, currentAssetState, allowDelete = false }) {
|
|
93
|
-
const desiredAssetStateWithChanges = Object.assign({}, desiredAssetState);
|
|
94
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
95
|
-
for (const fieldName of handler.objectFields) {
|
|
96
|
-
const areDesiredStateAndCurrentStateEmpty = Object.keys(desiredAssetState[fieldName] || {}).length === 0 && Object.keys(currentAssetState[fieldName] || {}).length === 0;
|
|
97
|
-
if (areDesiredStateAndCurrentStateEmpty) {
|
|
98
|
-
// If both the desired state and current state for a given object is empty, it is a no-op and can skip
|
|
99
|
-
// eslint-disable-next-line no-continue
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
// A desired state that omits the objectField OR that has it as an empty object should
|
|
103
|
-
// signal that all fields should be removed (subject to ALLOW_DELETE).
|
|
104
|
-
if (desiredAssetState[fieldName] && Object.keys(desiredAssetState[fieldName]).length) {
|
|
105
|
-
// Both the current and desired state have the object field. Here's where we need to map
|
|
106
|
-
// to the APIv2 protocol of setting `null` values for deleted fields.
|
|
107
|
-
// For new and modified properties of the object field, we can just pass them through to
|
|
108
|
-
// APIv2.
|
|
109
|
-
if (currentAssetState[fieldName]) {
|
|
110
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
111
|
-
for (const currentObjectFieldPropertyName of Object.keys(currentAssetState[fieldName])) {
|
|
112
|
-
// Loop through each object property that exists currently
|
|
113
|
-
if (desiredAssetState[fieldName][currentObjectFieldPropertyName] === undefined) {
|
|
114
|
-
// If the object has a property that exists now but doesn't exist in the proposed state
|
|
115
|
-
if (allowDelete) {
|
|
116
|
-
desiredAssetStateWithChanges[fieldName][currentObjectFieldPropertyName] = null;
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
// If deletes aren't allowed, do outright delete the property within the object
|
|
120
|
-
logger_1.default.warn(`Detected that the ${fieldName} of the following ${handler.name || handler.id || ''} should be deleted. Doing so may be destructive.\nYou can enable deletes by setting 'AUTH0_ALLOW_DELETE' to true in the config\n${handler.objString(currentAssetState)}`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
else if (allowDelete) {
|
|
127
|
-
// If the desired state does not have the object field and the current state does, we
|
|
128
|
-
// should mark *all* properties for deletion by specifying an empty object.
|
|
129
|
-
//
|
|
130
|
-
// See: https://auth0.com/docs/users/metadata/manage-metadata-api#delete-user-metadata
|
|
131
|
-
desiredAssetStateWithChanges[fieldName] = {};
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
delete desiredAssetStateWithChanges[fieldName];
|
|
135
|
-
logger_1.default.warn(`Detected that the ${fieldName} of the following ${handler.name || handler.id || ''} should be emptied. Doing so may be destructive.\nYou can enable deletes by setting 'AUTH0_ALLOW_DELETE' to true in the config\n${handler.objString(currentAssetState)}`);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return desiredAssetStateWithChanges;
|
|
139
|
-
}
|
|
140
|
-
exports.processChangedObjectFields = processChangedObjectFields;
|
|
141
|
-
function calcChanges(handler, assets, existing, identifiers = ['id', 'name'], allowDelete = false) {
|
|
142
|
-
// Calculate the changes required between two sets of assets.
|
|
143
|
-
const update = [];
|
|
144
|
-
let del = [...existing];
|
|
145
|
-
let create = [...assets];
|
|
146
|
-
const conflicts = [];
|
|
147
|
-
const findByKeyValue = (key, value, arr) => arr.find((e) => {
|
|
148
|
-
if (Array.isArray(key)) {
|
|
149
|
-
const values = key.map((k) => e[k]);
|
|
150
|
-
if (values.every((v) => v)) {
|
|
151
|
-
return value === values.join('-');
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
return e[key] === value;
|
|
156
|
-
}
|
|
157
|
-
return false;
|
|
158
|
-
});
|
|
159
|
-
const processAssets = (id, arr) => {
|
|
160
|
-
arr.forEach((asset) => {
|
|
161
|
-
let assetIdValue;
|
|
162
|
-
if (Array.isArray(id)) {
|
|
163
|
-
const values = id.map((i) => asset[i]);
|
|
164
|
-
if (values.every((v) => v)) {
|
|
165
|
-
assetIdValue = values.join('-');
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
assetIdValue = asset[id];
|
|
170
|
-
}
|
|
171
|
-
if (assetIdValue) {
|
|
172
|
-
const found = findByKeyValue(id, assetIdValue, del);
|
|
173
|
-
if (found) {
|
|
174
|
-
// Delete from existing
|
|
175
|
-
del = del.filter((e) => e !== found);
|
|
176
|
-
// Delete from create as it's an update
|
|
177
|
-
create = create.filter((e) => e !== asset);
|
|
178
|
-
// Append identifiers to asset
|
|
179
|
-
update.push(Object.assign(Object.assign({}, identifiers.reduce((obj, i) => {
|
|
180
|
-
if (found[i])
|
|
181
|
-
obj[i] = found[i];
|
|
182
|
-
return obj;
|
|
183
|
-
}, {})), (handler.objectFields.length
|
|
184
|
-
? processChangedObjectFields({
|
|
185
|
-
handler, desiredAssetState: asset, currentAssetState: found, allowDelete
|
|
186
|
-
})
|
|
187
|
-
: asset)));
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
};
|
|
192
|
-
// Loop through identifiers (in order) to try match assets to existing
|
|
193
|
-
// If existing then update if not create
|
|
194
|
-
// The remainder will be deleted
|
|
195
|
-
for (const id of identifiers) { // eslint-disable-line
|
|
196
|
-
processAssets(id, [...create]);
|
|
197
|
-
}
|
|
198
|
-
// Check if there are assets with names that will conflict with existing names during the update process
|
|
199
|
-
// This will rename those assets to a temp random name first
|
|
200
|
-
// This assumes the first identifiers is the unique identifier
|
|
201
|
-
if (identifiers.includes('name')) {
|
|
202
|
-
const uniqueID = identifiers[0];
|
|
203
|
-
const futureAssets = [...create, ...update];
|
|
204
|
-
futureAssets.forEach((a) => {
|
|
205
|
-
// If the conflicting item is going to be deleted then skip
|
|
206
|
-
const inDeleted = del.filter((e) => e.name === a.name && e[uniqueID] !== a[uniqueID])[0];
|
|
207
|
-
if (!inDeleted) {
|
|
208
|
-
const conflict = existing.filter((e) => e.name === a.name && e[uniqueID] !== a[uniqueID])[0];
|
|
209
|
-
if (conflict) {
|
|
210
|
-
const temp = Math.random().toString(36).substr(2, 5);
|
|
211
|
-
conflicts.push(Object.assign(Object.assign({}, conflict), { name: `${conflict.name}-${temp}` }));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
return {
|
|
217
|
-
del,
|
|
218
|
-
update,
|
|
219
|
-
conflicts,
|
|
220
|
-
create
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
exports.calcChanges = calcChanges;
|
|
224
83
|
function stripFields(obj, fields) {
|
|
225
84
|
// Strip object fields supporting dot notation (ie: a.deep.field)
|
|
226
85
|
const stripped = [];
|
|
@@ -243,7 +102,7 @@ function getEnabledClients(assets, connection, existing, clients) {
|
|
|
243
102
|
const excludedClientsByNames = (assets.exclude && assets.exclude.clients) || [];
|
|
244
103
|
const excludedClients = convertClientNamesToIds(excludedClientsByNames, clients);
|
|
245
104
|
const enabledClients = [
|
|
246
|
-
...convertClientNamesToIds(connection.enabled_clients || [], clients).filter((item) => ![...excludedClientsByNames, ...excludedClients].includes(item))
|
|
105
|
+
...convertClientNamesToIds(connection.enabled_clients || [], clients).filter((item) => ![...excludedClientsByNames, ...excludedClients].includes(item)),
|
|
247
106
|
];
|
|
248
107
|
// If client is excluded and in the existing connection this client is enabled, it should keep enabled
|
|
249
108
|
// If client is excluded and in the existing connection this client is disabled, it should keep disabled
|
|
@@ -283,7 +142,7 @@ function filterExcluded(changes, exclude) {
|
|
|
283
142
|
del: filter(del),
|
|
284
143
|
update: filter(update),
|
|
285
144
|
create: filter(create),
|
|
286
|
-
conflicts: filter(conflicts)
|
|
145
|
+
conflicts: filter(conflicts),
|
|
287
146
|
};
|
|
288
147
|
}
|
|
289
148
|
exports.filterExcluded = filterExcluded;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
function ValidationError(message) {
|
|
2
4
|
Error.call(this, message);
|
|
3
5
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -9,4 +11,4 @@ function ValidationError(message) {
|
|
|
9
11
|
}
|
|
10
12
|
ValidationError.prototype = Object.create(Error.prototype);
|
|
11
13
|
ValidationError.prototype.constructor = ValidationError;
|
|
12
|
-
|
|
14
|
+
exports.default = ValidationError;
|
package/lib/types.js
ADDED
package/lib/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ 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"));
|
|
@@ -12,8 +12,7 @@ const tools_1 = require("./tools");
|
|
|
12
12
|
const logger_1 = __importDefault(require("./logger"));
|
|
13
13
|
function isDirectory(f) {
|
|
14
14
|
try {
|
|
15
|
-
return fs_extra_1.default.statSync(path_1.default.resolve(f))
|
|
16
|
-
.isDirectory();
|
|
15
|
+
return fs_extra_1.default.statSync(path_1.default.resolve(f)).isDirectory();
|
|
17
16
|
}
|
|
18
17
|
catch (err) {
|
|
19
18
|
return false;
|
|
@@ -22,8 +21,7 @@ function isDirectory(f) {
|
|
|
22
21
|
exports.isDirectory = isDirectory;
|
|
23
22
|
function isFile(f) {
|
|
24
23
|
try {
|
|
25
|
-
return fs_extra_1.default.statSync(path_1.default.resolve(f))
|
|
26
|
-
.isFile();
|
|
24
|
+
return fs_extra_1.default.statSync(path_1.default.resolve(f)).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]) {
|
|
@@ -189,7 +179,7 @@ function convertClientIdToName(clientId, knownClients = []) {
|
|
|
189
179
|
exports.convertClientIdToName = convertClientIdToName;
|
|
190
180
|
function mapClientID2NameSorted(enabledClients, knownClients) {
|
|
191
181
|
return [
|
|
192
|
-
...(enabledClients || []).map((clientId) => convertClientIdToName(clientId, knownClients))
|
|
182
|
+
...(enabledClients || []).map((clientId) => convertClientIdToName(clientId, knownClients)),
|
|
193
183
|
].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
|
194
184
|
}
|
|
195
185
|
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.0",
|
|
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",
|
|
@@ -52,11 +56,14 @@
|
|
|
52
56
|
"cross-env": "^3.1.4",
|
|
53
57
|
"eslint": "^7.28.0",
|
|
54
58
|
"eslint-config-airbnb-base": "^14.2.1",
|
|
59
|
+
"eslint-config-prettier": "^8.5.0",
|
|
55
60
|
"eslint-plugin-import": "^2.20.2",
|
|
56
61
|
"husky": "^7.0.4",
|
|
57
62
|
"kacl": "^1.1.1",
|
|
58
63
|
"mocha": "^9.1.3",
|
|
59
64
|
"nyc": "^15.0.1",
|
|
65
|
+
"prettier": "^2.6.1",
|
|
66
|
+
"pretty-quick": "^3.1.3",
|
|
60
67
|
"rimraf": "^3.0.2",
|
|
61
68
|
"rmdir-sync": "^1.0.1",
|
|
62
69
|
"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 "- - - - - - - - - - - - - - - - - - - - - -"
|