@utilix-tech/sdk 0.42.0 → 0.43.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.
@@ -1,2 +1,2 @@
1
- export { MODEL_PRICING, chunkText, compressHtml, compressJson, compressMarkdown, deduplicateLines, detectPii, detectPromptInjection, detectSecrets, diffJson, estimateCost, estimateTokens, expandQuery, extractEntities, extractJson, extractKeywords, extractTables, extractUrls, flattenJson, formatFewShotExamples, mergeJson, redactPii, repairJson, rerankChunks, sanitizeHtml, scoreRelevance, summarizeForLlm, trimToTokens, unflattenJson, validateJsonSchema, vectorSimilarity } from '../chunk-W3J7GZVQ.js';
1
+ export { MODEL_PRICING, chunkText, compressHtml, compressJson, compressMarkdown, deduplicateLines, detectPii, detectPromptInjection, detectSecrets, diffJson, estimateCost, estimateTokens, expandQuery, extractEntities, extractJson, extractKeywords, extractTables, extractUrls, flattenJson, formatFewShotExamples, lintToolSchema, mergeJson, redactPii, repairJson, rerankChunks, sanitizeHtml, scoreRelevance, summarizeForLlm, trimToTokens, unflattenJson, validateJsonSchema, vectorSimilarity } from '../chunk-EKIXOA7B.js';
2
2
  import '../chunk-MLKGABMK.js';
@@ -2316,6 +2316,112 @@ function parseVaryHeader(raw) {
2316
2316
  const headers = withoutLabel.split(",").map((h) => h.trim()).filter((h) => h.length > 0);
2317
2317
  return buildVaryHeader(headers);
2318
2318
  }
