profile
viewpoint
ibrahim mii9000 @bKash-developer Dhaka, Bangladesh https://mii.ninja ☕️ 🏋️ 📺 🎮 💻 🤓 🇧🇩 🍛 🎧 ♎️ 🎵 🏓

mii9000/dev-resource 27

Links to resources for devs

mii9000/cart-wizard 2

A cart wizard app made with Angularjs

mii9000/AsciiThis-Bot 1

The code for the AsciiThis bot on Reddit

mii9000/browser-extension 1

OctoLinker – Available on Chrome, Firefox and Opera

mii9000/cart-wizard-ts 1

Cart wizard app with Angularjs and TypeScript

mii9000/das 1

Diagrams As Code

mii9000/angular2-lazy-load-example 0

Angular 2 lazy load example

mii9000/angular2-webpack 0

A complete, yet simple, starter for Angular 2 using webpack

mii9000/angularattack2016-sightings 0

Team Codemons submission for Angular Attack 2016

startedcabinjs/cabin

started time in 2 days

startedbrillout/awesome-react-components

started time in 2 days

startedamark/gun

started time in 3 days

startedstart-react/native-starter-kit

started time in 6 days

startedbartonhammond/snowflake

started time in 6 days

startedthecodingmachine/react-native-boilerplate

started time in 6 days

startedeliben/raft

started time in 9 days

startedkamilmysliwiec/nest-cqrs-example

started time in 12 days

startedbecomist/strapi-okr-api

started time in 12 days

issue commentoclif/oclif

cli exists after some time and not immediately

@peternhale thanks for your prompt reply. but I just narrowed down the issue to my use of mysql2/promise package. i replaced it with mysql and its working fine now. thanks for your assistance.

mii9000

comment created time in 13 days

issue closedoclif/oclif

cli exists after some time and not immediately

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Program does not exist immediately. Exists after quite some time (~30 seconds) even with this.exit(0)

What is the expected behavior?

MacOS: 11.6 oclif: 1

closed time in 13 days

mii9000

issue commentoclif/oclif

cli exists after some time and not immediately

Apologies for the confusion. I am using the latest version. 2.1.3 following is the command which is getting huge amounts of data and dumping them as csv according to some logic i have other commands as well but surprisingly only this one takes some time to exit the program

import cli from 'cli-ux'
import * as inquirer from 'inquirer'
import * as mysql from 'mysql2/promise'
import { QUERY } from './query'
import * as _ from 'lodash'
import DumperBase from '../dumper-base'
const php = require('php-unserialize')
  
export default class DetailsDumper extends DumperBase {

    constructor(db: mysql.Connection){
        super(DetailsDumper.name, db)
    }

    async run() {
        const selections = await inquirer.prompt(this.SourceDestinationPrompt)
        
        const progress = cli.progress()
        progress.start()

        //extract ids from source file
        const ids = await this.readSourceFileAsync(selections.sourceFile, 'KYC_ID')
        this.logger.info(`${ids.size} records read from file ${selections.sourceFile}`)
        
        const batches = _.chunk(Array.from(ids), selections.batchSize)
        this.logger.info(`created ${batches.length} for processing`)
        
        let totalExported = 0
        for (let i = 0; i < batches.length; i++) {
            const batch = batches[i]
            const batchNo = i + 1
            const recordsNo = await this.process(batch, selections.outputDir, batchNo)
            this.logger.info(`finished processing batch no. ${batchNo}`)
            totalExported += recordsNo
            progress.update((batchNo/batches.length)*100)
        }

        this.logger.info(`===${DetailsDumper.name} DONE. Exported ${totalExported} records===`)
        
        progress.stop()
    }

    private async process(ids: string[], outputDir: string, batchNo: number) {
        //execute query to fetch from database
        const query = this.renderIdsFromQueryTemplateSync(ids, QUERY)
        const [records] = await this.db.query<any[]>(query)
        this.logger.info(`Batch No. ${batchNo} | ${records.length} fetched`)

        //write the raw output for logging
        await this.writeRawSqlDumpFile(records, query, outputDir, batchNo)
        
        //format data according to output
        const results = this.metadataFormatter(records)
        this.logger.info(`Batch No. ${batchNo} | metadata formatted`)

        //write results in destination dir
        const outfile = await this.writeOutputFileAsync(results, outputDir, batchNo)
        this.logger.info(`Batch No. ${batchNo} | ${results.length} rows written to ${outfile}`)

        return results.length
    }

