jyn 0.0.1-beta → 0.0.1-beta.3

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/dist/index.cjs ADDED
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // index.ts
27
+ var import_chalk_animation = __toESM(require("chalk-animation"), 1);
28
+
29
+ // utils/timers.ts
30
+ var sleep = (ms = 1e3) => new Promise((res) => setTimeout(res, ms));
31
+
32
+ // index.ts
33
+ var import_prompts2 = require("@inquirer/prompts");
34
+
35
+ // src/password.ts
36
+ var import_prompts = require("@inquirer/prompts");
37
+ var LOWERCASE_CHAR_CODES = arrayFromLowToHigh(97, 122);
38
+ var UPPERCASE_CHAR_CODES = arrayFromLowToHigh(65, 90);
39
+ var NUMBER_CHAR_CODES = arrayFromLowToHigh(48, 57);
40
+ var SYMBOL_CHAR_CODES = arrayFromLowToHigh(33, 47).concat(
41
+ arrayFromLowToHigh(58, 64)
42
+ ).concat(
43
+ arrayFromLowToHigh(91, 96)
44
+ ).concat(
45
+ arrayFromLowToHigh(123, 126)
46
+ );
47
+ function arrayFromLowToHigh(low, high) {
48
+ const array = [];
49
+ for (let i = low; i <= high; i++) {
50
+ array.push(i);
51
+ }
52
+ return array;
53
+ }
54
+ async function passwordGenerator() {
55
+ const charsCount = await (0, import_prompts.number)({ message: "Enter number of characters" });
56
+ const configs = await (0, import_prompts.checkbox)({
57
+ message: "Select a package manager",
58
+ choices: [
59
+ { name: "Include Uppercase", value: "uppercase" },
60
+ { name: "Include Numbers", value: "numbers" },
61
+ { name: "Include Symbols", value: "symbols" }
62
+ ]
63
+ });
64
+ const output = generatePassword(charsCount ?? 0, configs.includes("uppercase"), configs.includes("numbers"), configs.includes("symbols"));
65
+ return output;
66
+ }
67
+ function generatePassword(charCount, includeUppercase, includeNumbers, includeSymbols) {
68
+ let charCodes = LOWERCASE_CHAR_CODES;
69
+ if (includeUppercase) charCodes = charCodes.concat(UPPERCASE_CHAR_CODES);
70
+ if (includeSymbols) charCodes = charCodes.concat(SYMBOL_CHAR_CODES);
71
+ if (includeNumbers) charCodes = charCodes.concat(NUMBER_CHAR_CODES);
72
+ const passwordChars = [];
73
+ for (let i = 0; i < charCount; i++) {
74
+ const characterCode = charCodes[Math.floor(Math.random() * charCodes.length)];
75
+ if (characterCode) {
76
+ passwordChars.push(String.fromCharCode(characterCode));
77
+ }
78
+ }
79
+ return passwordChars.join("");
80
+ }
81
+
82
+ // index.ts
83
+ async function welcome() {
84
+ const title = import_chalk_animation.default.rainbow("I'm Gyn - a random generator toolbelt");
85
+ await sleep();
86
+ title.stop();
87
+ await askBaseSelection();
88
+ }
89
+ async function askBaseSelection() {
90
+ const answer = await (0, import_prompts2.select)({
91
+ message: "Select your choice",
92
+ choices: [
93
+ {
94
+ name: "Password generation",
95
+ value: "password_gen"
96
+ },
97
+ new import_prompts2.Separator()
98
+ ]
99
+ });
100
+ let output;
101
+ switch (answer) {
102
+ case "password_gen": {
103
+ output = await passwordGenerator();
104
+ }
105
+ }
106
+ console.log({ output });
107
+ }
108
+ async function start() {
109
+ await welcome();
110
+ }
111
+ start();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/index.js ADDED
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+
3
+ // index.ts
4
+ import chalkAnimation from "chalk-animation";
5
+
6
+ // utils/timers.ts
7
+ var sleep = (ms = 1e3) => new Promise((res) => setTimeout(res, ms));
8
+
9
+ // index.ts
10
+ import { select, Separator } from "@inquirer/prompts";
11
+
12
+ // src/password.ts
13
+ import { number, checkbox } from "@inquirer/prompts";
14
+ var LOWERCASE_CHAR_CODES = arrayFromLowToHigh(97, 122);
15
+ var UPPERCASE_CHAR_CODES = arrayFromLowToHigh(65, 90);
16
+ var NUMBER_CHAR_CODES = arrayFromLowToHigh(48, 57);
17
+ var SYMBOL_CHAR_CODES = arrayFromLowToHigh(33, 47).concat(
18
+ arrayFromLowToHigh(58, 64)
19
+ ).concat(
20
+ arrayFromLowToHigh(91, 96)
21
+ ).concat(
22
+ arrayFromLowToHigh(123, 126)
23
+ );
24
+ function arrayFromLowToHigh(low, high) {
25
+ const array = [];
26
+ for (let i = low; i <= high; i++) {
27
+ array.push(i);
28
+ }
29
+ return array;
30
+ }
31
+ async function passwordGenerator() {
32
+ const charsCount = await number({ message: "Enter number of characters" });
33
+ const configs = await checkbox({
34
+ message: "Select a package manager",
35
+ choices: [
36
+ { name: "Include Uppercase", value: "uppercase" },
37
+ { name: "Include Numbers", value: "numbers" },
38
+ { name: "Include Symbols", value: "symbols" }
39
+ ]
40
+ });
41
+ const output = generatePassword(charsCount ?? 0, configs.includes("uppercase"), configs.includes("numbers"), configs.includes("symbols"));
42
+ return output;
43
+ }
44
+ function generatePassword(charCount, includeUppercase, includeNumbers, includeSymbols) {
45
+ let charCodes = LOWERCASE_CHAR_CODES;
46
+ if (includeUppercase) charCodes = charCodes.concat(UPPERCASE_CHAR_CODES);
47
+ if (includeSymbols) charCodes = charCodes.concat(SYMBOL_CHAR_CODES);
48
+ if (includeNumbers) charCodes = charCodes.concat(NUMBER_CHAR_CODES);
49
+ const passwordChars = [];
50
+ for (let i = 0; i < charCount; i++) {
51
+ const characterCode = charCodes[Math.floor(Math.random() * charCodes.length)];
52
+ if (characterCode) {
53
+ passwordChars.push(String.fromCharCode(characterCode));
54
+ }
55
+ }
56
+ return passwordChars.join("");
57
+ }
58
+
59
+ // index.ts
60
+ async function welcome() {
61
+ const title = chalkAnimation.rainbow("I'm Gyn - a random generator toolbelt");
62
+ await sleep();
63
+ title.stop();
64
+ await askBaseSelection();
65
+ }
66
+ async function askBaseSelection() {
67
+ const answer = await select({
68
+ message: "Select your choice",
69
+ choices: [
70
+ {
71
+ name: "Password generation",
72
+ value: "password_gen"
73
+ },
74
+ new Separator()
75
+ ]
76
+ });
77
+ let output;
78
+ switch (answer) {
79
+ case "password_gen": {
80
+ output = await passwordGenerator();
81
+ }
82
+ }
83
+ console.log({ output });
84
+ }
85
+ async function start() {
86
+ await welcome();
87
+ }
88
+ start();
package/dist/index.mjs ADDED
File without changes
package/index.ts ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ import chalkAnimation from 'chalk-animation';
3
+ import { sleep } from './utils/timers';
4
+ import { select, Separator } from '@inquirer/prompts';
5
+ import passwordGenerator from './src/password';
6
+
7
+ async function welcome(){
8
+ const title = chalkAnimation.rainbow("I'm Gyn - a random generator toolbelt");
9
+ await sleep();
10
+ title.stop();
11
+ await askBaseSelection();
12
+ }
13
+
14
+
15
+ async function askBaseSelection(){
16
+ const answer = await select({
17
+ message:'Select your choice',
18
+ choices:[
19
+ {
20
+ name:'Password generation',
21
+ value:'password_gen',
22
+ },
23
+ new Separator(),
24
+ ]
25
+
26
+ });
27
+
28
+ let output;
29
+ switch(answer){
30
+ case 'password_gen':{
31
+ output = await passwordGenerator();
32
+ }
33
+ }
34
+
35
+ console.log({output});
36
+ }
37
+
38
+
39
+
40
+
41
+ async function start(){
42
+ await welcome();
43
+ }
44
+
45
+ start();
package/package.json CHANGED
@@ -1,18 +1,27 @@
1
1
  {
2
- "name": "jyn",
3
- "version": "0.0.1-beta",
4
- "description": "Toolkit for random generation",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "keywords": [],
10
- "author": "",
11
- "license": "ISC",
12
- "type": "module",
13
- "dependencies": {
14
- "@openrouter/sdk": "^0.4.0",
15
- "ember": "^1.1.1",
16
- "void": "^3.0.1"
17
- }
2
+ "name": "jyn",
3
+ "license": "MIT",
4
+ "version": "0.0.1-beta.3",
5
+ "description": "Toolkit for random generation",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.mjs",
8
+ "types": "dist/index.d.ts",
9
+ "type": "module",
10
+ "scripts": {
11
+ "build": "tsup index.ts --format cjs,esm --dts",
12
+ "lint": "tsc"
13
+ },
14
+ "bin": {
15
+ "gyn": "index.js"
16
+ },
17
+ "devDependencies": {
18
+ "@types/chalk-animation": "^1.6.3",
19
+ "@types/node": "^25.0.10",
20
+ "tsup": "^8.5.1",
21
+ "typescript": "^5.9.3"
22
+ },
23
+ "dependencies": {
24
+ "@inquirer/prompts": "^8.2.0",
25
+ "chalk-animation": "^2.0.3"
26
+ }
18
27
  }
@@ -0,0 +1,55 @@
1
+ import { number,checkbox } from '@inquirer/prompts';
2
+
3
+ const LOWERCASE_CHAR_CODES = arrayFromLowToHigh(97, 122);
4
+ const UPPERCASE_CHAR_CODES = arrayFromLowToHigh(65, 90);
5
+ const NUMBER_CHAR_CODES = arrayFromLowToHigh(48, 57);
6
+ const SYMBOL_CHAR_CODES = arrayFromLowToHigh(33, 47).concat(
7
+ arrayFromLowToHigh(58, 64)
8
+ ).concat(
9
+ arrayFromLowToHigh(91, 96)
10
+ ).concat(
11
+ arrayFromLowToHigh(123, 126)
12
+ );
13
+
14
+ function arrayFromLowToHigh(low:number, high:number) {
15
+ const array = []
16
+ for (let i = low; i <= high; i++) {
17
+ array.push(i)
18
+ }
19
+ return array
20
+ }
21
+ export default async function passwordGenerator(){
22
+ const charsCount = await number({message:'Enter number of characters'});
23
+
24
+ const configs = await checkbox({
25
+ message: 'Select a package manager',
26
+ choices: [
27
+ { name: 'Include Uppercase', value: 'uppercase' },
28
+ { name: 'Include Numbers', value: 'numbers' },
29
+ { name: 'Include Symbols', value: 'symbols' },
30
+ ],
31
+ });
32
+
33
+ const output = generatePassword(charsCount ?? 0, configs.includes('uppercase'), configs.includes('numbers'), configs.includes('symbols'));
34
+
35
+ return output;
36
+
37
+ }
38
+
39
+
40
+ function generatePassword(charCount: number, includeUppercase:boolean, includeNumbers:boolean, includeSymbols:boolean){
41
+ let charCodes = LOWERCASE_CHAR_CODES;
42
+ if (includeUppercase) charCodes = charCodes.concat(UPPERCASE_CHAR_CODES)
43
+ if (includeSymbols) charCodes = charCodes.concat(SYMBOL_CHAR_CODES)
44
+ if (includeNumbers) charCodes = charCodes.concat(NUMBER_CHAR_CODES)
45
+
46
+ const passwordChars = [];
47
+ for(let i=0;i<charCount;i++){
48
+ const characterCode = charCodes[Math.floor(Math.random()*charCodes.length)];
49
+ if(characterCode){
50
+ passwordChars.push(String.fromCharCode(characterCode));
51
+ }
52
+ }
53
+
54
+ return passwordChars.join('');
55
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ // Visit https://aka.ms/tsconfig to read more about this file
3
+ "compilerOptions": {
4
+ // File Layout
5
+ // "rootDir": "./src",
6
+ // "outDir": "./dist",
7
+
8
+ // Environment Settings
9
+ // See also https://aka.ms/tsconfig/module
10
+ "moduleResolution": "bundler",
11
+ "module": "es2022",
12
+ "target": "esnext",
13
+ "types": [],
14
+ // For nodejs:
15
+ // "lib": ["esnext"],
16
+ // "types": ["node"],
17
+ // and npm install -D @types/node
18
+
19
+ // Other Outputs
20
+ "sourceMap": true,
21
+ "declaration": true,
22
+ "declarationMap": true,
23
+
24
+ // Stricter Typechecking Options
25
+ "noUncheckedIndexedAccess": true,
26
+ "exactOptionalPropertyTypes": true,
27
+ "noEmit": true,
28
+
29
+ // Style Options
30
+ // "noImplicitReturns": true,
31
+ // "noImplicitOverride": true,
32
+ // "noUnusedLocals": true,
33
+ // "noUnusedParameters": true,
34
+ // "noFallthroughCasesInSwitch": true,
35
+ // "noPropertyAccessFromIndexSignature": true,
36
+
37
+ // Recommended Options
38
+ "strict": true,
39
+ "verbatimModuleSyntax": true,
40
+ "isolatedModules": true,
41
+ "noUncheckedSideEffectImports": true,
42
+ "moduleDetection": "force",
43
+ "skipLibCheck": true,
44
+ }
45
+ }
@@ -0,0 +1 @@
1
+ export const sleep = (ms=1000)=> new Promise(res=> setTimeout(res,ms));
package/index.js DELETED
@@ -1,22 +0,0 @@
1
- import { OpenRouter } from "@openrouter/sdk";
2
-
3
- const openrouter = new OpenRouter({
4
- });
5
-
6
- const stream = await openrouter.chat.send({
7
- model: "liquid/lfm-2.5-1.2b-thinking:free",
8
- messages: [
9
- {
10
- "role": "user",
11
- "content": "What is the meaning of name Abhirup?"
12
- }
13
- ],
14
- stream: true
15
- });
16
-
17
- for await (const chunk of stream) {
18
- const content = chunk.choices[0]?.delta?.content;
19
- if (content) {
20
- process.stdout.write(content);
21
- }
22
- }