2319
+ var VALID_MANIFEST_DISPLAY = /* @__PURE__ */ new Set(["fullscreen", "standalone", "minimal-ui", "browser"]);
2320
+ function validateManifest(jsonText) {
2321
+ if (!jsonText || !jsonText.trim()) return { error: "Input is empty" };
2322
+ let manifest;
2323
+ try {
2324
+ manifest = JSON.parse(jsonText);
2325
+ } catch (e) {
2326
+ return { error: `Invalid JSON: ${e.message}` };
2327
+ }
2328
+ if (typeof manifest !== "object" || manifest === null || Array.isArray(manifest)) {
2329
+ return { error: "Manifest must be a JSON object" };
2330
+ }
2331
+ const m = manifest;
2332
+ const issues = [];
2333
+ if (!m.name && !m.short_name) {
2334
+ issues.push({ severity: "error", path: "name", message: 'Manifest must have at least one of "name" or "short_name"' });
2335
+ }
2336
+ if (m.name !== void 0 && typeof m.name !== "string") {
2337
+ issues.push({ severity: "error", path: "name", message: '"name" must be a string' });
2338
+ } else if (typeof m.name === "string" && m.name.length > 45) {
2339
+ issues.push({ severity: "warning", path: "name", message: `"name" is ${m.name.length} characters; keep it under ~45 to avoid truncation in install prompts` });
2340
+ }
2341
+ if (m.short_name !== void 0 && typeof m.short_name !== "string") {
2342
+ issues.push({ severity: "error", path: "short_name", message: '"short_name" must be a string' });
2343
+ } else if (typeof m.short_name === "string" && m.short_name.length > 12) {
2344
+ issues.push({ severity: "warning", path: "short_name", message: `"short_name" is ${m.short_name.length} characters; keep it under ~12 to avoid truncation on home screens` });
2345
+ }
2346
+ if (!m.start_url) {
2347
+ issues.push({ severity: "error", path: "start_url", message: 'Manifest is missing "start_url"' });
2348
+ } else if (typeof m.start_url !== "string") {
2349
+ issues.push({ severity: "error", path: "start_url", message: '"start_url" must be a string' });
2350
+ } else if (m.start_url.startsWith("//")) {
2351
+ issues.push({ severity: "warning", path: "start_url", message: '"start_url" looks protocol-relative; use a relative path (e.g. "/") or a full absolute URL instead' });
2352
+ }
2353
+ if (m.display !== void 0) {
2354
+ if (typeof m.display !== "string" || !VALID_MANIFEST_DISPLAY.has(m.display)) {
2355
+ issues.push({ severity: "error", path: "display", message: `"display" must be one of: ${[...VALID_MANIFEST_DISPLAY].join(", ")}` });
2356
+ }
2357
+ } else {
2358
+ issues.push({ severity: "warning", path: "display", message: 'Missing "display"; it defaults to "browser", which will not open the installed app in its own standalone window' });
2359
+ }
2360
+ const icons = [];
2361
+ let hasMaskableIcon = false;
2362
+ let has512Icon = false;
2363
+ if (!Array.isArray(m.icons) || m.icons.length === 0) {
2364
+ issues.push({ severity: "error", path: "icons", message: 'Manifest must have a non-empty "icons" array' });
2365
+ } else {
2366
+ m.icons.forEach((icon, i) => {
2367
+ const path = `icons[${i}]`;
2368
+ if (!icon || typeof icon !== "object") {
2369
+ issues.push({ severity: "error", path, message: "Icon entry must be an object" });
2370
+ return;
2371
+ }
2372
+ const iconObj = icon;
2373
+ if (!iconObj.src || typeof iconObj.src !== "string") {
2374
+ issues.push({ severity: "error", path, message: 'Icon entry is missing a required "src"' });
2375
+ }
2376
+ if (iconObj.sizes !== void 0) {
2377
+ if (typeof iconObj.sizes !== "string" || iconObj.sizes !== "any" && !/^\d+x\d+(\s+\d+x\d+)*$/i.test(iconObj.sizes)) {
2378
+ issues.push({ severity: "warning", path, message: `"sizes" value "${String(iconObj.sizes)}" doesn't match the expected "WIDTHxHEIGHT" format` });
2379
+ } else if (/(^|\s)512x512(\s|$)/i.test(iconObj.sizes)) {
2380
+ has512Icon = true;
2381
+ }
2382
+ }
2383
+ if (typeof iconObj.purpose === "string" && iconObj.purpose.toLowerCase().includes("maskable")) {
2384
+ hasMaskableIcon = true;
2385
+ }
2386
+ icons.push({
2387
+ src: typeof iconObj.src === "string" ? iconObj.src : "",
2388
+ sizes: typeof iconObj.sizes === "string" ? iconObj.sizes : void 0,
2389
+ type: typeof iconObj.type === "string" ? iconObj.type : void 0,
2390
+ purpose: typeof iconObj.purpose === "string" ? iconObj.purpose : void 0
2391
+ });
2392
+ });
2393
+ if (icons.length > 0) {
2394
+ if (!has512Icon) {
2395
+ issues.push({ severity: "warning", path: "icons", message: "No icon sized 512x512 found; this size is used for splash screens and app store listings" });
2396
+ }
2397
+ if (!hasMaskableIcon) {
2398
+ issues.push({ severity: "warning", path: "icons", message: 'No icon with purpose "maskable" (or "any maskable") found; without one, Android may crop your icon into its adaptive icon mask' });
2399
+ }
2400
+ }
2401
+ }
2402
+ if (m.theme_color !== void 0 && typeof m.theme_color !== "string") {
2403
+ issues.push({ severity: "error", path: "theme_color", message: '"theme_color" must be a CSS color string' });
2404
+ }
2405
+ if (m.background_color !== void 0 && typeof m.background_color !== "string") {
2406
+ issues.push({ severity: "error", path: "background_color", message: '"background_color" must be a CSS color string' });
2407
+ } else if (m.background_color === void 0) {
2408
+ issues.push({ severity: "warning", path: "background_color", message: 'Missing "background_color"; without it the splash screen background defaults to white' });
2409
+ }
2410
+ const valid = !issues.some((i) => i.severity === "error");
2411
+ return {
2412
+ issues,
2413
+ valid,
2414
+ summary: {
2415
+ name: typeof m.name === "string" ? m.name : void 0,
2416
+ shortName: typeof m.short_name === "string" ? m.short_name : void 0,
2417
+ startUrl: typeof m.start_url === "string" ? m.start_url : void 0,
2418
+ display: typeof m.display === "string" ? m.display : void 0,
2419
+ icons,
2420
+ hasMaskableIcon,
2421
+ has512Icon
2422
+ }
2423
+ };
2424
+ }
2319
2425
 
