Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bin/pos-cli-data-clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const confirmCleanup = async (autoConfirm, includeSchema, url) => {
try {
let schemaText = includeSchema ? 'and database schemas ' : '';

logger.Warn('');
logger.Warn(`WARNING!!! You are going to REMOVE your data ${schemaText}from instance: ${url}`);
logger.Warn('There is no coming back.');
logger.Warn('');
await logger.Warn('');
await logger.Warn(`WARNING!!! You are going to REMOVE your data ${schemaText}from instance: ${url}`);
await logger.Warn('There is no coming back.');
await logger.Warn('');

const message = `If you still want to continue please type: '${confirmationText}' `;
const response = await prompts({ type: 'text', name: 'confirmation', message: message });
Expand Down
7 changes: 4 additions & 3 deletions bin/pos-cli-generate-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
import { program } from '../lib/program.js';
import glob from 'fast-glob';
import table from 'text-table';
import logger from '../lib/logger.js';

program
.name('pos-cli generate')
.description('List available generators')
.action(async () => {
const files = await glob('**/generators/*/index.js');
if (files.length > 0) {
console.log('List of available generators:');
await logger.Info('List of available generators:');
const generators = files.map((file) => {
const generatorPath = file.replace('/index.js', '');
const generatorName = generatorPath.split('/').pop();
return [generatorName, `pos-cli generate run ${generatorPath} --generator-help`];
});
console.log(table(generators));
await logger.Print(table(generators) + '\n');
} else {
console.log("Can't find any generators");
await logger.Info("Can't find any generators");
}

});
Expand Down
4 changes: 2 additions & 2 deletions bin/pos-cli-generate-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const confirmInstallation = async (packageRoot, pkg, autoConfirm) => {

const packageJsonPath = path.join(packageRoot, 'package.json');

const lines = ['\nGenerator dependencies need to be installed:'];
const lines = ['Generator dependencies need to be installed:'];
lines.push(` Package: ${pkg.name || 'unnamed'}`);
lines.push(` Location: ${packageJsonPath}`);

Expand All @@ -133,7 +133,7 @@ const confirmInstallation = async (packageRoot, pkg, autoConfirm) => {

lines.push('');

console.log(lines.join('\n'));
await logger.Info(lines.join('\n'));

try {
const answer = await confirm({
Expand Down
2 changes: 1 addition & 1 deletion bin/pos-cli-logsv2-reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ program
const response = await client.searchSQLByQuery(report);

if (!program.json)
search.printReport(response, report);
await search.printReport(response, report);
else
console.log(JSON.stringify(response));

Expand Down
6 changes: 3 additions & 3 deletions lib/productionEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const isProductionEnvironment = (environment) => {
};

const confirmProductionExecution = async (environment) => {
logger.Warn(`WARNING: You are executing on a production environment: ${environment}`);
logger.Warn('This could potentially modify production data or cause unintended side effects.');
logger.Warn('');
await logger.Warn(`WARNING: You are executing on a production environment: ${environment}`);
await logger.Warn('This could potentially modify production data or cause unintended side effects.');
await logger.Warn('');

const response = await prompts({
type: 'confirm',
Expand Down
9 changes: 5 additions & 4 deletions lib/swagger-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import logger from '../lib/logger.js';
import ServerError from '../lib/ServerError.js';
import api from './logsv2/http.js';
import fs from 'fs';
import chalk from 'chalk';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Expand Down Expand Up @@ -252,18 +253,18 @@ const search = {
.forEach(search.printLog);
},
printLog(hit) {
console.log(search.formatHit(hit));
logger.Print(search.formatHit(hit) + '\n');
},
formatHit([_id, hit]) {
const row = `[${search.toDate(hit._timestamp)}] ${hit._timestamp} ${hit.type} | ${hit.message}`;
if (hit.highlight) {
return row.blue;
return chalk.blue(row);
} else {
return row;
}
},
printReport(response, report) {
console.log(report.meta.title);
async printReport(response, report) {
await logger.Info(report.meta.title);
if (response.aggs)
console.table(
Object.entries(response.aggs.histogram).map((r) => {
Expand Down
Loading