@hahnpro/flow-cli 2.14.3 → 2.15.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/lib/auth.mjs +7 -2
- package/lib/cli.mjs +8 -8
- package/lib/utils.mjs +4 -4
- package/package.json +14 -14
package/lib/auth.mjs
CHANGED
|
@@ -43,8 +43,12 @@ export async function getAccessToken(baseUrl = BASE_URL, realm = REALM) {
|
|
|
43
43
|
? new Promise(async (resolve, reject) => {
|
|
44
44
|
try {
|
|
45
45
|
const kcIssuer = await openidClient.Issuer.discover(`${baseUrl}/auth/realms/${realm}/`);
|
|
46
|
-
const client = new kcIssuer.Client({
|
|
47
|
-
|
|
46
|
+
const client = new kcIssuer.Client({
|
|
47
|
+
client_id: CLIENT_ID,
|
|
48
|
+
client_secret: CLIENT_SECRET,
|
|
49
|
+
token_endpoint_auth_method: 'client_secret_jwt',
|
|
50
|
+
});
|
|
51
|
+
tokenSet = await client.grant({ grant_type: 'client_credentials' });
|
|
48
52
|
|
|
49
53
|
nconf.set(baseUrl.replace(/:/g, ''), tokenSet);
|
|
50
54
|
nconf.save((error) => {
|
|
@@ -85,6 +89,7 @@ export function login(baseUrl = BASE_URL, realm = REALM) {
|
|
|
85
89
|
const auhtUrl = client.authorizationUrl({ code_challenge, code_challenge_method: 'S256' });
|
|
86
90
|
|
|
87
91
|
const app = express();
|
|
92
|
+
app.disable('x-powered-by');
|
|
88
93
|
app.use(express.static(viewsPath));
|
|
89
94
|
app.set('views', viewsPath);
|
|
90
95
|
|
package/lib/cli.mjs
CHANGED
|
@@ -628,9 +628,9 @@ function zipDirectory(source, out) {
|
|
|
628
628
|
});
|
|
629
629
|
}
|
|
630
630
|
|
|
631
|
-
function deleteFile(
|
|
631
|
+
function deleteFile(filePath) {
|
|
632
632
|
return new Promise((resolve, reject) => {
|
|
633
|
-
fs.unlink(
|
|
633
|
+
fs.unlink(filePath, (error) => {
|
|
634
634
|
if (error) return reject(error);
|
|
635
635
|
return resolve();
|
|
636
636
|
});
|
|
@@ -737,20 +737,20 @@ function checkIfAll(projectName) {
|
|
|
737
737
|
return false;
|
|
738
738
|
}
|
|
739
739
|
|
|
740
|
-
function readJson(
|
|
740
|
+
function readJson(filePath) {
|
|
741
741
|
return new Promise((resolve, reject) => {
|
|
742
|
-
fs.readFile(
|
|
742
|
+
fs.readFile(filePath, { encoding: 'utf8' }, (error, data) => {
|
|
743
743
|
if (error) return reject(error);
|
|
744
744
|
try {
|
|
745
745
|
return resolve(JSON.parse(data));
|
|
746
|
-
} catch (
|
|
747
|
-
return reject(
|
|
746
|
+
} catch (error_) {
|
|
747
|
+
return reject(error_);
|
|
748
748
|
}
|
|
749
749
|
});
|
|
750
750
|
});
|
|
751
751
|
}
|
|
752
752
|
|
|
753
|
-
function writeJson(
|
|
753
|
+
function writeJson(filePath, data) {
|
|
754
754
|
return new Promise((resolve, reject) => {
|
|
755
755
|
let dataString;
|
|
756
756
|
try {
|
|
@@ -758,7 +758,7 @@ function writeJson(path, data) {
|
|
|
758
758
|
} catch (error) {
|
|
759
759
|
return reject(error);
|
|
760
760
|
}
|
|
761
|
-
fs.writeFile(
|
|
761
|
+
fs.writeFile(filePath, dataString, (error) => {
|
|
762
762
|
if (error) return reject(error);
|
|
763
763
|
return resolve();
|
|
764
764
|
});
|
package/lib/utils.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const defaultLogger = {
|
|
|
10
10
|
/* eslint-enable no-console */
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export function checkTypes(definedTypes, propertiesSchema, jsonPath,
|
|
13
|
+
export function checkTypes(definedTypes, propertiesSchema, jsonPath, logger1 = defaultLogger) {
|
|
14
14
|
const knownTypes = new Set([
|
|
15
15
|
...definedTypes,
|
|
16
16
|
'string',
|
|
@@ -32,7 +32,7 @@ export function checkTypes(definedTypes, propertiesSchema, jsonPath, logger = de
|
|
|
32
32
|
const properties = propertiesSchema.properties || {};
|
|
33
33
|
for (const property of Object.keys(properties)) {
|
|
34
34
|
if (properties[property].type && !knownTypes.has(properties[property].type)) {
|
|
35
|
-
|
|
35
|
+
logger1.error(
|
|
36
36
|
`ERROR: unknown type ${properties[property].type}.
|
|
37
37
|
Please add a schema for this type in ${jsonPath}
|
|
38
38
|
for more info check the documentation`,
|
|
@@ -52,12 +52,12 @@ export async function getTypes(filePath) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export async function handleConvertedOutput(result, jsonPath, json,
|
|
55
|
+
export async function handleConvertedOutput(result, jsonPath, json, logger1 = defaultLogger) {
|
|
56
56
|
let schema;
|
|
57
57
|
try {
|
|
58
58
|
schema = JSON.parse(result);
|
|
59
59
|
} catch {
|
|
60
|
-
|
|
60
|
+
logger1.error(result);
|
|
61
61
|
return json;
|
|
62
62
|
}
|
|
63
63
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hahnpro/flow-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "CLI for managing Flow Modules",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"chalk": "^5.0.1",
|
|
32
32
|
"class-transformer": "0.5.1",
|
|
33
33
|
"class-validator": "~0.13.2",
|
|
34
|
-
"class-validator-jsonschema": "^3.1.
|
|
35
|
-
"commander": "^9.
|
|
34
|
+
"class-validator-jsonschema": "^3.1.1",
|
|
35
|
+
"commander": "^9.4.0",
|
|
36
36
|
"copyfiles": "^2.4.1",
|
|
37
37
|
"dotenv": "^16.0.1",
|
|
38
38
|
"ejs": "^3.1.8",
|
|
@@ -44,21 +44,21 @@
|
|
|
44
44
|
"https-proxy-agent": "^5.0.1",
|
|
45
45
|
"nconf": "^0.12.0",
|
|
46
46
|
"open": "^8.4.0",
|
|
47
|
-
"openid-client": "^5.1.
|
|
48
|
-
"ora": "^6.1.
|
|
47
|
+
"openid-client": "^5.1.8",
|
|
48
|
+
"ora": "^6.1.2",
|
|
49
49
|
"reflect-metadata": "^0.1.13",
|
|
50
|
-
"ts-node": "^10.
|
|
50
|
+
"ts-node": "^10.9.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/express": "^4.17.13",
|
|
54
|
-
"@types/jest": "^
|
|
55
|
-
"@types/nconf": "^0.10.
|
|
56
|
-
"@types/node": "^16.11.
|
|
57
|
-
"eslint": "^8.
|
|
58
|
-
"eslint-plugin-unicorn": "^
|
|
59
|
-
"jest": "^28.1.
|
|
60
|
-
"prettier": "^2.
|
|
61
|
-
"typescript": "^4.7.
|
|
54
|
+
"@types/jest": "^28.1.6",
|
|
55
|
+
"@types/nconf": "^0.10.3",
|
|
56
|
+
"@types/node": "^16.11.45",
|
|
57
|
+
"eslint": "^8.20.0",
|
|
58
|
+
"eslint-plugin-unicorn": "^43.0.2",
|
|
59
|
+
"jest": "^28.1.3",
|
|
60
|
+
"prettier": "^2.7.1",
|
|
61
|
+
"typescript": "^4.7.4"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": "^14.13.1 || >=16.0.0"
|