@utilix-tech/sdk 0.15.0 → 0.17.0
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/CHANGELOG.md +6 -0
- package/README.md +28 -9
- package/dist/{chunk-OB56VNKJ.js → chunk-3QMUUTBH.js} +107 -1
- package/dist/{chunk-IPR7FSX4.js → chunk-DOWQZUTP.js} +61 -1
- package/dist/{chunk-Y5X34JAC.js → chunk-L53LAVAD.js} +64 -1
- package/dist/{chunk-RJPYVCKQ.js → chunk-M4MMO6C6.js} +18 -1
- package/dist/{code-C4skwg3l.d.cts → code-Cn9uOIAh.d.cts} +27 -2
- package/dist/{code-C4skwg3l.d.ts → code-Cn9uOIAh.d.ts} +27 -2
- package/dist/{encoding-7gmq-vkV.d.cts → encoding-Dk3wpmb3.d.cts} +19 -2
- package/dist/{encoding-7gmq-vkV.d.ts → encoding-Dk3wpmb3.d.ts} +19 -2
- package/dist/index.cjs +246 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/{network-DaNoZ5ER.d.ts → network-DZugNyAQ.d.cts} +35 -2
- package/dist/{network-DaNoZ5ER.d.cts → network-DZugNyAQ.d.ts} +35 -2
- package/dist/tools/code.cjs +63 -0
- package/dist/tools/code.d.cts +1 -1
- package/dist/tools/code.d.ts +1 -1
- package/dist/tools/code.js +1 -1
- package/dist/tools/encoding.cjs +60 -0
- package/dist/tools/encoding.d.cts +1 -1
- package/dist/tools/encoding.d.ts +1 -1
- package/dist/tools/encoding.js +1 -1
- package/dist/tools/network.cjs +106 -0
- package/dist/tools/network.d.cts +1 -1
- package/dist/tools/network.d.ts +1 -1
- package/dist/tools/network.js +1 -1
- package/dist/tools/units.cjs +17 -0
- package/dist/tools/units.d.cts +1 -1
- package/dist/tools/units.d.ts +1 -1
- package/dist/tools/units.js +1 -1
- package/dist/{units-CADUCiYZ.d.cts → units-CkV4kAIs.d.cts} +21 -2
- package/dist/{units-CADUCiYZ.d.ts → units-CkV4kAIs.d.ts} +21 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Full release notes for all Utilix surfaces (browser tools, REST API, SDKs, MCP server) live at [utilix.tech/changelog](https://utilix.tech/changelog). This file tracks just this package.
|
|
4
4
|
|
|
5
|
+
## 0.17.0
|
|
6
|
+
- Added User-Agent Parser (`parseUserAgent`) and GitHub URL Parser (`parseGithubUrl`).
|
|
7
|
+
|
|
8
|
+
## 0.16.0
|
|
9
|
+
- Added Simple Interest Calculator (`calculateSimpleInterest`) and Base58 / Base62 Encoder (`base58Encode`, `base58Decode`, `base62Encode`, `base62Decode`).
|
|
10
|
+
|
|
5
11
|
## 0.15.0
|
|
6
12
|
- Added MIME Type Lookup (`lookupMime`) and Tip / Bill Split Calculator (`calculateTipSplit`).
|
|
7
13
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @utilix-tech/sdk
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**550 developer utility functions for Node.js: runs locally, no API key required.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
6
6
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
@@ -93,13 +93,18 @@ validateJson(data, schema);
|
|
|
93
93
|
|
|
94
94
|
```ts
|
|
95
95
|
import { encodeBase64, decodeBase64, encodeUrl, decodeUrl,
|
|
96
|
-
encodeHtmlEntities, decodeHtmlEntities, base32Encode, base32Decode
|
|
96
|
+
encodeHtmlEntities, decodeHtmlEntities, base32Encode, base32Decode,
|
|
97
|
+
base58Encode, base58Decode, base62Encode, base62Decode } from "@utilix-tech/sdk/encoding";
|
|
97
98
|
|
|
98
99
|
encodeBase64("Hello, World!"); // "SGVsbG8sIFdvcmxkIQ=="
|
|
99
100
|
decodeBase64("SGVsbG8sIFdvcmxkIQ=="); // "Hello, World!"
|
|
100
101
|
encodeUrl("hello world?"); // "hello%20world%3F"
|
|
101
102
|
encodeHtmlEntities("<div class=\"a\">"); // "<div class="a">"
|
|
102
103
|
base32Encode("hello"); // "NBSWY3DPEB3W64TMMQ======"
|
|
104
|
+
|
|
105
|
+
// Base58 (Bitcoin-style, no ambiguous 0/O/I/l) and Base62 (alphanumeric)
|
|
106
|
+
base58Encode("hello world"); // "StV1DL6CwTryKyV"
|
|
107
|
+
base62Encode("hello world"); // "AAwf93rvy4aWQVw"
|
|
103
108
|
```
|
|
104
109
|
|
|
105
110
|
---
|
|
@@ -242,7 +247,7 @@ getNextRuns("*/5 * * * *", 5); // next 5 run timestamps
|
|
|
242
247
|
### `/units`: Conversions
|
|
243
248
|
|
|
244
249
|
```ts
|
|
245
|
-
import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax, calculateCompoundInterest, validateIsbn, calculateTipSplit } from "@utilix-tech/sdk/units";
|
|
250
|
+
import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax, calculateCompoundInterest, validateIsbn, calculateTipSplit, calculateSimpleInterest } from "@utilix-tech/sdk/units";
|
|
246
251
|
|
|
247
252
|
// File sizes
|
|
248
253
|
convertBytes(1073741824, "GB"); // 1
|
|
@@ -292,6 +297,10 @@ validateIsbn("0-306-40615-2");
|
|
|
292
297
|
// Tip / bill split: tip amount, total, and an even per-person split
|
|
293
298
|
calculateTipSplit(84.5, 18, 2);
|
|
294
299
|
// { tipAmount: 15.21, totalAmount: 99.71, perPersonTotal: 49.86, ... }
|
|
300
|
+
|
|
301
|
+
// Simple (non-compounding) interest: principal x rate x time
|
|
302
|
+
calculateSimpleInterest(1000, 5, 2);
|
|
303
|
+
// { interest: 100, totalPayoff: 1100, ... }
|
|
295
304
|
```
|
|
296
305
|
|
|
297
306
|
---
|
|
@@ -301,7 +310,8 @@ calculateTipSplit(84.5, 18, 2);
|
|
|
301
310
|
```ts
|
|
302
311
|
import { getStatusCode, isValidIp, isValidIpv4, isValidIpv6,
|
|
303
312
|
searchStatusCodes, buildGeoUrl, countryCodeToFlag,
|
|
304
|
-
parseHar, validateSitemap, validateRobotsTxt
|
|
313
|
+
parseHar, validateSitemap, validateRobotsTxt,
|
|
314
|
+
parseUserAgent } from "@utilix-tech/sdk/network";
|
|
305
315
|
|
|
306
316
|
getStatusCode(404);
|
|
307
317
|
// { code: 404, text: "Not Found", description: "...", category: "Client Error" }
|
|
@@ -314,6 +324,11 @@ isValidIp("256.0.0.1"); // false
|
|
|
314
324
|
|
|
315
325
|
countryCodeToFlag("US"); // "🇺🇸"
|
|
316
326
|
|
|
327
|
+
// User-Agent parsing
|
|
328
|
+
parseUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36");
|
|
329
|
+
// { browser: { name: "Chrome", version: "120.0.0.0" }, engine: { name: "Blink", version: "120.0.0.0" },
|
|
330
|
+
// os: { name: "Windows", version: "10" }, device: { type: "desktop" }, raw: "..." }
|
|
331
|
+
|
|
317
332
|
// Parse a DevTools .har network export into entries + summary stats
|
|
318
333
|
const har = await fs.promises.readFile("network.har", "utf-8");
|
|
319
334
|
parseHar(har);
|
|
@@ -370,7 +385,7 @@ generateCspHeader({ "default-src": ["'self'"], "script-src": ["'self'", "cdn.exa
|
|
|
370
385
|
|
|
371
386
|
```ts
|
|
372
387
|
import { formatSql, minifySql, testRegex, formatHtml, formatGql,
|
|
373
|
-
detectDialect, splitStatements, lookupMime } from "@utilix-tech/sdk/code";
|
|
388
|
+
detectDialect, splitStatements, lookupMime, parseGithubUrl } from "@utilix-tech/sdk/code";
|
|
374
389
|
|
|
375
390
|
// SQL
|
|
376
391
|
formatSql("SELECT id,name FROM users WHERE active=1 ORDER BY name");
|
|
@@ -398,6 +413,10 @@ formatGql("query { user(id: 1) { name email } }");
|
|
|
398
413
|
// MIME type lookup, either direction
|
|
399
414
|
lookupMime("json"); // { kind: "extension", matches: [{ extension: "json", mimeType: "application/json" }] }
|
|
400
415
|
lookupMime("image/jpeg"); // { kind: "mime", matches: [{ extension: "jpg", ... }, { extension: "jpeg", ... }] }
|
|
416
|
+
|
|
417
|
+
// GitHub URL parsing
|
|
418
|
+
parseGithubUrl("https://github.com/facebook/react/pull/1234");
|
|
419
|
+
// { owner: "facebook", repo: "react", type: "pull", number: 1234 }
|
|
401
420
|
```
|
|
402
421
|
|
|
403
422
|
---
|
|
@@ -520,16 +539,16 @@ readIcoInfo(new Uint8Array(icoBytes));
|
|
|
520
539
|
| Import | What it does |
|
|
521
540
|
|---|---|
|
|
522
541
|
| `@utilix-tech/sdk/json` | Format, minify, diff, validate, JSONPath, CSV↔JSON, YAML↔JSON, TS types |
|
|
523
|
-
| `@utilix-tech/sdk/encoding` | Base64, URL, HTML entities, Base32 encode/decode |
|
|
542
|
+
| `@utilix-tech/sdk/encoding` | Base64, URL, HTML entities, Base32/Base58/Base62 encode/decode |
|
|
524
543
|
| `@utilix-tech/sdk/hashing` | MD5, SHA-1/256/512, bcrypt, HMAC, .htpasswd |
|
|
525
544
|
| `@utilix-tech/sdk/text` | Case convert, slugify, word count, lorem ipsum, line ops, HTML→Markdown |
|
|
526
545
|
| `@utilix-tech/sdk/data` | CSV, YAML, TOML, XML, INI, NDJSON parse and convert |
|
|
527
546
|
| `@utilix-tech/sdk/generators` | UUID v4/v7, ULID, passwords, strength check, fake data |
|
|
528
547
|
| `@utilix-tech/sdk/time` | Date diff, timezone convert, cron parse, relative time |
|
|
529
|
-
| `@utilix-tech/sdk/units` | Bytes, CSS px/rem, number bases, currency format, credit card/IBAN/barcode/ISBN validation, loan calculator, compound interest
|
|
530
|
-
| `@utilix-tech/sdk/network` | HTTP status codes, IP validation, country flags, geolocation URLs, HAR file parsing |
|
|
548
|
+
| `@utilix-tech/sdk/units` | Bytes, CSS px/rem, number bases, currency format, credit card/IBAN/barcode/ISBN validation, loan calculator, compound/simple interest calculators, VAT/sales tax calculator, tip/bill split calculator |
|
|
549
|
+
| `@utilix-tech/sdk/network` | HTTP status codes, IP validation, country flags, geolocation URLs, HAR file parsing, User-Agent parsing |
|
|
531
550
|
| `@utilix-tech/sdk/api` | cURL build/parse, JWT decode/sign, JWKS parse, CORS headers, CSP header |
|
|
532
|
-
| `@utilix-tech/sdk/code` | SQL format/minify, HTML format/minify, regex tester, GraphQL format, MIME type lookup |
|
|
551
|
+
| `@utilix-tech/sdk/code` | SQL format/minify, HTML format/minify, regex tester, GraphQL format, MIME type lookup, GitHub URL parsing |
|
|
533
552
|
| `@utilix-tech/sdk/color` | Hex/RGB/HSL/HSV/CMYK convert, palette generation, contrast check |
|
|
534
553
|
| `@utilix-tech/sdk/css` | CSS gradient, box-shadow, border-radius, keyframe animation generators |
|
|
535
554
|
| `@utilix-tech/sdk/misc` | SVG optimize/sanitize, file size format, Unicode inspector |
|
|
@@ -26,6 +26,7 @@ __export(network_exports, {
|
|
|
26
26
|
parseDnsResponse: () => parseDnsResponse,
|
|
27
27
|
parseGeoResponse: () => parseGeoResponse,
|
|
28
28
|
parseHar: () => parseHar,
|
|
29
|
+
parseUserAgent: () => parseUserAgent,
|
|
29
30
|
searchHeaders: () => searchHeaders,
|
|
30
31
|
searchStatusCodes: () => searchStatusCodes,
|
|
31
32
|
statusCodeToText: () => statusCodeToText,
|
|
@@ -1615,5 +1616,110 @@ function validateRobotsTxt(text) {
|
|
|
1615
1616
|
const valid = !issues.some((i) => i.severity === "error");
|
|
1616
1617
|
return { groups, sitemaps, issues, valid };
|
|
1617
1618
|
}
|
|
1619
|
+
var UA_BOT_PATTERNS = [
|
|
1620
|
+
[/googlebot/i, "Googlebot"],
|
|
1621
|
+
[/bingbot/i, "Bingbot"],
|
|
1622
|
+
[/slurp/i, "Slurp"],
|
|
1623
|
+
[/duckduckbot/i, "DuckDuckBot"],
|
|
1624
|
+
[/baiduspider/i, "Baiduspider"],
|
|
1625
|
+
[/yandexbot/i, "YandexBot"],
|
|
1626
|
+
[/facebookexternalhit/i, "Facebot"],
|
|
1627
|
+
[/twitterbot/i, "Twitterbot"],
|
|
1628
|
+
[/applebot/i, "Applebot"],
|
|
1629
|
+
[/discordbot/i, "Discordbot"],
|
|
1630
|
+
[/slackbot/i, "Slackbot"],
|
|
1631
|
+
[/telegrambot/i, "TelegramBot"],
|
|
1632
|
+
[/whatsapp/i, "WhatsApp"],
|
|
1633
|
+
[/ahrefsbot/i, "AhrefsBot"],
|
|
1634
|
+
[/semrushbot/i, "SemrushBot"],
|
|
1635
|
+
[/crawler|spider|\bbot\b/i, "Bot"]
|
|
1636
|
+
];
|
|
1637
|
+
function _detectUaBrowser(s) {
|
|
1638
|
+
let m;
|
|
1639
|
+
if (m = s.match(/Edg(?:A|iOS)?\/([\d.]+)/)) return { name: "Edge", version: m[1] };
|
|
1640
|
+
if (m = s.match(/Edge\/([\d.]+)/)) return { name: "Edge (Legacy)", version: m[1] };
|
|
1641
|
+
if (m = s.match(/OPR\/([\d.]+)/)) return { name: "Opera", version: m[1] };
|
|
1642
|
+
if (m = s.match(/Opera\/([\d.]+)/)) return { name: "Opera", version: m[1] };
|
|
1643
|
+
if (m = s.match(/SamsungBrowser\/([\d.]+)/)) return { name: "Samsung Internet", version: m[1] };
|
|
1644
|
+
if (m = s.match(/FxiOS\/([\d.]+)/)) return { name: "Firefox", version: m[1] };
|
|
1645
|
+
if (m = s.match(/Firefox\/([\d.]+)/)) return { name: "Firefox", version: m[1] };
|
|
1646
|
+
if (m = s.match(/CriOS\/([\d.]+)/)) return { name: "Chrome", version: m[1] };
|
|
1647
|
+
if (m = s.match(/Chrome\/([\d.]+)/)) return { name: "Chrome", version: m[1] };
|
|
1648
|
+
if (m = s.match(/Version\/([\d.]+).*Safari\//)) return { name: "Safari", version: m[1] };
|
|
1649
|
+
if (/Safari\//.test(s)) return { name: "Safari", version: "" };
|
|
1650
|
+
if (m = s.match(/MSIE ([\d.]+)/)) return { name: "Internet Explorer", version: m[1] };
|
|
1651
|
+
if (m = s.match(/Trident\/.*rv:([\d.]+)/)) return { name: "Internet Explorer", version: m[1] };
|
|
1652
|
+
return { name: "Unknown", version: "" };
|
|
1653
|
+
}
|
|
1654
|
+
function _detectUaEngine(s, browserName) {
|
|
1655
|
+
let m;
|
|
1656
|
+
if (/Chrome\/|CriOS\/|Edg\/|OPR\/|SamsungBrowser\//.test(s)) {
|
|
1657
|
+
m = s.match(/Chrome\/([\d.]+)/) || s.match(/CriOS\/([\d.]+)/);
|
|
1658
|
+
return { name: "Blink", version: m ? m[1] : "" };
|
|
1659
|
+
}
|
|
1660
|
+
if (/Firefox\/|FxiOS\//.test(s)) {
|
|
1661
|
+
m = s.match(/rv:([\d.]+)/);
|
|
1662
|
+
return { name: "Gecko", version: m ? m[1] : "" };
|
|
1663
|
+
}
|
|
1664
|
+
if (m = s.match(/AppleWebKit\/([\d.]+)/)) return { name: "WebKit", version: m[1] };
|
|
1665
|
+
if (m = s.match(/Trident\/([\d.]+)/)) return { name: "Trident", version: m[1] };
|
|
1666
|
+
if (browserName === "Edge (Legacy)") return { name: "EdgeHTML", version: "" };
|
|
1667
|
+
return { name: "Unknown", version: "" };
|
|
1668
|
+
}
|
|
1669
|
+
var UA_WINDOWS_VERSIONS = {
|
|
1670
|
+
"10.0": "10",
|
|
1671
|
+
"6.3": "8.1",
|
|
1672
|
+
"6.2": "8",
|
|
1673
|
+
"6.1": "7",
|
|
1674
|
+
"6.0": "Vista",
|
|
1675
|
+
"5.1": "XP"
|
|
1676
|
+
};
|
|
1677
|
+
function _detectUaOs(s) {
|
|
1678
|
+
if (/Windows NT/.test(s)) return "Windows";
|
|
1679
|
+
if (/CrOS/.test(s)) return "ChromeOS";
|
|
1680
|
+
if (/Android/.test(s)) return "Android";
|
|
1681
|
+
if (/iPhone|iPad|iPod/.test(s)) return "iOS";
|
|
1682
|
+
if (/Mac OS X/.test(s)) return "macOS";
|
|
1683
|
+
if (/Linux/.test(s)) return "Linux";
|
|
1684
|
+
return "Unknown";
|
|
1685
|
+
}
|
|
1686
|
+
function _detectUaOsVersion(s) {
|
|
1687
|
+
let m;
|
|
1688
|
+
if (m = s.match(/Windows NT ([\d.]+)/)) return UA_WINDOWS_VERSIONS[m[1]] ?? m[1];
|
|
1689
|
+
if (/CrOS/.test(s) && (m = s.match(/CrOS \S+ ([\d.]+)/))) return m[1];
|
|
1690
|
+
if (m = s.match(/Android ([\d.]+)/)) return m[1];
|
|
1691
|
+
if (m = s.match(/(?:iPhone|CPU) OS ([\d_]+)/)) return m[1].replace(/_/g, ".");
|
|
1692
|
+
if (m = s.match(/Mac OS X ([\d_]+)/)) return m[1].replace(/_/g, ".");
|
|
1693
|
+
return "";
|
|
1694
|
+
}
|
|
1695
|
+
function _detectUaDeviceType(s) {
|
|
1696
|
+
if (/iPad/.test(s)) return "tablet";
|
|
1697
|
+
if (/Android/.test(s) && !/Mobile/.test(s)) return "tablet";
|
|
1698
|
+
if (/Mobile|iPhone|iPod|Android/.test(s)) return "mobile";
|
|
1699
|
+
return "desktop";
|
|
1700
|
+
}
|
|
1701
|
+
function parseUserAgent(ua) {
|
|
1702
|
+
if (!ua || typeof ua !== "string" || ua.trim() === "") {
|
|
1703
|
+
return { error: "Empty user-agent string" };
|
|
1704
|
+
}
|
|
1705
|
+
const s = ua.trim();
|
|
1706
|
+
for (const [re, name] of UA_BOT_PATTERNS) {
|
|
1707
|
+
if (re.test(s)) {
|
|
1708
|
+
const versionMatch = s.match(new RegExp(`${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\/([\\d.]+)`, "i"));
|
|
1709
|
+
return {
|
|
1710
|
+
browser: { name, version: versionMatch ? versionMatch[1] : "" },
|
|
1711
|
+
engine: { name: "Unknown", version: "" },
|
|
1712
|
+
os: { name: _detectUaOs(s), version: _detectUaOsVersion(s) },
|
|
1713
|
+
device: { type: "bot" },
|
|
1714
|
+
raw: s
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
const browser = _detectUaBrowser(s);
|
|
1719
|
+
const engine = _detectUaEngine(s, browser.name);
|
|
1720
|
+
const os = { name: _detectUaOs(s), version: _detectUaOsVersion(s) };
|
|
1721
|
+
const device = { type: _detectUaDeviceType(s) };
|
|
1722
|
+
return { browser, engine, os, device, raw: s };
|
|
1723
|
+
}
|
|
1618
1724
|
|
|
1619
|
-
export { DNS_RECORD_TYPES, HTTP_HEADERS, STATUS_CODES, buildDnsQueryUrl, buildGeoUrl, buildMapUrl, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseDnsResponse, parseGeoResponse, parseHar, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap };
|
|
1725
|
+
export { DNS_RECORD_TYPES, HTTP_HEADERS, STATUS_CODES, buildDnsQueryUrl, buildGeoUrl, buildMapUrl, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseDnsResponse, parseGeoResponse, parseHar, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap };
|
|
@@ -8,6 +8,10 @@ __export(encoding_exports, {
|
|
|
8
8
|
base32DecodeBytes: () => base32DecodeBytes,
|
|
9
9
|
base32Encode: () => base32Encode,
|
|
10
10
|
base32EncodeBytes: () => base32EncodeBytes,
|
|
11
|
+
base58Decode: () => base58Decode,
|
|
12
|
+
base58Encode: () => base58Encode,
|
|
13
|
+
base62Decode: () => base62Decode,
|
|
14
|
+
base62Encode: () => base62Encode,
|
|
11
15
|
decodeBase64: () => decodeBase64,
|
|
12
16
|
decodeHtmlEntities: () => decodeHtmlEntities,
|
|
13
17
|
decodeUrl: () => decodeUrl,
|
|
@@ -261,5 +265,61 @@ function isValidBase32(input, alphabet = "standard") {
|
|
|
261
265
|
if (rem === 1 || rem === 3 || rem === 6) return false;
|
|
262
266
|
return true;
|
|
263
267
|
}
|
|
268
|
+
var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
269
|
+
var BASE62_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
270
|
+
function encodeBytesToBase(bytes, alphabet) {
|
|
271
|
+
const base = BigInt(alphabet.length);
|
|
272
|
+
let num = 0n;
|
|
273
|
+
for (const byte of bytes) num = num << 8n | BigInt(byte);
|
|
274
|
+
let out = "";
|
|
275
|
+
while (num > 0n) {
|
|
276
|
+
out = alphabet[Number(num % base)] + out;
|
|
277
|
+
num = num / base;
|
|
278
|
+
}
|
|
279
|
+
let leadingZeros = 0;
|
|
280
|
+
for (const byte of bytes) {
|
|
281
|
+
if (byte === 0) leadingZeros++;
|
|
282
|
+
else break;
|
|
283
|
+
}
|
|
284
|
+
return alphabet[0].repeat(leadingZeros) + out;
|
|
285
|
+
}
|
|
286
|
+
function decodeBaseToBytes(input, alphabet) {
|
|
287
|
+
const base = BigInt(alphabet.length);
|
|
288
|
+
let num = 0n;
|
|
289
|
+
for (const char of input) {
|
|
290
|
+
const idx = alphabet.indexOf(char);
|
|
291
|
+
if (idx === -1) return { error: `Invalid character '${char}' for this alphabet` };
|
|
292
|
+
num = num * base + BigInt(idx);
|
|
293
|
+
}
|
|
294
|
+
const bytes = [];
|
|
295
|
+
while (num > 0n) {
|
|
296
|
+
bytes.unshift(Number(num % 256n));
|
|
297
|
+
num = num / 256n;
|
|
298
|
+
}
|
|
299
|
+
let leadingZeros = 0;
|
|
300
|
+
for (const char of input) {
|
|
301
|
+
if (char === alphabet[0]) leadingZeros++;
|
|
302
|
+
else break;
|
|
303
|
+
}
|
|
304
|
+
return new Uint8Array([...new Array(leadingZeros).fill(0), ...bytes]);
|
|
305
|
+
}
|
|
306
|
+
function base58Encode(input) {
|
|
307
|
+
return encodeBytesToBase(stringToBytes(input), BASE58_ALPHABET);
|
|
308
|
+
}
|
|
309
|
+
function base58Decode(input) {
|
|
310
|
+
if (!input) return { error: "No input provided" };
|
|
311
|
+
const result = decodeBaseToBytes(input, BASE58_ALPHABET);
|
|
312
|
+
if (!(result instanceof Uint8Array)) return result;
|
|
313
|
+
return bytesToString(result);
|
|
314
|
+
}
|
|
315
|
+
function base62Encode(input) {
|
|
316
|
+
return encodeBytesToBase(stringToBytes(input), BASE62_ALPHABET);
|
|
317
|
+
}
|
|
318
|
+
function base62Decode(input) {
|
|
319
|
+
if (!input) return { error: "No input provided" };
|
|
320
|
+
const result = decodeBaseToBytes(input, BASE62_ALPHABET);
|
|
321
|
+
if (!(result instanceof Uint8Array)) return result;
|
|
322
|
+
return bytesToString(result);
|
|
323
|
+
}
|
|
264
324
|
|
|
265
|
-
export { ALPHABETS, base32Decode, base32DecodeBytes, base32Encode, base32EncodeBytes, decodeBase64, decodeHtmlEntities, decodeUrl, diffSegments, encodeBase64, encodeHtmlEntities, encodeHtmlEntitiesAll, encodeUrl, encoding_exports, isValidBase32 };
|
|
325
|
+
export { ALPHABETS, base32Decode, base32DecodeBytes, base32Encode, base32EncodeBytes, base58Decode, base58Encode, base62Decode, base62Encode, decodeBase64, decodeHtmlEntities, decodeUrl, diffSegments, encodeBase64, encodeHtmlEntities, encodeHtmlEntitiesAll, encodeUrl, encoding_exports, isValidBase32 };
|
|
@@ -39,6 +39,7 @@ __export(code_exports, {
|
|
|
39
39
|
parseDockerImage: () => parseDockerImage,
|
|
40
40
|
parseEnv: () => parseEnv,
|
|
41
41
|
parseGitCommand: () => parseGitCommand,
|
|
42
|
+
parseGithubUrl: () => parseGithubUrl,
|
|
42
43
|
parseSpec: () => parseSpec,
|
|
43
44
|
removeConsoleCalls: () => removeConsoleCalls,
|
|
44
45
|
removeEmptyAttributes: () => removeEmptyAttributes,
|
|
@@ -2412,5 +2413,67 @@ function lookupMime(query) {
|
|
|
2412
2413
|
if (matches.length === 0) return { error: `No known MIME type for extension ".${ext}"` };
|
|
2413
2414
|
return { query: trimmed, kind: "extension", matches };
|
|
2414
2415
|
}
|
|
2416
|
+
function _parseGithubLineRange(hash) {
|
|
2417
|
+
const m = hash.match(/^#?L(\d+)(?:-L?(\d+))?$/i);
|
|
2418
|
+
if (!m) return {};
|
|
2419
|
+
const startLine = parseInt(m[1], 10);
|
|
2420
|
+
const endLine = m[2] ? parseInt(m[2], 10) : void 0;
|
|
2421
|
+
return endLine !== void 0 ? { startLine, endLine } : { startLine };
|
|
2422
|
+
}
|
|
2423
|
+
function parseGithubUrl(input) {
|
|
2424
|
+
if (!input || typeof input !== "string" || input.trim() === "") {
|
|
2425
|
+
return { error: "Empty URL" };
|
|
2426
|
+
}
|
|
2427
|
+
const trimmed = input.trim();
|
|
2428
|
+
const normalized = /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
|
|
2429
|
+
let url;
|
|
2430
|
+
try {
|
|
2431
|
+
url = new URL(normalized);
|
|
2432
|
+
} catch {
|
|
2433
|
+
return { error: "Invalid URL" };
|
|
2434
|
+
}
|
|
2435
|
+
if (!/^(www\.)?github\.com$/i.test(url.hostname)) {
|
|
2436
|
+
return { error: `Not a github.com URL (got host "${url.hostname}")` };
|
|
2437
|
+
}
|
|
2438
|
+
const segments = url.pathname.split("/").filter(Boolean);
|
|
2439
|
+
if (segments.length < 2) {
|
|
2440
|
+
return { error: "URL must include an owner and a repository" };
|
|
2441
|
+
}
|
|
2442
|
+
const [owner, repo, ...rest] = segments;
|
|
2443
|
+
if (rest.length === 0) {
|
|
2444
|
+
return { owner, repo, type: "repo" };
|
|
2445
|
+
}
|
|
2446
|
+
const kind = rest[0];
|
|
2447
|
+
if (kind === "pull" || kind === "issues") {
|
|
2448
|
+
const number = parseInt(rest[1], 10);
|
|
2449
|
+
if (!rest[1] || Number.isNaN(number)) {
|
|
2450
|
+
return { error: `Missing ${kind === "pull" ? "pull request" : "issue"} number` };
|
|
2451
|
+
}
|
|
2452
|
+
return { owner, repo, type: kind === "pull" ? "pull" : "issue", number };
|
|
2453
|
+
}
|
|
2454
|
+
if (kind === "commit") {
|
|
2455
|
+
if (!rest[1]) return { error: "Missing commit SHA" };
|
|
2456
|
+
return { owner, repo, type: "commit", ref: rest[1] };
|
|
2457
|
+
}
|
|
2458
|
+
if (kind === "blob") {
|
|
2459
|
+
const ref = rest[1];
|
|
2460
|
+
const path = rest.slice(2).join("/");
|
|
2461
|
+
if (!ref || !path) return { error: "File URL must include a ref and a file path (/blob/<ref>/<path>)" };
|
|
2462
|
+
return { owner, repo, type: "file", ref, path, ..._parseGithubLineRange(url.hash) };
|
|
2463
|
+
}
|
|
2464
|
+
if (kind === "tree") {
|
|
2465
|
+
const ref = rest[1];
|
|
2466
|
+
if (!ref) return { error: "Missing branch or tag ref (/tree/<ref>)" };
|
|
2467
|
+
const path = rest.slice(2).join("/");
|
|
2468
|
+
return { owner, repo, type: "tree", ref, ...path ? { path } : {} };
|
|
2469
|
+
}
|
|
2470
|
+
if (kind === "releases") {
|
|
2471
|
+
if (rest[1] !== "tag" || !rest[2]) {
|
|
2472
|
+
return { error: "Unsupported releases URL (expected /releases/tag/<name>)" };
|
|
2473
|
+
}
|
|
2474
|
+
return { owner, repo, type: "release", ref: rest[2] };
|
|
2475
|
+
}
|
|
2476
|
+
return { error: `Unsupported GitHub URL path: /${rest.join("/")}` };
|
|
2477
|
+
}
|
|
2415
2478
|
|
|
2416
|
-
export { ALL_FLAGS, CHEATSHEET, MIME_TABLE, OPERATIONS, SQL_DEFAULT_OPTIONS, buildDockerPull, buildDockerRun, buildGitCommand, code_exports, collapseHtmlWhitespace, collapseJsWhitespace, countProperties, countRules, detectDialect, detectOperationType, envToExport, envToJson, formatCss, formatGql, formatHtml, formatSql, getEndpointsByTag, getHtmlStats, getJsStats, getMethodColor, isValidTag, lookupMime, minifyCss, minifyGql, minifyHtml, minifyJs, minifySql, normalizeRef, parseDockerImage, parseEnv, parseGitCommand, parseSpec, removeConsoleCalls, removeEmptyAttributes, removeHtmlComments, removeJsComments, removeRedundantAttributes, searchCheatsheet, searchEndpoints, splitStatements, testPattern, testRegex, validateEnvKey };
|
|
2479
|
+
export { ALL_FLAGS, CHEATSHEET, MIME_TABLE, OPERATIONS, SQL_DEFAULT_OPTIONS, buildDockerPull, buildDockerRun, buildGitCommand, code_exports, collapseHtmlWhitespace, collapseJsWhitespace, countProperties, countRules, detectDialect, detectOperationType, envToExport, envToJson, formatCss, formatGql, formatHtml, formatSql, getEndpointsByTag, getHtmlStats, getJsStats, getMethodColor, isValidTag, lookupMime, minifyCss, minifyGql, minifyHtml, minifyJs, minifySql, normalizeRef, parseDockerImage, parseEnv, parseGitCommand, parseGithubUrl, parseSpec, removeConsoleCalls, removeEmptyAttributes, removeHtmlComments, removeJsComments, removeRedundantAttributes, searchCheatsheet, searchEndpoints, splitStatements, testPattern, testRegex, validateEnvKey };
|
|
@@ -20,6 +20,7 @@ __export(units_exports, {
|
|
|
20
20
|
calcSubnet: () => calcSubnet,
|
|
21
21
|
calculateCompoundInterest: () => calculateCompoundInterest,
|
|
22
22
|
calculateLoan: () => calculateLoan,
|
|
23
|
+
calculateSimpleInterest: () => calculateSimpleInterest,
|
|
23
24
|
calculateTax: () => calculateTax,
|
|
24
25
|
calculateTipSplit: () => calculateTipSplit,
|
|
25
26
|
compareSemver: () => compareSemver,
|
|
@@ -1280,5 +1281,21 @@ function calculateTipSplit(billAmount, tipPercent, numPeople = 1) {
|
|
|
1280
1281
|
perPersonTotal: round22(totalAmount / numPeople)
|
|
1281
1282
|
};
|
|
1282
1283
|
}
|
|
1284
|
+
function calculateSimpleInterest(principal, annualRatePercent, years) {
|
|
1285
|
+
if (!Number.isFinite(principal) || principal < 0) return { error: "Principal must be zero or a positive number" };
|
|
1286
|
+
if (!Number.isFinite(annualRatePercent) || annualRatePercent < 0) {
|
|
1287
|
+
return { error: "Annual interest rate must be zero or a positive number" };
|
|
1288
|
+
}
|
|
1289
|
+
if (!Number.isFinite(years) || years <= 0) return { error: "Years must be a positive number" };
|
|
1290
|
+
const round22 = (n) => Math.round(n * 100) / 100;
|
|
1291
|
+
const interest = round22(principal * (annualRatePercent / 100) * years);
|
|
1292
|
+
return {
|
|
1293
|
+
principal: round22(principal),
|
|
1294
|
+
annualRatePercent,
|
|
1295
|
+
years,
|
|
1296
|
+
interest,
|
|
1297
|
+
totalPayoff: round22(principal + interest)
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1283
1300
|
|
|
1284
|
-
export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_TAX_RATES, COMMON_TIP_PERCENTAGES, COMMON_VIEWPORTS, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateCompoundInterest, calculateLoan, calculateTax, calculateTipSplit, compareSemver, convert, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, units_exports, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx };
|
|
1301
|
+
export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_TAX_RATES, COMMON_TIP_PERCENTAGES, COMMON_VIEWPORTS, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateCompoundInterest, calculateLoan, calculateSimpleInterest, calculateTax, calculateTipSplit, compareSemver, convert, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, units_exports, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx };
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* - env-parser (parseEnv, envToJson, envToExport, validateEnvKey)
|
|
19
19
|
* - css-minifier (minifyCss, formatCss, countRules, countProperties)
|
|
20
20
|
* - mime-lookup (lookupMime, MIME_TABLE)
|
|
21
|
+
* - github-url-parser (parseGithubUrl)
|
|
21
22
|
*/
|
|
22
23
|
type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
|
|
23
24
|
declare const ALL_FLAGS: RegexFlag[];
|
|
@@ -285,6 +286,27 @@ declare const MIME_TABLE: MimeEntry[];
|
|
|
285
286
|
declare function lookupMime(query: string): MimeLookupResult | {
|
|
286
287
|
error: string;
|
|
287
288
|
};
|
|
289
|
+
type GithubUrlType = 'repo' | 'pull' | 'issue' | 'commit' | 'file' | 'tree' | 'release';
|
|
290
|
+
interface GithubUrlInfo {
|
|
291
|
+
owner: string;
|
|
292
|
+
repo: string;
|
|
293
|
+
type: GithubUrlType;
|
|
294
|
+
number?: number;
|
|
295
|
+
ref?: string;
|
|
296
|
+
path?: string;
|
|
297
|
+
startLine?: number;
|
|
298
|
+
endLine?: number;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Parses a github.com URL (repo, pull request, issue, commit, or a
|
|
302
|
+
* file/tree with an optional line range) into structured components via
|
|
303
|
+
* the path segments GitHub's own routing uses. Only covers github.com URLs
|
|
304
|
+
* over HTTP(S): SSH remotes (git@github.com:owner/repo.git) and other Git
|
|
305
|
+
* hosts are out of scope.
|
|
306
|
+
*/
|
|
307
|
+
declare function parseGithubUrl(input: string): GithubUrlInfo | {
|
|
308
|
+
error: string;
|
|
309
|
+
};
|
|
288
310
|
|
|
289
311
|
declare const code_ALL_FLAGS: typeof ALL_FLAGS;
|
|
290
312
|
type code_ApiEndpoint = ApiEndpoint;
|
|
@@ -298,6 +320,8 @@ type code_EnvParseResult = EnvParseResult;
|
|
|
298
320
|
type code_GitCommandConfig = GitCommandConfig;
|
|
299
321
|
type code_GitCommandResult = GitCommandResult;
|
|
300
322
|
type code_GitOperation = GitOperation;
|
|
323
|
+
type code_GithubUrlInfo = GithubUrlInfo;
|
|
324
|
+
type code_GithubUrlType = GithubUrlType;
|
|
301
325
|
type code_GqlFormatResult = GqlFormatResult;
|
|
302
326
|
type code_HtmlFormatResult = HtmlFormatResult;
|
|
303
327
|
type code_HtmlMinifyOptions = HtmlMinifyOptions;
|
|
@@ -351,6 +375,7 @@ declare const code_normalizeRef: typeof normalizeRef;
|
|
|
351
375
|
declare const code_parseDockerImage: typeof parseDockerImage;
|
|
352
376
|
declare const code_parseEnv: typeof parseEnv;
|
|
353
377
|
declare const code_parseGitCommand: typeof parseGitCommand;
|
|
378
|
+
declare const code_parseGithubUrl: typeof parseGithubUrl;
|
|
354
379
|
declare const code_parseSpec: typeof parseSpec;
|
|
355
380
|
declare const code_removeConsoleCalls: typeof removeConsoleCalls;
|
|
356
381
|
declare const code_removeEmptyAttributes: typeof removeEmptyAttributes;
|
|
@@ -364,7 +389,7 @@ declare const code_testPattern: typeof testPattern;
|
|
|
364
389
|
declare const code_testRegex: typeof testRegex;
|
|
365
390
|
declare const code_validateEnvKey: typeof validateEnvKey;
|
|
366
391
|
declare namespace code {
|
|
367
|
-
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
392
|
+
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
368
393
|
}
|
|
369
394
|
|
|
370
|
-
export {
|
|
395
|
+
export { getEndpointsByTag as $, ALL_FLAGS as A, buildDockerRun as B, CHEATSHEET as C, type DockerImageRef as D, type EnvEntry as E, buildGitCommand as F, type GitCommandConfig as G, type HtmlFormatResult as H, collapseHtmlWhitespace as I, type JsMinifyOptions as J, collapseJsWhitespace as K, countProperties as L, MIME_TABLE as M, countRules as N, OPERATIONS as O, type ParsedSpec as P, detectDialect as Q, type RegexError as R, SQL_DEFAULT_OPTIONS as S, type TestPatternResult as T, detectOperationType as U, envToExport as V, envToJson as W, formatCss as X, formatGql as Y, formatHtml as Z, formatSql as _, type ApiEndpoint as a, getHtmlStats as a0, getJsStats as a1, getMethodColor as a2, isValidTag as a3, lookupMime as a4, minifyCss as a5, minifyGql as a6, minifyHtml as a7, minifyJs as a8, minifySql as a9, normalizeRef as aa, parseDockerImage as ab, parseEnv as ac, parseGitCommand as ad, parseGithubUrl as ae, parseSpec as af, removeConsoleCalls as ag, removeEmptyAttributes as ah, removeHtmlComments as ai, removeJsComments as aj, removeRedundantAttributes as ak, searchCheatsheet as al, searchEndpoints as am, splitStatements as an, testPattern as ao, testRegex as ap, validateEnvKey as aq, type ApiInfo as b, code as c, type CheatsheetEntry as d, type CssResult as e, type EnvParseResult as f, type GitCommandResult as g, type GitOperation as h, type GithubUrlInfo as i, type GithubUrlType as j, type GqlFormatResult as k, type HtmlMinifyOptions as l, type HtmlMinifyResult as m, type JsMinifyResult as n, type MatchResult as o, type MimeEntry as p, type MimeLookupResult as q, type RegexFlag as r, type RegexMatch as s, type RegexResult as t, type RegexSuccess as u, type Segment as v, type SpecVersion as w, type SqlDialect as x, type SqlFormatOptions as y, buildDockerPull as z };
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* - env-parser (parseEnv, envToJson, envToExport, validateEnvKey)
|
|
19
19
|
* - css-minifier (minifyCss, formatCss, countRules, countProperties)
|
|
20
20
|
* - mime-lookup (lookupMime, MIME_TABLE)
|
|
21
|
+
* - github-url-parser (parseGithubUrl)
|
|
21
22
|
*/
|
|
22
23
|
type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
|
|
23
24
|
declare const ALL_FLAGS: RegexFlag[];
|
|
@@ -285,6 +286,27 @@ declare const MIME_TABLE: MimeEntry[];
|
|
|
285
286
|
declare function lookupMime(query: string): MimeLookupResult | {
|
|
286
287
|
error: string;
|
|
287
288
|
};
|
|
289
|
+
type GithubUrlType = 'repo' | 'pull' | 'issue' | 'commit' | 'file' | 'tree' | 'release';
|
|
290
|
+
interface GithubUrlInfo {
|
|
291
|
+
owner: string;
|
|
292
|
+
repo: string;
|
|
293
|
+
type: GithubUrlType;
|
|
294
|
+
number?: number;
|
|
295
|
+
ref?: string;
|
|
296
|
+
path?: string;
|
|
297
|
+
startLine?: number;
|
|
298
|
+
endLine?: number;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Parses a github.com URL (repo, pull request, issue, commit, or a
|
|
302
|
+
* file/tree with an optional line range) into structured components via
|
|
303
|
+
* the path segments GitHub's own routing uses. Only covers github.com URLs
|
|
304
|
+
* over HTTP(S): SSH remotes (git@github.com:owner/repo.git) and other Git
|
|
305
|
+
* hosts are out of scope.
|
|
306
|
+
*/
|
|
307
|
+
declare function parseGithubUrl(input: string): GithubUrlInfo | {
|
|
308
|
+
error: string;
|
|
309
|
+
};
|
|
288
310
|
|
|
289
311
|
declare const code_ALL_FLAGS: typeof ALL_FLAGS;
|
|
290
312
|
type code_ApiEndpoint = ApiEndpoint;
|
|
@@ -298,6 +320,8 @@ type code_EnvParseResult = EnvParseResult;
|
|
|
298
320
|
type code_GitCommandConfig = GitCommandConfig;
|
|
299
321
|
type code_GitCommandResult = GitCommandResult;
|
|
300
322
|
type code_GitOperation = GitOperation;
|
|
323
|
+
type code_GithubUrlInfo = GithubUrlInfo;
|
|
324
|
+
type code_GithubUrlType = GithubUrlType;
|
|
301
325
|
type code_GqlFormatResult = GqlFormatResult;
|
|
302
326
|
type code_HtmlFormatResult = HtmlFormatResult;
|
|
303
327
|
type code_HtmlMinifyOptions = HtmlMinifyOptions;
|
|
@@ -351,6 +375,7 @@ declare const code_normalizeRef: typeof normalizeRef;
|
|
|
351
375
|
declare const code_parseDockerImage: typeof parseDockerImage;
|
|
352
376
|
declare const code_parseEnv: typeof parseEnv;
|
|
353
377
|
declare const code_parseGitCommand: typeof parseGitCommand;
|
|
378
|
+
declare const code_parseGithubUrl: typeof parseGithubUrl;
|
|
354
379
|
declare const code_parseSpec: typeof parseSpec;
|
|
355
380
|
declare const code_removeConsoleCalls: typeof removeConsoleCalls;
|
|
356
381
|
declare const code_removeEmptyAttributes: typeof removeEmptyAttributes;
|
|
@@ -364,7 +389,7 @@ declare const code_testPattern: typeof testPattern;
|
|
|
364
389
|
declare const code_testRegex: typeof testRegex;
|
|
365
390
|
declare const code_validateEnvKey: typeof validateEnvKey;
|
|
366
391
|
declare namespace code {
|
|
367
|
-
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
392
|
+
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
368
393
|
}
|
|
369
394
|
|
|
370
|
-
export {
|
|
395
|
+
export { getEndpointsByTag as $, ALL_FLAGS as A, buildDockerRun as B, CHEATSHEET as C, type DockerImageRef as D, type EnvEntry as E, buildGitCommand as F, type GitCommandConfig as G, type HtmlFormatResult as H, collapseHtmlWhitespace as I, type JsMinifyOptions as J, collapseJsWhitespace as K, countProperties as L, MIME_TABLE as M, countRules as N, OPERATIONS as O, type ParsedSpec as P, detectDialect as Q, type RegexError as R, SQL_DEFAULT_OPTIONS as S, type TestPatternResult as T, detectOperationType as U, envToExport as V, envToJson as W, formatCss as X, formatGql as Y, formatHtml as Z, formatSql as _, type ApiEndpoint as a, getHtmlStats as a0, getJsStats as a1, getMethodColor as a2, isValidTag as a3, lookupMime as a4, minifyCss as a5, minifyGql as a6, minifyHtml as a7, minifyJs as a8, minifySql as a9, normalizeRef as aa, parseDockerImage as ab, parseEnv as ac, parseGitCommand as ad, parseGithubUrl as ae, parseSpec as af, removeConsoleCalls as ag, removeEmptyAttributes as ah, removeHtmlComments as ai, removeJsComments as aj, removeRedundantAttributes as ak, searchCheatsheet as al, searchEndpoints as am, splitStatements as an, testPattern as ao, testRegex as ap, validateEnvKey as aq, type ApiInfo as b, code as c, type CheatsheetEntry as d, type CssResult as e, type EnvParseResult as f, type GitCommandResult as g, type GitOperation as h, type GithubUrlInfo as i, type GithubUrlType as j, type GqlFormatResult as k, type HtmlMinifyOptions as l, type HtmlMinifyResult as m, type JsMinifyResult as n, type MatchResult as o, type MimeEntry as p, type MimeLookupResult as q, type RegexFlag as r, type RegexMatch as s, type RegexResult as t, type RegexSuccess as u, type Segment as v, type SpecVersion as w, type SqlDialect as x, type SqlFormatOptions as y, buildDockerPull as z };
|