    private metadataFormatter(records: any[]) {
        //wrapper function around the php library to handle exceptions
        const unserialize = (kycId: string, metadata: string) => {
            const empty = {
                documentVersion: '',
                deviceFingerprint: '',
                deviceModel: '',
                osVersion: '',
                sdkVersion: ''
            }

            if(!metadata) return empty

            try {
                return php.unserialize(metadata)
            } catch {
                const err = `KYC ID = ${kycId} | Metadata = ${metadata}`
                this.logger.error(err)
                return empty 
            }
        }

        const results = []

        for (const record of records) {
            try {
                //create a new record from the existing record
                //we need this because we need metadata properties after these properties in the object
                const newRecord = _.pick(record, ['KYC ID', 'Customer Number','Registering Number', 'Application Date & Time',
                'System Status', 'Portal Status', 'Doc Face Score', 'Alive Face Score', 'OCR Score'])         
        
                //extract metadata properties
                const metadata: Metadata = unserialize(record['KYC ID'], record['metadata'])
                const metadataObj = {
                    ['NID Version']: metadata?.documentVersion,
                    ['Device Fingerprint']: metadata?.deviceFingerprint,
                    ['Device Model']: metadata?.deviceModel,
                    ['OS Version']: metadata?.osVersion,
                    ['SDK Version']: metadata?.sdkVersion
                }
        
                //delete metadata property from record
                delete record['metadata']
        
                //destruct and merge each object into 1 and maintain property order
                results.push({ ...newRecord, ...metadataObj, ...record })           
            } catch(error) {
                const err = `Error : KYC ID = ${record['KYC ID']}`
                this.logger.error(err)
            }
        }

        return results
    }
}

interface Metadata {
    documentVersion: string
    deviceFingerprint: string
    deviceModel: string
    osVersion: string
    sdkVersion: string
}
mii9000

comment created time in 13 days

issue openedoclif/oclif

cli does not exists after some time and not immediately

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Program does not exist immediately. Exists after quite some time (~30 seconds) even with this.exit(0)

What is the expected behavior?

MacOS: 11.6 oclif: 1

created time in 13 days

issue commentoclif/oclif

support pkg little better with default setup

I needed to first do npm run build to generate a dist directory and then do pkg --out-path exe/ . where exe is the folder where executables would be generated. Spent hours trying to figure out that this in official docs was not working. Not even sure why ./lib is mentioned.

twk-b

comment created time in 15 days

issue commentoclif/oclif

Package appears to be compromised.

@christiansmith Thanks for bringing this to our attention

I added a resolutions section to our package.json to force colors to resolve to 1.4.0 - however, that unfortunately won't have any affect on npm installs.

I could update our release process to generate a shrinkwrap - but given that it's a Saturday and the bug doesn't appear to be malicious I'd rather wait on that for now. Hopefully the bug gets fixed or they point latest to a working version before then

In the meantime, you can install oclif using yarn:

yarn global add oclif

adding with yarn did not work for me

christiansmith

comment created time in 16 days

startedvercel/pkg

started time in 18 days

startednexe/nexe

started time in 18 days

startedoskardudycz/EventSourcing.NetCore

started time in 19 days

startedKaustubh-Natuskar/moreThanFAANGM

started time in 24 days

startedmizrael/OpenSleigh

started time in a month

startedplausible/analytics

started time in a month

startedtheanalyst/awesome-distributed-systems

started time in a month

startedmizrael/SuperSafeBank

started time in a month

startedauthorizerdev/authorizer

started time in a month

startedadrianvlupu/C4-Builder

started time in a month

startedhackjutsu/Lepton

started time in a month

startedreactide/reactide

started time in a month

startedresponsively-org/responsively-app

started time in a month

startedxgrommx/awesome-redux

started time in a month

startedwaterbear-cloud/paco

started time in a month

more