@utilix-tech/sdk 0.56.0 → 0.59.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +30 -9
  3. package/dist/{chunk-WVEKRKGU.js → chunk-34C6GXCC.js} +34 -1
  4. package/dist/{chunk-TVSQ53TZ.js → chunk-3QU46YFP.js} +100 -1
  5. package/dist/{chunk-3TYWIX3B.js → chunk-422ICOZX.js} +16 -1
  6. package/dist/{chunk-56VFNHVO.js → chunk-QY2M2UHJ.js} +34 -1
  7. package/dist/{data-Cvyg8ZXo.d.cts → data-vxXrBlWh.d.cts} +22 -2
  8. package/dist/{data-Cvyg8ZXo.d.ts → data-vxXrBlWh.d.ts} +22 -2
  9. package/dist/{generators-Du8cBesn.d.cts → generators-DAXXrMvG.d.cts} +23 -2
  10. package/dist/{generators-Du8cBesn.d.ts → generators-DAXXrMvG.d.ts} +23 -2
  11. package/dist/index.cjs +180 -0
  12. package/dist/index.d.cts +4 -4
  13. package/dist/index.d.ts +4 -4
  14. package/dist/index.js +4 -4
  15. package/dist/{json-Ta9JykSB.d.ts → json-CaiYsGDQ.d.cts} +24 -2
  16. package/dist/{json-Ta9JykSB.d.cts → json-CaiYsGDQ.d.ts} +24 -2
  17. package/dist/{network-CoGf7_Op.d.ts → network-fDfM1_L6.d.cts} +45 -2
  18. package/dist/{network-CoGf7_Op.d.cts → network-fDfM1_L6.d.ts} +45 -2
  19. package/dist/tools/data.cjs +33 -0
  20. package/dist/tools/data.d.cts +1 -1
  21. package/dist/tools/data.d.ts +1 -1
  22. package/dist/tools/data.js +1 -1
  23. package/dist/tools/generators.cjs +15 -0
  24. package/dist/tools/generators.d.cts +1 -1
  25. package/dist/tools/generators.d.ts +1 -1
  26. package/dist/tools/generators.js +1 -1
  27. package/dist/tools/json.cjs +33 -0
  28. package/dist/tools/json.d.cts +1 -1
  29. package/dist/tools/json.d.ts +1 -1
  30. package/dist/tools/json.js +1 -1
  31. package/dist/tools/network.cjs +99 -0
  32. package/dist/tools/network.d.cts +1 -1
  33. package/dist/tools/network.d.ts +1 -1
  34. package/dist/tools/network.js +1 -1
  35. package/package.json +1 -1
@@ -10,6 +10,7 @@
10
10
  * - password-entropy-estimator : estimatePasswordEntropy
11
11
  * - random-data : generateSingle, generateData
12
12
  * - qr-code : generateQrSvg, generateQrDataUrl
13
+ * - csp-nonce-generator : generateCspNonce
13
14
  */
14
15
  type UuidVersion = 'v4' | 'v7';
15
16
  interface GeneratedUuid {
@@ -117,8 +118,27 @@ interface QrOptions {
117
118
  declare const DEFAULT_QR_OPTIONS: QrOptions;
118
119
  declare function generateQrSvg(text: string, options?: QrOptions): Promise<string>;
119
120
  declare function generateQrDataUrl(text: string, options?: QrOptions): Promise<string>;
121
+ interface CspNonceResult {
122
+ nonce: string;
123
+ byteLength: number;
124
+ scriptSrcDirective: string;
125
+ styleSrcDirective: string;
126
+ scriptTag: string;
127
+ styleTag: string;
128
+ }
129
+ /**
130
+ * Generate a cryptographically random, base64-encoded nonce for a
131
+ * Content-Security-Policy script-src/style-src directive, along with
132
+ * ready-to-paste header directive and <script>/<style nonce="..."> tag
133
+ * snippets. Generates a fresh value on every call; the same value must be
134
+ * reused for both the header and the markup within a single request.
135
+ */
136
+ declare function generateCspNonce(byteLength?: number): CspNonceResult | {
137
+ error: string;
138
+ };
120
139
 
121
140
  declare const generators_AMBIGUOUS_CHARS: typeof AMBIGUOUS_CHARS;
141
+ type generators_CspNonceResult = CspNonceResult;
122
142
  declare const generators_DATA_TYPES: typeof DATA_TYPES;
123
143
  declare const generators_DEFAULT_OPTIONS: typeof DEFAULT_OPTIONS;
124
144
  declare const generators_DEFAULT_QR_OPTIONS: typeof DEFAULT_QR_OPTIONS;
@@ -141,6 +161,7 @@ declare const generators_estimatePasswordEntropy: typeof estimatePasswordEntropy
141
161
  declare const generators_generateBulk: typeof generateBulk;
142
162
  declare const generators_generateBulkPasswords: typeof generateBulkPasswords;
143
163
  declare const generators_generateBulkUlids: typeof generateBulkUlids;
164
+ declare const generators_generateCspNonce: typeof generateCspNonce;
144
165
  declare const generators_generateData: typeof generateData;
145
166
  declare const generators_generatePassword: typeof generatePassword;
146
167
  declare const generators_generateQrDataUrl: typeof generateQrDataUrl;
@@ -155,7 +176,7 @@ declare const generators_isValidUuid: typeof isValidUuid;
155
176
  declare const generators_parseUlid: typeof parseUlid;
156
177
  declare const generators_parseUuidVersion: typeof parseUuidVersion;
157
178
  declare namespace generators {
158
- export { generators_AMBIGUOUS_CHARS as AMBIGUOUS_CHARS, generators_DATA_TYPES as DATA_TYPES, generators_DEFAULT_OPTIONS as DEFAULT_OPTIONS, generators_DEFAULT_QR_OPTIONS as DEFAULT_QR_OPTIONS, type generators_DataType as DataType, type generators_GeneratedUuid as GeneratedUuid, type generators_PasswordCharsetInfo as PasswordCharsetInfo, type generators_PasswordCrackTimeEstimate as PasswordCrackTimeEstimate, type generators_PasswordEntropyResult as PasswordEntropyResult, type generators_PasswordEntropyStrength as PasswordEntropyStrength, type generators_PasswordOptions as PasswordOptions, type generators_QrErrorLevel as QrErrorLevel, type generators_QrOptions as QrOptions, type generators_QrOutputFormat as QrOutputFormat, type generators_RandomConfig as RandomConfig, generators_SYMBOL_CHARS as SYMBOL_CHARS, generators_ULID_REGEX as ULID_REGEX, type generators_UuidVersion as UuidVersion, generators_checkStrength as checkStrength, generators_estimatePasswordEntropy as estimatePasswordEntropy, generators_generateBulk as generateBulk, generators_generateBulkPasswords as generateBulkPasswords, generators_generateBulkUlids as generateBulkUlids, generators_generateData as generateData, generators_generatePassword as generatePassword, generators_generateQrDataUrl as generateQrDataUrl, generators_generateQrSvg as generateQrSvg, generators_generateSingle as generateSingle, generators_generateUlid as generateUlid, generators_generateUuid as generateUuid, generators_generateV4 as generateV4, generators_generateV7 as generateV7, generators_isValidUlid as isValidUlid, generators_isValidUuid as isValidUuid, generators_parseUlid as parseUlid, generators_parseUuidVersion as parseUuidVersion };
179
+ export { generators_AMBIGUOUS_CHARS as AMBIGUOUS_CHARS, type generators_CspNonceResult as CspNonceResult, generators_DATA_TYPES as DATA_TYPES, generators_DEFAULT_OPTIONS as DEFAULT_OPTIONS, generators_DEFAULT_QR_OPTIONS as DEFAULT_QR_OPTIONS, type generators_DataType as DataType, type generators_GeneratedUuid as GeneratedUuid, type generators_PasswordCharsetInfo as PasswordCharsetInfo, type generators_PasswordCrackTimeEstimate as PasswordCrackTimeEstimate, type generators_PasswordEntropyResult as PasswordEntropyResult, type generators_PasswordEntropyStrength as PasswordEntropyStrength, type generators_PasswordOptions as PasswordOptions, type generators_QrErrorLevel as QrErrorLevel, type generators_QrOptions as QrOptions, type generators_QrOutputFormat as QrOutputFormat, type generators_RandomConfig as RandomConfig, generators_SYMBOL_CHARS as SYMBOL_CHARS, generators_ULID_REGEX as ULID_REGEX, type generators_UuidVersion as UuidVersion, generators_checkStrength as checkStrength, generators_estimatePasswordEntropy as estimatePasswordEntropy, generators_generateBulk as generateBulk, generators_generateBulkPasswords as generateBulkPasswords, generators_generateBulkUlids as generateBulkUlids, generators_generateCspNonce as generateCspNonce, generators_generateData as generateData, generators_generatePassword as generatePassword, generators_generateQrDataUrl as generateQrDataUrl, generators_generateQrSvg as generateQrSvg, generators_generateSingle as generateSingle, generators_generateUlid as generateUlid, generators_generateUuid as generateUuid, generators_generateV4 as generateV4, generators_generateV7 as generateV7, generators_isValidUlid as isValidUlid, generators_isValidUuid as isValidUuid, generators_parseUlid as parseUlid, generators_parseUuidVersion as parseUuidVersion };
159
180
  }
160
181
 
161
- export { AMBIGUOUS_CHARS as A, isValidUuid as B, parseUlid as C, DATA_TYPES as D, parseUuidVersion as E, type GeneratedUuid as G, type PasswordCharsetInfo as P, type QrErrorLevel as Q, type RandomConfig as R, SYMBOL_CHARS as S, ULID_REGEX as U, DEFAULT_OPTIONS as a, DEFAULT_QR_OPTIONS as b, type DataType as c, type PasswordCrackTimeEstimate as d, type PasswordEntropyResult as e, type PasswordEntropyStrength as f, generators as g, type PasswordOptions as h, type QrOptions as i, type QrOutputFormat as j, type UuidVersion as k, checkStrength as l, estimatePasswordEntropy as m, generateBulk as n, generateBulkPasswords as o, generateBulkUlids as p, generateData as q, generatePassword as r, generateQrDataUrl as s, generateQrSvg as t, generateSingle as u, generateUlid as v, generateUuid as w, generateV4 as x, generateV7 as y, isValidUlid as z };
182
+ export { AMBIGUOUS_CHARS as A, isValidUlid as B, type CspNonceResult as C, DATA_TYPES as D, isValidUuid as E, parseUlid as F, type GeneratedUuid as G, parseUuidVersion as H, type PasswordCharsetInfo as P, type QrErrorLevel as Q, type RandomConfig as R, SYMBOL_CHARS as S, ULID_REGEX as U, DEFAULT_OPTIONS as a, DEFAULT_QR_OPTIONS as b, type DataType as c, type PasswordCrackTimeEstimate as d, type PasswordEntropyResult as e, type PasswordEntropyStrength as f, generators as g, type PasswordOptions as h, type QrOptions as i, type QrOutputFormat as j, type UuidVersion as k, checkStrength as l, estimatePasswordEntropy as m, generateBulk as n, generateBulkPasswords as o, generateBulkUlids as p, generateCspNonce as q, generateData as r, generatePassword as s, generateQrDataUrl as t, generateQrSvg as u, generateSingle as v, generateUlid as w, generateUuid as x, generateV4 as y, generateV7 as z };
package/dist/index.cjs CHANGED
@@ -42,6 +42,7 @@ var __export = (target, all) => {
42
42
  // src/tools/json.ts
43
43
  var json_exports = {};
44
44
  __export(json_exports, {
45
+ applyJsonMergePatch: () => applyJsonMergePatch,
45
46
  csvToJson: () => csvToJson,
46
47
  detectFormat: () => detectFormat,
47
48
  diffJson: () => diffJson,
@@ -60,6 +61,7 @@ __export(json_exports, {
60
61
  jsonToTypescript: () => jsonToTypescript,
61
62
  jsonToYaml: () => jsonToYaml,
62
63
  jsonToZod: () => jsonToZod,
64
+ mergeJsonPatch: () => mergeJsonPatch,
63
65
  minifyJson: () => minifyJson,
64
66
  parseJson: () => parseJson,
65
67
  parseStructs: () => parseStructs,
@@ -1440,6 +1442,37 @@ function jsonSchemaToTypescript(schemaJson, options) {
1440
1442
  }
1441
1443
  return parts.join("\n\n");
1442
1444
  }
1445
+ function _isMergePatchObject(value) {
1446
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1447
+ }
1448
+ function mergeJsonPatch(target, patch) {
1449
+ if (!_isMergePatchObject(patch)) return patch;
1450
+ const result = _isMergePatchObject(target) ? { ...target } : {};
1451
+ for (const key of Object.keys(patch)) {
1452
+ const value = patch[key];
1453
+ if (value === null) {
1454
+ delete result[key];
1455
+ } else {
1456
+ result[key] = mergeJsonPatch(result[key], value);
1457
+ }
1458
+ }
1459
+ return result;
1460
+ }
1461
+ function applyJsonMergePatch(targetJson, patchJson) {
1462
+ let target;
1463
+ try {
1464
+ target = JSON.parse(targetJson);
1465
+ } catch {
1466
+ return { error: "Target is not valid JSON" };
1467
+ }
1468
+ let patch;
1469
+ try {
1470
+ patch = JSON.parse(patchJson);
1471
+ } catch {
1472
+ return { error: "Patch is not valid JSON" };
1473
+ }
1474
+ return { result: mergeJsonPatch(target, patch) };
1475
+ }
1443
1476
 
1444
1477
  // src/tools/encoding.ts
1445
1478
  var encoding_exports = {};
@@ -5156,6 +5189,7 @@ __export(data_exports, {
5156
5189
  convertSubtitles: () => convertSubtitles,
5157
5190
  csvToJson: () => csvToJson2,
5158
5191
  csvToSqlInsert: () => csvToSqlInsert,
5192
+ dedupeNdjson: () => dedupeNdjson,
5159
5193
  detectDelimiter: () => detectDelimiter2,
5160
5194
  detectSubtitleFormat: () => detectSubtitleFormat,
5161
5195
  diffEnvExample: () => diffEnvExample,
@@ -6318,6 +6352,38 @@ function jsonArrayToNdjson(input) {
6318
6352
  if (!Array.isArray(parsed)) return { error: "Input must be a JSON array" };
6319
6353
  return parsed.map((item) => JSON.stringify(item)).join("\n");
6320
6354
  }
6355
+ function dedupeNdjson(input, keyField) {
6356
+ const validated = validateNdjson(input);
6357
+ if (!validated.valid) return { error: _firstNdjsonError(validated) };
6358
+ const seen = /* @__PURE__ */ new Set();
6359
+ const keptRaw = [];
6360
+ const removedLines = [];
6361
+ for (const l of validated.lines) {
6362
+ const parsed = JSON.parse(l.raw);
6363
+ let key;
6364
+ if (keyField) {
6365
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed) || !(keyField in parsed)) {
6366
+ return { error: `Line ${l.line}: missing key field "${keyField}"` };
6367
+ }
6368
+ key = JSON.stringify(parsed[keyField]);
6369
+ } else {
6370
+ key = JSON.stringify(parsed);
6371
+ }
6372
+ if (seen.has(key)) {
6373
+ removedLines.push(l.line);
6374
+ } else {
6375
+ seen.add(key);
6376
+ keptRaw.push(l.raw.trim());
6377
+ }
6378
+ }
6379
+ return {
6380
+ totalLines: validated.totalLines,
6381
+ uniqueLines: keptRaw.length,
6382
+ duplicatesRemoved: removedLines.length,
6383
+ output: keptRaw.join("\n"),
6384
+ removedLines
6385
+ };
6386
+ }
6321
6387
  var _SUBTITLE_TIMESTAMP_RE = /(\d+):(\d{1,2}):(\d{1,2})[.,](\d{1,3})|(\d{1,3}):(\d{1,2})[.,](\d{1,3})/;
6322
6388
  var _VTT_BLOCK_KEYWORDS = ["NOTE", "STYLE", "REGION"];
6323
6389
  function parseSubtitleTimestamp(raw) {
@@ -6935,6 +7001,7 @@ __export(generators_exports, {
6935
7001
  generateBulk: () => generateBulk,
6936
7002
  generateBulkPasswords: () => generateBulkPasswords,
6937
7003
  generateBulkUlids: () => generateBulkUlids,
7004
+ generateCspNonce: () => generateCspNonce,
6938
7005
  generateData: () => generateData,
6939
7006
  generatePassword: () => generatePassword,
6940
7007
  generateQrDataUrl: () => generateQrDataUrl,
@@ -7541,6 +7608,20 @@ async function generateQrDataUrl(text, options) {
7541
7608
  }
7542
7609
  });
7543
7610
  }
7611
+ function generateCspNonce(byteLength = 16) {
7612
+ if (!Number.isInteger(byteLength) || byteLength < 8 || byteLength > 64) {
7613
+ return { error: "Byte length must be a whole number between 8 and 64" };
7614
+ }
7615
+ const nonce = crypto.randomBytes(byteLength).toString("base64");
7616
+ return {
7617
+ nonce,
7618
+ byteLength,
7619
+ scriptSrcDirective: `script-src 'nonce-${nonce}'`,
7620
+ styleSrcDirective: `style-src 'nonce-${nonce}'`,
7621
+ scriptTag: `<script nonce="${nonce}">`,
7622
+ styleTag: `<style nonce="${nonce}">`
7623
+ };
7624
+ }
7544
7625
 
7545
7626
  // src/tools/time.ts
7546
7627
  var time_exports = {};
@@ -10651,6 +10732,7 @@ __export(network_exports, {
10651
10732
  buildLinkHeader: () => buildLinkHeader,
10652
10733
  buildMapUrl: () => buildMapUrl,
10653
10734
  buildPermissionsPolicy: () => buildPermissionsPolicy,
10735
+ buildPreferHeader: () => buildPreferHeader,
10654
10736
  buildRangeHeader: () => buildRangeHeader,
10655
10737
  buildReferrerPolicy: () => buildReferrerPolicy,
10656
10738
  buildVaryHeader: () => buildVaryHeader,
@@ -10679,6 +10761,7 @@ __export(network_exports, {
10679
10761
  parseHar: () => parseHar,
10680
10762
  parseIpv6Address: () => parseIpv6Address,
10681
10763
  parsePermissionsPolicy: () => parsePermissionsPolicy,
10764
+ parsePreferHeader: () => parsePreferHeader,
10682
10765
  parseUserAgent: () => parseUserAgent,
10683
10766
  parseVaryHeader: () => parseVaryHeader,
10684
10767
  parseXContentTypeOptionsHeader: () => parseXContentTypeOptionsHeader,
@@ -13515,6 +13598,103 @@ function parseAcceptLanguage(raw) {
13515
13598
  const headerValue = formatAcceptLanguageEntries(sorted);
13516
13599
  return { header: `Accept-Language: ${headerValue}`, headerValue, entries: sorted };
13517
13600
  }
13601
+ var PREFER_TOKEN_RE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
13602
+ function isPreferToken(s) {
13603
+ return PREFER_TOKEN_RE.test(s);
13604
+ }
13605
+ function splitPreferTopLevel(input, delim) {
13606
+ const parts = [];
13607
+ let current = "";
13608
+ let inQuotes = false;
13609
+ for (const ch of input) {
13610
+ if (ch === '"') inQuotes = !inQuotes;
13611
+ if (ch === delim && !inQuotes) {
13612
+ parts.push(current);
13613
+ current = "";
13614
+ } else {
13615
+ current += ch;
13616
+ }
13617
+ }
13618
+ parts.push(current);
13619
+ return parts;
13620
+ }
13621
+ function parsePreferTokenValue(part) {
13622
+ const trimmed = part.trim();
13623
+ if (!trimmed) return null;
13624
+ const eq = trimmed.indexOf("=");
13625
+ if (eq === -1) return { token: trimmed };
13626
+ const token = trimmed.slice(0, eq).trim();
13627
+ let value = trimmed.slice(eq + 1).trim();
13628
+ if (value.length >= 2 && value.startsWith('"') && value.endsWith('"')) {
13629
+ value = value.slice(1, -1);
13630
+ }
13631
+ return { token, value };
13632
+ }
13633
+ function formatPreferWord(value) {
13634
+ return isPreferToken(value) ? value : `"${value.replace(/"/g, '\\"')}"`;
13635
+ }
13636
+ function formatPreferPreferences(preferences) {
13637
+ return preferences.map((p) => {
13638
+ let s = p.token;
13639
+ if (p.value !== void 0) s += `=${formatPreferWord(p.value)}`;
13640
+ for (const param of p.params ?? []) {
13641
+ s += `;${param.name}`;
13642
+ if (param.value !== void 0) s += `=${formatPreferWord(param.value)}`;
13643
+ }
13644
+ return s;
13645
+ }).join(", ");
13646
+ }
13647
+ function buildPreferHeader(preferences) {
13648
+ if (!Array.isArray(preferences) || preferences.length === 0) {
13649
+ return { error: "At least one preference is required" };
13650
+ }
13651
+ const built = [];
13652
+ for (let i = 0; i < preferences.length; i++) {
13653
+ const { token, value, params } = preferences[i];
13654
+ if (typeof token !== "string" || !isPreferToken(token.trim())) {
13655
+ return { error: `preference ${i + 1}: token is required and must be a valid HTTP token` };
13656
+ }
13657
+ const cleanParams = [];
13658
+ if (params !== void 0) {
13659
+ if (!Array.isArray(params)) return { error: `preference ${i + 1}: params must be an array` };
13660
+ for (const param of params) {
13661
+ if (typeof param?.name !== "string" || !isPreferToken(param.name.trim())) {
13662
+ return { error: `preference ${i + 1}: parameter name is required and must be a valid HTTP token` };
13663
+ }
13664
+ cleanParams.push({ name: param.name.trim(), value: param.value !== void 0 ? String(param.value) : void 0 });
13665
+ }
13666
+ }
13667
+ built.push({
13668
+ token: token.trim(),
13669
+ value: value !== void 0 ? String(value) : void 0,
13670
+ params: cleanParams.length > 0 ? cleanParams : void 0
13671
+ });
13672
+ }
13673
+ const headerValue = formatPreferPreferences(built);
13674
+ return { header: `Prefer: ${headerValue}`, headerValue, preferences: built };
13675
+ }
13676
+ function parsePreferHeader(raw) {
13677
+ if (!raw || raw.trim() === "") return { error: "Input is empty" };
13678
+ const withoutLabel = raw.trim().replace(/^prefer:\s*/i, "");
13679
+ const parts = splitPreferTopLevel(withoutLabel, ",").map((p) => p.trim()).filter((p) => p.length > 0);
13680
+ if (parts.length === 0) return { error: "Input is empty" };
13681
+ const preferences = [];
13682
+ for (const part of parts) {
13683
+ const segments = splitPreferTopLevel(part, ";").map((s) => s.trim()).filter((s) => s.length > 0);
13684
+ if (segments.length === 0) return { error: `Invalid preference: "${part}"` };
13685
+ const main = parsePreferTokenValue(segments[0]);
13686
+ if (!main || !isPreferToken(main.token)) return { error: `Invalid preference token in "${part}"` };
13687
+ const params = [];
13688
+ for (const seg of segments.slice(1)) {
13689
+ const p = parsePreferTokenValue(seg);
13690
+ if (!p || !isPreferToken(p.token)) return { error: `Invalid parameter in "${part}"` };
13691
+ params.push({ name: p.token, value: p.value });
13692
+ }
13693
+ preferences.push({ token: main.token, value: main.value, params: params.length > 0 ? params : void 0 });
13694
+ }
13695
+ const headerValue = formatPreferPreferences(preferences);
13696
+ return { header: `Prefer: ${headerValue}`, headerValue, preferences };
13697
+ }
13518
13698
 
13519
13699
  // src/tools/api.ts
13520
13700
  var api_exports = {};
package/dist/index.d.cts CHANGED
@@ -1,12 +1,12 @@
1
- export { j as json } from './json-Ta9JykSB.cjs';
1
+ export { j as json } from './json-CaiYsGDQ.cjs';
2
2
  export { e as encoding } from './encoding-Dk3wpmb3.cjs';
3
3
  export { h as hashing } from './hashing-CJjlvqS_.cjs';
4
4
  export { t as text } from './text-DWUcY8H1.cjs';
5
- export { d as data } from './data-Cvyg8ZXo.cjs';
6
- export { g as generators } from './generators-Du8cBesn.cjs';
5
+ export { d as data } from './data-vxXrBlWh.cjs';
6
+ export { g as generators } from './generators-DAXXrMvG.cjs';
7
7
  export { t as time } from './time-KqJjdqII.cjs';
8
8
  export { u as units } from './units-BM9GkUZW.cjs';
9
- export { n as network } from './network-CoGf7_Op.cjs';
9
+ export { n as network } from './network-fDfM1_L6.cjs';
10
10
  export { a as api } from './api-DmTNE4c1.cjs';
11
11
  export { c as code } from './code-rxidGgvB.cjs';
12
12
  export { c as color } from './color-tPwZCr9H.cjs';
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- export { j as json } from './json-Ta9JykSB.js';
1
+ export { j as json } from './json-CaiYsGDQ.js';
2
2
  export { e as encoding } from './encoding-Dk3wpmb3.js';
3
3
  export { h as hashing } from './hashing-CJjlvqS_.js';
4
4
  export { t as text } from './text-DWUcY8H1.js';
5
- export { d as data } from './data-Cvyg8ZXo.js';
6
- export { g as generators } from './generators-Du8cBesn.js';
5
+ export { d as data } from './data-vxXrBlWh.js';
6
+ export { g as generators } from './generators-DAXXrMvG.js';
7
7
  export { t as time } from './time-KqJjdqII.js';
8
8
  export { u as units } from './units-BM9GkUZW.js';
9
- export { n as network } from './network-CoGf7_Op.js';
9
+ export { n as network } from './network-fDfM1_L6.js';
10
10
  export { a as api } from './api-DmTNE4c1.js';
11
11
  export { c as code } from './code-rxidGgvB.js';
12
12
  export { c as color } from './color-tPwZCr9H.js';
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  export { media_exports as media } from './chunk-226EH3ZI.js';
2
2
  export { units_exports as units } from './chunk-MRIGQRTU.js';
3
- export { network_exports as network } from './chunk-TVSQ53TZ.js';
3
+ export { network_exports as network } from './chunk-3QU46YFP.js';
4
4
  export { api_exports as api } from './chunk-52ZDKSIX.js';
5
5
  export { code_exports as code } from './chunk-JW4NG2GN.js';
6
6
  export { color_exports as color } from './chunk-BPVAB4P2.js';
7
7
  export { css_exports as css } from './chunk-6YPV2AB5.js';
8
8
  export { misc_exports as misc } from './chunk-GX7H6TAX.js';
9
9
  export { ai_agent_exports as ai_agent } from './chunk-EKIXOA7B.js';
10
- export { json_exports as json } from './chunk-WVEKRKGU.js';
10
+ export { json_exports as json } from './chunk-34C6GXCC.js';
11
11
  export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
12
12
  export { hashing_exports as hashing } from './chunk-PET2CGTH.js';
13
13
  export { text_exports as text } from './chunk-P7TXG7CI.js';
14
- export { data_exports as data } from './chunk-56VFNHVO.js';
15
- export { generators_exports as generators } from './chunk-3TYWIX3B.js';
14
+ export { data_exports as data } from './chunk-QY2M2UHJ.js';
15
+ export { generators_exports as generators } from './chunk-422ICOZX.js';
16
16
  export { time_exports as time } from './chunk-IEPWZERQ.js';
17
17
  import './chunk-MLKGABMK.js';
18
18
 
@@ -14,6 +14,7 @@
14
14
  * - json-to-python : jsonToPython, toSnakeCase, inferPythonType
15
15
  * - json-to-zod : jsonToZod
16
16
  * - json-schema-to-typescript : jsonSchemaToTypescript
17
+ * - json-merge-patch : mergeJsonPatch, applyJsonMergePatch
17
18
  */
18
19
  type ParseStatus = 'idle' | 'valid' | 'error';
19
20
  interface JsonParseResult {
@@ -201,6 +202,24 @@ interface JsonSchemaToTsOptions {
201
202
  declare function jsonSchemaToTypescript(schemaJson: string, options?: JsonSchemaToTsOptions): string | {
202
203
  error: string;
203
204
  };
205
+ interface MergePatchResult {
206
+ result: unknown;
207
+ }
208
+ /**
209
+ * Apply an RFC 7396 JSON Merge Patch to a target value. A patch that is not
210
+ * itself a JSON object replaces the target wholesale (this is how arrays are
211
+ * replaced rather than merged element by element); a null-valued key in an
212
+ * object patch removes that key from the result.
213
+ */
214
+ declare function mergeJsonPatch(target: unknown, patch: unknown): unknown;
215
+ /**
216
+ * Apply an RFC 7396 JSON Merge Patch document to a target JSON document,
217
+ * both given as JSON strings, and return the merged result. Pure recursive
218
+ * merge, no external calls.
219
+ */
220
+ declare function applyJsonMergePatch(targetJson: string, patchJson: string): MergePatchResult | {
221
+ error: string;
222
+ };
204
223
 
205
224
  type json_ConvertOptions = ConvertOptions;
206
225
  type json_CsvOptions = CsvOptions;
@@ -214,6 +233,7 @@ type json_JsonPathResult = JsonPathResult;
214
233
  type json_JsonPointerResult = JsonPointerResult;
215
234
  type json_JsonSchemaLike = JsonSchemaLike;
216
235
  type json_JsonSchemaToTsOptions = JsonSchemaToTsOptions;
236
+ type json_MergePatchResult = MergePatchResult;
217
237
  type json_ParseStatus = ParseStatus;
218
238
  type json_PythonClass = PythonClass;
219
239
  type json_PythonField = PythonField;
@@ -221,6 +241,7 @@ type json_PythonMode = PythonMode;
221
241
  type json_ValidationError = ValidationError;
222
242
  type json_ValidationResult = ValidationResult;
223
243
  type json_ZodOptions = ZodOptions;
244
+ declare const json_applyJsonMergePatch: typeof applyJsonMergePatch;
224
245
  declare const json_csvToJson: typeof csvToJson;
225
246
  declare const json_detectFormat: typeof detectFormat;
226
247
  declare const json_diffJson: typeof diffJson;
@@ -239,6 +260,7 @@ declare const json_jsonToPython: typeof jsonToPython;
239
260
  declare const json_jsonToTypescript: typeof jsonToTypescript;
240
261
  declare const json_jsonToYaml: typeof jsonToYaml;
241
262
  declare const json_jsonToZod: typeof jsonToZod;
263
+ declare const json_mergeJsonPatch: typeof mergeJsonPatch;
242
264
  declare const json_minifyJson: typeof minifyJson;
243
265
  declare const json_parseJson: typeof parseJson;
244
266
  declare const json_parseStructs: typeof parseStructs;
@@ -250,7 +272,7 @@ declare const json_validateJsonPath: typeof validateJsonPath;
250
272
  declare const json_validateJsonString: typeof validateJsonString;
251
273
  declare const json_yamlToJson: typeof yamlToJson;
252
274
  declare namespace json {
253
- export { type json_ConvertOptions as ConvertOptions, type json_CsvOptions as CsvOptions, type json_DiffNode as DiffNode, type json_DiffType as DiffType, type json_GoField as GoField, type json_GoStruct as GoStruct, type json_JsonDiffResult as JsonDiffResult, type json_JsonParseResult as JsonParseResult, type json_JsonPathResult as JsonPathResult, type json_JsonPointerResult as JsonPointerResult, type json_JsonSchemaLike as JsonSchemaLike, type json_JsonSchemaToTsOptions as JsonSchemaToTsOptions, type json_ParseStatus as ParseStatus, type json_PythonClass as PythonClass, type json_PythonField as PythonField, type json_PythonMode as PythonMode, type json_ValidationError as ValidationError, type json_ValidationResult as ValidationResult, type json_ZodOptions as ZodOptions, json_csvToJson as csvToJson, json_detectFormat as detectFormat, json_diffJson as diffJson, json_evaluateJsonPath as evaluateJsonPath, json_formatDiffLine as formatDiffLine, json_formatJson as formatJson, json_generateExample as generateExample, json_getJsonStats as getJsonStats, json_inferGoType as inferGoType, json_inferPythonType as inferPythonType, json_inferType as inferType, json_jsonSchemaToTypescript as jsonSchemaToTypescript, json_jsonToCsv as jsonToCsv, json_jsonToGo as jsonToGo, json_jsonToPython as jsonToPython, json_jsonToTypescript as jsonToTypescript, json_jsonToYaml as jsonToYaml, json_jsonToZod as jsonToZod, json_minifyJson as minifyJson, json_parseJson as parseJson, json_parseStructs as parseStructs, json_resolveJsonPointer as resolveJsonPointer, json_toPascalCase as toPascalCase, json_toSnakeCase as toSnakeCase, json_validateJson as validateJson, json_validateJsonPath as validateJsonPath, json_validateJsonString as validateJsonString, json_yamlToJson as yamlToJson };
275
+ export { type json_ConvertOptions as ConvertOptions, type json_CsvOptions as CsvOptions, type json_DiffNode as DiffNode, type json_DiffType as DiffType, type json_GoField as GoField, type json_GoStruct as GoStruct, type json_JsonDiffResult as JsonDiffResult, type json_JsonParseResult as JsonParseResult, type json_JsonPathResult as JsonPathResult, type json_JsonPointerResult as JsonPointerResult, type json_JsonSchemaLike as JsonSchemaLike, type json_JsonSchemaToTsOptions as JsonSchemaToTsOptions, type json_MergePatchResult as MergePatchResult, type json_ParseStatus as ParseStatus, type json_PythonClass as PythonClass, type json_PythonField as PythonField, type json_PythonMode as PythonMode, type json_ValidationError as ValidationError, type json_ValidationResult as ValidationResult, type json_ZodOptions as ZodOptions, json_applyJsonMergePatch as applyJsonMergePatch, json_csvToJson as csvToJson, json_detectFormat as detectFormat, json_diffJson as diffJson, json_evaluateJsonPath as evaluateJsonPath, json_formatDiffLine as formatDiffLine, json_formatJson as formatJson, json_generateExample as generateExample, json_getJsonStats as getJsonStats, json_inferGoType as inferGoType, json_inferPythonType as inferPythonType, json_inferType as inferType, json_jsonSchemaToTypescript as jsonSchemaToTypescript, json_jsonToCsv as jsonToCsv, json_jsonToGo as jsonToGo, json_jsonToPython as jsonToPython, json_jsonToTypescript as jsonToTypescript, json_jsonToYaml as jsonToYaml, json_jsonToZod as jsonToZod, json_mergeJsonPatch as mergeJsonPatch, json_minifyJson as minifyJson, json_parseJson as parseJson, json_parseStructs as parseStructs, json_resolveJsonPointer as resolveJsonPointer, json_toPascalCase as toPascalCase, json_toSnakeCase as toSnakeCase, json_validateJson as validateJson, json_validateJsonPath as validateJsonPath, json_validateJsonString as validateJsonString, json_yamlToJson as yamlToJson };
254
276
  }
255
277
 
256
- export { jsonToGo as A, jsonToPython as B, type ConvertOptions as C, type DiffNode as D, jsonToTypescript as E, jsonToYaml as F, type GoField as G, jsonToZod as H, minifyJson as I, type JsonDiffResult as J, parseJson as K, parseStructs as L, resolveJsonPointer as M, toPascalCase as N, toSnakeCase as O, type ParseStatus as P, validateJson as Q, validateJsonPath as R, validateJsonString as S, yamlToJson as T, type ValidationError as V, type ZodOptions as Z, type CsvOptions as a, type DiffType as b, type GoStruct as c, type JsonParseResult as d, type JsonPathResult as e, type JsonPointerResult as f, type JsonSchemaLike as g, type JsonSchemaToTsOptions as h, type PythonClass as i, json as j, type PythonField as k, type PythonMode as l, type ValidationResult as m, csvToJson as n, detectFormat as o, diffJson as p, evaluateJsonPath as q, formatDiffLine as r, formatJson as s, generateExample as t, getJsonStats as u, inferGoType as v, inferPythonType as w, inferType as x, jsonSchemaToTypescript as y, jsonToCsv as z };
278
+ export { jsonToCsv as A, jsonToGo as B, type ConvertOptions as C, type DiffNode as D, jsonToPython as E, jsonToTypescript as F, type GoField as G, jsonToYaml as H, jsonToZod as I, type JsonDiffResult as J, mergeJsonPatch as K, minifyJson as L, type MergePatchResult as M, parseJson as N, parseStructs as O, type ParseStatus as P, resolveJsonPointer as Q, toPascalCase as R, toSnakeCase as S, validateJson as T, validateJsonPath as U, type ValidationError as V, validateJsonString as W, yamlToJson as X, type ZodOptions as Z, type CsvOptions as a, type DiffType as b, type GoStruct as c, type JsonParseResult as d, type JsonPathResult as e, type JsonPointerResult as f, type JsonSchemaLike as g, type JsonSchemaToTsOptions as h, type PythonClass as i, json as j, type PythonField as k, type PythonMode as l, type ValidationResult as m, applyJsonMergePatch as n, csvToJson as o, detectFormat as p, diffJson as q, evaluateJsonPath as r, formatDiffLine as s, formatJson as t, generateExample as u, getJsonStats as v, inferGoType as w, inferPythonType as x, inferType as y, jsonSchemaToTypescript as z };
@@ -14,6 +14,7 @@
14
14
  * - json-to-python : jsonToPython, toSnakeCase, inferPythonType
15
15
  * - json-to-zod : jsonToZod
16
16
  * - json-schema-to-typescript : jsonSchemaToTypescript
17
+ * - json-merge-patch : mergeJsonPatch, applyJsonMergePatch
17
18
  */
18
19
  type ParseStatus = 'idle' | 'valid' | 'error';
19
20
  interface JsonParseResult {
@@ -201,6 +202,24 @@ interface JsonSchemaToTsOptions {
201
202
  declare function jsonSchemaToTypescript(schemaJson: string, options?: JsonSchemaToTsOptions): string | {
202
203
  error: string;
203
204
  };
205
+ interface MergePatchResult {
206
+ result: unknown;
207
+ }
208
+ /**
209
+ * Apply an RFC 7396 JSON Merge Patch to a target value. A patch that is not
210
+ * itself a JSON object replaces the target wholesale (this is how arrays are
211
+ * replaced rather than merged element by element); a null-valued key in an
212
+ * object patch removes that key from the result.
213
+ */
214
+ declare function mergeJsonPatch(target: unknown, patch: unknown): unknown;
215
+ /**
216
+ * Apply an RFC 7396 JSON Merge Patch document to a target JSON document,
217
+ * both given as JSON strings, and return the merged result. Pure recursive
218
+ * merge, no external calls.
219
+ */
220
+ declare function applyJsonMergePatch(targetJson: string, patchJson: string): MergePatchResult | {
221
+ error: string;
222
+ };
204
223
 
205
224
  type json_ConvertOptions = ConvertOptions;
206
225
  type json_CsvOptions = CsvOptions;
@@ -214,6 +233,7 @@ type json_JsonPathResult = JsonPathResult;
214
233
  type json_JsonPointerResult = JsonPointerResult;
215
234
  type json_JsonSchemaLike = JsonSchemaLike;
216
235
  type json_JsonSchemaToTsOptions = JsonSchemaToTsOptions;
236
+ type json_MergePatchResult = MergePatchResult;
217
237
  type json_ParseStatus = ParseStatus;
218
238
  type json_PythonClass = PythonClass;
219
239
  type json_PythonField = PythonField;
@@ -221,6 +241,7 @@ type json_PythonMode = PythonMode;
221
241
  type json_ValidationError = ValidationError;
222
242
  type json_ValidationResult = ValidationResult;
223
243
  type json_ZodOptions = ZodOptions;
244
+ declare const json_applyJsonMergePatch: typeof applyJsonMergePatch;
224
245
  declare const json_csvToJson: typeof csvToJson;
225
246
  declare const json_detectFormat: typeof detectFormat;
226
247
  declare const json_diffJson: typeof diffJson;
@@ -239,6 +260,7 @@ declare const json_jsonToPython: typeof jsonToPython;
239
260
  declare const json_jsonToTypescript: typeof jsonToTypescript;
240
261
  declare const json_jsonToYaml: typeof jsonToYaml;
241
262
  declare const json_jsonToZod: typeof jsonToZod;
263
+ declare const json_mergeJsonPatch: typeof mergeJsonPatch;
242
264
  declare const json_minifyJson: typeof minifyJson;
243
265
  declare const json_parseJson: typeof parseJson;
244
266
  declare const json_parseStructs: typeof parseStructs;
@@ -250,7 +272,7 @@ declare const json_validateJsonPath: typeof validateJsonPath;
250
272
  declare const json_validateJsonString: typeof validateJsonString;
251
273
  declare const json_yamlToJson: typeof yamlToJson;
252
274
  declare namespace json {
253
- export { type json_ConvertOptions as ConvertOptions, type json_CsvOptions as CsvOptions, type json_DiffNode as DiffNode, type json_DiffType as DiffType, type json_GoField as GoField, type json_GoStruct as GoStruct, type json_JsonDiffResult as JsonDiffResult, type json_JsonParseResult as JsonParseResult, type json_JsonPathResult as JsonPathResult, type json_JsonPointerResult as JsonPointerResult, type json_JsonSchemaLike as JsonSchemaLike, type json_JsonSchemaToTsOptions as JsonSchemaToTsOptions, type json_ParseStatus as ParseStatus, type json_PythonClass as PythonClass, type json_PythonField as PythonField, type json_PythonMode as PythonMode, type json_ValidationError as ValidationError, type json_ValidationResult as ValidationResult, type json_ZodOptions as ZodOptions, json_csvToJson as csvToJson, json_detectFormat as detectFormat, json_diffJson as diffJson, json_evaluateJsonPath as evaluateJsonPath, json_formatDiffLine as formatDiffLine, json_formatJson as formatJson, json_generateExample as generateExample, json_getJsonStats as getJsonStats, json_inferGoType as inferGoType, json_inferPythonType as inferPythonType, json_inferType as inferType, json_jsonSchemaToTypescript as jsonSchemaToTypescript, json_jsonToCsv as jsonToCsv, json_jsonToGo as jsonToGo, json_jsonToPython as jsonToPython, json_jsonToTypescript as jsonToTypescript, json_jsonToYaml as jsonToYaml, json_jsonToZod as jsonToZod, json_minifyJson as minifyJson, json_parseJson as parseJson, json_parseStructs as parseStructs, json_resolveJsonPointer as resolveJsonPointer, json_toPascalCase as toPascalCase, json_toSnakeCase as toSnakeCase, json_validateJson as validateJson, json_validateJsonPath as validateJsonPath, json_validateJsonString as validateJsonString, json_yamlToJson as yamlToJson };
275
+ export { type json_ConvertOptions as ConvertOptions, type json_CsvOptions as CsvOptions, type json_DiffNode as DiffNode, type json_DiffType as DiffType, type json_GoField as GoField, type json_GoStruct as GoStruct, type json_JsonDiffResult as JsonDiffResult, type json_JsonParseResult as JsonParseResult, type json_JsonPathResult as JsonPathResult, type json_JsonPointerResult as JsonPointerResult, type json_JsonSchemaLike as JsonSchemaLike, type json_JsonSchemaToTsOptions as JsonSchemaToTsOptions, type json_MergePatchResult as MergePatchResult, type json_ParseStatus as ParseStatus, type json_PythonClass as PythonClass, type json_PythonField as PythonField, type json_PythonMode as PythonMode, type json_ValidationError as ValidationError, type json_ValidationResult as ValidationResult, type json_ZodOptions as ZodOptions, json_applyJsonMergePatch as applyJsonMergePatch, json_csvToJson as csvToJson, json_detectFormat as detectFormat, json_diffJson as diffJson, json_evaluateJsonPath as evaluateJsonPath, json_formatDiffLine as formatDiffLine, json_formatJson as formatJson, json_generateExample as generateExample, json_getJsonStats as getJsonStats, json_inferGoType as inferGoType, json_inferPythonType as inferPythonType, json_inferType as inferType, json_jsonSchemaToTypescript as jsonSchemaToTypescript, json_jsonToCsv as jsonToCsv, json_jsonToGo as jsonToGo, json_jsonToPython as jsonToPython, json_jsonToTypescript as jsonToTypescript, json_jsonToYaml as jsonToYaml, json_jsonToZod as jsonToZod, json_mergeJsonPatch as mergeJsonPatch, json_minifyJson as minifyJson, json_parseJson as parseJson, json_parseStructs as parseStructs, json_resolveJsonPointer as resolveJsonPointer, json_toPascalCase as toPascalCase, json_toSnakeCase as toSnakeCase, json_validateJson as validateJson, json_validateJsonPath as validateJsonPath, json_validateJsonString as validateJsonString, json_yamlToJson as yamlToJson };
254
276
  }
255
277
 
256
- export { jsonToGo as A, jsonToPython as B, type ConvertOptions as C, type DiffNode as D, jsonToTypescript as E, jsonToYaml as F, type GoField as G, jsonToZod as H, minifyJson as I, type JsonDiffResult as J, parseJson as K, parseStructs as L, resolveJsonPointer as M, toPascalCase as N, toSnakeCase as O, type ParseStatus as P, validateJson as Q, validateJsonPath as R, validateJsonString as S, yamlToJson as T, type ValidationError as V, type ZodOptions as Z, type CsvOptions as a, type DiffType as b, type GoStruct as c, type JsonParseResult as d, type JsonPathResult as e, type JsonPointerResult as f, type JsonSchemaLike as g, type JsonSchemaToTsOptions as h, type PythonClass as i, json as j, type PythonField as k, type PythonMode as l, type ValidationResult as m, csvToJson as n, detectFormat as o, diffJson as p, evaluateJsonPath as q, formatDiffLine as r, formatJson as s, generateExample as t, getJsonStats as u, inferGoType as v, inferPythonType as w, inferType as x, jsonSchemaToTypescript as y, jsonToCsv as z };
278
+ export { jsonToCsv as A, jsonToGo as B, type ConvertOptions as C, type DiffNode as D, jsonToPython as E, jsonToTypescript as F, type GoField as G, jsonToYaml as H, jsonToZod as I, type JsonDiffResult as J, mergeJsonPatch as K, minifyJson as L, type MergePatchResult as M, parseJson as N, parseStructs as O, type ParseStatus as P, resolveJsonPointer as Q, toPascalCase as R, toSnakeCase as S, validateJson as T, validateJsonPath as U, type ValidationError as V, validateJsonString as W, yamlToJson as X, type ZodOptions as Z, type CsvOptions as a, type DiffType as b, type GoStruct as c, type JsonParseResult as d, type JsonPathResult as e, type JsonPointerResult as f, type JsonSchemaLike as g, type JsonSchemaToTsOptions as h, type PythonClass as i, json as j, type PythonField as k, type PythonMode as l, type ValidationResult as m, applyJsonMergePatch as n, csvToJson as o, detectFormat as p, diffJson as q, evaluateJsonPath as r, formatDiffLine as s, formatJson as t, generateExample as u, getJsonStats as v, inferGoType as w, inferPythonType as x, inferType as y, jsonSchemaToTypescript as z };