@contentstack/cli-utilities 1.5.10 → 1.5.12
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/lib/auth-handler.js +1 -1
- package/lib/encrypter.js +1 -0
- package/lib/helpers.d.ts +1 -0
- package/lib/helpers.js +12 -1
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/logger.js +11 -6
- package/package.json +4 -4
package/lib/auth-handler.js
CHANGED
|
@@ -21,7 +21,7 @@ class AuthHandler {
|
|
|
21
21
|
}
|
|
22
22
|
constructor() {
|
|
23
23
|
this.checkExpiryAndRefresh = (force = false) => this.compareOAuthExpiry(force);
|
|
24
|
-
this.codeVerifier = crypto.
|
|
24
|
+
this.codeVerifier = crypto.randomBytes(32).toString('hex');
|
|
25
25
|
this.OAuthAppId = process.env.OAUTH_APP_ID || '6400aa06db64de001a31c8a9';
|
|
26
26
|
this.OAuthClientId = process.env.OAUTH_CLIENT_ID || 'Ie0FEfTzlfAHL4xM';
|
|
27
27
|
this.OAuthRedirectURL = process.env.OAUTH_APP_REDIRECT_URL || 'http://localhost:8184';
|
package/lib/encrypter.js
CHANGED
|
@@ -14,6 +14,7 @@ class NodeCrypto {
|
|
|
14
14
|
const { algorithm, encryptionKey, typeIdentifier } = (0, merge_1.default)(defaultValues, config);
|
|
15
15
|
this.algorithm = algorithm;
|
|
16
16
|
this.typeIdentifier = typeIdentifier;
|
|
17
|
+
// deepcode ignore HardcodedSecret: <please specify a reason of ignoring this>
|
|
17
18
|
this.key = crypto_1.default.scryptSync(encryptionKey, 'salt', 24);
|
|
18
19
|
}
|
|
19
20
|
encrypt(plainData) {
|
package/lib/helpers.d.ts
CHANGED
package/lib/helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isManagementTokenValid = exports.doesBranchExist = exports.isAuthenticated = void 0;
|
|
3
|
+
exports.createDeveloperHubUrl = exports.isManagementTokenValid = exports.doesBranchExist = exports.isAuthenticated = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const auth_handler_1 = tslib_1.__importDefault(require("./auth-handler"));
|
|
6
6
|
const _1 = require(".");
|
|
@@ -35,3 +35,14 @@ const isManagementTokenValid = async (stackAPIKey, managementToken) => {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
exports.isManagementTokenValid = isManagementTokenValid;
|
|
38
|
+
const createDeveloperHubUrl = (developerHubBaseUrl) => {
|
|
39
|
+
developerHubBaseUrl = developerHubBaseUrl === null || developerHubBaseUrl === void 0 ? void 0 : developerHubBaseUrl.replace('api', 'developerhub-api');
|
|
40
|
+
developerHubBaseUrl = developerHubBaseUrl.startsWith('dev11')
|
|
41
|
+
? developerHubBaseUrl.replace('dev11', 'dev')
|
|
42
|
+
: developerHubBaseUrl;
|
|
43
|
+
developerHubBaseUrl = developerHubBaseUrl.endsWith('io')
|
|
44
|
+
? developerHubBaseUrl.replace('io', 'com')
|
|
45
|
+
: developerHubBaseUrl;
|
|
46
|
+
return developerHubBaseUrl.startsWith('http') ? developerHubBaseUrl : `https://${developerHubBaseUrl}`;
|
|
47
|
+
};
|
|
48
|
+
exports.createDeveloperHubUrl = createDeveloperHubUrl;
|
package/lib/logger.js
CHANGED
|
@@ -169,7 +169,7 @@ class Logger {
|
|
|
169
169
|
* the sensitiveKeys array, and false otherwise.
|
|
170
170
|
*/
|
|
171
171
|
isSensitiveKey(keyStr) {
|
|
172
|
-
if (keyStr) {
|
|
172
|
+
if (keyStr && typeof keyStr === 'string') {
|
|
173
173
|
return this.sensitiveKeys.some((regex) => regex.test(keyStr));
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -196,11 +196,16 @@ class Logger {
|
|
|
196
196
|
* redacted.
|
|
197
197
|
*/
|
|
198
198
|
redact(obj) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
try {
|
|
200
|
+
const copy = (0, full_1.klona)(obj);
|
|
201
|
+
this.redactObject(copy);
|
|
202
|
+
const splat = copy[Symbol.for('splat')];
|
|
203
|
+
this.redactObject(splat);
|
|
204
|
+
return copy;
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
return obj;
|
|
208
|
+
}
|
|
204
209
|
}
|
|
205
210
|
/**
|
|
206
211
|
* The function checks if an object is a LogEntry by verifying if it has the properties 'level' and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-utilities",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.12",
|
|
4
4
|
"description": "Utilities for contentstack projects",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"author": "contentstack",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@contentstack/management": "~1.
|
|
35
|
+
"@contentstack/management": "~1.15.3",
|
|
36
36
|
"@contentstack/marketplace-sdk": "^1.0.1",
|
|
37
37
|
"@oclif/core": "^2.9.3",
|
|
38
38
|
"axios": "^1.6.4",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@contentstack/cli-dev-dependencies": "^1.2.4",
|
|
62
|
-
"@oclif/test": "^2.
|
|
62
|
+
"@oclif/test": "^2.5.6",
|
|
63
63
|
"@types/chai": "^4.2.18",
|
|
64
64
|
"@types/inquirer": "^9.0.3",
|
|
65
65
|
"@types/mkdirp": "^1.0.1",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"nyc": "^15.1.0",
|
|
79
79
|
"rimraf": "^2.7.1",
|
|
80
80
|
"sinon": "^15.0.1",
|
|
81
|
-
"tmp": "^0.2.
|
|
81
|
+
"tmp": "^0.2.2",
|
|
82
82
|
"ts-node": "^10.9.1",
|
|
83
83
|
"tslib": "^1.13.0",
|
|
84
84
|
"typescript": "^4.9.3"
|