@utilix-tech/sdk 0.25.0 → 0.26.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 +4 -0
- package/README.md +11 -3
- package/dist/{api-Xl7OzIgq.d.cts → api-DmTNE4c1.d.cts} +29 -2
- package/dist/{api-Xl7OzIgq.d.ts → api-DmTNE4c1.d.ts} +29 -2
- package/dist/{chunk-Q3B3YWOA.js → chunk-52ZDKSIX.js} +45 -2
- package/dist/{chunk-FVKNR3PV.js → chunk-HP6C4VBX.js} +54 -1
- package/dist/index.cjs +96 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/tools/api.cjs +43 -0
- package/dist/tools/api.d.cts +1 -1
- package/dist/tools/api.d.ts +1 -1
- package/dist/tools/api.js +1 -1
- package/dist/tools/units.cjs +53 -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-DUqjk24x.d.cts → units-D2wEimKG.d.cts} +39 -2
- package/dist/{units-DUqjk24x.d.ts → units-D2wEimKG.d.ts} +39 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.26.0
|
|
6
|
+
- Add `computeJwkThumbprint` (jwk-thumbprint): RFC 7638 canonical thumbprint of a single JWK, hashed with SHA-256/384/512.
|
|
7
|
+
- Add `calculateVideoBitrate` (video-bitrate-calculator): resulting file size from a video/audio bitrate and duration, or the required bitrate to hit a target file size.
|
|
8
|
+
|
|
5
9
|
## 0.25.0
|
|
6
10
|
- Add `calculateBreakEven` (break-even-calculator): break-even unit count and revenue from fixed costs, variable cost per unit, and price per unit, plus profit and margin of safety at an optional sales volume.
|
|
7
11
|
- Add `calculateStringDistance` (string-distance): Levenshtein edit distance and normalized similarity between two strings, with an optional Damerau (transposition) mode.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @utilix-tech/sdk
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**576 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)
|
|
@@ -272,7 +272,7 @@ formatIso8601Duration(90061); // { iso: "P1DT1H1M1S", ... }
|
|
|
272
272
|
### `/units`: Conversions
|
|
273
273
|
|
|
274
274
|
```ts
|
|
275
|
-
import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax, calculateCompoundInterest, validateIsbn, calculateTipSplit, calculateSimpleInterest, calculateTimeValue, calculatePercentageChange, convertAprApy, calculateMarginMarkup, calculateDiscount, applySuccessiveDiscounts, calculateBreakEven } from "@utilix-tech/sdk/units";
|
|
275
|
+
import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan, validateBarcode, calculateTax, calculateCompoundInterest, validateIsbn, calculateTipSplit, calculateSimpleInterest, calculateTimeValue, calculatePercentageChange, convertAprApy, calculateMarginMarkup, calculateDiscount, applySuccessiveDiscounts, calculateBreakEven, calculateVideoBitrate } from "@utilix-tech/sdk/units";
|
|
276
276
|
|
|
277
277
|
// File sizes
|
|
278
278
|
convertBytes(1073741824, "GB"); // 1
|
|
@@ -354,6 +354,10 @@ applySuccessiveDiscounts(100, [20, 10]);
|
|
|
354
354
|
// Break-even point: fixed costs, variable cost/unit, price/unit
|
|
355
355
|
calculateBreakEven({ fixedCosts: 10000, variableCostPerUnit: 20, pricePerUnit: 50 });
|
|
356
356
|
// { breakEvenUnitsRounded: 334, breakEvenRevenue: 16666.6667, contributionMarginPerUnit: 30, ... }
|
|
357
|
+
|
|
358
|
+
// Video file size from a bitrate + duration, or the bitrate to hit a target size
|
|
359
|
+
calculateVideoBitrate({ mode: "size-from-bitrate", durationSeconds: 600, videoBitrateKbps: 5000, audioBitrateKbps: 192 });
|
|
360
|
+
// { totalBitrateKbps: 5192, fileSizeBytes: 389400000, fileSizeMB: 389.4, fileSizeMiB: 371.36, ... }
|
|
357
361
|
```
|
|
358
362
|
|
|
359
363
|
---
|
|
@@ -405,7 +409,7 @@ buildCacheControl({ visibility: "public", maxAge: 3600, mustRevalidate: true });
|
|
|
405
409
|
### `/api`: cURL, JWT, CORS, HTTP
|
|
406
410
|
|
|
407
411
|
```ts
|
|
408
|
-
import { buildCurl, parseCurlCommand, decodeJwt, signJwt, parseJwks,
|
|
412
|
+
import { buildCurl, parseCurlCommand, decodeJwt, signJwt, parseJwks, computeJwkThumbprint,
|
|
409
413
|
generateCors, generateCspHeader } from "@utilix-tech/sdk/api";
|
|
410
414
|
|
|
411
415
|
buildCurl({
|
|
@@ -429,6 +433,10 @@ decodeJwt("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...");
|
|
|
429
433
|
parseJwks('{"keys":[{"kty":"RSA","use":"sig","kid":"1","n":"...","e":"AQAB"}]}');
|
|
430
434
|
// { ok: true, keys: [{ kty: "RSA", kid: "1", keySize: 2048, ... }], count: 1, duplicateKids: [] }
|
|
431
435
|
|
|
436
|
+
// JWK thumbprint (RFC 7638): canonical fingerprint of a single JWK
|
|
437
|
+
computeJwkThumbprint('{"kty":"oct","k":"c2VjcmV0"}');
|
|
438
|
+
// { ok: true, kty: "oct", hashAlg: "SHA-256", thumbprint: "DWBh0SEIAPYh1x5uvot4z3AhaikHkxNJa3Ada2fT-Cg", ... }
|
|
439
|
+
|
|
432
440
|
// Generate CORS headers
|
|
433
441
|
generateCors({ origins: ["https://myapp.com"], methods: ["GET", "POST"] });
|
|
434
442
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* - curl-to-code : parseCurlCommand, convertToCode
|
|
6
6
|
* - jwt-decoder : decodeJwt, formatJwtJson
|
|
7
7
|
* - jwk-viewer : parseJwks
|
|
8
|
+
* - jwk-thumbprint : computeJwkThumbprint
|
|
8
9
|
* - jwt-signer : base64urlEncode, base64urlDecode, signJwt
|
|
9
10
|
* - cors-builder : validateCorsConfig, generateCors
|
|
10
11
|
* - csp-builder : generateCspHeader, generateFullHeader, parseCspHeader, validateCspConfig
|
|
@@ -106,6 +107,27 @@ type JwksParseResult = JwksResult | JwksError;
|
|
|
106
107
|
* use the keys cryptographically: this is inspection only.
|
|
107
108
|
*/
|
|
108
109
|
declare function parseJwks(input: string): JwksParseResult;
|
|
110
|
+
type JwkThumbprintHash = 'SHA-256' | 'SHA-384' | 'SHA-512';
|
|
111
|
+
interface JwkThumbprintResult {
|
|
112
|
+
ok: true;
|
|
113
|
+
kty: string;
|
|
114
|
+
hashAlg: JwkThumbprintHash;
|
|
115
|
+
members: string[];
|
|
116
|
+
canonicalJson: string;
|
|
117
|
+
thumbprint: string;
|
|
118
|
+
}
|
|
119
|
+
interface JwkThumbprintErrorResult {
|
|
120
|
+
ok: false;
|
|
121
|
+
error: string;
|
|
122
|
+
}
|
|
123
|
+
type JwkThumbprintOutcome = JwkThumbprintResult | JwkThumbprintErrorResult;
|
|
124
|
+
/**
|
|
125
|
+
* Compute the RFC 7638 thumbprint of a single JWK: build the canonical JSON
|
|
126
|
+
* of its required members (lexicographic key order, no whitespace) and hash
|
|
127
|
+
* it. This is a fingerprint for identifying/matching a key, not a signature
|
|
128
|
+
* or verification, and it only accepts a bare JWK, not a JWKS set.
|
|
129
|
+
*/
|
|
130
|
+
declare function computeJwkThumbprint(input: string, hashAlg?: JwkThumbprintHash): JwkThumbprintOutcome;
|
|
109
131
|
type JwtAlgorithm = 'HS256' | 'HS384' | 'HS512';
|
|
110
132
|
interface JwtSignOptions {
|
|
111
133
|
algorithm?: JwtAlgorithm;
|
|
@@ -284,6 +306,10 @@ declare const api_HTTP_METHODS: typeof HTTP_METHODS;
|
|
|
284
306
|
type api_Header = Header;
|
|
285
307
|
type api_HttpMethod = HttpMethod;
|
|
286
308
|
type api_JwkSummary = JwkSummary;
|
|
309
|
+
type api_JwkThumbprintErrorResult = JwkThumbprintErrorResult;
|
|
310
|
+
type api_JwkThumbprintHash = JwkThumbprintHash;
|
|
311
|
+
type api_JwkThumbprintOutcome = JwkThumbprintOutcome;
|
|
312
|
+
type api_JwkThumbprintResult = JwkThumbprintResult;
|
|
287
313
|
type api_JwksError = JwksError;
|
|
288
314
|
type api_JwksParseResult = JwksParseResult;
|
|
289
315
|
type api_JwksResult = JwksResult;
|
|
@@ -307,6 +333,7 @@ declare const api_base64urlEncode: typeof base64urlEncode;
|
|
|
307
333
|
declare const api_buildCurl: typeof buildCurl;
|
|
308
334
|
declare const api_buildCurlMultiline: typeof buildCurlMultiline;
|
|
309
335
|
declare const api_buildUrl: typeof buildUrl;
|
|
336
|
+
declare const api_computeJwkThumbprint: typeof computeJwkThumbprint;
|
|
310
337
|
declare const api_convertToCode: typeof convertToCode;
|
|
311
338
|
declare const api_decodeJwt: typeof decodeJwt;
|
|
312
339
|
declare const api_decodeUrlComponent: typeof decodeUrlComponent;
|
|
@@ -335,7 +362,7 @@ declare const api_validateCorsConfig: typeof validateCorsConfig;
|
|
|
335
362
|
declare const api_validateCspConfig: typeof validateCspConfig;
|
|
336
363
|
declare const api_validateOgTags: typeof validateOgTags;
|
|
337
364
|
declare namespace api {
|
|
338
|
-
export { api_COMMON_HEADERS as COMMON_HEADERS, api_COMMON_PRESETS as COMMON_PRESETS, api_CORS_COMMON_HEADERS as CORS_COMMON_HEADERS, type api_CorsConfig as CorsConfig, type api_CorsOutput as CorsOutput, type api_CspConfig as CspConfig, type api_CspDirective as CspDirective, type api_CspSource as CspSource, type api_CurlCommand as CurlCommand, type api_CurlConfig as CurlConfig, api_DEFAULT_CORS_CONFIG as DEFAULT_CORS_CONFIG, api_DIRECTIVE_DESCRIPTIONS as DIRECTIVE_DESCRIPTIONS, type api_DirectiveConfig as DirectiveConfig, type api_FormatResult as FormatResult, api_HTTP_METHODS as HTTP_METHODS, type api_Header as Header, type api_HttpMethod as HttpMethod, type api_JwkSummary as JwkSummary, type api_JwksError as JwksError, type api_JwksParseResult as JwksParseResult, type api_JwksResult as JwksResult, type api_JwtAlgorithm as JwtAlgorithm, type api_JwtDecodeError as JwtDecodeError, type api_JwtDecodeResult as JwtDecodeResult, type api_JwtExpiry as JwtExpiry, type api_JwtPart as JwtPart, type api_JwtResult as JwtResult, type api_JwtSignOptions as JwtSignOptions, type api_MetaTags as MetaTags, type api_OgTags as OgTags, type api_ParsedUrl as ParsedUrl, type api_ResponseFormat as ResponseFormat, api_SUPPORTED_LANGUAGES as SUPPORTED_LANGUAGES, type api_TargetLanguage as TargetLanguage, type api_TwitterTags as TwitterTags, api_addParam as addParam, api_base64urlDecode as base64urlDecode, api_base64urlEncode as base64urlEncode, api_buildCurl as buildCurl, api_buildCurlMultiline as buildCurlMultiline, api_buildUrl as buildUrl, api_convertToCode as convertToCode, api_decodeJwt as decodeJwt, api_decodeUrlComponent as decodeUrlComponent, api_detectFormat as detectFormat, api_encodeUrlComponent as encodeUrlComponent, api_extractJsonPaths as extractJsonPaths, api_formatJwtJson as formatJwtJson, api_formatResponse as formatResponse, api_generateCors as generateCors, api_generateCspHeader as generateCspHeader, api_generateFullHeader as generateFullHeader, api_generateMetaHtml as generateMetaHtml, api_getParam as getParam, api_getStats as getStats, api_isValidUrl as isValidUrl, api_normalizeUrl as normalizeUrl, api_parseCspHeader as parseCspHeader, api_parseCurl as parseCurl, api_parseCurlCommand as parseCurlCommand, api_parseJwks as parseJwks, api_parseMetaTags as parseMetaTags, api_parseUrl as parseUrl, api_removeParam as removeParam, api_signJwt as signJwt, api_validateCorsConfig as validateCorsConfig, api_validateCspConfig as validateCspConfig, api_validateOgTags as validateOgTags };
|
|
365
|
+
export { api_COMMON_HEADERS as COMMON_HEADERS, api_COMMON_PRESETS as COMMON_PRESETS, api_CORS_COMMON_HEADERS as CORS_COMMON_HEADERS, type api_CorsConfig as CorsConfig, type api_CorsOutput as CorsOutput, type api_CspConfig as CspConfig, type api_CspDirective as CspDirective, type api_CspSource as CspSource, type api_CurlCommand as CurlCommand, type api_CurlConfig as CurlConfig, api_DEFAULT_CORS_CONFIG as DEFAULT_CORS_CONFIG, api_DIRECTIVE_DESCRIPTIONS as DIRECTIVE_DESCRIPTIONS, type api_DirectiveConfig as DirectiveConfig, type api_FormatResult as FormatResult, api_HTTP_METHODS as HTTP_METHODS, type api_Header as Header, type api_HttpMethod as HttpMethod, type api_JwkSummary as JwkSummary, type api_JwkThumbprintErrorResult as JwkThumbprintErrorResult, type api_JwkThumbprintHash as JwkThumbprintHash, type api_JwkThumbprintOutcome as JwkThumbprintOutcome, type api_JwkThumbprintResult as JwkThumbprintResult, type api_JwksError as JwksError, type api_JwksParseResult as JwksParseResult, type api_JwksResult as JwksResult, type api_JwtAlgorithm as JwtAlgorithm, type api_JwtDecodeError as JwtDecodeError, type api_JwtDecodeResult as JwtDecodeResult, type api_JwtExpiry as JwtExpiry, type api_JwtPart as JwtPart, type api_JwtResult as JwtResult, type api_JwtSignOptions as JwtSignOptions, type api_MetaTags as MetaTags, type api_OgTags as OgTags, type api_ParsedUrl as ParsedUrl, type api_ResponseFormat as ResponseFormat, api_SUPPORTED_LANGUAGES as SUPPORTED_LANGUAGES, type api_TargetLanguage as TargetLanguage, type api_TwitterTags as TwitterTags, api_addParam as addParam, api_base64urlDecode as base64urlDecode, api_base64urlEncode as base64urlEncode, api_buildCurl as buildCurl, api_buildCurlMultiline as buildCurlMultiline, api_buildUrl as buildUrl, api_computeJwkThumbprint as computeJwkThumbprint, api_convertToCode as convertToCode, api_decodeJwt as decodeJwt, api_decodeUrlComponent as decodeUrlComponent, api_detectFormat as detectFormat, api_encodeUrlComponent as encodeUrlComponent, api_extractJsonPaths as extractJsonPaths, api_formatJwtJson as formatJwtJson, api_formatResponse as formatResponse, api_generateCors as generateCors, api_generateCspHeader as generateCspHeader, api_generateFullHeader as generateFullHeader, api_generateMetaHtml as generateMetaHtml, api_getParam as getParam, api_getStats as getStats, api_isValidUrl as isValidUrl, api_normalizeUrl as normalizeUrl, api_parseCspHeader as parseCspHeader, api_parseCurl as parseCurl, api_parseCurlCommand as parseCurlCommand, api_parseJwks as parseJwks, api_parseMetaTags as parseMetaTags, api_parseUrl as parseUrl, api_removeParam as removeParam, api_signJwt as signJwt, api_validateCorsConfig as validateCorsConfig, api_validateCspConfig as validateCspConfig, api_validateOgTags as validateOgTags };
|
|
339
366
|
}
|
|
340
367
|
|
|
341
|
-
export {
|
|
368
|
+
export { formatJwtJson as $, type JwtResult as A, type JwtSignOptions as B, COMMON_HEADERS as C, DEFAULT_CORS_CONFIG as D, type TwitterTags as E, type FormatResult as F, addParam as G, HTTP_METHODS as H, base64urlDecode as I, type JwkSummary as J, base64urlEncode as K, buildCurl as L, type MetaTags as M, buildCurlMultiline as N, type OgTags as O, type ParsedUrl as P, buildUrl as Q, type ResponseFormat as R, SUPPORTED_LANGUAGES as S, type TargetLanguage as T, computeJwkThumbprint as U, convertToCode as V, decodeJwt as W, decodeUrlComponent as X, detectFormat as Y, encodeUrlComponent as Z, extractJsonPaths as _, api as a, formatResponse as a0, generateCors as a1, generateCspHeader as a2, generateFullHeader as a3, generateMetaHtml as a4, getParam as a5, getStats as a6, isValidUrl as a7, normalizeUrl as a8, parseCspHeader as a9, parseCurl as aa, parseCurlCommand as ab, parseJwks as ac, parseMetaTags as ad, parseUrl as ae, removeParam as af, signJwt as ag, validateCorsConfig as ah, validateCspConfig as ai, validateOgTags as aj, COMMON_PRESETS as b, CORS_COMMON_HEADERS as c, type CorsConfig as d, type CorsOutput as e, type CspConfig as f, type CspDirective as g, type CspSource as h, type CurlCommand as i, type CurlConfig as j, DIRECTIVE_DESCRIPTIONS as k, type DirectiveConfig as l, type Header as m, type HttpMethod as n, type JwkThumbprintErrorResult as o, type JwkThumbprintHash as p, type JwkThumbprintOutcome as q, type JwkThumbprintResult as r, type JwksError as s, type JwksParseResult as t, type JwksResult as u, type JwtAlgorithm as v, type JwtDecodeError as w, type JwtDecodeResult as x, type JwtExpiry as y, type JwtPart as z };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* - curl-to-code : parseCurlCommand, convertToCode
|
|
6
6
|
* - jwt-decoder : decodeJwt, formatJwtJson
|
|
7
7
|
* - jwk-viewer : parseJwks
|
|
8
|
+
* - jwk-thumbprint : computeJwkThumbprint
|
|
8
9
|
* - jwt-signer : base64urlEncode, base64urlDecode, signJwt
|
|
9
10
|
* - cors-builder : validateCorsConfig, generateCors
|
|
10
11
|
* - csp-builder : generateCspHeader, generateFullHeader, parseCspHeader, validateCspConfig
|
|
@@ -106,6 +107,27 @@ type JwksParseResult = JwksResult | JwksError;
|
|
|
106
107
|
* use the keys cryptographically: this is inspection only.
|
|
107
108
|
*/
|
|
108
109
|
declare function parseJwks(input: string): JwksParseResult;
|
|
110
|
+
type JwkThumbprintHash = 'SHA-256' | 'SHA-384' | 'SHA-512';
|
|
111
|
+
interface JwkThumbprintResult {
|
|
112
|
+
ok: true;
|
|
113
|
+
kty: string;
|
|
114
|
+
hashAlg: JwkThumbprintHash;
|
|
115
|
+
members: string[];
|
|
116
|
+
canonicalJson: string;
|
|
117
|
+
thumbprint: string;
|
|
118
|
+
}
|
|
119
|
+
interface JwkThumbprintErrorResult {
|
|
120
|
+
ok: false;
|
|
121
|
+
error: string;
|
|
122
|
+
}
|
|
123
|
+
type JwkThumbprintOutcome = JwkThumbprintResult | JwkThumbprintErrorResult;
|
|
124
|
+
/**
|
|
125
|
+
* Compute the RFC 7638 thumbprint of a single JWK: build the canonical JSON
|
|
126
|
+
* of its required members (lexicographic key order, no whitespace) and hash
|
|
127
|
+
* it. This is a fingerprint for identifying/matching a key, not a signature
|
|
128
|
+
* or verification, and it only accepts a bare JWK, not a JWKS set.
|
|
129
|
+
*/
|
|
130
|
+
declare function computeJwkThumbprint(input: string, hashAlg?: JwkThumbprintHash): JwkThumbprintOutcome;
|
|
109
131
|
type JwtAlgorithm = 'HS256' | 'HS384' | 'HS512';
|
|
110
132
|
interface JwtSignOptions {
|
|
111
133
|
algorithm?: JwtAlgorithm;
|
|
@@ -284,6 +306,10 @@ declare const api_HTTP_METHODS: typeof HTTP_METHODS;
|
|
|
284
306
|
type api_Header = Header;
|
|
285
307
|
type api_HttpMethod = HttpMethod;
|
|
286
308
|
type api_JwkSummary = JwkSummary;
|
|
309
|
+
type api_JwkThumbprintErrorResult = JwkThumbprintErrorResult;
|
|
310
|
+
type api_JwkThumbprintHash = JwkThumbprintHash;
|
|
311
|
+
type api_JwkThumbprintOutcome = JwkThumbprintOutcome;
|
|
312
|
+
type api_JwkThumbprintResult = JwkThumbprintResult;
|
|
287
313
|
type api_JwksError = JwksError;
|
|
288
314
|
type api_JwksParseResult = JwksParseResult;
|
|
289
315
|
type api_JwksResult = JwksResult;
|
|
@@ -307,6 +333,7 @@ declare const api_base64urlEncode: typeof base64urlEncode;
|
|
|
307
333
|
declare const api_buildCurl: typeof buildCurl;
|
|
308
334
|
declare const api_buildCurlMultiline: typeof buildCurlMultiline;
|
|
309
335
|
declare const api_buildUrl: typeof buildUrl;
|
|
336
|
+
declare const api_computeJwkThumbprint: typeof computeJwkThumbprint;
|
|
310
337
|
declare const api_convertToCode: typeof convertToCode;
|
|
311
338
|
declare const api_decodeJwt: typeof decodeJwt;
|
|
312
339
|
declare const api_decodeUrlComponent: typeof decodeUrlComponent;
|
|
@@ -335,7 +362,7 @@ declare const api_validateCorsConfig: typeof validateCorsConfig;
|
|
|
335
362
|
declare const api_validateCspConfig: typeof validateCspConfig;
|
|
336
363
|
declare const api_validateOgTags: typeof validateOgTags;
|
|
337
364
|
declare namespace api {
|
|
338
|
-
export { api_COMMON_HEADERS as COMMON_HEADERS, api_COMMON_PRESETS as COMMON_PRESETS, api_CORS_COMMON_HEADERS as CORS_COMMON_HEADERS, type api_CorsConfig as CorsConfig, type api_CorsOutput as CorsOutput, type api_CspConfig as CspConfig, type api_CspDirective as CspDirective, type api_CspSource as CspSource, type api_CurlCommand as CurlCommand, type api_CurlConfig as CurlConfig, api_DEFAULT_CORS_CONFIG as DEFAULT_CORS_CONFIG, api_DIRECTIVE_DESCRIPTIONS as DIRECTIVE_DESCRIPTIONS, type api_DirectiveConfig as DirectiveConfig, type api_FormatResult as FormatResult, api_HTTP_METHODS as HTTP_METHODS, type api_Header as Header, type api_HttpMethod as HttpMethod, type api_JwkSummary as JwkSummary, type api_JwksError as JwksError, type api_JwksParseResult as JwksParseResult, type api_JwksResult as JwksResult, type api_JwtAlgorithm as JwtAlgorithm, type api_JwtDecodeError as JwtDecodeError, type api_JwtDecodeResult as JwtDecodeResult, type api_JwtExpiry as JwtExpiry, type api_JwtPart as JwtPart, type api_JwtResult as JwtResult, type api_JwtSignOptions as JwtSignOptions, type api_MetaTags as MetaTags, type api_OgTags as OgTags, type api_ParsedUrl as ParsedUrl, type api_ResponseFormat as ResponseFormat, api_SUPPORTED_LANGUAGES as SUPPORTED_LANGUAGES, type api_TargetLanguage as TargetLanguage, type api_TwitterTags as TwitterTags, api_addParam as addParam, api_base64urlDecode as base64urlDecode, api_base64urlEncode as base64urlEncode, api_buildCurl as buildCurl, api_buildCurlMultiline as buildCurlMultiline, api_buildUrl as buildUrl, api_convertToCode as convertToCode, api_decodeJwt as decodeJwt, api_decodeUrlComponent as decodeUrlComponent, api_detectFormat as detectFormat, api_encodeUrlComponent as encodeUrlComponent, api_extractJsonPaths as extractJsonPaths, api_formatJwtJson as formatJwtJson, api_formatResponse as formatResponse, api_generateCors as generateCors, api_generateCspHeader as generateCspHeader, api_generateFullHeader as generateFullHeader, api_generateMetaHtml as generateMetaHtml, api_getParam as getParam, api_getStats as getStats, api_isValidUrl as isValidUrl, api_normalizeUrl as normalizeUrl, api_parseCspHeader as parseCspHeader, api_parseCurl as parseCurl, api_parseCurlCommand as parseCurlCommand, api_parseJwks as parseJwks, api_parseMetaTags as parseMetaTags, api_parseUrl as parseUrl, api_removeParam as removeParam, api_signJwt as signJwt, api_validateCorsConfig as validateCorsConfig, api_validateCspConfig as validateCspConfig, api_validateOgTags as validateOgTags };
|
|
365
|
+
export { api_COMMON_HEADERS as COMMON_HEADERS, api_COMMON_PRESETS as COMMON_PRESETS, api_CORS_COMMON_HEADERS as CORS_COMMON_HEADERS, type api_CorsConfig as CorsConfig, type api_CorsOutput as CorsOutput, type api_CspConfig as CspConfig, type api_CspDirective as CspDirective, type api_CspSource as CspSource, type api_CurlCommand as CurlCommand, type api_CurlConfig as CurlConfig, api_DEFAULT_CORS_CONFIG as DEFAULT_CORS_CONFIG, api_DIRECTIVE_DESCRIPTIONS as DIRECTIVE_DESCRIPTIONS, type api_DirectiveConfig as DirectiveConfig, type api_FormatResult as FormatResult, api_HTTP_METHODS as HTTP_METHODS, type api_Header as Header, type api_HttpMethod as HttpMethod, type api_JwkSummary as JwkSummary, type api_JwkThumbprintErrorResult as JwkThumbprintErrorResult, type api_JwkThumbprintHash as JwkThumbprintHash, type api_JwkThumbprintOutcome as JwkThumbprintOutcome, type api_JwkThumbprintResult as JwkThumbprintResult, type api_JwksError as JwksError, type api_JwksParseResult as JwksParseResult, type api_JwksResult as JwksResult, type api_JwtAlgorithm as JwtAlgorithm, type api_JwtDecodeError as JwtDecodeError, type api_JwtDecodeResult as JwtDecodeResult, type api_JwtExpiry as JwtExpiry, type api_JwtPart as JwtPart, type api_JwtResult as JwtResult, type api_JwtSignOptions as JwtSignOptions, type api_MetaTags as MetaTags, type api_OgTags as OgTags, type api_ParsedUrl as ParsedUrl, type api_ResponseFormat as ResponseFormat, api_SUPPORTED_LANGUAGES as SUPPORTED_LANGUAGES, type api_TargetLanguage as TargetLanguage, type api_TwitterTags as TwitterTags, api_addParam as addParam, api_base64urlDecode as base64urlDecode, api_base64urlEncode as base64urlEncode, api_buildCurl as buildCurl, api_buildCurlMultiline as buildCurlMultiline, api_buildUrl as buildUrl, api_computeJwkThumbprint as computeJwkThumbprint, api_convertToCode as convertToCode, api_decodeJwt as decodeJwt, api_decodeUrlComponent as decodeUrlComponent, api_detectFormat as detectFormat, api_encodeUrlComponent as encodeUrlComponent, api_extractJsonPaths as extractJsonPaths, api_formatJwtJson as formatJwtJson, api_formatResponse as formatResponse, api_generateCors as generateCors, api_generateCspHeader as generateCspHeader, api_generateFullHeader as generateFullHeader, api_generateMetaHtml as generateMetaHtml, api_getParam as getParam, api_getStats as getStats, api_isValidUrl as isValidUrl, api_normalizeUrl as normalizeUrl, api_parseCspHeader as parseCspHeader, api_parseCurl as parseCurl, api_parseCurlCommand as parseCurlCommand, api_parseJwks as parseJwks, api_parseMetaTags as parseMetaTags, api_parseUrl as parseUrl, api_removeParam as removeParam, api_signJwt as signJwt, api_validateCorsConfig as validateCorsConfig, api_validateCspConfig as validateCspConfig, api_validateOgTags as validateOgTags };
|
|
339
366
|
}
|
|
340
367
|
|
|
341
|
-
export {
|
|
368
|
+
export { formatJwtJson as $, type JwtResult as A, type JwtSignOptions as B, COMMON_HEADERS as C, DEFAULT_CORS_CONFIG as D, type TwitterTags as E, type FormatResult as F, addParam as G, HTTP_METHODS as H, base64urlDecode as I, type JwkSummary as J, base64urlEncode as K, buildCurl as L, type MetaTags as M, buildCurlMultiline as N, type OgTags as O, type ParsedUrl as P, buildUrl as Q, type ResponseFormat as R, SUPPORTED_LANGUAGES as S, type TargetLanguage as T, computeJwkThumbprint as U, convertToCode as V, decodeJwt as W, decodeUrlComponent as X, detectFormat as Y, encodeUrlComponent as Z, extractJsonPaths as _, api as a, formatResponse as a0, generateCors as a1, generateCspHeader as a2, generateFullHeader as a3, generateMetaHtml as a4, getParam as a5, getStats as a6, isValidUrl as a7, normalizeUrl as a8, parseCspHeader as a9, parseCurl as aa, parseCurlCommand as ab, parseJwks as ac, parseMetaTags as ad, parseUrl as ae, removeParam as af, signJwt as ag, validateCorsConfig as ah, validateCspConfig as ai, validateOgTags as aj, COMMON_PRESETS as b, CORS_COMMON_HEADERS as c, type CorsConfig as d, type CorsOutput as e, type CspConfig as f, type CspDirective as g, type CspSource as h, type CurlCommand as i, type CurlConfig as j, DIRECTIVE_DESCRIPTIONS as k, type DirectiveConfig as l, type Header as m, type HttpMethod as n, type JwkThumbprintErrorResult as o, type JwkThumbprintHash as p, type JwkThumbprintOutcome as q, type JwkThumbprintResult as r, type JwksError as s, type JwksParseResult as t, type JwksResult as u, type JwtAlgorithm as v, type JwtDecodeError as w, type JwtDecodeResult as x, type JwtExpiry as y, type JwtPart as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __export } from './chunk-MLKGABMK.js';
|
|
2
|
-
import { createHmac } from 'crypto';
|
|
2
|
+
import { createHash, createHmac } from 'crypto';
|
|
3
3
|
|
|
4
4
|
// src/tools/api.ts
|
|
5
5
|
var api_exports = {};
|
|
@@ -17,6 +17,7 @@ __export(api_exports, {
|
|
|
17
17
|
buildCurl: () => buildCurl,
|
|
18
18
|
buildCurlMultiline: () => buildCurlMultiline,
|
|
19
19
|
buildUrl: () => buildUrl,
|
|
20
|
+
computeJwkThumbprint: () => computeJwkThumbprint,
|
|
20
21
|
convertToCode: () => convertToCode,
|
|
21
22
|
decodeJwt: () => decodeJwt,
|
|
22
23
|
decodeUrlComponent: () => decodeUrlComponent,
|
|
@@ -535,6 +536,48 @@ function parseJwks(input) {
|
|
|
535
536
|
const duplicateKids = [...kidCounts.entries()].filter(([, c]) => c > 1).map(([kid]) => kid);
|
|
536
537
|
return { ok: true, keys, count: keys.length, duplicateKids };
|
|
537
538
|
}
|
|
539
|
+
var JWK_THUMBPRINT_MEMBERS = {
|
|
540
|
+
oct: ["k", "kty"],
|
|
541
|
+
RSA: ["e", "kty", "n"],
|
|
542
|
+
EC: ["crv", "kty", "x", "y"],
|
|
543
|
+
OKP: ["crv", "kty", "x"]
|
|
544
|
+
};
|
|
545
|
+
var JWK_THUMBPRINT_NODE_HASH = {
|
|
546
|
+
"SHA-256": "sha256",
|
|
547
|
+
"SHA-384": "sha384",
|
|
548
|
+
"SHA-512": "sha512"
|
|
549
|
+
};
|
|
550
|
+
function computeJwkThumbprint(input, hashAlg = "SHA-256") {
|
|
551
|
+
const trimmed = input.trim();
|
|
552
|
+
if (!trimmed) return { ok: false, error: "No input provided" };
|
|
553
|
+
const nodeHash = JWK_THUMBPRINT_NODE_HASH[hashAlg];
|
|
554
|
+
if (!nodeHash) return { ok: false, error: 'hashAlg must be one of "SHA-256", "SHA-384", "SHA-512"' };
|
|
555
|
+
let jwk;
|
|
556
|
+
try {
|
|
557
|
+
jwk = JSON.parse(trimmed);
|
|
558
|
+
} catch (e) {
|
|
559
|
+
return { ok: false, error: `Invalid JSON: ${e instanceof Error ? e.message : String(e)}` };
|
|
560
|
+
}
|
|
561
|
+
if (jwk === null || typeof jwk !== "object" || Array.isArray(jwk)) {
|
|
562
|
+
return { ok: false, error: "Input must be a single JWK object, not a JWKS set or array" };
|
|
563
|
+
}
|
|
564
|
+
const obj = jwk;
|
|
565
|
+
const kty = obj.kty;
|
|
566
|
+
if (typeof kty !== "string") return { ok: false, error: 'JWK must have a "kty" (key type) member' };
|
|
567
|
+
const members = JWK_THUMBPRINT_MEMBERS[kty];
|
|
568
|
+
if (!members) return { ok: false, error: `Unsupported key type "${kty}": supported types are RSA, EC, oct, OKP` };
|
|
569
|
+
const canonical = {};
|
|
570
|
+
for (const m of members) {
|
|
571
|
+
const v = obj[m];
|
|
572
|
+
if (typeof v !== "string" || v.length === 0) {
|
|
573
|
+
return { ok: false, error: `JWK is missing required member "${m}" for key type "${kty}"` };
|
|
574
|
+
}
|
|
575
|
+
canonical[m] = v;
|
|
576
|
+
}
|
|
577
|
+
const canonicalJson = "{" + members.map((m) => `${JSON.stringify(m)}:${JSON.stringify(canonical[m])}`).join(",") + "}";
|
|
578
|
+
const thumbprint = createHash(nodeHash).update(canonicalJson, "utf8").digest("base64url");
|
|
579
|
+
return { ok: true, kty, hashAlg, members, canonicalJson, thumbprint };
|
|
580
|
+
}
|
|
538
581
|
var ALG_TO_NODE_HASH = {
|
|
539
582
|
HS256: "sha256",
|
|
540
583
|
HS384: "sha384",
|
|
@@ -1266,4 +1309,4 @@ function generateMetaHtml(tags) {
|
|
|
1266
1309
|
return lines.join("\n");
|
|
1267
1310
|
}
|
|
1268
1311
|
|
|
1269
|
-
export { COMMON_HEADERS, COMMON_PRESETS, CORS_COMMON_HEADERS, DEFAULT_CORS_CONFIG, DIRECTIVE_DESCRIPTIONS, HTTP_METHODS, SUPPORTED_LANGUAGES, addParam, api_exports, base64urlDecode, base64urlEncode, buildCurl, buildCurlMultiline, buildUrl, convertToCode, decodeJwt, decodeUrlComponent, detectFormat, encodeUrlComponent, extractJsonPaths, formatJwtJson, formatResponse, generateCors, generateCspHeader, generateFullHeader, generateMetaHtml, getParam, getStats, isValidUrl, normalizeUrl, parseCspHeader, parseCurl, parseCurlCommand, parseJwks, parseMetaTags, parseUrl, removeParam, signJwt, validateCorsConfig, validateCspConfig, validateOgTags };
|
|
1312
|
+
export { COMMON_HEADERS, COMMON_PRESETS, CORS_COMMON_HEADERS, DEFAULT_CORS_CONFIG, DIRECTIVE_DESCRIPTIONS, HTTP_METHODS, SUPPORTED_LANGUAGES, addParam, api_exports, base64urlDecode, base64urlEncode, buildCurl, buildCurlMultiline, buildUrl, computeJwkThumbprint, convertToCode, decodeJwt, decodeUrlComponent, detectFormat, encodeUrlComponent, extractJsonPaths, formatJwtJson, formatResponse, generateCors, generateCspHeader, generateFullHeader, generateMetaHtml, getParam, getStats, isValidUrl, normalizeUrl, parseCspHeader, parseCurl, parseCurlCommand, parseJwks, parseMetaTags, parseUrl, removeParam, signJwt, validateCorsConfig, validateCspConfig, validateOgTags };
|
|
@@ -29,6 +29,7 @@ __export(units_exports, {
|
|
|
29
29
|
calculateTax: () => calculateTax,
|
|
30
30
|
calculateTimeValue: () => calculateTimeValue,
|
|
31
31
|
calculateTipSplit: () => calculateTipSplit,
|
|
32
|
+
calculateVideoBitrate: () => calculateVideoBitrate,
|
|
32
33
|
compareSemver: () => compareSemver,
|
|
33
34
|
convert: () => convert,
|
|
34
35
|
convertAprApy: () => convertAprApy,
|
|
@@ -1589,5 +1590,57 @@ function calculateBreakEven(input) {
|
|
|
1589
1590
|
}
|
|
1590
1591
|
return result;
|
|
1591
1592
|
}
|
|
1593
|
+
function calculateVideoBitrate(input) {
|
|
1594
|
+
const { mode, durationSeconds, videoBitrateKbps, targetSizeMB } = input;
|
|
1595
|
+
const audioBitrateKbps = input.audioBitrateKbps ?? 0;
|
|
1596
|
+
if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
|
|
1597
|
+
return { error: "durationSeconds must be a positive number" };
|
|
1598
|
+
}
|
|
1599
|
+
if (!Number.isFinite(audioBitrateKbps) || audioBitrateKbps < 0) {
|
|
1600
|
+
return { error: "audioBitrateKbps must be zero or a positive number" };
|
|
1601
|
+
}
|
|
1602
|
+
const round22 = (n) => Math.round(n * 100) / 100;
|
|
1603
|
+
if (mode === "size-from-bitrate") {
|
|
1604
|
+
if (typeof videoBitrateKbps !== "number" || !Number.isFinite(videoBitrateKbps) || videoBitrateKbps <= 0) {
|
|
1605
|
+
return { error: 'videoBitrateKbps must be a positive number for mode "size-from-bitrate"' };
|
|
1606
|
+
}
|
|
1607
|
+
const totalBitrateKbps = videoBitrateKbps + audioBitrateKbps;
|
|
1608
|
+
const fileSizeBytes = totalBitrateKbps * 1e3 * durationSeconds / 8;
|
|
1609
|
+
return {
|
|
1610
|
+
mode,
|
|
1611
|
+
durationSeconds,
|
|
1612
|
+
videoBitrateKbps: round22(videoBitrateKbps),
|
|
1613
|
+
audioBitrateKbps: round22(audioBitrateKbps),
|
|
1614
|
+
totalBitrateKbps: round22(totalBitrateKbps),
|
|
1615
|
+
fileSizeBytes: Math.round(fileSizeBytes),
|
|
1616
|
+
fileSizeMB: round22(fileSizeBytes / 1e6),
|
|
1617
|
+
fileSizeMiB: round22(fileSizeBytes / 1048576)
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1620
|
+
if (mode === "bitrate-from-size") {
|
|
1621
|
+
if (typeof targetSizeMB !== "number" || !Number.isFinite(targetSizeMB) || targetSizeMB <= 0) {
|
|
1622
|
+
return { error: 'targetSizeMB must be a positive number for mode "bitrate-from-size"' };
|
|
1623
|
+
}
|
|
1624
|
+
const fileSizeBytes = targetSizeMB * 1e6;
|
|
1625
|
+
const totalBitrateKbps = fileSizeBytes * 8 / (1e3 * durationSeconds);
|
|
1626
|
+
const videoKbps = totalBitrateKbps - audioBitrateKbps;
|
|
1627
|
+
if (videoKbps <= 0) {
|
|
1628
|
+
return {
|
|
1629
|
+
error: "audioBitrateKbps exceeds the total bitrate available at this target size and duration; lower the audio bitrate or raise the target size"
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
return {
|
|
1633
|
+
mode,
|
|
1634
|
+
durationSeconds,
|
|
1635
|
+
videoBitrateKbps: round22(videoKbps),
|
|
1636
|
+
audioBitrateKbps: round22(audioBitrateKbps),
|
|
1637
|
+
totalBitrateKbps: round22(totalBitrateKbps),
|
|
1638
|
+
fileSizeBytes: Math.round(fileSizeBytes),
|
|
1639
|
+
fileSizeMB: round22(targetSizeMB),
|
|
1640
|
+
fileSizeMiB: round22(fileSizeBytes / 1048576)
|
|
1641
|
+
};
|
|
1642
|
+
}
|
|
1643
|
+
return { error: 'mode must be "size-from-bitrate" or "bitrate-from-size"' };
|
|
1644
|
+
}
|
|
1592
1645
|
|
|
1593
|
-
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, applySuccessiveDiscounts, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateBreakEven, calculateCompoundInterest, calculateDiscount, calculateLoan, calculateMarginMarkup, calculatePercentageChange, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, compareSemver, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, marginToMarkup, markupToMargin, 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 };
|
|
1646
|
+
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, applySuccessiveDiscounts, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateBreakEven, calculateCompoundInterest, calculateDiscount, calculateLoan, calculateMarginMarkup, calculatePercentageChange, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, calculateVideoBitrate, compareSemver, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, marginToMarkup, markupToMargin, 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 };
|
package/dist/index.cjs
CHANGED
|
@@ -7158,6 +7158,7 @@ __export(units_exports, {
|
|
|
7158
7158
|
calculateTax: () => calculateTax,
|
|
7159
7159
|
calculateTimeValue: () => calculateTimeValue,
|
|
7160
7160
|
calculateTipSplit: () => calculateTipSplit,
|
|
7161
|
+
calculateVideoBitrate: () => calculateVideoBitrate,
|
|
7161
7162
|
compareSemver: () => compareSemver,
|
|
7162
7163
|
convert: () => convert,
|
|
7163
7164
|
convertAprApy: () => convertAprApy,
|
|
@@ -8718,6 +8719,58 @@ function calculateBreakEven(input) {
|
|
|
8718
8719
|
}
|
|
8719
8720
|
return result;
|
|
8720
8721
|
}
|
|
8722
|
+
function calculateVideoBitrate(input) {
|
|
8723
|
+
const { mode, durationSeconds, videoBitrateKbps, targetSizeMB } = input;
|
|
8724
|
+
const audioBitrateKbps = input.audioBitrateKbps ?? 0;
|
|
8725
|
+
if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
|
|
8726
|
+
return { error: "durationSeconds must be a positive number" };
|
|
8727
|
+
}
|
|
8728
|
+
if (!Number.isFinite(audioBitrateKbps) || audioBitrateKbps < 0) {
|
|
8729
|
+
return { error: "audioBitrateKbps must be zero or a positive number" };
|
|
8730
|
+
}
|
|
8731
|
+
const round23 = (n) => Math.round(n * 100) / 100;
|
|
8732
|
+
if (mode === "size-from-bitrate") {
|
|
8733
|
+
if (typeof videoBitrateKbps !== "number" || !Number.isFinite(videoBitrateKbps) || videoBitrateKbps <= 0) {
|
|
8734
|
+
return { error: 'videoBitrateKbps must be a positive number for mode "size-from-bitrate"' };
|
|
8735
|
+
}
|
|
8736
|
+
const totalBitrateKbps = videoBitrateKbps + audioBitrateKbps;
|
|
8737
|
+
const fileSizeBytes = totalBitrateKbps * 1e3 * durationSeconds / 8;
|
|
8738
|
+
return {
|
|
8739
|
+
mode,
|
|
8740
|
+
durationSeconds,
|
|
8741
|
+
videoBitrateKbps: round23(videoBitrateKbps),
|
|
8742
|
+
audioBitrateKbps: round23(audioBitrateKbps),
|
|
8743
|
+
totalBitrateKbps: round23(totalBitrateKbps),
|
|
8744
|
+
fileSizeBytes: Math.round(fileSizeBytes),
|
|
8745
|
+
fileSizeMB: round23(fileSizeBytes / 1e6),
|
|
8746
|
+
fileSizeMiB: round23(fileSizeBytes / 1048576)
|
|
8747
|
+
};
|
|
8748
|
+
}
|
|
8749
|
+
if (mode === "bitrate-from-size") {
|
|
8750
|
+
if (typeof targetSizeMB !== "number" || !Number.isFinite(targetSizeMB) || targetSizeMB <= 0) {
|
|
8751
|
+
return { error: 'targetSizeMB must be a positive number for mode "bitrate-from-size"' };
|
|
8752
|
+
}
|
|
8753
|
+
const fileSizeBytes = targetSizeMB * 1e6;
|
|
8754
|
+
const totalBitrateKbps = fileSizeBytes * 8 / (1e3 * durationSeconds);
|
|
8755
|
+
const videoKbps = totalBitrateKbps - audioBitrateKbps;
|
|
8756
|
+
if (videoKbps <= 0) {
|
|
8757
|
+
return {
|
|
8758
|
+
error: "audioBitrateKbps exceeds the total bitrate available at this target size and duration; lower the audio bitrate or raise the target size"
|
|
8759
|
+
};
|
|
8760
|
+
}
|
|
8761
|
+
return {
|
|
8762
|
+
mode,
|
|
8763
|
+
durationSeconds,
|
|
8764
|
+
videoBitrateKbps: round23(videoKbps),
|
|
8765
|
+
audioBitrateKbps: round23(audioBitrateKbps),
|
|
8766
|
+
totalBitrateKbps: round23(totalBitrateKbps),
|
|
8767
|
+
fileSizeBytes: Math.round(fileSizeBytes),
|
|
8768
|
+
fileSizeMB: round23(targetSizeMB),
|
|
8769
|
+
fileSizeMiB: round23(fileSizeBytes / 1048576)
|
|
8770
|
+
};
|
|
8771
|
+
}
|
|
8772
|
+
return { error: 'mode must be "size-from-bitrate" or "bitrate-from-size"' };
|
|
8773
|
+
}
|
|
8721
8774
|
|
|
8722
8775
|
// src/tools/network.ts
|
|
8723
8776
|
var network_exports = {};
|
|
@@ -10550,6 +10603,7 @@ __export(api_exports, {
|
|
|
10550
10603
|
buildCurl: () => buildCurl,
|
|
10551
10604
|
buildCurlMultiline: () => buildCurlMultiline,
|
|
10552
10605
|
buildUrl: () => buildUrl,
|
|
10606
|
+
computeJwkThumbprint: () => computeJwkThumbprint,
|
|
10553
10607
|
convertToCode: () => convertToCode,
|
|
10554
10608
|
decodeJwt: () => decodeJwt,
|
|
10555
10609
|
decodeUrlComponent: () => decodeUrlComponent,
|
|
@@ -11068,6 +11122,48 @@ function parseJwks(input) {
|
|
|
11068
11122
|
const duplicateKids = [...kidCounts.entries()].filter(([, c]) => c > 1).map(([kid]) => kid);
|
|
11069
11123
|
return { ok: true, keys, count: keys.length, duplicateKids };
|
|
11070
11124
|
}
|
|
11125
|
+
var JWK_THUMBPRINT_MEMBERS = {
|
|
11126
|
+
oct: ["k", "kty"],
|
|
11127
|
+
RSA: ["e", "kty", "n"],
|
|
11128
|
+
EC: ["crv", "kty", "x", "y"],
|
|
11129
|
+
OKP: ["crv", "kty", "x"]
|
|
11130
|
+
};
|
|
11131
|
+
var JWK_THUMBPRINT_NODE_HASH = {
|
|
11132
|
+
"SHA-256": "sha256",
|
|
11133
|
+
"SHA-384": "sha384",
|
|
11134
|
+
"SHA-512": "sha512"
|
|
11135
|
+
};
|
|
11136
|
+
function computeJwkThumbprint(input, hashAlg = "SHA-256") {
|
|
11137
|
+
const trimmed = input.trim();
|
|
11138
|
+
if (!trimmed) return { ok: false, error: "No input provided" };
|
|
11139
|
+
const nodeHash = JWK_THUMBPRINT_NODE_HASH[hashAlg];
|
|
11140
|
+
if (!nodeHash) return { ok: false, error: 'hashAlg must be one of "SHA-256", "SHA-384", "SHA-512"' };
|
|
11141
|
+
let jwk;
|
|
11142
|
+
try {
|
|
11143
|
+
jwk = JSON.parse(trimmed);
|
|
11144
|
+
} catch (e) {
|
|
11145
|
+
return { ok: false, error: `Invalid JSON: ${e instanceof Error ? e.message : String(e)}` };
|
|
11146
|
+
}
|
|
11147
|
+
if (jwk === null || typeof jwk !== "object" || Array.isArray(jwk)) {
|
|
11148
|
+
return { ok: false, error: "Input must be a single JWK object, not a JWKS set or array" };
|
|
11149
|
+
}
|
|
11150
|
+
const obj = jwk;
|
|
11151
|
+
const kty = obj.kty;
|
|
11152
|
+
if (typeof kty !== "string") return { ok: false, error: 'JWK must have a "kty" (key type) member' };
|
|
11153
|
+
const members = JWK_THUMBPRINT_MEMBERS[kty];
|
|
11154
|
+
if (!members) return { ok: false, error: `Unsupported key type "${kty}": supported types are RSA, EC, oct, OKP` };
|
|
11155
|
+
const canonical = {};
|
|
11156
|
+
for (const m of members) {
|
|
11157
|
+
const v = obj[m];
|
|
11158
|
+
if (typeof v !== "string" || v.length === 0) {
|
|
11159
|
+
return { ok: false, error: `JWK is missing required member "${m}" for key type "${kty}"` };
|
|
11160
|
+
}
|
|
11161
|
+
canonical[m] = v;
|
|
11162
|
+
}
|
|
11163
|
+
const canonicalJson = "{" + members.map((m) => `${JSON.stringify(m)}:${JSON.stringify(canonical[m])}`).join(",") + "}";
|
|
11164
|
+
const thumbprint = crypto.createHash(nodeHash).update(canonicalJson, "utf8").digest("base64url");
|
|
11165
|
+
return { ok: true, kty, hashAlg, members, canonicalJson, thumbprint };
|
|
11166
|
+
}
|
|
11071
11167
|
var ALG_TO_NODE_HASH = {
|
|
11072
11168
|
HS256: "sha256",
|
|
11073
11169
|
HS384: "sha384",
|
package/dist/index.d.cts
CHANGED
|
@@ -5,9 +5,9 @@ export { t as text } from './text-D1fySkCB.cjs';
|
|
|
5
5
|
export { d as data } from './data-XRb0D7Zn.cjs';
|
|
6
6
|
export { g as generators } from './generators-BGtRGpJZ.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-D2wEimKG.cjs';
|
|
9
9
|
export { n as network } from './network-BJOjJnmY.cjs';
|
|
10
|
-
export { a as api } from './api-
|
|
10
|
+
export { a as api } from './api-DmTNE4c1.cjs';
|
|
11
11
|
export { c as code } from './code-DaRvff2v.cjs';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.cjs';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export { t as text } from './text-D1fySkCB.js';
|
|
|
5
5
|
export { d as data } from './data-XRb0D7Zn.js';
|
|
6
6
|
export { g as generators } from './generators-BGtRGpJZ.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-D2wEimKG.js';
|
|
9
9
|
export { n as network } from './network-BJOjJnmY.js';
|
|
10
|
-
export { a as api } from './api-
|
|
10
|
+
export { a as api } from './api-DmTNE4c1.js';
|
|
11
11
|
export { c as code } from './code-DaRvff2v.js';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.js';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { media_exports as media } from './chunk-XMKJYVKB.js';
|
|
2
|
-
export { units_exports as units } from './chunk-
|
|
2
|
+
export { units_exports as units } from './chunk-HP6C4VBX.js';
|
|
3
3
|
export { network_exports as network } from './chunk-Y5OOP6WN.js';
|
|
4
|
-
export { api_exports as api } from './chunk-
|
|
4
|
+
export { api_exports as api } from './chunk-52ZDKSIX.js';
|
|
5
5
|
export { code_exports as code } from './chunk-LXKIPPDG.js';
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
7
7
|
export { css_exports as css } from './chunk-6YPV2AB5.js';
|
package/dist/tools/api.cjs
CHANGED
|
@@ -493,6 +493,48 @@ function parseJwks(input) {
|
|
|
493
493
|
const duplicateKids = [...kidCounts.entries()].filter(([, c]) => c > 1).map(([kid]) => kid);
|
|
494
494
|
return { ok: true, keys, count: keys.length, duplicateKids };
|
|
495
495
|
}
|
|
496
|
+
var JWK_THUMBPRINT_MEMBERS = {
|
|
497
|
+
oct: ["k", "kty"],
|
|
498
|
+
RSA: ["e", "kty", "n"],
|
|
499
|
+
EC: ["crv", "kty", "x", "y"],
|
|
500
|
+
OKP: ["crv", "kty", "x"]
|
|
501
|
+
};
|
|
502
|
+
var JWK_THUMBPRINT_NODE_HASH = {
|
|
503
|
+
"SHA-256": "sha256",
|
|
504
|
+
"SHA-384": "sha384",
|
|
505
|
+
"SHA-512": "sha512"
|
|
506
|
+
};
|
|
507
|
+
function computeJwkThumbprint(input, hashAlg = "SHA-256") {
|
|
508
|
+
const trimmed = input.trim();
|
|
509
|
+
if (!trimmed) return { ok: false, error: "No input provided" };
|
|
510
|
+
const nodeHash = JWK_THUMBPRINT_NODE_HASH[hashAlg];
|
|
511
|
+
if (!nodeHash) return { ok: false, error: 'hashAlg must be one of "SHA-256", "SHA-384", "SHA-512"' };
|
|
512
|
+
let jwk;
|
|
513
|
+
try {
|
|
514
|
+
jwk = JSON.parse(trimmed);
|
|
515
|
+
} catch (e) {
|
|
516
|
+
return { ok: false, error: `Invalid JSON: ${e instanceof Error ? e.message : String(e)}` };
|
|
517
|
+
}
|
|
518
|
+
if (jwk === null || typeof jwk !== "object" || Array.isArray(jwk)) {
|
|
519
|
+
return { ok: false, error: "Input must be a single JWK object, not a JWKS set or array" };
|
|
520
|
+
}
|
|
521
|
+
const obj = jwk;
|
|
522
|
+
const kty = obj.kty;
|
|
523
|
+
if (typeof kty !== "string") return { ok: false, error: 'JWK must have a "kty" (key type) member' };
|
|
524
|
+
const members = JWK_THUMBPRINT_MEMBERS[kty];
|
|
525
|
+
if (!members) return { ok: false, error: `Unsupported key type "${kty}": supported types are RSA, EC, oct, OKP` };
|
|
526
|
+
const canonical = {};
|
|
527
|
+
for (const m of members) {
|
|
528
|
+
const v = obj[m];
|
|
529
|
+
if (typeof v !== "string" || v.length === 0) {
|
|
530
|
+
return { ok: false, error: `JWK is missing required member "${m}" for key type "${kty}"` };
|
|
531
|
+
}
|
|
532
|
+
canonical[m] = v;
|
|
533
|
+
}
|
|
534
|
+
const canonicalJson = "{" + members.map((m) => `${JSON.stringify(m)}:${JSON.stringify(canonical[m])}`).join(",") + "}";
|
|
535
|
+
const thumbprint = crypto.createHash(nodeHash).update(canonicalJson, "utf8").digest("base64url");
|
|
536
|
+
return { ok: true, kty, hashAlg, members, canonicalJson, thumbprint };
|
|
537
|
+
}
|
|
496
538
|
var ALG_TO_NODE_HASH = {
|
|
497
539
|
HS256: "sha256",
|
|
498
540
|
HS384: "sha384",
|
|
@@ -1237,6 +1279,7 @@ exports.base64urlEncode = base64urlEncode;
|
|
|
1237
1279
|
exports.buildCurl = buildCurl;
|
|
1238
1280
|
exports.buildCurlMultiline = buildCurlMultiline;
|
|
1239
1281
|
exports.buildUrl = buildUrl;
|
|
1282
|
+
exports.computeJwkThumbprint = computeJwkThumbprint;
|
|
1240
1283
|
exports.convertToCode = convertToCode;
|
|
1241
1284
|
exports.decodeJwt = decodeJwt;
|
|
1242
1285
|
exports.decodeUrlComponent = decodeUrlComponent;
|
package/dist/tools/api.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as COMMON_HEADERS, b as COMMON_PRESETS, c as CORS_COMMON_HEADERS, d as CorsConfig, e as CorsOutput, f as CspConfig, g as CspDirective, h as CspSource, i as CurlCommand, j as CurlConfig, D as DEFAULT_CORS_CONFIG, k as DIRECTIVE_DESCRIPTIONS, l as DirectiveConfig, F as FormatResult, H as HTTP_METHODS, m as Header, n as HttpMethod, J as JwkSummary, o as
|
|
1
|
+
export { C as COMMON_HEADERS, b as COMMON_PRESETS, c as CORS_COMMON_HEADERS, d as CorsConfig, e as CorsOutput, f as CspConfig, g as CspDirective, h as CspSource, i as CurlCommand, j as CurlConfig, D as DEFAULT_CORS_CONFIG, k as DIRECTIVE_DESCRIPTIONS, l as DirectiveConfig, F as FormatResult, H as HTTP_METHODS, m as Header, n as HttpMethod, J as JwkSummary, o as JwkThumbprintErrorResult, p as JwkThumbprintHash, q as JwkThumbprintOutcome, r as JwkThumbprintResult, s as JwksError, t as JwksParseResult, u as JwksResult, v as JwtAlgorithm, w as JwtDecodeError, x as JwtDecodeResult, y as JwtExpiry, z as JwtPart, A as JwtResult, B as JwtSignOptions, M as MetaTags, O as OgTags, P as ParsedUrl, R as ResponseFormat, S as SUPPORTED_LANGUAGES, T as TargetLanguage, E as TwitterTags, G as addParam, I as base64urlDecode, K as base64urlEncode, L as buildCurl, N as buildCurlMultiline, Q as buildUrl, U as computeJwkThumbprint, V as convertToCode, W as decodeJwt, X as decodeUrlComponent, Y as detectFormat, Z as encodeUrlComponent, _ as extractJsonPaths, $ as formatJwtJson, a0 as formatResponse, a1 as generateCors, a2 as generateCspHeader, a3 as generateFullHeader, a4 as generateMetaHtml, a5 as getParam, a6 as getStats, a7 as isValidUrl, a8 as normalizeUrl, a9 as parseCspHeader, aa as parseCurl, ab as parseCurlCommand, ac as parseJwks, ad as parseMetaTags, ae as parseUrl, af as removeParam, ag as signJwt, ah as validateCorsConfig, ai as validateCspConfig, aj as validateOgTags } from '../api-DmTNE4c1.cjs';
|
package/dist/tools/api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as COMMON_HEADERS, b as COMMON_PRESETS, c as CORS_COMMON_HEADERS, d as CorsConfig, e as CorsOutput, f as CspConfig, g as CspDirective, h as CspSource, i as CurlCommand, j as CurlConfig, D as DEFAULT_CORS_CONFIG, k as DIRECTIVE_DESCRIPTIONS, l as DirectiveConfig, F as FormatResult, H as HTTP_METHODS, m as Header, n as HttpMethod, J as JwkSummary, o as
|
|
1
|
+
export { C as COMMON_HEADERS, b as COMMON_PRESETS, c as CORS_COMMON_HEADERS, d as CorsConfig, e as CorsOutput, f as CspConfig, g as CspDirective, h as CspSource, i as CurlCommand, j as CurlConfig, D as DEFAULT_CORS_CONFIG, k as DIRECTIVE_DESCRIPTIONS, l as DirectiveConfig, F as FormatResult, H as HTTP_METHODS, m as Header, n as HttpMethod, J as JwkSummary, o as JwkThumbprintErrorResult, p as JwkThumbprintHash, q as JwkThumbprintOutcome, r as JwkThumbprintResult, s as JwksError, t as JwksParseResult, u as JwksResult, v as JwtAlgorithm, w as JwtDecodeError, x as JwtDecodeResult, y as JwtExpiry, z as JwtPart, A as JwtResult, B as JwtSignOptions, M as MetaTags, O as OgTags, P as ParsedUrl, R as ResponseFormat, S as SUPPORTED_LANGUAGES, T as TargetLanguage, E as TwitterTags, G as addParam, I as base64urlDecode, K as base64urlEncode, L as buildCurl, N as buildCurlMultiline, Q as buildUrl, U as computeJwkThumbprint, V as convertToCode, W as decodeJwt, X as decodeUrlComponent, Y as detectFormat, Z as encodeUrlComponent, _ as extractJsonPaths, $ as formatJwtJson, a0 as formatResponse, a1 as generateCors, a2 as generateCspHeader, a3 as generateFullHeader, a4 as generateMetaHtml, a5 as getParam, a6 as getStats, a7 as isValidUrl, a8 as normalizeUrl, a9 as parseCspHeader, aa as parseCurl, ab as parseCurlCommand, ac as parseJwks, ad as parseMetaTags, ae as parseUrl, af as removeParam, ag as signJwt, ah as validateCorsConfig, ai as validateCspConfig, aj as validateOgTags } from '../api-DmTNE4c1.js';
|
package/dist/tools/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { COMMON_HEADERS, COMMON_PRESETS, CORS_COMMON_HEADERS, DEFAULT_CORS_CONFIG, DIRECTIVE_DESCRIPTIONS, HTTP_METHODS, SUPPORTED_LANGUAGES, addParam, base64urlDecode, base64urlEncode, buildCurl, buildCurlMultiline, buildUrl, convertToCode, decodeJwt, decodeUrlComponent, detectFormat, encodeUrlComponent, extractJsonPaths, formatJwtJson, formatResponse, generateCors, generateCspHeader, generateFullHeader, generateMetaHtml, getParam, getStats, isValidUrl, normalizeUrl, parseCspHeader, parseCurl, parseCurlCommand, parseJwks, parseMetaTags, parseUrl, removeParam, signJwt, validateCorsConfig, validateCspConfig, validateOgTags } from '../chunk-
|
|
1
|
+
export { COMMON_HEADERS, COMMON_PRESETS, CORS_COMMON_HEADERS, DEFAULT_CORS_CONFIG, DIRECTIVE_DESCRIPTIONS, HTTP_METHODS, SUPPORTED_LANGUAGES, addParam, base64urlDecode, base64urlEncode, buildCurl, buildCurlMultiline, buildUrl, computeJwkThumbprint, convertToCode, decodeJwt, decodeUrlComponent, detectFormat, encodeUrlComponent, extractJsonPaths, formatJwtJson, formatResponse, generateCors, generateCspHeader, generateFullHeader, generateMetaHtml, getParam, getStats, isValidUrl, normalizeUrl, parseCspHeader, parseCurl, parseCurlCommand, parseJwks, parseMetaTags, parseUrl, removeParam, signJwt, validateCorsConfig, validateCspConfig, validateOgTags } from '../chunk-52ZDKSIX.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/units.cjs
CHANGED
|
@@ -1508,6 +1508,58 @@ function calculateBreakEven(input) {
|
|
|
1508
1508
|
}
|
|
1509
1509
|
return result;
|
|
1510
1510
|
}
|
|
1511
|
+
function calculateVideoBitrate(input) {
|
|
1512
|
+
const { mode, durationSeconds, videoBitrateKbps, targetSizeMB } = input;
|
|
1513
|
+
const audioBitrateKbps = input.audioBitrateKbps ?? 0;
|
|
1514
|
+
if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
|
|
1515
|
+
return { error: "durationSeconds must be a positive number" };
|
|
1516
|
+
}
|
|
1517
|
+
if (!Number.isFinite(audioBitrateKbps) || audioBitrateKbps < 0) {
|
|
1518
|
+
return { error: "audioBitrateKbps must be zero or a positive number" };
|
|
1519
|
+
}
|
|
1520
|
+
const round22 = (n) => Math.round(n * 100) / 100;
|
|
1521
|
+
if (mode === "size-from-bitrate") {
|
|
1522
|
+
if (typeof videoBitrateKbps !== "number" || !Number.isFinite(videoBitrateKbps) || videoBitrateKbps <= 0) {
|
|
1523
|
+
return { error: 'videoBitrateKbps must be a positive number for mode "size-from-bitrate"' };
|
|
1524
|
+
}
|
|
1525
|
+
const totalBitrateKbps = videoBitrateKbps + audioBitrateKbps;
|
|
1526
|
+
const fileSizeBytes = totalBitrateKbps * 1e3 * durationSeconds / 8;
|
|
1527
|
+
return {
|
|
1528
|
+
mode,
|
|
1529
|
+
durationSeconds,
|
|
1530
|
+
videoBitrateKbps: round22(videoBitrateKbps),
|
|
1531
|
+
audioBitrateKbps: round22(audioBitrateKbps),
|
|
1532
|
+
totalBitrateKbps: round22(totalBitrateKbps),
|
|
1533
|
+
fileSizeBytes: Math.round(fileSizeBytes),
|
|
1534
|
+
fileSizeMB: round22(fileSizeBytes / 1e6),
|
|
1535
|
+
fileSizeMiB: round22(fileSizeBytes / 1048576)
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
if (mode === "bitrate-from-size") {
|
|
1539
|
+
if (typeof targetSizeMB !== "number" || !Number.isFinite(targetSizeMB) || targetSizeMB <= 0) {
|
|
1540
|
+
return { error: 'targetSizeMB must be a positive number for mode "bitrate-from-size"' };
|
|
1541
|
+
}
|
|
1542
|
+
const fileSizeBytes = targetSizeMB * 1e6;
|
|
1543
|
+
const totalBitrateKbps = fileSizeBytes * 8 / (1e3 * durationSeconds);
|
|
1544
|
+
const videoKbps = totalBitrateKbps - audioBitrateKbps;
|
|
1545
|
+
if (videoKbps <= 0) {
|
|
1546
|
+
return {
|
|
1547
|
+
error: "audioBitrateKbps exceeds the total bitrate available at this target size and duration; lower the audio bitrate or raise the target size"
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
return {
|
|
1551
|
+
mode,
|
|
1552
|
+
durationSeconds,
|
|
1553
|
+
videoBitrateKbps: round22(videoKbps),
|
|
1554
|
+
audioBitrateKbps: round22(audioBitrateKbps),
|
|
1555
|
+
totalBitrateKbps: round22(totalBitrateKbps),
|
|
1556
|
+
fileSizeBytes: Math.round(fileSizeBytes),
|
|
1557
|
+
fileSizeMB: round22(targetSizeMB),
|
|
1558
|
+
fileSizeMiB: round22(fileSizeBytes / 1048576)
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
return { error: 'mode must be "size-from-bitrate" or "bitrate-from-size"' };
|
|
1562
|
+
}
|
|
1511
1563
|
|
|
1512
1564
|
exports.BASE_LABELS = BASE_LABELS;
|
|
1513
1565
|
exports.BASE_PREFIXES = BASE_PREFIXES;
|
|
@@ -1535,6 +1587,7 @@ exports.calculateSimpleInterest = calculateSimpleInterest;
|
|
|
1535
1587
|
exports.calculateTax = calculateTax;
|
|
1536
1588
|
exports.calculateTimeValue = calculateTimeValue;
|
|
1537
1589
|
exports.calculateTipSplit = calculateTipSplit;
|
|
1590
|
+
exports.calculateVideoBitrate = calculateVideoBitrate;
|
|
1538
1591
|
exports.compareSemver = compareSemver;
|
|
1539
1592
|
exports.convert = convert;
|
|
1540
1593
|
exports.convertAprApy = convertAprApy;
|
package/dist/tools/units.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as BreakEvenInput, j as BreakEvenResult, k as ByteConvertResult, l as ByteUnit, C as COMMON_CURRENCIES, m as COMMON_LOCALES, n as COMMON_PERMISSIONS, o as COMMON_RATIOS, p as COMMON_SIZES, q as COMMON_TAX_RATES, r as COMMON_TIP_PERCENTAGES, s as COMMON_VIEWPORTS, t as CardValidationResult, v as CompoundInterestResult, w as CompoundYearRow, D as Dimensions, x as DiscountField, y as DiscountInput, z as DiscountResult, F as FilePermissions, E as FormatOptions, I as IbanValidationResult, G as IpConversion, H as IsbnFormat, J as IsbnResult, L as LoanResult, M as MarginMarkupField, K as MarginMarkupInput, N as MarginMarkupResult, O as NotationStyle, P as NumberBase, Q as PercentChangeDirection, R as PercentageChangeResult, S as Permission, T as PxConvertResult, U as SemverVersion, V as SimpleInterestResult, W as SubnetInfo, X as SuccessiveDiscountResult, Y as SuccessiveDiscountStep, Z as TaxDirection, _ as TaxResult, $ as TimeValueDirection, a0 as TimeValueResult, a1 as TipSplitResult, a2 as
|
|
1
|
+
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as BreakEvenInput, j as BreakEvenResult, k as ByteConvertResult, l as ByteUnit, C as COMMON_CURRENCIES, m as COMMON_LOCALES, n as COMMON_PERMISSIONS, o as COMMON_RATIOS, p as COMMON_SIZES, q as COMMON_TAX_RATES, r as COMMON_TIP_PERCENTAGES, s as COMMON_VIEWPORTS, t as CardValidationResult, v as CompoundInterestResult, w as CompoundYearRow, D as Dimensions, x as DiscountField, y as DiscountInput, z as DiscountResult, F as FilePermissions, E as FormatOptions, I as IbanValidationResult, G as IpConversion, H as IsbnFormat, J as IsbnResult, L as LoanResult, M as MarginMarkupField, K as MarginMarkupInput, N as MarginMarkupResult, O as NotationStyle, P as NumberBase, Q as PercentChangeDirection, R as PercentageChangeResult, S as Permission, T as PxConvertResult, U as SemverVersion, V as SimpleInterestResult, W as SubnetInfo, X as SuccessiveDiscountResult, Y as SuccessiveDiscountStep, Z as TaxDirection, _ as TaxResult, $ as TimeValueDirection, a0 as TimeValueResult, a1 as TipSplitResult, a2 as VideoBitrateInput, a3 as VideoBitrateMode, a4 as VideoBitrateResult, a5 as ViewportConvertResult, a6 as applySuccessiveDiscounts, a7 as autoFormat, a8 as bumpVersion, a9 as calcAspectRatio, aa as calcSubnet, ab as calculateBreakEven, ac as calculateCompoundInterest, ad as calculateDiscount, ae as calculateLoan, af as calculateMarginMarkup, ag as calculatePercentageChange, ah as calculateSimpleInterest, ai as calculateTax, aj as calculateTimeValue, ak as calculateTipSplit, al as calculateVideoBitrate, am as compareSemver, an as convert, ao as convertAprApy, ap as convertBytes, aq as convertIp, ar as coverBox, as as decimalToIp, at as decimalToIpCidr, au as describePermissions, av as fitIntoBox, aw as formatNumber, ax as formatValue, ay as formatVwValue, az as formatWithSeparator, aA as gcd, aB as ipFromBinary, aC as ipFromDecimal, aD as ipFromHex, aE as ipToBinary, aF as ipToDecimal, aG as ipToDecimalCidr, aH as ipToHex, aI as ipToOctal, aJ as isValid, aK as isValidCidr, aL as isValidIp, aM as isValidIpv4, aN as marginToMarkup, aO as markupToMargin, aP as octalToPermissions, aQ as parseFileSize, aR as parseInput, aS as parseNumberString, aT as parseSemver, aU as permissionsToChmod, aV as permissionsToOctal, aW as permissionsToSymbolic, aX as ptToPx, aY as pxToAll, aZ as pxToViewport, a_ as remToPx, a$ as satisfiesRange, b0 as scaleByHeight, b1 as scaleByWidth, b2 as sortVersions, b3 as splitSubnet, b4 as symbolicToPermissions, b5 as validateBarcode, b6 as validateCardNumber, b7 as validateIban, b8 as validateIsbn, b9 as viewportToPx } from '../units-D2wEimKG.cjs';
|
package/dist/tools/units.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as BreakEvenInput, j as BreakEvenResult, k as ByteConvertResult, l as ByteUnit, C as COMMON_CURRENCIES, m as COMMON_LOCALES, n as COMMON_PERMISSIONS, o as COMMON_RATIOS, p as COMMON_SIZES, q as COMMON_TAX_RATES, r as COMMON_TIP_PERCENTAGES, s as COMMON_VIEWPORTS, t as CardValidationResult, v as CompoundInterestResult, w as CompoundYearRow, D as Dimensions, x as DiscountField, y as DiscountInput, z as DiscountResult, F as FilePermissions, E as FormatOptions, I as IbanValidationResult, G as IpConversion, H as IsbnFormat, J as IsbnResult, L as LoanResult, M as MarginMarkupField, K as MarginMarkupInput, N as MarginMarkupResult, O as NotationStyle, P as NumberBase, Q as PercentChangeDirection, R as PercentageChangeResult, S as Permission, T as PxConvertResult, U as SemverVersion, V as SimpleInterestResult, W as SubnetInfo, X as SuccessiveDiscountResult, Y as SuccessiveDiscountStep, Z as TaxDirection, _ as TaxResult, $ as TimeValueDirection, a0 as TimeValueResult, a1 as TipSplitResult, a2 as
|
|
1
|
+
export { A as AmortizationRow, a as AprApyDirection, b as AprApyResult, c as AspectRatioResult, B as BASE_LABELS, d as BASE_PREFIXES, e as BYTE_UNITS, f as BarcodeFormat, g as BarcodeValidationResult, h as BaseConvertResult, i as BreakEvenInput, j as BreakEvenResult, k as ByteConvertResult, l as ByteUnit, C as COMMON_CURRENCIES, m as COMMON_LOCALES, n as COMMON_PERMISSIONS, o as COMMON_RATIOS, p as COMMON_SIZES, q as COMMON_TAX_RATES, r as COMMON_TIP_PERCENTAGES, s as COMMON_VIEWPORTS, t as CardValidationResult, v as CompoundInterestResult, w as CompoundYearRow, D as Dimensions, x as DiscountField, y as DiscountInput, z as DiscountResult, F as FilePermissions, E as FormatOptions, I as IbanValidationResult, G as IpConversion, H as IsbnFormat, J as IsbnResult, L as LoanResult, M as MarginMarkupField, K as MarginMarkupInput, N as MarginMarkupResult, O as NotationStyle, P as NumberBase, Q as PercentChangeDirection, R as PercentageChangeResult, S as Permission, T as PxConvertResult, U as SemverVersion, V as SimpleInterestResult, W as SubnetInfo, X as SuccessiveDiscountResult, Y as SuccessiveDiscountStep, Z as TaxDirection, _ as TaxResult, $ as TimeValueDirection, a0 as TimeValueResult, a1 as TipSplitResult, a2 as VideoBitrateInput, a3 as VideoBitrateMode, a4 as VideoBitrateResult, a5 as ViewportConvertResult, a6 as applySuccessiveDiscounts, a7 as autoFormat, a8 as bumpVersion, a9 as calcAspectRatio, aa as calcSubnet, ab as calculateBreakEven, ac as calculateCompoundInterest, ad as calculateDiscount, ae as calculateLoan, af as calculateMarginMarkup, ag as calculatePercentageChange, ah as calculateSimpleInterest, ai as calculateTax, aj as calculateTimeValue, ak as calculateTipSplit, al as calculateVideoBitrate, am as compareSemver, an as convert, ao as convertAprApy, ap as convertBytes, aq as convertIp, ar as coverBox, as as decimalToIp, at as decimalToIpCidr, au as describePermissions, av as fitIntoBox, aw as formatNumber, ax as formatValue, ay as formatVwValue, az as formatWithSeparator, aA as gcd, aB as ipFromBinary, aC as ipFromDecimal, aD as ipFromHex, aE as ipToBinary, aF as ipToDecimal, aG as ipToDecimalCidr, aH as ipToHex, aI as ipToOctal, aJ as isValid, aK as isValidCidr, aL as isValidIp, aM as isValidIpv4, aN as marginToMarkup, aO as markupToMargin, aP as octalToPermissions, aQ as parseFileSize, aR as parseInput, aS as parseNumberString, aT as parseSemver, aU as permissionsToChmod, aV as permissionsToOctal, aW as permissionsToSymbolic, aX as ptToPx, aY as pxToAll, aZ as pxToViewport, a_ as remToPx, a$ as satisfiesRange, b0 as scaleByHeight, b1 as scaleByWidth, b2 as sortVersions, b3 as splitSubnet, b4 as symbolicToPermissions, b5 as validateBarcode, b6 as validateCardNumber, b7 as validateIban, b8 as validateIsbn, b9 as viewportToPx } from '../units-D2wEimKG.js';
|
package/dist/tools/units.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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, applySuccessiveDiscounts, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateBreakEven, calculateCompoundInterest, calculateDiscount, calculateLoan, calculateMarginMarkup, calculatePercentageChange, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, compareSemver, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, marginToMarkup, markupToMargin, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx } from '../chunk-
|
|
1
|
+
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, applySuccessiveDiscounts, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateBreakEven, calculateCompoundInterest, calculateDiscount, calculateLoan, calculateMarginMarkup, calculatePercentageChange, calculateSimpleInterest, calculateTax, calculateTimeValue, calculateTipSplit, calculateVideoBitrate, compareSemver, convert, convertAprApy, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, marginToMarkup, markupToMargin, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, validateBarcode, validateCardNumber, validateIban, validateIsbn, viewportToPx } from '../chunk-HP6C4VBX.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* - margin-markup-calculator : calculateMarginMarkup, marginToMarkup, markupToMargin
|
|
28
28
|
* - discount-calculator : calculateDiscount, applySuccessiveDiscounts
|
|
29
29
|
* - break-even-calculator : calculateBreakEven
|
|
30
|
+
* - video-bitrate-calculator : calculateVideoBitrate
|
|
30
31
|
*/
|
|
31
32
|
interface PxConvertResult {
|
|
32
33
|
px: number;
|
|
@@ -594,6 +595,38 @@ interface BreakEvenResult {
|
|
|
594
595
|
declare function calculateBreakEven(input: BreakEvenInput): BreakEvenResult | {
|
|
595
596
|
error: string;
|
|
596
597
|
};
|
|
598
|
+
type VideoBitrateMode = 'size-from-bitrate' | 'bitrate-from-size';
|
|
599
|
+
interface VideoBitrateInput {
|
|
600
|
+
mode: VideoBitrateMode;
|
|
601
|
+
durationSeconds: number;
|
|
602
|
+
/** Required for mode "size-from-bitrate". */
|
|
603
|
+
videoBitrateKbps?: number;
|
|
604
|
+
/** Optional for either mode; defaults to 0. */
|
|
605
|
+
audioBitrateKbps?: number;
|
|
606
|
+
/** Required for mode "bitrate-from-size". Decimal MB (1 MB = 1,000,000 bytes). */
|
|
607
|
+
targetSizeMB?: number;
|
|
608
|
+
}
|
|
609
|
+
interface VideoBitrateResult {
|
|
610
|
+
mode: VideoBitrateMode;
|
|
611
|
+
durationSeconds: number;
|
|
612
|
+
videoBitrateKbps: number;
|
|
613
|
+
audioBitrateKbps: number;
|
|
614
|
+
totalBitrateKbps: number;
|
|
615
|
+
fileSizeBytes: number;
|
|
616
|
+
/** Decimal megabytes: 1 MB = 1,000,000 bytes. */
|
|
617
|
+
fileSizeMB: number;
|
|
618
|
+
/** Binary mebibytes: 1 MiB = 1,048,576 bytes. */
|
|
619
|
+
fileSizeMiB: number;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Calculate the video file size from a target bitrate and duration, or the
|
|
623
|
+
* required bitrate to hit a target file size, with an optional separate
|
|
624
|
+
* audio bitrate. Pure arithmetic (fileSizeBytes = totalBitrateBps *
|
|
625
|
+
* durationSeconds / 8); no container parsing or encoding is performed.
|
|
626
|
+
*/
|
|
627
|
+
declare function calculateVideoBitrate(input: VideoBitrateInput): VideoBitrateResult | {
|
|
628
|
+
error: string;
|
|
629
|
+
};
|
|
597
630
|
|
|
598
631
|
type units_AmortizationRow = AmortizationRow;
|
|
599
632
|
type units_AprApyDirection = AprApyDirection;
|
|
@@ -650,6 +683,9 @@ type units_TaxResult = TaxResult;
|
|
|
650
683
|
type units_TimeValueDirection = TimeValueDirection;
|
|
651
684
|
type units_TimeValueResult = TimeValueResult;
|
|
652
685
|
type units_TipSplitResult = TipSplitResult;
|
|
686
|
+
type units_VideoBitrateInput = VideoBitrateInput;
|
|
687
|
+
type units_VideoBitrateMode = VideoBitrateMode;
|
|
688
|
+
type units_VideoBitrateResult = VideoBitrateResult;
|
|
653
689
|
type units_ViewportConvertResult = ViewportConvertResult;
|
|
654
690
|
declare const units_applySuccessiveDiscounts: typeof applySuccessiveDiscounts;
|
|
655
691
|
declare const units_autoFormat: typeof autoFormat;
|
|
@@ -666,6 +702,7 @@ declare const units_calculateSimpleInterest: typeof calculateSimpleInterest;
|
|
|
666
702
|
declare const units_calculateTax: typeof calculateTax;
|
|
667
703
|
declare const units_calculateTimeValue: typeof calculateTimeValue;
|
|
668
704
|
declare const units_calculateTipSplit: typeof calculateTipSplit;
|
|
705
|
+
declare const units_calculateVideoBitrate: typeof calculateVideoBitrate;
|
|
669
706
|
declare const units_compareSemver: typeof compareSemver;
|
|
670
707
|
declare const units_convert: typeof convert;
|
|
671
708
|
declare const units_convertAprApy: typeof convertAprApy;
|
|
@@ -719,7 +756,7 @@ declare const units_validateIban: typeof validateIban;
|
|
|
719
756
|
declare const units_validateIsbn: typeof validateIsbn;
|
|
720
757
|
declare const units_viewportToPx: typeof viewportToPx;
|
|
721
758
|
declare namespace units {
|
|
722
|
-
export { type units_AmortizationRow as AmortizationRow, type units_AprApyDirection as AprApyDirection, type units_AprApyResult as AprApyResult, type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BarcodeFormat as BarcodeFormat, type units_BarcodeValidationResult as BarcodeValidationResult, type units_BaseConvertResult as BaseConvertResult, type units_BreakEvenInput as BreakEvenInput, type units_BreakEvenResult as BreakEvenResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_TAX_RATES as COMMON_TAX_RATES, units_COMMON_TIP_PERCENTAGES as COMMON_TIP_PERCENTAGES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_CompoundInterestResult as CompoundInterestResult, type units_CompoundYearRow as CompoundYearRow, type units_Dimensions as Dimensions, type units_DiscountField as DiscountField, type units_DiscountInput as DiscountInput, type units_DiscountResult as DiscountResult, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IbanValidationResult as IbanValidationResult, type units_IpConversion as IpConversion, type units_IsbnFormat as IsbnFormat, type units_IsbnResult as IsbnResult, type units_LoanResult as LoanResult, type units_MarginMarkupField as MarginMarkupField, type units_MarginMarkupInput as MarginMarkupInput, type units_MarginMarkupResult as MarginMarkupResult, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_PercentChangeDirection as PercentChangeDirection, type units_PercentageChangeResult as PercentageChangeResult, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SimpleInterestResult as SimpleInterestResult, type units_SubnetInfo as SubnetInfo, type units_SuccessiveDiscountResult as SuccessiveDiscountResult, type units_SuccessiveDiscountStep as SuccessiveDiscountStep, type units_TaxDirection as TaxDirection, type units_TaxResult as TaxResult, type units_TimeValueDirection as TimeValueDirection, type units_TimeValueResult as TimeValueResult, type units_TipSplitResult as TipSplitResult, type units_ViewportConvertResult as ViewportConvertResult, units_applySuccessiveDiscounts as applySuccessiveDiscounts, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_calculateBreakEven as calculateBreakEven, units_calculateCompoundInterest as calculateCompoundInterest, units_calculateDiscount as calculateDiscount, units_calculateLoan as calculateLoan, units_calculateMarginMarkup as calculateMarginMarkup, units_calculatePercentageChange as calculatePercentageChange, units_calculateSimpleInterest as calculateSimpleInterest, units_calculateTax as calculateTax, units_calculateTimeValue as calculateTimeValue, units_calculateTipSplit as calculateTipSplit, units_compareSemver as compareSemver, units_convert as convert, units_convertAprApy as convertAprApy, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_marginToMarkup as marginToMarkup, units_markupToMargin as markupToMargin, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateBarcode as validateBarcode, units_validateCardNumber as validateCardNumber, units_validateIban as validateIban, units_validateIsbn as validateIsbn, units_viewportToPx as viewportToPx };
|
|
759
|
+
export { type units_AmortizationRow as AmortizationRow, type units_AprApyDirection as AprApyDirection, type units_AprApyResult as AprApyResult, type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BarcodeFormat as BarcodeFormat, type units_BarcodeValidationResult as BarcodeValidationResult, type units_BaseConvertResult as BaseConvertResult, type units_BreakEvenInput as BreakEvenInput, type units_BreakEvenResult as BreakEvenResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_TAX_RATES as COMMON_TAX_RATES, units_COMMON_TIP_PERCENTAGES as COMMON_TIP_PERCENTAGES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_CompoundInterestResult as CompoundInterestResult, type units_CompoundYearRow as CompoundYearRow, type units_Dimensions as Dimensions, type units_DiscountField as DiscountField, type units_DiscountInput as DiscountInput, type units_DiscountResult as DiscountResult, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IbanValidationResult as IbanValidationResult, type units_IpConversion as IpConversion, type units_IsbnFormat as IsbnFormat, type units_IsbnResult as IsbnResult, type units_LoanResult as LoanResult, type units_MarginMarkupField as MarginMarkupField, type units_MarginMarkupInput as MarginMarkupInput, type units_MarginMarkupResult as MarginMarkupResult, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_PercentChangeDirection as PercentChangeDirection, type units_PercentageChangeResult as PercentageChangeResult, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SimpleInterestResult as SimpleInterestResult, type units_SubnetInfo as SubnetInfo, type units_SuccessiveDiscountResult as SuccessiveDiscountResult, type units_SuccessiveDiscountStep as SuccessiveDiscountStep, type units_TaxDirection as TaxDirection, type units_TaxResult as TaxResult, type units_TimeValueDirection as TimeValueDirection, type units_TimeValueResult as TimeValueResult, type units_TipSplitResult as TipSplitResult, type units_VideoBitrateInput as VideoBitrateInput, type units_VideoBitrateMode as VideoBitrateMode, type units_VideoBitrateResult as VideoBitrateResult, type units_ViewportConvertResult as ViewportConvertResult, units_applySuccessiveDiscounts as applySuccessiveDiscounts, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_calculateBreakEven as calculateBreakEven, units_calculateCompoundInterest as calculateCompoundInterest, units_calculateDiscount as calculateDiscount, units_calculateLoan as calculateLoan, units_calculateMarginMarkup as calculateMarginMarkup, units_calculatePercentageChange as calculatePercentageChange, units_calculateSimpleInterest as calculateSimpleInterest, units_calculateTax as calculateTax, units_calculateTimeValue as calculateTimeValue, units_calculateTipSplit as calculateTipSplit, units_calculateVideoBitrate as calculateVideoBitrate, units_compareSemver as compareSemver, units_convert as convert, units_convertAprApy as convertAprApy, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_marginToMarkup as marginToMarkup, units_markupToMargin as markupToMargin, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateBarcode as validateBarcode, units_validateCardNumber as validateCardNumber, units_validateIban as validateIban, units_validateIsbn as validateIsbn, units_viewportToPx as viewportToPx };
|
|
723
760
|
}
|
|
724
761
|
|
|
725
|
-
export { type TimeValueDirection as $, type AmortizationRow as A, BASE_LABELS as B, COMMON_CURRENCIES as C, type Dimensions as D, type FormatOptions as E, type FilePermissions as F, type IpConversion as G, type IsbnFormat as H, type IbanValidationResult as I, type IsbnResult as J, type MarginMarkupInput as K, type LoanResult as L, type MarginMarkupField as M, type MarginMarkupResult as N, type NotationStyle as O, type NumberBase as P, type PercentChangeDirection as Q, type PercentageChangeResult as R, type Permission as S, type PxConvertResult as T, type SemverVersion as U, type SimpleInterestResult as V, type SubnetInfo as W, type SuccessiveDiscountResult as X, type SuccessiveDiscountStep as Y, type TaxDirection as Z, type TaxResult as _, type AprApyDirection as a,
|
|
762
|
+
export { type TimeValueDirection as $, type AmortizationRow as A, BASE_LABELS as B, COMMON_CURRENCIES as C, type Dimensions as D, type FormatOptions as E, type FilePermissions as F, type IpConversion as G, type IsbnFormat as H, type IbanValidationResult as I, type IsbnResult as J, type MarginMarkupInput as K, type LoanResult as L, type MarginMarkupField as M, type MarginMarkupResult as N, type NotationStyle as O, type NumberBase as P, type PercentChangeDirection as Q, type PercentageChangeResult as R, type Permission as S, type PxConvertResult as T, type SemverVersion as U, type SimpleInterestResult as V, type SubnetInfo as W, type SuccessiveDiscountResult as X, type SuccessiveDiscountStep as Y, type TaxDirection as Z, type TaxResult as _, type AprApyDirection as a, satisfiesRange as a$, type TimeValueResult as a0, type TipSplitResult as a1, type VideoBitrateInput as a2, type VideoBitrateMode as a3, type VideoBitrateResult as a4, type ViewportConvertResult as a5, applySuccessiveDiscounts as a6, autoFormat as a7, bumpVersion as a8, calcAspectRatio as a9, gcd as aA, ipFromBinary as aB, ipFromDecimal as aC, ipFromHex as aD, ipToBinary as aE, ipToDecimal as aF, ipToDecimalCidr as aG, ipToHex as aH, ipToOctal as aI, isValid as aJ, isValidCidr as aK, isValidIp as aL, isValidIpv4 as aM, marginToMarkup as aN, markupToMargin as aO, octalToPermissions as aP, parseFileSize as aQ, parseInput as aR, parseNumberString as aS, parseSemver as aT, permissionsToChmod as aU, permissionsToOctal as aV, permissionsToSymbolic as aW, ptToPx as aX, pxToAll as aY, pxToViewport as aZ, remToPx as a_, calcSubnet as aa, calculateBreakEven as ab, calculateCompoundInterest as ac, calculateDiscount as ad, calculateLoan as ae, calculateMarginMarkup as af, calculatePercentageChange as ag, calculateSimpleInterest as ah, calculateTax as ai, calculateTimeValue as aj, calculateTipSplit as ak, calculateVideoBitrate as al, compareSemver as am, convert as an, convertAprApy as ao, convertBytes as ap, convertIp as aq, coverBox as ar, decimalToIp as as, decimalToIpCidr as at, describePermissions as au, fitIntoBox as av, formatNumber as aw, formatValue as ax, formatVwValue as ay, formatWithSeparator as az, type AprApyResult as b, scaleByHeight as b0, scaleByWidth as b1, sortVersions as b2, splitSubnet as b3, symbolicToPermissions as b4, validateBarcode as b5, validateCardNumber as b6, validateIban as b7, validateIsbn as b8, viewportToPx as b9, type AspectRatioResult as c, BASE_PREFIXES as d, BYTE_UNITS as e, type BarcodeFormat as f, type BarcodeValidationResult as g, type BaseConvertResult as h, type BreakEvenInput as i, type BreakEvenResult as j, type ByteConvertResult as k, type ByteUnit as l, COMMON_LOCALES as m, COMMON_PERMISSIONS as n, COMMON_RATIOS as o, COMMON_SIZES as p, COMMON_TAX_RATES as q, COMMON_TIP_PERCENTAGES as r, COMMON_VIEWPORTS as s, type CardValidationResult as t, units as u, type CompoundInterestResult as v, type CompoundYearRow as w, type DiscountField as x, type DiscountInput as y, type DiscountResult as z };
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* - margin-markup-calculator : calculateMarginMarkup, marginToMarkup, markupToMargin
|
|
28
28
|
* - discount-calculator : calculateDiscount, applySuccessiveDiscounts
|
|
29
29
|
* - break-even-calculator : calculateBreakEven
|
|
30
|
+
* - video-bitrate-calculator : calculateVideoBitrate
|
|
30
31
|
*/
|
|
31
32
|
interface PxConvertResult {
|
|
32
33
|
px: number;
|
|
@@ -594,6 +595,38 @@ interface BreakEvenResult {
|
|
|
594
595
|
declare function calculateBreakEven(input: BreakEvenInput): BreakEvenResult | {
|
|
595
596
|
error: string;
|
|
596
597
|
};
|
|
598
|
+
type VideoBitrateMode = 'size-from-bitrate' | 'bitrate-from-size';
|
|
599
|
+
interface VideoBitrateInput {
|
|
600
|
+
mode: VideoBitrateMode;
|
|
601
|
+
durationSeconds: number;
|
|
602
|
+
/** Required for mode "size-from-bitrate". */
|
|
603
|
+
videoBitrateKbps?: number;
|
|
604
|
+
/** Optional for either mode; defaults to 0. */
|
|
605
|
+
audioBitrateKbps?: number;
|
|
606
|
+
/** Required for mode "bitrate-from-size". Decimal MB (1 MB = 1,000,000 bytes). */
|
|
607
|
+
targetSizeMB?: number;
|
|
608
|
+
}
|
|
609
|
+
interface VideoBitrateResult {
|
|
610
|
+
mode: VideoBitrateMode;
|
|
611
|
+
durationSeconds: number;
|
|
612
|
+
videoBitrateKbps: number;
|
|
613
|
+
audioBitrateKbps: number;
|
|
614
|
+
totalBitrateKbps: number;
|
|
615
|
+
fileSizeBytes: number;
|
|
616
|
+
/** Decimal megabytes: 1 MB = 1,000,000 bytes. */
|
|
617
|
+
fileSizeMB: number;
|
|
618
|
+
/** Binary mebibytes: 1 MiB = 1,048,576 bytes. */
|
|
619
|
+
fileSizeMiB: number;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Calculate the video file size from a target bitrate and duration, or the
|
|
623
|
+
* required bitrate to hit a target file size, with an optional separate
|
|
624
|
+
* audio bitrate. Pure arithmetic (fileSizeBytes = totalBitrateBps *
|
|
625
|
+
* durationSeconds / 8); no container parsing or encoding is performed.
|
|
626
|
+
*/
|
|
627
|
+
declare function calculateVideoBitrate(input: VideoBitrateInput): VideoBitrateResult | {
|
|
628
|
+
error: string;
|
|
629
|
+
};
|
|
597
630
|
|
|
598
631
|
type units_AmortizationRow = AmortizationRow;
|
|
599
632
|
type units_AprApyDirection = AprApyDirection;
|
|
@@ -650,6 +683,9 @@ type units_TaxResult = TaxResult;
|
|
|
650
683
|
type units_TimeValueDirection = TimeValueDirection;
|
|
651
684
|
type units_TimeValueResult = TimeValueResult;
|
|
652
685
|
type units_TipSplitResult = TipSplitResult;
|
|
686
|
+
type units_VideoBitrateInput = VideoBitrateInput;
|
|
687
|
+
type units_VideoBitrateMode = VideoBitrateMode;
|
|
688
|
+
type units_VideoBitrateResult = VideoBitrateResult;
|
|
653
689
|
type units_ViewportConvertResult = ViewportConvertResult;
|
|
654
690
|
declare const units_applySuccessiveDiscounts: typeof applySuccessiveDiscounts;
|
|
655
691
|
declare const units_autoFormat: typeof autoFormat;
|
|
@@ -666,6 +702,7 @@ declare const units_calculateSimpleInterest: typeof calculateSimpleInterest;
|
|
|
666
702
|
declare const units_calculateTax: typeof calculateTax;
|
|
667
703
|
declare const units_calculateTimeValue: typeof calculateTimeValue;
|
|
668
704
|
declare const units_calculateTipSplit: typeof calculateTipSplit;
|
|
705
|
+
declare const units_calculateVideoBitrate: typeof calculateVideoBitrate;
|
|
669
706
|
declare const units_compareSemver: typeof compareSemver;
|
|
670
707
|
declare const units_convert: typeof convert;
|
|
671
708
|
declare const units_convertAprApy: typeof convertAprApy;
|
|
@@ -719,7 +756,7 @@ declare const units_validateIban: typeof validateIban;
|
|
|
719
756
|
declare const units_validateIsbn: typeof validateIsbn;
|
|
720
757
|
declare const units_viewportToPx: typeof viewportToPx;
|
|
721
758
|
declare namespace units {
|
|
722
|
-
export { type units_AmortizationRow as AmortizationRow, type units_AprApyDirection as AprApyDirection, type units_AprApyResult as AprApyResult, type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BarcodeFormat as BarcodeFormat, type units_BarcodeValidationResult as BarcodeValidationResult, type units_BaseConvertResult as BaseConvertResult, type units_BreakEvenInput as BreakEvenInput, type units_BreakEvenResult as BreakEvenResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_TAX_RATES as COMMON_TAX_RATES, units_COMMON_TIP_PERCENTAGES as COMMON_TIP_PERCENTAGES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_CompoundInterestResult as CompoundInterestResult, type units_CompoundYearRow as CompoundYearRow, type units_Dimensions as Dimensions, type units_DiscountField as DiscountField, type units_DiscountInput as DiscountInput, type units_DiscountResult as DiscountResult, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IbanValidationResult as IbanValidationResult, type units_IpConversion as IpConversion, type units_IsbnFormat as IsbnFormat, type units_IsbnResult as IsbnResult, type units_LoanResult as LoanResult, type units_MarginMarkupField as MarginMarkupField, type units_MarginMarkupInput as MarginMarkupInput, type units_MarginMarkupResult as MarginMarkupResult, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_PercentChangeDirection as PercentChangeDirection, type units_PercentageChangeResult as PercentageChangeResult, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SimpleInterestResult as SimpleInterestResult, type units_SubnetInfo as SubnetInfo, type units_SuccessiveDiscountResult as SuccessiveDiscountResult, type units_SuccessiveDiscountStep as SuccessiveDiscountStep, type units_TaxDirection as TaxDirection, type units_TaxResult as TaxResult, type units_TimeValueDirection as TimeValueDirection, type units_TimeValueResult as TimeValueResult, type units_TipSplitResult as TipSplitResult, type units_ViewportConvertResult as ViewportConvertResult, units_applySuccessiveDiscounts as applySuccessiveDiscounts, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_calculateBreakEven as calculateBreakEven, units_calculateCompoundInterest as calculateCompoundInterest, units_calculateDiscount as calculateDiscount, units_calculateLoan as calculateLoan, units_calculateMarginMarkup as calculateMarginMarkup, units_calculatePercentageChange as calculatePercentageChange, units_calculateSimpleInterest as calculateSimpleInterest, units_calculateTax as calculateTax, units_calculateTimeValue as calculateTimeValue, units_calculateTipSplit as calculateTipSplit, units_compareSemver as compareSemver, units_convert as convert, units_convertAprApy as convertAprApy, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_marginToMarkup as marginToMarkup, units_markupToMargin as markupToMargin, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateBarcode as validateBarcode, units_validateCardNumber as validateCardNumber, units_validateIban as validateIban, units_validateIsbn as validateIsbn, units_viewportToPx as viewportToPx };
|
|
759
|
+
export { type units_AmortizationRow as AmortizationRow, type units_AprApyDirection as AprApyDirection, type units_AprApyResult as AprApyResult, type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BarcodeFormat as BarcodeFormat, type units_BarcodeValidationResult as BarcodeValidationResult, type units_BaseConvertResult as BaseConvertResult, type units_BreakEvenInput as BreakEvenInput, type units_BreakEvenResult as BreakEvenResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_TAX_RATES as COMMON_TAX_RATES, units_COMMON_TIP_PERCENTAGES as COMMON_TIP_PERCENTAGES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_CompoundInterestResult as CompoundInterestResult, type units_CompoundYearRow as CompoundYearRow, type units_Dimensions as Dimensions, type units_DiscountField as DiscountField, type units_DiscountInput as DiscountInput, type units_DiscountResult as DiscountResult, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IbanValidationResult as IbanValidationResult, type units_IpConversion as IpConversion, type units_IsbnFormat as IsbnFormat, type units_IsbnResult as IsbnResult, type units_LoanResult as LoanResult, type units_MarginMarkupField as MarginMarkupField, type units_MarginMarkupInput as MarginMarkupInput, type units_MarginMarkupResult as MarginMarkupResult, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_PercentChangeDirection as PercentChangeDirection, type units_PercentageChangeResult as PercentageChangeResult, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SimpleInterestResult as SimpleInterestResult, type units_SubnetInfo as SubnetInfo, type units_SuccessiveDiscountResult as SuccessiveDiscountResult, type units_SuccessiveDiscountStep as SuccessiveDiscountStep, type units_TaxDirection as TaxDirection, type units_TaxResult as TaxResult, type units_TimeValueDirection as TimeValueDirection, type units_TimeValueResult as TimeValueResult, type units_TipSplitResult as TipSplitResult, type units_VideoBitrateInput as VideoBitrateInput, type units_VideoBitrateMode as VideoBitrateMode, type units_VideoBitrateResult as VideoBitrateResult, type units_ViewportConvertResult as ViewportConvertResult, units_applySuccessiveDiscounts as applySuccessiveDiscounts, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_calculateBreakEven as calculateBreakEven, units_calculateCompoundInterest as calculateCompoundInterest, units_calculateDiscount as calculateDiscount, units_calculateLoan as calculateLoan, units_calculateMarginMarkup as calculateMarginMarkup, units_calculatePercentageChange as calculatePercentageChange, units_calculateSimpleInterest as calculateSimpleInterest, units_calculateTax as calculateTax, units_calculateTimeValue as calculateTimeValue, units_calculateTipSplit as calculateTipSplit, units_calculateVideoBitrate as calculateVideoBitrate, units_compareSemver as compareSemver, units_convert as convert, units_convertAprApy as convertAprApy, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_marginToMarkup as marginToMarkup, units_markupToMargin as markupToMargin, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateBarcode as validateBarcode, units_validateCardNumber as validateCardNumber, units_validateIban as validateIban, units_validateIsbn as validateIsbn, units_viewportToPx as viewportToPx };
|
|
723
760
|
}
|
|
724
761
|
|
|
725
|
-
export { type TimeValueDirection as $, type AmortizationRow as A, BASE_LABELS as B, COMMON_CURRENCIES as C, type Dimensions as D, type FormatOptions as E, type FilePermissions as F, type IpConversion as G, type IsbnFormat as H, type IbanValidationResult as I, type IsbnResult as J, type MarginMarkupInput as K, type LoanResult as L, type MarginMarkupField as M, type MarginMarkupResult as N, type NotationStyle as O, type NumberBase as P, type PercentChangeDirection as Q, type PercentageChangeResult as R, type Permission as S, type PxConvertResult as T, type SemverVersion as U, type SimpleInterestResult as V, type SubnetInfo as W, type SuccessiveDiscountResult as X, type SuccessiveDiscountStep as Y, type TaxDirection as Z, type TaxResult as _, type AprApyDirection as a,
|
|
762
|
+
export { type TimeValueDirection as $, type AmortizationRow as A, BASE_LABELS as B, COMMON_CURRENCIES as C, type Dimensions as D, type FormatOptions as E, type FilePermissions as F, type IpConversion as G, type IsbnFormat as H, type IbanValidationResult as I, type IsbnResult as J, type MarginMarkupInput as K, type LoanResult as L, type MarginMarkupField as M, type MarginMarkupResult as N, type NotationStyle as O, type NumberBase as P, type PercentChangeDirection as Q, type PercentageChangeResult as R, type Permission as S, type PxConvertResult as T, type SemverVersion as U, type SimpleInterestResult as V, type SubnetInfo as W, type SuccessiveDiscountResult as X, type SuccessiveDiscountStep as Y, type TaxDirection as Z, type TaxResult as _, type AprApyDirection as a, satisfiesRange as a$, type TimeValueResult as a0, type TipSplitResult as a1, type VideoBitrateInput as a2, type VideoBitrateMode as a3, type VideoBitrateResult as a4, type ViewportConvertResult as a5, applySuccessiveDiscounts as a6, autoFormat as a7, bumpVersion as a8, calcAspectRatio as a9, gcd as aA, ipFromBinary as aB, ipFromDecimal as aC, ipFromHex as aD, ipToBinary as aE, ipToDecimal as aF, ipToDecimalCidr as aG, ipToHex as aH, ipToOctal as aI, isValid as aJ, isValidCidr as aK, isValidIp as aL, isValidIpv4 as aM, marginToMarkup as aN, markupToMargin as aO, octalToPermissions as aP, parseFileSize as aQ, parseInput as aR, parseNumberString as aS, parseSemver as aT, permissionsToChmod as aU, permissionsToOctal as aV, permissionsToSymbolic as aW, ptToPx as aX, pxToAll as aY, pxToViewport as aZ, remToPx as a_, calcSubnet as aa, calculateBreakEven as ab, calculateCompoundInterest as ac, calculateDiscount as ad, calculateLoan as ae, calculateMarginMarkup as af, calculatePercentageChange as ag, calculateSimpleInterest as ah, calculateTax as ai, calculateTimeValue as aj, calculateTipSplit as ak, calculateVideoBitrate as al, compareSemver as am, convert as an, convertAprApy as ao, convertBytes as ap, convertIp as aq, coverBox as ar, decimalToIp as as, decimalToIpCidr as at, describePermissions as au, fitIntoBox as av, formatNumber as aw, formatValue as ax, formatVwValue as ay, formatWithSeparator as az, type AprApyResult as b, scaleByHeight as b0, scaleByWidth as b1, sortVersions as b2, splitSubnet as b3, symbolicToPermissions as b4, validateBarcode as b5, validateCardNumber as b6, validateIban as b7, validateIsbn as b8, viewportToPx as b9, type AspectRatioResult as c, BASE_PREFIXES as d, BYTE_UNITS as e, type BarcodeFormat as f, type BarcodeValidationResult as g, type BaseConvertResult as h, type BreakEvenInput as i, type BreakEvenResult as j, type ByteConvertResult as k, type ByteUnit as l, COMMON_LOCALES as m, COMMON_PERMISSIONS as n, COMMON_RATIOS as o, COMMON_SIZES as p, COMMON_TAX_RATES as q, COMMON_TIP_PERCENTAGES as r, COMMON_VIEWPORTS as s, type CardValidationResult as t, units as u, type CompoundInterestResult as v, type CompoundYearRow as w, type DiscountField as x, type DiscountInput as y, type DiscountResult as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilix-tech/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "154+ developer utility tools for Node.js: JSON, encoding, hashing, color, CSS, network and more. Runs locally, no API key required.",
|
|
5
5
|
"author": "Utilix <hello@utilix.tech>",
|
|
6
6
|
"license": "MIT",
|