2320
2426
  exports.DNS_RECORD_TYPES = DNS_RECORD_TYPES;
2321
2427
  exports.HTTP_HEADERS = HTTP_HEADERS;
@@ -2360,5 +2466,6 @@ exports.typeNumberToLabel = typeNumberToLabel;
2360
2466
  exports.validateDomain = validateDomain;
2361
2467
  exports.validateHeaderName = validateHeaderName;
2362
2468
  exports.validateHeaderValue = validateHeaderValue;
2469
+ exports.validateManifest = validateManifest;
2363
2470
  exports.validateRobotsTxt = validateRobotsTxt;
2364
2471
  exports.validateSitemap = validateSitemap;
@@ -1 +1 @@
1
- export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as ContentRangeResult, d as CookieAttributes, e as CookieCheckResult, D as DNS_RECORD_TYPES, f as DnsRecord, g as DnsRecordType, h as DnsResponse, E as EmailHeaderAnalysis, i as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, j as HarEntry, k as HarParseResult, l as HarSummary, m as HeaderCategory, o as HttpHeader, I as Ipv6AddressType, p as Ipv6ParseResult, L as LINK_REL_VALUES, q as LinkHeaderEntry, r as LinkHeaderEntryInput, s as LinkHeaderResult, t as LinkRel, P as ParsedDnsResult, u as ParsedGeoResult, R as REFERRER_POLICY_VALUES, v as RangeEntry, w as RangeEntryInput, x as RangeHeaderResult, y as ReceivedHop, z as ReferrerPolicyEntry, F as ReferrerPolicyResult, J as ReferrerPolicyValue, K as RobotsGroup, M as RobotsIssue, N as RobotsRule, O as RobotsValidationResult, S as STATUS_CODES, Q as SameSiteValue, T as SitemapIndexEntry, U as SitemapIssue, V as SitemapUrlEntry, W as SitemapValidationResult, X as StatusCode, Y as UaDeviceType, Z as UserAgentInfo, _ as VaryHeaderEntry, $ as VaryHeaderResult, a0 as analyzeEmailHeaders, a1 as buildCacheControl, a2 as buildDnsQueryUrl, a3 as buildGeoUrl, a4 as buildLinkHeader, a5 as buildMapUrl, a6 as buildRangeHeader, a7 as buildReferrerPolicy, a8 as buildVaryHeader, a9 as checkSetCookieHeader, aa as countryCodeToFlag, ab as formatCoordinates, ac as formatTtl, ad as getByCategory, ae as getHeader, af as getHeadersByCategory, ag as getStatusByCategory, ah as getStatusCode, ai as isClientError, aj as isServerError, ak as isSuccess, al as isValidIp, am as isValidIpv4, an as isValidIpv6, ao as parseContentRangeHeader, ap as parseDnsResponse, aq as parseGeoResponse, ar as parseHar, as as parseIpv6Address, at as parseUserAgent, au as parseVaryHeader, av as searchHeaders, aw as searchStatusCodes, ax as statusCodeToText, ay as typeNumberToLabel, az as validateDomain, aA as validateHeaderName, aB as validateHeaderValue, aC as validateRobotsTxt, aD as validateSitemap } from '../network-oAs83Ztn.cjs';
1
+ export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as ContentRangeResult, d as CookieAttributes, e as CookieCheckResult, D as DNS_RECORD_TYPES, f as DnsRecord, g as DnsRecordType, h as DnsResponse, E as EmailHeaderAnalysis, i as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, j as HarEntry, k as HarParseResult, l as HarSummary, m as HeaderCategory, o as HttpHeader, I as Ipv6AddressType, p as Ipv6ParseResult, L as LINK_REL_VALUES, q as LinkHeaderEntry, r as LinkHeaderEntryInput, s as LinkHeaderResult, t as LinkRel, M as ManifestIconInfo, u as ManifestIssue, v as ManifestValidationResult, P as ParsedDnsResult, w as ParsedGeoResult, R as REFERRER_POLICY_VALUES, x as RangeEntry, y as RangeEntryInput, z as RangeHeaderResult, F as ReceivedHop, J as ReferrerPolicyEntry, K as ReferrerPolicyResult, N as ReferrerPolicyValue, O as RobotsGroup, Q as RobotsIssue, S as RobotsRule, T as RobotsValidationResult, U as STATUS_CODES, V as SameSiteValue, W as SitemapIndexEntry, X as SitemapIssue, Y as SitemapUrlEntry, Z as SitemapValidationResult, _ as StatusCode, $ as UaDeviceType, a0 as UserAgentInfo, a1 as VaryHeaderEntry, a2 as VaryHeaderResult, a3 as analyzeEmailHeaders, a4 as buildCacheControl, a5 as buildDnsQueryUrl, a6 as buildGeoUrl, a7 as buildLinkHeader, a8 as buildMapUrl, a9 as buildRangeHeader, aa as buildReferrerPolicy, ab as buildVaryHeader, ac as checkSetCookieHeader, ad as countryCodeToFlag, ae as formatCoordinates, af as formatTtl, ag as getByCategory, ah as getHeader, ai as getHeadersByCategory, aj as getStatusByCategory, ak as getStatusCode, al as isClientError, am as isServerError, an as isSuccess, ao as isValidIp, ap as isValidIpv4, aq as isValidIpv6, ar as parseContentRangeHeader, as as parseDnsResponse, at as parseGeoResponse, au as parseHar, av as parseIpv6Address, aw as parseUserAgent, ax as parseVaryHeader, ay as searchHeaders, az as searchStatusCodes, aA as statusCodeToText, aB as typeNumberToLabel, aC as validateDomain, aD as validateHeaderName, aE as validateHeaderValue, aF as validateManifest, aG as validateRobotsTxt, aH as validateSitemap } from '../network-DISiPMoK.cjs';
@@ -1 +1 @@
1
- export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as ContentRangeResult, d as CookieAttributes, e as CookieCheckResult, D as DNS_RECORD_TYPES, f as DnsRecord, g as DnsRecordType, h as DnsResponse, E as EmailHeaderAnalysis, i as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, j as HarEntry, k as HarParseResult, l as HarSummary, m as HeaderCategory, o as HttpHeader, I as Ipv6AddressType, p as Ipv6ParseResult, L as LINK_REL_VALUES, q as LinkHeaderEntry, r as LinkHeaderEntryInput, s as LinkHeaderResult, t as LinkRel, P as ParsedDnsResult, u as ParsedGeoResult, R as REFERRER_POLICY_VALUES, v as RangeEntry, w as RangeEntryInput, x as RangeHeaderResult, y as ReceivedHop, z as ReferrerPolicyEntry, F as ReferrerPolicyResult, J as ReferrerPolicyValue, K as RobotsGroup, M as RobotsIssue, N as RobotsRule, O as RobotsValidationResult, S as STATUS_CODES, Q as SameSiteValue, T as SitemapIndexEntry, U as SitemapIssue, V as SitemapUrlEntry, W as SitemapValidationResult, X as StatusCode, Y as UaDeviceType, Z as UserAgentInfo, _ as VaryHeaderEntry, $ as VaryHeaderResult, a0 as analyzeEmailHeaders, a1 as buildCacheControl, a2 as buildDnsQueryUrl, a3 as buildGeoUrl, a4 as buildLinkHeader, a5 as buildMapUrl, a6 as buildRangeHeader, a7 as buildReferrerPolicy, a8 as buildVaryHeader, a9 as checkSetCookieHeader, aa as countryCodeToFlag, ab as formatCoordinates, ac as formatTtl, ad as getByCategory, ae as getHeader, af as getHeadersByCategory, ag as getStatusByCategory, ah as getStatusCode, ai as isClientError, aj as isServerError, ak as isSuccess, al as isValidIp, am as isValidIpv4, an as isValidIpv6, ao as parseContentRangeHeader, ap as parseDnsResponse, aq as parseGeoResponse, ar as parseHar, as as parseIpv6Address, at as parseUserAgent, au as parseVaryHeader, av as searchHeaders, aw as searchStatusCodes, ax as statusCodeToText, ay as typeNumberToLabel, az as validateDomain, aA as validateHeaderName, aB as validateHeaderValue, aC as validateRobotsTxt, aD as validateSitemap } from '../network-oAs83Ztn.js';
1
+ export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, c as ContentRangeResult, d as CookieAttributes, e as CookieCheckResult, D as DNS_RECORD_TYPES, f as DnsRecord, g as DnsRecordType, h as DnsResponse, E as EmailHeaderAnalysis, i as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, j as HarEntry, k as HarParseResult, l as HarSummary, m as HeaderCategory, o as HttpHeader, I as Ipv6AddressType, p as Ipv6ParseResult, L as LINK_REL_VALUES, q as LinkHeaderEntry, r as LinkHeaderEntryInput, s as LinkHeaderResult, t as LinkRel, M as ManifestIconInfo, u as ManifestIssue, v as ManifestValidationResult, P as ParsedDnsResult, w as ParsedGeoResult, R as REFERRER_POLICY_VALUES, x as RangeEntry, y as RangeEntryInput, z as RangeHeaderResult, F as ReceivedHop, J as ReferrerPolicyEntry, K as ReferrerPolicyResult, N as ReferrerPolicyValue, O as RobotsGroup, Q as RobotsIssue, S as RobotsRule, T as RobotsValidationResult, U as STATUS_CODES, V as SameSiteValue, W as SitemapIndexEntry, X as SitemapIssue, Y as SitemapUrlEntry, Z as SitemapValidationResult, _ as StatusCode, $ as UaDeviceType, a0 as UserAgentInfo, a1 as VaryHeaderEntry, a2 as VaryHeaderResult, a3 as analyzeEmailHeaders, a4 as buildCacheControl, a5 as buildDnsQueryUrl, a6 as buildGeoUrl, a7 as buildLinkHeader, a8 as buildMapUrl, a9 as buildRangeHeader, aa as buildReferrerPolicy, ab as buildVaryHeader, ac as checkSetCookieHeader, ad as countryCodeToFlag, ae as formatCoordinates, af as formatTtl, ag as getByCategory, ah as getHeader, ai as getHeadersByCategory, aj as getStatusByCategory, ak as getStatusCode, al as isClientError, am as isServerError, an as isSuccess, ao as isValidIp, ap as isValidIpv4, aq as isValidIpv6, ar as parseContentRangeHeader, as as parseDnsResponse, at as parseGeoResponse, au as parseHar, av as parseIpv6Address, aw as parseUserAgent, ax as parseVaryHeader, ay as searchHeaders, az as searchStatusCodes, aA as statusCodeToText, aB as typeNumberToLabel, aC as validateDomain, aD as validateHeaderName, aE as validateHeaderValue, aF as validateManifest, aG as validateRobotsTxt, aH as validateSitemap } from '../network-DISiPMoK.js';
@@ -1,2 +1,2 @@
1
- export { DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap } from '../chunk-UD45LBG7.js';
1
+ export { DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap } from '../chunk-XPNZYPM5.js';
2
2
  import '../chunk-MLKGABMK.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utilix-tech/sdk",
3
- "version": "0.42.0",
3
+ "version": "0.43.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",