Socket
Socket
Sign inDemoInstall

@teqed/interact-ibmi

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teqed/interact-ibmi - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

4

build/main.js

@@ -11,6 +11,6 @@ #! /usr/bin/env node

import mainMenu from './menu/main/menu-main.js';
import { welcome } from './util.js';
// import { welcome } from './util.js';
const start = async () => {
try {
await welcome();
// await welcome();
await login();

@@ -17,0 +17,0 @@ await diagnoseUsers();

@@ -44,51 +44,70 @@ import chalk from 'chalk';

// and users.INITIAL_PROGRAM_LIBRARY_NAME on foundUserDiagnostics.
const initialProgramNamePopularAndLibrary = foundUserDiagnostics
.map(user => [user.INITIAL_PROGRAM_NAME, user.INITIAL_PROGRAM_LIBRARY_NAME])
.filter(initialProgramName => initialProgramName[0] !== null && initialProgramName[1] !== null)
// eslint-disable-next-line unicorn/no-array-reduce
.reduce((accumulator, initialProgramName) => {
if (accumulator.has(initialProgramName)) {
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
accumulator.set(initialProgramName, accumulator.get(initialProgramName) + 1);
// Use a for each loop.
// Create an object with the keys being the combination of INITIAL_PROGRAM_NAME and INITIAL_PROGRAM_LIBRARY_NAME
// and the values being the number of times that combination appears.
// Use the object to find the 3 most popular INITIAL_PROGRAM_NAME and INITIAL_PROGRAM_LIBRARY_NAME combinations.
// Log a message listing the 3 most popular INITIAL_PROGRAM_NAME and INITIAL_PROGRAM_LIBRARY_NAME combinations,
// and how many times they appear.
// Create an object with the keys being the combination of INITIAL_PROGRAM_NAME and INITIAL_PROGRAM_LIBRARY_NAME
// and the values being the number of times that combination appears.
const initialProgramAndLibrary = {};
foundUserDiagnostics.forEach(user => {
const key = `${user.INITIAL_PROGRAM_NAME} ${user.INITIAL_PROGRAM_LIBRARY_NAME}`;
if (initialProgramAndLibrary[key]) {
initialProgramAndLibrary[key] += 1;
}
else {
accumulator.set(initialProgramName, 1);
initialProgramAndLibrary[key] = 1;
}
return accumulator;
}, new Map());
console.log(chalk.yellow(`The most popular initial programs are: `));
initialProgramNamePopularAndLibrary.forEach((count, initialProgramName) => {
console.log(
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
chalk.blue(`${initialProgramName[1]}/${initialProgramName[0]} used by ${count}`));
});
// Find the 3 most popular combination of values for users.OUTPUT_QUEUE_NAME
// and users.OUTPUT_QUEUE_LIBRARY_NAME on foundUserDiagnostics.
const outputQueueNamePopularAndLibrary = foundUserDiagnostics
.map(user => [user.OUTPUT_QUEUE_NAME, user.OUTPUT_QUEUE_LIBRARY_NAME])
.filter(outputQueueName => outputQueueName[0] !== null && outputQueueName[1] !== null)
// eslint-disable-next-line unicorn/no-array-reduce
.reduce((accumulator, outputQueueName) => {
if (accumulator.has(outputQueueName)) {
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
accumulator.set(outputQueueName, accumulator.get(outputQueueName) + 1);
// Use the object to find the 3 most popular INITIAL_PROGRAM_NAME and INITIAL_PROGRAM_LIBRARY_NAME combinations.
// Sort them by the number of times they appear.
const initialProgramArray = Object.entries(initialProgramAndLibrary).sort((a, b) => b[1] - a[1]);
// Log a message listing the 3 most popular INITIAL_PROGRAM_NAME and INITIAL_PROGRAM_LIBRARY_NAME combinations,
// and how many times they appear.
console.log(chalk.yellow(`The most popular initial programs are:`));
for (let index = 0; index < 3; index += 1) {
if (initialProgramArray[index]) {
console.log(chalk.blue(`${initialProgramArray[index][0]} used by ${initialProgramArray[index][1]}`));
}
}
// Find the 3 most popular combination of values for users.OUTOUT_QUEUE_NAME and users.OUTPUT_QUEUE_LIBRARY_NAME
// Use a for each loop.
// Create an object with the keys being the combination of OUTOUT_QUEUE_NAME and OUTPUT_QUEUE_LIBRARY_NAME
// and the values being the number of times that combination appears.
const outputQueueNameAndLibrary = {};
foundUserDiagnostics.forEach(user => {
const key = `${user.OUTPUT_QUEUE_NAME}/${user.OUTPUT_QUEUE_LIBRARY_NAME}`;
if (outputQueueNameAndLibrary[key]) {
outputQueueNameAndLibrary[key] += 1;
}
else {
accumulator.set(outputQueueName, 1);
outputQueueNameAndLibrary[key] = 1;
}
return accumulator;
}, new Map());
console.log(chalk.yellow(`The most popular output queues are: `));
outputQueueNamePopularAndLibrary.forEach((count, outputQueueName) => {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
console.log(chalk.blue(`${outputQueueName[1]}/${outputQueueName[0]} used by ${count}`));
});
// Use the object to find the 3 most popular OUTOUT_QUEUE_NAME and OUTPUT_QUEUE_LIBRARY_NAME combinations.
// Sort them by the number of times they appear.
const outputQueueNameArray = Object.entries(outputQueueNameAndLibrary).sort((a, b) => b[1] - a[1]);
// Log a message listing the 3 most popular OUTOUT_QUEUE_NAME and OUTPUT_QUEUE_LIBRARY_NAME combinations,
// and how many times they appear.
console.log(chalk.yellow(`The most popular output queues are:`));
for (let index = 0; index < 3; index += 1) {
if (outputQueueNameArray[index]) {
console.log(chalk.blue(`${outputQueueNameArray[index][0]} used by ${outputQueueNameArray[index][1]}`));
}
}
// Find the last 5 users to sign on. Treat PREVIOUS_SIGNON as a Date.
// If PREVIOUS_SIGNON is null, ignore them.
// TODO: Make sure this actually works.
const lastFiveUsersToSignOn = foundUserDiagnostics
.sort((a, b) => b.PREVIOUS_SIGNON.localeCompare(a.PREVIOUS_SIGNON))
.filter(user => user.PREVIOUS_SIGNON !== null)
.sort((a, b) => {
const aDate = new Date(a.PREVIOUS_SIGNON);
const bDate = new Date(b.PREVIOUS_SIGNON);
return aDate.getTime() - bDate.getTime();
})
.slice(0, 5)
.map(user => user.AUTHORIZATION_NAME);
console.log(chalk.yellow(`The last users to sign on are:
${chalk.blue(lastFiveUsersToSignOn.join(`, `))}`));
console.log(chalk.yellow(`The last 5 users to sign on are: `));
console.log(chalk.blue(lastFiveUsersToSignOn.join(`, `)));
}

@@ -87,3 +87,3 @@ {

"type": "module",
"version": "1.0.5",
"version": "1.0.6",
"engines": {

@@ -90,0 +90,0 @@ "node": ">=16.0.0"

<h1 align="center">interact-ibmi</h1>
<p align="center">
<img src="https://img.shields.io/badge/stability-wip-lightgrey.svg?style=plastic" alt="stability-wip"> <img src="https://github.com/Teqed/interact-ibmi/actions/workflows/continuous-integration.yml/badge.svg?event=push&style=plastic" alt="CI"> <img src="https://raw.githubusercontent.com/Teqed/interact-ibmi/main/.github/assets/build.svg" alt="Tests"> <img src="https://img.shields.io/depfu/dependencies/github/Teqed/interact-ibmi?style=plastic" alt="Depfu"> <img src="https://img.shields.io/github/last-commit/Teqed/interact-ibmi?style=plastic" alt="GitHub last commit">
<img src="https://img.shields.io/badge/stability-wip-lightgrey.svg?style=plastic" alt="stability-wip"> <img src="https://github.com/Teqed/interact-ibmi/actions/workflows/continuous-integration.yml/badge.svg?event=push&style=plastic" alt="CI"> <img src="https://img.shields.io/depfu/dependencies/github/Teqed/interact-ibmi?style=plastic" alt="Depfu">
</p><p align="center">
<img src="https://img.shields.io/github/issues-pr/Teqed/interact-ibmi?style=plastic" alt="GitHub pull requests"> <img src="https://img.shields.io/github/license/Teqed/interact-ibmi?style=plastic" alt="GitHub"> <img src="https://img.shields.io/github/repo-size/Teqed/interact-ibmi?style=plastic" alt="GitHub repo size"> <img src="https://img.shields.io/tokei/lines/github/Teqed/interact-ibmi?style=plastic" alt="Lines of code">
<img src="https://img.shields.io/github/last-commit/Teqed/interact-ibmi?style=plastic" alt="GitHub last commit"> <img src="https://img.shields.io/github/license/Teqed/interact-ibmi?style=plastic" alt="GitHub">
</p>

@@ -10,6 +10,12 @@

<p align="center">
<img src="https://user-images.githubusercontent.com/5181964/186485005-d9686590-5599-4329-bdfa-083d5dde18ea.png" alt="prototype image of interact-ibmi showing some test output">
<img src="https://user-images.githubusercontent.com/5181964/189445402-07ffb4cf-445c-45a6-8800-c31d6c997c4b.png" alt="prototype image of interact-ibmi showing some test output">
</p><br><br>
This is a work-in-progress with the goals of being able to view file records using ODBC, insert new records, and delete selected records, as well as perform some system commands.
<!--
<img src="https://raw.githubusercontent.com/Teqed/interact-ibmi/main/.github/assets/build.svg" alt="Tests">
<img src="https://img.shields.io/github/issues-pr/Teqed/interact-ibmi?style=plastic" alt="GitHub pull requests">
<img src="https://img.shields.io/github/repo-size/Teqed/interact-ibmi?style=plastic" alt="GitHub repo size">
<img src="https://img.shields.io/tokei/lines/github/Teqed/interact-ibmi?style=plastic" alt="Lines of code">
-->
## To-do

@@ -29,3 +35,3 @@

<p align="center">
<img src="https://user-images.githubusercontent.com/5181964/188281738-bfe1880c-8d2b-490f-aca4-cb7c1f543614.png" alt="prototype image of interact-ibmi showing some user diagnostics">
<img src="https://user-images.githubusercontent.com/5181964/189445594-afe69bba-bcde-4d02-92e9-3fd0aaf70b10.png" alt="prototype image of interact-ibmi showing some user diagnostics">
<br>

@@ -40,1 +46,15 @@ <sup><small><i>Some basic user diagnostics already done!</i></small></sup>

However, there's a lot of other tools available from IBM, the open source community, and third-party vendors that can already accomplish each of those tasks. Two tools I would recommend for general purposes are IBM's own Access Client Solutions (ACS) which can be run on OpenJava on most platforms, and Liam Barry's [Code for IBM i](https://github.com/halcyon-tech/vscode-ibmi) which is an excellent VSCode extension for working with IBMi that includes an API for creating your own extensions.
## Prerequisites
You must have IBM ODBC drivers installed for your platform. These are provided by IBM and are often included with installations of ACS. You must reboot after the installation. For more information, see the instructions on the node-odbc package, which this prereq is inherited from.
## Usage
Open your commandline and use:
```bash
npx @teqed/interact-ibmi
```
That's it, npx will take care of everything from there. You should be greeted by the login screen after it finishes downloading. Run the same command again as needed.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc