Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffd13421ca |
No files matched your search
@@ -4,4 +4,3 @@ My personal set of tools to ease and speed up my development experience.
|
|||||||
|
|
||||||
1. `colorizer`: color model converter.
|
1. `colorizer`: color model converter.
|
||||||
2. `image-converter`: simple image formate and size converter.
|
2. `image-converter`: simple image formate and size converter.
|
||||||
3. `juker`: API faker.
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 931 KiB |
@@ -0,0 +1,36 @@
|
|||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
def convert_ascii(src: str, width: int, weight: int, charset: [str]):
|
||||||
|
# Open an image file
|
||||||
|
img = Image.open(src)
|
||||||
|
|
||||||
|
gray_scale = len(charset)
|
||||||
|
print("__char", charset, gray_scale)
|
||||||
|
|
||||||
|
img_width, img_height = img.size
|
||||||
|
px = img.load()
|
||||||
|
|
||||||
|
# Use image parser to take resolution down
|
||||||
|
# Convert to grayscale
|
||||||
|
# Calc color differences
|
||||||
|
# Stablish defined character based on the color variance
|
||||||
|
|
||||||
|
min_color = 255
|
||||||
|
max_color = 0
|
||||||
|
|
||||||
|
for x in range(img_width):
|
||||||
|
for y in range(img_height):
|
||||||
|
# r, g, b = px[x, y]
|
||||||
|
gray_px = sum(px[x, y]) // 3
|
||||||
|
px[x,y] = (gray_px, gray_px, gray_px)
|
||||||
|
|
||||||
|
if (min_color > gray_px):
|
||||||
|
min_color = gray_px
|
||||||
|
elif (max_color < gray_px):
|
||||||
|
max_color = gray_px
|
||||||
|
|
||||||
|
print("Pixels", px[0,0], min_color, max_color) # --> outputs a three-dimensional array, rgb
|
||||||
|
|
||||||
|
|
||||||
|
convert_ascii('src/assets/fee.jpg', 100, 100, ["a", "b", "c"])
|
||||||
|
convert_ascii('src/assets/clear.jpg', 100, 100, ["a", "b", "c"])
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
class TestAsciiConvert:
|
||||||
|
def test_pixel_parse(self):
|
||||||
|
print("__testing")
|
||||||
|
assert 1 + 1 == 2
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
node_modules
|
|
||||||
dist
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "juker",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "Compact API faker.",
|
|
||||||
"main": "app.ts",
|
|
||||||
"scripts": {
|
|
||||||
"dev:tsc": "tsc --watch --preserveWatchOutput",
|
|
||||||
"dev:tsc:silent": "tsc --watch >/dev/null",
|
|
||||||
"dev:node": "node --watch-preserve-output --watch-path=./dist dist/app.js",
|
|
||||||
"dev": "pnpm run dev:tsc:silent & pnpm run dev:node",
|
|
||||||
"build": "tsc",
|
|
||||||
"start": "node dist/app.js",
|
|
||||||
"run": "pnpm run build && pnpm run start"
|
|
||||||
},
|
|
||||||
"keywords": [],
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
|
||||||
"devEngines": {
|
|
||||||
"packageManager": {
|
|
||||||
"name": "pnpm",
|
|
||||||
"version": "^11.3.0",
|
|
||||||
"onFail": "download"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/express": "^5.0.6",
|
|
||||||
"@types/node": "^26.5.0",
|
|
||||||
"typescript": "^7.0.2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Generated
-506
@@ -1,506 +0,0 @@
|
|||||||
---
|
|
||||||
lockfileVersion: '9.0'
|
|
||||||
|
|
||||||
importers:
|
|
||||||
|
|
||||||
.:
|
|
||||||
configDependencies: {}
|
|
||||||
packageManagerDependencies:
|
|
||||||
'@pnpm/exe':
|
|
||||||
specifier: ^11.3.0
|
|
||||||
version: 11.26.0
|
|
||||||
pnpm:
|
|
||||||
specifier: ^11.3.0
|
|
||||||
version: 11.26.0
|
|
||||||
|
|
||||||
packages:
|
|
||||||
|
|
||||||
'@pnpm/exe@11.26.0':
|
|
||||||
resolution: {integrity: sha512-eeiNi7WeXulOO1BzDAU9HIk+N3dokG+xwKPUupNQoZT5auL3rh2pFW9DqdIEnCC2xtt/hZd6UGtKyb6OMpqndw==}
|
|
||||||
hasBin: true
|
|
||||||
|
|
||||||
'@pnpm/linux-arm64@11.26.0':
|
|
||||||
resolution: {integrity: sha512-M0IDuD4hbXxpLBsj1/I9pODcxu/gxTDtbyQmsVGYu1TZwCCpf6YU1x3lzq8aCGjrysmXYQAtCiY8GBjdw4UGFg==}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [linux]
|
|
||||||
|
|
||||||
'@pnpm/linux-x64@11.26.0':
|
|
||||||
resolution: {integrity: sha512-nUuNRsFCGVje3FHtOaWxIQl2EP4NBktKr+PpLN7uhuWnJCCMN/F9RKjNJAM+dUPyvAZs8VDvS0kA8J55kyybyg==}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [linux]
|
|
||||||
|
|
||||||
'@pnpm/linuxstatic-arm64@11.26.0':
|
|
||||||
resolution: {integrity: sha512-+dXROkvdWjskrQtjwJAFuJI7Q2uTkghBfLsd0vqRmorX3fPuinhoRjJJ/UPtWXzJqwcByJBmdJRW+q2964m5qQ==}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [linux]
|
|
||||||
libc: [musl]
|
|
||||||
|
|
||||||
'@pnpm/linuxstatic-x64@11.26.0':
|
|
||||||
resolution: {integrity: sha512-0eXE6spzIBdCbYhJZQ0u/sIOD0v30sqk2PrzoixzsNMc7S/lhd7EkBMVJ6cCPiCL2TXvOsrJC2SpWPBK769A9A==}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [linux]
|
|
||||||
libc: [musl]
|
|
||||||
|
|
||||||
'@pnpm/macos-arm64@11.26.0':
|
|
||||||
resolution: {integrity: sha512-Za3kKV89Zj0SFzQf6zEUTUIy13xH8UiNyb7aILDRjPiTvTaUSCh3q+nvljISfGH1XcopXvo+p3K8Q2nrKYWAug==}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [darwin]
|
|
||||||
|
|
||||||
'@pnpm/win-arm64@11.26.0':
|
|
||||||
resolution: {integrity: sha512-5akeLtbqbFDdJtCV4qgLmDBV3R+XNs6E7h7Xb4ZBzS3rLRp8e/y/ZdgrZaGF5Kjo45g0BLAxdGUREHbU2/lGUw==}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [win32]
|
|
||||||
|
|
||||||
'@pnpm/win-x64@11.26.0':
|
|
||||||
resolution: {integrity: sha512-f15SfIo7nppxBII+STy6jpd1z3LgGTZh6skfuxKA/xHmkzopnQJQXr4hBnl1rJLJAnmuOhN8BssaC4LiXmS78w==}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [win32]
|
|
||||||
|
|
||||||
'@reflink/reflink-darwin-arm64@0.1.19':
|
|
||||||
resolution: {integrity: sha512-ruy44Lpepdk1FqDz38vExBY/PVUsjxZA+chd9wozjUH9JjuDT/HEaQYA6wYN9mf041l0yLVar6BCZuWABJvHSA==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [darwin]
|
|
||||||
|
|
||||||
'@reflink/reflink-darwin-x64@0.1.19':
|
|
||||||
resolution: {integrity: sha512-By85MSWrMZa+c26TcnAy8SDk0sTUkYlNnwknSchkhHpGXOtjNDUOxJE9oByBnGbeuIE1PiQsxDG3Ud+IVV9yuA==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [darwin]
|
|
||||||
|
|
||||||
'@reflink/reflink-linux-arm64-gnu@0.1.19':
|
|
||||||
resolution: {integrity: sha512-7P+er8+rP9iNeN+bfmccM4hTAaLP6PQJPKWSA4iSk2bNvo6KU6RyPgYeHxXmzNKzPVRcypZQTpFgstHam6maVg==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [linux]
|
|
||||||
libc: [glibc]
|
|
||||||
|
|
||||||
'@reflink/reflink-linux-arm64-musl@0.1.19':
|
|
||||||
resolution: {integrity: sha512-37iO/Dp6m5DDaC2sf3zPtx/hl9FV3Xze4xoYidrxxS9bgP3S8ALroxRK6xBG/1TtfXKTvolvp+IjrUU6ujIGmA==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [linux]
|
|
||||||
libc: [musl]
|
|
||||||
|
|
||||||
'@reflink/reflink-linux-x64-gnu@0.1.19':
|
|
||||||
resolution: {integrity: sha512-jbI8jvuYCaA3MVUdu8vLoLAFqC+iNMpiSuLbxlAgg7x3K5bsS8nOpTRnkLF7vISJ+rVR8W+7ThXlXlUQ93ulkw==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [linux]
|
|
||||||
libc: [glibc]
|
|
||||||
|
|
||||||
'@reflink/reflink-linux-x64-musl@0.1.19':
|
|
||||||
resolution: {integrity: sha512-e9FBWDe+lv7QKAwtKOt6A2W/fyy/aEEfr0g6j/hWzvQcrzHCsz07BNQYlNOjTfeytrtLU7k449H1PI95jA4OjQ==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [linux]
|
|
||||||
libc: [musl]
|
|
||||||
|
|
||||||
'@reflink/reflink-win32-arm64-msvc@0.1.19':
|
|
||||||
resolution: {integrity: sha512-09PxnVIQcd+UOn4WAW73WU6PXL7DwGS6wPlkMhMg2zlHHG65F3vHepOw06HFCq+N42qkaNAc8AKIabWvtk6cIQ==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [win32]
|
|
||||||
|
|
||||||
'@reflink/reflink-win32-x64-msvc@0.1.19':
|
|
||||||
resolution: {integrity: sha512-E//yT4ni2SyhwP8JRjVGWr3cbnhWDiPLgnQ66qqaanjjnMiu3O/2tjCPQXlcGc/DEYofpDc9fvhv6tALQsMV9w==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [win32]
|
|
||||||
|
|
||||||
'@reflink/reflink@0.1.19':
|
|
||||||
resolution: {integrity: sha512-DmCG8GzysnCZ15bres3N5AHCmwBwYgp0As6xjhQ47rAUTUXxJiK+lLUxaGsX3hd/30qUpVElh05PbGuxRPgJwA==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
|
|
||||||
detect-libc@2.1.2:
|
|
||||||
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
|
|
||||||
pnpm@11.26.0:
|
|
||||||
resolution: {integrity: sha512-/A4r+JC5+YNhHxq2jAY3vOkUOQZTaZ+DwaeLAF7SXyyB53kgyP2O7i7PC1iyjNywCoTZf2m898VrLzRHECOGZA==}
|
|
||||||
engines: {node: '>=22.13'}
|
|
||||||
hasBin: true
|
|
||||||
|
|
||||||
snapshots:
|
|
||||||
|
|
||||||
'@pnpm/exe@11.26.0':
|
|
||||||
dependencies:
|
|
||||||
'@reflink/reflink': 0.1.19
|
|
||||||
detect-libc: 2.1.2
|
|
||||||
optionalDependencies:
|
|
||||||
'@pnpm/linux-arm64': 11.26.0
|
|
||||||
'@pnpm/linux-x64': 11.26.0
|
|
||||||
'@pnpm/linuxstatic-arm64': 11.26.0
|
|
||||||
'@pnpm/linuxstatic-x64': 11.26.0
|
|
||||||
'@pnpm/macos-arm64': 11.26.0
|
|
||||||
'@pnpm/win-arm64': 11.26.0
|
|
||||||
'@pnpm/win-x64': 11.26.0
|
|
||||||
|
|
||||||
'@pnpm/linux-arm64@11.26.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@pnpm/linux-x64@11.26.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@pnpm/linuxstatic-arm64@11.26.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@pnpm/linuxstatic-x64@11.26.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@pnpm/macos-arm64@11.26.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@pnpm/win-arm64@11.26.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@pnpm/win-x64@11.26.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@reflink/reflink-darwin-arm64@0.1.19':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@reflink/reflink-darwin-x64@0.1.19':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@reflink/reflink-linux-arm64-gnu@0.1.19':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@reflink/reflink-linux-arm64-musl@0.1.19':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@reflink/reflink-linux-x64-gnu@0.1.19':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@reflink/reflink-linux-x64-musl@0.1.19':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@reflink/reflink-win32-arm64-msvc@0.1.19':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@reflink/reflink-win32-x64-msvc@0.1.19':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@reflink/reflink@0.1.19':
|
|
||||||
optionalDependencies:
|
|
||||||
'@reflink/reflink-darwin-arm64': 0.1.19
|
|
||||||
'@reflink/reflink-darwin-x64': 0.1.19
|
|
||||||
'@reflink/reflink-linux-arm64-gnu': 0.1.19
|
|
||||||
'@reflink/reflink-linux-arm64-musl': 0.1.19
|
|
||||||
'@reflink/reflink-linux-x64-gnu': 0.1.19
|
|
||||||
'@reflink/reflink-linux-x64-musl': 0.1.19
|
|
||||||
'@reflink/reflink-win32-arm64-msvc': 0.1.19
|
|
||||||
'@reflink/reflink-win32-x64-msvc': 0.1.19
|
|
||||||
|
|
||||||
detect-libc@2.1.2: {}
|
|
||||||
|
|
||||||
pnpm@11.26.0: {}
|
|
||||||
|
|
||||||
---
|
|
||||||
lockfileVersion: '9.0'
|
|
||||||
|
|
||||||
settings:
|
|
||||||
autoInstallPeers: true
|
|
||||||
excludeLinksFromLockfile: false
|
|
||||||
|
|
||||||
importers:
|
|
||||||
|
|
||||||
.:
|
|
||||||
devDependencies:
|
|
||||||
'@types/express':
|
|
||||||
specifier: ^5.0.6
|
|
||||||
version: 5.0.6
|
|
||||||
'@types/node':
|
|
||||||
specifier: ^26.5.0
|
|
||||||
version: 26.5.0
|
|
||||||
typescript:
|
|
||||||
specifier: ^7.0.2
|
|
||||||
version: 7.0.2
|
|
||||||
|
|
||||||
packages:
|
|
||||||
|
|
||||||
'@types/body-parser@1.19.6':
|
|
||||||
resolution: {integrity: sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==}
|
|
||||||
|
|
||||||
'@types/connect@3.4.38':
|
|
||||||
resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==}
|
|
||||||
|
|
||||||
'@types/express-serve-static-core@5.1.3':
|
|
||||||
resolution: {integrity: sha512-dPfW8NFiOF4wOHc7+N/QSxlY9cfSsenewGbAz8C8U/MULPd/YZ27LvJUIlzaXie7e6Ove9YunJGgC9tbHD2cKw==}
|
|
||||||
|
|
||||||
'@types/express@5.0.6':
|
|
||||||
resolution: {integrity: sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA==}
|
|
||||||
|
|
||||||
'@types/http-errors@2.0.5':
|
|
||||||
resolution: {integrity: sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==}
|
|
||||||
|
|
||||||
'@types/node@26.5.0':
|
|
||||||
resolution: {integrity: sha512-dVSGpriSoCgz8WnDNTuSSuSv1PC/ALXihO4ulRZt7Md8k9mlbdin3lGOcDE8SnWOgf513ByWlXd7BK4azmyg/A==}
|
|
||||||
|
|
||||||
'@types/qs@6.15.1':
|
|
||||||
resolution: {integrity: sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw==}
|
|
||||||
|
|
||||||
'@types/range-parser@1.2.7':
|
|
||||||
resolution: {integrity: sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==}
|
|
||||||
|
|
||||||
'@types/send@1.2.1':
|
|
||||||
resolution: {integrity: sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==}
|
|
||||||
|
|
||||||
'@types/serve-static@2.2.0':
|
|
||||||
resolution: {integrity: sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ==}
|
|
||||||
|
|
||||||
'@typescript/typescript-aix-ppc64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [ppc64]
|
|
||||||
os: [aix]
|
|
||||||
|
|
||||||
'@typescript/typescript-darwin-arm64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [darwin]
|
|
||||||
|
|
||||||
'@typescript/typescript-darwin-x64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [darwin]
|
|
||||||
|
|
||||||
'@typescript/typescript-freebsd-arm64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [freebsd]
|
|
||||||
|
|
||||||
'@typescript/typescript-freebsd-x64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [freebsd]
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-arm64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [linux]
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-arm@7.0.2':
|
|
||||||
resolution: {integrity: sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [arm]
|
|
||||||
os: [linux]
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-loong64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [loong64]
|
|
||||||
os: [linux]
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-mips64el@7.0.2':
|
|
||||||
resolution: {integrity: sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [mips64el]
|
|
||||||
os: [linux]
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-ppc64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [ppc64]
|
|
||||||
os: [linux]
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-riscv64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [riscv64]
|
|
||||||
os: [linux]
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-s390x@7.0.2':
|
|
||||||
resolution: {integrity: sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [s390x]
|
|
||||||
os: [linux]
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-x64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [linux]
|
|
||||||
|
|
||||||
'@typescript/typescript-netbsd-arm64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [netbsd]
|
|
||||||
|
|
||||||
'@typescript/typescript-netbsd-x64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [netbsd]
|
|
||||||
|
|
||||||
'@typescript/typescript-openbsd-arm64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [openbsd]
|
|
||||||
|
|
||||||
'@typescript/typescript-openbsd-x64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [openbsd]
|
|
||||||
|
|
||||||
'@typescript/typescript-sunos-x64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [sunos]
|
|
||||||
|
|
||||||
'@typescript/typescript-win32-arm64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [win32]
|
|
||||||
|
|
||||||
'@typescript/typescript-win32-x64@7.0.2':
|
|
||||||
resolution: {integrity: sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [win32]
|
|
||||||
|
|
||||||
typescript@7.0.2:
|
|
||||||
resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==}
|
|
||||||
engines: {node: '>=16.20.0'}
|
|
||||||
hasBin: true
|
|
||||||
|
|
||||||
undici-types@8.9.0:
|
|
||||||
resolution: {integrity: sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==}
|
|
||||||
|
|
||||||
snapshots:
|
|
||||||
|
|
||||||
'@types/body-parser@1.19.6':
|
|
||||||
dependencies:
|
|
||||||
'@types/connect': 3.4.38
|
|
||||||
'@types/node': 26.5.0
|
|
||||||
|
|
||||||
'@types/connect@3.4.38':
|
|
||||||
dependencies:
|
|
||||||
'@types/node': 26.5.0
|
|
||||||
|
|
||||||
'@types/express-serve-static-core@5.1.3':
|
|
||||||
dependencies:
|
|
||||||
'@types/node': 26.5.0
|
|
||||||
'@types/qs': 6.15.1
|
|
||||||
'@types/range-parser': 1.2.7
|
|
||||||
'@types/send': 1.2.1
|
|
||||||
|
|
||||||
'@types/express@5.0.6':
|
|
||||||
dependencies:
|
|
||||||
'@types/body-parser': 1.19.6
|
|
||||||
'@types/express-serve-static-core': 5.1.3
|
|
||||||
'@types/serve-static': 2.2.0
|
|
||||||
|
|
||||||
'@types/http-errors@2.0.5': {}
|
|
||||||
|
|
||||||
'@types/node@26.5.0':
|
|
||||||
dependencies:
|
|
||||||
undici-types: 8.9.0
|
|
||||||
|
|
||||||
'@types/qs@6.15.1': {}
|
|
||||||
|
|
||||||
'@types/range-parser@1.2.7': {}
|
|
||||||
|
|
||||||
'@types/send@1.2.1':
|
|
||||||
dependencies:
|
|
||||||
'@types/node': 26.5.0
|
|
||||||
|
|
||||||
'@types/serve-static@2.2.0':
|
|
||||||
dependencies:
|
|
||||||
'@types/http-errors': 2.0.5
|
|
||||||
'@types/node': 26.5.0
|
|
||||||
|
|
||||||
'@typescript/typescript-aix-ppc64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-darwin-arm64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-darwin-x64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-freebsd-arm64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-freebsd-x64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-arm64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-arm@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-loong64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-mips64el@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-ppc64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-riscv64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-s390x@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-linux-x64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-netbsd-arm64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-netbsd-x64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-openbsd-arm64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-openbsd-x64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-sunos-x64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-win32-arm64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@typescript/typescript-win32-x64@7.0.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
typescript@7.0.2:
|
|
||||||
optionalDependencies:
|
|
||||||
'@typescript/typescript-aix-ppc64': 7.0.2
|
|
||||||
'@typescript/typescript-darwin-arm64': 7.0.2
|
|
||||||
'@typescript/typescript-darwin-x64': 7.0.2
|
|
||||||
'@typescript/typescript-freebsd-arm64': 7.0.2
|
|
||||||
'@typescript/typescript-freebsd-x64': 7.0.2
|
|
||||||
'@typescript/typescript-linux-arm': 7.0.2
|
|
||||||
'@typescript/typescript-linux-arm64': 7.0.2
|
|
||||||
'@typescript/typescript-linux-loong64': 7.0.2
|
|
||||||
'@typescript/typescript-linux-mips64el': 7.0.2
|
|
||||||
'@typescript/typescript-linux-ppc64': 7.0.2
|
|
||||||
'@typescript/typescript-linux-riscv64': 7.0.2
|
|
||||||
'@typescript/typescript-linux-s390x': 7.0.2
|
|
||||||
'@typescript/typescript-linux-x64': 7.0.2
|
|
||||||
'@typescript/typescript-netbsd-arm64': 7.0.2
|
|
||||||
'@typescript/typescript-netbsd-x64': 7.0.2
|
|
||||||
'@typescript/typescript-openbsd-arm64': 7.0.2
|
|
||||||
'@typescript/typescript-openbsd-x64': 7.0.2
|
|
||||||
'@typescript/typescript-sunos-x64': 7.0.2
|
|
||||||
'@typescript/typescript-win32-arm64': 7.0.2
|
|
||||||
'@typescript/typescript-win32-x64': 7.0.2
|
|
||||||
|
|
||||||
undici-types@8.9.0: {}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
import { readJSON } from "./modules/parser/json.parser";
|
|
||||||
|
|
||||||
console.log("TS is working!!!");
|
|
||||||
readJSON("./src/modules/parser/fixtures/mock.fixture.json").then(d => console.log(JSON.stringify(d)));
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
export type HTTPHeaders = Record<string, string>;
|
|
||||||
|
|
||||||
export interface RawJuke {
|
|
||||||
path: string;
|
|
||||||
responses: Object[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Juke<T = unknown> {
|
|
||||||
path: string;
|
|
||||||
status: {
|
|
||||||
condition: (body: T, headers: HTTPHeaders) => boolean;
|
|
||||||
response: HTTPMinimalResponse<T>;
|
|
||||||
}[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface HTTPMinimalResponse<T> {
|
|
||||||
code: number;
|
|
||||||
body?: T;
|
|
||||||
}
|
|
||||||
Whitespace-only changes.
@@ -1,40 +0,0 @@
|
|||||||
{
|
|
||||||
"routes": [
|
|
||||||
{
|
|
||||||
"path": "/test",
|
|
||||||
"responses": [
|
|
||||||
{
|
|
||||||
"code": "401",
|
|
||||||
"when": "body.name !== 'test' || headers['Content-Type'] !== 'application/json'"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"code": "200",
|
|
||||||
"when": "",
|
|
||||||
"body": {
|
|
||||||
"name": "$request.body.name",
|
|
||||||
"param": "$query.id",
|
|
||||||
"data": [{
|
|
||||||
"title": "$word",
|
|
||||||
"subtitle": "$word",
|
|
||||||
"description": "$text"
|
|
||||||
}],
|
|
||||||
"limitedData": {
|
|
||||||
"$array": {
|
|
||||||
"$array.count": 15,
|
|
||||||
"$array.content": {
|
|
||||||
"title": "$word",
|
|
||||||
"subtitle": "$word",
|
|
||||||
"description": "$text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pagination": {
|
|
||||||
"page": "$number",
|
|
||||||
"total": "$number"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import { readFile } from "node:fs/promises";
|
|
||||||
import { RawJuke } from "../core/juker.types";
|
|
||||||
|
|
||||||
export async function readJSON(path: string): Promise<RawJuke[]> {
|
|
||||||
try {
|
|
||||||
const jukes: RawJuke[] = [];
|
|
||||||
const f = await readFile(path);
|
|
||||||
const j = JSON.parse(f.toString());
|
|
||||||
|
|
||||||
if ("routes" in j && Array.isArray(j.routes)) {
|
|
||||||
j.routes.forEach((route: RawJuke) => {
|
|
||||||
if ("path" in route && "responses" in route && Array.isArray(route.responses)) {
|
|
||||||
jukes.push({ path: route.path, responses: route.responses })
|
|
||||||
} else {
|
|
||||||
console.error("[!!] Route entry wrong format");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
throw Error("incorrect format, 'routes' not present at the root of the file.")
|
|
||||||
}
|
|
||||||
|
|
||||||
return jukes;
|
|
||||||
} catch (e) {
|
|
||||||
console.error("[!!] Reading JSON error", e);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { Juke, RawJuke } from "../core/juker.types";
|
|
||||||
|
|
||||||
export function parseJuke(raw: RawJuke): Juke {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseObject(input: Object): Object {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseMock(input: string): unknown {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es6",
|
|
||||||
"module": "nodenext",
|
|
||||||
"lib": ["ESNext", "DOM"],
|
|
||||||
"skipLibCheck": true,
|
|
||||||
|
|
||||||
"rootDir": "./src",
|
|
||||||
"outDir": "./dist",
|
|
||||||
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"strict": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"typeRoots": [
|
|
||||||
"./node_modules/@types"
|
|
||||||
],
|
|
||||||
"types": [
|
|
||||||
"node"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"include": ["src/**/*.ts"],
|
|
||||||
"exclude": ["node_modules"]
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user